Loading packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardTransitionInteractorTest.kt +106 −10 Original line number Diff line number Diff line Loading @@ -40,7 +40,10 @@ import com.android.systemui.keyguard.shared.model.TransitionState.RUNNING import com.android.systemui.keyguard.shared.model.TransitionState.STARTED import com.android.systemui.keyguard.shared.model.TransitionStep import com.android.systemui.kosmos.testScope import com.android.systemui.scene.data.repository.Idle import com.android.systemui.scene.data.repository.Transition import com.android.systemui.scene.data.repository.sceneContainerRepository import com.android.systemui.scene.data.repository.setSceneTransition import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat Loading Loading @@ -527,7 +530,13 @@ class KeyguardTransitionInteractorTest : SysuiTestCase() { @DisableSceneContainer fun isInTransitionToState() = testScope.runTest { val results by collectValues(underTest.isInTransitionToState(GONE)) val results by collectValues( underTest.isInTransition( edge = Edge.create(OFF, OFF), edgeWithoutSceneContainer = Edge.create(to = LOCKSCREEN) ) ) sendSteps( TransitionStep(AOD, DOZING, 0f, STARTED), Loading @@ -543,7 +552,7 @@ class KeyguardTransitionInteractorTest : SysuiTestCase() { ) sendSteps( TransitionStep(DOZING, GONE, 0f, STARTED), TransitionStep(DOZING, LOCKSCREEN, 0f, STARTED), ) assertThat(results) Loading @@ -555,7 +564,7 @@ class KeyguardTransitionInteractorTest : SysuiTestCase() { ) sendSteps( TransitionStep(DOZING, GONE, 0f, RUNNING), TransitionStep(DOZING, LOCKSCREEN, 0f, RUNNING), ) assertThat(results) Loading @@ -567,7 +576,7 @@ class KeyguardTransitionInteractorTest : SysuiTestCase() { ) sendSteps( TransitionStep(DOZING, GONE, 0f, FINISHED), TransitionStep(DOZING, LOCKSCREEN, 0f, FINISHED), ) assertThat(results) Loading @@ -580,9 +589,9 @@ class KeyguardTransitionInteractorTest : SysuiTestCase() { ) sendSteps( TransitionStep(GONE, DOZING, 0f, STARTED), TransitionStep(GONE, DOZING, 0f, RUNNING), TransitionStep(GONE, DOZING, 1f, FINISHED), TransitionStep(LOCKSCREEN, DOZING, 0f, STARTED), TransitionStep(LOCKSCREEN, DOZING, 0f, RUNNING), TransitionStep(LOCKSCREEN, DOZING, 1f, FINISHED), ) assertThat(results) Loading @@ -595,8 +604,8 @@ class KeyguardTransitionInteractorTest : SysuiTestCase() { ) sendSteps( TransitionStep(DOZING, GONE, 0f, STARTED), TransitionStep(DOZING, GONE, 0f, RUNNING), TransitionStep(DOZING, LOCKSCREEN, 0f, STARTED), TransitionStep(DOZING, LOCKSCREEN, 0f, RUNNING), ) assertThat(results) Loading @@ -610,10 +619,97 @@ class KeyguardTransitionInteractorTest : SysuiTestCase() { ) } @Test @EnableSceneContainer fun isInTransitionFromScene() = testScope.runTest { val results by collectValues(underTest.isInTransition(edge = Edge.create(Scenes.Lockscreen, null))) kosmos.setSceneTransition(Transition(from = Scenes.Gone, to = Scenes.Lockscreen)) kosmos.setSceneTransition(Idle(Scenes.Lockscreen)) assertThat(results) .isEqualTo( listOf( false, ) ) kosmos.setSceneTransition(Transition(from = Scenes.Lockscreen, to = Scenes.Shade)) assertThat(results) .isEqualTo( listOf( false, true, ) ) kosmos.setSceneTransition(Idle(Scenes.Shade)) assertThat(results) .isEqualTo( listOf( false, true, false, ) ) } @Test @EnableSceneContainer fun isInTransitionToScene() = testScope.runTest { val results by collectValues(underTest.isInTransition(edge = Edge.create(null, Scenes.Lockscreen))) kosmos.setSceneTransition(Transition(from = Scenes.Gone, to = Scenes.Lockscreen)) kosmos.setSceneTransition(Idle(Scenes.Lockscreen)) kosmos.setSceneTransition(Transition(from = Scenes.Lockscreen, to = Scenes.Gone)) assertThat(results) .isEqualTo( listOf( false, true, false, ) ) } @Test @EnableSceneContainer fun isInTransitionStateToScene() = testScope.runTest { val results by collectValues(underTest.isInTransition(edge = Edge.create(AOD, Scenes.Gone))) kosmos.setSceneTransition(Transition(from = Scenes.Lockscreen, to = Scenes.Gone)) sendSteps( TransitionStep(AOD, UNDEFINED, 0f, STARTED), TransitionStep(AOD, UNDEFINED, 0.5f, RUNNING), TransitionStep(AOD, UNDEFINED, 1f, FINISHED), ) kosmos.setSceneTransition(Idle(Scenes.Gone)) assertThat(results) .isEqualTo( listOf( false, true, false, ) ) } @Test fun isInTransitionFromState() = testScope.runTest { val results by collectValues(underTest.isInTransitionFromState(DOZING)) val results by collectValues(underTest.isInTransition(Edge.create(from = DOZING))) sendSteps( TransitionStep(AOD, DOZING, 0f, STARTED), Loading packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/InWindowLauncherUnlockAnimationInteractor.kt +7 −2 Original line number Diff line number Diff line Loading @@ -20,7 +20,9 @@ import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.keyguard.data.repository.InWindowLauncherUnlockAnimationRepository import com.android.systemui.keyguard.data.repository.KeyguardSurfaceBehindRepository import com.android.systemui.keyguard.shared.model.KeyguardState import com.android.systemui.keyguard.shared.model.Edge import com.android.systemui.keyguard.shared.model.KeyguardState.GONE import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.shared.system.ActivityManagerWrapper import com.android.systemui.shared.system.smartspace.SmartspaceState import javax.inject.Inject Loading Loading @@ -50,7 +52,10 @@ constructor( */ val transitioningToGoneWithInWindowAnimation: StateFlow<Boolean> = transitionInteractor .isInTransitionToState(KeyguardState.GONE) .isInTransition( edge = Edge.create(to = Scenes.Gone), edgeWithoutSceneContainer = Edge.create(to = GONE) ) .map { transitioningToGone -> transitioningToGone && isLauncherUnderneath() } .stateIn(scope, SharingStarted.Eagerly, false) Loading packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardTransitionInteractor.kt +19 −29 Original line number Diff line number Diff line Loading @@ -180,7 +180,7 @@ constructor( val fromScene = when (edge) { is Edge.StateToState -> edge.from?.mapToSceneContainerScene() is Edge.StateToScene -> edge.from.mapToSceneContainerScene() is Edge.StateToScene -> edge.from?.mapToSceneContainerScene() is Edge.SceneToState -> edge.from } Loading @@ -188,7 +188,7 @@ constructor( when (edge) { is Edge.StateToState -> edge.to?.mapToSceneContainerScene() is Edge.StateToScene -> edge.to is Edge.SceneToState -> edge.to.mapToSceneContainerScene() is Edge.SceneToState -> edge.to?.mapToSceneContainerScene() } fun SceneKey?.isLockscreenOrNull() = this == Scenes.Lockscreen || this == null Loading Loading @@ -450,16 +450,6 @@ constructor( } } /** Whether we're in a transition to the given [KeyguardState], but haven't yet completed it. */ fun isInTransitionToState( state: KeyguardState, ): Flow<Boolean> { return transition(Edge.create(from = null, to = state)) .mapLatest { it.transitionState.isTransitioning() } .onStart { emit(false) } .distinctUntilChanged() } /** * Whether we're in a transition to and from the given [KeyguardState]s, but haven't yet * completed it. Loading @@ -469,23 +459,23 @@ constructor( */ fun isInTransition(edge: Edge, edgeWithoutSceneContainer: Edge? = null): Flow<Boolean> { return if (SceneContainerFlag.isEnabled) { transition(edge) if (edge.isSceneWildcardEdge()) { sceneInteractor.get().transitionState.map { when (edge) { is Edge.StateToState -> throw IllegalStateException("Should not be reachable.") is Edge.SceneToState -> it.isTransitioning(from = edge.from) is Edge.StateToScene -> it.isTransitioning(to = edge.to) } } } else { transition(edgeWithoutSceneContainer ?: edge) transition(edge).mapLatest { it.transitionState.isTransitioning() } } } else { transition(edgeWithoutSceneContainer ?: edge).mapLatest { it.transitionState.isTransitioning() } .mapLatest { it.transitionState.isTransitioning() } .onStart { emit(false) } .distinctUntilChanged() } /** * Whether we're in a transition out of the given [KeyguardState], but haven't yet completed it. */ fun isInTransitionFromState( state: KeyguardState, ): Flow<Boolean> { return transition(Edge.create(from = state, to = null)) .mapLatest { it.transitionState.isTransitioning() } .onStart { emit(false) } .distinctUntilChanged() } Loading @@ -494,7 +484,7 @@ constructor( * Whether we're in a transition to a [KeyguardState] that matches the given predicate, but * haven't yet completed it. * * If you only care about a single state, instead use the optimized [isInTransitionToState]. * If you only care about a single state, instead use the optimized [isInTransition]. */ fun isInTransitionToStateWhere( stateMatcher: (KeyguardState) -> Boolean, Loading @@ -506,7 +496,7 @@ constructor( * Whether we're in a transition out of a [KeyguardState] that matches the given predicate, but * haven't yet completed it. * * If you only care about a single state, instead use the optimized [isInTransitionFromState]. * If you only care about a single state, instead use the optimized [isInTransition]. */ fun isInTransitionFromStateWhere( stateMatcher: (KeyguardState) -> Boolean, Loading packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/WindowManagerLockscreenVisibilityInteractor.kt +5 −1 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ package com.android.systemui.keyguard.domain.interactor import com.android.systemui.dagger.SysUISingleton import com.android.systemui.deviceentry.domain.interactor.DeviceEntryInteractor import com.android.systemui.keyguard.shared.model.BiometricUnlockMode import com.android.systemui.keyguard.shared.model.Edge import com.android.systemui.keyguard.shared.model.KeyguardState import com.android.systemui.keyguard.shared.model.TransitionState import com.android.systemui.scene.domain.interactor.SceneInteractor Loading Loading @@ -132,7 +133,10 @@ constructor( .distinctUntilChanged() } else { combine( transitionInteractor.isInTransitionToState(KeyguardState.GONE), transitionInteractor.isInTransition( edge = Edge.create(to = Scenes.Gone), edgeWithoutSceneContainer = Edge.create(to = KeyguardState.GONE) ), transitionInteractor.finishedKeyguardState, surfaceBehindInteractor.isAnimatingSurface, notificationLaunchAnimationInteractor.isLaunchAnimationRunning, Loading packages/SystemUI/src/com/android/systemui/keyguard/shared/model/Edge.kt +13 −20 Original line number Diff line number Diff line Loading @@ -23,11 +23,6 @@ import com.android.systemui.scene.shared.flag.SceneContainerFlag /** * Represents an edge either between two Keyguard Transition Framework states (KTF) or a KTF state * and a scene container scene. Passing [null] in either [from] or [to] indicates a wildcard. * * Wildcards are not allowed for transitions involving a scene. Use [sceneInteractor] directly * instead. Reason: [TransitionStep]s are not emitted for every edge leading into/out of a scene. * For example: Lockscreen -> Gone would be emitted as LOCKSCREEN -> UNDEFINED but Bouncer -> Gone * would not emit anything. */ sealed class Edge { Loading Loading @@ -59,17 +54,6 @@ sealed class Edge { Please remove or port this edge to scene container.""" .trimIndent(), ) } else if ((fromChanged && to == null) || (toChanged && from == null)) { Log.e( TAG, """ The edge ${from?.name} => ${to?.name} was automatically converted to ${mappedFrom?.name} => ${mappedTo?.name}. Wildcards are not allowed together with UNDEFINED because it will only be tracking edges leading in and out of the Lockscreen scene but miss others. Please remove or port this edge.""" .trimIndent(), Exception() ) } else if (fromChanged || toChanged) { Log.w( TAG, Loading @@ -90,23 +74,32 @@ sealed class Edge { } } fun isSceneWildcardEdge(): Boolean { return when (this) { is StateToState -> false is SceneToState -> to == null is StateToScene -> from == null } } data class StateToState(val from: KeyguardState?, val to: KeyguardState?) : Edge() { init { check(!(from == null && to == null)) { "to and from can't both be null" } } } data class StateToScene(val from: KeyguardState, val to: SceneKey) : Edge() data class StateToScene(val from: KeyguardState? = null, val to: SceneKey) : Edge() data class SceneToState(val from: SceneKey, val to: KeyguardState) : Edge() data class SceneToState(val from: SceneKey, val to: KeyguardState? = null) : Edge() companion object { private const val TAG = "Edge" fun create(from: KeyguardState? = null, to: KeyguardState? = null) = StateToState(from, to) fun create(from: KeyguardState, to: SceneKey) = StateToScene(from, to) fun create(from: KeyguardState? = null, to: SceneKey) = StateToScene(from, to) fun create(from: SceneKey, to: KeyguardState) = SceneToState(from, to) fun create(from: SceneKey, to: KeyguardState? = null) = SceneToState(from, to) } } Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardTransitionInteractorTest.kt +106 −10 Original line number Diff line number Diff line Loading @@ -40,7 +40,10 @@ import com.android.systemui.keyguard.shared.model.TransitionState.RUNNING import com.android.systemui.keyguard.shared.model.TransitionState.STARTED import com.android.systemui.keyguard.shared.model.TransitionStep import com.android.systemui.kosmos.testScope import com.android.systemui.scene.data.repository.Idle import com.android.systemui.scene.data.repository.Transition import com.android.systemui.scene.data.repository.sceneContainerRepository import com.android.systemui.scene.data.repository.setSceneTransition import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat Loading Loading @@ -527,7 +530,13 @@ class KeyguardTransitionInteractorTest : SysuiTestCase() { @DisableSceneContainer fun isInTransitionToState() = testScope.runTest { val results by collectValues(underTest.isInTransitionToState(GONE)) val results by collectValues( underTest.isInTransition( edge = Edge.create(OFF, OFF), edgeWithoutSceneContainer = Edge.create(to = LOCKSCREEN) ) ) sendSteps( TransitionStep(AOD, DOZING, 0f, STARTED), Loading @@ -543,7 +552,7 @@ class KeyguardTransitionInteractorTest : SysuiTestCase() { ) sendSteps( TransitionStep(DOZING, GONE, 0f, STARTED), TransitionStep(DOZING, LOCKSCREEN, 0f, STARTED), ) assertThat(results) Loading @@ -555,7 +564,7 @@ class KeyguardTransitionInteractorTest : SysuiTestCase() { ) sendSteps( TransitionStep(DOZING, GONE, 0f, RUNNING), TransitionStep(DOZING, LOCKSCREEN, 0f, RUNNING), ) assertThat(results) Loading @@ -567,7 +576,7 @@ class KeyguardTransitionInteractorTest : SysuiTestCase() { ) sendSteps( TransitionStep(DOZING, GONE, 0f, FINISHED), TransitionStep(DOZING, LOCKSCREEN, 0f, FINISHED), ) assertThat(results) Loading @@ -580,9 +589,9 @@ class KeyguardTransitionInteractorTest : SysuiTestCase() { ) sendSteps( TransitionStep(GONE, DOZING, 0f, STARTED), TransitionStep(GONE, DOZING, 0f, RUNNING), TransitionStep(GONE, DOZING, 1f, FINISHED), TransitionStep(LOCKSCREEN, DOZING, 0f, STARTED), TransitionStep(LOCKSCREEN, DOZING, 0f, RUNNING), TransitionStep(LOCKSCREEN, DOZING, 1f, FINISHED), ) assertThat(results) Loading @@ -595,8 +604,8 @@ class KeyguardTransitionInteractorTest : SysuiTestCase() { ) sendSteps( TransitionStep(DOZING, GONE, 0f, STARTED), TransitionStep(DOZING, GONE, 0f, RUNNING), TransitionStep(DOZING, LOCKSCREEN, 0f, STARTED), TransitionStep(DOZING, LOCKSCREEN, 0f, RUNNING), ) assertThat(results) Loading @@ -610,10 +619,97 @@ class KeyguardTransitionInteractorTest : SysuiTestCase() { ) } @Test @EnableSceneContainer fun isInTransitionFromScene() = testScope.runTest { val results by collectValues(underTest.isInTransition(edge = Edge.create(Scenes.Lockscreen, null))) kosmos.setSceneTransition(Transition(from = Scenes.Gone, to = Scenes.Lockscreen)) kosmos.setSceneTransition(Idle(Scenes.Lockscreen)) assertThat(results) .isEqualTo( listOf( false, ) ) kosmos.setSceneTransition(Transition(from = Scenes.Lockscreen, to = Scenes.Shade)) assertThat(results) .isEqualTo( listOf( false, true, ) ) kosmos.setSceneTransition(Idle(Scenes.Shade)) assertThat(results) .isEqualTo( listOf( false, true, false, ) ) } @Test @EnableSceneContainer fun isInTransitionToScene() = testScope.runTest { val results by collectValues(underTest.isInTransition(edge = Edge.create(null, Scenes.Lockscreen))) kosmos.setSceneTransition(Transition(from = Scenes.Gone, to = Scenes.Lockscreen)) kosmos.setSceneTransition(Idle(Scenes.Lockscreen)) kosmos.setSceneTransition(Transition(from = Scenes.Lockscreen, to = Scenes.Gone)) assertThat(results) .isEqualTo( listOf( false, true, false, ) ) } @Test @EnableSceneContainer fun isInTransitionStateToScene() = testScope.runTest { val results by collectValues(underTest.isInTransition(edge = Edge.create(AOD, Scenes.Gone))) kosmos.setSceneTransition(Transition(from = Scenes.Lockscreen, to = Scenes.Gone)) sendSteps( TransitionStep(AOD, UNDEFINED, 0f, STARTED), TransitionStep(AOD, UNDEFINED, 0.5f, RUNNING), TransitionStep(AOD, UNDEFINED, 1f, FINISHED), ) kosmos.setSceneTransition(Idle(Scenes.Gone)) assertThat(results) .isEqualTo( listOf( false, true, false, ) ) } @Test fun isInTransitionFromState() = testScope.runTest { val results by collectValues(underTest.isInTransitionFromState(DOZING)) val results by collectValues(underTest.isInTransition(Edge.create(from = DOZING))) sendSteps( TransitionStep(AOD, DOZING, 0f, STARTED), Loading
packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/InWindowLauncherUnlockAnimationInteractor.kt +7 −2 Original line number Diff line number Diff line Loading @@ -20,7 +20,9 @@ import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.keyguard.data.repository.InWindowLauncherUnlockAnimationRepository import com.android.systemui.keyguard.data.repository.KeyguardSurfaceBehindRepository import com.android.systemui.keyguard.shared.model.KeyguardState import com.android.systemui.keyguard.shared.model.Edge import com.android.systemui.keyguard.shared.model.KeyguardState.GONE import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.shared.system.ActivityManagerWrapper import com.android.systemui.shared.system.smartspace.SmartspaceState import javax.inject.Inject Loading Loading @@ -50,7 +52,10 @@ constructor( */ val transitioningToGoneWithInWindowAnimation: StateFlow<Boolean> = transitionInteractor .isInTransitionToState(KeyguardState.GONE) .isInTransition( edge = Edge.create(to = Scenes.Gone), edgeWithoutSceneContainer = Edge.create(to = GONE) ) .map { transitioningToGone -> transitioningToGone && isLauncherUnderneath() } .stateIn(scope, SharingStarted.Eagerly, false) Loading
packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardTransitionInteractor.kt +19 −29 Original line number Diff line number Diff line Loading @@ -180,7 +180,7 @@ constructor( val fromScene = when (edge) { is Edge.StateToState -> edge.from?.mapToSceneContainerScene() is Edge.StateToScene -> edge.from.mapToSceneContainerScene() is Edge.StateToScene -> edge.from?.mapToSceneContainerScene() is Edge.SceneToState -> edge.from } Loading @@ -188,7 +188,7 @@ constructor( when (edge) { is Edge.StateToState -> edge.to?.mapToSceneContainerScene() is Edge.StateToScene -> edge.to is Edge.SceneToState -> edge.to.mapToSceneContainerScene() is Edge.SceneToState -> edge.to?.mapToSceneContainerScene() } fun SceneKey?.isLockscreenOrNull() = this == Scenes.Lockscreen || this == null Loading Loading @@ -450,16 +450,6 @@ constructor( } } /** Whether we're in a transition to the given [KeyguardState], but haven't yet completed it. */ fun isInTransitionToState( state: KeyguardState, ): Flow<Boolean> { return transition(Edge.create(from = null, to = state)) .mapLatest { it.transitionState.isTransitioning() } .onStart { emit(false) } .distinctUntilChanged() } /** * Whether we're in a transition to and from the given [KeyguardState]s, but haven't yet * completed it. Loading @@ -469,23 +459,23 @@ constructor( */ fun isInTransition(edge: Edge, edgeWithoutSceneContainer: Edge? = null): Flow<Boolean> { return if (SceneContainerFlag.isEnabled) { transition(edge) if (edge.isSceneWildcardEdge()) { sceneInteractor.get().transitionState.map { when (edge) { is Edge.StateToState -> throw IllegalStateException("Should not be reachable.") is Edge.SceneToState -> it.isTransitioning(from = edge.from) is Edge.StateToScene -> it.isTransitioning(to = edge.to) } } } else { transition(edgeWithoutSceneContainer ?: edge) transition(edge).mapLatest { it.transitionState.isTransitioning() } } } else { transition(edgeWithoutSceneContainer ?: edge).mapLatest { it.transitionState.isTransitioning() } .mapLatest { it.transitionState.isTransitioning() } .onStart { emit(false) } .distinctUntilChanged() } /** * Whether we're in a transition out of the given [KeyguardState], but haven't yet completed it. */ fun isInTransitionFromState( state: KeyguardState, ): Flow<Boolean> { return transition(Edge.create(from = state, to = null)) .mapLatest { it.transitionState.isTransitioning() } .onStart { emit(false) } .distinctUntilChanged() } Loading @@ -494,7 +484,7 @@ constructor( * Whether we're in a transition to a [KeyguardState] that matches the given predicate, but * haven't yet completed it. * * If you only care about a single state, instead use the optimized [isInTransitionToState]. * If you only care about a single state, instead use the optimized [isInTransition]. */ fun isInTransitionToStateWhere( stateMatcher: (KeyguardState) -> Boolean, Loading @@ -506,7 +496,7 @@ constructor( * Whether we're in a transition out of a [KeyguardState] that matches the given predicate, but * haven't yet completed it. * * If you only care about a single state, instead use the optimized [isInTransitionFromState]. * If you only care about a single state, instead use the optimized [isInTransition]. */ fun isInTransitionFromStateWhere( stateMatcher: (KeyguardState) -> Boolean, Loading
packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/WindowManagerLockscreenVisibilityInteractor.kt +5 −1 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ package com.android.systemui.keyguard.domain.interactor import com.android.systemui.dagger.SysUISingleton import com.android.systemui.deviceentry.domain.interactor.DeviceEntryInteractor import com.android.systemui.keyguard.shared.model.BiometricUnlockMode import com.android.systemui.keyguard.shared.model.Edge import com.android.systemui.keyguard.shared.model.KeyguardState import com.android.systemui.keyguard.shared.model.TransitionState import com.android.systemui.scene.domain.interactor.SceneInteractor Loading Loading @@ -132,7 +133,10 @@ constructor( .distinctUntilChanged() } else { combine( transitionInteractor.isInTransitionToState(KeyguardState.GONE), transitionInteractor.isInTransition( edge = Edge.create(to = Scenes.Gone), edgeWithoutSceneContainer = Edge.create(to = KeyguardState.GONE) ), transitionInteractor.finishedKeyguardState, surfaceBehindInteractor.isAnimatingSurface, notificationLaunchAnimationInteractor.isLaunchAnimationRunning, Loading
packages/SystemUI/src/com/android/systemui/keyguard/shared/model/Edge.kt +13 −20 Original line number Diff line number Diff line Loading @@ -23,11 +23,6 @@ import com.android.systemui.scene.shared.flag.SceneContainerFlag /** * Represents an edge either between two Keyguard Transition Framework states (KTF) or a KTF state * and a scene container scene. Passing [null] in either [from] or [to] indicates a wildcard. * * Wildcards are not allowed for transitions involving a scene. Use [sceneInteractor] directly * instead. Reason: [TransitionStep]s are not emitted for every edge leading into/out of a scene. * For example: Lockscreen -> Gone would be emitted as LOCKSCREEN -> UNDEFINED but Bouncer -> Gone * would not emit anything. */ sealed class Edge { Loading Loading @@ -59,17 +54,6 @@ sealed class Edge { Please remove or port this edge to scene container.""" .trimIndent(), ) } else if ((fromChanged && to == null) || (toChanged && from == null)) { Log.e( TAG, """ The edge ${from?.name} => ${to?.name} was automatically converted to ${mappedFrom?.name} => ${mappedTo?.name}. Wildcards are not allowed together with UNDEFINED because it will only be tracking edges leading in and out of the Lockscreen scene but miss others. Please remove or port this edge.""" .trimIndent(), Exception() ) } else if (fromChanged || toChanged) { Log.w( TAG, Loading @@ -90,23 +74,32 @@ sealed class Edge { } } fun isSceneWildcardEdge(): Boolean { return when (this) { is StateToState -> false is SceneToState -> to == null is StateToScene -> from == null } } data class StateToState(val from: KeyguardState?, val to: KeyguardState?) : Edge() { init { check(!(from == null && to == null)) { "to and from can't both be null" } } } data class StateToScene(val from: KeyguardState, val to: SceneKey) : Edge() data class StateToScene(val from: KeyguardState? = null, val to: SceneKey) : Edge() data class SceneToState(val from: SceneKey, val to: KeyguardState) : Edge() data class SceneToState(val from: SceneKey, val to: KeyguardState? = null) : Edge() companion object { private const val TAG = "Edge" fun create(from: KeyguardState? = null, to: KeyguardState? = null) = StateToState(from, to) fun create(from: KeyguardState, to: SceneKey) = StateToScene(from, to) fun create(from: KeyguardState? = null, to: SceneKey) = StateToScene(from, to) fun create(from: SceneKey, to: KeyguardState) = SceneToState(from, to) fun create(from: SceneKey, to: KeyguardState? = null) = SceneToState(from, to) } }