InputDispatcher: Remove transform for non-pointer events
MotionEvents that are not pointer events should not have a window
transform associated with them because they don't correspond to
on-screen locations.
Bug: 182325974
Test: manual, verify pointer capture in freeform and multi-window modes
Change-Id: I774bbdfacffa68a42e72e3ca52ec4b474560ff34
diff --git a/services/inputflinger/dispatcher/InputDispatcher.cpp b/services/inputflinger/dispatcher/InputDispatcher.cpp
index 19f8694..6d9190c 100644
--- a/services/inputflinger/dispatcher/InputDispatcher.cpp
+++ b/services/inputflinger/dispatcher/InputDispatcher.cpp
@@ -332,10 +332,11 @@
int32_t inputTargetFlags) {
if (eventEntry->type == EventEntry::Type::MOTION) {
const MotionEntry& motionEntry = static_cast<const MotionEntry&>(*eventEntry);
- if (motionEntry.source & AINPUT_SOURCE_CLASS_JOYSTICK) {
+ if ((motionEntry.source & AINPUT_SOURCE_CLASS_POINTER) == 0) {
const ui::Transform identityTransform;
- // Use identity transform for joystick events events because they don't depend on
- // the window info
+ // Use identity transform for events that are not pointer events because their axes
+ // values do not represent on-screen coordinates, so they should not have any window
+ // transformations applied to them.
return std::make_unique<DispatchEntry>(eventEntry, inputTargetFlags, identityTransform,
1.0f /*globalScaleFactor*/);
}