According to a blog post from Hoi Lam, a lead developer advocate for Wear OS, the team plans to leverage App Standby Buckets from Android P to fine-tune battery life in smartwatches.
The change comes after the development team tested a blanket solution in the Wear OS Developer Preview. The original solution was to disable all alarms and jobs for background apps.
After taking feedback from app developers and reviewing the impact on battery statistics, the Wear OS team decided to reverse the change and switch to App Standby Buckets.
What are App Standby Buckets?
App Standby Buckets are part of the inner workings of Adaptive Battery. Google announced Adaptive Battery at Google I/O last month. The feature leverages DeepMind artificial intelligence to analyze how you use apps. Then the system adjusts the amount of resources — like battery — available to the app.
Additionally, Adaptive Battery restricts how apps run ‘jobs’ and trigger ‘alarms.’ ‘Jobs’ and ‘Alarms’ are requests apps make that wake up the device. These are things like a request from Facebook to check for notifications and a subsequent request to notify the user.
App Standby Buckets are how the system categorizes apps. The system can place an app into one of five categories; Active, Working set, Frequent, Rare and a special Never bucket.
How App Standby Buckets work
Apps currently in use are placed in the Active bucket with no restrictions on active apps. The system places an app in the Working set if it’s used often but isn’t currently active. The system places mild restrictions on these apps’ ability to run jobs and trigger alarms.
If an app is used often but not every day, the system places it in the Frequent bucket. These apps receive stronger restrictions on jobs and alarms. Additionally, the system puts a cap on how many high-priority Firebase Cloud Messages (FCMs) an app can send. FCMs are part of a cross-platform app notification system. Developers can use FCMs to send, for example, email notifications to iOS, Android and web users.
The Rare bucket has the second strongest restrictions and also limits an app’s ability to connect to the internet. Apps that have never been used by the user are placed in the Never bracket with the most severe restrictions.
How this affects developers
The development team for Wear OS is still working on the feature. Specifically, the team is working on getting the exact settings for background apps right. Furthermore, the team urges developers to update apps to ensure they work properly regardless of the bucket the app is placed in.
One area Lam highlighted was privacy. With the new adjustments, some Wear OS apps may need to run a foreground service to access a sensor on the watch. Android P limits background services from accessing device sensors like camera or microphone to protect user privacy.
Developers with devices running the Wear OS Developer Preview won’t have to reinstall to get the change. All connected Wear OS devices should reflect the change.
Source: Android Developers Blog