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

Commit 4549869e authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix DisplayCutout.{width,height} units" into main

parents 2e2d60e7 231ea21f
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]