From f6496357e2529b064f1426e2053c3de186e4a0f5 Mon Sep 17 00:00:00 2001 From: Saumya Prakash Date: Wed, 29 Jan 2025 19:55:09 +0000 Subject: [PATCH] Remove back button and enable back gesture on SUW According to new spec, for devices that have a different theme, Setup Wizard should no longer have the back button, and instead should use the back gesture in between screens. Fix: 349495243 Flag: EXEMPT bugfix Test: Set the System property for setup wizard device theme to be expressive. Rerun setup wizard and ensure the back button doesn't show up and the back gesture works. For the existing theme, the behavior should remain unchanged. Change-Id: I6b8e95f4eeecdf7422c9f1c099b30a4fc2d2fd12 --- .../taskbar/NavbarButtonsViewController.java | 15 ++++++++++++--- .../taskbar/navbutton/SetupNavLayoutter.kt | 13 +++++++++---- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java index 1144ac5ca1..368a0367fd 100644 --- a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java @@ -73,6 +73,7 @@ import android.graphics.drawable.PaintDrawable; import android.graphics.drawable.RotateDrawable; import android.inputmethodservice.InputMethodService; import android.os.Handler; +import android.os.SystemProperties; import android.util.Property; import android.view.Gravity; import android.view.HapticFeedbackConstants; @@ -181,6 +182,7 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT private final int mDarkIconColorOnWorkspace; /** Color to use for navbar buttons, if they are on on a Taskbar surface background. */ private final int mOnBackgroundIconColor; + private final boolean mIsExpressiveThemeEnabled; private @Nullable Animator mNavBarLocationAnimator; private @Nullable BubbleBarLocation mBubbleBarTargetLocation; @@ -262,6 +264,9 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT if (mContext.isPhoneMode()) { mTaskbarTransitions = new TaskbarTransitions(mContext, mNavButtonsView); } + String SUWTheme = SystemProperties.get("setupwizard.theme", ""); + mIsExpressiveThemeEnabled = SUWTheme.equals("glif_expressive") + || SUWTheme.equals("glif_expressive_light"); } /** @@ -324,10 +329,10 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT // Start at 1 because relevant flags are unset at init. mOnBackgroundNavButtonColorOverrideMultiplier.value = 1; - // Force nav buttons (specifically back button) to be visible during setup wizard. - boolean isInSetup = !mContext.isUserSetupComplete(); + // Potentially force the back button to be visible during setup wizard. + boolean shouldShowInSetup = !mContext.isUserSetupComplete() && !mIsExpressiveThemeEnabled; boolean isInKidsMode = mContext.isNavBarKidsModeActive(); - boolean alwaysShowButtons = isThreeButtonNav || isInSetup; + boolean alwaysShowButtons = isThreeButtonNav || shouldShowInSetup; // Make sure to remove nav bar buttons translation when any of the following occur: // - Notification shade is expanded @@ -917,6 +922,10 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT } private void handleSetupUi() { + // Setup wizard handles the UI when the expressive theme is enabled. + if (mIsExpressiveThemeEnabled) { + return; + } // Since setup wizard only has back button enabled, it looks strange to be // end-aligned, so start-align instead. FrameLayout.LayoutParams navButtonsLayoutParams = (FrameLayout.LayoutParams) diff --git a/quickstep/src/com/android/launcher3/taskbar/navbutton/SetupNavLayoutter.kt b/quickstep/src/com/android/launcher3/taskbar/navbutton/SetupNavLayoutter.kt index 22a36301b3..e032430c1d 100644 --- a/quickstep/src/com/android/launcher3/taskbar/navbutton/SetupNavLayoutter.kt +++ b/quickstep/src/com/android/launcher3/taskbar/navbutton/SetupNavLayoutter.kt @@ -17,6 +17,7 @@ package com.android.launcher3.taskbar.navbutton import android.content.res.Resources +import android.os.SystemProperties import android.view.Gravity import android.view.ViewGroup import android.view.ViewGroup.LayoutParams.WRAP_CONTENT @@ -39,7 +40,7 @@ class SetupNavLayoutter( startContextualContainer: ViewGroup, imeSwitcher: ImageView?, a11yButton: ImageView?, - space: Space? + space: Space?, ) : AbstractNavButtonLayoutter( resources, @@ -48,11 +49,15 @@ class SetupNavLayoutter( startContextualContainer, imeSwitcher, a11yButton, - space + space, ) { private val mNavButtonsView = navButtonsView override fun layoutButtons(context: TaskbarActivityContext, isA11yButtonPersistent: Boolean) { + val SUWTheme = SystemProperties.get("setupwizard.theme", "") + if (SUWTheme == "glif_expressive" || SUWTheme == "glif_expressive_light") { + return + } // Since setup wizard only has back button enabled, it looks strange to be // end-aligned, so start-align instead. val navButtonsLayoutParams = navButtonContainer.layoutParams as FrameLayout.LayoutParams @@ -80,7 +85,7 @@ class SetupNavLayoutter( adjustForSetupInPhoneMode( navButtonsLayoutParams, navButtonsViewLayoutParams, - deviceProfile + deviceProfile, ) } mNavButtonsView.layoutParams = navButtonsViewLayoutParams @@ -97,7 +102,7 @@ class SetupNavLayoutter( WRAP_CONTENT, contextualMargin, contextualMargin, - Gravity.START + Gravity.START, ) if (imeSwitcher != null) {