Android P features you'll love: Restricted apps to save you battery life

We all have different wants and needs about what our phone can do for us, but we all have one thing in common, too: we want our battery to last longer. Whether you get more than a day from a phone like the ASUS Zenfone Max and its 5,000mAh battery or you barely make it through the day with a phone that has a more, erhm, modest battery, you still want a longer time between charges. So do I. Charging a phone isn't hard, but not charging it is easier. Google knows this, too, and that's why Android P has several features designed to extend your battery.

A part of Android's power management called Background Restrictions is one of the things in Android P that tries to tame unruly apps and ease your battery life woes. As part of Android P, it uses an aggressive approach to do something we've needed for a long time — clamp down apps that don't use any of the newer battery saving features found in the latest versions of Android. Putting the decision in your hands instead of an app developer's is pretty awesome.

How Background Restrictions work

The beauty of how these Background Restrictions work is in their simplicity.

If an app exhibits some of the bad behaviors described in Android vitals, the system prompts the user to restrict that app's access to system resources. This is a new feature for Android P.

Android vitals is a Google initiative designed to do one thing — improve performance and stability of every Android phone. That's a tough task; Google can test the Pixel phones, Samsung can test the Galaxy phones, LG can test their ThinQ phones and so on, but once we get them the first thing we do is add apps. Those apps were not there when the Samsungs and LGs of the smartphone world tested the software for stability and performance. Those apps can do horrible things. Those horrible things all cause the battery inside our phones to drain faster than it should.

Power management in Android P gets a little perturbed when apps exhibit any of the bad behaviors described by the Android vitals initiative. There are also two stand-alone things that will draw Android P's power management ire: Wake locks when the screen is off and apps built to target versions lower than Oreo and try to have "excessive" background services running.

If the active power management subsystem notices any of this sort of thing happening from an app, it notifies you and gives you the option of restricting the apps services. Think of it as putting that app in detention.

What restrictions are placed on a "bad" app?

That is up to the developers who built the software for your phone. And it should be because Android can run on a lot of different hardware and not all hardware is equal. A Galaxy S9+ can handle a lot more load than an entry-level phone a carrier might include with a service plan. The company that made the phone will know what it can handle and what is just too much to ask.

Google gives us a baseline using a stock AOSP build for phones that can officially run them (Pixel and Pixel 2 models). Restricted apps can't do any of the following when they aren't in the foreground (actively being used because you wanted something done):

  • Run jobs. A job is a single unit of work that you, an app, or a part of the OS called a scheduler (it runs things on a schedule) assigns to the operating system.
  • Fire alarms. An alarm is an alert or event that gets sent from an app to the operating system. These are different from the types of notifications you see.
  • Use the network. This means any network — LTE, 3G, Wi-Fi, etc.

For a chart showing Android P's Power Management Restrictions, Look here.

The developers who designed the operating system for your phone and set all the right parameters and worked all the long hours will decide what an app that does bad things is not allowed to do when you're restricted its background use. All we need to do is notice the notification and tap away to send that bad app into the corner for a timeout. It's a beautiful idea that took nine versions to happen.

Jerry Hildenbrand
Senior Editor — Google Ecosystem

Jerry is an amateur woodworker and struggling shade tree mechanic. There's nothing he can't take apart, but many things he can't reassemble. You'll find him writing and speaking his loud opinion on Android Central and occasionally on Twitter.