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
This commit is contained in:
parent
41783647e8
commit
ddfe27d9a0
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user