Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3291)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunFlowSequencer.java

Issue 1175133002: Revert of Android FRE: A New Deal (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunFlowSequencer.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunFlowSequencer.java b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunFlowSequencer.java
index 1e5cdbdeceb96735d02bb1db959c168492f38fc3..07b6dbdb041a96256ab5977329270cd8b3b3d9ed 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunFlowSequencer.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunFlowSequencer.java
@@ -130,39 +130,45 @@
final boolean shouldSkipFirstUseHints =
ApiCompatibilityUtils.shouldSkipFirstUseHints(context.getContentResolver());
- // In the full FRE we always show the Welcome page, except on EDU devices.
- final boolean showWelcomePage = !forceEduSignIn;
- freProperties.putBoolean(FirstRunActivity.SHOW_WELCOME_PAGE, showWelcomePage);
-
- // Enable reporting by default on non-Stable releases.
- // The user can turn it off on the Welcome page.
- // This is controlled by the administrator via a policy on EDU devices.
- if (!ChromeVersionInfo.isStableBuild()) {
- PrivacyPreferencesManager.getInstance(context).initCrashUploadPreference(true);
- }
-
- // We show the sign-in page if sync is allowed, and this is not an EDU device, and
- // - no "skip the first use hints" is set, or
- // - "skip the first use hints" is set, but there is at least one account.
- final boolean syncOk = isSyncAllowed();
- final boolean offerSignInOk = syncOk
- && !forceEduSignIn
- && (!shouldSkipFirstUseHints || googleAccounts.length > 0);
- freProperties.putBoolean(FirstRunActivity.SHOW_SIGNIN_PAGE, offerSignInOk);
-
- if (offerSignInOk || forceEduSignIn) {
- // If the user has accepted the ToS in the Setup Wizard and there is exactly
- // one account, or if the device has a child account, or if the device is an
- // Android EDU device and there is exactly one account, preselect the sign-in
- // account and force the selection if necessary.
- if ((ToSAckedReceiver.checkAnyUserHasSeenToS(mActivity) && onlyOneAccount)
- || mHasChildAccount
- || forceEduSignIn) {
- freProperties.putString(AccountFirstRunFragment.FORCE_SIGNIN_ACCOUNT_TO,
- googleAccounts[0].name);
- freProperties.putBoolean(AccountFirstRunFragment.PRESELECT_BUT_ALLOW_TO_CHANGE,
- !forceEduSignIn && !mHasChildAccount);
+ if (!FirstRunStatus.getFirstRunFlowComplete(context)) {
+ // In the full FRE we always show the Welcome page, except on EDU devices.
+ final boolean showWelcomePage = !forceEduSignIn;
+ freProperties.putBoolean(FirstRunActivity.SHOW_WELCOME_PAGE, showWelcomePage);
+
+ // Enable reporting by default on non-Stable releases.
+ // The user can turn it off on the Welcome page.
+ // This is controlled by the administrator via a policy on EDU devices.
+ if (!ChromeVersionInfo.isStableBuild()) {
+ PrivacyPreferencesManager.getInstance(context).initCrashUploadPreference(true);
}
+
+ // We show the sign-in page if sync is allowed, and this is not an EDU device, and
+ // - no "skip the first use hints" is set, or
+ // - "skip the first use hints" is set, but there is at least one account.
+ final boolean syncOk = isSyncAllowed();
+ final boolean offerSignInOk = syncOk
+ && !forceEduSignIn
+ && (!shouldSkipFirstUseHints || googleAccounts.length > 0);
+ freProperties.putBoolean(FirstRunActivity.SHOW_SIGNIN_PAGE, offerSignInOk);
+
+ if (offerSignInOk || forceEduSignIn) {
+ // If the user has accepted the ToS in the Setup Wizard and there is exactly
+ // one account, or if the device has a child account, or if the device is an
+ // Android EDU device and there is exactly one account, preselect the sign-in
+ // account and force the selection if necessary.
+ if ((ToSAckedReceiver.checkAnyUserHasSeenToS(mActivity) && onlyOneAccount)
+ || mHasChildAccount
+ || forceEduSignIn) {
+ freProperties.putString(AccountFirstRunFragment.FORCE_SIGNIN_ACCOUNT_TO,
+ googleAccounts[0].name);
+ freProperties.putBoolean(AccountFirstRunFragment.PRESELECT_BUT_ALLOW_TO_CHANGE,
+ !forceEduSignIn && !mHasChildAccount);
+ }
+ }
+ } else {
+ // If the full FRE has already been shown, don't show Welcome or Sign-In pages.
+ freProperties.putBoolean(FirstRunActivity.SHOW_WELCOME_PAGE, false);
+ freProperties.putBoolean(FirstRunActivity.SHOW_SIGNIN_PAGE, false);
}
freProperties.putBoolean(AccountFirstRunFragment.IS_CHILD_ACCOUNT, mHasChildAccount);
@@ -191,34 +197,44 @@
* @return The intent to launch the First Run Experience if necessary, or null.
* @param activity The context
* @param originalIntent An original intent
- */
- public static Intent checkIfFirstRunIsNecessary(Activity activity, Intent originalIntent) {
+ * @param fromChromeIcon Whether Chrome is opened via the Chrome icon
+ */
+ public static Intent checkIfFirstRunIsNecessary(Activity activity,
+ Intent originalIntent, boolean fromChromeIcon) {
// If FRE is disabled (e.g. in tests), proceed directly to the intent handling.
if (CommandLine.getInstance().hasSwitch(ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE)) {
return null;
}
- // If the user has been through the First Run Activity -- proceed with the original intent.
- if (FirstRunStatus.getFirstRunFlowComplete(activity)) return null;
-
- // If the device hasn't been provisioned yet -- proceed with the original intent.
- if (!ApiCompatibilityUtils.isDeviceProvisioned(activity)) return null;
-
- // Otherwise, start the full FRE.
- return createGenericFirstRunIntent(activity, originalIntent);
+ // If Chrome isn't opened via the Chrome icon, and the user accepted the ToS
+ // in the Setup Wizard, skip any First Run Experience screens and proceed directly
+ // to the intent handling.
+ if (!fromChromeIcon && ToSAckedReceiver.checkAnyUserHasSeenToS(activity)) return null;
+
+ // If the user hasn't been through the First Run Activity -- it must be shown.
+ final boolean baseFreComplete = FirstRunStatus.getFirstRunFlowComplete(activity);
+ if (!baseFreComplete) {
+ return createGenericFirstRunIntent(activity, originalIntent, fromChromeIcon);
+ }
+
+ // Promo pages are removed, so there is nothing else to show in FRE.
+ return null;
}
/**
* @return A generic intent to show the First Run Activity.
* @param activity The context
* @param originalIntent An original intent
+ * @param fromChromeIcon Whether Chrome is opened via the Chrome icon
*/
- public static Intent createGenericFirstRunIntent(Activity activity, Intent originalIntent) {
+ public static Intent createGenericFirstRunIntent(
+ Activity activity, Intent originalIntent, boolean fromChromeIcon) {
ChromiumApplication application = (ChromiumApplication) activity.getApplication();
String activityName = application.getFirstRunActivityName();
Intent intent = new Intent();
intent.setClassName(activity, activityName);
+ intent.putExtra(FirstRunActivity.COMING_FROM_CHROME_ICON, fromChromeIcon);
intent.putExtra(FirstRunActivity.USE_FRE_FLOW_SEQUENCER, true);
return intent;
}

Powered by Google App Engine
This is Rietveld 408576698