FORUMS

Analysis & Opinion

Define Widgets in Custom ROMS

167 posts
Thanks Meter: 35
 
By hawkeyexp, Senior Member on 7th August 2010, 08:55 PM
Post Reply Subscribe to Thread Email Thread
3rd September 2011, 06:44 PM |#11  
3c's Avatar
Senior Member
Thanks Meter: 1,324
 
Donate to Me
More
Question Interested to know we can make it work?
FYI, the various data in the appwidgets.xml are as follows:

The <p/> tags are for listing which widget is using which package/class already installed... Order is important as it is referenced from the <g /> tags.

The <h/> tags lists all launcher installed, its package name and id. It seems custom launchers loaded from market have all an id of 400!

The <g/> tags are the actual widgets already added to a launcher/home screen,
it's ID is the dev ID used by apps, unique on a single device
the h= attribute is the launcher reference (0, 1, ...) from the <h/> tags above.
the p= attribute is the package ref (0, 1, ...) from the <p/> tags above.

That file is updated when an launcher/home screen app calls many Android API methods, including those:

allocateAppWidgetId() to get a new dev ID as mentioned above and link future <g> tags to an existing <h> tag.
The h tag is ALWAYS a reference to the package having called this method! No way to get a widget ID from another app for a particular launcher!

bindAppWidgetId(int appWidgetId, ComponentName provider) to link the <g> tag along with the <p> tag



Even tried ADW Launcher and its home-screen backup/restore but it fails to restore anything!? What a crap!


I personnally use 'System Tuner' which actually restores home screens, except the widgets! Is Titanium Backup able to restore home screens widget?


I've been messing around with the appwidgets.xml file manually to restore a widget... Unfortunately nothing worked.


Did anyone found more info on the subject?
 
 
12th October 2011, 01:28 AM |#12  
Junior Member
Thanks Meter: 6
 
More
Titanium Backup not restore widget......

Any news editing xml????
25th December 2011, 06:58 AM |#13  
YarsRevenge78's Avatar
Senior Member
Flag Pittsburgh, PA
Thanks Meter: 238
 
More
Merry Xmas everyone! I finally got this to work with ADW.Launcher.

After setting up my widgets, icons, and ADW settings, I copied a couple of the files from "/data/data/org.adw.launcher" into a backup dir, and used an init.d script to replace the default files. The script deletes itself to make sure it only runs on the very first boot.

I had to experiment forever to get the right sleep time. This script needs to sleep for 45 seconds minimum in order to let ADW finish before it can swap the files. If you are using this with another launcher, you might need to change the sleep time.

Code:
#!/sbin/busybox sh

# THE SCRIPT MUST WAIT A MIN OF 45 SECONDS OR ELSE IT WILL NOT WORK
sleep 45
if [ -d "/data/data/org.adw.launcher-backup/" ]; then
	# RESTORE WIDGETS AND ICONS
        rm "/data/data/org.adw.launcher/databases/launcher.db-wal"
	cp "/data/data/org.adw.launcher-backup/databases/launcher.db-wal" "/data/data/org.adw.launcher/databases/launcher.db-wal"
        
        # RESTORE ADW SETTINGS
	rm "/data/data/org.adw.launcher/shared_prefs/launcher.preferences.almostnexus.xml"
	cp "/data/data/org.adw.launcher-backup/shared_prefs/launcher.preferences.almostnexus.xml" "/data/data/org.adw.launcher/shared_prefs/launcher.preferences.almostnexus.xml"

        # RESTART LAUNCHER
	killall android.process.acore

        # DELETE THIS SCRIPT TO MAKE SURE IT DOESN'T RUN AGAIN
	rm /system/etc/init.d/98adwreset
fi
The Following 2 Users Say Thank You to YarsRevenge78 For This Useful Post: [ View ]
25th December 2011, 09:42 AM |#14  
3c's Avatar
Senior Member
Thanks Meter: 1,324
 
Donate to Me
More
Quote:
Originally Posted by DieHappy

Merry Xmas everyone! I finally got this to work with ADW.Launcher.

After setting up my widgets, icons, and ADW settings, I copied a couple of the files from "/data/data/org.adw.launcher" into a backup dir, and used an init.d script to replace the default files. The script deletes itself to make sure it only runs on the very first boot.

I had to experiment forever to get the right sleep time. This script needs to sleep for 45 seconds minimum in order to let ADW finish before it can swap the files. If you are using this with another launcher, you might need to change the sleep time.

Great finding! I'll try to integrate that into System Tuner asap! That would be awesome to have a way to restore launchers setup. All I managed so far is to restore a launcher's icons, without widget, but with that might be able to restore the widgets too
26th December 2011, 05:16 AM |#15  
YarsRevenge78's Avatar
Senior Member
Flag Pittsburgh, PA
Thanks Meter: 238
 
More
I have not tested this out yet, but I'm pretty sure you can rename "/sdcard/adw_settings.xml" to "/data/data/org.adw.launcher-backup/launcher.preferences.almostnexus.xml" if you are using the ADW.Launcher settings backup.restore.

Likewise with renaming "/sdcard/adw_launcher.db" to "/data/data/org.adw.launcher-backup/launcher.db-wal". This file has an extension of .db-wal, but it is most likely the exact same file. I will have to test this out sometime to make sure.

I also wanted to point out that you only want to copy "launcher.preferences.almostnexus.xml" and "launcher.db-wal". Don't just delete /data/data/org.adw.launcher and replace the entire directory with your backup. If you do this it will just force close and probably delete the directory and recreate it again.

Does anyone else know what files to backup and restore from other launchers?

---------- Post added at 12:16 AM ---------- Previous post was at 12:08 AM ----------

Quote:
Originally Posted by 3c

Great finding! I'll try to integrate that into System Tuner asap! That would be awesome to have a way to restore launchers setup. All I managed so far is to restore a launcher's icons, without widget, but with that might be able to restore the widgets too

If the widgets didn't come with the rom, you would have your program backup and restore the .apk files too. Fancy Widgets didn't seem to work right on a custom rom I was messing around with, I think because when ADW reset it knew where to place Fancy Widgets which had not yet run so it wasn't functional yet. Perhaps backing up this widgets /data/dir might do the trick, but I'm not sure.

ADW appears to delete and re-create the "/data/data/org.adw.launcher" dir if it exists when the program runs for the first time. This is the reason why I had to sleep for 45 seconds before replacing the files and restarting the launcher. If this is how all programs/widgets work, then using my method probably won't work on the settings for those files because they won't run automatically like the launcher does.
3rd March 2012, 12:50 AM |#16  
LastOttoman's Avatar
Senior Member
Thanks Meter: 190
 
Donate to Me
More
scripts/check_binaries: line 12: clear: command not found
scripts/check_binaries: line 12: clear: command not found

why do i get this error please help me ...

i have been searchin about all post but i did not find any answer tenkss ...
7th March 2012, 02:20 PM |#17  
Senior Member
Flag Christchurch
Thanks Meter: 69
 
More
Just decompile the launcher's APK and edit the default_homescreen.XML (it will have a different filename for different launchers). Recompile and sign. Done :)

Sent from my GT-I9100 using xda premium
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes