How does Android Optimize Battery Usage in New Releases?

Abhishek Luthra
Cashify Engineering
3 min readOct 29, 2018
Android battery optimization

Battery Life or Extended Battery Life is one of the most desired features on mobile devices today. The phones in our pockets are more powerful than ever, but if there is one thing that all of us wish we had, it’s a phone whose battery doesn’t die at the end of the day. On the Google Play Store there are hundreds of battery apps that claim to help extend the battery life of mobile devices — some with as many as 100 million downloads or more — so clearly it’s a problem that Android users face.

So, where does the power on our mobile phones go?

It turns out that when the screen is on, it dominates the power consumption on your phone more than anything else. Whether you are playing a game, or watching a video or chatting with your bae, it’s majorly your screen that sucks the juice out of your battery. The screen turns out to be a costly component on the device, which is many orders of magnitude more in terms of power consumption, than most other components of the device.

Android power usage

However, our phones also spend a lot of the time in our pockets when their screens are off, and we are not actively interacting with the device. The power consumption of the device now starts getting dominated by the CPU and the networking radios. In such a case it may be an application holding a wake lock to do some work. It may also be background sync, or background job, trying to access the internet to sync some data in the background — and all of that costs power. So when it comes to optimizing for power when the screen is off, the Android Framework team has focused on three main design principles starting with Android 6: Reduce, Defer, Coalesce any and all background activity that you can.

  • REDUCE: Reduce the background operations of an app when the user is not actively engaged or is not actively using the device. It is something that only application developers can do; they know best the logic of their applications, the constraints that they are operating in and what their users want from the application.
  • DEFER: If background activity must be performed, defer it to when the device is on the charger. Why? The user does not incur any battery cost if background activity is done while the device is plugged into the charger.
  • COALESCE: If it cannot be deferred, coalesce it with other background activity to reduce wake-up overhead. Why? Every time your device wakes up it activates the mobile radio to do any networking activity (even for a very small number of data packets) there is a fixed cost (in terms of power consumption due to sudden current surge) that needs to get incurred when user’s device goes into this high-power state. What happened before was that every app activated networking radios from background whenever it required internet or access to the current location of the device. It increased the overall power consumption on the device. Now, if more applications can patch (COALESCE) together any of their background activity, the more efficient the system becomes and power consumption on the device can be reduced to a significant extent.

How does the Android Framework Enforce Defer and Coalesce?

Doze

— App Standby

— JobScheduler API

— WorkManager API

I will be discussing the above topics individually in detail in separate articles. Keep tuned in…

--

--