Battery life has been important for the developers working on Android for the last few releases. This goes beyond the typical “optimized battery life” fluff that we generally see in changelogs. Android has fundamentally changed the way it lets applications run in the background thanks to the Job Scheduler API, the evolution we’ve seen with Doze, and more. This focus isn’t changing with Android P either as noted by Dave Burke at Google I/O this week. One of these new features is being called App Standby Buckets.
The goal of App Standby Buckets is to improve the overall power management of our devices by prioritizing applications into one of four different buckets. Over time, Android will watch and see how frequently you use certain applications and then organize them into one of these buckets based on usage. The operating system will then limit the resources a device allocates to a particular application based on which bucket the application has been placed in.
The different buckets in this system include Active, Working Set, Frequent, and Rare. Here’s the basic description for each bucket:
- App is currently being used
- Working set
- App is in regular use
- App is often used, but not every day
- App is not frequently used
The Active App Standby Bucket is for applications that are currently being used. It also includes an application that has launched an activity, one that is running in the foreground, one that has a sync adapter associated with a content provider (which is used by a foreground application), and one that has a notification in which the user has tapped on. Android will know these applications are important and will do its best to make sure they complete their tasks without any hindrance.
We then have the Working Set bucket for applications that are run often but aren’t currently active. This could be a social media application, email, or any others that you frequently use throughout the day. Continuing through the list we have the Frequent bucket which is for applications that are used regularly but not every day. This could be something like a workout application that you only use 2-3 times a week. Lastly, we have the Rare bucket which contains applications that are not used very often at all. This may be that hotel or airline application that you kept on your phone and might use it once a year.
Google lists a few guidelines for how to use these new features correctly. The obvious recommendation is to not manipulate the system into putting your app in a different bucket. This will be the biggest challenge with App Standby Buckets. The feature doesn’t work if developers force their apps to be in the Active bucket. Google suggests adding a launcher activity to an app, otherwise, it may not be promoted to the Active bucket. Also, notifications that aren’t actionable will not move the app to the Active bucket.
Source: Android Developers