FORUMS
Remove All Ads from XDA

[SCRIPT] [GUIDE] Google Play Services Battery Drain Fix/Workaround

1,312 posts
Thanks Meter: 2,236
 
By Alcolawl, Senior Member on 20th March 2015, 03:59 AM
Post Reply Email Thread
Anyone's Google Play Services update recently? If you're suddenly experiencing dreadful battery life due to Google Play Services (see pic below) then this fix might be right for you.

Background:
Recently, an update to Google Play Services (ver. 7.0.97) was released and reports flooded the internet with complaints of battery life issues. People had battery graphs similar to this:
battery drain

I also experienced this issue. After checking my frequency tables in my kernel tweaker, I noticed that my phone was NEVER going into Deep Sleep, and, instead, was sitting at 300mhz even when the screen was off. After some Googling and reading some comments on GitHub, it seemed apparent that the problem was one Service in particular "SystemUpdateService".

The Problem: Without going into much detail SystemUpdateService is basically Google's OTA update service, and when it detects that your phone need and update while running a Custom ROM, it fails and re-runs this check over and over again. It's this wakelock that drains your battery.

The Solution: Enabling the service. You read that correctly. For whatever reason, enabling the service actually prevents the wakelock from occurring. I, along with a few testers, have been using our phones for hours now after having run the script and the wakelock and battery drain is completely gone.

Method #1: init.d Script
For those of you with custom ROMs that support init.d scripts, simply unzip and place this script in the /etc/init.d folder (as root) and set permissions to 755. The service becomes disabled again as soon as the phone reboots. We place this script in the init.d folder so the script runs automatically every time the phone boots. If your Custom ROM does NOT support init.d scripts skip over to Method #2 or 3.

DOWNLOAD SCRIPT HERE: fixUpdateService.zip

Permissions Screenshot:


The source code to this script (Edited slightly, Credit to Oreganoian on Reddit):
Code:
echo "Disabling SystemUpdateService Battery Drain"
su -c pm enable com.google.android.gms/.update.SystemUpdateActivity 
su -c pm enable com.google.android.gms/.update.SystemUpdateService
su -c pm enable com.google.android.gms/.update.SystemUpdateService$ActiveReceiver 
su -c pm enable com.google.android.gms/.update.SystemUpdateService$Receiver 
su -c pm enable com.google.android.gms/.update.SystemUpdateService$SecretCodeReceiver 
su -c pm enable com.google.android.gsf/.update.SystemUpdateActivity 
su -c pm enable com.google.android.gsf/.update.SystemUpdatePanoActivity 
su -c pm enable com.google.android.gsf/.update.SystemUpdateService 
su -c pm enable com.google.android.gsf/.update.SystemUpdateService$Receiver 
su -c pm enable com.google.android.gsf/.update.SystemUpdateService$SecretCodeReceiver
echo "Script Execution Successful"
Method #2: Manually Running the Script
This method works best if you like working in the terminal or file explorer. Or if you would rather just do things yourself. Place the script above in the /etc/init.d directory and set permissions to 755. This time, however, you must run the script yourself EVERY TIME THE PHONE BOOTS. You can do this by using your file explorer, if it supports executing scripts (see output below) or running the script via Terminal.

Terminal: Run this command as root (type "su" and hit enter):
Code:
./etc/init.d/fixUpdateService.sh


File Explorer: I personally use FX (File Explorer), which is a wonderful app by the way, so the output in the screenshot below may be styled different but generally should appear the same:


Method #3: Enabling SystemUpdateService via App

Now, if you're a no frills kinda person, or just don't feel comfortable rummaging around in your filesystem or terminal, there is an app you can download called Disable Service which lets you do the same thing, just with a nice GUI. YOU MUST DO THIS EVERY TIME YOU REBOOT YOUR PHONE.

Steps:
  1. Once installed, launch the app.
  2. Then click the "System" tab on the top right.
  3. Scroll down and select "Google Play services"
  4. Scroll down to "SystemUpdateService" and CHECK the box.
  5. Done!

There you have it! Hope this helps!
The Following 70 Users Say Thank You to Alcolawl For This Useful Post: [ View ] Gift Alcolawl Ad-Free
 
 
blackzigong
20th March 2015, 01:20 PM |#2  
Guest
Thanks Meter: 0
 
