Fix NPE in SyncManager when updating accounts.

On receiving MESSAGE_ACCOUNTS_UPDATED, do not try to sync accounts when
users are removed or stopped (when userId is null).

Bug: 132369930
Test: manual (steps listed on bug)
Change-Id: Ic9f8917e93d5e31a477b86e36d3e82b784657478
This commit is contained in:
Varun Shah
2019-05-10 17:16:52 -07:00
parent 50e31711af
commit 190c7017fa

View File

@@ -3256,14 +3256,17 @@ public class SyncManager {
}
}
// On account add, check if there are any settings to be restored.
for (AccountAndUser aau : mRunningAccounts) {
if (!containsAccountAndUser(oldAccounts, aau.account, aau.userId)) {
if (Log.isLoggable(TAG, Log.DEBUG)) {
Log.d(TAG, "Account " + aau.account + " added, checking sync restore data");
if (syncTargets != null) {
// On account add, check if there are any settings to be restored.
for (AccountAndUser aau : mRunningAccounts) {
if (!containsAccountAndUser(oldAccounts, aau.account, aau.userId)) {
if (Log.isLoggable(TAG, Log.DEBUG)) {
Log.d(TAG, "Account " + aau.account
+ " added, checking sync restore data");
}
AccountSyncSettingsBackupHelper.accountAdded(mContext, syncTargets.userId);
break;
}
AccountSyncSettingsBackupHelper.accountAdded(mContext, syncTargets.userId);
break;
}
}