[MODULE] Universal GMS Doze

Search This thread

Zaxx32

Senior Member
Mar 23, 2019
486
177
Morgantown
Moto G5 Plus
Moto G7
I don't have it installed on my new phone yet. Got burned by the A13 ARB bs...they 'repaired' it and sent it back to me with a dead fingerprint reader. I then raised serious hell, again, and got a brand new phone. I'm a bit too rusty re: Servicely to just go off the top of my head. Maybe google round a bit. I'll have it back in soon tho...😉
 
  • Like
Reactions: rodken

x_berzerker

Senior Member
Dec 19, 2010
111
17
Moto G5
Asus ZenFone 3 Zoom
You can:

1) Unzip the module
2) Open customize.sh

Add /system_ext/ to the paths in the lines:

# Patch the XML and place the modified one to the original directory
ui_print "- Patching XML files"
gms=$(xml=$(find /system/ /product/ /vendor/ -iname "*.xml");for i in $xml; do if grep -q 'allow-in-power-save package="com.google.android.gms"' $ROOT$i 2>/dev/null; then echo "$i";fi; done)
ims=$(xml=$(find /system/ /product/ /vendor/ -iname "*.xml");for i in $xml; do if grep -q 'allow-in-power-save package="com.google.android.ims"' $ROOT$i 2>/dev/null; then echo "$i";fi; done)
pst=$(xml=$(find /system/ /product/ /vendor/ -iname "*.xml");for i in $xml; do if grep -q 'allow-in-power-save package="com.google.android.apps.safetyhub"' $ROOT$i 2>/dev/null; then echo "$i";fi; done)
trb=$(xml=$(find /system/ /product/ /vendor/ -iname "*.xml");for i in $xml; do if grep -q 'allow-in-power-save package="com.google.android.apps.turbo"' $ROOT$i 2>/dev/null; then echo "$i";fi; done)


aka

# Patch the XML and place the modified one to the original directory
ui_print "- Patching XML files"
gms=$(xml=$(find /system/ /system_ext/ /product/ /vendor/ -iname "*.xml");for i in $xml; do if grep -q 'allow-in-power-save package="com.google.android.gms"' $ROOT$i 2>/dev/null; then echo "$i";fi; done)
ims=$(xml=$(find /system/ /system_ext/ /product/ /vendor/ -iname "*.xml");for i in $xml; do if grep -q 'allow-in-power-save package="com.google.android.ims"' $ROOT$i 2>/dev/null; then echo "$i";fi; done)
pst=$(xml=$(find /system/ /system_ext/ /product/ /vendor/ -iname "*.xml");for i in $xml; do if grep -q 'allow-in-power-save package="com.google.android.apps.safetyhub"' $ROOT$i 2>/dev/null; then echo "$i";fi; done)
trb=$(xml=$(find /system/ /system_ext/ /product/ /vendor/ -iname "*.xml");for i in $xml; do if grep -q 'allow-in-power-save package="com.google.android.apps.turbo"' $ROOT$i 2>/dev/null; then echo "$i";fi; done)

3) zip the files in the root of the modules folder back up, and flash and test


OR

You can try my simpler GMS Doze module (added the /system_ext/ path just now)

It doesnt do as much as gloeyisk's, but it uses the "original" method as described here (this is the OG of doze tweaks)

aka it merely comments out

<allow-in-power-save package="com.google.android.gms" />

to

<!-- <allow-in-power-save package="com.google.android.gms" /> -->

my common/install.sh (i use MMT-Ex module format):

Bash:
gxml=$(find /system /system_ext /product /vendor -iname "google.xml" -print | head -n 1 | sed 's|/[^/]*$||')
ui_print "google.xml found at: $gxml"
root_folder=$(echo $gxml | cut -d "/" -f2)
if [ "$root_folder" == "system" ]; then
#remove the /system folder so we can use the same code beyond for all paths
finalgxmlpath=$(echo $gxml | cut -d "/" -f3,4)
else
#add /system folder prefix for product, system_ext and vendor paths
finalgxmlpath="system/$root_folder/etc/sysconfig"
fi
ui_print "creating directory: $MODPATH/$finalgxmlpath"
mkdir -p "$MODPATH/$finalgxmlpath"
ui_print "copying $gxml/google.xml to $MODPATH/$finalgxmlpath"
cp -af "$gxml/google.xml" "$MODPATH/$finalgxmlpath"
ui_print "modifying $MODPATH/$finalgxmlpath/google.xml"
# add <!=== prefix and --> suffix around relevant line in google.xml
sed -i 's/<allow-in-power-save package=\"com.google.android.gms\" \/>/<!--  &  -->/' "$MODPATH/$finalgxmlpath/google.xml"

