Ignore keyguard transitions FROM an invalid state.
Transitions should only be started FROM the state we most recently started a transition TO. Previously we allowed transitions from the most recently FINISHED state, but this was never the design intent of the keyguard transition graph.
For example, once we've started GONE -> AOD the next transition MUST be AOD -> *. Previously transitions from GONE -> * were also allowed until the transition to AOD FINISHED.
This fixes some issues with temporary legacy code shims that interact with the KeyguardTransitionInteractor, such as https://source.corp.google.com/h/googleplex-android/platform/superproject/main/+/main:frameworks/base/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromGoneTransitionInteractor.kt;l=75.
This should have no effect on refactored code. If this causes regressions in refactored code, we should fix those transitions.
Fixes: 325481408
Test: atest SystemUITests
Flag: ACONFIG com.android.systemui.migrate_clocks_to_blueprint TEAMFOOD
Change-Id: Ia239ec9bd4f9d16b23f7a6c53804873fa1c84c81
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/TransitionInteractor.kt b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/TransitionInteractor.kt
index 9a59ce9..599285e 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/TransitionInteractor.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/TransitionInteractor.kt
@@ -78,19 +78,26 @@
// a bugreport.
ownerReason: String = "",
): UUID? {
- if (
- fromState != transitionInteractor.startedKeyguardState.replayCache.last() &&
- fromState != transitionInteractor.finishedKeyguardState.replayCache.last()
- ) {
+ if (fromState != transitionInteractor.currentTransitionInfoInternal.value.to) {
Log.e(
name,
- "startTransition: We were asked to transition from " +
- "$fromState to $toState, however we last finished a transition to " +
- "${transitionInteractor.finishedKeyguardState.replayCache.last()}, " +
- "and last started a transition to " +
- "${transitionInteractor.startedKeyguardState.replayCache.last()}. " +
- "Ignoring startTransition, but this should never happen."
+ "Ignoring startTransition: This interactor asked to transition from " +
+ "$fromState -> $toState, but we last transitioned to " +
+ "${transitionInteractor.currentTransitionInfoInternal.value.to}, not " +
+ "$fromState. This should never happen - check currentTransitionInfoInternal " +
+ "or use filterRelevantKeyguardState before starting transitions."
)
+
+ if (fromState == transitionInteractor.finishedKeyguardState.replayCache.last()) {
+ Log.e(
+ name,
+ "This transition would not have been ignored prior to ag/26681239, since we " +
+ "are FINISHED in $fromState (but have since started another transition). " +
+ "If ignoring this transition has caused a regression, fix it by ensuring " +
+ "that transitions are exclusively started from the most recently started " +
+ "state."
+ )
+ }
return null
}