[flexiglass] use LSToGoneTransitionViewModel for keyguardAlpha during LS -> GONE
With flexiglass on, using the shade/QS alpha for keyguard when on Gone scene was causing the stack to flicker when going from LS -> Gone scene, as well as during the first shade invocation after going from LS -> Gone. This CL switches us over to the alpha provided by LockscreenToGoneTransitionViewModel and only uses shade/QS alpha when shade/QS are actually occluding keyguard.
Bug: 364887368
Test: Manually verified keyguard alpha during LS -> Gone transition
Flag: com.android.systemui.scene_container
Change-Id: I837156b5e39cfc512ec7564824683a5acb6fc98b
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModel.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModel.kt
index f39af18..472e779 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModel.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModel.kt
@@ -475,19 +475,28 @@
}
fun keyguardAlpha(viewState: ViewStateAccessor, scope: CoroutineScope): Flow<Float> {
+ val isKeyguardOccluded =
+ keyguardTransitionInteractor.transitionValue(OCCLUDED).map { it == 1f }
+
+ val isKeyguardNotVisibleInState =
+ if (SceneContainerFlag.isEnabled) {
+ isKeyguardOccluded
+ } else {
+ anyOf(
+ isKeyguardOccluded,
+ keyguardTransitionInteractor
+ .transitionValue(scene = Scenes.Gone, stateWithoutSceneContainer = GONE)
+ .map { it == 1f },
+ )
+ }
+
// Transitions are not (yet) authoritative for NSSL; they still rely on StatusBarState to
// help determine when the device has fully moved to GONE or OCCLUDED state. Once SHADE
// state has been set, let shade alpha take over
val isKeyguardNotVisible =
- combine(
- anyOf(
- keyguardTransitionInteractor.transitionValue(OCCLUDED).map { it == 1f },
- keyguardTransitionInteractor
- .transitionValue(scene = Scenes.Gone, stateWithoutSceneContainer = GONE)
- .map { it == 1f },
- ),
- keyguardInteractor.statusBarState,
- ) { isKeyguardNotVisibleInState, statusBarState ->
+ combine(isKeyguardNotVisibleInState, keyguardInteractor.statusBarState) {
+ isKeyguardNotVisibleInState,
+ statusBarState ->
isKeyguardNotVisibleInState && statusBarState == SHADE
}