Commit 110edf39 authored by Boris Sazonov's avatar Boris Sazonov Committed by Commit Bot

[Signin][Android] Load accounts into IdentityManager before setting primary account

Changes order of calls in SigninManager - now it triggers an update to
the account list before setting the primary account. This way, the list
of accounts is available by the time the primary account is set.

Bug: 1095128, 1121479
Change-Id: Idc596f99e6899624284b9cc86bdf01320f16b954
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2416520Reviewed-by: default avatarMihai Sardarescu <msarda@chromium.org>
Commit-Queue: Boris Sazonov <bsazonov@chromium.org>
Cr-Commit-Position: refs/heads/master@{#808270}
parent ca577860
......@@ -522,6 +522,11 @@ public class SigninManager
// The user should not be already signed in
assert !mIdentityManager.hasPrimaryAccount();
// Setting the primary account triggers observers which query accounts from IdentityManager.
// Reloading before setting the primary ensures they don't get an empty list of accounts.
mIdentityMutator.reloadAllAccountsFromSystemWithPrimaryAccount(
mSignInState.mCoreAccountInfo.getId());
@ConsentLevel
int consentLevel =
mSignInState.shouldTurnSyncOn() ? ConsentLevel.SYNC : ConsentLevel.NOT_REQUIRED;
......@@ -551,9 +556,6 @@ public class SigninManager
mSignInState.mCallback.onSignInComplete();
}
// Trigger token requests via identity mutator.
reloadAllAccountsFromSystem();
Log.d(TAG, "Signin completed.");
mSignInState = null;
notifyCallbacksWaitingForOperation();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment