summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/startable/SceneContainerStartableTest.kt30
-rw-r--r--packages/SystemUI/src/com/android/systemui/scene/domain/startable/SceneContainerStartable.kt17
2 files changed, 40 insertions, 7 deletions
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/startable/SceneContainerStartableTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/startable/SceneContainerStartableTest.kt
index 36859e729daa..e8ffbc033f07 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/startable/SceneContainerStartableTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/startable/SceneContainerStartableTest.kt
@@ -472,7 +472,7 @@ class SceneContainerStartableTest : SysuiTestCase() {
}
@Test
- fun doesNotSwitchToGoneWhenDeviceStartsToWakeUp_authMethodSecure() =
+ fun doesNotSwitchToGone_whenDeviceStartsToWakeUp_authMethodSecure() =
testScope.runTest {
val currentSceneKey by collectLastValue(sceneInteractor.currentScene)
prepareState(
@@ -487,6 +487,34 @@ class SceneContainerStartableTest : SysuiTestCase() {
}
@Test
+ fun doesNotSwitchToGone_whenDeviceStartsToWakeUp_ifAlreadyTransitioningToLockscreen() =
+ testScope.runTest {
+ val currentSceneKey by collectLastValue(sceneInteractor.currentScene)
+ val transitioningTo by collectLastValue(sceneInteractor.transitioningTo)
+ val transitionStateFlow =
+ prepareState(
+ isDeviceUnlocked = true,
+ initialSceneKey = Scenes.Gone,
+ authenticationMethod = AuthenticationMethodModel.Pin,
+ )
+ transitionStateFlow.value =
+ ObservableTransitionState.Transition(
+ fromScene = Scenes.Gone,
+ toScene = Scenes.Lockscreen,
+ progress = flowOf(0.1f),
+ isInitiatedByUserInput = false,
+ isUserInputOngoing = flowOf(false),
+ )
+ assertThat(currentSceneKey).isEqualTo(Scenes.Gone)
+ assertThat(transitioningTo).isEqualTo(Scenes.Lockscreen)
+ underTest.start()
+ powerInteractor.setAwakeForTest()
+
+ assertThat(currentSceneKey).isEqualTo(Scenes.Gone)
+ assertThat(transitioningTo).isEqualTo(Scenes.Lockscreen)
+ }
+
+ @Test
fun switchToGoneWhenDeviceStartsToWakeUp_authMethodSecure_deviceUnlocked() =
testScope.runTest {
val currentSceneKey by collectLastValue(sceneInteractor.currentScene)
diff --git a/packages/SystemUI/src/com/android/systemui/scene/domain/startable/SceneContainerStartable.kt b/packages/SystemUI/src/com/android/systemui/scene/domain/startable/SceneContainerStartable.kt
index e911ce17b395..e1b46df308a5 100644
--- a/packages/SystemUI/src/com/android/systemui/scene/domain/startable/SceneContainerStartable.kt
+++ b/packages/SystemUI/src/com/android/systemui/scene/domain/startable/SceneContainerStartable.kt
@@ -294,12 +294,17 @@ constructor(
val canSwipeToEnter = deviceEntryInteractor.canSwipeToEnter.value
val isUnlocked = deviceEntryInteractor.isUnlocked.value
if (isUnlocked && canSwipeToEnter == false) {
- switchToScene(
- targetSceneKey = Scenes.Gone,
- loggingReason =
- "device is waking up while unlocked without the ability" +
- " to swipe up on lockscreen to enter.",
- )
+ val isTransitioningToLockscreen =
+ sceneInteractor.transitioningTo.value == Scenes.Lockscreen
+ if (!isTransitioningToLockscreen) {
+ switchToScene(
+ targetSceneKey = Scenes.Gone,
+ loggingReason =
+ "device is waking up while unlocked without the ability to" +
+ " swipe up on lockscreen to enter and not on or" +
+ " transitioning to, the lockscreen scene.",
+ )
+ }
} else if (
authenticationInteractor.get().getAuthenticationMethod() ==
AuthenticationMethodModel.Sim