Dark's Code Dump

Possibly useful

How to actually reduce battery drain on Android

This assumes you've tried all the normal methods of reducing drain - apps like BetterBatteryStats, Wakelock Detector, etc, the built-in battery stats, trimming permissions, using Pie background restrictions, etc.

I very rarely see this mentioned anywhere when people are trying to track down mysterious Google Play Services/Android OS/Android System drain - most people seem to resort to a factory reset, which won't fix the problem when the issue lies in dodgy apps.

The fix is really simple:

  • Open an ADB shell
  • Run top
  • Interact with your phone as normal, and take note of anything using more than 0.5% CPU
    • Ignore Android system processes, except anything containing gms (Google Play Services) - see below if this is consistently using CPU
    • Process names may be truncated, in which case cross reference the PID using ps -A | grep 12345
  • Lock the screen and wait a bit, then again look for unusual CPU usage
  • Install Greenify
  • Greenify any apps you've found, taking care to 'ignore background-free' (which is a misnomer)

If you do the above and still encounter Google Play Services/GMS CPU usage:

  • If you are on Android 9, unrestrict all background apps. One of my apps seemed to be able to send GMS into a continuous loop by being background restricted - unsure which.
  • Consider partial de-googling, such as by disabling/uninstalling the Google app
  • Try disabling ad blockers
  • Watch logcat for any obvious errors/loops from badly written apps

Doing all this got me from 3.5-4 hours SOT to 5+ hours SOT on my Google Pixel - fixing the drain that Android Pie added and getting me back to where I was on Oreo.

For anyone interested the apps I ended up Greenifying included: Spotify, my banking app, MS RDP, and a few other obscure ones. To reiterate, none of the apps showed up in any battery drain diagnosis apps, or in the system battery stats.

Leave a Reply