From ddfe27d9a06e1f1ebee8f6cf7948f5fb080b8d25 Mon Sep 17 00:00:00 2001 From: Marc Blank Date: Tue, 16 Mar 2010 22:21:38 -0700 Subject: [PATCH] Only delete events locally when calendar is disabled * Disabling a Calendar is supposed to delete all events from the database via CalendarProvider * We didn't call the delete method with the CALLER_IS_SYNCADAPTER parameter, so the deletions were propagating to the server, which is VERY bad * This CL adds the parameter to the URI used for deletion Bug: 2521196 Change-Id: Ib366979fe32ebff0f8cfa3e3f0843ad7e2af4d47 --- src/com/android/exchange/SyncManager.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/com/android/exchange/SyncManager.java b/src/com/android/exchange/SyncManager.java index d4501b8ea..77d98cd59 100644 --- a/src/com/android/exchange/SyncManager.java +++ b/src/com/android/exchange/SyncManager.java @@ -702,8 +702,13 @@ public class SyncManager extends Service implements Runnable { // Reset the sync key locally in the Mailbox and set it not to sync cv.put(Mailbox.SYNC_KEY, "0"); cv.put(Mailbox.SYNC_INTERVAL, Mailbox.CHECK_INTERVAL_NEVER); - // Delete all events in this calendar - mResolver.delete(Events.CONTENT_URI, WHERE_CALENDAR_ID, + // Delete all events in this calendar using the sync adapter + // parameter so that the deletion is only local + Uri eventsAsSyncAdapter = + Events.CONTENT_URI.buildUpon() + .appendQueryParameter(Calendar.CALLER_IS_SYNCADAPTER, + "true").build(); + mResolver.delete(eventsAsSyncAdapter, WHERE_CALENDAR_ID, new String[] {Long.toString(mCalendarId)}); // TODO Stop sync in progress?? } else {