diff options
| author | 2016-02-01 15:16:14 +0000 | |
|---|---|---|
| committer | 2016-02-01 15:16:14 +0000 | |
| commit | e4d4435e2355ffafdaf18f60c7d5ed0204cf528d (patch) | |
| tree | 76fd5626fc420993e33e095f7923ca1202226d13 | |
| parent | d9be7216fdfc8eeebb9090af8eacd327cc0d2e1a (diff) | |
Revert "Bugfix for accountsUpdated receiver in SyncManager"
Hastily submitted this patch which is already fixed in ag/846619
reverting for simplicity of merge
This reverts commit d9be7216fdfc8eeebb9090af8eacd327cc0d2e1a.
Change-Id: I799869c33f42044ee4e06477ee46b83a3436cc40
| -rw-r--r-- | services/core/java/com/android/server/content/SyncManager.java | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/services/core/java/com/android/server/content/SyncManager.java b/services/core/java/com/android/server/content/SyncManager.java index c28ba2c90f08..2eb90952f6c4 100644 --- a/services/core/java/com/android/server/content/SyncManager.java +++ b/services/core/java/com/android/server/content/SyncManager.java @@ -295,7 +295,7 @@ public class SyncManager { private final BroadcastReceiver mAccountsUpdatedReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { - updateRunningAccounts(true /* resync all targets */); + updateRunningAccounts(); // Kick off sync for everyone, since this was a radical account change scheduleSync(null, UserHandle.USER_ALL, SyncOperation.REASON_ACCOUNTS_UPDATED, null, @@ -344,12 +344,10 @@ public class SyncManager { return found; } - private void updateRunningAccounts(boolean resyncAllTargets) { + public void updateRunningAccounts() { if (Log.isLoggable(TAG, Log.VERBOSE)) Log.v(TAG, "sending MESSAGE_ACCOUNTS_UPDATED"); // Update accounts in handler thread. - Message m = mSyncHandler.obtainMessage(SyncHandler.MESSAGE_ACCOUNTS_UPDATED); - m.arg1 = resyncAllTargets ? 1 : 0; - m.sendToTarget(); + mSyncHandler.sendEmptyMessage(SyncHandler.MESSAGE_ACCOUNTS_UPDATED); } private void doDatabaseCleanup() { @@ -1284,7 +1282,7 @@ public class SyncManager { mSyncAdapters.invalidateCache(userId); - updateRunningAccounts(false); + updateRunningAccounts(); synchronized (mSyncQueue) { mSyncQueue.addPendingOperations(userId); @@ -1303,7 +1301,7 @@ public class SyncManager { } private void onUserStopping(int userId) { - updateRunningAccounts(false); + updateRunningAccounts(); cancelActiveSync( new SyncStorageEngine.EndPoint( @@ -1315,7 +1313,7 @@ public class SyncManager { } private void onUserRemoved(int userId) { - updateRunningAccounts(false); + updateRunningAccounts(); // Clean up the storage engine database mSyncStorageEngine.doDatabaseCleanup(new Account[0], userId); @@ -2287,8 +2285,7 @@ public class SyncManager { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "handleSyncHandlerMessage: MESSAGE_ACCOUNTS_UPDATED"); } - boolean resyncAllTargets = msg.arg1 == 0 ? false : true; - updateRunningAccountsH(resyncAllTargets); + updateRunningAccountsH(); break; case SyncHandler.MESSAGE_CANCEL: @@ -2872,7 +2869,7 @@ public class SyncManager { } } - private void updateRunningAccountsH(boolean resyncAll) { + private void updateRunningAccountsH() { mRunningAccounts = AccountManagerService.getSingleton().getRunningAccounts(); if (mBootCompleted) { @@ -2889,14 +2886,9 @@ public class SyncManager { null /* no result since this is a cancel */); } } - - if (resyncAll) { - // Kick off sync for everyone, since this was a radical account change - scheduleSync(null, UserHandle.USER_ALL, SyncOperation.REASON_ACCOUNTS_UPDATED, null, - null, 0 /* no delay */, 0/* no delay */, false); - } else { - sendCheckAlarmsMessage(); - } + // we must do this since we don't bother scheduling alarms when + // the accounts are not set yet + sendCheckAlarmsMessage(); } private boolean isSyncNotUsingNetworkH(ActiveSyncContext activeSyncContext) { |