summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jordan Demeulenaere <jdemeulenaere@google.com> 2025-01-31 15:59:35 +0100
committer Jordan Demeulenaere <jdemeulenaere@google.com> 2025-01-31 15:59:40 +0100
commit1d38904507da9e70b33288f6b72419486f81a095 (patch)
treee960b84c95dbfa78917c7dc65c3fb4399e997a61
parentdaca911006e814efdb55463ad3bd416c58b2791e (diff)
Remove drag position & size check
This CL removes a safety check that was added when starting a drag, that was double checking that the drag position and number of pointers down was the same that was tracked by another pointer input handler. As shown in b/393423580 and discussed offline with the Compose team, this assumption is not always correct depending on some very specific timings. Bug: 393423580 Test: None, unfortunately I was not able to reproduce given that this is a bug that can occur in some very specific & rare circumstances Flag: EXEMPT crash fix Change-Id: I3d62239ec042e5a20944f4b205383a9e44553f85
-rw-r--r--packages/SystemUI/compose/core/src/com/android/compose/gesture/NestedDraggable.kt14
1 files changed, 6 insertions, 8 deletions
diff --git a/packages/SystemUI/compose/core/src/com/android/compose/gesture/NestedDraggable.kt b/packages/SystemUI/compose/core/src/com/android/compose/gesture/NestedDraggable.kt
index 195b060932eb..20f1cdf4242c 100644
--- a/packages/SystemUI/compose/core/src/com/android/compose/gesture/NestedDraggable.kt
+++ b/packages/SystemUI/compose/core/src/com/android/compose/gesture/NestedDraggable.kt
@@ -296,13 +296,6 @@ private class NestedDraggableNode(
awaitEachGesture {
val down = awaitFirstDown(requireUnconsumed = false)
- check(down.position == lastFirstDown) {
- "Position from detectDrags() is not the same as position in trackDownPosition()"
- }
- check(pointersDown.size == 1 && pointersDown.keys.first() == down.id) {
- "pointersDown should only contain $down but it contains $pointersDown"
- }
-
var overSlop = 0f
val onTouchSlopReached = { change: PointerInputChange, over: Float ->
if (draggable.shouldStartDrag(change)) {
@@ -342,7 +335,12 @@ private class NestedDraggableNode(
check(pointersDown.size > 0) { "pointersDown is empty" }
val controller =
- draggable.onDragStarted(down.position, sign, pointersDown.size, drag.type)
+ draggable.onDragStarted(
+ down.position,
+ sign,
+ pointersDown.size.coerceAtLeast(1),
+ drag.type,
+ )
if (overSlop != 0f) {
onDrag(controller, drag, overSlop, velocityTracker)
}