Wipe and Resync Mailbox on Bad Sync
Change-Id: I52f95641e2cc519944863d394f808d796b3c0a18
diff --git a/src/com/android/exchange/adapter/AbstractSyncParser.java b/src/com/android/exchange/adapter/AbstractSyncParser.java
index a3a0633..c7de131 100644
--- a/src/com/android/exchange/adapter/AbstractSyncParser.java
+++ b/src/com/android/exchange/adapter/AbstractSyncParser.java
@@ -144,8 +144,7 @@
if (status == 3 || CommandStatus.isBadSyncKey(status)) {
// Must delete all of the data and start over with syncKey of "0"
mMailbox.mSyncKey = "0";
- // TODO: Implement wipe.
- //mAdapter.wipe();
+ wipe();
// Indicate there's more so that we'll start syncing again
moreAvailable = true;
} else if (status == 16 || status == 5) {
@@ -217,6 +216,10 @@
return moreAvailable;
}
+ protected void wipe() {
+ // TODO: Implement for non email mailboxes
+ }
+
void userLog(String ...strings) {
// TODO: Convert to other logging types?
//mService.userLog(strings);
diff --git a/src/com/android/exchange/adapter/EmailSyncParser.java b/src/com/android/exchange/adapter/EmailSyncParser.java
index 76dd163..16f68d1 100644
--- a/src/com/android/exchange/adapter/EmailSyncParser.java
+++ b/src/com/android/exchange/adapter/EmailSyncParser.java
@@ -729,6 +729,12 @@
}
}
+ @Override
+ protected void wipe() {
+ LogUtils.i(TAG, "Wiping mailbox " + mMailbox);
+ Mailbox.resyncMailbox(mContentResolver, mAccount.mAmAccount, mMailbox.mId);
+ }
+
/**
* Commit all changes. This results in a Binder IPC call which has constraint on the size of
* the data, the docs say it currently 1MB. We set a limit to the size of the message we fetch