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
This commit is contained in:
Marc Blank 2010-04-24 12:45:21 -07:00
parent 2f1ce56fc8
commit 47d124e4a1
2 changed files with 17 additions and 9 deletions

View File

@ -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 {

View File

@ -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);