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

Commit 162588ac authored by András Kurucz's avatar András Kurucz
Browse files

[flexiglass] Set NSSL stack bounds from the GONE scene

Fixes: 379855431
Test: go to the GONE Scene, check if stackTop and stackCutoff are 0
Flag: com.android.systemui.scene_container
Change-Id: I5b2bdd8149cef3044ff5c675387499dd0de9b699
parent ef9885ae
Loading
Loading
Loading
Loading
+25 −6
Original line number Diff line number Diff line
@@ -19,12 +19,17 @@ package com.android.systemui.scene.ui.composable
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.derivedStateOf
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import com.android.compose.animation.scene.SceneScope
import com.android.compose.animation.scene.UserAction
import com.android.compose.animation.scene.UserActionResult
import com.android.compose.animation.scene.animateContentDpAsState
import com.android.compose.animation.scene.animateContentFloatAsState
import com.android.compose.animation.scene.content.state.TransitionState
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.lifecycle.ExclusiveActivatable
import com.android.systemui.lifecycle.rememberViewModel
@@ -63,9 +68,25 @@ constructor(
    }

    @Composable
    override fun SceneScope.Content(
        modifier: Modifier,
    ) {
    override fun SceneScope.Content(modifier: Modifier) {

        val isIdle by remember {
            derivedStateOf { layoutState.transitionState is TransitionState.Idle }
        }

        LaunchedEffect(isIdle) {
            // Wait for being Idle on this Scene, otherwise LaunchedEffect would fire too soon,
            // and another transition could override the NSSL stack bounds.
            if (isIdle) {
                // Reset the stack bounds to avoid caching these values from the previous Scenes,
                // and not to confuse the StackScrollAlgorithm when it displays a HUN over GONE.
                notificationStackScrolLView.get().apply {
                    setStackTop(0f)
                    setStackCutoff(0f)
                }
            }
        }

        animateContentFloatAsState(
            value = QuickSettings.SharedValues.SquishinessValues.GoneSceneStarting,
            key = QuickSettings.SharedValues.TilesSquishiness,
@@ -75,9 +96,7 @@ constructor(
        SnoozeableHeadsUpNotificationSpace(
            stackScrollView = notificationStackScrolLView.get(),
            viewModel =
                rememberViewModel("GoneScene") {
                    notificationsPlaceholderViewModelFactory.create()
                },
                rememberViewModel("GoneScene") { notificationsPlaceholderViewModelFactory.create() },
        )
    }
}