From 4290d3cab1cbc990840c1a75d5c7b539601e71cf Mon Sep 17 00:00:00 2001 From: Mady Mellor Date: Thu, 29 Aug 2024 11:33:11 -0700 Subject: [PATCH] Only handle taps on bubble bar when it was collapsed/stashed on down When bubbles are expanded and you tap on the currently opened bubble, the stack collapses. In the input consumer code, we also get that tap & we handle it because at the "up" event at that time, we're collapsed (or stashed in some cases). To fix this, only handle the "up" event for the bar being collapsed / stashed, if it was in that state when the gesture started (i.e. on down) Flag: com.android.wm.shell.enable_bubble_bar Bug: 362165243 Test: manual - expand bubble bar in home / overview - tap on the currently expanded bubble => observe the animation is smooth - expand bubble bar in app - tap on currently expanded bubble => observe the animation is smooth Change-Id: I1861af15c88bc0cbf2514faac7464de2f85aad1e --- .../inputconsumers/BubbleBarInputConsumer.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/quickstep/src/com/android/quickstep/inputconsumers/BubbleBarInputConsumer.java b/quickstep/src/com/android/quickstep/inputconsumers/BubbleBarInputConsumer.java index dbe20685d5..92031c5429 100644 --- a/quickstep/src/com/android/quickstep/inputconsumers/BubbleBarInputConsumer.java +++ b/quickstep/src/com/android/quickstep/inputconsumers/BubbleBarInputConsumer.java @@ -45,6 +45,7 @@ public class BubbleBarInputConsumer implements InputConsumer { private boolean mSwipeUpOnBubbleHandle; private boolean mPassedTouchSlop; + private boolean mStashedOrCollapsedOnDown; private final int mTouchSlop; private final PointF mDownPos = new PointF(); @@ -69,13 +70,13 @@ public class BubbleBarInputConsumer implements InputConsumer { @Override public void onMotionEvent(MotionEvent ev) { - final boolean isStashed = mBubbleStashController.isStashed(); final int action = ev.getAction(); switch (action) { case MotionEvent.ACTION_DOWN: mActivePointerId = ev.getPointerId(0); mDownPos.set(ev.getX(), ev.getY()); mLastPos.set(mDownPos); + mStashedOrCollapsedOnDown = mBubbleStashController.isStashed() || isCollapsed(); break; case MotionEvent.ACTION_MOVE: int pointerIndex = ev.findPointerIndex(mActivePointerId); @@ -89,7 +90,7 @@ public class BubbleBarInputConsumer implements InputConsumer { if (!mPassedTouchSlop) { mPassedTouchSlop = Math.abs(dY) > mTouchSlop || Math.abs(dX) > mTouchSlop; } - if ((isCollapsed() || isStashed) && !mSwipeUpOnBubbleHandle && mPassedTouchSlop) { + if (mStashedOrCollapsedOnDown && !mSwipeUpOnBubbleHandle && mPassedTouchSlop) { boolean verticalGesture = Math.abs(dY) > Math.abs(dX); if (verticalGesture && !mBubbleDragController.isDragging()) { mSwipeUpOnBubbleHandle = true; @@ -102,11 +103,10 @@ public class BubbleBarInputConsumer implements InputConsumer { break; case MotionEvent.ACTION_UP: boolean isWithinTapTime = ev.getEventTime() - ev.getDownTime() <= mTimeForTap; - if (isWithinTapTime && !mSwipeUpOnBubbleHandle && !mPassedTouchSlop) { + if (isWithinTapTime && !mSwipeUpOnBubbleHandle && !mPassedTouchSlop + && mStashedOrCollapsedOnDown) { // Taps on the handle / collapsed state should open the bar - if (isStashed || isCollapsed()) { - mBubbleStashController.showBubbleBar(/* expandBubbles= */ true); - } + mBubbleStashController.showBubbleBar(/* expandBubbles= */ true); } break; }