Adding a policy mechanism to control alarms
Alarms now keep track of their deliverability per different throttling policies. Each policy can dictate a time such that the alarm cannot expire any earlier than that. The ultimate delivery start is then calculated as the latest of these times. This makes it simpler to manage different throttling policies separately. Adding two policies to start: 1. Requester policy: This defines the time when the caller requested the alarm to go off. For an alarm with FLAG_IDLE_UNTIL, this is adjusted to be before the next WAKE_FROM_IDLE. This is an exceptional case as this alarm is supposed to be exempt from all the other policies. 2. App-standby policy: This defines the time when the caller app is going to be in quota as per its app-standby-bucket. The delivery end is chosen to the delivery start or (requester policy time + the supplied window), whichever is later. Also, fixed some bugs related to idle-until-time not getting snapped to the next wake-from-idle time in some cases. Test: atest FrameworksMockingServicesTests:\ com.android.server.alarm atest CtsAlarmManagerTestCases atest CtsAppTestCases:AlarmManagerTest Bug: 170279979 Change-Id: Ib7fac90fe4804b624568ca4c6eba7a4cbc8a8aad
Loading
Please register or sign in to comment