From 3980b03b32b71cd9528cbb180c53bc5cf446c47d Mon Sep 17 00:00:00 2001 From: Pat Manning Date: Tue, 1 Apr 2025 12:22:34 +0100 Subject: [PATCH] Do not intercept touch on other actions if not enabled in ACTION_DOWN. Fix: 406405786 Test: Manual. Flag: com.android.launcher3.enable_expressive_dismiss_task_motion Change-Id: Ibd03917a2109307921642a681747709f113e279d --- .../TaskViewDismissTouchController.kt | 13 +++++++++++-- .../TaskViewLaunchTouchController.kt | 8 +++++++- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewDismissTouchController.kt b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewDismissTouchController.kt index 97be7a61a4..03d51b8462 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewDismissTouchController.kt +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewDismissTouchController.kt @@ -66,6 +66,7 @@ CONTAINER : RecentsViewContainer { private var initialDisplacement: Float = 0f private var recentsScaleAnimation: SpringAnimation? = null private var isBlockedDuringDismissal = false + private var canInterceptTouch = false private fun canInterceptTouch(ev: MotionEvent): Boolean = when { @@ -104,11 +105,15 @@ CONTAINER : RecentsViewContainer { clearState() } if (ev.action == MotionEvent.ACTION_DOWN) { - if (!onActionDown(ev)) { + canInterceptTouch = onActionDown(ev) + if (!canInterceptTouch) { return false } } - + // Ignore other actions if touch intercepting has not been enabled in an ACTION_DOWN event. + if (!canInterceptTouch) { + return false + } onControllerTouchEvent(ev) val upDirectionIsPositive = upDirection == SingleAxisSwipeDetector.DIRECTION_POSITIVE val wasInitialTouchUp = @@ -149,6 +154,10 @@ CONTAINER : RecentsViewContainer { verticalFactor = recentsView.pagedOrientationHandler.getTaskDismissVerticalDirection() } + if (taskBeingDragged == null) { + debugLog(TAG, "Not intercepting touch, null dragged task.") + return false + } detector.setDetectableScrollConditions(upDirection, /* ignoreSlop= */ false) return true } diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewLaunchTouchController.kt b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewLaunchTouchController.kt index fe9cae55f9..d4c6c8b18c 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewLaunchTouchController.kt +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewLaunchTouchController.kt @@ -60,6 +60,7 @@ CONTAINER : RecentsViewContainer { private var launchEndDisplacement: Float = 0f private var playbackController: AnimatorPlaybackController? = null private var verticalFactor: Int = 0 + private var canInterceptTouch = false private fun canTaskLaunchTaskView(taskView: TaskView?) = taskView != null && @@ -108,11 +109,16 @@ CONTAINER : RecentsViewContainer { clearState() } if (ev.action == MotionEvent.ACTION_DOWN) { - if (!onActionDown(ev)) { + canInterceptTouch = onActionDown(ev) + if (!canInterceptTouch) { clearState() return false } } + // Ignore other actions if touch intercepting has not been enabled in an ACTION_DOWN event. + if (!canInterceptTouch) { + return false + } onControllerTouchEvent(ev) val downDirectionIsNegative = downDirection == SingleAxisSwipeDetector.DIRECTION_NEGATIVE val wasInitialTouchDown =