Loading services/accessibility/java/com/android/server/accessibility/MouseKeysInterceptor.java +3 −1 Original line number Diff line number Diff line Loading @@ -528,8 +528,10 @@ public class MouseKeysInterceptor extends BaseEventStreamTransformation FLAGS_INPUT_FILTER, "event=" + event + ";policyFlags=" + policyFlags); } final KeyEvent keyEvent = event.copy(); mHandler.post(() -> { onKeyEventInternal(event, policyFlags); onKeyEventInternal(keyEvent, policyFlags); keyEvent.recycle(); }); } Loading services/tests/servicestests/src/com/android/server/accessibility/MouseKeysInterceptorTest.kt +8 −1 Original line number Diff line number Diff line Loading @@ -177,7 +177,7 @@ class MouseKeysInterceptorTest { testLooper.dispatchAll() assertThat(nextInterceptor.events).hasSize(1) assertThat(nextInterceptor.events.poll()).isEqualTo(downEvent) verifyKeyEventsEqual(downEvent, nextInterceptor.events.poll()) } @Test Loading Loading @@ -529,6 +529,13 @@ class MouseKeysInterceptorTest { assertThat(actualYAxis).containsExactlyElementsIn(yAxisMovements.toList()).inOrder() } private fun verifyKeyEventsEqual(expected: KeyEvent, received: KeyEvent) { assertThat(received.keyCode).isEqualTo(expected.keyCode) assertThat(received.action).isEqualTo(expected.action) assertThat(received.downTime).isEqualTo(expected.downTime) assertThat(received.eventTime).isEqualTo(expected.eventTime) } private fun createInputDevice( deviceId: Int, generation: Int = -1 Loading Loading
services/accessibility/java/com/android/server/accessibility/MouseKeysInterceptor.java +3 −1 Original line number Diff line number Diff line Loading @@ -528,8 +528,10 @@ public class MouseKeysInterceptor extends BaseEventStreamTransformation FLAGS_INPUT_FILTER, "event=" + event + ";policyFlags=" + policyFlags); } final KeyEvent keyEvent = event.copy(); mHandler.post(() -> { onKeyEventInternal(event, policyFlags); onKeyEventInternal(keyEvent, policyFlags); keyEvent.recycle(); }); } Loading
services/tests/servicestests/src/com/android/server/accessibility/MouseKeysInterceptorTest.kt +8 −1 Original line number Diff line number Diff line Loading @@ -177,7 +177,7 @@ class MouseKeysInterceptorTest { testLooper.dispatchAll() assertThat(nextInterceptor.events).hasSize(1) assertThat(nextInterceptor.events.poll()).isEqualTo(downEvent) verifyKeyEventsEqual(downEvent, nextInterceptor.events.poll()) } @Test Loading Loading @@ -529,6 +529,13 @@ class MouseKeysInterceptorTest { assertThat(actualYAxis).containsExactlyElementsIn(yAxisMovements.toList()).inOrder() } private fun verifyKeyEventsEqual(expected: KeyEvent, received: KeyEvent) { assertThat(received.keyCode).isEqualTo(expected.keyCode) assertThat(received.action).isEqualTo(expected.action) assertThat(received.downTime).isEqualTo(expected.downTime) assertThat(received.eventTime).isEqualTo(expected.eventTime) } private fun createInputDevice( deviceId: Int, generation: Int = -1 Loading