Make sure that touches are within the surface.
Changed TouchInputMapper::isPointInsideSurface should check the
surface range instead of physical frame range.
Test: atest inputflinger_tests
Test: enable emulator, open second display with landscape mode, try
YouTube and changed it to portrait mode.
Bug: 139805619
Change-Id: Id4ad7053acac33f49363442bd5f710f8023d5190
diff --git a/services/inputflinger/reader/mapper/TouchInputMapper.cpp b/services/inputflinger/reader/mapper/TouchInputMapper.cpp
index 6bd0ea9..34603b9 100644
--- a/services/inputflinger/reader/mapper/TouchInputMapper.cpp
+++ b/services/inputflinger/reader/mapper/TouchInputMapper.cpp
@@ -3621,9 +3621,9 @@
const float scaledX = x * mXScale;
const float scaledY = y * mYScale;
return x >= mRawPointerAxes.x.minValue && x <= mRawPointerAxes.x.maxValue &&
- scaledX >= mPhysicalLeft && scaledX <= mPhysicalLeft + mPhysicalWidth &&
+ scaledX >= mSurfaceLeft && scaledX <= mSurfaceLeft + mSurfaceWidth &&
y >= mRawPointerAxes.y.minValue && y <= mRawPointerAxes.y.maxValue &&
- scaledY >= mPhysicalTop && scaledY <= mPhysicalTop + mPhysicalHeight;
+ scaledY >= mSurfaceTop && scaledY <= mSurfaceTop + mSurfaceHeight;
}
const TouchInputMapper::VirtualKey* TouchInputMapper::findVirtualKeyHit(int32_t x, int32_t y) {