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

Commit 44239e1d authored by Christopher Tate's avatar Christopher Tate
Browse files

Use the new AlarmManager.setExact() for our alarms

Alarm clocks tend to need guaranteed timely delivery of their alarms,
so they are well justified in needing the new API.

Bug 9532215

Change-Id: I383f49c19bc8e8f9bceb8c246d972fb838da092d
parent f45aa3fe
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -450,7 +450,7 @@ public class Alarms {
        PendingIntent sender = PendingIntent.getBroadcast(
                context, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT);

        am.set(AlarmManager.RTC_WAKEUP, atTimeInMillis, sender);
        am.setExact(AlarmManager.RTC_WAKEUP, atTimeInMillis, sender);

        setStatusBarIcon(context, true);

+2 −2
Original line number Diff line number Diff line
@@ -167,7 +167,7 @@ public class TimerReceiver extends BroadcastReceiver {
        PendingIntent p = PendingIntent.getBroadcast(context,
                0, intent, PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_UPDATE_CURRENT);
        if (t != null) {
            mngr.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, nextTimesup, p);
            mngr.setExact(AlarmManager.ELAPSED_REALTIME_WAKEUP, nextTimesup, p);
            Log.d(TAG,"Setting times up to " + nextTimesup);
        } else {
            Log.d(TAG,"canceling times up");
@@ -269,7 +269,7 @@ public class TimerReceiver extends BroadcastReceiver {
                PendingIntent.getBroadcast(context, 0, nextBroadcast, 0);
        AlarmManager alarmManager =
                (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
        alarmManager.set(AlarmManager.ELAPSED_REALTIME, nextBroadcastTime, pendingNextBroadcast);
        alarmManager.setExact(AlarmManager.ELAPSED_REALTIME, nextBroadcastTime, pendingNextBroadcast);
    }

    private static void showCollapsedNotification(final Context context, String title, String text,