Fix race condition in Exchange account creation

* Now that observer code has been moved to worker threads, the order
  in which various pieces of account creation are executed has become
  indeterminate
* Because of this, our EasAccountsUpdatedListener could use a stale
  list of EmailProvider accounts when performing reconciliation with
  the AccountManager's list of accounts
* The fix is to ensure that EasAccountsUpdatedListener's worker thread
  causes the cached EmailProvider account list to be updated before
  calling the reconciliation method

Bug: 2558317
Change-Id: Ia94a8301845cf6c06f8efecd408eb237474f781a
This commit is contained in:
Marc Blank 2010-03-31 09:42:54 -07:00
parent 1a66cf0056
commit 3ae84b247d

View File

@ -924,7 +924,9 @@ public class SyncManager extends Service implements Runnable {
if (syncManager != null) {
android.accounts.Account[] accountMgrList = AccountManager.get(syncManager)
.getAccountsByType(Email.EXCHANGE_ACCOUNT_MANAGER_TYPE);
// Make sure we have an up-to-date sAccountList
synchronized (sAccountList) {
mAccountObserver.onAccountChanged();
reconcileAccountsWithAccountManager(syncManager, sAccountList,
accountMgrList, false, mResolver);
}