FORUMS
Remove All Ads from XDA

[MOD][TEMPLATE] Magisk Module Template with EvilTheme Patcher

2,813 posts
Thanks Meter: 4,872
 
By djb77, Recognized Developer / Contributor on 17th April 2017, 05:20 AM
Post Reply Email Thread
Hello everyone.

This is a little mod to the Magisk Module Template that allows you to patch APK files on-the-fly and have them created as a Magisk Module.

For example, you could have a modified camera module for your ROM, where this patcher would replace the classes.dex file with mods, then pack that as a Magisk Module, using the original file found in the /system (ROM)

For some of the devs that have been around for a while, you would be aware of the old VRTheme modding system, which would allow you to patch files on-the-fly. EvilTheme is basically a newer version of that, so combined with Magisk can be very useful

Here's what this module CAN do:
  • Replace resources.arsc, classes.dex, AndroidManifest.xml, and META-INF folder
  • Replace compiled res folders / files

Here's what this module CAN'T do:
  • Replace files in res/values or smali folders

How to use EVilTheme
(Example using /system/priv-app/SecSettings2.apk)
  • In the eviltheme folder, go to system and make a folder called priv-app. Inside it, make another folder called SecSettings2.apk
  • 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 SecSettings2.apk.
    Inside it, create a folder named drawable-hdpi, then paste your new battery_icon_50.png inside.
  • Repeat step 2 until you've placed your theme files in their appropriate locations.
  • When you're done, go back to the root folder of the theme (the one that contains eviltheme, engine, etc.) and put all the 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.
  • Test your mod.

For information regarding the Magisk Module subbmision etc, please read the information HERE


Link to Github Repository: HERE

Enjoy
The Following 25 Users Say Thank You to djb77 For This Useful Post: [ View ]
 
 
17th April 2017, 05:48 AM |#2  
stangdriver44's Avatar
Recognized Themer
Flag Cali
Thanks Meter: 9,004
 
Donate to Me
More
Nice! Sounds interesting!

I've been using vrtheme for years and even contacted spanna aabout adapting the script to achieve modding of live system files this eliminating the need for recovery zips and even Aroma!

So I have a question about the use and locations of the asset files.

Would it be possible to change, at least the location from which the files get pulled from and placed into the execute folders?

So basically could it be set to pull the image/resource, whatever file from either a data folder or my preference, sd storage?

I've used an asset folder built into my system for similar commands, but with enough options and large files the system partition can get extremely crowded.

Does my question make sense?

Basically i would like to eliminate a big section of my packed 2gb Aroma zip. About 700mb is all vrtheme injected compiled files.

Either way I will definitely be looking into this!

Thanks
The Following 3 Users Say Thank You to stangdriver44 For This Useful Post: [ View ] Gift stangdriver44 Ad-Free
17th April 2017, 05:59 AM |#3  
djb77's Avatar
OP Recognized Developer / Contributor
Flag NSW
Thanks Meter: 4,872
 
Donate to Me
More
Quote:
Originally Posted by stangdriver44

Nice! Sounds interesting!
I've been using vrtheme for years and even contacted spanna aabout adapting the script to achieve modding of live system files this eliminating the need for recovery zips and even Aroma!
So I have a question about the use and locations of the asset files.
Would it be possible to change, at least the location from which the files get pulled from and placed into the execute folders?
So basically could it be set to pull the image/resource, whatever file from either a data folder or my preference, sd storage?
I've used an asset folder built into my system for similar commands, but with enough options and large files the system partition can get extremely crowded.
Does my question make sense?
Basically i would like to eliminate a big section of my packed 2gb Aroma zip. About 700mb is all vrtheme injected compiled files.
Either way I will definitely be looking into this!
Thanks

You could, but you would have to look at update-binary and installtheme.sh, then modify it for your needs. So instead of copying the modded files from the flashable zip, you would just have to remove the unzip function and change the path of where they are unzipped to to the location of where the files are on your data partition.

Give it a try
The Following 2 Users Say Thank You to djb77 For This Useful Post: [ View ]
19th April 2017, 04:19 PM |#4  
Senior Member
Thanks Meter: 302
 
More
so with this I can technically change the rotation of an app without ever messing with the apk? I've tried editing the AndroidManifest.xml, but after editing I've never been successful putting it back into the apk
19th April 2017, 06:24 PM |#5  
djb77's Avatar
OP Recognized Developer / Contributor
Flag NSW
Thanks Meter: 4,872
 
Donate to Me
More
Quote:
Originally Posted by dimm0k

so with this I can technically change the rotation of an app without ever messing with the apk? I've tried editing the AndroidManifest.xml, but after editing I've never been successful putting it back into the apk

If you plan to change androidmanifest.xml you will have to include the newly created META-INF folder for it too.
20th April 2017, 03:13 AM |#6  
Senior Member
Thanks Meter: 14
 
More
Could this be used to convert substratum themes to work systemlessly with magisk?

Sent from my Pixel using XDA Labs
20th April 2017, 02:34 PM |#7  
djb77's Avatar
OP Recognized Developer / Contributor
Flag NSW
Thanks Meter: 4,872
 
Donate to Me
More
Quote:
Originally Posted by qwer777

Could this be used to convert substratum themes to work systemlessly with magisk?

Sent from my Pixel using XDA Labs

If you're talking about pre-packaged APK theme files, no it probably won't work, as they still need to be installed.
This is more for files that are already installed that require patching.
21st April 2017, 11:39 AM |#8  
Nice work

Got one question - is it possible to modify classes.dex if .apk file is not in system folder? I mean for example, if system app gets updated, it creates new folder in data/app/ with the name of the package and with either -1, -2 or whetever number at the end (ex. data/app/com.google.android.youtube-2).

Do I need to just integrate update into system and then modify it? Or just create new folder in eviltheme one with data/... instead of system/...?

Thanks :P
21st April 2017, 02:54 PM |#9  
Member
Flag Düsseldorf
Thanks Meter: 37
 
More
I tried to modify system/framework/framework-res.apk/res/drawable-xxhdpi-v4/default_wallpaper.jpg, but unfortunately it did not work. Neither on InFocus M808/mod stock 6.0(mt6753) nor on SamsungS5Neo/mod stock 6.0.1(exynos7580)
Both tried with official Magisk 12.0 and newest beta.
22nd April 2017, 04:30 AM |#10  
Senior Member
Thanks Meter: 437
 
More
nevermind i didn't read all the way
22nd April 2017, 04:06 PM |#11  
Member
Flag Düsseldorf
Thanks Meter: 37
 
More
Quote:
Originally Posted by drei.liter.milch

I tried to modify system/framework/framework-res.apk/res/drawable-xxhdpi-v4/default_wallpaper.jpg, but unfortunately it did not work. Neither on InFocus M808/mod stock 6.0(mt6753) nor on SamsungS5Neo/mod stock 6.0.1(exynos7580)
Both tried with official Magisk 12.0 and newest beta.

Started another try to replace some icons. did not work. am I missing something or is this template just faulty?
anybody who got this working?
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