diff options
| author | 2023-01-25 01:13:39 +0000 | |
|---|---|---|
| committer | 2023-01-25 01:13:39 +0000 | |
| commit | fb9ff85c3bbe91d6ea71ab2609a37023c969654c (patch) | |
| tree | d25c69a1fe64a35f0d84b66978928a8df5db98bd | |
| parent | b1491547ee5de3e42ecc92ec2a4005cc37a7eb80 (diff) | |
| parent | f8832235db8602f0010702db605958839b8f8a5d (diff) | |
Merge "Add hover event handling to new touch architecture" into tm-qpr-dev am: f8832235db
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20900042
Change-Id: I8981facaf7c6600d469296149a63f5ccea4f9d3a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2 files changed, 79 insertions, 9 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/udfps/SinglePointerTouchProcessor.kt b/packages/SystemUI/src/com/android/systemui/biometrics/udfps/SinglePointerTouchProcessor.kt index 3a01cd502929..39ea9368dacb 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/udfps/SinglePointerTouchProcessor.kt +++ b/packages/SystemUI/src/com/android/systemui/biometrics/udfps/SinglePointerTouchProcessor.kt @@ -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 -> diff --git a/packages/SystemUI/tests/src/com/android/systemui/biometrics/udfps/SinglePointerTouchProcessorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/biometrics/udfps/SinglePointerTouchProcessorTest.kt index 34ddf795c7e7..8e20303fd189 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/biometrics/udfps/SinglePointerTouchProcessorTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/biometrics/udfps/SinglePointerTouchProcessorTest.kt @@ -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,13 +388,7 @@ 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() + .flatten() } } |