Fix a bug in TouchInteractionService for fixed-display input rotation

DisplayManager display size seems to be pre-rotation, so adjust
logic in TouchInteractionService to account for that.

Bug: 179274888
Test: atest Launcher3Tests:com.android.launcher3.ui.TaplTestsLauncher3
Change-Id: Ie89d7b7d74c8bece8a2c109a0b350bc190356bf2
This commit is contained in:
Evan Rosky
2021-05-04 11:52:26 -07:00
parent 51991a7333
commit 04fb7ee44c
@@ -496,6 +496,13 @@ public class TouchInteractionService extends Service implements PluginListener<O
Point sz = new Point();
display.getRealSize(sz);
if (rotation != Surface.ROTATION_0) {
if ((rotation % 2) != 0) {
// via display-manager, the display size is unrotated, so "rotate" its size
// to match the rotation we are transforming the event into.
final int tmpX = sz.x;
sz.x = sz.y;
sz.y = tmpX;
}
event.transform(InputChannelCompat.createRotationMatrix(rotation, sz.x, sz.y));
}
}