summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Tiger <tigerhuang@google.com> 2022-11-09 16:23:49 +0800
committer Tiger <tigerhuang@google.com> 2022-11-09 17:28:21 +0800
commiteef6b4d3b06a165b4e52a344910555d97fefe98f (patch)
tree48f4f250e22195d03502dd19d5d46817d8cce946
parent389d8389c54eae07fef556fe904a0b9249bac6e4 (diff)
Don't send mSizeCompatScale to client if it is from SizeCompatBounds
If an app doesn't fit the container, we would scale the app down at the server side for making it fit. The client should layout the window as usual as if there is no scaling. Fix: 254187021 Test: 1. Open a non-resizeable app which has a fixed orientation. 2. Reduce the display size via `wm size`. 3. See if the app is cropped. Change-Id: I3ef16def30d4e52da6c4f2acbf17a247cc783774
-rw-r--r--services/core/java/com/android/server/wm/WindowManagerService.java2
-rw-r--r--services/core/java/com/android/server/wm/WindowState.java9
2 files changed, 7 insertions, 4 deletions
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java
index 9c9d751244e6..9db5170897a8 100644
--- a/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -1883,7 +1883,7 @@ public class WindowManagerService extends IWindowManager.Stub
// Make this invalid which indicates a null attached frame.
outAttachedFrame.set(0, 0, -1, -1);
}
- outSizeCompatScale[0] = win.getSizeCompatScale();
+ outSizeCompatScale[0] = win.getSizeCompatScaleForClient();
}
Binder.restoreCallingIdentity(origId);
diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java
index d4c1abfa8d24..018dc9241ec4 100644
--- a/services/core/java/com/android/server/wm/WindowState.java
+++ b/services/core/java/com/android/server/wm/WindowState.java
@@ -1265,8 +1265,10 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
mGlobalScale = mInvGlobalScale = mSizeCompatScale = 1f;
}
- float getSizeCompatScale() {
- return mSizeCompatScale;
+ float getSizeCompatScaleForClient() {
+ // If the size compat scale is because of the size compat bounds, we only scale down its
+ // coordinates at the server side without letting the client know.
+ return mToken.hasSizeCompatBounds() ? 1f : mSizeCompatScale;
}
/**
@@ -3863,7 +3865,8 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
outFrames.attachedFrame.scale(mInvGlobalScale);
}
}
- outFrames.sizeCompatScale = mSizeCompatScale;
+
+ outFrames.sizeCompatScale = getSizeCompatScaleForClient();
// Note: in the cases where the window is tied to an activity, we should not send a
// configuration update when the window has requested to be hidden. Doing so can lead to