Fix bug where upcoming alarm notification is left behind when single-use alarm is updated to recur on a weekday later than the current day

This commit is contained in:
Phillip Hsu 2016-09-22 23:26:40 -07:00
parent 41c4d27a09
commit 0bcaf8d2f5

View File

@ -60,7 +60,12 @@ public final class AlarmController {
return;
}
// TODO: Consider doing this in a new thread.
// Does nothing if it's not posted. This is primarily here for when alarms
// are updated, instead of newly created, so that we don't leave behind
// stray upcoming alarm notifications. This occurs e.g. when a single-use
// alarm is updated to recur on a weekday later than the current day.
removeUpcomingAlarmNotification(alarm);
Log.d(TAG, "Scheduling alarm " + alarm);
AlarmManager am = (AlarmManager) mAppContext.getSystemService(Context.ALARM_SERVICE);
// If there is already an alarm for this Intent scheduled (with the equality of two