Merge "Fix upsync of DAILY rrule with UNTIL" into froyo

This commit is contained in:
Marc Blank 2010-04-25 20:27:54 -07:00 committed by Android (Google) Code Review
commit 0f68676828
2 changed files with 17 additions and 9 deletions

View File

@ -953,16 +953,20 @@ public class SyncManager extends Service implements Runnable {
}.start(); }.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) { if (Eas.USER_LOG) {
Log.d(TAG, str); Log.d(tag, str);
if (Eas.FILE_LOG) { 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) { if (!Eas.USER_LOG) {
Log.d(TAG, str); Log.d(TAG, str);
} else { } else {

View File

@ -27,6 +27,7 @@ import com.android.email.provider.EmailContent.Mailbox;
import com.android.email.provider.EmailContent.Message; import com.android.email.provider.EmailContent.Message;
import com.android.exchange.Eas; import com.android.exchange.Eas;
import com.android.exchange.EasSyncService; import com.android.exchange.EasSyncService;
import com.android.exchange.SyncManager;
import com.android.exchange.adapter.Serializer; import com.android.exchange.adapter.Serializer;
import com.android.exchange.adapter.Tags; import com.android.exchange.adapter.Tags;
@ -322,7 +323,7 @@ public class CalendarUtilities {
String tziString = sTziStringCache.get(tz); String tziString = sTziStringCache.get(tz);
if (tziString != null) { if (tziString != null) {
if (Eas.USER_LOG) { 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; return tziString;
} }
@ -695,14 +696,14 @@ public class CalendarUtilities {
TimeZone timeZone = sTimeZoneCache.get(timeZoneString); TimeZone timeZone = sTimeZoneCache.get(timeZoneString);
if (timeZone != null) { if (timeZone != null) {
if (Eas.USER_LOG) { if (Eas.USER_LOG) {
Log.d(TAG, " Using cached TimeZone " + timeZone.getDisplayName()); SyncManager.log(TAG, " Using cached TimeZone " + timeZone.getDisplayName());
} }
} else { } else {
timeZone = tziStringToTimeZoneImpl(timeZoneString); timeZone = tziStringToTimeZoneImpl(timeZoneString);
if (timeZone == null) { if (timeZone == null) {
// If we don't find a match, we just return the current TimeZone. In theory, this // If we don't find a match, we just return the current TimeZone. In theory, this
// shouldn't be happening... // shouldn't be happening...
Log.w(TAG, "TimeZone not found using default: " + timeZoneString); SyncManager.alwaysLog("TimeZone not found using default: " + timeZoneString);
timeZone = TimeZone.getDefault(); timeZone = TimeZone.getDefault();
} }
sTimeZoneCache.put(timeZoneString, timeZone); sTimeZoneCache.put(timeZoneString, timeZone);
@ -742,7 +743,7 @@ public class CalendarUtilities {
String dn = timeZone.getDisplayName(); String dn = timeZone.getDisplayName();
sTimeZoneCache.put(timeZoneString, timeZone); sTimeZoneCache.put(timeZoneString, timeZone);
if (Eas.USER_LOG) { 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; return timeZone;
} else { } else {
@ -1014,7 +1015,9 @@ public class CalendarUtilities {
// This code must be updated when the Calendar adds new functionality // This code must be updated when the Calendar adds new functionality
static public void recurrenceFromRrule(String rrule, long startTime, Serializer s) static public void recurrenceFromRrule(String rrule, long startTime, Serializer s)
throws IOException { throws IOException {
Log.d("RRULE", "rule: " + rrule); if (Eas.USER_LOG) {
SyncManager.log(TAG, "RRULE: " + rrule);
}
String freq = tokenFromRrule(rrule, "FREQ="); String freq = tokenFromRrule(rrule, "FREQ=");
// If there's no FREQ=X, then we don't write a recurrence // 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 // 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.start(Tags.CALENDAR_RECURRENCE);
s.data(Tags.CALENDAR_RECURRENCE_TYPE, "0"); s.data(Tags.CALENDAR_RECURRENCE_TYPE, "0");
s.data(Tags.CALENDAR_RECURRENCE_INTERVAL, "1"); s.data(Tags.CALENDAR_RECURRENCE_INTERVAL, "1");
addUntil(rrule, s);
s.end(); s.end();
} else if (freq.equals("WEEKLY")) { } else if (freq.equals("WEEKLY")) {
s.start(Tags.CALENDAR_RECURRENCE); s.start(Tags.CALENDAR_RECURRENCE);