Loading packages/SystemUI/aconfig/systemui.aconfig +0 −10 Original line number Diff line number Diff line Loading @@ -1621,16 +1621,6 @@ flag { bug: "362719719" } flag { name: "transition_race_condition" namespace: "systemui" description: "Thread-safe keyguard transitions" bug: "358533338" metadata { purpose: PURPOSE_BUGFIX } } flag { name: "media_projection_request_attribution_fix" namespace: "systemui" Loading packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/startable/SceneContainerStartableTest.kt +0 −54 Original line number Diff line number Diff line Loading @@ -727,59 +727,6 @@ class SceneContainerStartableTest : SysuiTestCase() { } @Test @DisableFlags(Flags.FLAG_TRANSITION_RACE_CONDITION) fun switchToAOD_whenAvailable_whenDeviceSleepsLocked() = testScope.runTest { kosmos.lockscreenSceneTransitionInteractor.start() val asleepState by collectLastValue(keyguardInteractor.asleepKeyguardState) val currentTransitionInfo by collectLastValue(kosmos.keyguardTransitionRepository.currentTransitionInfoInternal) val transitionState = prepareState(isDeviceUnlocked = false, initialSceneKey = Scenes.Shade) kosmos.keyguardRepository.setAodAvailable(true) runCurrent() assertThat(asleepState).isEqualTo(KeyguardState.AOD) underTest.start() powerInteractor.setAsleepForTest() runCurrent() transitionState.value = ObservableTransitionState.Transition( fromScene = Scenes.Shade, toScene = Scenes.Lockscreen, currentScene = flowOf(Scenes.Lockscreen), progress = flowOf(0.5f), isInitiatedByUserInput = true, isUserInputOngoing = flowOf(false), ) runCurrent() assertThat(currentTransitionInfo?.to).isEqualTo(KeyguardState.AOD) } @Test @DisableFlags(Flags.FLAG_TRANSITION_RACE_CONDITION) fun switchToDozing_whenAodUnavailable_whenDeviceSleepsLocked() = testScope.runTest { kosmos.lockscreenSceneTransitionInteractor.start() val asleepState by collectLastValue(keyguardInteractor.asleepKeyguardState) val currentTransitionInfo by collectLastValue(kosmos.keyguardTransitionRepository.currentTransitionInfoInternal) val transitionState = prepareState(isDeviceUnlocked = false, initialSceneKey = Scenes.Shade) kosmos.keyguardRepository.setAodAvailable(false) runCurrent() assertThat(asleepState).isEqualTo(KeyguardState.DOZING) underTest.start() powerInteractor.setAsleepForTest() runCurrent() transitionState.value = Transition(from = Scenes.Shade, to = Scenes.Lockscreen) runCurrent() assertThat(currentTransitionInfo?.to).isEqualTo(KeyguardState.DOZING) } @Test @EnableFlags(Flags.FLAG_TRANSITION_RACE_CONDITION) fun switchToAOD_whenAvailable_whenDeviceSleepsLocked_transitionFlagEnabled() = testScope.runTest { kosmos.lockscreenSceneTransitionInteractor.start() Loading Loading @@ -808,7 +755,6 @@ class SceneContainerStartableTest : SysuiTestCase() { } @Test @EnableFlags(Flags.FLAG_TRANSITION_RACE_CONDITION) fun switchToDozing_whenAodUnavailable_whenDeviceSleepsLocked_transitionFlagEnabled() = testScope.runTest { kosmos.lockscreenSceneTransitionInteractor.start() Loading packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardTransitionRepository.kt +9 −38 Original line number Diff line number Diff line Loading @@ -26,7 +26,6 @@ import android.util.Log import com.android.app.animation.Interpolators import com.android.app.tracing.coroutines.flow.traceAs import com.android.app.tracing.coroutines.withContextTraced as withContext import com.android.systemui.Flags.transitionRaceCondition import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Main import com.android.systemui.keyguard.shared.model.KeyguardState Loading @@ -42,9 +41,6 @@ import kotlinx.coroutines.channels.BufferOverflow import kotlinx.coroutines.delay import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.MutableSharedFlow import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.flow.distinctUntilChanged import kotlinx.coroutines.flow.filter import kotlinx.coroutines.sync.Mutex Loading Loading @@ -77,8 +73,6 @@ interface KeyguardTransitionRepository { */ val transitions: Flow<TransitionStep> /** The [TransitionInfo] of the most recent call to [startTransition]. */ val currentTransitionInfoInternal: StateFlow<TransitionInfo> /** The [TransitionInfo] of the most recent call to [startTransition]. */ val currentTransitionInfo: TransitionInfo Loading Loading @@ -154,16 +148,6 @@ constructor( private var animatorListener: AnimatorListenerAdapter? = null private val withContextMutex = Mutex() private val _currentTransitionInfo: MutableStateFlow<TransitionInfo> = MutableStateFlow( TransitionInfo( ownerName = "", from = KeyguardState.OFF, to = KeyguardState.OFF, animator = null, ) ) override var currentTransitionInfoInternal = _currentTransitionInfo.asStateFlow() @Volatile override var currentTransitionInfo: TransitionInfo = Loading Loading @@ -194,11 +178,7 @@ constructor( } override suspend fun startTransition(info: TransitionInfo): UUID? { if (transitionRaceCondition()) { currentTransitionInfo = info } else { _currentTransitionInfo.value = info } Log.d(TAG, "(Internal) Setting current transition info: $info") // There is no fairness guarantee with 'withContext', which means that transitions could Loading Loading @@ -371,7 +351,6 @@ constructor( // Tests runs on testDispatcher, which is not the main thread, causing the animator thread // check to fail if (testSetup) { if (transitionRaceCondition()) { currentTransitionInfo = TransitionInfo( ownerName = ownerName, Loading @@ -379,15 +358,7 @@ constructor( to = to, animator = null, ) } else { _currentTransitionInfo.value = TransitionInfo( ownerName = ownerName, from = KeyguardState.OFF, to = to, animator = null, ) } emitTransition( TransitionStep( KeyguardState.OFF, Loading packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/InternalKeyguardTransitionInteractor.kt +1 −8 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ package com.android.systemui.keyguard.domain.interactor import android.annotation.FloatRange import com.android.systemui.Flags.transitionRaceCondition import com.android.systemui.dagger.SysUISingleton import com.android.systemui.keyguard.data.repository.KeyguardTransitionRepository import com.android.systemui.keyguard.shared.model.TransitionInfo Loading Loading @@ -56,13 +55,7 @@ constructor(private val repository: KeyguardTransitionRepository) { * *will* be emitted, and therefore that it can safely request an AOD -> LOCKSCREEN transition * which will subsequently cancel GONE -> AOD. */ internal fun currentTransitionInfoInternal(): TransitionInfo { return if (transitionRaceCondition()) { repository.currentTransitionInfo } else { repository.currentTransitionInfoInternal.value } } internal fun currentTransitionInfoInternal(): TransitionInfo = repository.currentTransitionInfo suspend fun startTransition(info: TransitionInfo) = repository.startTransition(info) Loading packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardDismissTransitionInteractor.kt +1 −8 Original line number Diff line number Diff line Loading @@ -18,7 +18,6 @@ package com.android.systemui.keyguard.domain.interactor import android.animation.ValueAnimator import android.util.Log import com.android.systemui.Flags.transitionRaceCondition import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Background import com.android.systemui.keyguard.data.repository.KeyguardTransitionRepository Loading Loading @@ -70,13 +69,7 @@ constructor( Log.d(TAG, "#startDismissKeyguardTransition(reason=$reason)") scope.launch { val startedState = if (transitionRaceCondition()) { repository.currentTransitionInfo.to } else { repository.currentTransitionInfoInternal.value.to } val startedState = repository.currentTransitionInfo.to val animator: ValueAnimator? = when (startedState) { LOCKSCREEN -> fromLockscreenTransitionInteractor Loading Loading
packages/SystemUI/aconfig/systemui.aconfig +0 −10 Original line number Diff line number Diff line Loading @@ -1621,16 +1621,6 @@ flag { bug: "362719719" } flag { name: "transition_race_condition" namespace: "systemui" description: "Thread-safe keyguard transitions" bug: "358533338" metadata { purpose: PURPOSE_BUGFIX } } flag { name: "media_projection_request_attribution_fix" namespace: "systemui" Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/startable/SceneContainerStartableTest.kt +0 −54 Original line number Diff line number Diff line Loading @@ -727,59 +727,6 @@ class SceneContainerStartableTest : SysuiTestCase() { } @Test @DisableFlags(Flags.FLAG_TRANSITION_RACE_CONDITION) fun switchToAOD_whenAvailable_whenDeviceSleepsLocked() = testScope.runTest { kosmos.lockscreenSceneTransitionInteractor.start() val asleepState by collectLastValue(keyguardInteractor.asleepKeyguardState) val currentTransitionInfo by collectLastValue(kosmos.keyguardTransitionRepository.currentTransitionInfoInternal) val transitionState = prepareState(isDeviceUnlocked = false, initialSceneKey = Scenes.Shade) kosmos.keyguardRepository.setAodAvailable(true) runCurrent() assertThat(asleepState).isEqualTo(KeyguardState.AOD) underTest.start() powerInteractor.setAsleepForTest() runCurrent() transitionState.value = ObservableTransitionState.Transition( fromScene = Scenes.Shade, toScene = Scenes.Lockscreen, currentScene = flowOf(Scenes.Lockscreen), progress = flowOf(0.5f), isInitiatedByUserInput = true, isUserInputOngoing = flowOf(false), ) runCurrent() assertThat(currentTransitionInfo?.to).isEqualTo(KeyguardState.AOD) } @Test @DisableFlags(Flags.FLAG_TRANSITION_RACE_CONDITION) fun switchToDozing_whenAodUnavailable_whenDeviceSleepsLocked() = testScope.runTest { kosmos.lockscreenSceneTransitionInteractor.start() val asleepState by collectLastValue(keyguardInteractor.asleepKeyguardState) val currentTransitionInfo by collectLastValue(kosmos.keyguardTransitionRepository.currentTransitionInfoInternal) val transitionState = prepareState(isDeviceUnlocked = false, initialSceneKey = Scenes.Shade) kosmos.keyguardRepository.setAodAvailable(false) runCurrent() assertThat(asleepState).isEqualTo(KeyguardState.DOZING) underTest.start() powerInteractor.setAsleepForTest() runCurrent() transitionState.value = Transition(from = Scenes.Shade, to = Scenes.Lockscreen) runCurrent() assertThat(currentTransitionInfo?.to).isEqualTo(KeyguardState.DOZING) } @Test @EnableFlags(Flags.FLAG_TRANSITION_RACE_CONDITION) fun switchToAOD_whenAvailable_whenDeviceSleepsLocked_transitionFlagEnabled() = testScope.runTest { kosmos.lockscreenSceneTransitionInteractor.start() Loading Loading @@ -808,7 +755,6 @@ class SceneContainerStartableTest : SysuiTestCase() { } @Test @EnableFlags(Flags.FLAG_TRANSITION_RACE_CONDITION) fun switchToDozing_whenAodUnavailable_whenDeviceSleepsLocked_transitionFlagEnabled() = testScope.runTest { kosmos.lockscreenSceneTransitionInteractor.start() Loading
packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardTransitionRepository.kt +9 −38 Original line number Diff line number Diff line Loading @@ -26,7 +26,6 @@ import android.util.Log import com.android.app.animation.Interpolators import com.android.app.tracing.coroutines.flow.traceAs import com.android.app.tracing.coroutines.withContextTraced as withContext import com.android.systemui.Flags.transitionRaceCondition import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Main import com.android.systemui.keyguard.shared.model.KeyguardState Loading @@ -42,9 +41,6 @@ import kotlinx.coroutines.channels.BufferOverflow import kotlinx.coroutines.delay import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.MutableSharedFlow import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.flow.distinctUntilChanged import kotlinx.coroutines.flow.filter import kotlinx.coroutines.sync.Mutex Loading Loading @@ -77,8 +73,6 @@ interface KeyguardTransitionRepository { */ val transitions: Flow<TransitionStep> /** The [TransitionInfo] of the most recent call to [startTransition]. */ val currentTransitionInfoInternal: StateFlow<TransitionInfo> /** The [TransitionInfo] of the most recent call to [startTransition]. */ val currentTransitionInfo: TransitionInfo Loading Loading @@ -154,16 +148,6 @@ constructor( private var animatorListener: AnimatorListenerAdapter? = null private val withContextMutex = Mutex() private val _currentTransitionInfo: MutableStateFlow<TransitionInfo> = MutableStateFlow( TransitionInfo( ownerName = "", from = KeyguardState.OFF, to = KeyguardState.OFF, animator = null, ) ) override var currentTransitionInfoInternal = _currentTransitionInfo.asStateFlow() @Volatile override var currentTransitionInfo: TransitionInfo = Loading Loading @@ -194,11 +178,7 @@ constructor( } override suspend fun startTransition(info: TransitionInfo): UUID? { if (transitionRaceCondition()) { currentTransitionInfo = info } else { _currentTransitionInfo.value = info } Log.d(TAG, "(Internal) Setting current transition info: $info") // There is no fairness guarantee with 'withContext', which means that transitions could Loading Loading @@ -371,7 +351,6 @@ constructor( // Tests runs on testDispatcher, which is not the main thread, causing the animator thread // check to fail if (testSetup) { if (transitionRaceCondition()) { currentTransitionInfo = TransitionInfo( ownerName = ownerName, Loading @@ -379,15 +358,7 @@ constructor( to = to, animator = null, ) } else { _currentTransitionInfo.value = TransitionInfo( ownerName = ownerName, from = KeyguardState.OFF, to = to, animator = null, ) } emitTransition( TransitionStep( KeyguardState.OFF, Loading
packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/InternalKeyguardTransitionInteractor.kt +1 −8 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ package com.android.systemui.keyguard.domain.interactor import android.annotation.FloatRange import com.android.systemui.Flags.transitionRaceCondition import com.android.systemui.dagger.SysUISingleton import com.android.systemui.keyguard.data.repository.KeyguardTransitionRepository import com.android.systemui.keyguard.shared.model.TransitionInfo Loading Loading @@ -56,13 +55,7 @@ constructor(private val repository: KeyguardTransitionRepository) { * *will* be emitted, and therefore that it can safely request an AOD -> LOCKSCREEN transition * which will subsequently cancel GONE -> AOD. */ internal fun currentTransitionInfoInternal(): TransitionInfo { return if (transitionRaceCondition()) { repository.currentTransitionInfo } else { repository.currentTransitionInfoInternal.value } } internal fun currentTransitionInfoInternal(): TransitionInfo = repository.currentTransitionInfo suspend fun startTransition(info: TransitionInfo) = repository.startTransition(info) Loading
packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardDismissTransitionInteractor.kt +1 −8 Original line number Diff line number Diff line Loading @@ -18,7 +18,6 @@ package com.android.systemui.keyguard.domain.interactor import android.animation.ValueAnimator import android.util.Log import com.android.systemui.Flags.transitionRaceCondition import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Background import com.android.systemui.keyguard.data.repository.KeyguardTransitionRepository Loading Loading @@ -70,13 +69,7 @@ constructor( Log.d(TAG, "#startDismissKeyguardTransition(reason=$reason)") scope.launch { val startedState = if (transitionRaceCondition()) { repository.currentTransitionInfo.to } else { repository.currentTransitionInfoInternal.value.to } val startedState = repository.currentTransitionInfo.to val animator: ValueAnimator? = when (startedState) { LOCKSCREEN -> fromLockscreenTransitionInteractor Loading