Don't create unexpected display cutout or rounded corners

Should not load cutout and rounded corner when the mInitialDisplayCutout
and mInitialRoundedCorner are null when setForcedSize() is called.
Otherwise, it will accidentally create the cutout/rounded corners of the
default display on other display.

Bug: 230500488
Test: atest DisplaySizeTest#testSizeRangesAfterSettingDisplaySize
Change-Id: Ied2ad194cf2a22e4ac3fe2eb9d6d474e3c9b7578
This commit is contained in:
shawnlin
2022-05-05 19:54:13 +08:00
committed by Shawn Lin
parent 100004b0ca
commit abaa42bd44

View File

@@ -2922,7 +2922,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
}
DisplayCutout loadDisplayCutout(int displayWidth, int displayHeight) {
if (mDisplayPolicy == null) {
if (mDisplayPolicy == null || mInitialDisplayCutout == null) {
return null;
}
return DisplayCutout.fromResourcesRectApproximation(
@@ -2931,7 +2931,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
}
RoundedCorners loadRoundedCorners(int displayWidth, int displayHeight) {
if (mDisplayPolicy == null) {
if (mDisplayPolicy == null || mInitialRoundedCorners == null) {
return null;
}
return RoundedCorners.fromResources(