From 3bc763f5a34b8638083ece79f19658e3f8d66793 Mon Sep 17 00:00:00 2001 From: Thales Lima Date: Wed, 3 May 2023 18:34:36 +0100 Subject: [PATCH] Make taskbar touchable region smaller in Overview While in overview, makes the touchable region smaller so touches can go to the window below and trigger tapping on overview to go home. Bug: 269985301 Test: Manual (TAPL in a following CL) Flag: none Change-Id: Ie8c7719090c387f951d78cf0fc47e6d9ed192f27 --- .../launcher3/taskbar/TaskbarInsetsController.kt | 13 ++++++++++++- .../taskbar/TaskbarLauncherStateController.java | 4 ++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt index 4422fd4b75..d6e559a9b4 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt @@ -33,11 +33,13 @@ import android.view.WindowInsets.Type.tappableElement import android.view.WindowManager import android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD import android.view.WindowManager.LayoutParams.TYPE_VOICE_INTERACTION +import androidx.core.graphics.toRegion import com.android.internal.policy.GestureNavigationSettingsObserver import com.android.launcher3.DeviceProfile import com.android.launcher3.R import com.android.launcher3.anim.AlphaUpdateListener import com.android.launcher3.taskbar.TaskbarControllers.LoggableTaskbarController +import com.android.launcher3.util.DisplayController import java.io.PrintWriter /** Handles the insets that Taskbar provides to underlying apps and the IME. */ @@ -220,7 +222,16 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas controllers.taskbarViewController.areIconsVisible() || context.isNavBarKidsModeActive ) { // Taskbar has some touchable elements, take over the full taskbar area - insetsInfo.touchableRegion.set(touchableRegion) + if ( + controllers.uiController.isInOverview && + DisplayController.isTransientTaskbar(context) + ) { + insetsInfo.touchableRegion.set( + controllers.taskbarActivityContext.dragLayer.lastDrawnTransientRect.toRegion() + ) + } else { + insetsInfo.touchableRegion.set(touchableRegion) + } insetsInfo.setTouchableInsets(TOUCHABLE_INSETS_REGION) insetsIsTouchableRegion = false } else { diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java index 75cfd05d41..84fb077ab1 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java @@ -424,6 +424,10 @@ public class TaskbarLauncherStateController { // We're changing state to home, should close open popups e.g. Taskbar AllApps handleOpenFloatingViews = true; } + if (mLauncherState == LauncherState.OVERVIEW) { + // Calling to update the insets in TaskbarInsetController#updateInsetsTouchability + mControllers.taskbarActivityContext.notifyUpdateLayoutParams(); + } } if (hasAnyFlag(changedFlags, FLAGS_LAUNCHER_ACTIVE)) {