From 468fe91dd8d3f7c35a2ecd4187dcc38c2e5ad1cc Mon Sep 17 00:00:00 2001 From: Marc Blank Date: Fri, 30 Apr 2010 11:15:10 -0700 Subject: [PATCH] Prevent account reconcile from running when service is down Bug: 2644142 Change-Id: Ia6ccf7371bc08b3b67ab3d0871f3618c5e5bd107 --- src/com/android/exchange/SyncManager.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/com/android/exchange/SyncManager.java b/src/com/android/exchange/SyncManager.java index 9f20e89b7..523aab894 100644 --- a/src/com/android/exchange/SyncManager.java +++ b/src/com/android/exchange/SyncManager.java @@ -954,12 +954,14 @@ public class SyncManager extends Service implements Runnable { android.accounts.Account[] accountMgrList = AccountManager.get(syncManager) .getAccountsByType(Email.EXCHANGE_ACCOUNT_MANAGER_TYPE); synchronized (sAccountList) { - // Make sure we have an up-to-date sAccountList + // Make sure we have an up-to-date sAccountList. If not (for example, if the + // service has been destroyed), we would be reconciling against an empty account + // list, which would cause the deletion of all of our accounts if (mAccountObserver != null) { mAccountObserver.onAccountChanged(); + reconcileAccountsWithAccountManager(syncManager, sAccountList, + accountMgrList, false, mResolver); } - reconcileAccountsWithAccountManager(syncManager, sAccountList, - accountMgrList, false, mResolver); } } }.start();