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

Commit d611bb1d authored by 0's avatar 0 Committed by Shawn Lee
Browse files

[flexiglass] Reset stackTop when idle on Gone scene

Because we now derive stackTop from the NotificationPlaceholder composable, when we transition from Lockscreen to Gone (unlocked), stackTop is still incorrectly set to its previous value in the Lockscreen scene. This is visible if we trigger a HUN before ever opening the Shade - it appears at the incorrect, stale stackTop value.

Bug: 357661886
Test: manually verified HUN appears at the correct position after first unlocking the phone and not opening the shade
Flag: com.android.systemui.scene_container
Change-Id: Ib713b4d8fcbbc2672dc56ea085b21676c0cce541
parent dce6a3c8
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.systemui.statusbar.notification.stack.ui.viewbinder

import android.util.Log
import com.android.app.tracing.coroutines.flow.filter
import com.android.systemui.common.ui.ConfigurationState
import com.android.systemui.common.ui.view.onLayoutChanged
import com.android.systemui.dagger.SysUISingleton
@@ -86,6 +87,7 @@ constructor(
            }
            launch { viewModel.isScrollable.collect { view.setScrollingEnabled(it) } }
            launch { viewModel.isDozing.collect { isDozing -> view.setDozing(isDozing) } }
            launch { viewModel.shouldResetStackTop.filter { it }.collect { view.setStackTop(0f) } }

            launchAndDispose {
                view.setSyntheticScrollConsumer(viewModel.syntheticScrollConsumer)
+9 −0
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.flowOf
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.mapNotNull

/** ViewModel which represents the state of the NSSL/Controller in the world of flexiglass */
class NotificationScrollViewModel
@@ -117,6 +118,14 @@ constructor(
            .distinctUntilChanged()
            .dumpWhileCollecting("expandFraction")

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

    private operator fun SceneKey.contains(scene: SceneKey) =
        sceneInteractor.isSceneInFamily(scene, this)