summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/com/android/providers/calendar/CalendarAlarmManager.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/com/android/providers/calendar/CalendarAlarmManager.java b/src/com/android/providers/calendar/CalendarAlarmManager.java
index f25d3de..5f8c00c 100644
--- a/src/com/android/providers/calendar/CalendarAlarmManager.java
+++ b/src/com/android/providers/calendar/CalendarAlarmManager.java
@@ -137,7 +137,13 @@ public class CalendarAlarmManager {
}
void scheduleNextAlarm(boolean removeAlarms) {
- if (!mNextAlarmCheckScheduled.getAndSet(true)) {
+ // We must always run the following when 'removeAlarms' is true. Previously it
+ // was possible to have a race condition on startup between TIME_CHANGED and
+ // BOOT_COMPLETED broadcast actions. This resulted in alarms being
+ // missed (Bug 7221716) when the TIME_CHANGED broadcast ('removeAlarms' = false)
+ // happened right before the BOOT_COMPLETED ('removeAlarms' = true), and the
+ // BOOT_COMPLETED action was skipped since there was concurrent scheduling in progress.
+ if (!mNextAlarmCheckScheduled.getAndSet(true) || removeAlarms) {
if (Log.isLoggable(CalendarProvider2.TAG, Log.DEBUG)) {
Log.d(CalendarProvider2.TAG, "Scheduling check of next Alarm");
}