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 =