Commit f95b8c27 authored by tedchoc's avatar tedchoc Committed by Commit bot

Remove unused context params from FirstRunStatus.

Split out from:
https://codereview.chromium.org/2559573002/

There is a downstream caller for one method, so will
land this first to allow a quicker patch time.

TBR=yusufo@chromium.org
BUG=671149

Review-Url: https://codereview.chromium.org/2565183005
Cr-Commit-Position: refs/heads/master@{#437937}
parent d3dd3038
......@@ -369,7 +369,7 @@ public class ChromeTabbedActivity extends ChromeActivity implements OverviewMode
ChromePreferenceManager preferenceManager = ChromePreferenceManager.getInstance(this);
// Promos can only be shown when we start with ACTION_MAIN intent and
// after FRE is complete.
if (!mIntentWithEffect && FirstRunStatus.getFirstRunFlowComplete(this)) {
if (!mIntentWithEffect && FirstRunStatus.getFirstRunFlowComplete()) {
// Only show promos on the second oppurtunity. This is because we show FRE on the
// first oppurtunity, and we don't want to show such content back to back.
if (preferenceManager.getPromosSkippedOnFirstStart()) {
......
......@@ -86,7 +86,7 @@ public class EmbedContentViewActivity extends FullScreenActivity {
@Override
public boolean onCreateOptionsMenu(Menu menu) {
boolean retVal = super.onCreateOptionsMenu(menu);
if (!FirstRunStatus.getFirstRunFlowComplete(this)) return retVal;
if (!FirstRunStatus.getFirstRunFlowComplete()) return retVal;
return true;
}
......
......@@ -260,7 +260,7 @@ public class FirstRunActivity extends AppCompatActivity implements FirstRunPageD
UmaUtils.recordForegroundStartTime();
stopProgressionIfNotAcceptedTermsOfService();
if (!mFreProperties.getBoolean(EXTRA_USE_FRE_FLOW_SEQUENCER)) {
if (FirstRunStatus.getFirstRunFlowComplete(this)) {
if (FirstRunStatus.getFirstRunFlowComplete()) {
// This is a parallel flow that needs to be refreshed/re-fired.
// Signal the FRE flow completion and re-launch the original intent.
completeFirstRunExperience();
......@@ -403,7 +403,7 @@ public class FirstRunActivity extends AppCompatActivity implements FirstRunPageD
// If default is true then it corresponds to opt-out and false corresponds to opt-in.
UmaUtils.recordMetricsReportingDefaultOptIn(!DEFAULT_METRICS_AND_CRASH_REPORTING);
sGlue.acceptTermsOfService(allowCrashUpload);
FirstRunStatus.setSkipWelcomePage(FirstRunActivity.this, true);
FirstRunStatus.setSkipWelcomePage(true);
flushPersistentData();
stopProgressionIfNotAcceptedTermsOfService();
jumpToPage(mPager.getCurrentItem() + 1);
......
......@@ -86,7 +86,7 @@ public abstract class FirstRunFlowSequencer {
@VisibleForTesting
protected boolean isFirstRunFlowComplete() {
return FirstRunStatus.getFirstRunFlowComplete(mActivity);
return FirstRunStatus.getFirstRunFlowComplete();
}
@VisibleForTesting
......@@ -263,13 +263,13 @@ public abstract class FirstRunFlowSequencer {
fromIntent != null && TextUtils.equals(fromIntent.getAction(), Intent.ACTION_MAIN);
if (!fromChromeIcon && ToSAckedReceiver.checkAnyUserHasSeenToS(context)) return null;
final boolean baseFreComplete = FirstRunStatus.getFirstRunFlowComplete(context);
final boolean baseFreComplete = FirstRunStatus.getFirstRunFlowComplete();
if (!baseFreComplete) {
if (forLightweightFre
&& CommandLine.getInstance().hasSwitch(
ChromeSwitches.ENABLE_LIGHTWEIGHT_FIRST_RUN_EXPERIENCE)) {
if (!FirstRunStatus.shouldSkipWelcomePage(context)
&& !FirstRunStatus.getLightweightFirstRunFlowComplete(context)) {
if (!FirstRunStatus.shouldSkipWelcomePage()
&& !FirstRunStatus.getLightweightFirstRunFlowComplete()) {
return createLightweightFirstRunIntent(context, fromChromeIcon);
}
} else {
......
......@@ -58,7 +58,7 @@ public final class FirstRunSignInProcessor {
SigninManager signinManager = SigninManager.get(activity.getApplicationContext());
signinManager.onFirstRunCheckDone();
boolean firstRunFlowComplete = FirstRunStatus.getFirstRunFlowComplete(activity);
boolean firstRunFlowComplete = FirstRunStatus.getFirstRunFlowComplete();
// We skip signin and the FRE if
// - FRE is disabled, or
// - FRE hasn't been completed, but the user has already seen the ToS in the Setup Wizard.
......@@ -129,7 +129,7 @@ public final class FirstRunSignInProcessor {
Log.e(TAG, "Attempt to pass-through without completed FRE");
// Things went wrong -- we want the user to go through the full FRE.
FirstRunStatus.setFirstRunFlowComplete(activity, false);
FirstRunStatus.setFirstRunFlowComplete(false);
setFirstRunFlowSignInComplete(activity, false);
setFirstRunFlowSignInAccountName(activity, null);
setFirstRunFlowSignInSetup(activity, false);
......@@ -207,7 +207,7 @@ public final class FirstRunSignInProcessor {
* @param data Resulting FRE properties bundle
*/
public static void finalizeFirstRunFlowState(Context context, Bundle data) {
FirstRunStatus.setFirstRunFlowComplete(context, true);
FirstRunStatus.setFirstRunFlowComplete(true);
setFirstRunFlowSignInAccountName(context,
data.getString(FirstRunActivity.RESULT_SIGNIN_ACCOUNT_NAME));
setFirstRunFlowSignInSetup(
......@@ -221,7 +221,7 @@ public final class FirstRunSignInProcessor {
public static void updateSigninManagerFirstRunCheckDone(Context context) {
SigninManager manager = SigninManager.get(context);
if (manager.isSignInAllowed()) return;
if (!FirstRunStatus.getFirstRunFlowComplete(context)) return;
if (!FirstRunStatus.getFirstRunFlowComplete()) return;
if (!getFirstRunFlowSignInComplete(context)) return;
manager.onFirstRunCheckDone();
}
......
......@@ -4,8 +4,6 @@
package org.chromium.chrome.browser.firstrun;
import android.content.Context;
import org.chromium.base.ContextUtils;
/**
......@@ -21,10 +19,9 @@ public class FirstRunStatus {
/**
* Sets the "main First Run Experience flow complete" preference.
* @param context Any context
* @param isComplete Whether the main First Run Experience flow is complete
*/
public static void setFirstRunFlowComplete(Context context, boolean isComplete) {
public static void setFirstRunFlowComplete(boolean isComplete) {
ContextUtils.getAppSharedPreferences()
.edit()
.putBoolean(FIRST_RUN_FLOW_COMPLETE, isComplete)
......@@ -35,35 +32,38 @@ public class FirstRunStatus {
* Returns whether the main First Run Experience flow is complete.
* Note: that might NOT include "intro"/"what's new" pages, but it always
* includes ToS and Sign In pages if necessary.
* @param context Any context
*/
public static boolean getFirstRunFlowComplete(Context context) {
public static boolean getFirstRunFlowComplete() {
return ContextUtils.getAppSharedPreferences()
.getBoolean(FIRST_RUN_FLOW_COMPLETE, false);
}
// TODO(tedchoc): Remove once downstream callers migrate to non-param version.
public static boolean getFirstRunFlowComplete(
@SuppressWarnings("unused") android.content.Context context) {
return getFirstRunFlowComplete();
}
/**
* Sets the preference to skip the welcome page from the main First Run Experience.
* @param context Any context
* @param isSkip Whether the welcome page should be skpped
* @param isSkip Whether the welcome page should be skpped
*/
public static void setSkipWelcomePage(Context context, boolean isSkip) {
public static void setSkipWelcomePage(boolean isSkip) {
ContextUtils.getAppSharedPreferences().edit().putBoolean(SKIP_WELCOME_PAGE, isSkip).apply();
}
/**
* Checks whether the welcome page should be skipped from the main First Run Experience.
*/
public static boolean shouldSkipWelcomePage(Context context) {
public static boolean shouldSkipWelcomePage() {
return ContextUtils.getAppSharedPreferences().getBoolean(SKIP_WELCOME_PAGE, false);
}
/**
* Sets the "lightweight First Run Experience flow complete" preference.
* @param context Any context
* @param isComplete Whether the lightweight First Run Experience flow is complete
*/
public static void setLightweightFirstRunFlowComplete(Context context, boolean isComplete) {
public static void setLightweightFirstRunFlowComplete(boolean isComplete) {
ContextUtils.getAppSharedPreferences()
.edit()
.putBoolean(LIGHTWEIGHT_FIRST_RUN_FLOW_COMPLETE, isComplete)
......@@ -72,9 +72,8 @@ public class FirstRunStatus {
/**
* Returns whether the "lightweight First Run Experience flow" is complete.
* @param context Any context
*/
public static boolean getLightweightFirstRunFlowComplete(Context context) {
public static boolean getLightweightFirstRunFlowComplete() {
return ContextUtils.getAppSharedPreferences().getBoolean(
LIGHTWEIGHT_FIRST_RUN_FLOW_COMPLETE, false);
}
......
......@@ -78,7 +78,7 @@ public class LightweightFirstRunActivity extends FirstRunActivity {
@Override
public void completeFirstRunExperience() {
FirstRunStatus.setLightweightFirstRunFlowComplete(LightweightFirstRunActivity.this, true);
FirstRunStatus.setLightweightFirstRunFlowComplete(true);
Intent intent = new Intent();
intent.putExtras(mFreProperties);
finishAllTheActivities(getLocalClassName(), Activity.RESULT_OK, intent);
......
......@@ -104,6 +104,6 @@ public class ToSAndUMAFirstRunFragment extends FirstRunPage {
@Override
public boolean shouldSkipPageOnCreate(Context appContext) {
return FirstRunStatus.shouldSkipWelcomePage(appContext);
return FirstRunStatus.shouldSkipWelcomePage();
}
}
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