summaryrefslogtreecommitdiff
path: root/quickstep
diff options
context:
space:
mode:
author Saumya Prakash <saumyaprakash@google.com> 2025-03-21 10:41:59 -0700
committer Android (Google) Code Review <android-gerrit@google.com> 2025-03-21 10:41:59 -0700
commitcfe62a68d23a3c88c28f593dfe76c08823120d54 (patch)
tree0ecff7cd54ea3a621157db2eb60f1d643c9dfffd /quickstep
parent6fb96f4fac7ec43e724506f6ee055bb9c385d638 (diff)
parent850ee61de68f20e9bdd38ebec2eed31cbe070804 (diff)
Merge "Ensure back button shows up in Simple View for SUW" into main
Diffstat (limited to 'quickstep')
-rw-r--r--quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt4
-rw-r--r--quickstep/src/com/android/launcher3/taskbar/navbutton/AbstractNavButtonLayoutter.kt29
-rw-r--r--quickstep/src/com/android/launcher3/taskbar/navbutton/NavButtonLayoutFactory.kt39
-rw-r--r--quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneGestureLayoutter.kt31
-rw-r--r--quickstep/src/com/android/launcher3/taskbar/navbutton/SetupNavLayoutter.kt25
5 files changed, 56 insertions, 72 deletions
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt
index f342fa52b3..cc6cc645f5 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt
@@ -348,13 +348,17 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas
controllers.bubbleControllers.isPresent &&
controllers.bubbleControllers.get().bubbleBarViewController.isBubbleBarVisible()
var insetsIsTouchableRegion = true
+ // Prevents the taskbar from taking touches and conflicting with setup wizard
if (
context.isPhoneButtonNavMode &&
+ context.isUserSetupComplete &&
(!controllers.navbarButtonsViewController.isImeVisible ||
!controllers.navbarButtonsViewController.isImeRenderingNavButtons)
) {
insetsInfo.setTouchableInsets(TOUCHABLE_INSETS_FRAME)
insetsIsTouchableRegion = false
+ debugTouchableRegion.lastSetTouchableReason =
+ "Phone button nav mode: Fullscreen touchable, IME not affecting nav buttons"
} else if (context.dragLayer.alpha < AlphaUpdateListener.ALPHA_CUTOFF_THRESHOLD) {
// Let touches pass through us.
insetsInfo.setTouchableInsets(TOUCHABLE_INSETS_REGION)
diff --git a/quickstep/src/com/android/launcher3/taskbar/navbutton/AbstractNavButtonLayoutter.kt b/quickstep/src/com/android/launcher3/taskbar/navbutton/AbstractNavButtonLayoutter.kt
index e487f9fd40..3712a76eab 100644
--- a/quickstep/src/com/android/launcher3/taskbar/navbutton/AbstractNavButtonLayoutter.kt
+++ b/quickstep/src/com/android/launcher3/taskbar/navbutton/AbstractNavButtonLayoutter.kt
@@ -27,7 +27,6 @@ import android.widget.Space
import com.android.launcher3.DeviceProfile
import com.android.launcher3.R
import com.android.launcher3.Utilities
-import com.android.launcher3.taskbar.TaskbarActivityContext
import com.android.launcher3.taskbar.navbutton.NavButtonLayoutFactory.NavButtonLayoutter
/**
@@ -48,7 +47,7 @@ abstract class AbstractNavButtonLayoutter(
protected val startContextualContainer: ViewGroup,
protected val imeSwitcher: ImageView?,
protected val a11yButton: ImageView?,
- protected val space: Space?
+ protected val space: Space?,
) : NavButtonLayoutter {
protected val homeButton: ImageView? = navButtonContainer.findViewById(R.id.home)
protected val recentsButton: ImageView? = navButtonContainer.findViewById(R.id.recent_apps)
@@ -69,26 +68,34 @@ abstract class AbstractNavButtonLayoutter(
val params =
FrameLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
- ViewGroup.LayoutParams.MATCH_PARENT
+ ViewGroup.LayoutParams.MATCH_PARENT,
)
params.gravity = Gravity.CENTER
return params
}
+ /**
+ * Adjusts the layout parameters of the nav bar container for setup in phone mode.
+ *
+ * @param nearestTouchFrameLayoutParams The layout parameters of the navButtonsView, which is
+ * the ViewGroup that contains start, end, nav button ViewGroups
+ * @param deviceProfile The device profile containing information about the device's
+ * configuration.
+ */
fun adjustForSetupInPhoneMode(
- navButtonsLayoutParams: FrameLayout.LayoutParams,
- navButtonsViewLayoutParams: FrameLayout.LayoutParams,
- deviceProfile: DeviceProfile
+ nearestTouchFrameLayoutParams: FrameLayout.LayoutParams,
+ deviceProfile: DeviceProfile,
) {
val phoneOrPortraitSetupMargin =
resources.getDimensionPixelSize(R.dimen.taskbar_contextual_button_suw_margin)
- navButtonsLayoutParams.marginStart = phoneOrPortraitSetupMargin
- navButtonsLayoutParams.bottomMargin =
+ nearestTouchFrameLayoutParams.marginStart = phoneOrPortraitSetupMargin
+ nearestTouchFrameLayoutParams.bottomMargin =
if (!deviceProfile.isLandscape) 0
else
phoneOrPortraitSetupMargin -
- resources.getDimensionPixelSize(R.dimen.taskbar_nav_buttons_size) / 2
- navButtonsViewLayoutParams.height =
+ resources.getDimensionPixelSize(R.dimen.taskbar_nav_buttons_size) / 2
+
+ nearestTouchFrameLayoutParams.height =
resources.getDimensionPixelSize(R.dimen.taskbar_contextual_button_suw_height)
}
@@ -97,7 +104,7 @@ abstract class AbstractNavButtonLayoutter(
buttonSize: Int,
barAxisMarginStart: Int,
barAxisMarginEnd: Int,
- gravity: Int
+ gravity: Int,
) {
val contextualContainerParams =
FrameLayout.LayoutParams(buttonSize, ViewGroup.LayoutParams.MATCH_PARENT)
diff --git a/quickstep/src/com/android/launcher3/taskbar/navbutton/NavButtonLayoutFactory.kt b/quickstep/src/com/android/launcher3/taskbar/navbutton/NavButtonLayoutFactory.kt
index 2497fbb98e..a199dba0bd 100644
--- a/quickstep/src/com/android/launcher3/taskbar/navbutton/NavButtonLayoutFactory.kt
+++ b/quickstep/src/com/android/launcher3/taskbar/navbutton/NavButtonLayoutFactory.kt
@@ -66,7 +66,7 @@ class NavButtonLayoutFactory {
isInSetup: Boolean,
isThreeButtonNav: Boolean,
phoneMode: Boolean,
- @Rotation surfaceRotation: Int
+ @Rotation surfaceRotation: Int,
): NavButtonLayoutter {
val navButtonContainer =
navButtonsView.requireViewById<LinearLayout>(ID_END_NAV_BUTTONS)
@@ -77,6 +77,18 @@ class NavButtonLayoutFactory {
val isPhoneNavMode = phoneMode && isThreeButtonNav
val isPhoneGestureMode = phoneMode && !isThreeButtonNav
return when {
+ isInSetup -> {
+ SetupNavLayoutter(
+ resources,
+ navButtonsView,
+ navButtonContainer,
+ endContextualContainer,
+ startContextualContainer,
+ imeSwitcher,
+ a11yButton,
+ space,
+ )
+ }
isPhoneNavMode -> {
if (!deviceProfile.isLandscape) {
navButtonsView.setIsVertical(false)
@@ -87,7 +99,7 @@ class NavButtonLayoutFactory {
startContextualContainer,
imeSwitcher,
a11yButton,
- space
+ space,
)
} else if (surfaceRotation == ROTATION_90) {
navButtonsView.setIsVertical(true)
@@ -98,7 +110,7 @@ class NavButtonLayoutFactory {
startContextualContainer,
imeSwitcher,
a11yButton,
- space
+ space,
)
} else {
navButtonsView.setIsVertical(true)
@@ -109,36 +121,23 @@ class NavButtonLayoutFactory {
startContextualContainer,
imeSwitcher,
a11yButton,
- space
+ space,
)
}
}
isPhoneGestureMode -> {
PhoneGestureLayoutter(
resources,
- navButtonsView,
navButtonContainer,
endContextualContainer,
startContextualContainer,
imeSwitcher,
a11yButton,
- space
+ space,
)
}
deviceProfile.isTaskbarPresent -> {
return when {
- isInSetup -> {
- SetupNavLayoutter(
- resources,
- navButtonsView,
- navButtonContainer,
- endContextualContainer,
- startContextualContainer,
- imeSwitcher,
- a11yButton,
- space
- )
- }
isKidsMode -> {
KidsNavLayoutter(
resources,
@@ -147,7 +146,7 @@ class NavButtonLayoutFactory {
startContextualContainer,
imeSwitcher,
a11yButton,
- space
+ space,
)
}
else ->
@@ -158,7 +157,7 @@ class NavButtonLayoutFactory {
startContextualContainer,
imeSwitcher,
a11yButton,
- space
+ space,
)
}
}
diff --git a/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneGestureLayoutter.kt b/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneGestureLayoutter.kt
index 390ec342e1..e0f2a22b2c 100644
--- a/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneGestureLayoutter.kt
+++ b/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneGestureLayoutter.kt
@@ -17,25 +17,21 @@
package com.android.launcher3.taskbar.navbutton
import android.content.res.Resources
-import android.view.Gravity
import android.view.ViewGroup
-import android.widget.FrameLayout
import android.widget.ImageView
import android.widget.LinearLayout
import android.widget.Space
-import com.android.launcher3.DeviceProfile
import com.android.launcher3.taskbar.TaskbarActivityContext
/** Layoutter for showing gesture navigation on phone screen. No buttons here, no-op container */
class PhoneGestureLayoutter(
resources: Resources,
- navButtonsView: NearestTouchFrame,
navBarContainer: LinearLayout,
endContextualContainer: ViewGroup,
startContextualContainer: ViewGroup,
imeSwitcher: ImageView?,
a11yButton: ImageView?,
- space: Space?
+ space: Space?,
) :
AbstractNavButtonLayoutter(
resources,
@@ -44,33 +40,10 @@ class PhoneGestureLayoutter(
startContextualContainer,
imeSwitcher,
a11yButton,
- space
+ space,
) {
- private val mNavButtonsView = navButtonsView
override fun layoutButtons(context: TaskbarActivityContext, isA11yButtonPersistent: Boolean) {
- // TODO: look into if we should use SetupNavLayoutter instead.
- if (!context.isUserSetupComplete) {
- // 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
- val navButtonsViewLayoutParams =
- mNavButtonsView.layoutParams as FrameLayout.LayoutParams
- val deviceProfile: DeviceProfile = context.deviceProfile
-
- navButtonsLayoutParams.marginEnd = 0
- navButtonsLayoutParams.gravity = Gravity.START
- context.setTaskbarWindowSize(context.setupWindowSize)
-
- adjustForSetupInPhoneMode(
- navButtonsLayoutParams,
- navButtonsViewLayoutParams,
- deviceProfile
- )
- mNavButtonsView.layoutParams = navButtonsViewLayoutParams
- navButtonContainer.layoutParams = navButtonsLayoutParams
- }
-
endContextualContainer.removeAllViews()
startContextualContainer.removeAllViews()
}
diff --git a/quickstep/src/com/android/launcher3/taskbar/navbutton/SetupNavLayoutter.kt b/quickstep/src/com/android/launcher3/taskbar/navbutton/SetupNavLayoutter.kt
index e032430c1d..eb3fdeb99e 100644
--- a/quickstep/src/com/android/launcher3/taskbar/navbutton/SetupNavLayoutter.kt
+++ b/quickstep/src/com/android/launcher3/taskbar/navbutton/SetupNavLayoutter.kt
@@ -29,12 +29,15 @@ import com.android.launcher3.DeviceProfile
import com.android.launcher3.R
import com.android.launcher3.taskbar.TaskbarActivityContext
+const val SUW_THEME_SYSTEM_PROPERTY = "setupwizard.theme"
+const val GLIF_EXPRESSIVE_THEME = "glif_expressive"
+const val GLIF_EXPRESSIVE_LIGHT_THEME = "glif_expressive_light"
const val SQUARE_ASPECT_RATIO_BOTTOM_BOUND = 0.95
const val SQUARE_ASPECT_RATIO_UPPER_BOUND = 1.05
class SetupNavLayoutter(
resources: Resources,
- navButtonsView: NearestTouchFrame,
+ nearestTouchFrame: NearestTouchFrame,
navButtonContainer: LinearLayout,
endContextualContainer: ViewGroup,
startContextualContainer: ViewGroup,
@@ -51,17 +54,19 @@ class SetupNavLayoutter(
a11yButton,
space,
) {
- private val mNavButtonsView = navButtonsView
+ // mNearestTouchFrame is a ViewGroup that contains start, end, nav button ViewGroups
+ private val mNearestTouchFrame = nearestTouchFrame
override fun layoutButtons(context: TaskbarActivityContext, isA11yButtonPersistent: Boolean) {
- val SUWTheme = SystemProperties.get("setupwizard.theme", "")
- if (SUWTheme == "glif_expressive" || SUWTheme == "glif_expressive_light") {
+ val SUWTheme = SystemProperties.get(SUW_THEME_SYSTEM_PROPERTY, "")
+ if (SUWTheme == GLIF_EXPRESSIVE_THEME || SUWTheme == GLIF_EXPRESSIVE_LIGHT_THEME) {
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
- val navButtonsViewLayoutParams = mNavButtonsView.layoutParams as FrameLayout.LayoutParams
+ val navButtonsOverallViewGroupLayoutParams =
+ mNearestTouchFrame.layoutParams as FrameLayout.LayoutParams
val deviceProfile: DeviceProfile = context.deviceProfile
navButtonsLayoutParams.marginEnd = 0
@@ -77,18 +82,14 @@ class SetupNavLayoutter(
) {
navButtonsLayoutParams.marginStart =
resources.getDimensionPixelSize(R.dimen.taskbar_back_button_suw_start_margin)
- navButtonsViewLayoutParams.bottomMargin =
+ navButtonsOverallViewGroupLayoutParams.bottomMargin =
resources.getDimensionPixelSize(R.dimen.taskbar_back_button_suw_bottom_margin)
navButtonsLayoutParams.height =
resources.getDimensionPixelSize(R.dimen.taskbar_back_button_suw_height)
} else {
- adjustForSetupInPhoneMode(
- navButtonsLayoutParams,
- navButtonsViewLayoutParams,
- deviceProfile,
- )
+ adjustForSetupInPhoneMode(navButtonsOverallViewGroupLayoutParams, deviceProfile)
}
- mNavButtonsView.layoutParams = navButtonsViewLayoutParams
+ mNearestTouchFrame.layoutParams = navButtonsOverallViewGroupLayoutParams
navButtonContainer.layoutParams = navButtonsLayoutParams
endContextualContainer.removeAllViews()