Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1d389045 authored by Jordan Demeulenaere's avatar Jordan Demeulenaere
Browse files

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
parent daca9110
Loading
Loading
Loading
Loading
+6 −8
Original line number Diff line number Diff line
@@ -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)
                }