Good day to the whole XDA community!
If I am not mistaken, the VRTheme engine has been largely outdated since 2011/2012, and that there are a considerable amount of failures when using the engine - some of which include still-unthemed APKs, bootloops, and unzipaligned APKs.
So I've decided to improve a bit on the original VRTheme Engine, and this is the fruit of my work.
EVilTheme (Enhanced VillainROM Theme Engine) is an Android themeing platform meant for use with custom Android recoveries which allow replacement of application resources without the need to replace the whole app or use a new ROM. It is based on the original 2011 VRTheme Engine.
The process is as such:
• Mount filesystems
• Extract engine to /tmp
• Extract new files to /system and /data, if any
• Extract theme files to /sdcard
• Copy the APKs to be themed to /sdcard
• Recurse the corresponding theme files into each APK using ZIP
• Zipalign the themed APKs
• Do a smart Dalvik wipe (detailed below)
• Create a recovery script in /system that will restore original, unthemed APKs when executed
• Alert the user on how to use the script in case of bootloop
• Unmount filesystems
EVilTheme uses a selective kind of Dalvik wipe. Instead of deleting all .dex entries in /cache and /data, it looks for the themed APKs' specific dex files and deletes it, thereby avoiding longer boot times caused by optimization of all APKs present.
The specific improvements of EVilTheme upon the original VRTheme Engine is enumerated below:
• Enables easy restoration of original APKs via ADB
• Zipalign process follows that on developer.android.com
• Smart selective Dalvik wiping
• APKs are renamed to .zip first so zip can recurse correctly
• Slightly better for-do looping, e.g.
• Attempts to 'echo' status to the recovery UI are now done correctly, thanks to a ui_print-like custom-defined method. Now you don't have to wonder what the heck the recovery is doing now!
busybox mkdir aligned
for f in $(ls)
/sdcard/vrtheme/zipalign -f 4 $f # zipalign will also attempt to align the 'aligned' folder
for f in $(ls *.apk)
/tmp/zipalign -f -v 4 $f ./aligned/$f
What's in the engine?
• busybox 1.21.1
• v1.0: EnhancedVRTheme_template.zip
• v1.1: Link
• v1.2: Link
- Even smarter Dalvik wiping: delete dex files only for those apps whose classes.dex were changed (thanks @Spannaa)
- Corrected a typo in the restore script (please delete 'restore-vr' inside your /system/xbin, if any!)
- Removed unused methods in installtheme.sh
• v1.3: Link
- Refinements to Smart Dalvik Wipe
- Switch to Linus Yang's BusyBox 1.21.1, which will hopefully make themeing TouchWiz < 4.2 possible
- TWRP compatibility: switch to a static zipalign binary, grep method for OUTFD to look for updater binary
- Cleaner zip hierarchy: new apps to be installed to /system and /data are now in their respective folders in a folder named 'new'
- Support for KitKat's system apps in priv-app
- The VillainROM team for the original template. (I cleaned up the script but the credits are still there, does that count as being a douche? )
- @Chainfire for his method of printing to recovery UI from shell
• Tested on a Samsung Galaxy Express GT-I8730 running CyanogenMod 10.1.
• IDK if this will work on non-AOSP / pre-4.2 ROMs, test it out!
• DON'T edit anything in the ZIP except the beginning of updater-script to avoid code breakage on a per-device basis.
Thanks for reading, and don't forget to hit the Thanks :thumbsup: button!
If I helped you in any way, just hit the Thanks button!