From 80f20a21837a65a74284a23d47c72de0cf896a92 Mon Sep 17 00:00:00 2001 From: Liran Binyamin Date: Tue, 22 Aug 2023 09:13:15 -0400 Subject: [PATCH] Handle touches on the bubble bar in Overview If the bubble bar is visible and we're in Overview, set the touchable region of the Taskbar to include the bubble bar bounds. Fixes: 290197298 Test: Manual - Add multiple bubbles to the bubble bar - Go to Overview - Tap on the bubble bar -- Observe that the bubble bar expands - Tap on different bubbles -- Observe that the bubble bar updates correctly - Tap outside the bubble bar -- Observe that the bubble bar collapses - Tap outside of the bubble bar again -- Observe that the launcher state changed and we are in Home Change-Id: I722778ee41b50ebca57431bb303da89104d25090 --- .../taskbar/TaskbarInsetsController.kt | 20 +++++++++++++++++-- .../bubbles/BubbleStashController.java | 5 +++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt index a935bac2a0..538a92424a 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt @@ -43,6 +43,7 @@ import com.android.launcher3.anim.AlphaUpdateListener import com.android.launcher3.taskbar.TaskbarControllers.LoggableTaskbarController import com.android.launcher3.util.DisplayController import java.io.PrintWriter +import kotlin.jvm.optionals.getOrNull /** Handles the insets that Taskbar provides to underlying apps and the IME. */ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTaskbarController { @@ -283,9 +284,24 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas controllers.uiController.isInOverview && DisplayController.isTransientTaskbar(context) ) { - insetsInfo.touchableRegion.set( + val region = controllers.taskbarActivityContext.dragLayer.lastDrawnTransientRect.toRegion() - ) + val bubbleBarBounds = + controllers.bubbleControllers.getOrNull()?.let { bubbleControllers -> + if (!bubbleControllers.bubbleStashController.isBubblesShowingOnOverview) { + return@let null + } + if (!bubbleControllers.bubbleBarViewController.isBubbleBarVisible) { + return@let null + } + bubbleControllers.bubbleBarViewController.bubbleBarBounds + } + + // Include the bounds of the bubble bar in the touchable region if they exist. + if (bubbleBarBounds != null) { + region.op(bubbleBarBounds, Region.Op.UNION) + } + insetsInfo.touchableRegion.set(region) } else { insetsInfo.touchableRegion.set(touchableRegion) } diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleStashController.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleStashController.java index 00c2ca1b2b..a5ea5a9955 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleStashController.java +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleStashController.java @@ -197,6 +197,11 @@ public class BubbleStashController { } } + /** Whether bubbles are showing on Overview. */ + public boolean isBubblesShowingOnOverview() { + return mBubblesShowingOnOverview; + } + /** Called when sysui locked state changes, when locked, bubble bar is stashed. */ public void onSysuiLockedStateChange(boolean isSysuiLocked) { if (isSysuiLocked != mIsSysuiLocked) {