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

djb77

Recognized Developer / Contributor
Oct 2, 2011
3,093
7,355
0
43
NSW
github.com
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 :)
 

stangdriver44

Recognized Themer
Nov 16, 2006
3,015
9,401
0
Cali
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
 

djb77

Recognized Developer / Contributor
Oct 2, 2011
3,093
7,355
0
43
NSW
github.com
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 :)
 

dimm0k

Senior Member
Jan 25, 2014
1,529
591
133
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
 

djb77

Recognized Developer / Contributor
Oct 2, 2011
3,093
7,355
0
43
NSW
github.com
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.
 

djb77

Recognized Developer / Contributor
Oct 2, 2011
3,093
7,355
0
43
NSW
github.com
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.
 

Th3 Ant

Senior Member
Mar 22, 2013
470
196
73
Częstochowa
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
 

drei.liter.milch

Senior Member
Dec 27, 2016
155
75
0
Mönchengladbach
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.
 

drei.liter.milch

Senior Member
Dec 27, 2016
155
75
0
Mönchengladbach
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?
 
Last edited:

Didgeridoohan

Forum Moderator / Developer Relations
Staff member
May 31, 2012
10,950
10,720
253
Gothenburg
Started another try to replace some icons. did not work. am I missing something or is this template just crap?
anybody who got this working?
That was a bit rude.

Edit: better to give some details on what you've actually done, maybe even upload your files. Easier to find any faults on your side or possible bugs that way.
 
  • Like
Reactions: drei.liter.milch

drei.liter.milch

Senior Member
Dec 27, 2016
155
75
0
Mönchengladbach
That was a bit rude.

Edit: better to give some details on what you've actually done, maybe even upload your files. Easier to find any faults on your side or possible bugs that way.
yes ok, the word "crap" maybe was a little bit over the top. i'm sorry for that. I just would like to know, if anybody can report this module/template as working. If so, I would go on looking for the error on my side.

I've actually followed exactly the guide given in OP. (It seems not that tricky to me)
-placed folder tree system/framework/framework-res.apk/res/drawable-xxhdpi-v4/ in the eviltheme-folder and put my default_wallpaper.jpg file in drawable-xxhdpi-v4 folder
-edited module.prop und config.sh
-zipped the whole template folder
-installed via magisk manager
-rebooted

tried with to different phones, beta and official magisk (see my first post)
I'll reproduce my logs and attach them later.

anyway thanks for the hint
 
  • Like
Reactions: Didgeridoohan

shekhawat2

Member
Jul 9, 2015
40
150
63
24
Jaipur
yes ok, the word "crap" maybe was a little bit over the top. i'm sorry for that. I just would like to know, if anybody can report this module/template as working. If so, I would go on looking for the error on my side.

I've actually followed exactly the guide given in OP. (It seems not that tricky to me)
-placed folder tree system/framework/framework-res.apk/res/drawable-xxhdpi-v4/ in the eviltheme-folder and put my default_wallpaper.jpg file in drawable-xxhdpi-v4 folder
-edited module.prop und config.sh
-zipped the whole template folder
-installed via magisk manager
-rebooted

tried with to different phones, beta and official magisk (see my first post)
I'll reproduce my logs and attach them later.

anyway thanks for the hint
Flash Via Recovery, it may work. didnt work for me when i installed from magisk manager.

btw i have a question, is there any way to remove a file from the apk?
 
  • Like
Reactions: drei.liter.milch

shekhawat2

Member
Jul 9, 2015
40
150
63
24
Jaipur
thx, i'll try that. which magisk-version do you use? and i guess maybe you can remove a file by placing a dummy.
No brother, I want to delete the file, not to replace it with dummy file. Replacing with dummy file will give system ui FCs.
I saw something delete.list in the installtheme.sh, but I don't know how to use it. If anyone can help, pls help me.:eek:
BTW I am using Magisk v12.
 

drei.liter.milch

Senior Member
Dec 27, 2016
155
75
0
Mönchengladbach
No brother, I want to delete the file, not to replace it with dummy file. Replacing with dummy file will give system ui FCs.
I saw something delete.list in the installtheme.sh, but I don't know how to use it. If anyone can help, pls help me.:eek:
BTW I am using Magisk v12.
Ok, I see. Perhaps you find sth about it in the vrtheme-topic. Btw. flashing in recovery doesn't work either. I'm not messing around with this anymore and continue using flipster :good:
 

i23u8

Senior Member
Jul 24, 2015
400
129
0
Manila
Where can we download? I want to change Viber's background to pure black so I will change the AndroidManifest. Will this theoretically work?
 

Tulsadiver

Recognized Contributor
Jul 11, 2013
7,841
5,539
253
I was wondering what, if anything, I would need to change for this to work on a pixel. On Pixel's, the install path is system/system. I couldn't tell whether or not this could detect the correct path on its own.

Edit: Never mind. I got it to work.
 
Last edited: