diff options
| author | 2022-08-02 17:38:00 +0800 | |
|---|---|---|
| committer | 2022-08-02 17:38:25 +0800 | |
| commit | eb8882f09b4f38d691ae87a4f04f628c52f30436 (patch) | |
| tree | 6bdb724a660ff440eac393d771bea354d03639e7 | |
| parent | 867250736a3a223c590156ccf4882ef7f211eb57 (diff) | |
Get the latest display info for overlay change
LocalDisplayAdapter.LocalDisplayDevice#updateDeviceInfoLocked
posts to display thread when receiving onOverlayChanged. So
the operation depends on it should run sequentially.
This partial relands commit 08a3049 to make sure that the display
info can include the latest cutout info after changing the cutout
overlay resources. The reconfigureDisplayLocked in previous commit
is not called in this change because that will require to fix
configuration calculation according to decor windows that provide
display config related insets.
Bug: 222572231
Bug: 240961743
Test: Toggle different types of cutout in developer options,
the cutout change should be applied immediately on screen.
Change-Id: I393c7b2c2e95eabc21123b7c95c760323a5386ec
| -rw-r--r-- | services/core/java/com/android/server/wm/DisplayPolicy.java | 4 | ||||
| -rw-r--r-- | services/core/java/com/android/server/wm/WindowManagerService.java | 15 |
2 files changed, 11 insertions, 8 deletions
diff --git a/services/core/java/com/android/server/wm/DisplayPolicy.java b/services/core/java/com/android/server/wm/DisplayPolicy.java index 14e224111286..565d5cc88f4b 100644 --- a/services/core/java/com/android/server/wm/DisplayPolicy.java +++ b/services/core/java/com/android/server/wm/DisplayPolicy.java @@ -1882,8 +1882,10 @@ public class DisplayPolicy { /** * Called when the resource overlays change. */ - public void onOverlayChangedLw() { + void onOverlayChanged() { updateCurrentUserResources(); + // Update the latest display size, cutout. + mDisplayContent.updateDisplayInfo(); onConfigurationChanged(); mSystemGestures.onConfigurationChanged(); } diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index 08c473226837..296390a57bcc 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -7046,13 +7046,14 @@ public class WindowManagerService extends IWindowManager.Stub } public void onOverlayChanged() { - synchronized (mGlobalLock) { - mRoot.forAllDisplays(displayContent -> { - displayContent.getDisplayPolicy().onOverlayChangedLw(); - displayContent.updateDisplayInfo(); - }); - requestTraversal(); - } + // Post to display thread so it can get the latest display info. + mH.post(() -> { + synchronized (mGlobalLock) { + mAtmService.deferWindowLayout(); + mRoot.forAllDisplays(dc -> dc.getDisplayPolicy().onOverlayChanged()); + mAtmService.continueWindowLayout(); + } + }); } @Override |