Power Struggle: Battery Use And Background Services

Posted on September 14, 2017

In the ten years since the first iPhone appeared our expectations of smartphones have soared. We have become more dependent on them for more functions, for more hours of every day. And yet, with every upgrade, we expect a thinner device with better battery life — even as screen size increases dramatically.

Bigger, brighter screens, faster networks, faster CPUs and more intensive usage continue to heap demands on smartphone’s batteries and power management logic. So, over the last few iterations of the leading operating systems, we have seen a profusion of tools in the OS itself designed to name and shame any apps which use more than their fair share of power.

All of which is great, until it goes too far. Recently I was using a Samsung Galaxy S7 for some testing, unrelated to battery usage, when I was greeted by a flurry of alarmist lock screen messages, including the two below.

image1

This phone is essentially unused. It has no SIM, no service, and was not even connected to Wi-Fi when the notifications surfaced. It was also stone cold to the touch. Tapping on the first of these messages popped up a dire warning that ten “background” apps were slowing the phone down. The apps listed included Samsung’s own Galaxy Apps, Samsung+, Samsung Pay, the Samsung Settings app, the Google app and the keyboard!

This might improve battery life to a degree, but it wreaks havoc on the smartphone user experience. I have many apps  which routinely go unopened for three days, some of which do things in the background (like synchronizing my fitness tracker data). There are many others which need to provide notifications when something changes, but which I don’t use daily.

Activating App power saving meant several of the apps on the phone were essentially disabled, and unable to communicate that to me. An optimizer that simply disables apps that have not been launched into the foreground for three days is the bluntest of instruments.

Image2

I found myself wondering why this Samsung extension was so aggressively reporting background apps on a phone I was hardly using, and which had plenty of battery life remaining. 

The Android stats showed the battery was at 85% and that, until this point, the device had been running off the battery for 30 hours. Yet the Samsung battery extensions were in full panic mode about background apps slowing and overheating the phone and draining the battery.

They not only listed applications, but used language which suggested the apps in question were somehow at fault and draining a disproportionate amount of power. The fact that so many of the apps were Samsung’s own at least offered some unintended light relief.

Doze Mode

In a similar vein, one of the additions in Android 6 (Marshmallow) was something called Doze Mode, which was further enhanced in Android 7 (Nougat). The first version of this was described as follows:

Doze: If a user unplugs a device and leaves it stationary, with its screen off, for a period of time, the device goes into Doze mode, where it attempts to keep the system in a sleep state. In this mode, devices periodically resume normal operations for brief periods of time so that app syncing can occur and the system can perform any pending operations.

In this version of Doze Mode, the device would stay in sleep mode if it was physically stationary (e.g. left on a desk) without being plugged in. While this certainly helps with managing power while the device is unused on a desk, it does nothing for the case where the phone is in a pocket or bag and moving.

In Android 7, Doze Mode was made able to activate more frequently, and the restriction that the device be physically stationary was removed. Apps could now discover that they were able to run in the background, but could only access the network by synchronizing activity with one of the doze mode maintenance windows.

For Android 8 (Oreo), more restrictions on background applications have been added, essentially making it impossible for apps to have long running background services, and, at the same time, preventing them from being started as easily by system events.

These changes, especially the changes in Oreo, limit the available options for a whole range of useful background services that are well written and do not drain the battery. (Although it remains easier to deal with core Android changes and API restrictions than with arbitrary OEM services that disable apps without any warning.)

Foreground Apps & Cell Standby

For all this attention on background applications and their battery usage, the top items in the battery stats table on my Nexus 5X are almost always the screen and the cellular standby. Also regularly at the top are ‘Android System’ and ‘Android OS’ as well as Google’s play services. The quickest way for me to drain the Nexus battery is to sit and watch something on it, keeping the screen on for extended periods of time.

The Nexus has three apps with Devicescape’s background services in them on it today (I usually have several of our apps installed). They are all designed to limit the amount of work they do, and on recent versions of Android will play nicely with the doze mode changes. In the last 7 hours, not one of those apps has used enough battery to even make it into the table of battery consumers. Right now, around seven hours into the day, that table looks like this:

Image5

The screen is by far the largest user of the battery so far today, and today has been a relatively light usage day for the phone.

While it is certainly possible for a badly designed background app, or even a buggy one, to consume lots of battery, well designed background services can add lots of value with just small sips of the es.sential battery juice.

Conclusion

Obviously, battery monitoring tools can be very useful, and both OEMs and Google are clearly trying to help consumers root out the apps that could cause the battery to drain too fast.

But it is also important to understand whether the tools themselves are well designed.

On Android, the main Settings app’s battery stats tool is generally good, although there are some variances even there (one of our Samsung devices seems to consider apps that just read the Wi-Fi scan list periodically to be heavy power consumers, whereas other phones do not).

Samsung’s own tools seem to simply identify the top consuming apps, regardless of their absolute power consumption and whether they constitute a problem. That’s clearly not helpful; with any of these apps there needs to be a certain level of usage that is considered normal.

The evolution of the Android operating system towards banning background apps outside of a few very specific use cases, while providing headaches for developers of well behaved background services, should improve the user experience.

Some of the restrictions, such as listening for network connection changes, might have been better handled by means of a user-granted permission. It is important for companies like Google, Apple, and Samsung to realize that background services go further than just updating social networking messages or email messages. There are many useful services that need access to more sophisticated triggers, whether that is network connectivity events, location triggers or other system events. And, when well designed, they present no threat whatsoever to battery life.