Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 190c7017 authored by Varun Shah's avatar Varun Shah
Browse files

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
parent 50e31711
Loading
Loading
Loading
Loading
+10 −7
Original line number Diff line number Diff line
@@ -3256,16 +3256,19 @@ public class SyncManager {
                }
            }

            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");
                            Log.d(TAG, "Account " + aau.account
                                    + " added, checking sync restore data");
                        }
                        AccountSyncSettingsBackupHelper.accountAdded(mContext, syncTargets.userId);
                        break;
                    }
                }
            }

            // Cancel all jobs from non-existent accounts.
            AccountAndUser[] allAccounts = AccountManagerService.getSingleton().getAllAccounts();