Android engineers talk tactics of saving battery life in Android P

Saving power is complex -- small changes sometimes have big effects

adaptive battery

Android P is on the horizon, bringing a wealth of changes for users. For many, the most important shift will come in the form of battery life. Android engineers Benjamin Poiesz and Tim Murray joke that “P is for Power.”

Poiesz, a group product manager for the Android Framework, and Murray, a seniour staff software engineer, sat down with Ars Technica for an interview about the changes in Android P.

Cores, big and small

Since 2015, most multi-core CPUs ran on a ‘big.LITTLE’ platform, according to Murray. Essentially, that platform means there are a number of large, high-power fast cores and a number of small, low-power slow cores.

Initially the team only restricted background apps and processes to the little cores.

In P, Murray’s team took things further. They looked at what ran on the big cores when the screen was off and found a lot of things related to the system.

“We looked at how many of these were performance critical and it turns out, not many — when the screen is off at least,” Murray said. ”

Now these processes operate on a restricted CPU stack with only the small cores. It saves some battery, but it also makes battery life more predictable.

If the system is going to use power when the screen is off now, it draws less because the small cores are much smaller.

We’re all A/B testers

Considering how much impact a change can have on power metrics, Murray and Poiesz took to the best metrics database they had.

You know when you’re setting up a phone for the first time and you see that ‘usage and diagnostics’ toggle? It sends data about your device and app usage to Google.

Usage diagnostics in Android

Murray and Poiesz are able to look at metrics of power in a dashboard, among other stats. It does so at a high level so they can’t see anything they shouldn’t. What they can see is trends in usage.

For example, Murray points out Christmas time. “The battery life that people see around Christmas is amazing because nobody’s using their phone, nobody’s sending email, and nobody’s doing any of these things.”

That variance makes studying power particularly difficult. It can be hard to tell what’s affecting battery. Is it a change in population — like no one using phones at Christmas — or is it the effect of a software change?

Murray and Poiesz narrow this data-set down to just the people running the Developer Previews. Then they A/B test. Some people have noticed really great battery life on Android P — others haven’t. These discrepancies could be the result of battery tests.

Power and predictions

The last thing the duo learned in their work on P was that power savings don’t add up as expected.

An app keeping a device awake to do tasks — a wake lock — draws power, but reducing the number of wake locks doesn’t help.

Going from no wake lock to one wake lock is a significant step. The CPU moves from an idle state to an active state. However, adding other wake locks doesn’t increase power draw. The CPU is already awake and working.

From that perspective, Murray and Poiesz took a strategy of delay. Android P delays processes until a device wakes up or is charging. Delaying a process until the device is awake doesn’t necessarily save power, but it reduces usage when the device is idle. The real power saver is delaying until the device is being charged.

If a process is delayed from 10am to 11am, the power needed to run it isn’t saved. If that process is delayed until your phone is plugged in, then that power is saved.

However, that means waking up the device uses more power. This is where the prediction comes in — it’s all about figuring out whether its more efficient to remain in idle or shut everything down.

Android P is about balance. It’s about figuring out what the users wants and needs at a given moment and working to deliver that efficiently.

Source: Ars Technica