From 0bbe34bce5284bf20fb60b20fc6679c3f9b4749a Mon Sep 17 00:00:00 2001 From: Marc Blank Date: Thu, 4 Feb 2010 15:23:09 -0800 Subject: [PATCH] Fix #2420732 (crash in Google Services Framework) * Exchange calendar sync created Event records for exceptions that didn't have a _sync_id * This caused google calendar sync to try to upload these Events as new, which caused an Exception to be thrown * Fixed EAS calendar sync adapter to generate a _sync_id for exceptions in the form _ Bug: 2420732 Change-Id: I46769175ca89ffa4cec4fe8b0c35ef2242536185 --- .../android/exchange/adapter/CalendarSyncAdapter.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/com/android/exchange/adapter/CalendarSyncAdapter.java b/src/com/android/exchange/adapter/CalendarSyncAdapter.java index 5a202bb88..49af06cf2 100644 --- a/src/com/android/exchange/adapter/CalendarSyncAdapter.java +++ b/src/com/android/exchange/adapter/CalendarSyncAdapter.java @@ -19,7 +19,6 @@ package com.android.exchange.adapter; import com.android.email.Email; import com.android.email.provider.EmailContent.Mailbox; -import com.android.exchange.Eas; import com.android.exchange.EasSyncService; import com.android.exchange.utility.CalendarUtilities; import com.android.exchange.utility.Duration; @@ -440,11 +439,13 @@ public class CalendarSyncAdapter extends AbstractSyncAdapter { // TODO Make sure calendar knows this isn't globally unique!! cv.put(Events.ORIGINAL_EVENT, parentCv.getAsString(Events._SYNC_ID)); + String exceptionStartTime = "_noStartTime"; while (nextTag(Tags.SYNC_APPLICATION_DATA) != END) { switch (tag) { case Tags.CALENDAR_EXCEPTION_START_TIME: + exceptionStartTime = getValue(); cv.put(Events.ORIGINAL_INSTANCE_TIME, - CalendarUtilities.parseDateTimeToMillis(getValue())); + CalendarUtilities.parseDateTimeToMillis(exceptionStartTime)); break; case Tags.CALENDAR_EXCEPTION_IS_DELETED: if (getValueInt() == 1) { @@ -501,6 +502,10 @@ public class CalendarSyncAdapter extends AbstractSyncAdapter { } } + // We need a _sync_id, but it can't be the parent's id, so we generate one + cv.put(Events._SYNC_ID, parentCv.getAsString(Events._SYNC_ID) + '_' + + exceptionStartTime); + if (!cv.containsKey(Events.DTSTART)) { cv.put(Events.DTSTART, parentCv.getAsLong(Events.DTSTART)); }