Loading packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/repository/KeyguardRepositoryImplTest.kt +6 −18 Original line number Diff line number Diff line Loading @@ -326,26 +326,14 @@ class KeyguardRepositoryImplTest : SysuiTestCase() { @Test fun isKeyguardGoingAway() = testScope.runTest { whenever(keyguardStateController.isKeyguardGoingAway).thenReturn(false) var latest: Boolean? = null val job = underTest.isKeyguardGoingAway.onEach { latest = it }.launchIn(this) runCurrent() assertThat(latest).isFalse() val captor = argumentCaptor<KeyguardStateController.Callback>() verify(keyguardStateController, atLeastOnce()).addCallback(captor.capture()) val isGoingAway by collectLastValue(underTest.isKeyguardGoingAway) assertThat(isGoingAway).isFalse() whenever(keyguardStateController.isKeyguardGoingAway).thenReturn(true) captor.value.onKeyguardGoingAwayChanged() runCurrent() assertThat(latest).isTrue() whenever(keyguardStateController.isKeyguardGoingAway).thenReturn(false) captor.value.onKeyguardGoingAwayChanged() runCurrent() assertThat(latest).isFalse() underTest.isKeyguardGoingAway.value = true assertThat(isGoingAway).isTrue() job.cancel() underTest.isKeyguardGoingAway.value = false assertThat(isGoingAway).isFalse() } @Test Loading packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/FromDozingTransitionInteractorTest.kt +16 −0 Original line number Diff line number Diff line Loading @@ -90,6 +90,7 @@ class FromDozingTransitionInteractorTest(flags: FlagsParameterization?) : SysuiT private lateinit var powerInteractor: PowerInteractor private lateinit var transitionRepository: FakeKeyguardTransitionRepository private lateinit var keyguardInteractor: KeyguardInteractor companion object { @JvmStatic Loading @@ -106,6 +107,7 @@ class FromDozingTransitionInteractorTest(flags: FlagsParameterization?) : SysuiT @Before fun setup() { powerInteractor = kosmos.powerInteractor keyguardInteractor = kosmos.keyguardInteractor transitionRepository = kosmos.fakeKeyguardTransitionRepositorySpy underTest = kosmos.fromDozingTransitionInteractor Loading Loading @@ -136,6 +138,20 @@ class FromDozingTransitionInteractorTest(flags: FlagsParameterization?) : SysuiT .startedTransition(from = KeyguardState.DOZING, to = KeyguardState.LOCKSCREEN) } @Test @DisableFlags(FLAG_KEYGUARD_WM_STATE_REFACTOR) fun testTransitionToGone_onWakeup_whenGoingAway() = testScope.runTest { keyguardInteractor.setIsKeyguardGoingAway(true) runCurrent() powerInteractor.setAwakeForTest() advanceTimeBy(60L) assertThat(transitionRepository) .startedTransition(from = KeyguardState.DOZING, to = KeyguardState.GONE) } @Test @EnableFlags(FLAG_KEYGUARD_WM_STATE_REFACTOR) @DisableFlags(FLAG_COMMUNAL_SCENE_KTF_REFACTOR) Loading packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/KeyguardStateControllerTest.java +4 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ import androidx.test.filters.SmallTest; import com.android.internal.widget.LockPatternUtils; import com.android.keyguard.KeyguardUpdateMonitor; import com.android.keyguard.KeyguardUpdateMonitorCallback; import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor; import com.android.keyguard.logging.KeyguardUpdateMonitorLogger; import com.android.systemui.SysuiTestCase; import com.android.systemui.dump.DumpManager; Loading Loading @@ -67,6 +68,8 @@ public class KeyguardStateControllerTest extends SysuiTestCase { @Mock private Lazy<KeyguardUnlockAnimationController> mKeyguardUnlockAnimationControllerLazy; @Mock private Lazy<KeyguardInteractor> mKeyguardInteractorLazy; @Mock private SelectedUserInteractor mSelectedUserInteractor; @Mock private KeyguardUpdateMonitorLogger mLogger; Loading @@ -86,6 +89,7 @@ public class KeyguardStateControllerTest extends SysuiTestCase { mKeyguardUnlockAnimationControllerLazy, mLogger, mDumpManager, mKeyguardInteractorLazy, mFeatureFlags, mSelectedUserInteractor); } Loading packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +1 −1 Original line number Diff line number Diff line Loading @@ -2975,7 +2975,7 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, @Override public void run() { Trace.beginSection("KeyguardViewMediator.mKeyGuardGoingAwayRunnable"); if (DEBUG) Log.d(TAG, "keyguardGoingAway"); Log.d(TAG, "keyguardGoingAwayRunnable"); mKeyguardViewControllerLazy.get().keyguardGoingAway(); int flags = 0; Loading packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardRepository.kt +1 −5 Original line number Diff line number Diff line Loading @@ -114,7 +114,7 @@ interface KeyguardRepository { "away' is isInTransitionToState(GONE), but consider using more specific flows " + "whenever possible." ) val isKeyguardGoingAway: Flow<Boolean> val isKeyguardGoingAway: MutableStateFlow<Boolean> /** * Whether the keyguard is enabled, per [KeyguardService]. If the keyguard is not enabled, the Loading Loading @@ -647,10 +647,6 @@ constructor( override fun onUnlockedChanged() { isKeyguardDismissible.value = keyguardStateController.isUnlocked } override fun onKeyguardGoingAwayChanged() { isKeyguardGoingAway.value = keyguardStateController.isKeyguardGoingAway } } keyguardStateController.addCallback(callback) Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/repository/KeyguardRepositoryImplTest.kt +6 −18 Original line number Diff line number Diff line Loading @@ -326,26 +326,14 @@ class KeyguardRepositoryImplTest : SysuiTestCase() { @Test fun isKeyguardGoingAway() = testScope.runTest { whenever(keyguardStateController.isKeyguardGoingAway).thenReturn(false) var latest: Boolean? = null val job = underTest.isKeyguardGoingAway.onEach { latest = it }.launchIn(this) runCurrent() assertThat(latest).isFalse() val captor = argumentCaptor<KeyguardStateController.Callback>() verify(keyguardStateController, atLeastOnce()).addCallback(captor.capture()) val isGoingAway by collectLastValue(underTest.isKeyguardGoingAway) assertThat(isGoingAway).isFalse() whenever(keyguardStateController.isKeyguardGoingAway).thenReturn(true) captor.value.onKeyguardGoingAwayChanged() runCurrent() assertThat(latest).isTrue() whenever(keyguardStateController.isKeyguardGoingAway).thenReturn(false) captor.value.onKeyguardGoingAwayChanged() runCurrent() assertThat(latest).isFalse() underTest.isKeyguardGoingAway.value = true assertThat(isGoingAway).isTrue() job.cancel() underTest.isKeyguardGoingAway.value = false assertThat(isGoingAway).isFalse() } @Test Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/FromDozingTransitionInteractorTest.kt +16 −0 Original line number Diff line number Diff line Loading @@ -90,6 +90,7 @@ class FromDozingTransitionInteractorTest(flags: FlagsParameterization?) : SysuiT private lateinit var powerInteractor: PowerInteractor private lateinit var transitionRepository: FakeKeyguardTransitionRepository private lateinit var keyguardInteractor: KeyguardInteractor companion object { @JvmStatic Loading @@ -106,6 +107,7 @@ class FromDozingTransitionInteractorTest(flags: FlagsParameterization?) : SysuiT @Before fun setup() { powerInteractor = kosmos.powerInteractor keyguardInteractor = kosmos.keyguardInteractor transitionRepository = kosmos.fakeKeyguardTransitionRepositorySpy underTest = kosmos.fromDozingTransitionInteractor Loading Loading @@ -136,6 +138,20 @@ class FromDozingTransitionInteractorTest(flags: FlagsParameterization?) : SysuiT .startedTransition(from = KeyguardState.DOZING, to = KeyguardState.LOCKSCREEN) } @Test @DisableFlags(FLAG_KEYGUARD_WM_STATE_REFACTOR) fun testTransitionToGone_onWakeup_whenGoingAway() = testScope.runTest { keyguardInteractor.setIsKeyguardGoingAway(true) runCurrent() powerInteractor.setAwakeForTest() advanceTimeBy(60L) assertThat(transitionRepository) .startedTransition(from = KeyguardState.DOZING, to = KeyguardState.GONE) } @Test @EnableFlags(FLAG_KEYGUARD_WM_STATE_REFACTOR) @DisableFlags(FLAG_COMMUNAL_SCENE_KTF_REFACTOR) Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/KeyguardStateControllerTest.java +4 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ import androidx.test.filters.SmallTest; import com.android.internal.widget.LockPatternUtils; import com.android.keyguard.KeyguardUpdateMonitor; import com.android.keyguard.KeyguardUpdateMonitorCallback; import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor; import com.android.keyguard.logging.KeyguardUpdateMonitorLogger; import com.android.systemui.SysuiTestCase; import com.android.systemui.dump.DumpManager; Loading Loading @@ -67,6 +68,8 @@ public class KeyguardStateControllerTest extends SysuiTestCase { @Mock private Lazy<KeyguardUnlockAnimationController> mKeyguardUnlockAnimationControllerLazy; @Mock private Lazy<KeyguardInteractor> mKeyguardInteractorLazy; @Mock private SelectedUserInteractor mSelectedUserInteractor; @Mock private KeyguardUpdateMonitorLogger mLogger; Loading @@ -86,6 +89,7 @@ public class KeyguardStateControllerTest extends SysuiTestCase { mKeyguardUnlockAnimationControllerLazy, mLogger, mDumpManager, mKeyguardInteractorLazy, mFeatureFlags, mSelectedUserInteractor); } Loading
packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +1 −1 Original line number Diff line number Diff line Loading @@ -2975,7 +2975,7 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, @Override public void run() { Trace.beginSection("KeyguardViewMediator.mKeyGuardGoingAwayRunnable"); if (DEBUG) Log.d(TAG, "keyguardGoingAway"); Log.d(TAG, "keyguardGoingAwayRunnable"); mKeyguardViewControllerLazy.get().keyguardGoingAway(); int flags = 0; Loading
packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardRepository.kt +1 −5 Original line number Diff line number Diff line Loading @@ -114,7 +114,7 @@ interface KeyguardRepository { "away' is isInTransitionToState(GONE), but consider using more specific flows " + "whenever possible." ) val isKeyguardGoingAway: Flow<Boolean> val isKeyguardGoingAway: MutableStateFlow<Boolean> /** * Whether the keyguard is enabled, per [KeyguardService]. If the keyguard is not enabled, the Loading Loading @@ -647,10 +647,6 @@ constructor( override fun onUnlockedChanged() { isKeyguardDismissible.value = keyguardStateController.isUnlocked } override fun onKeyguardGoingAwayChanged() { isKeyguardGoingAway.value = keyguardStateController.isKeyguardGoingAway } } keyguardStateController.addCallback(callback) Loading