Fixing recents command not working properly in gesture mode
Bug: 185445289
Test: Manual
Change-Id: I233ee493ea0d42bbfca14b17e921d907cc65da53
diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
index c547d00..dd6483c 100644
--- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
+++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
@@ -621,7 +621,7 @@
final boolean passed = mCurrentShift.value >= MIN_PROGRESS_FOR_OVERVIEW;
if (passed != mPassedOverviewThreshold) {
mPassedOverviewThreshold = passed;
- if (mDeviceState.isTwoButtonNavMode()) {
+ if (mDeviceState.isTwoButtonNavMode() && !mGestureState.isHandlingAtomicEvent()) {
performHapticFeedback();
}
}
@@ -854,7 +854,7 @@
private GestureEndTarget calculateEndTarget(PointF velocity, float endVelocity, boolean isFling,
boolean isCancel) {
- if (mDeviceState.isButtonNavMode()) {
+ if (mGestureState.isHandlingAtomicEvent()) {
// Button mode, this is only used to go to recents
return RECENTS;
}
@@ -976,7 +976,7 @@
mRecentsView.snapToPage(mRecentsView.getNextPage(), (int) MAX_SWIPE_DURATION);
isScrolling = true;
}
- if (!mDeviceState.isButtonNavMode() || isScrolling) {
+ if (!mGestureState.isHandlingAtomicEvent() || isScrolling) {
duration = Math.max(duration, mRecentsView.getScroller().getDuration());
}
}
diff --git a/quickstep/src/com/android/quickstep/GestureState.java b/quickstep/src/com/android/quickstep/GestureState.java
index ebdc1e6..6ad7f55 100644
--- a/quickstep/src/com/android/quickstep/GestureState.java
+++ b/quickstep/src/com/android/quickstep/GestureState.java
@@ -146,6 +146,8 @@
/** The time when the swipe up gesture is triggered. */
private long mSwipeUpStartTimeMs;
+ private boolean mHandlingAtomicEvent;
+
public GestureState(OverviewComponentObserver componentObserver, int gestureId) {
mHomeIntent = componentObserver.getHomeIntent();
mOverviewIntent = componentObserver.getOverviewIntent();
@@ -315,6 +317,22 @@
}
/**
+ * Indicates if the gesture is handling an atomic event like a click and not a
+ * user controlled gesture.
+ */
+ public void setHandlingAtomicEvent(boolean handlingAtomicEvent) {
+ mHandlingAtomicEvent = true;
+ }
+
+ /**
+ * Returns true if the gesture is handling an atomic event like a click and not a
+ * user controlled gesture.
+ */
+ public boolean isHandlingAtomicEvent() {
+ return mHandlingAtomicEvent;
+ }
+
+ /**
* @return whether the current gesture is still running a recents animation to a state in the
* Launcher or Recents activity.
*/
diff --git a/quickstep/src/com/android/quickstep/OverviewCommandHelper.java b/quickstep/src/com/android/quickstep/OverviewCommandHelper.java
index 923d4f1..dbdd75f 100644
--- a/quickstep/src/com/android/quickstep/OverviewCommandHelper.java
+++ b/quickstep/src/com/android/quickstep/OverviewCommandHelper.java
@@ -179,6 +179,7 @@
}
GestureState gestureState = mService.createGestureState(GestureState.DEFAULT_STATE);
+ gestureState.setHandlingAtomicEvent(true);
AbsSwipeUpHandler interactionHandler = mService.getSwipeUpHandlerFactory()
.newHandler(gestureState, cmd.createTime);
interactionHandler.setGestureEndCallback(