Loading packages/SystemUI/multivalentTests/src/com/android/systemui/qs/ui/viewmodel/QuickSettingsShadeSceneActionsViewModelTest.kt +9 −6 Original line number Diff line number Diff line Loading @@ -46,7 +46,6 @@ import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before import org.junit.Test import org.junit.runner.RunWith Loading @@ -64,14 +63,10 @@ class QuickSettingsShadeSceneActionsViewModelTest : SysuiTestCase() { private val underTest by lazy { kosmos.quickSettingsShadeSceneActionsViewModel } @Before fun setUp() { underTest.activateIn(testScope) } @Test fun upTransitionSceneKey_deviceLocked_lockscreen() = testScope.runTest { underTest.activateIn(this) val actions by collectLastValue(underTest.actions) val homeScene by collectLastValue(kosmos.homeSceneFamilyResolver.resolvedScene) lockDevice() Loading @@ -85,6 +80,7 @@ class QuickSettingsShadeSceneActionsViewModelTest : SysuiTestCase() { @Test fun upTransitionSceneKey_deviceLocked_keyguardDisabled_gone() = testScope.runTest { underTest.activateIn(this) val actions by collectLastValue(underTest.actions) val homeScene by collectLastValue(kosmos.homeSceneFamilyResolver.resolvedScene) lockDevice() Loading @@ -98,6 +94,7 @@ class QuickSettingsShadeSceneActionsViewModelTest : SysuiTestCase() { @Test fun upTransitionSceneKey_deviceUnlocked_gone() = testScope.runTest { underTest.activateIn(this) val actions by collectLastValue(underTest.actions) val homeScene by collectLastValue(kosmos.homeSceneFamilyResolver.resolvedScene) lockDevice() Loading @@ -113,6 +110,7 @@ class QuickSettingsShadeSceneActionsViewModelTest : SysuiTestCase() { fun downTransitionSceneKey_deviceLocked_bottomAligned_lockscreen() = testScope.runTest { kosmos.fakeShadeRepository.setDualShadeAlignedToBottom(true) underTest.activateIn(this) val actions by collectLastValue(underTest.actions) val homeScene by collectLastValue(kosmos.homeSceneFamilyResolver.resolvedScene) lockDevice() Loading @@ -127,6 +125,7 @@ class QuickSettingsShadeSceneActionsViewModelTest : SysuiTestCase() { fun downTransitionSceneKey_deviceUnlocked_bottomAligned_gone() = testScope.runTest { kosmos.fakeShadeRepository.setDualShadeAlignedToBottom(true) underTest.activateIn(this) val actions by collectLastValue(underTest.actions) val homeScene by collectLastValue(kosmos.homeSceneFamilyResolver.resolvedScene) lockDevice() Loading @@ -141,6 +140,7 @@ class QuickSettingsShadeSceneActionsViewModelTest : SysuiTestCase() { @Test fun upTransitionSceneKey_authMethodSwipe_lockscreenNotDismissed_goesToLockscreen() = testScope.runTest { underTest.activateIn(this) val actions by collectLastValue(underTest.actions) val homeScene by collectLastValue(kosmos.homeSceneFamilyResolver.resolvedScene) kosmos.fakeDeviceEntryRepository.setLockscreenEnabled(true) Loading @@ -157,6 +157,7 @@ class QuickSettingsShadeSceneActionsViewModelTest : SysuiTestCase() { @Test fun upTransitionSceneKey_authMethodSwipe_lockscreenDismissed_goesToGone() = testScope.runTest { underTest.activateIn(this) val actions by collectLastValue(underTest.actions) val homeScene by collectLastValue(kosmos.homeSceneFamilyResolver.resolvedScene) kosmos.fakeDeviceEntryRepository.setLockscreenEnabled(true) Loading @@ -174,6 +175,7 @@ class QuickSettingsShadeSceneActionsViewModelTest : SysuiTestCase() { @Test fun backTransitionSceneKey_notEditing_Home() = testScope.runTest { underTest.activateIn(this) val actions by collectLastValue(underTest.actions) assertThat((actions?.get(Back) as? UserActionResult.ChangeScene)?.toScene) Loading @@ -183,6 +185,7 @@ class QuickSettingsShadeSceneActionsViewModelTest : SysuiTestCase() { @Test fun backTransition_editing_noDestination() = testScope.runTest { underTest.activateIn(this) val actions by collectLastValue(underTest.actions) kosmos.editModeViewModel.startEditing() Loading packages/SystemUI/multivalentTests/src/com/android/systemui/scene/ui/viewmodel/SceneActionsViewModelTest.kt +1 −2 Original line number Diff line number Diff line Loading @@ -35,7 +35,6 @@ import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.Job import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.collectLatest import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Test Loading Loading @@ -123,7 +122,7 @@ class SceneActionsViewModelTest : SysuiTestCase() { override suspend fun hydrateActions( setActions: (Map<UserAction, UserActionResult>) -> Unit, ) { upstream.collectLatest { setActions(it) } upstream.collect { setActions(it) } } } } packages/SystemUI/src/com/android/systemui/bouncer/ui/viewmodel/BouncerMessageViewModel.kt +2 −2 Original line number Diff line number Diff line Loading @@ -155,7 +155,7 @@ constructor( emptyFlow() } } .collectLatest { messageViewModel -> message.value = messageViewModel } .collect { messageViewModel -> message.value = messageViewModel } } private suspend fun listenForSimBouncerEvents() { Loading @@ -170,7 +170,7 @@ constructor( emptyFlow() } } .collectLatest { .collect { if (it != null) { message.value = it } else { Loading packages/SystemUI/src/com/android/systemui/bouncer/ui/viewmodel/BouncerSceneActionsViewModel.kt +1 −2 Original line number Diff line number Diff line Loading @@ -25,7 +25,6 @@ import com.android.systemui.bouncer.domain.interactor.BouncerInteractor import com.android.systemui.scene.ui.viewmodel.SceneActionsViewModel import dagger.assisted.AssistedFactory import dagger.assisted.AssistedInject import kotlinx.coroutines.flow.collectLatest import kotlinx.coroutines.flow.map /** Loading @@ -46,7 +45,7 @@ constructor( Swipe(SwipeDirection.Down) to UserActionResult(prevScene), ) } .collectLatest { actions -> setActions(actions) } .collect { actions -> setActions(actions) } } @AssistedFactory Loading packages/SystemUI/src/com/android/systemui/bouncer/ui/viewmodel/BouncerSceneContentViewModel.kt +7 −9 Original line number Diff line number Diff line Loading @@ -160,7 +160,7 @@ constructor( launch { userSwitcher.selectedUser .map { it.image.toBitmap() } .collectLatest { _selectedUserImage.value = it } .collect { _selectedUserImage.value = it } } launch { Loading @@ -187,34 +187,32 @@ constructor( ) } } .collectLatest { _userSwitcherDropdown.value = it } .collect { _userSwitcherDropdown.value = it } } launch { combine(wipeDialogMessage, lockoutDialogMessage) { _, _ -> createDialogViewModel() } .collectLatest { _dialogViewModel.value = it } .collect { _dialogViewModel.value = it } } launch { actionButtonInteractor.actionButton.collectLatest { _actionButton.value = it } } launch { actionButtonInteractor.actionButton.collect { _actionButton.value = it } } launch { authMethodViewModel .map { authMethod -> isSideBySideSupported(authMethod) } .collectLatest { _isSideBySideSupported.value = it } .collect { _isSideBySideSupported.value = it } } launch { authMethodViewModel .map { authMethod -> isFoldSplitRequired(authMethod) } .collectLatest { _isFoldSplitRequired.value = it } .collect { _isFoldSplitRequired.value = it } } launch { message.isLockoutMessagePresent .map { lockoutMessagePresent -> !lockoutMessagePresent } .collectLatest { _isInputEnabled.value = it } .collect { _isInputEnabled.value = it } } awaitCancellation() Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/qs/ui/viewmodel/QuickSettingsShadeSceneActionsViewModelTest.kt +9 −6 Original line number Diff line number Diff line Loading @@ -46,7 +46,6 @@ import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before import org.junit.Test import org.junit.runner.RunWith Loading @@ -64,14 +63,10 @@ class QuickSettingsShadeSceneActionsViewModelTest : SysuiTestCase() { private val underTest by lazy { kosmos.quickSettingsShadeSceneActionsViewModel } @Before fun setUp() { underTest.activateIn(testScope) } @Test fun upTransitionSceneKey_deviceLocked_lockscreen() = testScope.runTest { underTest.activateIn(this) val actions by collectLastValue(underTest.actions) val homeScene by collectLastValue(kosmos.homeSceneFamilyResolver.resolvedScene) lockDevice() Loading @@ -85,6 +80,7 @@ class QuickSettingsShadeSceneActionsViewModelTest : SysuiTestCase() { @Test fun upTransitionSceneKey_deviceLocked_keyguardDisabled_gone() = testScope.runTest { underTest.activateIn(this) val actions by collectLastValue(underTest.actions) val homeScene by collectLastValue(kosmos.homeSceneFamilyResolver.resolvedScene) lockDevice() Loading @@ -98,6 +94,7 @@ class QuickSettingsShadeSceneActionsViewModelTest : SysuiTestCase() { @Test fun upTransitionSceneKey_deviceUnlocked_gone() = testScope.runTest { underTest.activateIn(this) val actions by collectLastValue(underTest.actions) val homeScene by collectLastValue(kosmos.homeSceneFamilyResolver.resolvedScene) lockDevice() Loading @@ -113,6 +110,7 @@ class QuickSettingsShadeSceneActionsViewModelTest : SysuiTestCase() { fun downTransitionSceneKey_deviceLocked_bottomAligned_lockscreen() = testScope.runTest { kosmos.fakeShadeRepository.setDualShadeAlignedToBottom(true) underTest.activateIn(this) val actions by collectLastValue(underTest.actions) val homeScene by collectLastValue(kosmos.homeSceneFamilyResolver.resolvedScene) lockDevice() Loading @@ -127,6 +125,7 @@ class QuickSettingsShadeSceneActionsViewModelTest : SysuiTestCase() { fun downTransitionSceneKey_deviceUnlocked_bottomAligned_gone() = testScope.runTest { kosmos.fakeShadeRepository.setDualShadeAlignedToBottom(true) underTest.activateIn(this) val actions by collectLastValue(underTest.actions) val homeScene by collectLastValue(kosmos.homeSceneFamilyResolver.resolvedScene) lockDevice() Loading @@ -141,6 +140,7 @@ class QuickSettingsShadeSceneActionsViewModelTest : SysuiTestCase() { @Test fun upTransitionSceneKey_authMethodSwipe_lockscreenNotDismissed_goesToLockscreen() = testScope.runTest { underTest.activateIn(this) val actions by collectLastValue(underTest.actions) val homeScene by collectLastValue(kosmos.homeSceneFamilyResolver.resolvedScene) kosmos.fakeDeviceEntryRepository.setLockscreenEnabled(true) Loading @@ -157,6 +157,7 @@ class QuickSettingsShadeSceneActionsViewModelTest : SysuiTestCase() { @Test fun upTransitionSceneKey_authMethodSwipe_lockscreenDismissed_goesToGone() = testScope.runTest { underTest.activateIn(this) val actions by collectLastValue(underTest.actions) val homeScene by collectLastValue(kosmos.homeSceneFamilyResolver.resolvedScene) kosmos.fakeDeviceEntryRepository.setLockscreenEnabled(true) Loading @@ -174,6 +175,7 @@ class QuickSettingsShadeSceneActionsViewModelTest : SysuiTestCase() { @Test fun backTransitionSceneKey_notEditing_Home() = testScope.runTest { underTest.activateIn(this) val actions by collectLastValue(underTest.actions) assertThat((actions?.get(Back) as? UserActionResult.ChangeScene)?.toScene) Loading @@ -183,6 +185,7 @@ class QuickSettingsShadeSceneActionsViewModelTest : SysuiTestCase() { @Test fun backTransition_editing_noDestination() = testScope.runTest { underTest.activateIn(this) val actions by collectLastValue(underTest.actions) kosmos.editModeViewModel.startEditing() Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/scene/ui/viewmodel/SceneActionsViewModelTest.kt +1 −2 Original line number Diff line number Diff line Loading @@ -35,7 +35,6 @@ import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.Job import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.collectLatest import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Test Loading Loading @@ -123,7 +122,7 @@ class SceneActionsViewModelTest : SysuiTestCase() { override suspend fun hydrateActions( setActions: (Map<UserAction, UserActionResult>) -> Unit, ) { upstream.collectLatest { setActions(it) } upstream.collect { setActions(it) } } } }
packages/SystemUI/src/com/android/systemui/bouncer/ui/viewmodel/BouncerMessageViewModel.kt +2 −2 Original line number Diff line number Diff line Loading @@ -155,7 +155,7 @@ constructor( emptyFlow() } } .collectLatest { messageViewModel -> message.value = messageViewModel } .collect { messageViewModel -> message.value = messageViewModel } } private suspend fun listenForSimBouncerEvents() { Loading @@ -170,7 +170,7 @@ constructor( emptyFlow() } } .collectLatest { .collect { if (it != null) { message.value = it } else { Loading
packages/SystemUI/src/com/android/systemui/bouncer/ui/viewmodel/BouncerSceneActionsViewModel.kt +1 −2 Original line number Diff line number Diff line Loading @@ -25,7 +25,6 @@ import com.android.systemui.bouncer.domain.interactor.BouncerInteractor import com.android.systemui.scene.ui.viewmodel.SceneActionsViewModel import dagger.assisted.AssistedFactory import dagger.assisted.AssistedInject import kotlinx.coroutines.flow.collectLatest import kotlinx.coroutines.flow.map /** Loading @@ -46,7 +45,7 @@ constructor( Swipe(SwipeDirection.Down) to UserActionResult(prevScene), ) } .collectLatest { actions -> setActions(actions) } .collect { actions -> setActions(actions) } } @AssistedFactory Loading
packages/SystemUI/src/com/android/systemui/bouncer/ui/viewmodel/BouncerSceneContentViewModel.kt +7 −9 Original line number Diff line number Diff line Loading @@ -160,7 +160,7 @@ constructor( launch { userSwitcher.selectedUser .map { it.image.toBitmap() } .collectLatest { _selectedUserImage.value = it } .collect { _selectedUserImage.value = it } } launch { Loading @@ -187,34 +187,32 @@ constructor( ) } } .collectLatest { _userSwitcherDropdown.value = it } .collect { _userSwitcherDropdown.value = it } } launch { combine(wipeDialogMessage, lockoutDialogMessage) { _, _ -> createDialogViewModel() } .collectLatest { _dialogViewModel.value = it } .collect { _dialogViewModel.value = it } } launch { actionButtonInteractor.actionButton.collectLatest { _actionButton.value = it } } launch { actionButtonInteractor.actionButton.collect { _actionButton.value = it } } launch { authMethodViewModel .map { authMethod -> isSideBySideSupported(authMethod) } .collectLatest { _isSideBySideSupported.value = it } .collect { _isSideBySideSupported.value = it } } launch { authMethodViewModel .map { authMethod -> isFoldSplitRequired(authMethod) } .collectLatest { _isFoldSplitRequired.value = it } .collect { _isFoldSplitRequired.value = it } } launch { message.isLockoutMessagePresent .map { lockoutMessagePresent -> !lockoutMessagePresent } .collectLatest { _isInputEnabled.value = it } .collect { _isInputEnabled.value = it } } awaitCancellation() Loading