From 048d2e56050654b7e047092c7d15d48b490ff9e9 Mon Sep 17 00:00:00 2001 From: Ats Jenk Date: Thu, 2 Jan 2025 18:04:06 -0800 Subject: [PATCH] Increase bubble bar tap timeout We were using only 100ms for bubble bar tap timeout. That made it difficult to tap to expand the bubble bar. The constant we were using, per javadoc, is for distinguishing scroll vs tap. Updating the timeout constant to long-press timeout value. If the tap is shorter than the long-press timeout (400ms by default), it is considered a tap. This should make it easier to tap the bar. Also fixing the long-press to drag timeout on the bubble bar. We were using only half of the long-press timeout constant. Bug: 385928447 Test: tap on bubble bar to expand it, long-press on bubble bar to move Flag: com.android.wm.shell.enable_bubble_bar Change-Id: I2df51a3caaa19ceb5b013d9377ebedd611ef84f3 --- .../launcher3/taskbar/bubbles/BubbleDragController.java | 2 +- .../quickstep/inputconsumers/BubbleBarInputConsumer.java | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleDragController.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleDragController.java index fd4cf0e98f..0abd88cfbc 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleDragController.java +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleDragController.java @@ -299,7 +299,7 @@ public class BubbleDragController { private final PointF mTouchDownLocation = new PointF(); private final PointF mViewInitialPosition = new PointF(); private final VelocityTracker mVelocityTracker = VelocityTracker.obtain(); - private final long mPressToDragTimeout = ViewConfiguration.getLongPressTimeout() / 2; + private final long mPressToDragTimeout = ViewConfiguration.getLongPressTimeout(); private State mState = State.IDLE; private int mTouchSlop = -1; private BubbleDragAnimator mAnimator; diff --git a/quickstep/src/com/android/quickstep/inputconsumers/BubbleBarInputConsumer.java b/quickstep/src/com/android/quickstep/inputconsumers/BubbleBarInputConsumer.java index 6b61298eed..f3f73c0402 100644 --- a/quickstep/src/com/android/quickstep/inputconsumers/BubbleBarInputConsumer.java +++ b/quickstep/src/com/android/quickstep/inputconsumers/BubbleBarInputConsumer.java @@ -53,7 +53,7 @@ public class BubbleBarInputConsumer implements InputConsumer { private final int mTouchSlop; private final PointF mDownPos = new PointF(); private final PointF mLastPos = new PointF(); - private final long mTimeForTap; + private final long mTimeForLongPress; private int mActivePointerId = INVALID_POINTER_ID; public BubbleBarInputConsumer(Context context, BubbleControllers bubbleControllers, @@ -64,7 +64,7 @@ public class BubbleBarInputConsumer implements InputConsumer { mInputMonitorCompat = inputMonitorCompat; mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop(); - mTimeForTap = ViewConfiguration.getTapTimeout(); + mTimeForLongPress = ViewConfiguration.getLongPressTimeout(); } @Override @@ -110,7 +110,8 @@ public class BubbleBarInputConsumer implements InputConsumer { case MotionEvent.ACTION_UP: boolean swipeUpOnBubbleHandle = mBubbleBarSwipeController != null && mBubbleBarSwipeController.isSwipeGesture(); - boolean isWithinTapTime = ev.getEventTime() - ev.getDownTime() <= mTimeForTap; + // Anything less than a long-press is a tap + boolean isWithinTapTime = ev.getEventTime() - ev.getDownTime() <= mTimeForLongPress; if (isWithinTapTime && !swipeUpOnBubbleHandle && !mPassedTouchSlop && mStashedOrCollapsedOnDown) { // Taps on the handle / collapsed state should open the bar