Commit 21f73547 authored by Side Yilmaz's avatar Side Yilmaz Committed by Commit Bot

Update deprecated |getIdentityManager| function in GSAState.

This CL replaces deprecated functions of IdentityServicesProvider with
the newer service getters with profile parameter.This CL passes
|Profile#getLastUsedRegularProfile| to |getIdentityManager| function
in GSAState class.

Note: This is only clean-up and does not change any code behaviour.

Bug: 1041781, 1075562
Change-Id: I42735354d1fa648361452d54e384b673b84aac17
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2339970Reviewed-by: default avatarRamin Halavati <rhalavati@chromium.org>
Reviewed-by: default avatarBenoit L <lizeb@chromium.org>
Commit-Queue: Side YILMAZ <sideyilmaz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#797182}
parent 9810450f
......@@ -21,10 +21,12 @@ import androidx.annotation.VisibleForTesting;
import org.chromium.base.PackageManagerUtils;
import org.chromium.base.PackageUtils;
import org.chromium.chrome.browser.IntentHandler;
import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.browser.signin.IdentityServicesProvider;
import org.chromium.components.signin.base.CoreAccountInfo;
import org.chromium.components.signin.identitymanager.ConsentLevel;
import org.chromium.components.signin.identitymanager.IdentityManager;
import java.util.List;
......@@ -102,9 +104,10 @@ public class GSAState {
*/
public boolean doesGsaAccountMatchChrome() {
if (!ProfileManager.isInitialized()) return false;
IdentityManager identityManager = IdentityServicesProvider.get().getIdentityManager(
Profile.getLastUsedRegularProfile());
CoreAccountInfo chromeAccountInfo =
IdentityServicesProvider.get().getIdentityManager().getPrimaryAccountInfo(
ConsentLevel.SYNC);
identityManager.getPrimaryAccountInfo(ConsentLevel.SYNC);
return chromeAccountInfo != null && !TextUtils.isEmpty(mGsaAccount)
&& TextUtils.equals(chromeAccountInfo.getEmail(), mGsaAccount);
}
......
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