Skip to content
Commit bd8f2ea6 authored by Suprabh Shukla's avatar Suprabh Shukla
Browse files

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
parent 50c75788
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment