VerifiedMotionEvent: Sign transformed raw values

The values for axes X/Y that are stored in MotionEvent are
transformed to values used for its getRaw API based on the source.
This is because non-pointer sources should not have translation applied
to them.

We need to ensure that we use the same raw coordinates when we sign a
VerifiedMotionEvent in InputDispatcher that we would get with the
MotionEvent#getRaw API. To do this, we re-use the same logic used to
transform the raw coordinates in MotionEvent in InputDispatcher.

Bug: 179274888
Test: atest inputflinger_tests
Test: atest VerifyInputEventTest
Change-Id: I552f94064f15573ddda8f7c0b588cd3b984b6a94
diff --git a/services/inputflinger/dispatcher/Entry.cpp b/services/inputflinger/dispatcher/Entry.cpp
index bcb0071..c03581d 100644
--- a/services/inputflinger/dispatcher/Entry.cpp
+++ b/services/inputflinger/dispatcher/Entry.cpp
@@ -40,14 +40,15 @@
             entry.repeatCount};
 }
 
-VerifiedMotionEvent verifiedMotionEventFromMotionEntry(const MotionEntry& entry) {
-    const float rawX = entry.pointerCoords[0].getAxisValue(AMOTION_EVENT_AXIS_X);
-    const float rawY = entry.pointerCoords[0].getAxisValue(AMOTION_EVENT_AXIS_Y);
+VerifiedMotionEvent verifiedMotionEventFromMotionEntry(const MotionEntry& entry,
+                                                       const ui::Transform& rawTransform) {
+    const vec2 rawXY = MotionEvent::calculateTransformedXY(entry.source, rawTransform,
+                                                           entry.pointerCoords[0].getXYValue());
     const int actionMasked = entry.action & AMOTION_EVENT_ACTION_MASK;
     return {{VerifiedInputEvent::Type::MOTION, entry.deviceId, entry.eventTime, entry.source,
              entry.displayId},
-            rawX,
-            rawY,
+            rawXY.x,
+            rawXY.y,
             actionMasked,
             entry.downTime,
             entry.flags & VERIFIED_MOTION_EVENT_FLAGS,