Skip to content

Commit

Permalink
New onboarding changes android [Uplift to 1.73.x] (#27059)
Browse files Browse the repository at this point in the history
Merge pull request #26999 from brave/new_onboarding_changes_android

New onboarding changes android
  • Loading branch information
deeppandya authored Dec 19, 2024
1 parent 4f28b26 commit 84fca34
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 6 deletions.
1 change: 1 addition & 0 deletions android/java/org/chromium/base/BraveFeatureList.java
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,15 @@
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;
import org.chromium.chrome.R;
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;
Expand Down Expand Up @@ -233,7 +234,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() {
Expand Down Expand Up @@ -262,7 +267,7 @@ private void nextOnboardingStep() {
if (mCurrentStep == 0) {
showIntroPage();
} else if (mCurrentStep == 1) {
if (DayZeroHelper.getDayZeroExptFlag()
if (!isNewOnboardingEnabled()
|| !BraveSetDefaultBrowserUtils.supportsDefaultRoleManager()) {
showBrowserSelectionPage();
} else if (!isDefaultBrowser()) {
Expand Down Expand Up @@ -319,8 +324,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);
Expand Down
7 changes: 7 additions & 0 deletions browser/brave_browser_features.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string> kBraveDayZeroExperimentVariant{
&kBraveDayZeroExperiment,
Expand Down
3 changes: 3 additions & 0 deletions browser/brave_browser_features.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string> kBraveDayZeroExperimentVariant;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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/buildflags/buildflags.h"
#include "brave/components/brave_news/common/features.h"
#include "brave/components/brave_rewards/common/features.h"
Expand Down Expand Up @@ -49,7 +50,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

Expand Down

0 comments on commit 84fca34

Please sign in to comment.