Don't disable account mailbox when sync freq -> "Never"
Bug: 2905667 Change-Id: I7052281a186534597702fa137a2ecfe8b1280575
This commit is contained in:
parent
e7b9e4ab94
commit
fa2386cb11
@ -132,6 +132,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";
|
||||
@ -1967,10 +1974,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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -147,6 +147,8 @@ public class ExchangeService 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 + "\"";
|
||||
@ -581,11 +583,12 @@ public class ExchangeService 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
|
||||
|
Loading…
Reference in New Issue
Block a user