Merge change I9bec1244 into eclair-mr2

* changes:
  Fix #2300147 (mistakenly reporting connection error)
This commit is contained in:
Android (Google) Code Review 2009-12-07 10:19:23 -08:00
commit 3af9f4cbf3

View File

@ -1138,19 +1138,23 @@ public class EasSyncService extends AbstractSyncService {
} catch (Exception e) { } catch (Exception e) {
userLog("Uncaught exception in EasSyncService", e); userLog("Uncaught exception in EasSyncService", e);
} finally { } finally {
int status;
if (!mStop) { if (!mStop) {
userLog("Sync finished"); userLog("Sync finished");
SyncManager.done(this); 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) { switch (mExitStatus) {
case EXIT_IO_ERROR: case EXIT_IO_ERROR:
status = EmailServiceStatus.CONNECTION_ERROR; status = EmailServiceStatus.CONNECTION_ERROR;
break; break;
case EXIT_DONE: case EXIT_DONE:
status = EmailServiceStatus.SUCCESS; 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; break;
case EXIT_LOGIN_FAILURE: case EXIT_LOGIN_FAILURE:
status = EmailServiceStatus.LOGIN_FAILED; status = EmailServiceStatus.LOGIN_FAILED;
@ -1160,24 +1164,15 @@ public class EasSyncService extends AbstractSyncService {
errorLog("Sync ended due to an exception."); errorLog("Sync ended due to an exception.");
break; break;
} }
try {
SyncManager.callback().syncMailboxStatus(mMailboxId, status, 0);
} catch (RemoteException e1) {
// 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 { } else {
userLog("Stopped sync finished."); userLog("Stopped sync finished.");
status = EmailServiceStatus.SUCCESS;
}
try {
SyncManager.callback().syncMailboxStatus(mMailboxId, status, 0);
} catch (RemoteException e1) {
// Don't care if this fails
} }
// Make sure SyncManager knows about this // Make sure SyncManager knows about this