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/services/inputflinger/dispatcher/trace/AndroidInputEventProtoConverter.cpp b/services/inputflinger/dispatcher/trace/AndroidInputEventProtoConverter.cpp
index 2d7554c..0b17507 100644
--- a/services/inputflinger/dispatcher/trace/AndroidInputEventProtoConverter.cpp
+++ b/services/inputflinger/dispatcher/trace/AndroidInputEventProtoConverter.cpp
@@ -123,7 +123,8 @@
const auto& coords = motion->pointerCoords[i];
const auto coordsInWindow =
- MotionEvent::calculateTransformedCoords(motion->source, args.transform, coords);
+ MotionEvent::calculateTransformedCoords(motion->source, motion->flags,
+ args.transform, coords);
auto bits = BitSet64(coords.bits);
for (int32_t axisIndex = 0; !bits.isEmpty(); axisIndex++) {
const uint32_t axis = bits.clearFirstMarkedBit();