From 47d124e4a100eda81a1458f38b563e208d2c9d79 Mon Sep 17 00:00:00 2001 From: Marc Blank Date: Sat, 24 Apr 2010 12:45:21 -0700 Subject: [PATCH] Fix upsync of DAILY rrule with UNTIL * Make sure we send UNTIL with FREQ=DAILY as appropriate * Also to help debug this in the future... Add logging capability to utilities via SyncManager Add public log methods so that CalendarUtilities can log properly Change Log.d's to SyncManager.log in CalendarUtilities Bug: 2623787 Change-Id: I3d651f00a3f7522e25c8d6e389469770c733953f --- src/com/android/exchange/SyncManager.java | 12 ++++++++---- .../exchange/utility/CalendarUtilities.java | 14 +++++++++----- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/com/android/exchange/SyncManager.java b/src/com/android/exchange/SyncManager.java index 4ee48c617..0e17d089c 100644 --- a/src/com/android/exchange/SyncManager.java +++ b/src/com/android/exchange/SyncManager.java @@ -953,16 +953,20 @@ public class SyncManager extends Service implements Runnable { }.start(); } - protected static void log(String str) { + public static void log(String str) { + log(TAG, str); + } + + public static void log(String tag, String str) { if (Eas.USER_LOG) { - Log.d(TAG, str); + Log.d(tag, str); if (Eas.FILE_LOG) { - FileLogger.log(TAG, str); + FileLogger.log(tag, str); } } } - protected static void alwaysLog(String str) { + public static void alwaysLog(String str) { if (!Eas.USER_LOG) { Log.d(TAG, str); } else { diff --git a/src/com/android/exchange/utility/CalendarUtilities.java b/src/com/android/exchange/utility/CalendarUtilities.java index 78c719f45..4051f1a93 100644 --- a/src/com/android/exchange/utility/CalendarUtilities.java +++ b/src/com/android/exchange/utility/CalendarUtilities.java @@ -27,6 +27,7 @@ import com.android.email.provider.EmailContent.Mailbox; import com.android.email.provider.EmailContent.Message; import com.android.exchange.Eas; import com.android.exchange.EasSyncService; +import com.android.exchange.SyncManager; import com.android.exchange.adapter.Serializer; import com.android.exchange.adapter.Tags; @@ -322,7 +323,7 @@ public class CalendarUtilities { String tziString = sTziStringCache.get(tz); if (tziString != null) { if (Eas.USER_LOG) { - Log.d(TAG, "TZI string for " + tz.getDisplayName() + " found in cache."); + SyncManager.log(TAG, "TZI string for " + tz.getDisplayName() + " found in cache."); } return tziString; } @@ -695,14 +696,14 @@ public class CalendarUtilities { TimeZone timeZone = sTimeZoneCache.get(timeZoneString); if (timeZone != null) { if (Eas.USER_LOG) { - Log.d(TAG, " Using cached TimeZone " + timeZone.getDisplayName()); + SyncManager.log(TAG, " Using cached TimeZone " + timeZone.getDisplayName()); } } else { timeZone = tziStringToTimeZoneImpl(timeZoneString); if (timeZone == null) { // If we don't find a match, we just return the current TimeZone. In theory, this // shouldn't be happening... - Log.w(TAG, "TimeZone not found using default: " + timeZoneString); + SyncManager.alwaysLog("TimeZone not found using default: " + timeZoneString); timeZone = TimeZone.getDefault(); } sTimeZoneCache.put(timeZoneString, timeZone); @@ -742,7 +743,7 @@ public class CalendarUtilities { String dn = timeZone.getDisplayName(); sTimeZoneCache.put(timeZoneString, timeZone); if (Eas.USER_LOG) { - Log.d(TAG, "TimeZone without DST found by offset: " + dn); + SyncManager.log(TAG, "TimeZone without DST found by offset: " + dn); } return timeZone; } else { @@ -1014,7 +1015,9 @@ public class CalendarUtilities { // This code must be updated when the Calendar adds new functionality static public void recurrenceFromRrule(String rrule, long startTime, Serializer s) throws IOException { - Log.d("RRULE", "rule: " + rrule); + if (Eas.USER_LOG) { + SyncManager.log(TAG, "RRULE: " + rrule); + } String freq = tokenFromRrule(rrule, "FREQ="); // If there's no FREQ=X, then we don't write a recurrence // Note that we duplicate s.start(Tags.CALENDAR_RECURRENCE); s.end(); to prevent the @@ -1024,6 +1027,7 @@ public class CalendarUtilities { s.start(Tags.CALENDAR_RECURRENCE); s.data(Tags.CALENDAR_RECURRENCE_TYPE, "0"); s.data(Tags.CALENDAR_RECURRENCE_INTERVAL, "1"); + addUntil(rrule, s); s.end(); } else if (freq.equals("WEEKLY")) { s.start(Tags.CALENDAR_RECURRENCE);