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

Commit d45521e9 authored by lyn's avatar lyn
Browse files

[Dual Shade] Fix HUN drawbounds in QuickSettingsShadeOverlay

Bug: 440059830
Flag: com.android.systemui.scene_container
Test: enable debug lines, observe correct drawbounds

Change-Id: I4985f1f544c186a3b53fa729ba624659d75333d0
parent e2581034
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -48,6 +48,9 @@ import androidx.compose.ui.geometry.Rect
import androidx.compose.ui.geometry.Size
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.graphics.toAndroidRectF
import androidx.compose.ui.layout.boundsInWindow
import androidx.compose.ui.layout.onGloballyPositioned
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.platform.LocalResources
import androidx.compose.ui.res.painterResource
@@ -75,6 +78,7 @@ import com.android.systemui.lifecycle.rememberViewModel
import com.android.systemui.media.remedia.ui.compose.Media
import com.android.systemui.media.remedia.ui.compose.MediaPresentationStyle
import com.android.systemui.notifications.ui.composable.SnoozeableHeadsUpNotificationSpace
import com.android.systemui.notifications.ui.composable.headsUpTopInset
import com.android.systemui.qs.composefragment.ui.GridAnchor
import com.android.systemui.qs.flags.QsDetailedView
import com.android.systemui.qs.panels.ui.compose.EditMode
@@ -154,6 +158,7 @@ constructor(
            quickSettingsContainerViewModel.brightnessSliderViewModel.showMirror
        val contentAlphaFromBrightnessMirror by
            animateFloatAsState(if (showBrightnessMirror) 0f else 1f)
        val headsUpInset = with(LocalDensity.current) { headsUpTopInset().toPx() }

        // Set the bounds to null when the QuickSettings overlay disappears.
        DisposableEffectWithLifecycle(Unit) {
@@ -207,6 +212,15 @@ constructor(
            SnoozeableHeadsUpNotificationSpace(
                stackScrollView = notificationStackScrollView.get(),
                viewModel = hunPlaceholderViewModel,
                modifier = Modifier.onGloballyPositioned { layoutCoordinates ->
                    val bounds = layoutCoordinates.boundsInWindow().toAndroidRectF()
                    if (bounds.height() > 0) {
                        // HUN gesture area must extend from the top of the screen for animations
                        bounds.top = 0f
                        bounds.bottom += headsUpInset
                        notificationStackScrollView.get().updateDrawBounds(bounds)
                    }
                }
            )
        }
    }