diff --git a/src/com/android/exchange/SyncManager.java b/src/com/android/exchange/SyncManager.java index 3d6d527b7..fe479123e 100644 --- a/src/com/android/exchange/SyncManager.java +++ b/src/com/android/exchange/SyncManager.java @@ -389,20 +389,17 @@ public class SyncManager extends Service implements Runnable { } else { // See whether any of our accounts has changed sync interval or window if (syncParametersChanged(account)) { - // Here's one that has... - INSTANCE.log("Account " + account.mDisplayName + - " changed; stopping running syncs..."); - // If account is push, set contacts and inbox to push + // Set pushable boxes' sync interval to the sync interval of the Account Account updatedAccount = Account.restoreAccountWithId(getContext(), account.mId); - if (updatedAccount.mSyncInterval == Account.CHECK_INTERVAL_PUSH) { - ContentValues cv = new ContentValues(); - cv.put(MailboxColumns.SYNC_INTERVAL, Mailbox.CHECK_INTERVAL_PUSH); - getContext().getContentResolver().update(Mailbox.CONTENT_URI, cv, - WHERE_IN_ACCOUNT_AND_PUSHABLE, - new String[] {Long.toString(account.mId)}); - } + ContentValues cv = new ContentValues(); + cv.put(MailboxColumns.SYNC_INTERVAL, updatedAccount.mSyncInterval); + getContentResolver().update(Mailbox.CONTENT_URI, cv, + WHERE_IN_ACCOUNT_AND_PUSHABLE, + new String[] {Long.toString(account.mId)}); // Stop all current syncs; the appropriate ones will restart + INSTANCE.log("Account " + account.mDisplayName + + " changed; stop running syncs..."); stopAccountSyncs(account.mId, true); } } diff --git a/src/com/android/exchange/adapter/FolderSyncParser.java b/src/com/android/exchange/adapter/FolderSyncParser.java index 646c357da..be268a4cb 100644 --- a/src/com/android/exchange/adapter/FolderSyncParser.java +++ b/src/com/android/exchange/adapter/FolderSyncParser.java @@ -208,14 +208,19 @@ public class FolderSyncParser extends AbstractSyncParser { m.mServerId = serverId; m.mAccountKey = mAccountId; m.mType = Mailbox.TYPE_MAIL; + // Note that all mailboxes default to checking "never" (i.e. manual sync only) + // We set specific intervals for inbox, contacts, and (eventually) calendar m.mSyncInterval = Mailbox.CHECK_INTERVAL_NEVER; switch (type) { case INBOX_TYPE: - m.mSyncInterval = Mailbox.CHECK_INTERVAL_PUSH; m.mType = Mailbox.TYPE_INBOX; + m.mSyncInterval = mAccount.mSyncInterval; + break; + case CONTACTS_TYPE: + m.mType = Mailbox.TYPE_CONTACTS; + m.mSyncInterval = mAccount.mSyncInterval; break; case OUTBOX_TYPE: - m.mSyncInterval = Mailbox.CHECK_INTERVAL_NEVER; // TYPE_OUTBOX mailboxes are known by SyncManager to sync whenever they aren't // empty. The value of mSyncFrequency is ignored for this kind of mailbox. m.mType = Mailbox.TYPE_OUTBOX; @@ -231,14 +236,8 @@ public class FolderSyncParser extends AbstractSyncParser { break; case CALENDAR_TYPE: m.mType = Mailbox.TYPE_CALENDAR; - // TODO This could be push, depending on settings // For now, no sync, since it's not yet implemented break; - case CONTACTS_TYPE: - m.mType = Mailbox.TYPE_CONTACTS; - // TODO Frequency below should depend on settings - m.mSyncInterval = Mailbox.CHECK_INTERVAL_PUSH; - break; } // Make boxes like Contacts and Calendar invisible in the folder list