Use original all-day flag when upsyncing exceptions
Bug: 3087410 Change-Id: I4bed0039758e98d4b85054876f192605eb00ee82
This commit is contained in:
parent
9c293eb65a
commit
9ce8f4d2a3
|
@ -1428,18 +1428,12 @@ public class CalendarSyncAdapter extends AbstractSyncAdapter {
|
||||||
// 2) Serialize attendees and reminders from subvalues
|
// 2) Serialize attendees and reminders from subvalues
|
||||||
// 3) Look for exceptions and serialize with the top-level event
|
// 3) Look for exceptions and serialize with the top-level event
|
||||||
ContentValues entityValues = entity.getEntityValues();
|
ContentValues entityValues = entity.getEntityValues();
|
||||||
boolean isException = (clientId == null);
|
final boolean isException = (clientId == null);
|
||||||
boolean hasAttendees = false;
|
boolean hasAttendees = false;
|
||||||
boolean isChange = entityValues.containsKey(Events._SYNC_ID);
|
final boolean isChange = entityValues.containsKey(Events._SYNC_ID);
|
||||||
Double version = mService.mProtocolVersionDouble;
|
final Double version = mService.mProtocolVersionDouble;
|
||||||
|
final boolean allDay =
|
||||||
boolean allDay = false;
|
CalendarUtilities.getIntegerValueAsBoolean(entityValues, Events.ALL_DAY);
|
||||||
if (entityValues.containsKey(Events.ALL_DAY)) {
|
|
||||||
Integer ade = entityValues.getAsInteger(Events.ALL_DAY);
|
|
||||||
if (ade != null && ade != 0) {
|
|
||||||
allDay = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// NOTE: Exchange 2003 (EAS 2.5) seems to require the "exception deleted" and "exception
|
// NOTE: Exchange 2003 (EAS 2.5) seems to require the "exception deleted" and "exception
|
||||||
// start time" data before other data in exceptions. Failure to do so results in a
|
// start time" data before other data in exceptions. Failure to do so results in a
|
||||||
|
@ -1455,7 +1449,7 @@ public class CalendarSyncAdapter extends AbstractSyncAdapter {
|
||||||
// If we're deleted, the UI will continue to show this exception until we mark
|
// If we're deleted, the UI will continue to show this exception until we mark
|
||||||
// it canceled, so we'll do that here...
|
// it canceled, so we'll do that here...
|
||||||
if (isDeleted && !isCanceled) {
|
if (isDeleted && !isCanceled) {
|
||||||
long eventId = entityValues.getAsLong(Events._ID);
|
final long eventId = entityValues.getAsLong(Events._ID);
|
||||||
ContentValues cv = new ContentValues();
|
ContentValues cv = new ContentValues();
|
||||||
cv.put(Events.STATUS, Events.STATUS_CANCELED);
|
cv.put(Events.STATUS, Events.STATUS_CANCELED);
|
||||||
mService.mContentResolver.update(
|
mService.mContentResolver.update(
|
||||||
|
@ -1468,7 +1462,10 @@ public class CalendarSyncAdapter extends AbstractSyncAdapter {
|
||||||
// TODO Add reminders to exceptions (allow them to be specified!)
|
// TODO Add reminders to exceptions (allow them to be specified!)
|
||||||
Long originalTime = entityValues.getAsLong(Events.ORIGINAL_INSTANCE_TIME);
|
Long originalTime = entityValues.getAsLong(Events.ORIGINAL_INSTANCE_TIME);
|
||||||
if (originalTime != null) {
|
if (originalTime != null) {
|
||||||
if (allDay) {
|
final boolean originalAllDay =
|
||||||
|
CalendarUtilities.getIntegerValueAsBoolean(entityValues,
|
||||||
|
Events.ORIGINAL_ALL_DAY);
|
||||||
|
if (originalAllDay) {
|
||||||
// For all day events, we need our local all-day time
|
// For all day events, we need our local all-day time
|
||||||
originalTime =
|
originalTime =
|
||||||
CalendarUtilities.getLocalAllDayCalendarTime(originalTime, mLocalTimeZone);
|
CalendarUtilities.getLocalAllDayCalendarTime(originalTime, mLocalTimeZone);
|
||||||
|
|
|
@ -1737,4 +1737,16 @@ public class CalendarUtilities {
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a boolean value for an integer ContentValues column
|
||||||
|
* @param values a ContentValues object
|
||||||
|
* @param columnName the name of a column to be found in the ContentValues
|
||||||
|
* @return a boolean representation of the value of columnName in values; null and 0 = false,
|
||||||
|
* other integers = true
|
||||||
|
*/
|
||||||
|
static public boolean getIntegerValueAsBoolean(ContentValues values, String columnName) {
|
||||||
|
Integer intValue = values.getAsInteger(columnName);
|
||||||
|
return (intValue != null && intValue != 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -927,6 +927,17 @@ public class CalendarUtilitiesTests extends SyncAdapterTestCase<CalendarSyncAdap
|
||||||
// Milliseconds aren't zeroed out and may not be the same
|
// Milliseconds aren't zeroed out and may not be the same
|
||||||
assertEquals(convertedLocalTime/1000, correctLocalTime/1000);
|
assertEquals(convertedLocalTime/1000, correctLocalTime/1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testGetIntegerValueAsBoolean() {
|
||||||
|
ContentValues cv = new ContentValues();
|
||||||
|
cv.put("A", 1);
|
||||||
|
cv.put("B", 69);
|
||||||
|
cv.put("C", 0);
|
||||||
|
assertTrue(CalendarUtilities.getIntegerValueAsBoolean(cv, "A"));
|
||||||
|
assertTrue(CalendarUtilities.getIntegerValueAsBoolean(cv, "B"));
|
||||||
|
assertFalse(CalendarUtilities.getIntegerValueAsBoolean(cv, "C"));
|
||||||
|
assertFalse(CalendarUtilities.getIntegerValueAsBoolean(cv, "D"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO Planned unit tests
|
// TODO Planned unit tests
|
||||||
|
|
Loading…
Reference in New Issue