For anyone who had no success with this project, I rebuilt the google.xml without the battery whitelist line (based on this post on Stackexchange) and put it in a super simple Magisk module. It's not advanced at all like this project is (my module is just a simple text file in "system"), but this is what worked for me. And maybe does for some other people too.
Edit: I got a helpful message regarding this and need to say, this works only if the original config file is on /system. But it it typically the case on custom ROMs and if you flashed something like OpenGapps (which is the case for me and where it worked).
Edit2: I noticed thanks to MatLog in logcat that Google Play Services is not happy and keeps exiting some services due not getting its special exception. I'm not sure if I should keep this file up or if the original GMS Doze project from OP can create the same side effect. But please proceed with caution and test if this works correctly!
gxml=$(find /system/ /system_ext/ /product/ /vendor/ -iname "google.xml" -print | head -n 1 | sed 's|/[^/]*$||') ui_print "google.xml found at: $gxml" ui_print "creating directory: $MODPATH$gxml" mkdir -p "$MODPATH$gxml" ui_print "copying $gxml/google.xml to $MODPATH$gxml/" cp -af "$gxml/google.xml" "$MODPATH$gxml/google.xml" ui_print "modifying $MODPATH$gxml/google.xml" sed -i 's/<allow-in-power-save package=\"com.google.android.gms\" \/>/<!-- & -->/g' "$MODPATH$gxml/google.xml"
I installed the magisk module, found that notifications (from apps like Discord) no longer work, but then the GMS services are still disabled. I tried to re-enable via adb shell pm, but it says that the shell cannot change component state. How do I properly uninstall this and reverse all changes the module made? Thanks.
1/ test with modified gloeyisk GMS Doze after having added the path /system_ext/ to the lines you've highlighted: from 100% battery to 59% in 5 hours while not using the phone at all, Google Play Services totaling 32% of "battery usage since full charge". And if I go to the Battery Optimization menu I can see that battery optimization is still not available for Google Play Services. Result: no benefits.
2/ test with your GMS Doze Simplified : "battery optimization not available" for Google Play Services. Now fully charging to test again and I will modify this message if the results are different but I'm not so hopeful.
Apart of re-flashing phone from scratch with AospExtended and BiTGApps (or any already optimized GApp) rather than FlameGApps, I see no solution...
Thank youUniversal GMS Doze Overview: - Optimized and adjusted Google Play services. - Support API 23 or later. - Support Magisk Live or Custom Recovery installations. Contents: - Base extensions module: 1.8.4 (0830) code: 184 Credits: - @topjohnwu /...forum.xda-developers.com
Just for info, tested BiTGapps on AospExtended but a fake error tells me that it's impossible to install it on ROMs that include GApps, while it's a pure Vanilla ROM. Tested again for one week with AEX + OpenGApps Pico + GMS Doze module and... GMS Doze module is working (I can enable battery optimization on Google Play Services and other Google apps, could have been great) but this f*****g Google Play Services app continues to crazily eat my battery energy... 106% of use now for example. My phone was charged at 50% yesterday night before going to sleep, I've enabled the airplane mode and stopped location services, and at wake up 7 hours later it was shut down out of battery. I'm so tired of this never ending issue, the ROM is great but seems unusable this way
> su > gmsc
> su > dumpsys deviceidle
> su > cd /data/data > find . -type f -name '*gms*' -delete
> su > pm disable com.google.android.gms/ com.google.android.gms.mdm.receivers.MdmDeviceAdminReceiver