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

Search This thread

djb77

Recognized Developer / Inactive RC
Oct 2, 2011
3,094
7,367
46
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

Inactive Recognized Themer
Nov 16, 2006
3,015
9,401
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 / Inactive RC
Oct 2, 2011
3,094
7,367
46
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,706
661
Google Pixel 4 XL
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 / Inactive RC
Oct 2, 2011
3,094
7,367
46
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.
 

qwer777

Senior Member
Jul 9, 2010
139
16
Could this be used to convert substratum themes to work systemlessly with magisk?

Sent from my Pixel using XDA Labs
 

djb77

Recognized Developer / Inactive RC
Oct 2, 2011
3,094
7,367
46
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.
 
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
76
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
76
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

Retired Senior Moderator
May 31, 2012
12,300
1
14,850
Gone
Google Nexus 4
Nexus 6
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
76
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
27
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
27
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
76
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:
 

Tulsadiver

Recognized Contributor
Jul 11, 2013
9,881
7,434
Google Pixel 7 Pro
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:

Top Liked Posts

  • There are no posts matching your filters.
  • 31
    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 :)
    3
    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
    3
    Hi, I have been relentlessly trying to decompile my SystemUIGoogle.apk to do edit XML files and recompile them to no avail (even the most minor of edits causes a "SystemUI has crashed" softbrick on my Pixel where I have to wipe my device. So EvilTheme Patcher seems like a godsend.

    Is there a definite workaround for the Google Pixel yet? I finally set my phone back up again after 2 days (I had to wipe everything, TWRP backups don't work with this phone either for some reason) so I would like to be 1,000% sure before trying it. Thank you so much!

    You still have to decompile, make your edits, then recompile your apks to use this. The thing that makes it great is you don't have to swap out your entire apk, just the parts you want to edit.

    For decompiling and recompiling, I use ticklemyandroid. For the Pixel, choose recompile with original signature for system apks and use new signature for non-system apks.

    I have a Pixel and Nexus 5X and I have it working for me. I have a thread in the themes section. You are welcome to try out my Pixel modded version and see if it works for you. It is an Aroma installer of my mods that creates a TWRP flashable Magisk Module on your sdcard.

    At the moment, this one does not work on the Pixel and it might not be practical to mod it to include the only dual slot phone.
    2
    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 :)
    2
    Hello,

    What do you mean by "naming convention"? I am on Nougat and would like to modify my anim Folder in framework-res.apk
    How did you achieve that?

    By normal naming convention I mean you put in your path just like it is, /system/priv-app/SystemUI/SystemUI.apk/res/drawable/qs_primary_background.xml. With the friendly naming convention you would put /system/priv-app/SystemUI.apk/res/drawable/qs_primary_background.xml (omitting the SystemUI folder from the path)

    Edit:. You would have to edit the installtheme.sh in the engine folder in order to mod the framework-res.apk and remove the "friendly" naming. Here is what I did. Just rename this file by taking the ".zip" off of it.