More
Great!
Method 1 doesn't work on hammerheadcaf 20150318 but Method 3 is working like a charm and the battery drain issue seems to be gone!
And CyanogenMod is going to deal with this issue before long:
http://review.cyanogenmod.org/#/c/91579/
http://review.cyanogenmod.org/#/c/91021/
The Following User Says Thank You to For This Useful Post: [ View ] Gift Ad-Free
20th March 2015, 03:30 PM |#3  
Kc_Nirvana's Avatar
Senior Member
Flag Lisbon
Thanks Meter: 46
 
Donate to Me
More
Hello...
This only occurs in custom roms or it happens also in Stock Rom?
Thank you...
20th March 2015, 03:39 PM |#4  
Alcolawl's Avatar
OP Senior Member
Flag New York
Thanks Meter: 2,236
 
More
Quote:
Originally Posted by blackzigong

Great!
Method 1 doesn't work on hammerheadcaf 20150318 but Method 3 is working like a charm and the battery drain issue seems to be gone!
And CyanogenMod is going to deal with this issue before long:
http://review.cyanogenmod.org/#/c/91579/
http://review.cyanogenmod.org/#/c/91021/

Interesting, I'll try to see if I can edit the script to get it to work right. Make sure you enable the service with that app every time you reboot your phone.
Also, I've been reading those CyanogenMod discussions. Very interesting. Hopefully they tackle the issue soon and the solution makes its way into other ROMs

Quote:
Originally Posted by Kc_Nirvana

Hello...
This only occurs in custom roms or it happens also in Stock Rom?
Thank you...

As far as I know, this bug only affects custom ROMs.
The Following 2 Users Say Thank You to Alcolawl For This Useful Post: [ View ] Gift Alcolawl Ad-Free
20th March 2015, 05:46 PM |#5  
Senior Member
Flag Dallas
Thanks Meter: 134
 
More
Method 1 didn't work but method 2 and 3 worked. I believe the permissions for the script
should be 755 instead of 744.

Update : changing permissions didn't help either.
The Following User Says Thank You to bhaismachine For This Useful Post: [ View ] Gift bhaismachine Ad-Free
22nd March 2015, 08:08 PM |#6  
Senior Member
Los Angeles
Thanks Meter: 42
 
More
755 or 744? Screenshot shows 744 but instructions say 755. Assuming 744 is correct.
22nd March 2015, 10:52 PM |#7  
Alcolawl's Avatar
OP Senior Member
Flag New York
Thanks Meter: 2,236
 
More
Quote:
Originally Posted by soundneedle

755 or 744? Screenshot shows 744 but instructions say 755. Assuming 744 is correct.

Permissions for init.d scripts should;d be 755. I'll update the picture to reflect that. Thank you for pointing that out.
23rd March 2015, 04:56 AM |#8  
smader12's Avatar
Member
Flag Detroit
Thanks Meter: 23
 
More
Quote:
Originally Posted by Kc_Nirvana

Hello...
This only occurs in custom roms or it happens also in Stock Rom?
Thank you...

I'm experiencing the battery drain with stock HTC sense on my M8 and GP services 7.0.97. The battery usage is very high for GP services (e.g. 38% for screen off!) and the "awake" bar shows the phone awake even during periods of low usage--too many awake intervals.
24th March 2015, 02:09 PM |#9  
Senior Member
Thanks Meter: 33
 
More
Will init.d scripts work on CM11s?
24th March 2015, 02:15 PM |#10  
AndrasLOHF's Avatar
Senior Member
Thanks Meter: 2,087
 
More
CM fixed this a couple days ago with 2 commits. Hopefully all the ROM teams will incorporate it into their builds.

http://review.cyanogenmod.org/#/c/91579/

http://review.cyanogenmod.org/#/c/91021/
Attached Thumbnails
Click image for larger version

Name:	1.PNG
Views:	5028
Size:	128.5 KB
ID:	3226711  
The Following User Says Thank You to AndrasLOHF For This Useful Post: [ View ] Gift AndrasLOHF Ad-Free
24th March 2015, 02:18 PM |#11  
Senior Member
Thanks Meter: 33
 
More
Quote:
Originally Posted by AndrasLOHF

CM fixed this a couple days ago with 2 commits. Hopefully all the ROM teams will incorporate it into their builds.

CM11s may not get another update though. I can confirm that the shell script doesn't work at startup on CM11S.

Edit: sorry didnt realise this was posted in the Nexus 5 section
Post Reply Subscribe to Thread

Tags
battery drain, fix, google play, systemupdateservices

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes