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
This commit is contained in:
Pat Manning
2025-04-01 12:22:34 +01:00
parent 207d5fa3b5
commit 3980b03b32
2 changed files with 18 additions and 3 deletions
@@ -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
}
@@ -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 =