From a3652cbf8b77524c70fb55d7c2f0655fa0241b27 Mon Sep 17 00:00:00 2001 From: Tony Mantler Date: Thu, 11 Sep 2014 13:10:16 -0700 Subject: [PATCH] Sync account immediately upon restore b/17443087 Change-Id: Ib38fa3551090db85c1f7391fcaa8ce6a8ed7c375 --- src/com/android/email/provider/EmailProvider.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/com/android/email/provider/EmailProvider.java b/src/com/android/email/provider/EmailProvider.java index 1b37b3680..a4490cb7e 100644 --- a/src/com/android/email/provider/EmailProvider.java +++ b/src/com/android/email/provider/EmailProvider.java @@ -1631,14 +1631,18 @@ public class EmailProvider extends ContentProvider // Try to restore them from saved JSON int restoredCount = 0; for (final android.accounts.Account amAccount : amAccounts) { - String jsonString = null; - jsonString = am.getUserData(amAccount, ACCOUNT_MANAGER_JSON_TAG); + final String jsonString = am.getUserData(amAccount, ACCOUNT_MANAGER_JSON_TAG); if (TextUtils.isEmpty(jsonString)) { continue; } final Account account = Account.fromJsonString(jsonString); if (account != null) { AccountSettingsUtils.commitSettings(context, account); + final Bundle extras = new Bundle(3); + extras.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true); + extras.putBoolean(ContentResolver.SYNC_EXTRAS_DO_NOT_RETRY, true); + extras.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, true); + ContentResolver.requestSync(amAccount, EmailContent.AUTHORITY, extras); restoredCount++; } }