Fix magnify screen in a dialog will response wrong position from touch.
The surface insects would be also scaled if window scale is not
identical.
Bug: 130693161
Test: atest libgui_test
Change-Id: I60a3c6b3ac1f930d3151edd86c3e798369c8c483
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index cbe8b29..379b004 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -2004,10 +2004,14 @@
ui::Transform t = getTransform();
const float xScale = t.sx();
const float yScale = t.sy();
+ float xSurfaceInset = info.surfaceInset;
+ float ySurfaceInset = info.surfaceInset;
if (xScale != 1.0f || yScale != 1.0f) {
info.windowXScale *= 1.0f / xScale;
info.windowYScale *= 1.0f / yScale;
info.touchableRegion.scaleSelf(xScale, yScale);
+ xSurfaceInset *= xScale;
+ ySurfaceInset *= yScale;
}
// Transform layer size to screen space and inset it by surface insets.
@@ -2019,7 +2023,7 @@
layerBounds = getCroppedBufferSize(getDrawingState());
}
layerBounds = t.transform(layerBounds);
- layerBounds.inset(info.surfaceInset, info.surfaceInset, info.surfaceInset, info.surfaceInset);
+ layerBounds.inset(xSurfaceInset, ySurfaceInset, xSurfaceInset, ySurfaceInset);
// Input coordinate should match the layer bounds.
info.frameLeft = layerBounds.left;