[Nexus 5 General] Alcolawl:
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:

[IMG="battery drain"]http://s24.postimg.org/5rpcdo3xx/batterydrian.png[/IMG]

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: View attachment 3219715

Permissions Screenshot:

The source code to this script (Edited slightly, Credit to Oreganoian on Reddit):

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):

./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:

Once installed, launch the app.

Then click the "System" tab on the top right.

Scroll down and select "Google Play services"

Scroll down to "SystemUpdateService" and CHECK the box.

Done!

There you have it! Hope this helps!