DO NOT MERGE: Don't disable account box if sync freq -> "Never"

Original Change-Id: Iec214b0fed093ff39dc70d5d821577bcf15f00ed
Bug: 2905667

Change-Id: Iee182596d8c217d6bd78371fcf6fdc4dbfcd04a4
This commit is contained in:
Andrew Stadler 2010-10-29 16:16:40 -07:00
parent 3ddfdb8e07
commit 89a799c8d4
2 changed files with 17 additions and 6 deletions

View File

@ -130,6 +130,13 @@ public class EasSyncService extends AbstractSyncService {
// The extra time allowed beyond the COMMAND_TIMEOUT before which our watchdog alarm triggers
static private final int WATCHDOG_TIMEOUT_ALLOWANCE = 30*SECONDS;
// The amount of time the account mailbox will sleep if there are no pingable mailboxes
// This could happen if the sync time is set to "never"; we always want to check in from time
// to time, however, for folder list/policy changes
static private final int ACCOUNT_MAILBOX_SLEEP_TIME = 20*MINUTES;
static private final String ACCOUNT_MAILBOX_SLEEP_TEXT =
"Account mailbox sleeping for " + (ACCOUNT_MAILBOX_SLEEP_TIME / MINUTES) + "m";
static private final String AUTO_DISCOVER_SCHEMA_PREFIX =
"http://schemas.microsoft.com/exchange/autodiscover/mobilesync/";
static private final String AUTO_DISCOVER_PAGE = "/autodiscover/autodiscover.xml";
@ -1860,10 +1867,11 @@ public class EasSyncService extends AbstractSyncService {
userLog("pingLoop waiting for initial sync of ", uninitCount, " box(es)");
sleep(10*SECONDS, true);
} else {
// We've got nothing to do, so we'll check again in 30 minutes at which time
// we'll update the folder list. Let the device sleep in the meantime...
userLog("pingLoop sleeping for 30m");
sleep(30*MINUTES, true);
// We've got nothing to do, so we'll check again in 20 minutes at which time
// we'll update the folder list, check for policy changes and/or remote wipe, etc.
// Let the device sleep in the meantime...
userLog(ACCOUNT_MAILBOX_SLEEP_TEXT);
sleep(ACCOUNT_MAILBOX_SLEEP_TIME, true);
}
}

View File

@ -150,6 +150,8 @@ public class SyncManager extends Service implements Runnable {
MailboxColumns.ACCOUNT_KEY + "=? and type in (" + Mailbox.TYPE_INBOX + ','
+ Mailbox.TYPE_EAS_ACCOUNT_MAILBOX + ',' + Mailbox.TYPE_CONTACTS + ','
+ Mailbox.TYPE_CALENDAR + ')';
protected static final String WHERE_IN_ACCOUNT_AND_TYPE_INBOX =
MailboxColumns.ACCOUNT_KEY + "=? and type = " + Mailbox.TYPE_INBOX ;
private static final String WHERE_MAILBOX_KEY = Message.MAILBOX_KEY + "=?";
private static final String WHERE_PROTOCOL_EAS = HostAuthColumns.PROTOCOL + "=\"" +
AbstractSyncService.EAS_PROTOCOL + "\"";
@ -542,11 +544,12 @@ public class SyncManager extends Service implements Runnable {
if (updatedAccount == null) continue;
if (account.mSyncInterval != updatedAccount.mSyncInterval
|| account.mSyncLookback != updatedAccount.mSyncLookback) {
// Set pushable boxes' interval to the interval of the Account
// Set the inbox interval to the interval of the Account
// This setting should NOT affect other boxes
ContentValues cv = new ContentValues();
cv.put(MailboxColumns.SYNC_INTERVAL, updatedAccount.mSyncInterval);
getContentResolver().update(Mailbox.CONTENT_URI, cv,
WHERE_IN_ACCOUNT_AND_PUSHABLE, new String[] {
WHERE_IN_ACCOUNT_AND_TYPE_INBOX, new String[] {
Long.toString(account.mId)
});
// Stop all current syncs; the appropriate ones will restart