Commit 6172c998 authored by Alice Wang's avatar Alice Wang Committed by Chromium LUCI CQ

[Android][Signin] Remove redundant callback argument in ForcedSigninProcessor

This CL removes the redundant callback argument used in
ForcedSigninProcessor.

Bug: 1045525
Change-Id: I980e972cca487eed4f0669ffa44d9b44da33ef6c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2620259Reviewed-by: default avatarMarc Treib <treib@chromium.org>
Commit-Queue: Alice Wang <aliceywang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#841972}
parent dd766c6c
......@@ -6,8 +6,6 @@ package org.chromium.chrome.browser.firstrun;
import android.app.Activity;
import androidx.annotation.Nullable;
import org.chromium.base.Log;
import org.chromium.chrome.browser.SyncFirstSetupCompleteSource;
import org.chromium.chrome.browser.childaccounts.ChildAccountService;
......@@ -47,12 +45,12 @@ public final class ForcedSigninProcessor {
* This is triggered once per Chrome Application lifetime and every time the Account state
* changes with early exit if an account has already been signed in.
*/
public static void start(@Nullable final Runnable onComplete) {
public static void start() {
ChildAccountService.checkChildAccountStatus(status -> {
boolean hasChildAccount = ChildAccountStatus.isChild(status);
AccountManagementFragment.setSignOutAllowedPreferenceValue(!hasChildAccount);
if (hasChildAccount) {
processForcedSignIn(onComplete);
processForcedSignIn();
}
});
}
......@@ -61,17 +59,16 @@ public final class ForcedSigninProcessor {
* Processes the fully automatic non-FRE-related forced sign-in.
* This is used to enforce the environment for Android EDU and child accounts.
*/
private static void processForcedSignIn(@Nullable final Runnable onComplete) {
private static void processForcedSignIn() {
final Profile profile = Profile.getLastUsedRegularProfile();
if (FirstRunUtils.canAllowSync()
&& IdentityServicesProvider.get()
.getIdentityManager(Profile.getLastUsedRegularProfile())
.hasPrimaryAccount()) {
&& IdentityServicesProvider.get().getIdentityManager(profile).hasPrimaryAccount()) {
// TODO(https://crbug.com/1044206): Remove this.
ProfileSyncService.get().setFirstSetupComplete(SyncFirstSetupCompleteSource.BASIC_FLOW);
}
final SigninManager signinManager = IdentityServicesProvider.get().getSigninManager(
Profile.getLastUsedRegularProfile());
final SigninManager signinManager =
IdentityServicesProvider.get().getSigninManager(profile);
// By definition we have finished all the checks for first run.
signinManager.onFirstRunCheckDone();
if (!FirstRunUtils.canAllowSync() || !signinManager.isSignInAllowed()) {
......@@ -90,17 +87,10 @@ public final class ForcedSigninProcessor {
// TODO(https://crbug.com/1044206): Remove this.
ProfileSyncService.get().setFirstSetupComplete(
SyncFirstSetupCompleteSource.BASIC_FLOW);
if (onComplete != null) {
onComplete.run();
}
}
@Override
public void onSignInAborted() {
if (onComplete != null) {
onComplete.run();
}
}
public void onSignInAborted() {}
});
});
}
......
......@@ -371,13 +371,13 @@ public class ProcessInitializationHandler {
deferredStartupHandler.addDeferredTask(new Runnable() {
@Override
public void run() {
ForcedSigninProcessor.start(null);
ForcedSigninProcessor.start();
AccountManagerFacadeProvider.getInstance().addObserver(
new AccountsChangeObserver() {
@Override
public void onAccountsChanged() {
PostTask.runOrPostTask(UiThreadTaskTraits.DEFAULT,
() -> { ForcedSigninProcessor.start(null); });
() -> { ForcedSigninProcessor.start(); });
}
});
}
......
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