Merge "Only create valid insets sources of display cutout" into tm-qpr-dev am: 0aa1b8ed79

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18911187

Change-Id: Iba02c81e666379df1a3910893719159732e40fa6
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Tiger Huang
2022-06-16 09:56:37 +00:00
committed by Automerger Merge Worker

View File

@@ -99,19 +99,28 @@ public class DisplayFrames {
state.setRoundedCorners(roundedCorners);
state.setPrivacyIndicatorBounds(indicatorBounds);
state.getDisplayCutoutSafe(safe);
if (!cutout.isEmpty()) {
if (safe.left > unrestricted.left) {
state.getSource(ITYPE_LEFT_DISPLAY_CUTOUT).setFrame(
unrestricted.left, unrestricted.top, safe.left, unrestricted.bottom);
} else {
state.removeSource(ITYPE_LEFT_DISPLAY_CUTOUT);
}
if (safe.top > unrestricted.top) {
state.getSource(ITYPE_TOP_DISPLAY_CUTOUT).setFrame(
unrestricted.left, unrestricted.top, unrestricted.right, safe.top);
} else {
state.removeSource(ITYPE_TOP_DISPLAY_CUTOUT);
}
if (safe.right < unrestricted.right) {
state.getSource(ITYPE_RIGHT_DISPLAY_CUTOUT).setFrame(
safe.right, unrestricted.top, unrestricted.right, unrestricted.bottom);
} else {
state.removeSource(ITYPE_RIGHT_DISPLAY_CUTOUT);
}
if (safe.bottom < unrestricted.bottom) {
state.getSource(ITYPE_BOTTOM_DISPLAY_CUTOUT).setFrame(
unrestricted.left, safe.bottom, unrestricted.right, unrestricted.bottom);
} else {
state.removeSource(ITYPE_LEFT_DISPLAY_CUTOUT);
state.removeSource(ITYPE_TOP_DISPLAY_CUTOUT);
state.removeSource(ITYPE_RIGHT_DISPLAY_CUTOUT);
state.removeSource(ITYPE_BOTTOM_DISPLAY_CUTOUT);
}
return true;