From 05cf8a1c1f9b13aff75ec9e5c300fbf5c7aee27f Mon Sep 17 00:00:00 2001 From: Yu Ping Hu Date: Thu, 11 Jul 2013 18:04:13 -0700 Subject: [PATCH] Remove the folder structure daily sync for push accounts. Turns out that you don't need it -- Exchange has a way to tell the client when folder changes occur. Change-Id: If8089d9fe55e7ece407acf2f0dae977dced522b4 --- .../android/email/provider/EmailProvider.java | 27 ++++--------------- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/src/com/android/email/provider/EmailProvider.java b/src/com/android/email/provider/EmailProvider.java index 1563fa879..421493459 100644 --- a/src/com/android/email/provider/EmailProvider.java +++ b/src/com/android/email/provider/EmailProvider.java @@ -256,14 +256,6 @@ public class EmailProvider extends ContentProvider { Body.TABLE_NAME, }; - /** - * Accounts that are receiving push notifications schedule a periodic sync to fetch account - * changes that aren't included in push (e.g. account settings, folder structure). This value - * specifies the poll frequency, in seconds. Currently set to one day. - */ - private static final long ACCOUNT_ONLY_SYNC_INTERVAL = - DateUtils.DAY_IN_MILLIS / DateUtils.SECOND_IN_MILLIS; - private static UriMatcher sURIMatcher = null; /** @@ -4377,20 +4369,11 @@ public class EmailProvider extends ContentProvider { ContentResolver.removePeriodicSync(account, EmailContent.AUTHORITY, sync.extras); } - // Now add back the periodic sync we need, if there is one. - if (syncInterval != Account.CHECK_INTERVAL_NEVER) { - final Bundle extras = new Bundle(); - final long pollFrequency; - if (syncInterval == Account.CHECK_INTERVAL_PUSH) { - // For push accounts, we still need an account-only sync to update things that are - // not pushed. - extras.putLong(Mailbox.SYNC_EXTRA_MAILBOX_ID, - Mailbox.SYNC_EXTRA_MAILBOX_ID_ACCOUNT_ONLY); - pollFrequency = ACCOUNT_ONLY_SYNC_INTERVAL; - } else { - pollFrequency = syncInterval * 60; - } - ContentResolver.addPeriodicSync(account, EmailContent.AUTHORITY, extras, pollFrequency); + // Only positive values of sync interval indicate periodic syncs. The value is in minutes, + // while addPeriodicSync expects its time in seconds. + if (syncInterval > 0) { + ContentResolver.addPeriodicSync(account, EmailContent.AUTHORITY, Bundle.EMPTY, + syncInterval * DateUtils.MINUTE_IN_MILLIS / DateUtils.SECOND_IN_MILLIS); } }