A new power management feature called App Standby Bucket has beed added in Android 9(Pie).
App Standby Bucket allows Android system to categorize priorities of apps in 5 buckets as follows;
- Working set
Apps go into one of those buckets according to how actively they are used.
An important thing to notice is that FCM receiving behavior in Doze mode is affected depending on which bucket an app belongs to. Basically, an FCM message with high priority wakes up the app even when in Doze mode. However, the maximum number of high priority messages the app can receive is limited when in some particular buckets
- Acive: Unlimited
- Working set: Unlimited
- Frequent: 10 per day
- Rare: 5 per day
But if a message is followed by a user interaction (such as showing a notification), it does not consume the quota.
ADB shell commands
We can see and change an app’s current bucket with these commands.
$ adb shell am set-standby-bucket packagename active|working_set|frequent|rare
$ adb shell am set-standby-bucket package1 bucket1 package2 bucket2...
$ adb shell am get-standby-bucket [packagename]
Meanings of the numbers
When get-standby-bucket is executed, just a number will be returned, not like Active, Working set, or etc.
Each number corresponds to:
- 10: Active
- 20: Working set
- 30: Frequent
- 40: Rare
Additionally, there are two more values (these are not documented)
- 5: Exempted
- The app is whitelisted and not affected by power management
- 50: Never
- The app has never been used