Loading packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/ui/viewmodel/KeyguardStatusBarViewModelTest.kt +1 −0 Original line number Diff line number Diff line Loading @@ -92,6 +92,7 @@ class KeyguardStatusBarViewModelTest(flags: FlagsParameterization) : SysuiTestCa fun setup() { underTest = KeyguardStatusBarViewModel( testScope.backgroundScope, headsUpNotificationInteractor, kosmos.sceneInteractor, keyguardInteractor, Loading packages/SystemUI/src/com/android/systemui/statusbar/ui/viewmodel/KeyguardStatusBarViewModel.kt +20 −27 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.systemui.statusbar.ui.viewmodel import com.android.systemui.Flags import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor import com.android.systemui.lifecycle.HydratedActivatable import com.android.systemui.scene.domain.interactor.SceneInteractor Loading @@ -32,16 +33,15 @@ import com.android.systemui.statusbar.policy.BatteryController.BatteryStateChang import com.android.systemui.user.domain.interactor.UserLogoutInteractor import com.android.systemui.utils.coroutines.flow.conflatedCallbackFlow import javax.inject.Inject import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.channels.awaitClose import kotlinx.coroutines.coroutineScope import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.SharingStarted import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.flow.map import kotlinx.coroutines.launch import kotlinx.coroutines.flow.stateIn /** * A view model for the status bar displayed on keyguard (lockscreen). Loading @@ -55,8 +55,9 @@ import kotlinx.coroutines.launch class KeyguardStatusBarViewModel @Inject constructor( @Application scope: CoroutineScope, headsUpNotificationInteractor: HeadsUpNotificationInteractor, private val sceneInteractor: SceneInteractor, sceneInteractor: SceneInteractor, private val keyguardInteractor: KeyguardInteractor, keyguardStatusBarInteractor: KeyguardStatusBarInteractor, private val userLogoutInteractor: UserLogoutInteractor, Loading @@ -70,13 +71,8 @@ constructor( flowOf(false) } private val _isVisible = MutableStateFlow(false) /** True if this view should be visible and false otherwise. */ val isVisible: StateFlow<Boolean> = _isVisible.asStateFlow() override suspend fun onActivated() { coroutineScope { launch { val isVisible: StateFlow<Boolean> = combine( sceneInteractor.currentScene, sceneInteractor.currentOverlays, Loading @@ -90,10 +86,7 @@ constructor( !isDozing && !showHeadsUpStatusBar } .collect { _isVisible.value = it } } } } .stateIn(scope, SharingStarted.WhileSubscribed(), false) /** True if the device's battery is currently charging and false otherwise. */ // Note: Never make this an eagerly-started state flow so that the callback is removed when the Loading packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/ui/viewmodel/KeyguardStatusBarViewModelKosmos.kt +2 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.systemui.statusbar.ui.viewmodel import com.android.systemui.keyguard.domain.interactor.keyguardInteractor import com.android.systemui.kosmos.Kosmos import com.android.systemui.kosmos.applicationCoroutineScope import com.android.systemui.scene.domain.interactor.sceneInteractor import com.android.systemui.statusbar.domain.interactor.keyguardStatusBarInteractor import com.android.systemui.statusbar.notification.stack.domain.interactor.headsUpNotificationInteractor Loading @@ -27,6 +28,7 @@ import com.android.systemui.user.domain.interactor.userLogoutInteractor val Kosmos.keyguardStatusBarViewModel: KeyguardStatusBarViewModel by Kosmos.Fixture { KeyguardStatusBarViewModel( applicationCoroutineScope, headsUpNotificationInteractor, sceneInteractor, keyguardInteractor, Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/ui/viewmodel/KeyguardStatusBarViewModelTest.kt +1 −0 Original line number Diff line number Diff line Loading @@ -92,6 +92,7 @@ class KeyguardStatusBarViewModelTest(flags: FlagsParameterization) : SysuiTestCa fun setup() { underTest = KeyguardStatusBarViewModel( testScope.backgroundScope, headsUpNotificationInteractor, kosmos.sceneInteractor, keyguardInteractor, Loading
packages/SystemUI/src/com/android/systemui/statusbar/ui/viewmodel/KeyguardStatusBarViewModel.kt +20 −27 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.systemui.statusbar.ui.viewmodel import com.android.systemui.Flags import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor import com.android.systemui.lifecycle.HydratedActivatable import com.android.systemui.scene.domain.interactor.SceneInteractor Loading @@ -32,16 +33,15 @@ import com.android.systemui.statusbar.policy.BatteryController.BatteryStateChang import com.android.systemui.user.domain.interactor.UserLogoutInteractor import com.android.systemui.utils.coroutines.flow.conflatedCallbackFlow import javax.inject.Inject import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.channels.awaitClose import kotlinx.coroutines.coroutineScope import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.SharingStarted import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.flow.map import kotlinx.coroutines.launch import kotlinx.coroutines.flow.stateIn /** * A view model for the status bar displayed on keyguard (lockscreen). Loading @@ -55,8 +55,9 @@ import kotlinx.coroutines.launch class KeyguardStatusBarViewModel @Inject constructor( @Application scope: CoroutineScope, headsUpNotificationInteractor: HeadsUpNotificationInteractor, private val sceneInteractor: SceneInteractor, sceneInteractor: SceneInteractor, private val keyguardInteractor: KeyguardInteractor, keyguardStatusBarInteractor: KeyguardStatusBarInteractor, private val userLogoutInteractor: UserLogoutInteractor, Loading @@ -70,13 +71,8 @@ constructor( flowOf(false) } private val _isVisible = MutableStateFlow(false) /** True if this view should be visible and false otherwise. */ val isVisible: StateFlow<Boolean> = _isVisible.asStateFlow() override suspend fun onActivated() { coroutineScope { launch { val isVisible: StateFlow<Boolean> = combine( sceneInteractor.currentScene, sceneInteractor.currentOverlays, Loading @@ -90,10 +86,7 @@ constructor( !isDozing && !showHeadsUpStatusBar } .collect { _isVisible.value = it } } } } .stateIn(scope, SharingStarted.WhileSubscribed(), false) /** True if the device's battery is currently charging and false otherwise. */ // Note: Never make this an eagerly-started state flow so that the callback is removed when the Loading
packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/ui/viewmodel/KeyguardStatusBarViewModelKosmos.kt +2 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.systemui.statusbar.ui.viewmodel import com.android.systemui.keyguard.domain.interactor.keyguardInteractor import com.android.systemui.kosmos.Kosmos import com.android.systemui.kosmos.applicationCoroutineScope import com.android.systemui.scene.domain.interactor.sceneInteractor import com.android.systemui.statusbar.domain.interactor.keyguardStatusBarInteractor import com.android.systemui.statusbar.notification.stack.domain.interactor.headsUpNotificationInteractor Loading @@ -27,6 +28,7 @@ import com.android.systemui.user.domain.interactor.userLogoutInteractor val Kosmos.keyguardStatusBarViewModel: KeyguardStatusBarViewModel by Kosmos.Fixture { KeyguardStatusBarViewModel( applicationCoroutineScope, headsUpNotificationInteractor, sceneInteractor, keyguardInteractor, Loading