am c5ec3d0b: Merge change I2eee4ddc into eclair

Merge commit 'c5ec3d0bce03de10c4bb1bc5cf013494c6d62947' into eclair-mr2

* commit 'c5ec3d0bce03de10c4bb1bc5cf013494c6d62947':
  Improved fix for #2189704 (sync loss)
This commit is contained in:
Marc Blank 2009-11-04 14:53:35 -08:00 committed by Android Git Automerger
commit 038be0fc4d

View File

@ -87,6 +87,7 @@ public abstract class AbstractSyncParser extends Parser {
public boolean parse() throws IOException { public boolean parse() throws IOException {
int status; int status;
boolean moreAvailable = false; boolean moreAvailable = false;
boolean newSyncKey = false;
int interval = mMailbox.mSyncInterval; int interval = mMailbox.mSyncInterval;
// If we're not at the top of the xml tree, throw an exception // If we're not at the top of the xml tree, throw an exception
@ -140,10 +141,8 @@ public abstract class AbstractSyncParser extends Parser {
mAdapter.setSyncKey(newKey, true); mAdapter.setSyncKey(newKey, true);
cv.put(MailboxColumns.SYNC_KEY, newKey); cv.put(MailboxColumns.SYNC_KEY, newKey);
mailboxUpdated = true; mailboxUpdated = true;
} else if (moreAvailable) { newSyncKey = true;
userLog("!! SyncKey hasn't changed, setting moreAvailable = false"); }
moreAvailable = false;
}
// If we were pushing (i.e. auto-start), now we'll become ping-triggered // If we were pushing (i.e. auto-start), now we'll become ping-triggered
if (mMailbox.mSyncInterval == Mailbox.CHECK_INTERVAL_PUSH) { if (mMailbox.mSyncInterval == Mailbox.CHECK_INTERVAL_PUSH) {
mMailbox.mSyncInterval = Mailbox.CHECK_INTERVAL_PING; mMailbox.mSyncInterval = Mailbox.CHECK_INTERVAL_PING;
@ -153,6 +152,12 @@ public abstract class AbstractSyncParser extends Parser {
} }
} }
// If we don't have a new sync key, ignore moreAvailable (or we'll loop)
if (moreAvailable && !newSyncKey) {
userLog("!! SyncKey hasn't changed, setting moreAvailable = false");
moreAvailable = false;
}
// Commit any changes // Commit any changes
commit(); commit();