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

Commit 7f8041f2 authored by Christopher Tate's avatar Christopher Tate
Browse files

Allow system processes to set near-future alarms

Bug: 151689784
Test: atest CtsAlarmManagerTestCases
Test: atest FrameworksMockingServicesTests:AlarmManagerServiceTest
Test: observe DHCP +2 sec alarm

Change-Id: Ic987eb168fb632d77e841f33518c2d0ea650693e
parent 86a91d2d
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -1741,8 +1741,9 @@ class AlarmManagerService extends SystemService {

        final long nowElapsed = mInjector.getElapsedRealtime();
        final long nominalTrigger = convertToElapsed(triggerAtTime, type);
        // Try to prevent spamming by making sure we aren't firing alarms in the immediate future
        final long minTrigger = nowElapsed + mConstants.MIN_FUTURITY;
        // Try to prevent spamming by making sure apps aren't firing alarms in the immediate future
        final long minTrigger = nowElapsed
                + (UserHandle.isCore(callingUid) ? 0L : mConstants.MIN_FUTURITY);
        final long triggerElapsed = (nominalTrigger > minTrigger) ? nominalTrigger : minTrigger;

        final long maxElapsed;