From 21bb36fa6635bae7c8782490eb138c404f448755 Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Thu, 23 May 2024 06:54:03 +0000 Subject: [PATCH] Report gesture height for mandatory system gestures - We are currently reporting the content insets for the mandatory system gestures in taskbar, but for button nav we should actually be reporting zero, and for gesture nav we should either report the content height if the taskbar is pinned, or the gesture height otherwise as the bottom mandatory gesture inset Fixes: 340134342 Test: atest android.systemui.cts.WindowInsetsBehaviorTests Change-Id: Ie4d56b62c903c273db95c19c9d34fcfe6c9ce486 Merged-In: Ie4d56b62c903c273db95c19c9d34fcfe6c9ce486 (cherry picked from commit 05682a059f32273679ebee7207b8752780873bf6) --- .../taskbar/TaskbarInsetsController.kt | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt index 8dc81cf461..4f511c1bfd 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt @@ -51,6 +51,7 @@ import com.android.launcher3.anim.AlphaUpdateListener import com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_NAVBAR_UNIFICATION import com.android.launcher3.config.FeatureFlags.enableTaskbarNoRecreate import com.android.launcher3.taskbar.TaskbarControllers.LoggableTaskbarController +import com.android.launcher3.testing.shared.ResourceUtils import com.android.launcher3.util.DisplayController import java.io.PrintWriter import kotlin.jvm.optionals.getOrNull @@ -218,8 +219,24 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas val contentHeight = controllers.taskbarStashController.contentHeightToReportToApps val tappableHeight = controllers.taskbarStashController.tappableHeightToReportToApps val res = context.resources - if (provider.type == navigationBars() || provider.type == mandatorySystemGestures()) { + if (provider.type == navigationBars()) { provider.insetsSize = getInsetsForGravityWithCutout(contentHeight, gravity, endRotation) + } else if (provider.type == mandatorySystemGestures()) { + if (context.isThreeButtonNav) { + provider.insetsSize = Insets.of(0, 0, 0, 0) + } else { + val gestureHeight = + ResourceUtils.getNavbarSize( + ResourceUtils.NAVBAR_BOTTOM_GESTURE_SIZE, + context.resources) + val isPinnedTaskbar = context.deviceProfile.isTaskbarPresent + && !context.deviceProfile.isTransientTaskbar + val mandatoryGestureHeight = + if (isPinnedTaskbar) contentHeight + else gestureHeight + provider.insetsSize = getInsetsForGravityWithCutout(mandatoryGestureHeight, gravity, + endRotation) + } } else if (provider.type == tappableElement()) { provider.insetsSize = getInsetsForGravity(tappableHeight, gravity) } else if (provider.type == systemGestures() && provider.index == INDEX_LEFT) {