Android Doze – Don’t poke the sleeping Android

{ 1 comment }

Sleeping

Battery power has always been a Gadgeteer’s nightmare especially on phones and finally phone manufacturers are doing something about it.  Qualcomm has its Quickcharge, Oppo has its VOOC Flash Charge from a hardware perspective and there’s a a multitude of third party apps on the Google Play Store that are supposed to extend your Android phone’s battery life.  In Android 6.0 (Marshmallow), Google has decided to address battery power directly within the OS.  Does it work?  Read on!

Google’s strategy for better battery life focuses around two components; Doze and App Standby.

A major cause of battery drain is what is known as Wake Locks. In simplistic terms, Wake Locks are background processes that keep your phone’s processor awake.  So even if your phone is not being used and the screen is off, Wake Locks may be going in the background and polling for information, checking for messages or updates etc.  A badly written app may keep your processor trickling along so that your phone never actually goes into “Deep Sleep”, consuming battery power.

Doze kicks in when your phone is left “idle”  i.e. screen off and no movement that activates any of the sensors. How long it has to sit idle before Doze kicks in is still undetermined. When your phone goes into Doze mode, network access is temporarily disabled, Wake Locks get ignored  and things like System Alarms (but not your user set alarm clock, you’ll still get woken up to go to work) and other background processes are disabled. Almost all of your background processing gets stopped. Phone calls, SMSs, and “important” messages from apps will still get through.

This is really useful for devices that sit idle for a long time, like your phone while you’re sleeping or that tablet that sits on the coffee table when not in use.

App Standby  is accessed via the Settings->Battery->Battery Optimisation menu. That being said, you don’t really have to set it up, it’s setup by default. All apps both system and user are automatically put into “Battery Optimised” or “inactive” mode. There’s no indication of how or when App Standby  works or what the definition of when an app hasn’t been used for a long time is.

Sleeping2

App Standby is enabled by default for all apps (user and system). As you add more apps, they’ll automatically be “optimised”. When an app hasn’t been used for a while it will go into “inactive” mode and as such it stops using processor cycles and as a consequence battery power.

Sleeping3

However if there are apps you don’t want to standby and stay active so you get notifications straight away, you can whitelist your required apps.  Some newer Marshmallow aware apps will ask or recommend that you don’t standby their app. Being in standby doesn’t mean you won’t get your notifications for apps that are optimised, you just won’t get them straight away potentially. Again how this works and if it’s polling at a regular period is unknown (to me at least) at this point in time.

If you want to get an even more “aggressive” App Standby, you can go under the Developer options and set  “Don’t keep activities” where your application will be made “inactive” immediately after you leave the app and not have to wait for the “not used in a long time” criteria.

Screenshot_20151216-084404

You can see here an example of my battery status. My phone was taken off the charger at 1:00 am and sat on my beside table till about 8:00 am. At 8:44 am you can see it’s only lost 3% battery and that’s with a small amount of usage when I woke up. Previously I’d probably see a 10-15% battery loss even before I used my phone.

unnamed

Doze is obviously doing  its job.  Deep sleep of 97% was unheard of on my other phones and/or Android versions. Even when doing nothing I’d see Deep sleep of less than 70% generally. Note that this isn’t in Airplane mode (another way to save battery  but you won’t get any calls or notifications 🙂 , it’s the phone straight out of my pocket with WiFi, GPS, Mobile Phone etc enabled.

Sleeping7

In addition, here’s the last couple of days. You can clearly see where I’m sleeping, those long flat lines.  When I get up, the battery indicators zero loss of power overnight (I’m sure it must be using some power !?!) . Once again, I’ve normally seen a 10-15% loss of power sitting idle overnight.  If you look closely you can also see small flatlines on the graph where the phone’s sitting on my desk at work and not being used.

Sleeping6

And after 2 days, my deep sleep percentage is still 80%.  That’s not too bad at all, again normally on other phones/ROMs I’ve had more like 67-70% deep sleep percentages.

It is worth noting here that the above article is written on “gut feel”.  I could setup scientific controls using different versions of Android on the same phone, sitting idle for the same time  etc, but….. I won’t 🙂

Doze and App Standby are a great feature of Marshmallow and will definitely assist in  extending  your battery life.  How much savings you’ll see does depend on your usage, so let’s finish this article with that old chestnut: YMMV! 🙂

Current testing equipment:

Oppo Find 7a (2800 mAH) running Omnirom 6.0 Marshmallow preview and Greenify

Posted in: Android, Articles
{ 1 comment… add one }
  • Andy Van Pelt December 18, 2015, 3:37 pm

    FYI: I’ve had an intermittent problem getting timely alarms on my Nexus 5x. I’ve white-listed “Alarm Clock Plus”, but that doesn’t always take care of it. I once saw my alarm go off 35 minutes late!

Leave a Comment