summaryrefslogtreecommitdiffstats
path: root/src/com/android/calendar/alerts/AlertService.java
diff options
context:
space:
mode:
authorPaul Sliwowski <psliwowski@google.com>2013-06-17 18:06:51 -0700
committerPaul Sliwowski <psliwowski@google.com>2013-06-19 21:45:36 -0700
commit137031dd7ff3f2dae9442916d1635f8483b12f53 (patch)
treef4d47e92d5e3b4ba3fa24d5c98f7745b6545b400 /src/com/android/calendar/alerts/AlertService.java
parenta0b14abb2b333c72d8be3fe7f8282837961341d2 (diff)
downloadandroid_packages_apps_Calendar-137031dd7ff3f2dae9442916d1635f8483b12f53.tar.gz
android_packages_apps_Calendar-137031dd7ff3f2dae9442916d1635f8483b12f53.tar.bz2
android_packages_apps_Calendar-137031dd7ff3f2dae9442916d1635f8483b12f53.zip
Add in-memory cache to dismiss alerts that we haven't seen yet.
Bug: 9018194 This adds an in-memory cache of alerts that we haven't seen yet, so that we can dismiss them once the calendar data provider syncs. Change-Id: I9490f478681783200a5cb8309a58243723bda4c1
Diffstat (limited to 'src/com/android/calendar/alerts/AlertService.java')
-rw-r--r--src/com/android/calendar/alerts/AlertService.java11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/com/android/calendar/alerts/AlertService.java b/src/com/android/calendar/alerts/AlertService.java
index fbb5ad13..ecd85723 100644
--- a/src/com/android/calendar/alerts/AlertService.java
+++ b/src/com/android/calendar/alerts/AlertService.java
@@ -216,6 +216,13 @@ public class AlertService extends Service {
}
}
+ // If we dismissed a notification for a new event, then we need to sync the cache when
+ // an ACTION_PROVIDER_CHANGED event has been sent. Unfortunately, the data provider
+ // has a delay of CalendarProvider2.SYNC_UPDATE_BROADCAST_TIMEOUT_MILLIS (ie. 30 sec.)
+ // until it notifies us that the sync adapter has finished.
+ // TODO(psliwowski): Find a quicker way to be notified when the data provider has the
+ // syncId for event.
+ GlobalDismissManager.syncSenderDismissCache(this);
updateAlertNotification(this);
} else if (action.equals(Intent.ACTION_BOOT_COMPLETED)) {
// The provider usually initiates this setting up of alarms on startup,
@@ -277,6 +284,8 @@ public class AlertService extends Service {
return true;
}
+ // Sync CalendarAlerts with global dismiss cache before query it
+ GlobalDismissManager.syncReceiverDismissCache(context);
Cursor alertCursor = cr.query(CalendarAlerts.CONTENT_URI, ALERT_PROJECTION,
(ACTIVE_ALERTS_SELECTION + currentTime), ACTIVE_ALERTS_SELECTION_ARGS,
ACTIVE_ALERTS_SORT);
@@ -814,7 +823,7 @@ public class AlertService extends Service {
lowPriorityEvents.add(newInfo);
}
}
- // TODO(cwren) add beginTime/startTime
+ // TODO(psliwowski): move this to account synchronization
GlobalDismissManager.processEventIds(context, eventIds.keySet());
} finally {
if (alertCursor != null) {