Loading packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/interactor/SceneInteractorTest.kt +3 −1 Original line number Diff line number Diff line Loading @@ -49,6 +49,7 @@ import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.flow.toList import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before import org.junit.Test import org.junit.runner.RunWith Loading @@ -63,7 +64,8 @@ class SceneInteractorTest : SysuiTestCase() { private val underTest = kosmos.sceneInteractor init { @Before fun setUp() { // Init lazy Fixtures. Accessing them once makes sure that the singletons are initialized // and therefore starts to collect StateFlows eagerly (when there are any). kosmos.deviceUnlockedInteractor Loading packages/SystemUI/src/com/android/systemui/bouncer/domain/interactor/AlternateBouncerInteractor.kt +2 −5 Original line number Diff line number Diff line Loading @@ -102,11 +102,7 @@ constructor( if (alternateBouncerSupported) { combine( keyguardTransitionInteractor.get().currentKeyguardState, if (SceneContainerFlag.isEnabled) { sceneInteractor.get().currentScene } else { flowOf(Scenes.Lockscreen) }, sceneInteractor.get().currentScene, ::Pair ) .flatMapLatest { (currentKeyguardState, transitionState) -> Loading Loading @@ -220,6 +216,7 @@ constructor( return (systemClock.uptimeMillis() - bouncerRepository.lastAlternateBouncerVisibleTime) > MIN_VISIBILITY_DURATION_UNTIL_TOUCHES_DISMISS_ALTERNATE_BOUNCER_MS } /** * Should only be called through StatusBarKeyguardViewManager which propagates the source of * truth to other concerned controllers. Will hide the alternate bouncer if it's no longer Loading packages/SystemUI/src/com/android/systemui/communal/ui/viewmodel/CommunalEditModeViewModel.kt +5 −1 Original line number Diff line number Diff line Loading @@ -43,6 +43,7 @@ import com.android.systemui.log.dagger.CommunalLog import com.android.systemui.media.controls.ui.view.MediaHost import com.android.systemui.media.dagger.MediaModule import com.android.systemui.res.R import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.util.kotlin.BooleanFlowOperators.allOf import com.android.systemui.util.kotlin.BooleanFlowOperators.not import javax.inject.Inject Loading Loading @@ -93,7 +94,10 @@ constructor( */ val canShowEditMode = allOf( keyguardTransitionInteractor.isFinishedIn(KeyguardState.GONE), keyguardTransitionInteractor.isFinishedIn( scene = Scenes.Gone, stateWithoutSceneContainer = KeyguardState.GONE ), communalInteractor.editModeOpen ) .filter { it } Loading packages/SystemUI/src/com/android/systemui/deviceentry/data/repository/DeviceEntryFaceAuthRepository.kt +5 −2 Original line number Diff line number Diff line Loading @@ -303,7 +303,10 @@ constructor( private fun listenForSchedulingWatchdog() { keyguardTransitionInteractor .transition(Edge.create(to = KeyguardState.GONE)) .transition( edge = Edge.create(to = Scenes.Gone), edgeWithoutSceneContainer = Edge.create(to = KeyguardState.GONE), ) .filter { it.transitionState == TransitionState.FINISHED } .onEach { // We deliberately want to run this in background because scheduleWatchdog does Loading @@ -324,7 +327,7 @@ constructor( combine( keyguardTransitionInteractor.isFinishedIn( scene = Scenes.Gone, stateWithoutSceneContainer = KeyguardState.GONE stateWithoutSceneContainer = KeyguardState.GONE, ), keyguardInteractor.statusBarState, ) { isFinishedInGoneState, statusBarState -> Loading packages/SystemUI/src/com/android/systemui/keyguard/ResourceTrimmer.kt +4 −17 Original line number Diff line number Diff line Loading @@ -24,11 +24,7 @@ import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.dagger.qualifiers.Background import com.android.systemui.keyguard.domain.interactor.KeyguardTransitionInteractor import com.android.systemui.keyguard.shared.model.Edge import com.android.systemui.keyguard.shared.model.KeyguardState.GONE import com.android.systemui.keyguard.shared.model.TransitionState import com.android.systemui.scene.domain.interactor.SceneInteractor import com.android.systemui.scene.shared.flag.SceneContainerFlag import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.utils.GlobalWindowManager import javax.inject.Inject Loading @@ -52,24 +48,15 @@ constructor( private val globalWindowManager: GlobalWindowManager, @Application private val applicationScope: CoroutineScope, @Background private val bgDispatcher: CoroutineDispatcher, private val sceneInteractor: SceneInteractor, ) : CoreStartable { override fun start() { Log.d(LOG_TAG, "Resource trimmer registered.") applicationScope.launch(bgDispatcher) { // We drop 1 to avoid triggering on initial collect(). if (SceneContainerFlag.isEnabled) { sceneInteractor.transitionState .filter { it.isIdle(Scenes.Gone) } keyguardTransitionInteractor .isFinishedIn(scene = Scenes.Gone, stateWithoutSceneContainer = GONE) .filter { isOnGone -> isOnGone } .collect { onKeyguardGone() } } else { keyguardTransitionInteractor.transition(Edge.create(to = GONE)).collect { if (it.transitionState == TransitionState.FINISHED) { onKeyguardGone() } } } } } Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/interactor/SceneInteractorTest.kt +3 −1 Original line number Diff line number Diff line Loading @@ -49,6 +49,7 @@ import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.flow.toList import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before import org.junit.Test import org.junit.runner.RunWith Loading @@ -63,7 +64,8 @@ class SceneInteractorTest : SysuiTestCase() { private val underTest = kosmos.sceneInteractor init { @Before fun setUp() { // Init lazy Fixtures. Accessing them once makes sure that the singletons are initialized // and therefore starts to collect StateFlows eagerly (when there are any). kosmos.deviceUnlockedInteractor Loading
packages/SystemUI/src/com/android/systemui/bouncer/domain/interactor/AlternateBouncerInteractor.kt +2 −5 Original line number Diff line number Diff line Loading @@ -102,11 +102,7 @@ constructor( if (alternateBouncerSupported) { combine( keyguardTransitionInteractor.get().currentKeyguardState, if (SceneContainerFlag.isEnabled) { sceneInteractor.get().currentScene } else { flowOf(Scenes.Lockscreen) }, sceneInteractor.get().currentScene, ::Pair ) .flatMapLatest { (currentKeyguardState, transitionState) -> Loading Loading @@ -220,6 +216,7 @@ constructor( return (systemClock.uptimeMillis() - bouncerRepository.lastAlternateBouncerVisibleTime) > MIN_VISIBILITY_DURATION_UNTIL_TOUCHES_DISMISS_ALTERNATE_BOUNCER_MS } /** * Should only be called through StatusBarKeyguardViewManager which propagates the source of * truth to other concerned controllers. Will hide the alternate bouncer if it's no longer Loading
packages/SystemUI/src/com/android/systemui/communal/ui/viewmodel/CommunalEditModeViewModel.kt +5 −1 Original line number Diff line number Diff line Loading @@ -43,6 +43,7 @@ import com.android.systemui.log.dagger.CommunalLog import com.android.systemui.media.controls.ui.view.MediaHost import com.android.systemui.media.dagger.MediaModule import com.android.systemui.res.R import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.util.kotlin.BooleanFlowOperators.allOf import com.android.systemui.util.kotlin.BooleanFlowOperators.not import javax.inject.Inject Loading Loading @@ -93,7 +94,10 @@ constructor( */ val canShowEditMode = allOf( keyguardTransitionInteractor.isFinishedIn(KeyguardState.GONE), keyguardTransitionInteractor.isFinishedIn( scene = Scenes.Gone, stateWithoutSceneContainer = KeyguardState.GONE ), communalInteractor.editModeOpen ) .filter { it } Loading
packages/SystemUI/src/com/android/systemui/deviceentry/data/repository/DeviceEntryFaceAuthRepository.kt +5 −2 Original line number Diff line number Diff line Loading @@ -303,7 +303,10 @@ constructor( private fun listenForSchedulingWatchdog() { keyguardTransitionInteractor .transition(Edge.create(to = KeyguardState.GONE)) .transition( edge = Edge.create(to = Scenes.Gone), edgeWithoutSceneContainer = Edge.create(to = KeyguardState.GONE), ) .filter { it.transitionState == TransitionState.FINISHED } .onEach { // We deliberately want to run this in background because scheduleWatchdog does Loading @@ -324,7 +327,7 @@ constructor( combine( keyguardTransitionInteractor.isFinishedIn( scene = Scenes.Gone, stateWithoutSceneContainer = KeyguardState.GONE stateWithoutSceneContainer = KeyguardState.GONE, ), keyguardInteractor.statusBarState, ) { isFinishedInGoneState, statusBarState -> Loading
packages/SystemUI/src/com/android/systemui/keyguard/ResourceTrimmer.kt +4 −17 Original line number Diff line number Diff line Loading @@ -24,11 +24,7 @@ import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.dagger.qualifiers.Background import com.android.systemui.keyguard.domain.interactor.KeyguardTransitionInteractor import com.android.systemui.keyguard.shared.model.Edge import com.android.systemui.keyguard.shared.model.KeyguardState.GONE import com.android.systemui.keyguard.shared.model.TransitionState import com.android.systemui.scene.domain.interactor.SceneInteractor import com.android.systemui.scene.shared.flag.SceneContainerFlag import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.utils.GlobalWindowManager import javax.inject.Inject Loading @@ -52,24 +48,15 @@ constructor( private val globalWindowManager: GlobalWindowManager, @Application private val applicationScope: CoroutineScope, @Background private val bgDispatcher: CoroutineDispatcher, private val sceneInteractor: SceneInteractor, ) : CoreStartable { override fun start() { Log.d(LOG_TAG, "Resource trimmer registered.") applicationScope.launch(bgDispatcher) { // We drop 1 to avoid triggering on initial collect(). if (SceneContainerFlag.isEnabled) { sceneInteractor.transitionState .filter { it.isIdle(Scenes.Gone) } keyguardTransitionInteractor .isFinishedIn(scene = Scenes.Gone, stateWithoutSceneContainer = GONE) .filter { isOnGone -> isOnGone } .collect { onKeyguardGone() } } else { keyguardTransitionInteractor.transition(Edge.create(to = GONE)).collect { if (it.transitionState == TransitionState.FINISHED) { onKeyguardGone() } } } } } Loading