summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Rob Carr <racarr@google.com> 2021-06-17 20:19:26 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2021-06-17 20:19:26 +0000
commite7fc75760a8c34e2cf447fda8daafeb0efc4a9a0 (patch)
treebec1401349ab731d3d41c2d1dc977cdffb1efbc3
parent7a4809f99a5b9d9d1e883f1d3d92c6adea49cb9b (diff)
parent0900271a8d7cc72cf8121f4f9084392df69c6a98 (diff)
Merge "WindowState: Correct wallpaper scaling" into sc-dev
-rw-r--r--services/core/java/com/android/server/wm/WindowState.java14
1 files changed, 13 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java
index 1a468d9f4ee9..07ac73b05706 100644
--- a/services/core/java/com/android/server/wm/WindowState.java
+++ b/services/core/java/com/android/server/wm/WindowState.java
@@ -5512,7 +5512,19 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
mSurfacePlacementNeeded = false;
transformFrameToSurfacePosition(mWindowFrames.mFrame.left, mWindowFrames.mFrame.top,
mSurfacePosition);
- mSurfacePosition.offset(mXOffset, mYOffset);
+
+ if (mWallpaperScale != 1f) {
+ DisplayInfo displayInfo = getDisplayInfo();
+ Matrix matrix = mTmpMatrix;
+ matrix.setTranslate(mXOffset, mYOffset);
+ matrix.postScale(mWallpaperScale, mWallpaperScale, displayInfo.logicalWidth / 2f,
+ displayInfo.logicalHeight / 2f);
+ matrix.getValues(mTmpMatrixArray);
+ mSurfacePosition.offset(Math.round(mTmpMatrixArray[Matrix.MTRANS_X]),
+ Math.round(mTmpMatrixArray[Matrix.MTRANS_Y]));
+ } else {
+ mSurfacePosition.offset(mXOffset, mYOffset);
+ }
// Freeze position while we're unrotated, so the surface remains at the position it was
// prior to the rotation.