Loading packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenUserActionsViewModelTest.kt +6 −55 Original line number Diff line number Diff line Loading @@ -29,7 +29,6 @@ import com.android.systemui.Flags import com.android.systemui.SysuiTestCase import com.android.systemui.authentication.data.repository.fakeAuthenticationRepository import com.android.systemui.authentication.shared.model.AuthenticationMethodModel import com.android.systemui.communal.domain.interactor.setCommunalAvailable import com.android.systemui.coroutines.collectLastValue import com.android.systemui.deviceentry.data.repository.fakeDeviceEntryRepository import com.android.systemui.flags.EnableSceneContainer Loading Loading @@ -65,13 +64,12 @@ import platform.test.runner.parameterized.Parameters class LockscreenUserActionsViewModelTest : SysuiTestCase() { companion object { private const val parameterCount = 7 private const val parameterCount = 6 @Parameters( name = "canSwipeToEnter={0}, downWithTwoPointers={1}, downFromEdge={2}," + " isSingleShade={3}, isCommunalAvailable={4}, isShadeTouchable={5}," + " isOccluded={6}" " isSingleShade={3}, isShadeTouchable={4}, isOccluded={6}" ) @JvmStatic fun combinations() = buildList { Loading @@ -82,9 +80,8 @@ class LockscreenUserActionsViewModelTest : SysuiTestCase() { /* downWithTwoPointers= */ combination and 2 != 0, /* downFromEdge= */ combination and 4 != 0, /* isSingleShade= */ combination and 8 != 0, /* isCommunalAvailable= */ combination and 16 != 0, /* isShadeTouchable= */ combination and 32 != 0, /* isOccluded= */ combination and 64 != 0, /* isShadeTouchable= */ combination and 16 != 0, /* isOccluded= */ combination and 32 != 0, ) .also { check(it.size == parameterCount) } ) Loading Loading @@ -145,17 +142,6 @@ class LockscreenUserActionsViewModelTest : SysuiTestCase() { else -> Scenes.Bouncer } } private fun expectedStartDestination( isCommunalAvailable: Boolean, isShadeTouchable: Boolean, ): SceneKey? { return when { !isShadeTouchable -> null isCommunalAvailable -> Scenes.Communal else -> null } } } private val kosmos = testKosmos() Loading @@ -166,9 +152,8 @@ class LockscreenUserActionsViewModelTest : SysuiTestCase() { @JvmField @Parameter(1) var downWithTwoPointers: Boolean = false @JvmField @Parameter(2) var downFromEdge: Boolean = false @JvmField @Parameter(3) var isNarrowScreen: Boolean = true @JvmField @Parameter(4) var isCommunalAvailable: Boolean = false @JvmField @Parameter(5) var isShadeTouchable: Boolean = false @JvmField @Parameter(6) var isOccluded: Boolean = false @JvmField @Parameter(4) var isShadeTouchable: Boolean = false @JvmField @Parameter(5) var isOccluded: Boolean = false private val underTest by lazy { kosmos.lockscreenUserActionsViewModel } Loading @@ -188,7 +173,6 @@ class LockscreenUserActionsViewModelTest : SysuiTestCase() { ) sceneInteractor.changeScene(Scenes.Lockscreen, "reason") kosmos.shadeRepository.setShadeLayoutWide(!isNarrowScreen) kosmos.setCommunalAvailable(isCommunalAvailable) kosmos.fakePowerRepository.updateWakefulness( rawState = if (isShadeTouchable) { Loading Loading @@ -246,22 +230,6 @@ class LockscreenUserActionsViewModelTest : SysuiTestCase() { isShadeTouchable = isShadeTouchable, ) ) val startScene by collectLastValue( (userActions?.get(Swipe.Start) as? UserActionResult.ChangeScene) ?.toScene ?.let { scene -> kosmos.sceneInteractor.resolveSceneFamily(scene) } ?: flowOf(null) ) assertThat(startScene) .isEqualTo( expectedStartDestination( isCommunalAvailable = isCommunalAvailable, isShadeTouchable = isShadeTouchable, ) ) } @Test Loading @@ -279,7 +247,6 @@ class LockscreenUserActionsViewModelTest : SysuiTestCase() { ) sceneInteractor.changeScene(Scenes.Lockscreen, "reason") kosmos.enableDualShade(wideLayout = !isNarrowScreen) kosmos.setCommunalAvailable(isCommunalAvailable) kosmos.fakePowerRepository.updateWakefulness( rawState = if (isShadeTouchable) { Loading Loading @@ -340,21 +307,5 @@ class LockscreenUserActionsViewModelTest : SysuiTestCase() { isShadeTouchable = isShadeTouchable, ) ) val startScene by collectLastValue( (userActions?.get(Swipe.Start) as? UserActionResult.ChangeScene) ?.toScene ?.let { scene -> kosmos.sceneInteractor.resolveSceneFamily(scene) } ?: flowOf(null) ) assertThat(startScene) .isEqualTo( expectedStartDestination( isCommunalAvailable = isCommunalAvailable, isShadeTouchable = isShadeTouchable, ) ) } } packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenUserActionsViewModel.kt +1 −8 Original line number Diff line number Diff line Loading @@ -19,7 +19,6 @@ package com.android.systemui.keyguard.ui.viewmodel import com.android.compose.animation.scene.Swipe import com.android.compose.animation.scene.UserAction import com.android.compose.animation.scene.UserActionResult import com.android.systemui.communal.domain.interactor.CommunalInteractor import com.android.systemui.deviceentry.domain.interactor.DeviceEntryInteractor import com.android.systemui.scene.domain.interactor.SceneContainerOcclusionInteractor import com.android.systemui.scene.shared.model.Scenes Loading @@ -43,7 +42,6 @@ class LockscreenUserActionsViewModel @AssistedInject constructor( private val deviceEntryInteractor: DeviceEntryInteractor, private val communalInteractor: CommunalInteractor, private val shadeInteractor: ShadeInteractor, private val shadeModeInteractor: ShadeModeInteractor, private val occlusionInteractor: SceneContainerOcclusionInteractor, Loading @@ -58,15 +56,10 @@ constructor( combine( deviceEntryInteractor.isUnlocked, communalInteractor.isCommunalAvailable, shadeModeInteractor.shadeMode, occlusionInteractor.isOccludingActivityShown, ) { isDeviceUnlocked, isCommunalAvailable, shadeMode, isOccluded -> ) { isDeviceUnlocked, shadeMode, isOccluded -> buildList { if (isCommunalAvailable) { add(Swipe.Start to Scenes.Communal) } add(Swipe.Up to if (isDeviceUnlocked) Scenes.Gone else Scenes.Bouncer) addAll( Loading packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenUserActionsViewModelKosmos.kt +0 −2 Original line number Diff line number Diff line Loading @@ -16,7 +16,6 @@ package com.android.systemui.keyguard.ui.viewmodel import com.android.systemui.communal.domain.interactor.communalInteractor import com.android.systemui.deviceentry.domain.interactor.deviceEntryInteractor import com.android.systemui.kosmos.Kosmos import com.android.systemui.kosmos.Kosmos.Fixture Loading @@ -27,7 +26,6 @@ import com.android.systemui.shade.domain.interactor.shadeModeInteractor val Kosmos.lockscreenUserActionsViewModel by Fixture { LockscreenUserActionsViewModel( deviceEntryInteractor = deviceEntryInteractor, communalInteractor = communalInteractor, shadeInteractor = shadeInteractor, shadeModeInteractor = shadeModeInteractor, occlusionInteractor = sceneContainerOcclusionInteractor, Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenUserActionsViewModelTest.kt +6 −55 Original line number Diff line number Diff line Loading @@ -29,7 +29,6 @@ import com.android.systemui.Flags import com.android.systemui.SysuiTestCase import com.android.systemui.authentication.data.repository.fakeAuthenticationRepository import com.android.systemui.authentication.shared.model.AuthenticationMethodModel import com.android.systemui.communal.domain.interactor.setCommunalAvailable import com.android.systemui.coroutines.collectLastValue import com.android.systemui.deviceentry.data.repository.fakeDeviceEntryRepository import com.android.systemui.flags.EnableSceneContainer Loading Loading @@ -65,13 +64,12 @@ import platform.test.runner.parameterized.Parameters class LockscreenUserActionsViewModelTest : SysuiTestCase() { companion object { private const val parameterCount = 7 private const val parameterCount = 6 @Parameters( name = "canSwipeToEnter={0}, downWithTwoPointers={1}, downFromEdge={2}," + " isSingleShade={3}, isCommunalAvailable={4}, isShadeTouchable={5}," + " isOccluded={6}" " isSingleShade={3}, isShadeTouchable={4}, isOccluded={6}" ) @JvmStatic fun combinations() = buildList { Loading @@ -82,9 +80,8 @@ class LockscreenUserActionsViewModelTest : SysuiTestCase() { /* downWithTwoPointers= */ combination and 2 != 0, /* downFromEdge= */ combination and 4 != 0, /* isSingleShade= */ combination and 8 != 0, /* isCommunalAvailable= */ combination and 16 != 0, /* isShadeTouchable= */ combination and 32 != 0, /* isOccluded= */ combination and 64 != 0, /* isShadeTouchable= */ combination and 16 != 0, /* isOccluded= */ combination and 32 != 0, ) .also { check(it.size == parameterCount) } ) Loading Loading @@ -145,17 +142,6 @@ class LockscreenUserActionsViewModelTest : SysuiTestCase() { else -> Scenes.Bouncer } } private fun expectedStartDestination( isCommunalAvailable: Boolean, isShadeTouchable: Boolean, ): SceneKey? { return when { !isShadeTouchable -> null isCommunalAvailable -> Scenes.Communal else -> null } } } private val kosmos = testKosmos() Loading @@ -166,9 +152,8 @@ class LockscreenUserActionsViewModelTest : SysuiTestCase() { @JvmField @Parameter(1) var downWithTwoPointers: Boolean = false @JvmField @Parameter(2) var downFromEdge: Boolean = false @JvmField @Parameter(3) var isNarrowScreen: Boolean = true @JvmField @Parameter(4) var isCommunalAvailable: Boolean = false @JvmField @Parameter(5) var isShadeTouchable: Boolean = false @JvmField @Parameter(6) var isOccluded: Boolean = false @JvmField @Parameter(4) var isShadeTouchable: Boolean = false @JvmField @Parameter(5) var isOccluded: Boolean = false private val underTest by lazy { kosmos.lockscreenUserActionsViewModel } Loading @@ -188,7 +173,6 @@ class LockscreenUserActionsViewModelTest : SysuiTestCase() { ) sceneInteractor.changeScene(Scenes.Lockscreen, "reason") kosmos.shadeRepository.setShadeLayoutWide(!isNarrowScreen) kosmos.setCommunalAvailable(isCommunalAvailable) kosmos.fakePowerRepository.updateWakefulness( rawState = if (isShadeTouchable) { Loading Loading @@ -246,22 +230,6 @@ class LockscreenUserActionsViewModelTest : SysuiTestCase() { isShadeTouchable = isShadeTouchable, ) ) val startScene by collectLastValue( (userActions?.get(Swipe.Start) as? UserActionResult.ChangeScene) ?.toScene ?.let { scene -> kosmos.sceneInteractor.resolveSceneFamily(scene) } ?: flowOf(null) ) assertThat(startScene) .isEqualTo( expectedStartDestination( isCommunalAvailable = isCommunalAvailable, isShadeTouchable = isShadeTouchable, ) ) } @Test Loading @@ -279,7 +247,6 @@ class LockscreenUserActionsViewModelTest : SysuiTestCase() { ) sceneInteractor.changeScene(Scenes.Lockscreen, "reason") kosmos.enableDualShade(wideLayout = !isNarrowScreen) kosmos.setCommunalAvailable(isCommunalAvailable) kosmos.fakePowerRepository.updateWakefulness( rawState = if (isShadeTouchable) { Loading Loading @@ -340,21 +307,5 @@ class LockscreenUserActionsViewModelTest : SysuiTestCase() { isShadeTouchable = isShadeTouchable, ) ) val startScene by collectLastValue( (userActions?.get(Swipe.Start) as? UserActionResult.ChangeScene) ?.toScene ?.let { scene -> kosmos.sceneInteractor.resolveSceneFamily(scene) } ?: flowOf(null) ) assertThat(startScene) .isEqualTo( expectedStartDestination( isCommunalAvailable = isCommunalAvailable, isShadeTouchable = isShadeTouchable, ) ) } }
packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenUserActionsViewModel.kt +1 −8 Original line number Diff line number Diff line Loading @@ -19,7 +19,6 @@ package com.android.systemui.keyguard.ui.viewmodel import com.android.compose.animation.scene.Swipe import com.android.compose.animation.scene.UserAction import com.android.compose.animation.scene.UserActionResult import com.android.systemui.communal.domain.interactor.CommunalInteractor import com.android.systemui.deviceentry.domain.interactor.DeviceEntryInteractor import com.android.systemui.scene.domain.interactor.SceneContainerOcclusionInteractor import com.android.systemui.scene.shared.model.Scenes Loading @@ -43,7 +42,6 @@ class LockscreenUserActionsViewModel @AssistedInject constructor( private val deviceEntryInteractor: DeviceEntryInteractor, private val communalInteractor: CommunalInteractor, private val shadeInteractor: ShadeInteractor, private val shadeModeInteractor: ShadeModeInteractor, private val occlusionInteractor: SceneContainerOcclusionInteractor, Loading @@ -58,15 +56,10 @@ constructor( combine( deviceEntryInteractor.isUnlocked, communalInteractor.isCommunalAvailable, shadeModeInteractor.shadeMode, occlusionInteractor.isOccludingActivityShown, ) { isDeviceUnlocked, isCommunalAvailable, shadeMode, isOccluded -> ) { isDeviceUnlocked, shadeMode, isOccluded -> buildList { if (isCommunalAvailable) { add(Swipe.Start to Scenes.Communal) } add(Swipe.Up to if (isDeviceUnlocked) Scenes.Gone else Scenes.Bouncer) addAll( Loading
packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenUserActionsViewModelKosmos.kt +0 −2 Original line number Diff line number Diff line Loading @@ -16,7 +16,6 @@ package com.android.systemui.keyguard.ui.viewmodel import com.android.systemui.communal.domain.interactor.communalInteractor import com.android.systemui.deviceentry.domain.interactor.deviceEntryInteractor import com.android.systemui.kosmos.Kosmos import com.android.systemui.kosmos.Kosmos.Fixture Loading @@ -27,7 +26,6 @@ import com.android.systemui.shade.domain.interactor.shadeModeInteractor val Kosmos.lockscreenUserActionsViewModel by Fixture { LockscreenUserActionsViewModel( deviceEntryInteractor = deviceEntryInteractor, communalInteractor = communalInteractor, shadeInteractor = shadeInteractor, shadeModeInteractor = shadeModeInteractor, occlusionInteractor = sceneContainerOcclusionInteractor, Loading