Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 11381d0d authored by Suprabh Shukla's avatar Suprabh Shukla
Browse files

Move lower idle alarm throttling to rolling quotas

ALLOW_WHILE_IDLE_COMPAT_QUOTA is used for throttling the following
allowed-while-idle alarms:
- Inexact alarms that use a PendingIntent
- Listener alarms
- Exact alarms for pre-S apps
- Alarms from system power allowlisted apps

This quota has stayed at 1/9 minutes for legacy reasons. Fixed delay
throttling is suitable for a small subset of apps that have a sustained
presence and require periodic alarms for a long duration of time. Such
use cases can now move to the setPrioritized API.
Moving this quota to an equivalent rolling window quota of 7/hour since
that would generally be better suited for a large majority of apps as
it allows greater flexibility within the window.

Test: atest FrameworksMockingServicesTests:AlarmManagerServiceTest
Test: atest CtsAlarmManagerTestCases
Test: atest CtsBatterySavingTestCases:BatterySaverAlarmTest

Bug: 209514618
Change-Id: Iad8c3a4f652d1a95bd0deb9b49ecefa6f8bf5b64
Merged-In: Iad8c3a4f652d1a95bd0deb9b49ecefa6f8bf5b64
(cherry picked from commit 5cef33d2)
parent 52a61a8b
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -766,11 +766,11 @@ public class AlarmManagerService extends SystemService {
         * Default quota for pre-S apps. The same as allowing an alarm slot once
         * every ALLOW_WHILE_IDLE_LONG_DELAY, which was 9 minutes.
         */
        private static final int DEFAULT_ALLOW_WHILE_IDLE_COMPAT_QUOTA = 1;
        private static final int DEFAULT_ALLOW_WHILE_IDLE_COMPAT_QUOTA = 7;
        private static final int DEFAULT_ALLOW_WHILE_IDLE_QUOTA = 72;

        private static final long DEFAULT_ALLOW_WHILE_IDLE_WINDOW = 60 * 60 * 1000; // 1 hour.
        private static final long DEFAULT_ALLOW_WHILE_IDLE_COMPAT_WINDOW = 9 * 60 * 1000; // 9 mins.
        private static final long DEFAULT_ALLOW_WHILE_IDLE_COMPAT_WINDOW = 60 * 60 * 1000;

        private static final long DEFAULT_PRIORITY_ALARM_DELAY = 9 * 60_000;