[Sony Xperia X Compact Guides, News, & Discussion] levone1:
Been messing around trying to figure this out for a while, and finally got it, (O is kind of a different animal than previous versions), so thought I'd share...

Need:

- root

- deodexed apps, (maybe). Apktool needs framework-res and SystemUI to be imported as framework, in order to function properly. I deodexed my SystemUI apk for that purpose, but might not be necessary. As far as modifying, Apktool can decompile resources of an odex apk which you can modify and recompile. You can replace whatever particular apps you want with deodexed ones, if odex isn't working out. TOAD deodexer by Ticklefish works great for O.

- superuser mod, (disable signature verification). Typically not hard to do with Xposed, but no working Xposed for us atm, so need to patch services.jar. There's more than one way to do it, but simplest thing at this point is probably smali.patcher Magisk module. I attached my services.jar, but be aware that it is deodexed, so if you are using it on stock odex rom, (like I am), you need to copy the file to your phone storage, then go to recovery file manager, and delete your services.jar, and also services.odex, services.vdex, and services.art from /system/framework/oat/arm64. Then copy the new services.jar to /system/framework, and set permissions 644. I'm pretty sure smali patcher can do it on odex no problem.

- Selinux permissive. More than one way to do it. I used Magisk module.

-ApktoolX 8 installer by Androblack - https://androidfilehost.com/?fid=1322778262904013039

- Mixplorer, with archive and signer add-ons.

- good text editor. Mixplorer has a pretty good code editor built in, but still not as solid as QuickEdit by Rhinosoft.

1. Install ApktoolX installer. First thing that pops up when you open it is 'install ApktoolX', so then do that. Then open the app, and go to settings, and check 'root', then exit the app, and reopen it, and grant root. Then go back to settings and select 'install openjdk'. After it installs, open it and you will see a message 'openjdk is running'.

2. Make a directory somewhere called 'apktool' or something, and copy /system/framework/framework-res.apk and /system/priv-app/SystemUI/SystemUI.apk to it, plus any other apks you want to modify. Open ApktoolX, go to apktool directory, and click on framework-res.apk and SystemUI.apk and select 'import as framework'. Now Apktool is set up.

3. Decompile, modify, and recompile whatever you want. After recompile, you will get a new apk called (app)_src.apk. This needs to be signed.

4. Open Mixplorer, and long-press on the ...src.apk app and choose 'sign > auto' from the three-dot menu. There will be a new apk created called (app)_src_sign.apk. This is ready to push to system. Note that ApktoolX also has a signing feature, which might do the same thing. I don't know for sure what signature it uses or if it's the same as what Mixplorer does. Test it if you want.

5. Delete your stock app, (back it up first if you're smart), and replace it with the new one. Rename the new one to the same as the original, (just because). Best to do this in recovery, but you can actually replace system apps while booted, (except for framework res), and just force stop the app in Settings and reopen it.

I've attached deodexed SystemUI and patched Services.jar, (including superuser mod, and signature spoof for MicroG), both from 34.4.A.118

Also, here's my dark-mod apks if anyone wants, (see screenshots). Note that there may be some bugs, (mainly some dark-on-dark icons, but I also know that 'system icons' option in display settings causes fc, because of some framework-res mod, [not really a problem since SystemUI tuner works fine]). I may or may not bother trying to fix them. Use as-is if you want.

Update - fixed most of the black-on-black, and fixed the System Icons Settings function. New zip linked

https://mega.nz/#!l10wFaqA!GfZEPcSwo3Ek3gZyCE64JXj2U45Yp3qhCxvDxIMDtbc

Apks are deodexed, so if you're replacing your odexed ones, make sure to delete oat folder.