am 3af9f4cb: Merge change I9bec1244 into eclair-mr2

Merge commit '3af9f4cbf325ee8be923e98344e9a441c0284ae7' into eclair-mr2-plus-aosp

* commit '3af9f4cbf325ee8be923e98344e9a441c0284ae7':
  Fix #2300147 (mistakenly reporting connection error)
This commit is contained in:
Marc Blank 2009-12-07 10:21:57 -08:00 committed by Android Git Automerger
commit 3421041995

View File

@ -1138,19 +1138,23 @@ public class EasSyncService extends AbstractSyncService {
} catch (Exception e) {
userLog("Uncaught exception in EasSyncService", e);
} finally {
int status;
if (!mStop) {
userLog("Sync finished");
SyncManager.done(this);
// If this is the account mailbox, wake up SyncManager
// Because this box has a "push" interval, it will be restarted immediately
// which will cause the folder list to be reloaded...
int status;
switch (mExitStatus) {
case EXIT_IO_ERROR:
status = EmailServiceStatus.CONNECTION_ERROR;
break;
case EXIT_DONE:
status = EmailServiceStatus.SUCCESS;
ContentValues cv = new ContentValues();
cv.put(Mailbox.SYNC_TIME, System.currentTimeMillis());
String s = "S" + mSyncReason + ':' + status + ':' + mChangeCount;
cv.put(Mailbox.SYNC_STATUS, s);
mContentResolver.update(ContentUris.withAppendedId(Mailbox.CONTENT_URI,
mMailboxId), cv, null, null);
break;
case EXIT_LOGIN_FAILURE:
status = EmailServiceStatus.LOGIN_FAILED;
@ -1160,6 +1164,10 @@ public class EasSyncService extends AbstractSyncService {
errorLog("Sync ended due to an exception.");
break;
}
} else {
userLog("Stopped sync finished.");
status = EmailServiceStatus.SUCCESS;
}
try {
SyncManager.callback().syncMailboxStatus(mMailboxId, status, 0);
@ -1167,19 +1175,6 @@ public class EasSyncService extends AbstractSyncService {
// Don't care if this fails
}
if (mExitStatus == EXIT_DONE) {
// Save the sync time and status
ContentValues cv = new ContentValues();
cv.put(Mailbox.SYNC_TIME, System.currentTimeMillis());
String s = "S" + mSyncReason + ':' + status + ':' + mChangeCount;
cv.put(Mailbox.SYNC_STATUS, s);
mContentResolver.update(ContentUris.withAppendedId(Mailbox.CONTENT_URI,
mMailboxId), cv, null, null);
}
} else {
userLog("Stopped sync finished.");
}
// Make sure SyncManager knows about this
SyncManager.kick("sync finished");
}