[Galaxy Note 4 General] AnonVendetta:
[MENTION=10891995]prkfsz[/MENTION] and [MENTION=9546812]Mr. JAVI[/MENTION]: I've figured out a way to deodex and signature spoof patch services.jar, entirely on the phone and without a PC. It's very easy if you follow my instructions to the letter, may take about 30 mins at most.

Some notes:

1. Root required for some steps, use whatever you prefer

2. You need APKTool. It was originally designed to only work on PC. But some years ago someone made an Android version. That version is pretty much beta, old, and no longer supported, but you can find the files on Google Code archive website if you want it. There is a much newer APKTool for Android, by AndroBlack. Google it, you will find AndroidFileHost links. Use this:

https://androidfilehost.com/?fid=4349826312261827487

3. TWRP preferred, but not required

Now for the actual steps:

1. Install APKTool, then click its' icon and let it install again

2. Now open it again, grant storage permission

3. Open settings and enable keep screen on, wakelock, root. Also check "add apktool and option flags". And "install OpenJDK". Dont mess with anything else.

4. Exit APKTool. Click OpenJDK icon. Now just press home button. Copy services.jar and services.odex to your internal storage. Also make a backup copy of these in case you mess up. Now open APKTool again.

5. From APKTool, tap on services.odex, then "decompile odex".

6. Tap on services_odex folder, then 'recompile'

7. Tap on services.dex, and then 'add to jar'

8. Now you may notice that services.jar file size has changed. It is now deodexed, and patchable. As a general rule, if an APK/jar doesnt contain 1 or more classes.dex, then the file is odexed (i.e. not deodexed). However, this isnt always true. To check, open the file with Zarchiver (or another archiver app), see if classes.dex is in it.

9. Boot into TWRP, mount system partition. Delete /system/framework/oat/arm/services.odex, and /system/framework/services.jar. copy your modded serviced.jar to /system/framework/.

10. Open TWRP terminal, type the following:

chmod 0644 /system/framework/services.jar

chown 0:0 /system/framework/services.jar

These must be on 2 separate lines, press enter after each line. All letters must be lowercase. It wont tell you if it succeeded, but if either fails, you will get an error.

11. Reboot into Android

12. Download the Nanodroid patcher zip from this page:

https://downloads.nanolx.org/NanoDroid/Stable/

13. For this step, uninstall Magisk if you have it. Not just the app, but the whole thing. Use the Magisk uninstaller zip. The reason is because the ND patcher will try to install services.jar as a systemless Magisk module if it detects Magisk. By removing it, it will patch services.jar directly.

14. Mount system partition, run the ND patcher zip (leave it in internal storage Download folder) and just wait. Normally it wont take long, but I have seen waits of 15+ mins. It should succeed.

15. Delete any ND files/folders on the internal storage. You dont need the backup, since you already have one elsewhere. Delete any ND files in /data/adb folder. Delete any ND files from /system/addon.d folder.

16. Now you can reinstall Magisk if you want it

17. Reboot into Android

18. Download Signature Spoofing Checker from F-Droid website. Run it.

If everything is a go, you can install MicroG now, I wont detail that here. There are numerous methods, but it's not hard. If your device doesnt boot at any point in these steps, then you probably messed up somewhere. I did these steps, but slightly changed and with an older APKTool, everything worked.

You may note that in MicroG settings, "system supports location provider" isnt checked. You have 2 options to fix this. Either decompile framework-res.apk, make changes, recompile. Or install Xposed, then install this module:

https://repo.xposed.info/module/be.r3w6.intika.xposedunifiednlp

Xposed is the easier of the 2, and if you're going to use it anyway, then you might as well install this module.

If you dont care about MicroG location provider functionality, just ignore this, it isnt critical.

If you dont have TWRP, you can set services.jar permissions with a root file manager.

APKTool on Android can do many things like:

Decompile APK/jar, decompile odex, decompile boot.oat, build APK/jar files, etc. In the past I really only used it to decompile and make changes to APKs. You need to remember to resign APKs after recompiling them, Android requires signed APKs. This isnt usually necessary for jars. I use ZipSigner and APK Signer, and my own private key. Just use the APKTool app alot, explore the possibilities. I actually didnt discover the extended functions until about a week ago. Also check out how to use APKTool on a PC, there are some differences. Generally the PC versions are superior.

I would still recommend trying SuperR's Kitchen.

Hope this helps!