summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardWakeDirectlyToGoneInteractorTest.kt45
-rw-r--r--packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromAodTransitionInteractor.kt4
-rw-r--r--packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardWakeDirectlyToGoneInteractor.kt10
3 files changed, 54 insertions, 5 deletions
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardWakeDirectlyToGoneInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardWakeDirectlyToGoneInteractorTest.kt
index b0698555941c..98e3c68e6e33 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardWakeDirectlyToGoneInteractorTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardWakeDirectlyToGoneInteractorTest.kt
@@ -36,6 +36,7 @@ import com.android.systemui.keyguard.data.repository.fakeKeyguardRepository
import com.android.systemui.keyguard.data.repository.fakeKeyguardTransitionRepository
import com.android.systemui.keyguard.shared.model.BiometricUnlockMode
import com.android.systemui.keyguard.shared.model.KeyguardState
+import com.android.systemui.keyguard.shared.model.TransitionState
import com.android.systemui.kosmos.testScope
import com.android.systemui.power.domain.interactor.PowerInteractor.Companion.setAsleepForTest
import com.android.systemui.power.domain.interactor.PowerInteractor.Companion.setAwakeForTest
@@ -406,4 +407,48 @@ class KeyguardWakeDirectlyToGoneInteractorTest : SysuiTestCase() {
// It should not have any effect.
assertEquals(listOf(false, true, false, true), canWake)
}
+
+ @Test
+ @EnableFlags(Flags.FLAG_KEYGUARD_WM_STATE_REFACTOR)
+ fun testCanWakeDirectlyToGone_falseAsSoonAsTransitionsAwayFromGone() =
+ testScope.runTest {
+ val canWake by collectValues(underTest.canWakeDirectlyToGone)
+
+ assertEquals(
+ listOf(
+ false // Defaults to false.
+ ),
+ canWake,
+ )
+
+ transitionRepository.sendTransitionSteps(
+ from = KeyguardState.LOCKSCREEN,
+ to = KeyguardState.GONE,
+ testScope,
+ )
+
+ assertEquals(
+ listOf(
+ false,
+ true, // Because we're GONE.
+ ),
+ canWake,
+ )
+
+ transitionRepository.sendTransitionSteps(
+ from = KeyguardState.LOCKSCREEN,
+ to = KeyguardState.GONE,
+ testScope = testScope,
+ throughTransitionState = TransitionState.RUNNING,
+ )
+
+ assertEquals(
+ listOf(
+ false,
+ true,
+ false, // False as soon as we start a transition away from GONE.
+ ),
+ canWake,
+ )
+ }
}
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromAodTransitionInteractor.kt b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromAodTransitionInteractor.kt
index 9896365abff9..b42da5265d86 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromAodTransitionInteractor.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromAodTransitionInteractor.kt
@@ -132,6 +132,8 @@ constructor(
if (SceneContainerFlag.isEnabled) return@collect
startTransitionTo(
toState = KeyguardState.GONE,
+ modeOnCanceled = TransitionModeOnCanceled.REVERSE,
+ ownerReason = "canWakeDirectlyToGone = true",
)
} else if (shouldTransitionToLockscreen) {
val modeOnCanceled =
@@ -146,7 +148,7 @@ constructor(
startTransitionTo(
toState = KeyguardState.LOCKSCREEN,
modeOnCanceled = modeOnCanceled,
- ownerReason = "listen for aod to awake"
+ ownerReason = "listen for aod to awake",
)
} else if (shouldTransitionToOccluded) {
startTransitionTo(
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardWakeDirectlyToGoneInteractor.kt b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardWakeDirectlyToGoneInteractor.kt
index a133f06b3f41..3bdc32dce6f5 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardWakeDirectlyToGoneInteractor.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardWakeDirectlyToGoneInteractor.kt
@@ -116,9 +116,10 @@ constructor(
* - We're wake and unlocking (fingerprint auth occurred while asleep).
* - We're allowed to ignore auth and return to GONE, due to timeouts not elapsing.
* - We're DREAMING and dismissible.
- * - We're already GONE. Technically you're already awake when GONE, but this makes it easier to
- * reason about this state (for example, if canWakeDirectlyToGone, don't tell WM to pause the
- * top activity - something you should never do while GONE as well).
+ * - We're already GONE and not transitioning out of GONE. Technically you're already awake when
+ * GONE, but this makes it easier to reason about this state (for example, if
+ * canWakeDirectlyToGone, don't tell WM to pause the top activity - something you should never
+ * do while GONE as well).
*/
val canWakeDirectlyToGone =
combine(
@@ -138,7 +139,8 @@ constructor(
canIgnoreAuthAndReturnToGone ||
(currentState == KeyguardState.DREAMING &&
keyguardInteractor.isKeyguardDismissible.value) ||
- currentState == KeyguardState.GONE
+ (currentState == KeyguardState.GONE &&
+ transitionInteractor.getStartedState() == KeyguardState.GONE)
}
.distinctUntilChanged()