Commit ca909303 authored by Alice Wang's avatar Alice Wang Committed by Commit Bot

[Android][Signin] Remove Android EDU support

This CL removes the Android EDU support.

Bug: 1044616
Change-Id: I4f63772cbb2c5f9da6c5b632a583572f6a85adec
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2072222
Commit-Queue: Alice Wang <aliceywang@chromium.org>
Reviewed-by: default avatarTanmoy Mollik <triploblastic@chromium.org>
Reviewed-by: default avatarBoris Sazonov <bsazonov@chromium.org>
Cr-Commit-Position: refs/heads/master@{#746324}
parent 360d6e85
...@@ -1355,7 +1355,7 @@ chrome_java_sources = [ ...@@ -1355,7 +1355,7 @@ chrome_java_sources = [
"java/src/org/chromium/chrome/browser/send_tab_to_self/SendTabToSelfShareActivity.java", "java/src/org/chromium/chrome/browser/send_tab_to_self/SendTabToSelfShareActivity.java",
"java/src/org/chromium/chrome/browser/send_tab_to_self/TargetDeviceInfo.java", "java/src/org/chromium/chrome/browser/send_tab_to_self/TargetDeviceInfo.java",
"java/src/org/chromium/chrome/browser/services/AccountsChangedReceiver.java", "java/src/org/chromium/chrome/browser/services/AccountsChangedReceiver.java",
"java/src/org/chromium/chrome/browser/services/AndroidEduAndChildAccountHelper.java", "java/src/org/chromium/chrome/browser/services/AndroidChildAccountHelper.java",
"java/src/org/chromium/chrome/browser/services/AndroidEduOwnerCheckCallback.java", "java/src/org/chromium/chrome/browser/services/AndroidEduOwnerCheckCallback.java",
"java/src/org/chromium/chrome/browser/services/GoogleServicesManager.java", "java/src/org/chromium/chrome/browser/services/GoogleServicesManager.java",
"java/src/org/chromium/chrome/browser/services/gcm/ChromeGcmListenerService.java", "java/src/org/chromium/chrome/browser/services/gcm/ChromeGcmListenerService.java",
......
...@@ -90,10 +90,13 @@ public abstract class AppHooks { ...@@ -90,10 +90,13 @@ public abstract class AppHooks {
/** /**
* Initiate AndroidEdu device check. * Initiate AndroidEdu device check.
* TODO(https://crbug.com/1044616) This method needs to be removed once we will remove the
* downstream overriden method
* @param callback Callback that should receive the results of the AndroidEdu device check. * @param callback Callback that should receive the results of the AndroidEdu device check.
*/ */
public void checkIsAndroidEduDevice(final AndroidEduOwnerCheckCallback callback) { public void checkIsAndroidEduDevice(final AndroidEduOwnerCheckCallback callback) {
PostTask.postTask(UiThreadTaskTraits.DEFAULT, () -> callback.onSchoolCheckDone(false)); PostTask.postTask(UiThreadTaskTraits.DEFAULT, () -> callback.onSchoolCheckDone(false));
assert false : "This method should not be called!";
} }
/** /**
......
...@@ -24,7 +24,7 @@ import org.chromium.chrome.browser.flags.CachedFeatureFlags; ...@@ -24,7 +24,7 @@ import org.chromium.chrome.browser.flags.CachedFeatureFlags;
import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.flags.ChromeFeatureList;
import org.chromium.chrome.browser.locale.LocaleManager; import org.chromium.chrome.browser.locale.LocaleManager;
import org.chromium.chrome.browser.net.spdyproxy.DataReductionProxySettings; import org.chromium.chrome.browser.net.spdyproxy.DataReductionProxySettings;
import org.chromium.chrome.browser.services.AndroidEduAndChildAccountHelper; import org.chromium.chrome.browser.services.AndroidChildAccountHelper;
import org.chromium.chrome.browser.settings.privacy.PrivacyPreferencesManager; import org.chromium.chrome.browser.settings.privacy.PrivacyPreferencesManager;
import org.chromium.chrome.browser.signin.IdentityServicesProvider; import org.chromium.chrome.browser.signin.IdentityServicesProvider;
import org.chromium.chrome.browser.signin.SigninManager; import org.chromium.chrome.browser.signin.SigninManager;
...@@ -51,12 +51,8 @@ public abstract class FirstRunFlowSequencer { ...@@ -51,12 +51,8 @@ public abstract class FirstRunFlowSequencer {
private static final String TAG = "firstrun"; private static final String TAG = "firstrun";
private final Activity mActivity; private final Activity mActivity;
// The following are initialized via initializeSharedState().
private boolean mIsAndroidEduDevice;
private @ChildAccountStatus.Status int mChildAccountStatus; private @ChildAccountStatus.Status int mChildAccountStatus;
private List<Account> mGoogleAccounts; private List<Account> mGoogleAccounts;
private boolean mForceEduSignIn;
/** /**
* Callback that is called once the flow is determined. * Callback that is called once the flow is determined.
...@@ -82,10 +78,10 @@ public abstract class FirstRunFlowSequencer { ...@@ -82,10 +78,10 @@ public abstract class FirstRunFlowSequencer {
return; return;
} }
new AndroidEduAndChildAccountHelper() { new AndroidChildAccountHelper() {
@Override @Override
public void onParametersReady() { public void onParametersReady() {
initializeSharedState(isAndroidEduDevice(), getChildAccountStatus()); initializeSharedState(getChildAccountStatus());
processFreEnvironmentPreNative(); processFreEnvironmentPreNative();
} }
}.start(); }.start();
...@@ -152,14 +148,9 @@ public abstract class FirstRunFlowSequencer { ...@@ -152,14 +148,9 @@ public abstract class FirstRunFlowSequencer {
FirstRunSignInProcessor.setFirstRunFlowSignInComplete(true); FirstRunSignInProcessor.setFirstRunFlowSignInComplete(true);
} }
void initializeSharedState( void initializeSharedState(@ChildAccountStatus.Status int childAccountStatus) {
boolean isAndroidEduDevice, @ChildAccountStatus.Status int childAccountStatus) {
mIsAndroidEduDevice = isAndroidEduDevice;
mChildAccountStatus = childAccountStatus; mChildAccountStatus = childAccountStatus;
mGoogleAccounts = getGoogleAccounts(); mGoogleAccounts = getGoogleAccounts();
// EDU devices should always have exactly 1 google account, which will be automatically
// signed-in. All FRE screens are skipped in this case.
mForceEduSignIn = mIsAndroidEduDevice && mGoogleAccounts.size() == 1 && !isSignedIn();
} }
void processFreEnvironmentPreNative() { void processFreEnvironmentPreNative() {
...@@ -171,20 +162,16 @@ public abstract class FirstRunFlowSequencer { ...@@ -171,20 +162,16 @@ public abstract class FirstRunFlowSequencer {
} }
Bundle freProperties = new Bundle(); Bundle freProperties = new Bundle();
// TODO(https://crbug.com/1056132): Remove the boolean FirstRunActivity.SHOW_WELCOME_PAGE
// In the full FRE we always show the Welcome page, except on EDU devices. freProperties.putBoolean(FirstRunActivity.SHOW_WELCOME_PAGE, true);
boolean showWelcomePage = !mForceEduSignIn;
freProperties.putBoolean(FirstRunActivity.SHOW_WELCOME_PAGE, showWelcomePage);
freProperties.putInt(SigninFirstRunFragment.CHILD_ACCOUNT_STATUS, mChildAccountStatus); freProperties.putInt(SigninFirstRunFragment.CHILD_ACCOUNT_STATUS, mChildAccountStatus);
// Initialize usage and crash reporting according to the default value. // Initialize usage and crash reporting according to the default value.
// The user can explicitly enable or disable the reporting on the Welcome page. // The user can explicitly enable or disable the reporting on the Welcome page.
// This is controlled by the administrator via a policy on EDU devices.
setDefaultMetricsAndCrashReporting(); setDefaultMetricsAndCrashReporting();
onFlowIsKnown(freProperties); onFlowIsKnown(freProperties);
if (ChildAccountStatus.isChild(mChildAccountStatus) || mForceEduSignIn) { if (ChildAccountStatus.isChild(mChildAccountStatus)) {
// Child and Edu forced signins are processed independently.
setFirstRunFlowSignInComplete(); setFirstRunFlowSignInComplete();
} }
} }
...@@ -194,15 +181,14 @@ public abstract class FirstRunFlowSequencer { ...@@ -194,15 +181,14 @@ public abstract class FirstRunFlowSequencer {
* @param freProperties Resulting FRE properties bundle. * @param freProperties Resulting FRE properties bundle.
*/ */
public void onNativeInitialized(Bundle freProperties) { public void onNativeInitialized(Bundle freProperties) {
// We show the sign-in page if sync is allowed, and not signed in, and this is not // We show the sign-in page if sync is allowed, and not signed in, and
// an EDU device, and
// - no "skip the first use hints" is set, or // - no "skip the first use hints" is set, or
// - "skip the first use hints" is set, but there is at least one account. // - "skip the first use hints" is set, but there is at least one account.
boolean offerSignInOk = isSyncAllowed() && !isSignedIn() && !mForceEduSignIn boolean offerSignInOk = isSyncAllowed() && !isSignedIn()
&& (!shouldSkipFirstUseHints() || !mGoogleAccounts.isEmpty()); && (!shouldSkipFirstUseHints() || !mGoogleAccounts.isEmpty());
freProperties.putBoolean(FirstRunActivity.SHOW_SIGNIN_PAGE, offerSignInOk); freProperties.putBoolean(FirstRunActivity.SHOW_SIGNIN_PAGE, offerSignInOk);
if (mForceEduSignIn || ChildAccountStatus.isChild(mChildAccountStatus)) { if (ChildAccountStatus.isChild(mChildAccountStatus)) {
// If the device is an Android EDU device or has a child account, there should be // If the device has a child account, there should be
// exactly account on the device. Force sign-in in to that account. // exactly account on the device. Force sign-in in to that account.
freProperties.putString( freProperties.putString(
SigninFirstRunFragment.FORCE_SIGNIN_ACCOUNT_TO, mGoogleAccounts.get(0).name); SigninFirstRunFragment.FORCE_SIGNIN_ACCOUNT_TO, mGoogleAccounts.get(0).name);
......
...@@ -11,7 +11,7 @@ import org.chromium.chrome.browser.ChromeActivity; ...@@ -11,7 +11,7 @@ import org.chromium.chrome.browser.ChromeActivity;
import org.chromium.chrome.browser.SyncFirstSetupCompleteSource; import org.chromium.chrome.browser.SyncFirstSetupCompleteSource;
import org.chromium.chrome.browser.externalauth.ExternalAuthUtils; import org.chromium.chrome.browser.externalauth.ExternalAuthUtils;
import org.chromium.chrome.browser.externalauth.UserRecoverableErrorHandler; import org.chromium.chrome.browser.externalauth.UserRecoverableErrorHandler;
import org.chromium.chrome.browser.services.AndroidEduAndChildAccountHelper; import org.chromium.chrome.browser.services.AndroidChildAccountHelper;
import org.chromium.chrome.browser.signin.IdentityServicesProvider; import org.chromium.chrome.browser.signin.IdentityServicesProvider;
import org.chromium.chrome.browser.signin.SigninManager; import org.chromium.chrome.browser.signin.SigninManager;
import org.chromium.chrome.browser.sync.ProfileSyncService; import org.chromium.chrome.browser.sync.ProfileSyncService;
...@@ -23,8 +23,8 @@ import org.chromium.components.signin.metrics.SigninAccessPoint; ...@@ -23,8 +23,8 @@ import org.chromium.components.signin.metrics.SigninAccessPoint;
/** /**
* A helper to perform all necessary steps for forced sign in. * A helper to perform all necessary steps for forced sign in.
* The helper performs: * The helper performs:
* - necessary Android EDU and child account checks; * - necessary child account checks;
* - automatic non-interactive forced sign in for Android EDU and child accounts; and * - automatic non-interactive forced sign in for child accounts; and
* The helper calls the observer's onSignInComplete() if * The helper calls the observer's onSignInComplete() if
* - nothing needs to be done, or when * - nothing needs to be done, or when
* - the sign in is complete. * - the sign in is complete.
...@@ -42,21 +42,16 @@ public final class ForcedSigninProcessor { ...@@ -42,21 +42,16 @@ public final class ForcedSigninProcessor {
/** /**
* Check whether a forced automatic signin is required and process it if it is. * Check whether a forced automatic signin is required and process it if it is.
* This is triggered once per Chrome Application lifetime and everytime the Account state * 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. * changes with early exit if an account has already been signed in.
*/ */
public static void start(@Nullable final Runnable onComplete) { public static void start(@Nullable final Runnable onComplete) {
new AndroidEduAndChildAccountHelper() { new AndroidChildAccountHelper() {
@Override @Override
public void onParametersReady() { public void onParametersReady() {
boolean isAndroidEduDevice = isAndroidEduDevice();
boolean hasChildAccount = ChildAccountStatus.isChild(getChildAccountStatus()); boolean hasChildAccount = ChildAccountStatus.isChild(getChildAccountStatus());
// Child account and EDU device at the same time is not supported. AccountManagementFragment.setSignOutAllowedPreferenceValue(!hasChildAccount);
assert !(isAndroidEduDevice && hasChildAccount); if (hasChildAccount) {
boolean forceSignin = isAndroidEduDevice || hasChildAccount;
AccountManagementFragment.setSignOutAllowedPreferenceValue(!forceSignin);
if (forceSignin) {
processForcedSignIn(onComplete); processForcedSignIn(onComplete);
} }
} }
...@@ -114,7 +109,7 @@ public final class ForcedSigninProcessor { ...@@ -114,7 +109,7 @@ public final class ForcedSigninProcessor {
* @param activity The activity for which to show the dialog. * @param activity The activity for which to show the dialog.
*/ */
// TODO(bauerb): Once external dependencies reliably use policy to force sign-in, // TODO(bauerb): Once external dependencies reliably use policy to force sign-in,
// consider removing the child account / EDU checks. // consider removing the child account.
public static void checkCanSignIn(final ChromeActivity activity) { public static void checkCanSignIn(final ChromeActivity activity) {
if (IdentityServicesProvider.get().getSigninManager().isForceSigninEnabled()) { if (IdentityServicesProvider.get().getSigninManager().isForceSigninEnabled()) {
ExternalAuthUtils.getInstance().canUseGooglePlayServices( ExternalAuthUtils.getInstance().canUseGooglePlayServices(
......
...@@ -5,61 +5,39 @@ ...@@ -5,61 +5,39 @@
package org.chromium.chrome.browser.services; package org.chromium.chrome.browser.services;
import org.chromium.base.Callback; import org.chromium.base.Callback;
import org.chromium.chrome.browser.AppHooks;
import org.chromium.chrome.browser.childaccounts.ChildAccountService; import org.chromium.chrome.browser.childaccounts.ChildAccountService;
import org.chromium.components.signin.ChildAccountStatus; import org.chromium.components.signin.ChildAccountStatus;
/** /**
* A helper for Android EDU and child account checks. * A helper for child account checks.
* Usage: * Usage:
* new AndroidEduAndChildAccountHelper() { override onParametersReady() }.start(appContext). * new AndroidChildAccountHelper() { override onParametersReady() }.start(appContext).
*/ */
public abstract class AndroidEduAndChildAccountHelper public abstract class AndroidChildAccountHelper implements Callback<Integer> {
implements Callback<Integer>, AndroidEduOwnerCheckCallback {
private Boolean mIsAndroidEduDevice;
private @ChildAccountStatus.Status Integer mChildAccountStatus; private @ChildAccountStatus.Status Integer mChildAccountStatus;
// Abbreviated to < 20 chars.
private static final String TAG = "EduChildHelper";
/** The callback called when Android EDU and child account parameters are known. */ /** The callback called when child account parameters are known. */
public abstract void onParametersReady(); public abstract void onParametersReady();
/** @return Whether the device is Android EDU device. */
public boolean isAndroidEduDevice() {
return mIsAndroidEduDevice;
}
/** @return The status of the device regarding child accounts. */ /** @return The status of the device regarding child accounts. */
public @ChildAccountStatus.Status int getChildAccountStatus() { protected @ChildAccountStatus.Status int getChildAccountStatus() {
return mChildAccountStatus; return mChildAccountStatus;
} }
/** /**
* Starts fetching the Android EDU and child accounts information. * Starts fetching the child accounts information.
* Calls onParametersReady() once the information is fetched. * Calls onParametersReady() once the information is fetched.
*/ */
public void start() { public void start() {
ChildAccountService.checkChildAccountStatus(this); ChildAccountService.checkChildAccountStatus(this);
AppHooks.get().checkIsAndroidEduDevice(this);
// TODO(aruslan): Should we start a watchdog to kill if Child/Edu stuff takes too long?
}
private void checkDone() {
if (mIsAndroidEduDevice == null || mChildAccountStatus == null) return;
onParametersReady();
}
// AndroidEdu.OwnerCheckCallback:
@Override
public void onSchoolCheckDone(boolean isAndroidEduDevice) {
mIsAndroidEduDevice = isAndroidEduDevice;
checkDone();
} }
// Callback<Integer>: // Callback<Integer>:
@Override @Override
public void onResult(@ChildAccountStatus.Status Integer status) { public void onResult(@ChildAccountStatus.Status Integer status) {
mChildAccountStatus = status; mChildAccountStatus = status;
checkDone(); if (mChildAccountStatus != null) {
onParametersReady();
}
} }
} }
...@@ -165,8 +165,7 @@ public class FirstRunFlowSequencerTest { ...@@ -165,8 +165,7 @@ public class FirstRunFlowSequencerTest {
mSequencer.hasAnyUserSeenToS = true; mSequencer.hasAnyUserSeenToS = true;
mSequencer.shouldSkipFirstUseHints = false; mSequencer.shouldSkipFirstUseHints = false;
mSequencer.isFirstRunEulaAccepted = true; mSequencer.isFirstRunEulaAccepted = true;
mSequencer.initializeSharedState( mSequencer.initializeSharedState(ChildAccountStatus.NOT_CHILD);
false /* androidEduDevice */, ChildAccountStatus.NOT_CHILD);
mSequencer.processFreEnvironmentPreNative(); mSequencer.processFreEnvironmentPreNative();
assertTrue(mSequencer.calledOnFlowIsKnown); assertTrue(mSequencer.calledOnFlowIsKnown);
...@@ -184,8 +183,7 @@ public class FirstRunFlowSequencerTest { ...@@ -184,8 +183,7 @@ public class FirstRunFlowSequencerTest {
mSequencer.hasAnyUserSeenToS = false; mSequencer.hasAnyUserSeenToS = false;
mSequencer.shouldSkipFirstUseHints = false; mSequencer.shouldSkipFirstUseHints = false;
mSequencer.shouldShowDataReductionPage = false; mSequencer.shouldShowDataReductionPage = false;
mSequencer.initializeSharedState( mSequencer.initializeSharedState(ChildAccountStatus.NOT_CHILD);
false /* androidEduDevice */, ChildAccountStatus.NOT_CHILD);
mSequencer.processFreEnvironmentPreNative(); mSequencer.processFreEnvironmentPreNative();
assertTrue(mSequencer.calledOnFlowIsKnown); assertTrue(mSequencer.calledOnFlowIsKnown);
...@@ -213,8 +211,7 @@ public class FirstRunFlowSequencerTest { ...@@ -213,8 +211,7 @@ public class FirstRunFlowSequencerTest {
mSequencer.hasAnyUserSeenToS = false; mSequencer.hasAnyUserSeenToS = false;
mSequencer.shouldSkipFirstUseHints = false; mSequencer.shouldSkipFirstUseHints = false;
mSequencer.shouldShowDataReductionPage = false; mSequencer.shouldShowDataReductionPage = false;
mSequencer.initializeSharedState( mSequencer.initializeSharedState(ChildAccountStatus.REGULAR_CHILD);
false /* androidEduDevice */, ChildAccountStatus.REGULAR_CHILD);
mSequencer.processFreEnvironmentPreNative(); mSequencer.processFreEnvironmentPreNative();
assertTrue(mSequencer.calledOnFlowIsKnown); assertTrue(mSequencer.calledOnFlowIsKnown);
...@@ -244,8 +241,7 @@ public class FirstRunFlowSequencerTest { ...@@ -244,8 +241,7 @@ public class FirstRunFlowSequencerTest {
mSequencer.shouldSkipFirstUseHints = false; mSequencer.shouldSkipFirstUseHints = false;
mSequencer.shouldShowDataReductionPage = true; mSequencer.shouldShowDataReductionPage = true;
mSequencer.shouldShowSearchEnginePage = false; mSequencer.shouldShowSearchEnginePage = false;
mSequencer.initializeSharedState( mSequencer.initializeSharedState(ChildAccountStatus.NOT_CHILD);
false /* androidEduDevice */, ChildAccountStatus.NOT_CHILD);
mSequencer.processFreEnvironmentPreNative(); mSequencer.processFreEnvironmentPreNative();
assertTrue(mSequencer.calledOnFlowIsKnown); assertTrue(mSequencer.calledOnFlowIsKnown);
...@@ -273,8 +269,7 @@ public class FirstRunFlowSequencerTest { ...@@ -273,8 +269,7 @@ public class FirstRunFlowSequencerTest {
mSequencer.shouldSkipFirstUseHints = false; mSequencer.shouldSkipFirstUseHints = false;
mSequencer.shouldShowDataReductionPage = true; mSequencer.shouldShowDataReductionPage = true;
mSequencer.shouldShowSearchEnginePage = true; mSequencer.shouldShowSearchEnginePage = true;
mSequencer.initializeSharedState( mSequencer.initializeSharedState(ChildAccountStatus.NOT_CHILD);
false /* androidEduDevice */, ChildAccountStatus.NOT_CHILD);
mSequencer.processFreEnvironmentPreNative(); mSequencer.processFreEnvironmentPreNative();
assertTrue(mSequencer.calledOnFlowIsKnown); assertTrue(mSequencer.calledOnFlowIsKnown);
...@@ -301,8 +296,7 @@ public class FirstRunFlowSequencerTest { ...@@ -301,8 +296,7 @@ public class FirstRunFlowSequencerTest {
mSequencer.hasAnyUserSeenToS = false; mSequencer.hasAnyUserSeenToS = false;
mSequencer.shouldSkipFirstUseHints = false; mSequencer.shouldSkipFirstUseHints = false;
mSequencer.shouldShowDataReductionPage = false; mSequencer.shouldShowDataReductionPage = false;
mSequencer.initializeSharedState( mSequencer.initializeSharedState(ChildAccountStatus.NOT_CHILD);
false /* androidEduDevice */, ChildAccountStatus.NOT_CHILD);
mSequencer.processFreEnvironmentPreNative(); mSequencer.processFreEnvironmentPreNative();
......
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