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

Commit 51961e88 authored by Austin Delgado's avatar Austin Delgado Committed by Automerger Merge Worker
Browse files

Merge "Add hover event handling to new touch architecture" into tm-qpr-dev am:...

Merge "Add hover event handling to new touch architecture" into tm-qpr-dev am: f8832235 am: fb9ff85c

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20900042



Change-Id: Ie9d7eed650ee8d8de835f132a0dad69d2c1160a5
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 96ca7aff fb9ff85c
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -54,9 +54,12 @@ class SinglePointerTouchProcessor @Inject constructor(val overlapDetector: Overl
        return when (event.actionMasked) {
            MotionEvent.ACTION_DOWN,
            MotionEvent.ACTION_POINTER_DOWN,
            MotionEvent.ACTION_MOVE -> processActionMove(preprocess())
            MotionEvent.ACTION_MOVE,
            MotionEvent.ACTION_HOVER_ENTER,
            MotionEvent.ACTION_HOVER_MOVE -> processActionMove(preprocess())
            MotionEvent.ACTION_UP,
            MotionEvent.ACTION_POINTER_UP ->
            MotionEvent.ACTION_POINTER_UP,
            MotionEvent.ACTION_HOVER_EXIT ->
                processActionUp(preprocess(), event.getPointerId(event.actionIndex))
            MotionEvent.ACTION_CANCEL -> processActionCancel(NormalizedTouchData())
            else ->
+74 −7
Original line number Diff line number Diff line
@@ -110,6 +110,28 @@ class SinglePointerTouchProcessorTest(val testCase: TestCase) : SysuiTestCase()
                        expectedInteractionEvent = InteractionEvent.UP,
                        expectedPointerOnSensorId = INVALID_POINTER_ID,
                    ),
                    // MotionEvent.ACTION_HOVER_ENTER
                    genPositiveTestCases(
                        motionEventAction = MotionEvent.ACTION_HOVER_ENTER,
                        previousPointerOnSensorId = INVALID_POINTER_ID,
                        currentPointers = listOf(TestPointer(id = POINTER_ID_1, onSensor = true)),
                        expectedInteractionEvent = InteractionEvent.DOWN,
                        expectedPointerOnSensorId = POINTER_ID_1,
                    ),
                    genPositiveTestCases(
                        motionEventAction = MotionEvent.ACTION_HOVER_ENTER,
                        previousPointerOnSensorId = INVALID_POINTER_ID,
                        currentPointers = listOf(TestPointer(id = POINTER_ID_1, onSensor = false)),
                        expectedInteractionEvent = InteractionEvent.UNCHANGED,
                        expectedPointerOnSensorId = INVALID_POINTER_ID,
                    ),
                    genPositiveTestCases(
                        motionEventAction = MotionEvent.ACTION_HOVER_ENTER,
                        previousPointerOnSensorId = POINTER_ID_1,
                        currentPointers = listOf(TestPointer(id = POINTER_ID_1, onSensor = false)),
                        expectedInteractionEvent = InteractionEvent.UP,
                        expectedPointerOnSensorId = INVALID_POINTER_ID,
                    ),
                    // MotionEvent.ACTION_MOVE
                    genPositiveTestCases(
                        motionEventAction = MotionEvent.ACTION_MOVE,
@@ -161,6 +183,35 @@ class SinglePointerTouchProcessorTest(val testCase: TestCase) : SysuiTestCase()
                        expectedInteractionEvent = InteractionEvent.UNCHANGED,
                        expectedPointerOnSensorId = POINTER_ID_2,
                    ),
                    // MotionEvent.ACTION_HOVER_MOVE
                    genPositiveTestCases(
                        motionEventAction = MotionEvent.ACTION_HOVER_MOVE,
                        previousPointerOnSensorId = INVALID_POINTER_ID,
                        currentPointers = listOf(TestPointer(id = POINTER_ID_1, onSensor = true)),
                        expectedInteractionEvent = InteractionEvent.DOWN,
                        expectedPointerOnSensorId = POINTER_ID_1,
                    ),
                    genPositiveTestCases(
                        motionEventAction = MotionEvent.ACTION_HOVER_MOVE,
                        previousPointerOnSensorId = POINTER_ID_1,
                        currentPointers = listOf(TestPointer(id = POINTER_ID_1, onSensor = true)),
                        expectedInteractionEvent = InteractionEvent.UNCHANGED,
                        expectedPointerOnSensorId = POINTER_ID_1,
                    ),
                    genPositiveTestCases(
                        motionEventAction = MotionEvent.ACTION_HOVER_MOVE,
                        previousPointerOnSensorId = INVALID_POINTER_ID,
                        currentPointers = listOf(TestPointer(id = POINTER_ID_1, onSensor = false)),
                        expectedInteractionEvent = InteractionEvent.UNCHANGED,
                        expectedPointerOnSensorId = INVALID_POINTER_ID,
                    ),
                    genPositiveTestCases(
                        motionEventAction = MotionEvent.ACTION_HOVER_MOVE,
                        previousPointerOnSensorId = POINTER_ID_1,
                        currentPointers = listOf(TestPointer(id = POINTER_ID_1, onSensor = false)),
                        expectedInteractionEvent = InteractionEvent.UP,
                        expectedPointerOnSensorId = INVALID_POINTER_ID,
                    ),
                    // MotionEvent.ACTION_UP
                    genPositiveTestCases(
                        motionEventAction = MotionEvent.ACTION_UP,
@@ -183,6 +234,28 @@ class SinglePointerTouchProcessorTest(val testCase: TestCase) : SysuiTestCase()
                        expectedInteractionEvent = InteractionEvent.UNCHANGED,
                        expectedPointerOnSensorId = INVALID_POINTER_ID,
                    ),
                    // MotionEvent.ACTION_HOVER_EXIT
                    genPositiveTestCases(
                        motionEventAction = MotionEvent.ACTION_HOVER_EXIT,
                        previousPointerOnSensorId = INVALID_POINTER_ID,
                        currentPointers = listOf(TestPointer(id = POINTER_ID_1, onSensor = true)),
                        expectedInteractionEvent = InteractionEvent.UP,
                        expectedPointerOnSensorId = INVALID_POINTER_ID,
                    ),
                    genPositiveTestCases(
                        motionEventAction = MotionEvent.ACTION_HOVER_EXIT,
                        previousPointerOnSensorId = POINTER_ID_1,
                        currentPointers = listOf(TestPointer(id = POINTER_ID_1, onSensor = true)),
                        expectedInteractionEvent = InteractionEvent.UP,
                        expectedPointerOnSensorId = INVALID_POINTER_ID,
                    ),
                    genPositiveTestCases(
                        motionEventAction = MotionEvent.ACTION_HOVER_EXIT,
                        previousPointerOnSensorId = INVALID_POINTER_ID,
                        currentPointers = listOf(TestPointer(id = POINTER_ID_1, onSensor = false)),
                        expectedInteractionEvent = InteractionEvent.UNCHANGED,
                        expectedPointerOnSensorId = INVALID_POINTER_ID,
                    ),
                    // MotionEvent.ACTION_CANCEL
                    genPositiveTestCases(
                        motionEventAction = MotionEvent.ACTION_CANCEL,
@@ -315,12 +388,6 @@ class SinglePointerTouchProcessorTest(val testCase: TestCase) : SysuiTestCase()
                        expectedPointerOnSensorId = POINTER_ID_2
                    )
                )
                .flatten() +
                listOf(
                        genTestCasesForUnsupportedAction(MotionEvent.ACTION_HOVER_ENTER),
                        genTestCasesForUnsupportedAction(MotionEvent.ACTION_HOVER_MOVE),
                        genTestCasesForUnsupportedAction(MotionEvent.ACTION_HOVER_EXIT)
                    )
                .flatten()
    }
}