FORUMS
Remove All Ads from XDA
Post Reply Email Thread
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.
  • Documentation
    EVilTheme (Enhanced VillainROM Theme Engine) is an Android theming 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 /data/tmp
    • Copy the APKs to be themed to a backup folder inside /data/tmp
    • Delete specified files inside each APK, if any
    • Recurse the corresponding theme files into each APK using ZIP
    • Zipalign the themed APKs
    • Do a smart Dalvik wipe (detailed below)
    • Create a restore ZIP in /data/vrtheme-backup that will restore original, unthemed APKs when flashed
    • 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 them, thereby avoiding longer boot times caused by re-optimization of every single APK.

    The specific improvements of EVilTheme upon the original VRTheme Engine are enumerated below:
    • Easy restoration of original APKs via flashable ZIP
    • Zipalign process follows that on developer.android.com
    • Smart Dalvik wiping
    • Ability to delete files inside APKs
    • APKs are renamed to .zip first so zip can recurse correctly
    • Slightly better for-do looping, e.g.

    Code:
    Original VRTheme:
    busybox mkdir aligned
    for f in $(ls)
    do
    /sdcard/vrtheme/zipalign -f 4 $f    # zipalign will also attempt to align the 'aligned' folder
    done
    
    EVilTheme:
    for f in *.apk; do
    [ -e $f ] || break
    /tmp/zipalign -f -v 4 $f ./aligned/$f
    done
    • 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!

    What's in the engine?
    • busybox 1.21.1
    • zip
    • zipalign
    • installtheme.sh
  • Downloads
    Second post.
  • Source Code
    GitHub
  • Credits
    Quote:

    - 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

  • Notes
    • Tested on a Samsung Galaxy Express GT-I8730 running CyanogenMod 11.0 (CWM 6.0.5.3) and a Cherry Mobile One H940 running stock 6.0.1 (TWRP 2.8.7.0).
    DON'T edit anything in the ZIP except the beginning and end of updater-script to avoid code breakage on a per-device basis.
Thanks for reading, and don't forget to hit the Thanks button!
The Following 11 Users Say Thank You to aureljared For This Useful Post: [ View ] Gift aureljared Ad-Free
 
 
6th June 2014, 09:03 AM |#2  
aureljared's Avatar
OP Senior Member
Flag Quezon City
Thanks Meter: 574
 
Donate to Me
More
Arrow Downloads

Current Release(s)
v2.0.5: Link
Quote:

What's new?
* Add ability to delete files inside APK. We use bash for this, since bash (and not sh) has a built-in readarray function. Unfortunately this increases the size of theme ZIPs by a considerable amount, so we have to find a sh-compatible solution in the future.
* Use a single function for all theming processes
* Cleanup /tmp on exit
* Write to our own log
* Fix syntax errors

Thanks to @3lo0sh for the Android-compatible static Bash binary! Link to his thread here.

Old Releases (some are broken - use at your own risk)

v2.0.4: Link
Quote:

What's new?
* Add credit for Spannaa
* New way to check if ROM is Lollipop+
* More comments
* Non-verbose zipaligning
* Bring back preload app theming
* Recreate permissions for themed apps
* (Hopefully) fix the whole folder error thing
* Display more info about the app currently being themed: `sa`= app,
`sp`= priv-app, `pr`= preload, `fw`=framework
* Slightly tweaked zip syntax
* Fix syntax errors

v2.0.3: Link
Quote:

What's new?
* Fixed dex checking on pre-Lollipop ROMs
* Prevent mkdir errors on existing directories
* Fix cp errors regarding nonexistent destinations
* Explicitly tell cp to replace the original APK

v2.0.2: Link
Quote:

What's new?
* Wrapped every statement that has variables in quotes
* Tweaked zip syntax
* Bring back the VRTheme directory checking
* Be a bit more verbose about cleaning up
* Stop using $(ls) for looping apps
* Framework apps don’t have their individual directories, so don’t be
silly
* Removed useless variables and mkdir loop
* Fix incomplete statement in checkdex()
* Capture date and time much earlier in execution
* Stop using ==, some shells might not support it

v2.0.1: Link
Quote:

This release is the same as 2.0, except for a typo in updater-script that has been fixed.
I also manually compressed this one, since GitHub likes to put everything in one folder at the root of the ZIP download.

v2.0: Link
Quote:

