From b742d45a6d79bed3e1b964387b442f427124515d Mon Sep 17 00:00:00 2001 From: shawnlin Date: Fri, 11 Mar 2022 14:19:32 +0800 Subject: [PATCH] Fixed cutout not drawn when it's inside rounded corner rect We may clear the color(if useInvertedAlphaColor is true) of the rounded corner rects before drawing rounded corners. If a cutout happens to be inside one of there rects, it will be cleared, so we should draw rounded corners before cutout. Bug: 223952603 Test: manual: select punch hole or corner cutout in the settings. Change-Id: I57298a849bbf5f286e154bf903705dbdfa5930ab --- .../src/com/android/systemui/ScreenDecorHwcLayer.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/systemui/ScreenDecorHwcLayer.kt b/packages/SystemUI/src/com/android/systemui/ScreenDecorHwcLayer.kt index 4b868622ce58d..498e71546bed7 100644 --- a/packages/SystemUI/src/com/android/systemui/ScreenDecorHwcLayer.kt +++ b/packages/SystemUI/src/com/android/systemui/ScreenDecorHwcLayer.kt @@ -119,9 +119,13 @@ class ScreenDecorHwcLayer(context: Context, displayDecorationSupport: DisplayDec if (useInvertedAlphaColor) { canvas.drawColor(bgColor) } + + // We may clear the color(if useInvertedAlphaColor is true) of the rounded corner rects + // before drawing rounded corners. If the cutout happens to be inside one of these rects, it + // will be cleared, so we have to draw rounded corners before cutout. + drawRoundedCorners(canvas) // Cutouts are drawn in DisplayCutoutBaseView.onDraw() super.onDraw(canvas) - drawRoundedCorners(canvas) debugTransparentRegionPaint?.let { calculateTransparentRect()