UpcomingAlarmReceiver and PendingAlarmScheduler load alarm in background

This commit is contained in:
Phillip Hsu
2016-07-07 03:18:03 -07:00
parent 4eb27df911
commit 9380f8f579
9 changed files with 93 additions and 56 deletions
@@ -65,6 +65,8 @@ public final class AlarmUtils {
notifyUpcomingAlarmIntent(context, alarm, false));
am.setExact(AlarmManager.RTC_WAKEUP, ringAt, alarmIntent(context, alarm, false));
// TODO: Consider removing this and letting callers handle Toasts, because
// it could be beneficial for callers to schedule the alarm in a worker thread.
if (showToast) {
String message;
if (alarm.isSnoozed()) {
@@ -97,6 +99,10 @@ public final class AlarmUtils {
removeUpcomingAlarmNotification(c, a);
// We can't remove this and instead let callers handle Toasts
// without complication, because callers would then have to
// handle cases when the alarm is snoozed and/or has
// recurrence themselves.
// TOneverDO: Place block after making value changes to the alarm.
if (showToast && (a.ringsWithinHours(hoursBeforeUpcoming(c)) || a.isSnoozed())) {
String time = formatTime(c, a.isSnoozed() ? a.snoozingUntil() : a.ringsAt());