summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/WindowManagerLockscreenVisibilityInteractorTest.kt35
-rw-r--r--packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/WindowManagerLockscreenVisibilityInteractor.kt15
-rw-r--r--packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/data/repository/FakeKeyguardTransitionRepository.kt33
3 files changed, 65 insertions, 18 deletions
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/WindowManagerLockscreenVisibilityInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/WindowManagerLockscreenVisibilityInteractorTest.kt
index 9d5bf4dbdc3f..a276f514b779 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/WindowManagerLockscreenVisibilityInteractorTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/WindowManagerLockscreenVisibilityInteractorTest.kt
@@ -1045,6 +1045,41 @@ class WindowManagerLockscreenVisibilityInteractorTest : SysuiTestCase() {
assertThat(usingKeyguardGoingAwayAnimation).isFalse()
}
+ @Test
+ fun aodVisibility_visibleFullyInAod_falseOtherwise() =
+ testScope.runTest {
+ val aodVisibility by collectValues(underTest.value.aodVisibility)
+
+ transitionRepository.sendTransitionStepsThroughRunning(
+ from = KeyguardState.LOCKSCREEN,
+ to = KeyguardState.AOD,
+ testScope,
+ throughValue = 0.5f,
+ )
+
+ assertEquals(listOf(false), aodVisibility)
+
+ transitionRepository.sendTransitionStep(
+ TransitionStep(
+ transitionState = TransitionState.FINISHED,
+ from = KeyguardState.LOCKSCREEN,
+ to = KeyguardState.AOD,
+ )
+ )
+ runCurrent()
+
+ assertEquals(listOf(false, true), aodVisibility)
+
+ transitionRepository.sendTransitionStepsThroughRunning(
+ from = KeyguardState.AOD,
+ to = KeyguardState.GONE,
+ testScope,
+ )
+ runCurrent()
+
+ assertEquals(listOf(false, true, false), aodVisibility)
+ }
+
companion object {
private val progress = MutableStateFlow(0f)
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/WindowManagerLockscreenVisibilityInteractor.kt b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/WindowManagerLockscreenVisibilityInteractor.kt
index 184f30237e8d..6a354821f628 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/WindowManagerLockscreenVisibilityInteractor.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/WindowManagerLockscreenVisibilityInteractor.kt
@@ -24,7 +24,6 @@ import com.android.systemui.Flags.transitionRaceCondition
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.deviceentry.domain.interactor.DeviceEntryInteractor
import com.android.systemui.keyguard.data.repository.KeyguardTransitionRepository
-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.KeyguardState.Companion.deviceIsAsleepInState
@@ -331,17 +330,9 @@ constructor(
* clock/smartspace/notif icons are visible.
*/
val aodVisibility: Flow<Boolean> =
- combine(
- keyguardInteractor.isDozing,
- keyguardInteractor.isAodAvailable,
- keyguardInteractor.biometricUnlockState,
- ) { isDozing, isAodAvailable, biometricUnlockState ->
- // AOD is visible if we're dozing, unless we are wake and unlocking (where we go
- // directly from AOD to unlocked while dozing).
- isDozing &&
- isAodAvailable &&
- !BiometricUnlockMode.isWakeAndUnlock(biometricUnlockState.mode)
- }
+ transitionInteractor
+ .transitionValue(KeyguardState.AOD)
+ .map { it == 1f }
.distinctUntilChanged()
companion object {
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/data/repository/FakeKeyguardTransitionRepository.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/data/repository/FakeKeyguardTransitionRepository.kt
index f4791003c828..026f8f97d2ae 100644
--- a/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/data/repository/FakeKeyguardTransitionRepository.kt
+++ b/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/data/repository/FakeKeyguardTransitionRepository.kt
@@ -124,8 +124,8 @@ class FakeKeyguardTransitionRepository(
/**
* Sends TransitionSteps between [from] and [to], calling [runCurrent] after each step.
*
- * By default, sends steps through FINISHED (STARTED, RUNNING, FINISHED) but can be halted part
- * way using [throughTransitionState].
+ * By default, sends steps through FINISHED (STARTED, RUNNING @0.5f, RUNNING @1f, FINISHED) but
+ * can be halted part way using [throughTransitionState].
*/
suspend fun sendTransitionSteps(
from: KeyguardState,
@@ -137,6 +137,25 @@ class FakeKeyguardTransitionRepository(
}
/**
+ * Sends a STARTED step between [from] and [to], followed by two RUNNING steps at value
+ * [throughValue] / 2 and [throughValue], calling [runCurrent] after each step.
+ */
+ suspend fun sendTransitionStepsThroughRunning(
+ from: KeyguardState,
+ to: KeyguardState,
+ testScope: TestScope,
+ throughValue: Float = 1f,
+ ) {
+ sendTransitionSteps(
+ from,
+ to,
+ testScope.testScheduler,
+ TransitionState.RUNNING,
+ throughValue,
+ )
+ }
+
+ /**
* Sends the provided [step] and makes sure that all previous [TransitionState]'s are sent when
* [fillInSteps] is true. e.g. when a step FINISHED is provided, a step with STARTED and RUNNING
* is also sent.
@@ -178,14 +197,15 @@ class FakeKeyguardTransitionRepository(
/**
* Sends TransitionSteps between [from] and [to], calling [runCurrent] after each step.
*
- * By default, sends steps through FINISHED (STARTED, RUNNING, FINISHED) but can be halted part
- * way using [throughTransitionState].
+ * By default, sends steps through FINISHED (STARTED, RUNNING @0.5f, RUNNING @1f, FINISHED) but
+ * can be halted part way using [throughTransitionState].
*/
suspend fun sendTransitionSteps(
from: KeyguardState,
to: KeyguardState,
testScheduler: TestCoroutineScheduler,
throughTransitionState: TransitionState = TransitionState.FINISHED,
+ throughTransitionValue: Float = 1f,
) {
val lastStep = _transitions.replayCache.lastOrNull()
if (lastStep != null && lastStep.transitionState != TransitionState.FINISHED) {
@@ -216,13 +236,14 @@ class FakeKeyguardTransitionRepository(
throughTransitionState == TransitionState.RUNNING ||
throughTransitionState == TransitionState.FINISHED
) {
+ // Send two steps to better simulate RUNNING transitions.
sendTransitionStep(
step =
TransitionStep(
transitionState = TransitionState.RUNNING,
from = from,
to = to,
- value = 0.5f,
+ value = throughTransitionValue / 2f,
)
)
testScheduler.runCurrent()
@@ -233,7 +254,7 @@ class FakeKeyguardTransitionRepository(
transitionState = TransitionState.RUNNING,
from = from,
to = to,
- value = 1f,
+ value = throughTransitionValue,
)
)
testScheduler.runCurrent()