From 302fc27f5338a0014f69286cb2fad96a3737ae48 Mon Sep 17 00:00:00 2001 From: Deep Pandya <5146988+deeppandya@users.noreply.github.com> Date: Wed, 18 Dec 2024 09:35:03 -0700 Subject: [PATCH] Merge pull request #26999 from brave/new_onboarding_changes_android New onboarding changes android Resolve rebase issue --- .../java/org/chromium/base/BraveFeatureList.java | 1 + .../firstrun/WelcomeOnboardingActivity.java | 14 +++++++++----- browser/brave_browser_features.cc | 7 +++++++ browser/brave_browser_features.h | 3 +++ .../browser/flags/android/chrome_feature_list.cc | 4 +++- 5 files changed, 23 insertions(+), 6 deletions(-) diff --git a/android/java/org/chromium/base/BraveFeatureList.java b/android/java/org/chromium/base/BraveFeatureList.java index bc876d07ae92..d61a6889c9f8 100644 --- a/android/java/org/chromium/base/BraveFeatureList.java +++ b/android/java/org/chromium/base/BraveFeatureList.java @@ -33,5 +33,6 @@ public abstract class BraveFeatureList { public static final String BRAVE_SHOW_STRICT_FINGERPRINTING_MODE = "BraveShowStrictFingerprintingMode"; public static final String BRAVE_DAY_ZERO_EXPERIMENT = "BraveDayZeroExperiment"; + public static final String BRAVE_NEW_ANDROID_ONBOARDING = "NewAndroidOnboarding"; public static final String BRAVE_FALLBACK_DOH_PROVIDER = "BraveFallbackDoHProvider"; } diff --git a/android/java/org/chromium/chrome/browser/firstrun/WelcomeOnboardingActivity.java b/android/java/org/chromium/chrome/browser/firstrun/WelcomeOnboardingActivity.java index 70aa9d572b58..8a41fbf0ab58 100644 --- a/android/java/org/chromium/chrome/browser/firstrun/WelcomeOnboardingActivity.java +++ b/android/java/org/chromium/chrome/browser/firstrun/WelcomeOnboardingActivity.java @@ -35,6 +35,7 @@ import com.android.installreferrer.api.InstallReferrerStateListener; import com.android.installreferrer.api.ReferrerDetails; +import org.chromium.base.BraveFeatureList; import org.chromium.base.BravePreferenceKeys; import org.chromium.base.Log; import org.chromium.base.ThreadUtils; @@ -42,7 +43,7 @@ import org.chromium.chrome.browser.BraveLocalState; import org.chromium.chrome.browser.back_press.SecondaryActivityBackPressUma.SecondaryActivity; import org.chromium.chrome.browser.customtabs.CustomTabActivity; -import org.chromium.chrome.browser.day_zero.DayZeroHelper; +import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.metrics.ChangeMetricsReportingStateCalledFrom; import org.chromium.chrome.browser.metrics.UmaSessionStats; import org.chromium.chrome.browser.onboarding.OnboardingPrefManager; @@ -230,7 +231,11 @@ private void onClickViews() { } private boolean shouldForceDefaultBrowserPrompt() { - return !DayZeroHelper.getDayZeroExptFlag() && !isDefaultBrowser(); + return isNewOnboardingEnabled() && !isDefaultBrowser(); + } + + private boolean isNewOnboardingEnabled() { + return ChromeFeatureList.isEnabled(BraveFeatureList.BRAVE_NEW_ANDROID_ONBOARDING); } private void setDefaultBrowserAndProceedToNextStep() { @@ -259,7 +264,7 @@ private void nextOnboardingStep() { if (mCurrentStep == 0) { showIntroPage(); } else if (mCurrentStep == 1) { - if (DayZeroHelper.getDayZeroExptFlag() + if (!isNewOnboardingEnabled() || !BraveSetDefaultBrowserUtils.supportsDefaultRoleManager()) { showBrowserSelectionPage(); } else if (!isDefaultBrowser()) { @@ -316,8 +321,7 @@ public void run() { }, 200); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU - && DayZeroHelper.getDayZeroExptFlag()) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU && !isNewOnboardingEnabled()) { mRequestPermissionLauncher.launch(Manifest.permission.POST_NOTIFICATIONS); } else { startTimer(3000); diff --git a/browser/brave_browser_features.cc b/browser/brave_browser_features.cc index 6bf68d23a30b..85c244faad08 100644 --- a/browser/brave_browser_features.cc +++ b/browser/brave_browser_features.cc @@ -46,6 +46,13 @@ BASE_FEATURE(kBraveDayZeroExperiment, "BraveDayZeroExperiment", base::FEATURE_DISABLED_BY_DEFAULT); +#if BUILDFLAG(IS_ANDROID) +// Enable new onboarding on Android +BASE_FEATURE(kNewAndroidOnboarding, + "NewAndroidOnboarding", + base::FEATURE_DISABLED_BY_DEFAULT); +#endif // BUILDFLAG(IS_ANDROID) + // The variant of the "day zero" experiment. i.e. A, B, C, D, etc. const base::FeatureParam kBraveDayZeroExperimentVariant{ &kBraveDayZeroExperiment, diff --git a/browser/brave_browser_features.h b/browser/brave_browser_features.h index eb582810c206..ad30895a251e 100644 --- a/browser/brave_browser_features.h +++ b/browser/brave_browser_features.h @@ -19,6 +19,9 @@ BASE_DECLARE_FEATURE(kBraveCopyCleanLinkFromJs); BASE_DECLARE_FEATURE(kBraveOverrideDownloadDangerLevel); BASE_DECLARE_FEATURE(kBraveWebViewRoundedCorners); BASE_DECLARE_FEATURE(kBraveDayZeroExperiment); +#if BUILDFLAG(IS_ANDROID) +BASE_DECLARE_FEATURE(kNewAndroidOnboarding); +#endif // BUILDFLAG(IS_ANDROID) extern const base::FeatureParam kBraveDayZeroExperimentVariant; diff --git a/chromium_src/chrome/browser/flags/android/chrome_feature_list.cc b/chromium_src/chrome/browser/flags/android/chrome_feature_list.cc index 2c3350bdc599..1669ea5ce33d 100644 --- a/chromium_src/chrome/browser/flags/android/chrome_feature_list.cc +++ b/chromium_src/chrome/browser/flags/android/chrome_feature_list.cc @@ -6,6 +6,7 @@ #include "base/feature_override.h" #include "brave/browser/android/background_video/features.h" #include "brave/browser/android/safe_browsing/features.h" +#include "brave/browser/brave_browser_features.h" #include "brave/components/ai_chat/core/common/features.h" #include "brave/components/brave_news/common/features.h" #include "brave/components/brave_rewards/common/features.h" @@ -44,7 +45,8 @@ &google_sign_in_permission::features::kBraveGoogleSignInPermission, \ &net::features::kBraveForgetFirstPartyStorage, \ &brave_shields::features::kBraveShowStrictFingerprintingMode, \ - &brave_shields::features::kBraveLocalhostAccessPermission + &brave_shields::features::kBraveLocalhostAccessPermission, \ + &features::kNewAndroidOnboarding // clang-format on