[GUIDE/DISCUSSION] Google Play Services Battery Drain

dmo580

Senior Member
Dec 29, 2009
2,606
708
0
I'd like to start a thread that discusses battery drain from Play Services--no not just specifically about Custom ROMs and Play Services 7.x and the SystemUpdateService issue, but a general Play Services. I see too many threads and "guides" and supposed "fixes" popping up specific device forums, but honestly Play Services affects ALL Android users that have GApps installed.

There's too much misinformation out there, and I know that Android has always had a bad image in regards to battery life, so I see too many people throwing out unvalidated fixes and misguiding users. Meanwhile, tons of users are accepting any fix they can find online in hopes of saving their battery life. That's honestly NOT the best solution. There's often adverse effects being introduced and a lot of compromises. I'd like this thread to have some healthy information AND discussion so we can truly understand WHAT is going on and how to best tackle this perceived drain.

1. Introduction

What is Play Services? To put it simply in the words of Wikipedia:
Google Play Services is a proprietary background service and API package for Android devices.
To give more detail, Play Services is in charge of a lot of background services and a lot of core functionality of Android devices from anything ranging from location services to ads to payment services.

2. What causes drain?

Location Services is probably one of the biggest drains of Play Services. Per the Amplify developer, Play Services will fire a location update every 60 seconds to Google servers. Why does Google do this? They probably use our location for their own purposes in addition to other features like Google Now location based updates, and well.... they're Google. They collect our data.

In my testing on a Nexus 5 and OnePlus One, a fresh build of Android with Location Services enabled will drain somewhere just under 1%/hour on LTE while idle. On WiFi, your drain could easily be far below that. To me that's not bad at all. Remember, not all of that is Play Services. Some of it goes to background syncing of Gmail and other Google services. However, there are instances where Play Services can go crazy and potentially drain more.

So that's just out of the box drain. Other apps could leverage Play Services' Location APIs. Google Now for example will do this. Wallet can use location to send you updates about offers or ads. Other apps like Google+ or Facebook have the ability to see nearby friends. Foursquare/Swarm has the ability to send you tips about nearby venues.

3. What you can do to fix this?

Like any process improvement, you should probably understand where your drain is coming from. By default, Play Services has some drain, but a properly set up phone should not be draining more than 1% / hour on mobile network provided that you're not experiencing poor reception or network congestion.

There's essentially what I'd like to take as a two step approach to Play Services Drain:
  1. Understand the default drain of Play Services without the involvement of 3rd party apps - this should be under 1%/hour for most phones on mobile data. Is that too much for you? If so, Amplify is probably the best solution out there.
  2. If your drain is well above 1% / hour, then other questions come up. Is your battery still in the proper condition? Do you have a rogue app syncing? If you can rule that out and still come back to Play Services, then I'd likely say its a 3rd party app USING Play Services and therefore causing excessive drain. BetterBatteryStats will often just lump Play Services drain all into one bucket, but use Wakelock Detector to understand which app is actually causing the drain.

Think long and hard about what apps you have set up to enable background location updates. You shouldn't be blaming play services for using your location, but rather apps themselves for being setup a certain way. Comb through your app settings and understand what's going on. It might be fun to see where your friends are in Facebook, but are you prepared for that background location update that potentially kills your battery? Or what about that weather widget? DO you need every 5 minute updates?

Q: What about switching to Battery Saver for Location Settings?

I honestly think Battery Saver is a red herring. The difference between High Accuracy and Battery Saver is that GPS is not used. But here's the thing--ask yourself when do you actually need GPS? It's not just running in the background all the time. Unless you open Yelp/Swarm/Maps all the time, GPS isn't being used anyway, so why would you disable GPS? High Accuracy maintains the ability to use GPS when an app calls for it, but the background updates which are the most tasking from a long term battery use perspective are still there whether or not you use Battery Saver or High Accuracy. That every 60 second ping to Google still exists on Battery Saver.