This release has a typo in updater-script. This has been fixed in 2.0.1, but you can fix it yourself too.
What's new?
- Use /data for theming instead of /sdcard
- Removed support for sec_apps and preload
- cleanup.sh is now merged into installtheme.sh.
- Restoring old APKs is now as easy as flashing a ZIP. (Why didn't I think of that in the first place? Idea by @Spannaa.)
- installtheme.sh has been slimmed down a lot that it's barely recognizable
- Theming functions have now been updated to properly adapt to Lollipop's new app hierarchy (e.g. Settings.apk inside a folder named Settings, Mms.apk inside Mms...)

v1.5.1 beta 2: Link
Quote:

What's new?
- Increased POSIX shell compatibility

v1.5.1 beta 1: Link
Quote:

What's new?
- Lollipop /app and /priv-app theming support

v1.5: Link
Quote:

What's new?
- FIX: Bring back priv-app
- FIX: Correct paths for backup function
- CLEANUP: Use more variables for paths in /sdcard/vrtheme

v1.4: Link
Quote:

What's new?
- CLEANUP: Remove all traces of /data/app themeing
- FIX: Remove the placeholders that are also inside each folder in "new"
- FIX: Use full path in $(ls) during backup
- CLEANUP: Remove quotes from variables in 'if' statements, use == instead of -eq
- FIX: Reintroduce theme file check for system apps (IDK why this was missing in the first place)

v1.3: Link
Quote:

What's new?
- Support for KitKat's system apps in priv-app

v1.2: Link
Quote:

What's new?
- 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'

v1.1: Link
Quote:

What's new?
- 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.0: EnhancedVRTheme_template.zip
The Following 6 Users Say Thank You to aureljared For This Useful Post: [ View ] Gift aureljared Ad-Free
6th June 2014, 09:03 AM |#3  
aureljared's Avatar
OP Senior Member
Flag Quezon City
Thanks Meter: 574
 
Donate to Me
More
Tutorial
How to use EVilTheme

This guide is mainly intended for first-time VRTheme users, but feel free to read on if you're already an experienced themer.


How do I theme an app (or apps) using this engine?

Inside the ZIP, there are two folders that you can modify as needed; namely, new and vrtheme.
Your patches/theme files go in vrtheme, while APK files that you want to install onto the device go in new.

For example, you want to theme Settings.apk, which is located in /system/priv-app.
Let's say theme replaces res/drawable-hdpi/battery_icon_50.png in the APK, and also replaces classes.dex because you changed some SMALI files.
These are the steps you need to follow to make a flashable theme ZIP:
  1. Ensure you've downloaded the appropriate template ZIP from the second post. Make a folder somewhere you can remember and extract the ZIP there.
  2. The folder should now contain the folders META-INF, new, vrtheme, and engine; and also a script named restore-vr.sh. If they are located in a subfolder, move them onto the parent folder.
  3. Go into new and delete all ".gitignore" files in every subfolder. Do the same for vrtheme.
  4. In the vrtheme folder, go to system and make a new folder called priv-app. Inside it, make another folder called Settings.apk. Make sure you capitalized correctly!
  5. Now make folders as necessary, according to the location of the files you want to theme. For example, battery_icon_50.png is located in res/drawable-hdpi, so make a folder named res inside Settings.apk. Inside it, create a folder named drawable-hdpi, then paste your new battery_icon_50.png inside.
  6. Repeat step 5 until you've placed your theme files in their appropriate locations.
  7. When you're done, go back to the root folder of the theme (the one that contains new, vrtheme, etc.) and put all 5 objects in a ZIP file. You should use Deflate compression with compression level on Normal, but if your theme is huge, you can safely try compressing using Deflate and the level set to Ultra or whatever high level is available.
  8. If the recovery that the theme is intended to be used with requires signing, sign the ZIP now.
  9. Test your theme!

How do I delete files inside APKs to be themed?

To delete files, add the filenames to a text file named "delete.list" inside the APK theme folder.
This is an example of a delete.list:
Code:
res/drawable-hdpi/ic-launcher.png
res/drawable-xxhdpi/battery_full.9.png
This is what the contents of an example ZIP with delete.lists would look like:
Code:
theme.zip
   -- META-INF
   -- engine
   -- new
   -- vrtheme
       -- system
           -- app
               -- SystemUI.apk
                   -- delete.list
           -- framework
               -- framework-res.apk
                   -- delete.list
       -- vrtheme_restore.zip
The theme wasn't successful, and I believe that the problem lies in the engine itself.

Post here describing the problem. Be as descriptive as possible. I will ignore all bug reports without an attached logcat dump and/or recovery.log. I'll try to look into the problem when time permits.
I am just a student, not a full-time developer. I may not be able to provide a fix for some bugs, so feel free to help me and everyone else out. If you know how to work with Git, an upstream patch to the project would be highly appreciated


The theme was / wasn't successful, but I am stuck in a bootloop.

Try wiping your Dalvik cache. If the problem is still there, flash the restore zip in /data/vrtheme-backup and file a bug report. Include /cache/recovery.log and the latest .log file in /data/eviltheme-backup.


The theme was successful, but the app I was theming does not reflect my changes.

This is a tough one to solve. Try recompiling the APK itself with your theme files. If it works, it's either the problem lies in how you put the theme files in the ZIP, or maybe it's the script that's buggy. Try to make a ZIP again, following the instructions to the letter. If it still doesn't work, you can file a bug report here and attach your logcat dump, recovery.log, and (if you want) the themed APK.


The theme was successful, and now I'm ready to release my theme to the public.

All I ask for is some credit and a link back to this thread.


The theme wasn't successful, and I found a problem in your engine script(s).

If you're familiar with Git, you can make a pull request to the EVilTheme repository.
If you don't know how to use Git, you can just edit the script(s) you need and send me a PM containing the fixed script(s). I'll add you to the credits list in the first post if your bugfix is effective!


Things to remember:
  • As it seems, theming data apps were and still is broken in VRTheme and EVilTheme, because modifying the contents will break the signature.
  • Remember to properly edit .9.png files, or else you might get a bootloop!
  • You do not need to put theme files in a subfolder inside the main APK folder, e.g. system/priv-app/SystemUI/SystemUI.apk. EVilTheme automatically does that for you.

Happy Theming!
The Following 3 Users Say Thank You to aureljared For This Useful Post: [ View ] Gift aureljared Ad-Free
6th June 2014, 07:58 PM |#4  
Spannaa's Avatar
Recognized Contributor / Themer
Flag Cardiff
Thanks Meter: 15,011
 
Donate to Me
More
Great work

I particularly like the smart selective dalvik-cache wiping
Maybe it could be even smarter if the script only wipes an apk's dalvik-cache if the apk has had it's classes.dex replaced by the theme...

I'm working on something like this myself but mine is based on the unreleased GS2XFormROM by @hawkerpaul
I'll throw you a link when it's ready
The Following User Says Thank You to Spannaa For This Useful Post: [ View ] Gift Spannaa Ad-Free
6th June 2014, 09:10 PM |#5  
hawkerpaul's Avatar
Recognized Contributor
Flag UK
Thanks Meter: 6,317
 
Donate to Me
More
Quote:
Originally Posted by Spannaa

Great work

I particularly like the smart selective dalvik-cache wiping
Maybe it could be even smarter if the script only wipes an apk's dalvik-cache if the apk has had it's classes.dex replaced by the theme...

I'm working on something like this myself but mine is based on the unreleased GS2XFormROM by @hawkerpaul
I'll throw you a link when it's ready

Let me know if you need any help on the scripting side of things butty.


Sent from my GT-I9505G using XDA Free mobile app
The Following User Says Thank You to hawkerpaul For This Useful Post: [ View ] Gift hawkerpaul Ad-Free
6th June 2014, 11:00 PM |#6  
Spannaa's Avatar
Recognized Contributor / Themer
Flag Cardiff
Thanks Meter: 15,011
 
Donate to Me
More
Quote:
Originally Posted by hawkerpaul

Let me know if you need any help on the scripting side of things butty.

I will - cheers mate

Got it working but I'm sure you'd do a better job - .sh scripting isn't my thing at all.

Apologies to the OP for the OT...

Sent from my GT-I9300...
7th June 2014, 01:29 AM |#7  
aureljared's Avatar
OP Senior Member
Flag Quezon City
Thanks Meter: 574
 
Donate to Me
More
Quote:
Originally Posted by Spannaa

Great work

I particularly like the smart selective dalvik-cache wiping
Maybe it could be even smarter if the script only wipes an apk's dalvik-cache if the apk has had it's classes.dex replaced by the theme...

I'm working on something like this myself but mine is based on the unreleased GS2XFormROM by @hawkerpaul
I'll throw you a link when it's ready

Hmm, yes I think I'll implement this in v1.1. Thanks for the suggestion!

Sent from my GT-I8730 using Tapatalk
7th June 2014, 04:55 AM |#8  
aureljared's Avatar
OP Senior Member
Flag Quezon City
Thanks Meter: 574
 
Donate to Me
More
Version 1.1 released!

v1.1: Link
Quote:


What's new?
- 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

18th June 2014, 04:38 PM |#9  
Spannaa's Avatar
Recognized Contributor / Themer
Flag Cardiff
Thanks Meter: 15,011
 
Donate to Me
More
Quote:
Originally Posted by aureljared

Version 1.1 released!

v1.1: Link

How about making this TWRP compatible too - then it'd be even more useful

Reference 1
Reference 2
20th June 2014, 02:19 PM |#10  
aureljared's Avatar
OP Senior Member
Flag Quezon City
Thanks Meter: 574
 
Donate to Me
More
Quote:
Originally Posted by Spannaa

How about making this TWRP compatible too - then it'd be even more useful

Reference 1
Reference 2

Version 1.2 released!

v1.2: Link

Quote:

What's new?
- Refinements to Smart Dalvik Wipe
- Switch to Linus Yang's BusyBox 1.21.1, which will hopefully make theming 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'

Sent from my GT-I8730 using Tapatalk
The Following User Says Thank You to aureljared For This Useful Post: [ View ] Gift aureljared Ad-Free
14th July 2014, 04:10 PM |#11  
deuce_biggins's Avatar
Senior Member
Flag Detroit
Thanks Meter: 2,194
 
More
Quote:
Originally Posted by aureljared

Version 1.2 released!

v1.2: Link



Sent from my GT-I8730 using Tapatalk

Very good job on this...one thing, in kitkat 4.4.2 touchwiz roms half of the apps that need to be themed are in /system/priv-app. This folder location does not seem to be in your installtheme.sh script. I can manually change everything myself but if you would like other users to take advantage of your work, you may want to consider updating for these users.
The Following User Says Thank You to deuce_biggins For This Useful Post: [ View ] Gift deuce_biggins Ad-Free
Post Reply Subscribe to Thread

Tags
eviltheme, flash, recovery, theme, vrtheme

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

Advanced Search
Display Modes