From 894210fea9194d46b229516240323dcd4bf6d25a Mon Sep 17 00:00:00 2001 From: Leon Scroggins III Date: Fri, 18 Mar 2022 17:06:04 -0400 Subject: [PATCH] Update transparent region when cutouts update The transparent region is used to compute the blocking region for the DPU. This needs to be updated when the cutouts change. Call updateProtectionBoundingPath in onAttachedToWindow. It is called the other times we call updateCutout. Fixes: 225212638 Test: debug.screenshot_rounded_corners Change-Id: Ib8e7e303b257947074ca9714f2cdaf3a3b7880ab --- .../src/com/android/systemui/DisplayCutoutBaseView.kt | 8 ++++++++ .../src/com/android/systemui/ScreenDecorHwcLayer.kt | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/packages/SystemUI/src/com/android/systemui/DisplayCutoutBaseView.kt b/packages/SystemUI/src/com/android/systemui/DisplayCutoutBaseView.kt index 56046d9c057d8..ccb5b1146a1cd 100644 --- a/packages/SystemUI/src/com/android/systemui/DisplayCutoutBaseView.kt +++ b/packages/SystemUI/src/com/android/systemui/DisplayCutoutBaseView.kt @@ -79,6 +79,8 @@ open class DisplayCutoutBaseView : View, RegionInterceptableView { override fun onAttachedToWindow() { super.onAttachedToWindow() updateCutout() + updateProtectionBoundingPath() + onUpdate() } fun onDisplayChanged(displayId: Int) { @@ -93,6 +95,7 @@ open class DisplayCutoutBaseView : View, RegionInterceptableView { if (displayId == display.displayId) { updateCutout() updateProtectionBoundingPath() + onUpdate() } } @@ -100,8 +103,13 @@ open class DisplayCutoutBaseView : View, RegionInterceptableView { displayRotation = rotation updateCutout() updateProtectionBoundingPath() + onUpdate() } + // Called after the cutout and protection bounding path change. Subclasses + // should make any changes that need to happen based on the change. + open fun onUpdate() = Unit + @VisibleForTesting(otherwise = VisibleForTesting.PROTECTED) public override fun onDraw(canvas: Canvas) { super.onDraw(canvas) diff --git a/packages/SystemUI/src/com/android/systemui/ScreenDecorHwcLayer.kt b/packages/SystemUI/src/com/android/systemui/ScreenDecorHwcLayer.kt index 1094622a8ef08..22c69373336f0 100644 --- a/packages/SystemUI/src/com/android/systemui/ScreenDecorHwcLayer.kt +++ b/packages/SystemUI/src/com/android/systemui/ScreenDecorHwcLayer.kt @@ -114,6 +114,10 @@ class ScreenDecorHwcLayer(context: Context, displayDecorationSupport: DisplayDec } } + override fun onUpdate() { + parent.requestTransparentRegion(this) + } + override fun onDraw(canvas: Canvas) { // If updating onDraw, also update gatherTransparentRegion if (useInvertedAlphaColor) {