am 93d419dd: am 40feb8f9: am 65d130ad: am b3be4655: Merge "Sync account immediately upon restore" into ub-gmail-ur14-dev
* commit '93d419dd2d61962974f288e5b640477d26da2825': Sync account immediately upon restore
This commit is contained in:
commit
a6446151cc
|
@ -1631,14 +1631,18 @@ public class EmailProvider extends ContentProvider
|
||||||
// Try to restore them from saved JSON
|
// Try to restore them from saved JSON
|
||||||
int restoredCount = 0;
|
int restoredCount = 0;
|
||||||
for (final android.accounts.Account amAccount : amAccounts) {
|
for (final android.accounts.Account amAccount : amAccounts) {
|
||||||
String jsonString = null;
|
final String jsonString = am.getUserData(amAccount, ACCOUNT_MANAGER_JSON_TAG);
|
||||||
jsonString = am.getUserData(amAccount, ACCOUNT_MANAGER_JSON_TAG);
|
|
||||||
if (TextUtils.isEmpty(jsonString)) {
|
if (TextUtils.isEmpty(jsonString)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
final Account account = Account.fromJsonString(jsonString);
|
final Account account = Account.fromJsonString(jsonString);
|
||||||
if (account != null) {
|
if (account != null) {
|
||||||
AccountSettingsUtils.commitSettings(context, account);
|
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++;
|
restoredCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue