Add missing input flags to aidl and add missing definitions
To ensure that the future updates are consistent across java, cpp, and
rust, we move all of motion event flags to aidl. That will be the
source of truth for those constants. That still doesn't ensure that in
the future updates, we forget to add these to all the languages, but at
least now it will be much easier to do so.
Bug: 309829647
Test: m sync
Change-Id: Ibb92c0c2b2da3b07eac3886c6fd652a295037099
diff --git a/include/input/Input.h b/include/input/Input.h
index 00757a7..3f81fb0 100644
--- a/include/input/Input.h
+++ b/include/input/Input.h
@@ -43,7 +43,7 @@
#ifdef __linux__
/* This event was generated or modified by accessibility service. */
AKEY_EVENT_FLAG_IS_ACCESSIBILITY_EVENT =
- android::os::IInputConstants::INPUT_EVENT_FLAG_IS_ACCESSIBILITY_EVENT, // 0x800,
+ android::os::IInputConstants::INPUT_EVENT_FLAG_IS_ACCESSIBILITY_EVENT,
#else
AKEY_EVENT_FLAG_IS_ACCESSIBILITY_EVENT = 0x800,
#endif
@@ -54,11 +54,11 @@
AKEY_EVENT_FLAG_START_TRACKING = 0x40000000,
/* Key event is inconsistent with previously sent key events. */
- AKEY_EVENT_FLAG_TAINTED = 0x80000000,
+ AKEY_EVENT_FLAG_TAINTED = android::os::IInputConstants::INPUT_EVENT_FLAG_TAINTED,
};
enum {
-
+ // AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED is defined in include/android/input.h
/**
* This flag indicates that the window that received this motion event is partly
* or wholly obscured by another visible window above it. This flag is set to true
@@ -69,13 +69,16 @@
* to drop the suspect touches or to take additional precautions to confirm the user's
* actual intent.
*/
- AMOTION_EVENT_FLAG_WINDOW_IS_PARTIALLY_OBSCURED = 0x2,
-
+ AMOTION_EVENT_FLAG_WINDOW_IS_PARTIALLY_OBSCURED =
+ android::os::IInputConstants::MOTION_EVENT_FLAG_WINDOW_IS_PARTIALLY_OBSCURED,
+ AMOTION_EVENT_FLAG_HOVER_EXIT_PENDING =
+ android::os::IInputConstants::MOTION_EVENT_FLAG_HOVER_EXIT_PENDING,
/**
* This flag indicates that the event has been generated by a gesture generator. It
* provides a hint to the GestureDetector to not apply any touch slop.
*/
- AMOTION_EVENT_FLAG_IS_GENERATED_GESTURE = 0x8,
+ AMOTION_EVENT_FLAG_IS_GENERATED_GESTURE =
+ android::os::IInputConstants::MOTION_EVENT_FLAG_IS_GENERATED_GESTURE,
/**
* This flag indicates that the event will not cause a focus change if it is directed to an
@@ -83,20 +86,24 @@
* gestures to allow the user to direct gestures to an unfocused window without bringing it
* into focus.
*/
- AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE = 0x40,
+ AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE =
+ android::os::IInputConstants::MOTION_EVENT_FLAG_NO_FOCUS_CHANGE,
#if defined(__linux__)
/**
* This event was generated or modified by accessibility service.
*/
AMOTION_EVENT_FLAG_IS_ACCESSIBILITY_EVENT =
- android::os::IInputConstants::INPUT_EVENT_FLAG_IS_ACCESSIBILITY_EVENT, // 0x800,
+ android::os::IInputConstants::INPUT_EVENT_FLAG_IS_ACCESSIBILITY_EVENT,
#else
AMOTION_EVENT_FLAG_IS_ACCESSIBILITY_EVENT = 0x800,
#endif
+ AMOTION_EVENT_FLAG_TARGET_ACCESSIBILITY_FOCUS =
+ android::os::IInputConstants::MOTION_EVENT_FLAG_TARGET_ACCESSIBILITY_FOCUS,
+
/* Motion event is inconsistent with previously sent motion events. */
- AMOTION_EVENT_FLAG_TAINTED = 0x80000000,
+ AMOTION_EVENT_FLAG_TAINTED = android::os::IInputConstants::INPUT_EVENT_FLAG_TAINTED,
};
/**
@@ -116,9 +123,10 @@
/**
* This flag indicates that the point up event has been canceled.
* Typically this is used for palm event when the user has accidental touches.
- * TODO: Adjust flag to public api
+ * TODO(b/338143308): Add this to NDK
*/
-constexpr int32_t AMOTION_EVENT_FLAG_CANCELED = 0x20;
+constexpr int32_t AMOTION_EVENT_FLAG_CANCELED =
+ android::os::IInputConstants::INPUT_EVENT_FLAG_CANCELED;
enum {
/*