This fix is almost always proposed every time someone brings up drain, but you really need to think about how location settings works before falling for that misnomer. In fact, High Accuracy will likely be a better choice for most because say you want to look at the map to see where you are. If you need your location NOW, it gets frustrating to open the app up and realize it points you to a location a mile away. After maybe 30 seconds of pondering you then realize that your GPS was off, you go and switch Location Settings to High Accuracy, and then you wait another 30 seconds for the GPS to lock. Why not leave High Accuracy on to begin with? It gives you GPS when you need it, but when you exit Maps, GPS stops on its own.

4. Conclusion

I'll be writing a lot more, but this is my first stab at a guide. I encourage discussion as I'm likely not the only self-proclaimed expert out there. I just feel there was enough misinformation to warrant a more centralized guide for all devices.


 
Last edited:

dmo580

Senior Member
Dec 29, 2009
2,606
708
0
List of Proposed Fixes for Battery Drain with Analysis

Since there's many proposed fixes for battery drain, let's talk about what some individuals have proposed, and I will inject my analysis.

Turn off background data
Many apps use Play Services' location APIs. If you turn off background data, then you end up with an app that cannot communicate because Play Services is always in the background. Why would anyone do this for an app that relies on background data to function? This is a bad fix IMO.

Use Privacy Guard to deny Play Services from Waking Up
This is a possible fix, although once again Play Services has a need for waking up while your phone screen is off. If we review once again what Play Services is responsible for, one can see that apps like Google Now which is supposed to give you updates in the background, requires location updates to work properly, then denying the ability for Play Services to wake up when your screen is off may have some adverse effects.

The good thing is that wakelocks are only required when the screen is off--therefore when your screen is on, your apps should be able to fetch location updates via Play Services and Play Services can function normally. The concern comes from when your screen is off. So if you play on your phone all day at work, it might not be bad, but if you sit with your phone in your pocket all day, and want a traffic alert to show up, it might not show up. Or for a busy guy like me who flies a lot for work, traffic cards showing when I need to get to the airport might not show up because Play Services is not updating my location properly when my phone screen isn't on.

This is a poor fix IMO but slightly better than the option above.

Use Amplify

This is probably the best and least harmless fix to implement. Its safe IMO to implement immediately. Most of us don't need every 60 second updates on location. Every 5-6 minutes should be sufficient. That still gives you enough update interval to get traffic cards. You can always get a location update when an app calls for it in the foreground. This fix should easily clamp down on your background Play Services drain and reduce it significantly. Of course, this is only affecting the periodic update that by default comes out of the box with Play Services. If other apps are constantly calling for location updates, you need to look at what other apps may be requesting location services.
 
Last edited:

dmo580

Senior Member
Dec 29, 2009
2,606
708
0
Play Services 7.x Drain

Are you getting unexpected battery drain after your Google Play Services updated to 7.x? Are you on a custom ROM?

If so, this is a bug that affects custom ROMs with SystemUpdateService disabled. It produces a SystemUpdateService wakelock that keeps your phone awake 100% of the time.

Here are several fixes ranked in order

1. Root cause fix

As of March 21, 2015, both CM11 and CM12 trees have had their fixes implemented (see commits http://review.cyanogenmod.org/#/c/91881/ and http://review.cyanogenmod.org/#/c/91882/ for CM11 and http://review.cyanogenmod.org/#/c/91021/ and http://review.cyanogenmod.org/#/c/91579/ for CM12). You can update to a CM build after March 21st, or if you're on another ROM you might want to check if there has been a fix implemented yet.


2. Manual root cause fix

In Terminal Emulator, issue the command:
Code:
su -c "pm enable com.google.android.gms/.update.SystemUpdateService"
You can help make this more automated via this post here.

Note: Requires root

3. Band-aid Fix

Download Wakelock Terminator, then filter for ONLY the SystemUpdateService wakelock for Play Services.

Note: You need Root and Xposed for this to work



4. Bigger Band-aid Fix

What separates this from #3 is that this band-aid fix disables other features of Play Services. It will fix the battery drain, but by disabling parts of Play Services, you create unnecessary adverse effects.

Go to: Settings > Privacy > Privacy Guard > Advanced (in the menu) > Google Play services
You can then disable "Wake up" and "Keep awake".

 
Last edited:
  • Like
Reactions: fraz0815