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

Commit 231ea21f authored by Jordan Demeulenaere's avatar Jordan Demeulenaere
Browse files

Fix DisplayCutout.{width,height} units

This CL fixes the unit of DisplayCutout.{width,height}, which I forgot
to change at the same time as the bounds units in ag/34831624.

Bug: 417960167
Test: Manual, verified the dimensions in Flexiglass shade
Flag: com.android.systemui.scene_container
Change-Id: I63d138ba2c877976b0557fa7a1dc98339b84b2cb
parent 3233ae9e
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@
package com.android.systemui.common.ui.compose.windowinsets

import android.view.DisplayCutout as ViewDisplayCutout
import androidx.compose.ui.unit.dp
import kotlin.math.abs

/**
@@ -40,9 +39,9 @@ data class DisplayCutout(
     */
    val viewDisplayCutoutKeyguardStatusBarView: ViewDisplayCutout? = null,
) {
    fun width() = abs(right - left).dp
    val width: Int = abs(right - left)

    fun height() = abs(bottom - top).dp
    val height: Int = abs(bottom - top)
}

enum class CutoutLocation {
+4 −4
Original line number Diff line number Diff line
@@ -465,8 +465,8 @@ private fun CutoutAwareShadeHeader(
    ) { measurables, constraints ->
        val cutout = cutoutProvider()

        val cutoutWidth = cutout.width()
        val cutoutHeight = cutout.height()
        val cutoutWidth = cutout.width
        val cutoutHeight = cutout.height
        val cutoutTop = cutout.top
        val cutoutLocation = cutout.location

@@ -476,8 +476,8 @@ private fun CutoutAwareShadeHeader(
        check(measurables[1].size == 1)

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

        val startMeasurable = measurables[0][0]