Update display contents when metrics change
There are two separate overrides for display metrics in DisplayManager and WindowManager: - In DM - LogicalDisplay#mOverrideDisplayInfo, in most cases not null. - In WM - DisplayContent#mBaseDisplayWidth/Height/Density, different from #mInitialDisplayWidth/Height/Density values when some metrics are forced. When display was resized its windows weren't updated because of two problems: old LogicaDisplay#mOverrideDisplayInfo was preventing WM from detecting the change and override (base) display metrics were never updated by resize. When display size changes: - Before this CL: DM receives DISPLAY_CHANGED event, it updates internal values. In most cases there is an override obtained from WM and WM doesn't get new values from LogicalDisplay#getDisplayInfoLocked(). - With this CL: DM receives DISPLAY_CHANGED event, it updates internal values and resets the override received from WM. WM will receive updated values and will decide whether to apply them or not: if there is no override in WM - it will apply values from WM, otherwise it will keep the override. In both cases WM will eventually update its own override and will update the override in DM. Bug: 35258051 Bug: 34164473 Test: android.server.cts.ActivityManagerDisplayTests Test: #testDisplayResize Test: #testForceDisplayMetrics Change-Id: I80795434a6a35adb0577fbce334d76fabd2fa03d
This commit is contained in:
@@ -50,7 +50,7 @@ import java.util.Arrays;
|
||||
* <li>The real display area specifies the part of the display that contains content
|
||||
* including the system decorations. Even so, the real display area may be smaller than the
|
||||
* physical size of the display if the window manager is emulating a smaller display
|
||||
* using (adb shell am display-size). Use the following methods to query the
|
||||
* using (adb shell wm size). Use the following methods to query the
|
||||
* real display area: {@link #getRealSize}, {@link #getRealMetrics}.</li>
|
||||
* </ul>
|
||||
* </p><p>
|
||||
@@ -947,7 +947,7 @@ public final class Display {
|
||||
* The size is adjusted based on the current rotation of the display.
|
||||
* </p><p>
|
||||
* The real size may be smaller than the physical size of the screen when the
|
||||
* window manager is emulating a smaller display (using adb shell am display-size).
|
||||
* window manager is emulating a smaller display (using adb shell wm size).
|
||||
* </p>
|
||||
*
|
||||
* @param outSize Set to the real size of the display.
|
||||
|
||||
Reference in New Issue
Block a user