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

Commit 9856bf30 authored by András Kurucz's avatar András Kurucz Committed by Android (Google) Code Review
Browse files

Merge "[flexiglass] Reset NSSL stack bounds from the unoccluded GONE scene" into main

parents 3d72b7c8 03905757
Loading
Loading
Loading
Loading
+10 −5
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ import com.android.systemui.notifications.ui.composable.SnoozeableHeadsUpNotific
import com.android.systemui.qs.ui.composable.QuickSettings
import com.android.systemui.qs.ui.composable.QuickSettings.SharedValues.MediaLandscapeTopOffset
import com.android.systemui.qs.ui.composable.QuickSettings.SharedValues.MediaOffset.Default
import com.android.systemui.scene.shared.model.Overlays
import com.android.systemui.scene.shared.model.Scenes
import com.android.systemui.scene.ui.viewmodel.GoneUserActionsViewModel
import com.android.systemui.statusbar.notification.stack.ui.view.NotificationScrollView
@@ -70,18 +71,22 @@ constructor(
    @Composable
    override fun SceneScope.Content(modifier: Modifier) {

        val isIdle by remember {
            derivedStateOf { layoutState.transitionState is TransitionState.Idle }
        val isIdleAndNotOccluded by remember {
            derivedStateOf {
                layoutState.transitionState is TransitionState.Idle &&
                    Overlays.NotificationsShade !in layoutState.transitionState.currentOverlays
            }
        }

        LaunchedEffect(isIdle) {
        LaunchedEffect(isIdleAndNotOccluded) {
            // Wait for being Idle on this Scene, otherwise LaunchedEffect would fire too soon,
            // and another transition could override the NSSL stack bounds.
            if (isIdle) {
            if (isIdleAndNotOccluded) {
                // 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)
                    // use -headsUpInset to allow HUN translation outside bounds for snoozing
                    setStackTop(-getHeadsUpInset().toFloat())
                    setStackCutoff(0f)
                }
            }
+0 −5
Original line number Diff line number Diff line
@@ -108,11 +108,6 @@ constructor(
                    view.setPulsing(isPulsing, viewModel.shouldAnimatePulse.value)
                }
            }
            launch {
                viewModel.shouldResetStackTop
                    .filter { it }
                    .collectTraced { view.setStackTop(-(view.getHeadsUpInset().toFloat())) }
            }
            launch {
                viewModel.shouldCloseGuts
                    .filter { it }
+0 −6
Original line number Diff line number Diff line
@@ -192,12 +192,6 @@ constructor(
    /** Whether we should close any open notification guts. */
    val shouldCloseGuts: Flow<Boolean> = stackAppearanceInteractor.shouldCloseGuts

    val shouldResetStackTop: Flow<Boolean> =
        sceneInteractor.transitionState
            .mapNotNull { state -> state is Idle && state.currentScene == Scenes.Gone }
            .distinctUntilChanged()
            .dumpWhileCollecting("shouldResetStackTop")

    /** Whether the Notification Stack is visibly on the lockscreen scene. */
    val isShowingStackOnLockscreen: Flow<Boolean> =
        sceneInteractor.transitionState