Skip to content

Commit

Permalink
[Android] Disable NTP at start up (uplift to 1.71.x) (#25781)
Browse files Browse the repository at this point in the history
Uplift of #25776 (squashed) to beta
  • Loading branch information
brave-builds authored Oct 8, 2024
1 parent 538f203 commit 6e4b3bc
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 11 deletions.
2 changes: 1 addition & 1 deletion android/java/apk_for_test.flags
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@
}

-keep class org.chromium.chrome.browser.tasks.ReturnToChromeUtil {
*** shouldShowTabSwitcher(...);
*** shouldShowNtpAsHomeSurfaceAtStartup(...);
}

-keep class org.chromium.chrome.browser.IntentHandler {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@

package org.chromium.chrome.browser.tasks;

import org.chromium.chrome.browser.flags.ChromeFeatureList;
import android.content.Intent;
import android.os.Bundle;

public final class BraveReturnToChromeUtil {
public static boolean shouldShowTabSwitcher(final long lastTimeMillis) {
if (!ChromeFeatureList.sStartSurfaceReturnTime.isEnabled()) {
return false;
}
import org.chromium.chrome.browser.ChromeInactivityTracker;

return ReturnToChromeUtil.shouldShowTabSwitcher(lastTimeMillis);
public final class BraveReturnToChromeUtil {
/** Returns whether should show a NTP as the home surface at startup. */
public static boolean shouldShowNtpAsHomeSurfaceAtStartup(
Intent intent, Bundle bundle, ChromeInactivityTracker inactivityTracker) {
// We do not want to show the NTP at start up in Brave.
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -651,11 +651,13 @@ public void testMethodsExist() throws Exception {
Assert.assertTrue(
methodExists(
"org/chromium/chrome/browser/tasks/ReturnToChromeUtil",
"shouldShowTabSwitcher",
"shouldShowNtpAsHomeSurfaceAtStartup",
MethodModifier.STATIC,
true,
boolean.class,
long.class));
Intent.class,
Bundle.class,
ChromeInactivityTracker.class));
Assert.assertTrue(
methodExists(
"org/chromium/chrome/browser/IntentHandler",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ public class BraveReturnToChromeUtilClassAdapter extends BraveClassVisitor {
public BraveReturnToChromeUtilClassAdapter(ClassVisitor visitor) {
super(visitor);

changeMethodOwner(sReturnToChromeUtilClassName, "shouldShowTabSwitcher",
changeMethodOwner(
sReturnToChromeUtilClassName,
"shouldShowNtpAsHomeSurfaceAtStartup",
sBraveReturnToChromeUtilClassName);
}
}

0 comments on commit 6e4b3bc

Please sign in to comment.