From: uazo Date: Tue, 27 Feb 2024 16:20:43 +0000 Subject: Show NTP at startup Adds an active option by default to automatically open the NTP at each reboot and allows the user to continue the old browsing. Until the real tab is opened, no data is retrieved. License: GPL-2.0-or-later - https://spdx.org/licenses/GPL-2.0-or-later.html --- .../java/res/layout/single_tab_view_layout.xml | 11 +++++++++-- .../tasks/SingleTabSwitcherOnNtpMediator.java | 10 ++++------ .../android/java/res/xml/homepage_preferences.xml | 6 ++++++ .../chrome/browser/ChromeInactivityTracker.java | 13 +++++++++++++ .../chrome/browser/ChromeTabbedActivity.java | 4 +++- .../chrome/browser/tasks/ReturnToChromeUtil.java | 8 +++++++- .../browser/preferences/ChromePreferenceKeys.java | 2 ++ .../preferences/LegacyChromePreferenceKeys.java | 1 + .../show-ntp-at-startup.grdp | 9 +++++++++ .../chrome_feature_list_cc/show-ntp-at-startup.inc | 2 ++ 10 files changed, 56 insertions(+), 10 deletions(-) create mode 100644 chrome/browser/ui/android/strings/cromite_android_chrome_strings_grd/show-ntp-at-startup.grdp create mode 100644 cromite_flags/chrome/browser/flags/android/chrome_feature_list_cc/show-ntp-at-startup.inc diff --git a/chrome/android/features/start_surface/java/res/layout/single_tab_view_layout.xml b/chrome/android/features/start_surface/java/res/layout/single_tab_view_layout.xml --- a/chrome/android/features/start_surface/java/res/layout/single_tab_view_layout.xml +++ b/chrome/android/features/start_surface/java/res/layout/single_tab_view_layout.xml @@ -36,7 +36,7 @@ found in the LICENSE file. @@ -57,11 +57,18 @@ found in the LICENSE file. android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1.0" - android:layout_marginBottom="10dp" android:layout_gravity="center_vertical" android:gravity="center_vertical" android:singleLine="true" android:textAppearance="@style/TextAppearance.TextMedium" /> + + + onStandardActiveIndexRead = null; shouldShowNtpAsHomeSurfaceAtStartup = shouldShowNtpHomeSurfaceOnStartup(); boolean skipSavingNonActiveNtps = skipSavingNonActiveNtps(); - if (skipSavingNonActiveNtps) { + if (skipSavingNonActiveNtps || shouldShowNtpAsHomeSurfaceAtStartup) { mHomeSurfaceTracker = new HomeSurfaceTracker(); } if (shouldShowNtpAsHomeSurfaceAtStartup) { @@ -2317,6 +2317,8 @@ public class ChromeTabbedActivity extends ChromeActivity + + + Show NTP at startup + + + Enable showing a NewTabPage at startup and allows selection of the last open tab + + diff --git a/cromite_flags/chrome/browser/flags/android/chrome_feature_list_cc/show-ntp-at-startup.inc b/cromite_flags/chrome/browser/flags/android/chrome_feature_list_cc/show-ntp-at-startup.inc new file mode 100644 --- /dev/null +++ b/cromite_flags/chrome/browser/flags/android/chrome_feature_list_cc/show-ntp-at-startup.inc @@ -0,0 +1,2 @@ +SET_CROMITE_FEATURE_ENABLED(kStartSurfaceReturnTime); +SET_CROMITE_FEATURE_ENABLED(kShowNtpAtStartupAndroid); --