diff options
| author | 2024-04-11 18:06:15 +0000 | |
|---|---|---|
| committer | 2024-04-11 18:06:15 +0000 | |
| commit | ae8f824d1d785c8b1d65ad82942f984dda5daaa9 (patch) | |
| tree | 94332003dca1d1f9d6bb3b213bcbc995abde4164 | |
| parent | 829ab8b52c79385c1311e39a7e9d9adb9cf7132c (diff) | |
| parent | 8ff37389680d5d5de142c2ecdcc0c4f772918703 (diff) | |
Merge "Code review feedback" into main
7 files changed, 17 insertions, 18 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/deviceentry/data/repository/DeviceEntryFaceAuthRepository.kt b/packages/SystemUI/src/com/android/systemui/deviceentry/data/repository/DeviceEntryFaceAuthRepository.kt index a8f30297ff07..e418641231ed 100644 --- a/packages/SystemUI/src/com/android/systemui/deviceentry/data/repository/DeviceEntryFaceAuthRepository.kt +++ b/packages/SystemUI/src/com/android/systemui/deviceentry/data/repository/DeviceEntryFaceAuthRepository.kt @@ -296,7 +296,7 @@ constructor( private fun listenForSchedulingWatchdog() { keyguardTransitionInteractor - .transition(from = null, to = KeyguardState.GONE) + .transition(to = KeyguardState.GONE) .filter { it.transitionState == TransitionState.FINISHED } .onEach { // We deliberately want to run this in background because scheduleWatchdog does diff --git a/packages/SystemUI/src/com/android/systemui/dreams/ui/viewmodel/DreamViewModel.kt b/packages/SystemUI/src/com/android/systemui/dreams/ui/viewmodel/DreamViewModel.kt index 04edd252f98f..2d9c14e222e9 100644 --- a/packages/SystemUI/src/com/android/systemui/dreams/ui/viewmodel/DreamViewModel.kt +++ b/packages/SystemUI/src/com/android/systemui/dreams/ui/viewmodel/DreamViewModel.kt @@ -98,7 +98,7 @@ constructor( .distinctUntilChanged() val transitionEnded = - keyguardTransitionInteractor.transition(from = DREAMING, to = null).filter { step -> + keyguardTransitionInteractor.transition(from = DREAMING).filter { step -> step.transitionState == TransitionState.FINISHED || step.transitionState == TransitionState.CANCELED } diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ResourceTrimmer.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ResourceTrimmer.kt index c835599abfe1..a65a8827fa48 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ResourceTrimmer.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ResourceTrimmer.kt @@ -84,7 +84,7 @@ constructor( applicationScope.launch(bgDispatcher) { // We drop 1 to avoid triggering on initial collect(). - keyguardTransitionInteractor.transition(from = null, to = GONE).collect { transition -> + keyguardTransitionInteractor.transition(to = GONE).collect { transition -> if (transition.transitionState == TransitionState.FINISHED) { onKeyguardGone() } diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardTransitionInteractor.kt b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardTransitionInteractor.kt index d3ad0c2ac7e1..a18579d9c8e0 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardTransitionInteractor.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardTransitionInteractor.kt @@ -157,7 +157,7 @@ constructor( * Receive all [TransitionStep] matching a filter of [from]->[to]. Allow nulls in order to match * any transition, for instance (any)->GONE. */ - fun transition(from: KeyguardState?, to: KeyguardState?): Flow<TransitionStep> { + fun transition(from: KeyguardState? = null, to: KeyguardState? = null): Flow<TransitionStep> { if (from == null && to == null) { throw IllegalArgumentException("from and to cannot both be null") } @@ -198,8 +198,7 @@ constructor( /** The last [TransitionStep] with a [TransitionState] of FINISHED */ val finishedKeyguardTransitionStep: Flow<TransitionStep> = - repository.transitions - .filter { step -> step.transitionState == TransitionState.FINISHED } + repository.transitions.filter { step -> step.transitionState == TransitionState.FINISHED } /** The destination state of the last [TransitionState.STARTED] transition. */ val startedKeyguardState: SharedFlow<KeyguardState> = @@ -377,7 +376,7 @@ constructor( state: KeyguardState, ): Flow<Boolean> { return getOrCreateFlow(Edge(from = null, to = state)) - .mapLatest { it.transitionState.isActive() } + .mapLatest { it.transitionState.isTransitioning() } .onStart { emit(false) } .distinctUntilChanged() } @@ -391,7 +390,7 @@ constructor( to: KeyguardState, ): Flow<Boolean> { return getOrCreateFlow(Edge(from = from, to = to)) - .mapLatest { it.transitionState.isActive() } + .mapLatest { it.transitionState.isTransitioning() } .onStart { emit(false) } .distinctUntilChanged() } @@ -403,7 +402,7 @@ constructor( state: KeyguardState, ): Flow<Boolean> { return getOrCreateFlow(Edge(from = state, to = null)) - .mapLatest { it.transitionState.isActive() } + .mapLatest { it.transitionState.isTransitioning() } .onStart { emit(false) } .distinctUntilChanged() } diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/shared/model/TransitionState.kt b/packages/SystemUI/src/com/android/systemui/keyguard/shared/model/TransitionState.kt index f6567a6ccb53..1cd188c9dc1a 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/shared/model/TransitionState.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/shared/model/TransitionState.kt @@ -19,20 +19,20 @@ package com.android.systemui.keyguard.shared.model enum class TransitionState { /* Transition has begun. */ STARTED { - override fun isActive() = true + override fun isTransitioning() = true }, /* Transition is actively running. */ RUNNING { - override fun isActive() = true + override fun isTransitioning() = true }, /* Transition has completed successfully. */ FINISHED { - override fun isActive() = false + override fun isTransitioning() = false }, /* Transition has been interrupted, and not completed successfully. */ CANCELED { - override fun isActive() = false + override fun isTransitioning() = false }; - abstract fun isActive(): Boolean + abstract fun isTransitioning(): Boolean } diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/AodBurnInViewModel.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/AodBurnInViewModel.kt index e2177e61d954..d4844e2af335 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/AodBurnInViewModel.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/AodBurnInViewModel.kt @@ -94,9 +94,9 @@ constructor( occludedToLockscreen, aodToLockscreen -> val translationY = - if (aodToLockscreen.transitionState.isActive()) { + if (aodToLockscreen.transitionState.isTransitioning()) { aodToLockscreen.value ?: 0f - } else if (goneToAod.transitionState.isActive()) { + } else if (goneToAod.transitionState.isTransitioning()) { (goneToAod.value ?: 0f) + burnInModel.translationY } else { burnInModel.translationY + occludedToLockscreen + keyguardTranslationY diff --git a/packages/SystemUI/src/com/android/systemui/media/controls/ui/controller/MediaCarouselController.kt b/packages/SystemUI/src/com/android/systemui/media/controls/ui/controller/MediaCarouselController.kt index 5b39ed34cb75..d15d45a477d7 100644 --- a/packages/SystemUI/src/com/android/systemui/media/controls/ui/controller/MediaCarouselController.kt +++ b/packages/SystemUI/src/com/android/systemui/media/controls/ui/controller/MediaCarouselController.kt @@ -603,7 +603,7 @@ constructor( internal fun listenForAnyStateToGoneKeyguardTransition(scope: CoroutineScope): Job { return scope.launch { keyguardTransitionInteractor - .transition(from = null, to = GONE) + .transition(to = GONE) .filter { it.transitionState == TransitionState.FINISHED } .collect { showMediaCarousel() @@ -616,7 +616,7 @@ constructor( internal fun listenForAnyStateToLockscreenTransition(scope: CoroutineScope): Job { return scope.launch { keyguardTransitionInteractor - .transition(from = null, to = LOCKSCREEN) + .transition(to = LOCKSCREEN) .filter { it.transitionState == TransitionState.FINISHED } .collect { if (!allowMediaPlayerOnLockScreen) { |