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

Commit ff6390cd authored by Christopher Tate's avatar Christopher Tate
Browse files

Allow direct-callback alarms for non-wakeup alarms

Turns out there are known use cases for it, in particular to avoid
interfering with doze/idle type optimizations.  In addition, it is
not reliably possible to aim for a specific *wall-clock* trigger time
when posting work to a Handler, since the time base used there is
uptime rather than elapsed.

Bug 26114467

Change-Id: I7cede733fc7e09704b63dfe3e98b00365bbdff35
parent caceb021
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
@@ -1233,14 +1233,6 @@ class AlarmManagerService extends SystemService {
                }
            }

            // direct-callback alarms must be wakeup alarms (otherwise they should just be
            // posting work to a Handler)
            if (directReceiver != null) {
                if (type != RTC_WAKEUP && type != ELAPSED_REALTIME_WAKEUP) {
                    throw new IllegalArgumentException("Only wakeup alarms can use AlarmReceivers");
                }
            }

            if (workSource != null) {
                getContext().enforcePermission(
                        android.Manifest.permission.UPDATE_DEVICE_STATS,