App Standby Buckets In Android

Deepanshu
MindOrks
4 min readMar 31, 2020

--

Google has been continuously making changes in every version of Android for a better user experience. Battery(power) optimization is among one of the things which makes the user experience smooth. In earlier versions of Android, Google introduced features like Doze and App Standby modes which saves users’ battery.

Android Pie (Version 9 API level 28) introduced a new feature for better battery(power) management called App Standby Buckets. Each android application is now placed into one of the priority buckets based on the app’s usage patterns like how recently & how frequently the user has used the application. The android system then limits the app’s resources based on the bucket app is currently residing in.

What are Priority buckets?

The system dynamically assigns each app to a priority bucket, reassigning the apps as needed. More active apps are assigned to higher priority buckets, making more system resources available to the app. In particular, the bucket determines how frequently the app’s jobs run, how often the app can trigger alarms, and how often the app can receive high-priority FCM messages. These restrictions apply only while the device is on battery power; the system does not impose these restrictions on apps while the device is charging.

Note: The system may rely on a preloaded app that uses machine learning to determine how likely each app is to be used, and assigns apps to the appropriate buckets. Otherwise, the system defaults to sorting apps based on how recently they were used. Your app can find out what bucket it’s currently in by calling UsageStatsManager.getAppStandbyBucket().

The buckets are:

  • Active: An app is in the active bucket if the user is currently using the app or very recently used the app. The system does not place any restrictions on the app’s jobs, alarms, or FCM messages.
  • Working set: An app is in the working set bucket if it runs often but it is not currently active. The system imposes mild restrictions on its ability to run jobs and trigger alarms.
  • Frequent: An app is in the frequent bucket if it is used regularly, but not necessarily every day. The system imposes stronger restrictions on its ability to run jobs and trigger alarms, and also imposes a cap on high-priority FCM messages.
  • Rare: An app is in the rare bucket if it is not often used. The system imposes strict restrictions on its ability to run jobs, trigger alarms, and receive high-priority FCM messages. The system also limits the app’s ability to connect to the internet.
  • Never: An app is in the never bucket if it is installed but has never been run. The system imposes severe restrictions on these apps.

Note: Apps that are on the Doze whitelist are exempted from the App Standby Bucket-based restrictions.

Best practices

  • If an app does not have a launcher activity, it might never be promoted to the active bucket.
  • If the app’s notifications aren’t actionable, users won’t be able to trigger the app’s promotion to the active bucket by interacting with the notifications.
  • Similarly, if the app doesn’t show a notification upon receiving a high-priority FCM message, it won’t give the user a chance to interact with the app and thus promote it to the active bucket. In fact, the only intended use for high-priority FCM messages is to push a notification to the user, so this situation should never occur. If you inappropriately mark an FCM message as high-priority when it doesn’t trigger user interaction, it can cause other negative consequences; for example, it can result in your app exhausting its quota, causing genuinely urgent FCM messages to be treated as normal-priority.
  • Do not try to manipulate the system into putting your app into one bucket or another. The system’s bucketing methods can change, and every device manufacturer could choose to write their own bucketing app with its own algorithm. Instead, make sure your app behaves appropriately no matter which bucket it’s in.

Note: Users can also manually decide the priority bucket for a particular app on Android Pie or higher versions. They can do so from Developer Options settings of their device.

Thank You!!!

--

--