From 2792271688e3745de79578121f0e2b92a574eec5 Mon Sep 17 00:00:00 2001 From: Jerry Chang Date: Thu, 20 Apr 2023 07:43:04 +0000 Subject: [PATCH] Defer intercepting touch events to actually start shifting tasks Fix: 278740578 Test: http://recall/-/fLARJNt42LVxc3tt86SneW/d9A443iE2UQVktVc2YqwT2 Change-Id: I81efc87f19775dba96bab581a1c443d6070f6ebc --- .../com/android/quickstep/AbsSwipeUpHandler.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java index 7d47945fc4..b49eb24971 100644 --- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java @@ -334,6 +334,7 @@ public abstract class AbsSwipeUpHandler, private boolean mCanSlowSwipeGoHome = true; // Indicates whether the divider is shown, only used when split screen is activated. private boolean mIsDividerShown = true; + private boolean mStartMovingTasks; @Nullable private RemoteAnimationTargets.ReleaseCheck mSwipePipToHomeReleaseCheck = null; @@ -1722,12 +1723,19 @@ public abstract class AbsSwipeUpHandler, return keepClearArea; } + /** + * Notifies to start intercepting touches in the app window and hide the divider bar if needed. + * @see RecentsAnimationController#enableInputConsumer() + */ private void startInterceptingTouchesForGesture() { - if (mRecentsAnimationController == null) { + if (mRecentsAnimationController == null || !mStartMovingTasks) { return; } mRecentsAnimationController.enableInputConsumer(); + + // Hide the divider as it starts intercepting touches in the app window. + setDividerShown(false); } private void computeRecentsScrollIfInvisible() { @@ -2339,9 +2347,9 @@ public abstract class AbsSwipeUpHandler, boolean setRecentsScroll = mRecentsViewScrollLinked && mRecentsView != null; float progress = Math.max(mCurrentShift.value, getScaleProgressDueToScroll()); int scrollOffset = setRecentsScroll ? mRecentsView.getScrollOffset() : 0; - if (progress > 0 || scrollOffset != 0) { - // Hide the divider as the tasks start moving. - setDividerShown(false); + if (!mStartMovingTasks && (progress > 0 || scrollOffset != 0)) { + mStartMovingTasks = true; + startInterceptingTouchesForGesture(); } for (RemoteTargetHandle remoteHandle : mRemoteTargetHandles) { AnimatorControllerWithResistance playbackController =