what it does (similar to above, though different): finds the first google.xml it can in the paths:
/system/
/system_ext/
/product/
/vendor/

copies the google.xml to the modules correct folder, either:
/system
/system/system_ext
/system/product
or
system/vendor

and then uses sed to add a <--- prefix and ---> suffix to the relevant line

thats all it does. for those who have issues with main GMS Doze module, you may like to try this simpler one. I made it (in 30 seconds) in response to a members question on here, and only up till now shared it with him privately. It resolved the issue was personally having, ymmv

attached....

never be afraid to open up a script and look for ways to customize it to your needs, its often easily to figure out how to add/change a path...its hard to hose your device with a magisk module, even if you bootloop it, its fixable....
1.8.7 worked on my lavender lineage R, but not on wife's sweet arrow os S.
this simplified didn't work on mine, but fixed my wife's. thanks!
 
  • Like
Reactions: 73sydney

SnoOkilow

Member
Jul 20, 2017
8
5
As youve discovered... others might now (finally), this is very much down to the ROM...its just easier to blame the modules...
I completely replaced the contents of the line in the 1.8.7 directory "# Patch the XML and place the modified one to the original directory" with the directory from 1.8.6 and got a working 1.8.7 module. These aren't bad ROMs, they're a bad new detection method (Improved XML patching logic)
 
Last edited:
  • Like
Reactions: 73sydney

73sydney

Senior Member
I completely replaced the contents of the line in the 1.8.7 directory "# Patch the XML and place the modified one to the original directory" with the directory from 1.8.6 and got a working 1.8.7 module. These aren't bad ROMs, they're a bad new detection method (Improved XML patching logic)

Nice find but i think it still works for some?

I dont monitor changes in the module as i use my own simplified module

if you think its worth it, attach and the file here OR perhaps fork the repo and make the changes OR share the changed file that works and i may fork it on my github and have others test

fwiw i have also updated my own GMS Simplified module after i discovered a case where the path was failing

attached here
 

Attachments

  • GMS Doze Simplified.v1.3.zip
    16.3 KB · Views: 9
Last edited:

73sydney

Senior Member
1.8.7 worked on my lavender lineage R, but not on wife's sweet arrow os S.
this simplified didn't work on mine, but fixed my wife's. thanks!

You might want to read the previous few posts, including mine (both seemed to have path issues) and as you may an older version of my module, its attached to the post above here (remove older one before applying if you use mine):


The main module may get an update so stay tuned
 
  • Like
Reactions: SnoOkilow

x_berzerker

Senior Member
Dec 19, 2010
111
17
Moto G5
Asus ZenFone 3 Zoom
You might want to read the previous few posts, including mine (both seemed to have path issues) and as you may an older version of my module, its attached to the post above here (remove older one before applying if you use mine):


The main module may get an update so stay tuned
ok thx! just removed previous and installed that new one.

now i still need to realize why after so much this and that investigating gms hogness youtube ceased to see my chromecast.
 
Last edited:

Fishawy

Senior Member
Mar 26, 2010
3,294
614
Melbourne
OnePlus 9 Pro
Google Pixel 7 Pro
I completely replaced the contents of the line in the 1.8.7 directory "# Patch the XML and place the modified one to the original directory" with the directory from 1.8.6 and got a working 1.8.7 module. These aren't bad ROMs, they're a bad new detection method (Improved XML patching logic)
Mind sharing that custom 1.8.7?
 
  • Like
Reactions: SnoOkilow

x_berzerker

Senior Member
Dec 19, 2010
111
17
Moto G5
Asus ZenFone 3 Zoom
You might want to read the previous few posts, including mine (both seemed to have path issues) and as you may an older version of my module, its attached to the post above here (remove older one before applying if you use mine):


The main module may get an update so stay tuned

So, finally confirmed that your versions, both older one and 1.0, fix gms hog BUT breaks youtube ability to cast to chromecast.
1.8.7 github version won't fix hog but also won't break youtube cast either.

Any ideas on getting best of worlds?
 

73sydney

Senior Member
So, finally confirmed that your versions, both older one and 1.0, fix gms hog BUT breaks youtube ability to cast to chromecast.
1.8.7 github version won't fix hog but also won't break youtube cast either.

Any ideas on getting best of worlds?

my module makes 1 change, the original method of removing google play services from a whitelist, nothing more, it does 1 thing and its the most benign version of google play services dozing

if it breaks casting then ive never noticed because ive literally never cast anything in my life because i have a tv that has youtube on it (and to be honest i dont even use youtube on the TV), or im in front of a PC with youtube open - which is where i mainly view stuff

nothing i can do about that, thats the original method

ive never looked at the other version to know what it does/doesnt do, but if its not dozing google play services, and mine is (and its using the original method), then mine is working as it should be and i guess you have to decide whether you want battery saving or to cast stuff - which is the opposite to battery saving...you cant expect one thing to do two diametrically opposed things....
 
  • Like
Reactions: WarriorMax

x_berzerker

Senior Member
Dec 19, 2010
111
17
Moto G5
Asus ZenFone 3 Zoom
my module makes 1 change, the original method of removing google play services from a whitelist, nothing more, it does 1 thing and its the most benign version of google play services dozing

if it breaks casting then ive never noticed because ive literally never cast anything in my life because i have a tv that has youtube on it (and to be honest i dont even use youtube on the TV), or im in front of a PC with youtube open - which is where i mainly view stuff

nothing i can do about that, thats the original method

ive never looked at the other version to know what it does/doesnt do, but if its not dozing google play services, and mine is (and its using the original method), then mine is working as it should be and i guess you have to decide whether you want battery saving or to cast stuff - which is the opposite to battery saving...you cant expect one thing to do two diametrically opposed things....

thanks for the answer mate. and thanks for the working version too.
but, i must disagree: i see no proof -so far- these things are diametrically opposite. if me or you can't do it, it doesn't mean -yet- that one with superior understanding won't be able to do. maybe someone pop out of chaos with a solution that fits both parts, maybe even you, despite your first impression.
just a thought. don't bother. let's save thread for what is worth.
 
  • Like
Reactions: WarriorMax

73sydney

Senior Member
thanks for the answer mate. and thanks for the working version too.
but, i must disagree: i see no proof -so far- these things are diametrically opposite. if me or you can't do it, it doesn't mean -yet- that one with superior understanding won't be able to do. maybe someone pop out of chaos with a solution that fits both parts, maybe even you, despite your first impression.
just a thought. don't bother. let's save thread for what is worth.

if it helps, i can link my phone to my tv (with tv code) and play youtube videos there...first time i ever tried just now...so not sure how thats not working for you

maybe my point wasnt as clear as i meant it, i mean t on one hand you want to save battery, but then you want to cast, and those are two diametrically opposed things....
 
  • Like
Reactions: WarriorMax

x_berzerker

Senior Member
Dec 19, 2010
111
17
Moto G5
Asus ZenFone 3 Zoom
if it helps, i can link my phone to my tv (with tv code) and play youtube videos there...first time i ever tried just now...so not sure how thats not working for you
thx again mate. i had that tested. my tv have youtube and that works. the thing is that it is for my wife, which is a more limited user.
since we have a chromecast for its broader compatibility, tv native apps end up falling into oblivion.

for now it seems that somehow gms hogging has ceased even after i removed the module.
i will keep an eye on it and other on this thread.
hope my feedback bring some worth contribution anyway.
 
  • Like
Reactions: 73sydney

SnoOkilow

Member
Jul 20, 2017
8
5
I completely replaced the contents of the line in the 1.8.7 directory "# Patch the XML and place the modified one to the original directory" with the directory from 1.8.6 and got a working 1.8.7 module. These aren't bad ROMs, they're a bad new detection method (Improved XML patching logic)
- I also recommend that everyone immediately apply this tweak.
> su
> cd /data/data
> find . -type f -name '*gms*' -delete
- PS This tweak will save you from possible problems with notification delays. This does not bad affect the energy efficiency in any way.
 

WarriorMax

Senior Member
Jun 10, 2011
503
174
The module installed fine but when i check i get this... What does it mean pls.


/system/bin/sh: gmsc: inaccessible or not found
 

Top Liked Posts

  • There are no posts matching your filters.
  • 172
    Universal 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 / Magisk - Magisk Module Template
    - @JumboMan / Custom installation script

    Extras:
    - Donation: PayPal - LiberaPay
    - Mirror Links: GitHub Releases - Telegram - Index
    - Source Code: GitHub
    69
    Troubleshooting:

    - Command-line for check optimization (with add-on installed):
    Code:
    > su
    > gmsc

    - Command-line for check optimization (general):
    There's a line written Whitelist (except idle) system apps: and if com.google.android.gms line does not exist it means Google Play services is optimized.
    Code:
    > su
    > dumpsys deviceidle

    - Command-line for fix delayed incoming messages issue:
    Code:
    > su
    > cd /data/data
    > find . -type f -name '*gms*' -delete

    - Command-line for disable Find My Device:
    Code:
    > su
    > pm disable com.google.android.gms/
    com.google.android.gms.mdm.receivers.MdmDeviceAdminReceiver

    Changelog:

    v1.8.4
    - Removed redundant script (GMS: Stay with disabling Find My Device only)


    v1.8.3
    - Android 12 support
    - Additional boot complete check
    - Multi-User support
    - Set ignore for GMS and IMS WRITE_SETTINGS
    - Minor improvements

    v1.8.2
    - Android 11 support
    - Improved installation (Magisk Live and Custom Recovery)
    - Improved patching detections (XML files and conflicting modules)
    - Integrated add-on (run 'gmsc' with superuser rights for check optimization status)
    - Set ignore for GMS and IMS BOOT_COMPLETED
    - Set ignore for GMS and IMS AUTO_START (custom permissions for Oxygen OS)
    - Updated template

    v1.8.1
    - Integrated custom recovery installation
    - Added boot logic for search and patch any conflicting modules (if present)
    - Whitelisted IMS and Turbo (this should fixed location crash issue in MIUI)

    v1.8.0
    - Initial re-release
    - 100 seconds Magisk Boot Service
    35
    So this is it guys, both of my old machines are totally broken and some parts are get burned. I've no idea to revive it since my money were spent for my primary demands. I've built ±5 beta builds available in the support group (if you want to) but there's no special things since I'm still tinkering with every devices that Find My Device doesn't disabled automatically. Talking/sharing in here or in support group would be a nice place to find other workarounds. I'm so sorry for the lack of updates, also I just want to tell that I'll married soon.

    Keep up all of your supports, sorry for the inconveniences.
    Have a nice day!
    30
    New stable build is up!​

    This is like a dilemma, where I've to continue this GMS optimization stuff or not. But I got a few ideas lately where my loyal supporters always ask about GMS optimization and this is the answer. I will continue to try to make this module work well, stable, efficiently and of course optimized GMS.
    Please remember to read installation guides on OP, and don't use similar modules or tweaks because I won't know where the issue came from that might one day happens to you. I would like to say Thank You to all my supporters for my simplicity-oriented-usability project.
    Happy flashing :fingers-crossed:
    27
    GL-DP wishes you Happy Eid Mubarak
    and
    Here's the Stable Update!​

    I've made a lot of changes regarding I'll stop/drop supports or works for optimizing GMS. Now I'm starting to focus to prevent unnecessary GMS running in the background with my own modified services in hope for getting better battery life. Please note that I'm not referred you to use similar modules while reporting any issues you've faced of. So I can check whether the wrong is from my module or in your ends.

    While the ponds is starting to dry, don't forget that the ponds will stay wet when the rain comes.
    Happy flashing! :fingers-crossed: