From b42785efdf3ad0a73db9bd780581dd0ea70a9f54 Mon Sep 17 00:00:00 2001 From: Siarhei Vishniakou Date: Thu, 17 Jun 2021 23:27:48 +0000 Subject: Add FLAG_IS_ACCESSIBILITY_EVENT to KeyEvent and MotionEvent This flag indicates that the event was modified or generated by an accessibility service. It allows apps to tell apart real hardware events, events that are injected (device id == -1), and events coming from accessibility (has flag is_accessibility_event). Events that have gone into accessibility, and got reinjected without being modified will not be distinguishable from real hardware events. In the next release, we will make FLAG_IS_ACCESSIBILITY_EVENT public api. Until then, applications will have to hard-code its value (0x800) to use it. The value is the same for both KeyEvents and MotionEvents for convenience. Bug: 175069843 Bug: 152399927 Test: atest VerifiedMotionEventTest VerifiedKeyEventTest Test: atest AccessibilityGestureDispatchTest Test: atest inputflinger_tests libinput_tests GamepadWithAccessibilityTest Change-Id: I38ac2ab8e19e32cad927742c623f14f43ea0c588 --- core/java/android/view/InputDevice.java | 7 ------- 1 file changed, 7 deletions(-) (limited to 'core/java/android/view/InputDevice.java') diff --git a/core/java/android/view/InputDevice.java b/core/java/android/view/InputDevice.java index 782a992d28e5..4f1354d7eee6 100644 --- a/core/java/android/view/InputDevice.java +++ b/core/java/android/view/InputDevice.java @@ -444,13 +444,6 @@ public final class InputDevice implements Parcelable { private static final int VIBRATOR_ID_ALL = -1; - /** - * The device id of input events generated inside accessibility service. - * @hide - */ - @TestApi - public static final int ACCESSIBILITY_DEVICE_ID = -2; - public static final @android.annotation.NonNull Parcelable.Creator CREATOR = new Parcelable.Creator() { public InputDevice createFromParcel(Parcel in) { -- cgit v1.2.3