MotionEvent: Differentiate directional support for AXIS_ORIENTATION

We have three cases for handling AXIS_ORIENTATION:
1. Orientation is not supported by the input device, so the value for
   AXIS_ORIENTATION should always be 0, regardless of display rotation.
2. Orientation is supported, but a "direction" is not specified, like
   for touchscreens and touchpads. The orientation must be in the range
   [-pi/2, pi/2] for all display rotations.
3. Orientation is fully supported, and the value is in the range [-pi,
   pi] for all display rotations.

It is insufficient to rely on whether or not the PointerCoords has the
bit for AXIS_ORIENTATION set to determine whether the event has a valid
orientation. This is because we always skip setting values of 0 for any
axis in PointerCoords to save space during serialization.

To support these three cases, we introduce two new MotionEvent private
flags. These are flags that are not exposed to Java and to the public
APIs.

Bug: 263310669
Test: atest TouchScreenTest libinput_tests inputflinger_tests
Change-Id: Iaa38afe35b00de74fbc5eefce25191bea52c2ea6
diff --git a/libs/input/android/os/IInputConstants.aidl b/libs/input/android/os/IInputConstants.aidl
index 90ed2b7..650dc5c 100644
--- a/libs/input/android/os/IInputConstants.aidl
+++ b/libs/input/android/os/IInputConstants.aidl
@@ -116,6 +116,31 @@
     const int MOTION_EVENT_FLAG_NO_FOCUS_CHANGE = 0x40;
 
     /**
+     * This flag indicates that the event has a valid value for AXIS_ORIENTATION.
+     *
+     * This is a private flag that is not used in Java.
+     * @hide
+     */
+    const int MOTION_EVENT_PRIVATE_FLAG_SUPPORTS_ORIENTATION = 0x80;
+
+    /**
+     * This flag indicates that the pointers' AXIS_ORIENTATION can be used to precisely determine
+     * the direction in which the tool is pointing. The value of the orientation axis will be in
+     * the range [-pi, pi], which represents a full circle. This is usually supported by devices
+     * like styluses.
+     *
+     * Conversely, AXIS_ORIENTATION cannot be used to tell which direction the tool is pointing
+     * when this flag is not set. In this case, the axis value will have a range of [-pi/2, pi/2],
+     * which represents half a circle. This is usually the case for devices like touchscreens and
+     * touchpads, for which it is difficult to tell which direction along the major axis of the
+     * touch ellipse the finger is pointing.
+     *
+     * This is a private flag that is not used in Java.
+     * @hide
+     */
+    const int MOTION_EVENT_PRIVATE_FLAG_SUPPORTS_DIRECTIONAL_ORIENTATION = 0x100;
+
+    /**
      * The input event was generated or modified by accessibility service.
      * Shared by both KeyEvent and MotionEvent flags, so this value should not overlap with either
      * set of flags, including in input/Input.h and in android/input.h.