Use Transform in InputDispatcher

Modified InputDispatcher to use the Transform object instead of offset
and scale values.

Bug: 158476194
Test: /data/nativetest64/inputflinger_tests/inputflinger_tests
Test: /data/nativetest64/libinput_tests/libinput_tests
Change-Id: I31242fa6af92b02158ccb0d292c208a4a21c9e43
diff --git a/libs/input/InputWindow.cpp b/libs/input/InputWindow.cpp
index 36c1f80..d5d35e6 100644
--- a/libs/input/InputWindow.cpp
+++ b/libs/input/InputWindow.cpp
@@ -57,7 +57,7 @@
             info.frameLeft == frameLeft && info.frameTop == frameTop &&
             info.frameRight == frameRight && info.frameBottom == frameBottom &&
             info.surfaceInset == surfaceInset && info.globalScaleFactor == globalScaleFactor &&
-            info.windowXScale == windowXScale && info.windowYScale == windowYScale &&
+            info.transform == transform &&
             info.touchableRegion.hasSameRects(touchableRegion) && info.visible == visible &&
             info.canReceiveKeys == canReceiveKeys && info.trustedOverlay == trustedOverlay &&
             info.hasFocus == hasFocus && info.hasWallpaper == hasWallpaper &&
@@ -93,8 +93,12 @@
         parcel->writeInt32(frameBottom) ?:
         parcel->writeInt32(surfaceInset) ?:
         parcel->writeFloat(globalScaleFactor) ?:
-        parcel->writeFloat(windowXScale) ?:
-        parcel->writeFloat(windowYScale) ?:
+        parcel->writeFloat(transform.dsdx()) ?:
+        parcel->writeFloat(transform.dtdx()) ?:
+        parcel->writeFloat(transform.tx()) ?:
+        parcel->writeFloat(transform.dtdy()) ?:
+        parcel->writeFloat(transform.dsdy()) ?:
+        parcel->writeFloat(transform.ty()) ?:
         parcel->writeBool(visible) ?:
         parcel->writeBool(canReceiveKeys) ?:
         parcel->writeBool(hasFocus) ?:
@@ -132,14 +136,19 @@
 
     flags = Flags<Flag>(parcel->readInt32());
     type = static_cast<Type>(parcel->readInt32());
+    float dsdx, dtdx, tx, dtdy, dsdy, ty;
     status = parcel->readInt32(&frameLeft) ?:
         parcel->readInt32(&frameTop) ?:
         parcel->readInt32(&frameRight) ?:
         parcel->readInt32(&frameBottom) ?:
         parcel->readInt32(&surfaceInset) ?:
         parcel->readFloat(&globalScaleFactor) ?:
-        parcel->readFloat(&windowXScale) ?:
-        parcel->readFloat(&windowYScale) ?:
+        parcel->readFloat(&dsdx) ?:
+        parcel->readFloat(&dtdx) ?:
+        parcel->readFloat(&tx) ?:
+        parcel->readFloat(&dtdy) ?:
+        parcel->readFloat(&dsdy) ?:
+        parcel->readFloat(&ty) ?:
         parcel->readBool(&visible) ?:
         parcel->readBool(&canReceiveKeys) ?:
         parcel->readBool(&hasFocus) ?:
@@ -165,6 +174,7 @@
     }
 
     touchableRegionCropHandle = parcel->readStrongBinder();
+    transform.set(std::array<float, 9>{dsdx, dtdx, tx, dtdy, dsdy, ty, 0, 0, 1});
 
     return OK;
 }