Merge "Make sure display config is updated when cutout is changed" into tm-dev

This commit is contained in:
Riddle Hsu
2022-03-31 06:31:36 +00:00
committed by Android (Google) Code Review
2 changed files with 17 additions and 9 deletions

View File

@@ -1810,10 +1810,14 @@ public class DisplayPolicy {
/** /**
* Called when the resource overlays change. * Called when the resource overlays change.
*/ */
public void onOverlayChangedLw() { void onOverlayChanged() {
updateCurrentUserResources(); updateCurrentUserResources();
// Update the latest display size, cutout.
mDisplayContent.updateDisplayInfo();
// The height of status bar needs to update in case display cutout is changed.
onConfigurationChanged(); onConfigurationChanged();
mSystemGestures.onConfigurationChanged(); // The height of status bar can affect screen size configuration.
mDisplayContent.reconfigureDisplayLocked();
} }
/** /**

View File

@@ -6966,13 +6966,17 @@ public class WindowManagerService extends IWindowManager.Stub
} }
public void onOverlayChanged() { public void onOverlayChanged() {
synchronized (mGlobalLock) { // Post to display thread so it can get the latest display info.
mRoot.forAllDisplays(displayContent -> { mH.post(() -> {
displayContent.getDisplayPolicy().onOverlayChangedLw(); synchronized (mGlobalLock) {
displayContent.updateDisplayInfo(); mAtmService.deferWindowLayout();
}); try {
requestTraversal(); mRoot.forAllDisplays(dc -> dc.getDisplayPolicy().onOverlayChanged());
} } finally {
mAtmService.continueWindowLayout();
}
}
});
} }
@Override @Override