From 699be36c9bd332868fed9f38a0e436527264b8cf Mon Sep 17 00:00:00 2001 From: Saumya Prakash Date: Mon, 31 Mar 2025 21:57:47 +0000 Subject: [PATCH] Ensure the back button is visible in SUW for simple view Simple view is meant to provide an easier setup experience and this means that the back button must be visible in SUW, even if the new design choice is applied. This change adds a caveat to enable the back button for this situation. Fix: 396559615 Test: Enable/Disable simple view with the new theme applied and observe the back button appear/disappear Flag: EXEMPT bugfix Change-Id: Ic58b5d87b2d0670c468222098a53293ae27b0206 --- .../taskbar/NavbarButtonsViewController.java | 12 +++++++----- .../launcher3/taskbar/TaskbarActivityContext.java | 14 ++++++++++++++ .../taskbar/navbutton/SetupNavLayoutter.kt | 4 +++- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java index cf3b95274a..65f2fce91e 100644 --- a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java @@ -344,8 +344,10 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT // Start at 1 because relevant flags are unset at init. mOnBackgroundNavButtonColorOverrideMultiplier.value = 1; - // Potentially force the back button to be visible during setup wizard. - boolean shouldShowInSetup = !mContext.isUserSetupComplete() && !mIsExpressiveThemeEnabled; + // Potentially force the back button to be visible during setup wizard. The back button + // won't show up if the expressive theme is enabled and simple view is disabled + boolean shouldShowInSetup = !mContext.isUserSetupComplete() + && (!mIsExpressiveThemeEnabled || mContext.isSimpleViewEnabled()); boolean isInKidsMode = mContext.isNavBarKidsModeActive(); boolean alwaysShowButtons = isThreeButtonNav || shouldShowInSetup; @@ -987,15 +989,15 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT if (mFloatingRotationButton != null) { mFloatingRotationButton.onConfigurationChanged(configChanges); } - if (!mContext.isUserSetupComplete()) { + if (!mContext.isUserSetupComplete() && !ENABLE_TASKBAR_NAVBAR_UNIFICATION) { handleSetupUi(); } updateButtonLayoutSpacing(); } private void handleSetupUi() { - // Setup wizard handles the UI when the expressive theme is enabled. - if (mIsExpressiveThemeEnabled) { + // Setup wizard handles the UI when the expressive theme is enabled and Simple View isn't. + if (mIsExpressiveThemeEnabled && !mContext.isSimpleViewEnabled()) { return; } // Since setup wizard only has back button enabled, it looks strange to be diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java index 653bef9429..e4b81dc206 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java @@ -207,6 +207,8 @@ public class TaskbarActivityContext extends BaseTaskbarContext { private static final String WINDOW_TITLE = "Taskbar"; + public static final String SIMPLE_VIEW_SETTINGS_KEY = "matcha_enable"; + protected static final DesktopModeFlag ENABLE_TASKBAR_BEHIND_SHADE = new DesktopModeFlag( Flags::enableTaskbarBehindShade, false); @@ -2017,6 +2019,18 @@ public class TaskbarActivityContext extends BaseTaskbarContext { return mIsUserSetupComplete; } + /** + * Checks if the simple view mode is enabled. + * + * Since Simple View puts the device in 3 button nav mode, we use that as a precursor to + * checking the actual value in Settings to avoid extra calls to Settings. + */ + public boolean isSimpleViewEnabled() { + return isThreeButtonNav() + && Settings.Secure.getInt(getContentResolver(), SIMPLE_VIEW_SETTINGS_KEY, 0) + > 0; + } + public boolean isNavBarKidsModeActive() { return mIsNavBarKidsMode && isThreeButtonNav(); } diff --git a/quickstep/src/com/android/launcher3/taskbar/navbutton/SetupNavLayoutter.kt b/quickstep/src/com/android/launcher3/taskbar/navbutton/SetupNavLayoutter.kt index eb3fdeb99e..99a2382827 100644 --- a/quickstep/src/com/android/launcher3/taskbar/navbutton/SetupNavLayoutter.kt +++ b/quickstep/src/com/android/launcher3/taskbar/navbutton/SetupNavLayoutter.kt @@ -59,7 +59,9 @@ class SetupNavLayoutter( override fun layoutButtons(context: TaskbarActivityContext, isA11yButtonPersistent: Boolean) { val SUWTheme = SystemProperties.get(SUW_THEME_SYSTEM_PROPERTY, "") - if (SUWTheme == GLIF_EXPRESSIVE_THEME || SUWTheme == GLIF_EXPRESSIVE_LIGHT_THEME) { + val expressiveThemeEnabled = + SUWTheme == GLIF_EXPRESSIVE_THEME || SUWTheme == GLIF_EXPRESSIVE_LIGHT_THEME + if (expressiveThemeEnabled && !context.isSimpleViewEnabled) { return } // Since setup wizard only has back button enabled, it looks strange to be