Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 97be7d5a authored by Danny Burakov's avatar Danny Burakov
Browse files

[Dual Shade] Recompose the shade whenever the cutout location changes.

BONUS: Remove an unnecessary variable in ShadeHeader.

Fix: 441491427
Test: Manually tested by rotating the device with the shade open.
Flag: com.android.systemui.scene_container
Change-Id: I4be00ed9dce6fea4d5bd7f4c6144db1f5322dd7f
parent af64fd4e
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -479,9 +479,8 @@ private fun CutoutAwareShadeHeader(
        check(measurables[1].size == 1)

        val screenWidth = constraints.maxWidth
        val cutoutWidthPx = cutoutWidth
        val height = max(cutoutHeight + (cutoutTop * 2), statusBarHeight.roundToPx())
        val childConstraints = Constraints.fixed((screenWidth - cutoutWidthPx) / 2, height)
        val childConstraints = Constraints.fixed((screenWidth - cutoutWidth) / 2, height)

        val startMeasurable = measurables[0][0]
        val endMeasurable = measurables[1][0]
@@ -498,11 +497,11 @@ private fun CutoutAwareShadeHeader(
                }
                CutoutLocation.CENTER -> {
                    startPlaceable.placeRelative(x = 0, y = 0)
                    endPlaceable.placeRelative(x = startPlaceable.width + cutoutWidthPx, y = 0)
                    endPlaceable.placeRelative(x = startPlaceable.width + cutoutWidth, y = 0)
                }
                CutoutLocation.LEFT -> {
                    startPlaceable.placeRelative(x = cutoutWidthPx, y = 0)
                    endPlaceable.placeRelative(x = startPlaceable.width + cutoutWidthPx, y = 0)
                    startPlaceable.placeRelative(x = cutoutWidth, y = 0)
                    endPlaceable.placeRelative(x = startPlaceable.width + cutoutWidth, y = 0)
                }
            }
        }
+2 −3
Original line number Diff line number Diff line
@@ -231,7 +231,7 @@ private fun ContentScope.SingleShade(
    modifier: Modifier = Modifier,
    shadeSession: SaveableSession,
) {
    val cutout = LocalDisplayCutout.current
    val cutoutLocation = LocalDisplayCutout.current().location
    val cutoutInsets = WindowInsets.Companion.displayCutout

    var maxNotifScrimTop by remember { mutableIntStateOf(0) }
@@ -256,8 +256,7 @@ private fun ContentScope.SingleShade(
    val shadeHorizontalPadding =
        dimensionResource(id = R.dimen.notification_panel_margin_horizontal)
    val shadeMeasurePolicy =
        remember(cutout, cutoutInsets) {
            val cutoutLocation = cutout().location
        remember(cutoutLocation, cutoutInsets) {
            SingleShadeMeasurePolicy(
                onNotificationsTopChanged = { maxNotifScrimTop = it },
                cutoutInsetsProvider = {