Merge "Update transparent region when cutouts update" into tm-dev

This commit is contained in:
Leon Scroggins
2022-03-22 13:54:51 +00:00
committed by Android (Google) Code Review
2 changed files with 12 additions and 0 deletions

View File

@@ -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)

View File

@@ -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) {