OSDN Git Service

Update display contents when metrics change
authorAndrii Kulian <akulian@google.com>
Tue, 21 Mar 2017 17:17:03 +0000 (10:17 -0700)
committerAndrii Kulian <akulian@google.com>
Tue, 21 Mar 2017 22:23:47 +0000 (15:23 -0700)
commiteddb7c0985e1fac8bdbeaaed40c678c0dc9da321
treefcdaea46f73a54d164e5d01f3b48b168f639f349
parenta5c560b328f60144041dd60277ec0158bee9954a
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
core/java/android/view/Display.java
services/core/java/com/android/server/display/LogicalDisplay.java
services/core/java/com/android/server/wm/DisplayContent.java
services/core/java/com/android/server/wm/WindowManagerService.java