summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMartin Hibdon <mhibdon@google.com>2014-09-26 15:44:11 -0700
committerMartin Hibdon <mhibdon@google.com>2014-09-27 16:34:31 -0700
commit9a93ac01a7b260fac12cd613d0c99690ecf298bf (patch)
treeaa32d7cd1702b126d966d15cb26b6c36c871e26f /src
parente23e45c747d03032e2e81e40bb3a8bf5a87ba47c (diff)
downloadandroid_packages_apps_Exchange-9a93ac01a7b260fac12cd613d0c99690ecf298bf.tar.gz
android_packages_apps_Exchange-9a93ac01a7b260fac12cd613d0c99690ecf298bf.tar.bz2
android_packages_apps_Exchange-9a93ac01a7b260fac12cd613d0c99690ecf298bf.zip
When we migrate Exchange folders, set the sync status to INITIAL_SYNC_NEEDED
b/17443087 When we migrate exchange accounts, we copy mailboxes over to the new account (in order to preserve sync frequency and window). The problem with this is, you may have many accounts/mailboxes. After starting the app, it may take quite a long time before all mailboxes are synced. If the user visits some mailbox near the bottom, they'll see a misleading "folder is empty" view. Now, when migrating, we'll set the uisyncstatus to INITIAL_SYNC_NEEDED. The issue here is that when we start a fresh sync, we temporarily store sync info needed in RAM, clear all of the folders, then restore the sync. I needed to add uiSyncStatus to the list of attributes copied over. Change-Id: I223d2e000cfd48f62ce694365cbb8ec3850a50b3
Diffstat (limited to 'src')
-rw-r--r--src/com/android/exchange/adapter/FolderSyncParser.java19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/com/android/exchange/adapter/FolderSyncParser.java b/src/com/android/exchange/adapter/FolderSyncParser.java
index c90be630..acd71d39 100644
--- a/src/com/android/exchange/adapter/FolderSyncParser.java
+++ b/src/com/android/exchange/adapter/FolderSyncParser.java
@@ -42,6 +42,7 @@ import com.android.exchange.CommandStatusException.CommandStatus;
import com.android.exchange.Eas;
import com.android.exchange.eas.EasSyncContacts;
import com.android.exchange.eas.EasSyncCalendar;
+import com.android.mail.providers.UIProvider;
import com.android.mail.utils.LogUtils;
import com.google.common.annotations.VisibleForTesting;
@@ -316,10 +317,12 @@ public class FolderSyncParser extends AbstractSyncParser {
private static class SyncOptions {
private final int mInterval;
private final int mLookback;
+ private final int mSyncState;
- private SyncOptions(int interval, int lookback) {
+ private SyncOptions(int interval, int lookback, int syncState) {
mInterval = interval;
mLookback = lookback;
+ mSyncState = syncState;
}
}
@@ -329,10 +332,12 @@ public class FolderSyncParser extends AbstractSyncParser {
SyncWindow.SYNC_WINDOW_ACCOUNT + ")";
private static final String[] MAILBOX_STATE_PROJECTION = new String[] {
- MailboxColumns.SERVER_ID, MailboxColumns.SYNC_INTERVAL, MailboxColumns.SYNC_LOOKBACK};
+ MailboxColumns.SERVER_ID, MailboxColumns.SYNC_INTERVAL, MailboxColumns.SYNC_LOOKBACK,
+ MailboxColumns.UI_SYNC_STATUS};
private static final int MAILBOX_STATE_SERVER_ID = 0;
private static final int MAILBOX_STATE_INTERVAL = 1;
private static final int MAILBOX_STATE_LOOKBACK = 2;
+ private static final int MAILBOX_STATE_SYNC_STATUS = 3;
@VisibleForTesting
final HashMap<String, SyncOptions> mSyncOptionsMap = new HashMap<String, SyncOptions>();
@@ -349,9 +354,17 @@ public class FolderSyncParser extends AbstractSyncParser {
if (c != null) {
try {
while (c.moveToNext()) {
+ int syncStatus = c.getInt(MAILBOX_STATE_SYNC_STATUS);
+ // The only sync status I would ever want to propagate is INITIAL_SYNC_NEEDED.
+ // This is so that after a migration from the old Email to Unified Gmail
+ // won't appear to be empty, but not syncing.
+ if (syncStatus != UIProvider.SyncStatus.INITIAL_SYNC_NEEDED) {
+ syncStatus = UIProvider.SyncStatus.NO_SYNC;
+ }
mSyncOptionsMap.put(c.getString(MAILBOX_STATE_SERVER_ID),
new SyncOptions(c.getInt(MAILBOX_STATE_INTERVAL),
- c.getInt(MAILBOX_STATE_LOOKBACK)));
+ c.getInt(MAILBOX_STATE_LOOKBACK),
+ syncStatus));
}
} finally {
c.close();