Merge "[flexiglass] Lock screen -> Lockscreen." into udc-dev
This commit is contained in:
@@ -62,7 +62,7 @@ constructor(
|
||||
override fun destinationScenes(): StateFlow<Map<UserAction, SceneModel>> =
|
||||
MutableStateFlow<Map<UserAction, SceneModel>>(
|
||||
mapOf(
|
||||
UserAction.Back to SceneModel(SceneKey.LockScreen),
|
||||
UserAction.Back to SceneModel(SceneKey.Lockscreen),
|
||||
)
|
||||
)
|
||||
.asStateFlow()
|
||||
|
||||
@@ -33,7 +33,7 @@ import com.android.systemui.common.shared.model.Icon
|
||||
import com.android.systemui.common.ui.compose.Icon
|
||||
import com.android.systemui.dagger.SysUISingleton
|
||||
import com.android.systemui.dagger.qualifiers.Application
|
||||
import com.android.systemui.keyguard.ui.viewmodel.LockScreenSceneViewModel
|
||||
import com.android.systemui.keyguard.ui.viewmodel.LockscreenSceneViewModel
|
||||
import com.android.systemui.scene.shared.model.Direction
|
||||
import com.android.systemui.scene.shared.model.SceneKey
|
||||
import com.android.systemui.scene.shared.model.SceneModel
|
||||
@@ -48,13 +48,13 @@ import kotlinx.coroutines.flow.stateIn
|
||||
|
||||
/** The lock screen scene shows when the device is locked. */
|
||||
@SysUISingleton
|
||||
class LockScreenScene
|
||||
class LockscreenScene
|
||||
@Inject
|
||||
constructor(
|
||||
@Application private val applicationScope: CoroutineScope,
|
||||
private val viewModel: LockScreenSceneViewModel,
|
||||
private val viewModel: LockscreenSceneViewModel,
|
||||
) : ComposableScene {
|
||||
override val key = SceneKey.LockScreen
|
||||
override val key = SceneKey.Lockscreen
|
||||
|
||||
override fun destinationScenes(): StateFlow<Map<UserAction, SceneModel>> =
|
||||
viewModel.upDestinationSceneKey
|
||||
@@ -69,7 +69,7 @@ constructor(
|
||||
override fun Content(
|
||||
modifier: Modifier,
|
||||
) {
|
||||
LockScreenScene(
|
||||
LockscreenScene(
|
||||
viewModel = viewModel,
|
||||
modifier = modifier,
|
||||
)
|
||||
@@ -86,8 +86,8 @@ constructor(
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun LockScreenScene(
|
||||
viewModel: LockScreenSceneViewModel,
|
||||
private fun LockscreenScene(
|
||||
viewModel: LockscreenSceneViewModel,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
// TODO(b/280879610): implement the real UI.
|
||||
@@ -99,7 +99,7 @@ private fun LockScreenScene(
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
modifier = Modifier.align(Alignment.Center)
|
||||
) {
|
||||
Text("Lock screen", style = MaterialTheme.typography.headlineMedium)
|
||||
Text("Lockscreen", style = MaterialTheme.typography.headlineMedium)
|
||||
Row(
|
||||
horizontalArrangement = Arrangement.spacedBy(8.dp),
|
||||
) {
|
||||
@@ -33,7 +33,7 @@ interface AuthenticationRepository {
|
||||
* A device that is not yet unlocked requires unlocking by completing an authentication
|
||||
* challenge according to the current authentication method.
|
||||
*
|
||||
* Note that this state has no real bearing on whether the lock screen is showing or dismissed.
|
||||
* Note that this state has no real bearing on whether the lockscreen is showing or dismissed.
|
||||
*/
|
||||
val isUnlocked: StateFlow<Boolean>
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ constructor(
|
||||
is AuthenticationMethodModel.Swipe ->
|
||||
sceneInteractor.setCurrentScene(
|
||||
containerName,
|
||||
SceneModel(SceneKey.LockScreen),
|
||||
SceneModel(SceneKey.Lockscreen),
|
||||
)
|
||||
else -> Unit
|
||||
}
|
||||
|
||||
@@ -36,8 +36,8 @@ import kotlinx.coroutines.flow.map
|
||||
import kotlinx.coroutines.flow.stateIn
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
/** Hosts business and application state accessing logic for the lock screen scene. */
|
||||
class LockScreenSceneInteractor
|
||||
/** Hosts business and application state accessing logic for the lockscreen scene. */
|
||||
class LockscreenSceneInteractor
|
||||
@AssistedInject
|
||||
constructor(
|
||||
@Application applicationScope: CoroutineScope,
|
||||
@@ -59,7 +59,7 @@ constructor(
|
||||
initialValue = !authenticationInteractor.isUnlocked.value,
|
||||
)
|
||||
|
||||
/** Whether it's currently possible to swipe up to dismiss the lock screen. */
|
||||
/** Whether it's currently possible to swipe up to dismiss the lockscreen. */
|
||||
val isSwipeToDismissEnabled: StateFlow<Boolean> =
|
||||
combine(
|
||||
authenticationInteractor.isUnlocked,
|
||||
@@ -81,9 +81,9 @@ constructor(
|
||||
)
|
||||
|
||||
init {
|
||||
// LOCKING SHOWS LOCK SCREEN.
|
||||
// LOCKING SHOWS Lockscreen.
|
||||
//
|
||||
// Move to the lock screen scene if the device becomes locked while in any scene.
|
||||
// Move to the lockscreen scene if the device becomes locked while in any scene.
|
||||
applicationScope.launch {
|
||||
authenticationInteractor.isUnlocked
|
||||
.map { !it }
|
||||
@@ -92,7 +92,7 @@ constructor(
|
||||
if (isLocked) {
|
||||
sceneInteractor.setCurrentScene(
|
||||
containerName = containerName,
|
||||
scene = SceneModel(SceneKey.LockScreen),
|
||||
scene = SceneModel(SceneKey.Lockscreen),
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -101,7 +101,7 @@ constructor(
|
||||
// BYPASS UNLOCK.
|
||||
//
|
||||
// Moves to the gone scene if bypass is enabled and the device becomes unlocked while in the
|
||||
// lock screen scene.
|
||||
// lockscreen scene.
|
||||
applicationScope.launch {
|
||||
combine(
|
||||
authenticationInteractor.isBypassEnabled,
|
||||
@@ -110,7 +110,7 @@ constructor(
|
||||
::Triple,
|
||||
)
|
||||
.collect { (isBypassEnabled, isUnlocked, currentScene) ->
|
||||
if (isBypassEnabled && isUnlocked && currentScene.key == SceneKey.LockScreen) {
|
||||
if (isBypassEnabled && isUnlocked && currentScene.key == SceneKey.Lockscreen) {
|
||||
sceneInteractor.setCurrentScene(
|
||||
containerName = containerName,
|
||||
scene = SceneModel(SceneKey.Gone),
|
||||
@@ -119,9 +119,9 @@ constructor(
|
||||
}
|
||||
}
|
||||
|
||||
// SWIPE TO DISMISS LOCK SCREEN.
|
||||
// SWIPE TO DISMISS Lockscreen.
|
||||
//
|
||||
// If switched from the lock screen to the gone scene and the auth method was a swipe,
|
||||
// If switched from the lockscreen to the gone scene and the auth method was a swipe,
|
||||
// unlocks the device.
|
||||
applicationScope.launch {
|
||||
combine(
|
||||
@@ -133,7 +133,7 @@ constructor(
|
||||
val (previousScene, currentScene) = scenes
|
||||
if (
|
||||
authMethod is AuthenticationMethodModel.Swipe &&
|
||||
previousScene.key == SceneKey.LockScreen &&
|
||||
previousScene.key == SceneKey.Lockscreen &&
|
||||
currentScene.key == SceneKey.Gone
|
||||
) {
|
||||
authenticationInteractor.unlockDevice()
|
||||
@@ -141,9 +141,9 @@ constructor(
|
||||
}
|
||||
}
|
||||
|
||||
// DISMISS LOCK SCREEN IF AUTH METHOD IS REMOVED.
|
||||
// DISMISS Lockscreen IF AUTH METHOD IS REMOVED.
|
||||
//
|
||||
// If the auth method becomes None while on the lock screen scene, dismisses the lock
|
||||
// If the auth method becomes None while on the lockscreen scene, dismisses the lock
|
||||
// screen.
|
||||
applicationScope.launch {
|
||||
combine(
|
||||
@@ -153,7 +153,7 @@ constructor(
|
||||
)
|
||||
.collect { (authMethod, scene) ->
|
||||
if (
|
||||
scene.key == SceneKey.LockScreen &&
|
||||
scene.key == SceneKey.Lockscreen &&
|
||||
authMethod == AuthenticationMethodModel.None
|
||||
) {
|
||||
sceneInteractor.setCurrentScene(
|
||||
@@ -165,8 +165,8 @@ constructor(
|
||||
}
|
||||
}
|
||||
|
||||
/** Attempts to dismiss the lock screen. This will cause the bouncer to show, if needed. */
|
||||
fun dismissLockScreen() {
|
||||
/** Attempts to dismiss the lockscreen. This will cause the bouncer to show, if needed. */
|
||||
fun dismissLockscreen() {
|
||||
bouncerInteractor.showOrUnlockDevice(containerName = containerName)
|
||||
}
|
||||
|
||||
@@ -181,6 +181,6 @@ constructor(
|
||||
interface Factory {
|
||||
fun create(
|
||||
containerName: String,
|
||||
): LockScreenSceneInteractor
|
||||
): LockscreenSceneInteractor
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,7 @@ import com.android.systemui.R
|
||||
import com.android.systemui.common.shared.model.ContentDescription
|
||||
import com.android.systemui.common.shared.model.Icon
|
||||
import com.android.systemui.dagger.qualifiers.Application
|
||||
import com.android.systemui.keyguard.domain.interactor.LockScreenSceneInteractor
|
||||
import com.android.systemui.keyguard.domain.interactor.LockscreenSceneInteractor
|
||||
import com.android.systemui.scene.shared.model.SceneKey
|
||||
import dagger.assisted.Assisted
|
||||
import dagger.assisted.AssistedFactory
|
||||
@@ -31,17 +31,17 @@ import kotlinx.coroutines.flow.StateFlow
|
||||
import kotlinx.coroutines.flow.map
|
||||
import kotlinx.coroutines.flow.stateIn
|
||||
|
||||
/** Models UI state and handles user input for the lock screen scene. */
|
||||
class LockScreenSceneViewModel
|
||||
/** Models UI state and handles user input for the lockscreen scene. */
|
||||
class LockscreenSceneViewModel
|
||||
@AssistedInject
|
||||
constructor(
|
||||
@Application applicationScope: CoroutineScope,
|
||||
interactorFactory: LockScreenSceneInteractor.Factory,
|
||||
interactorFactory: LockscreenSceneInteractor.Factory,
|
||||
@Assisted containerName: String,
|
||||
) {
|
||||
private val interactor: LockScreenSceneInteractor = interactorFactory.create(containerName)
|
||||
private val interactor: LockscreenSceneInteractor = interactorFactory.create(containerName)
|
||||
|
||||
/** The icon for the "lock" button on the lock screen. */
|
||||
/** The icon for the "lock" button on the lockscreen. */
|
||||
val lockButtonIcon: StateFlow<Icon> =
|
||||
interactor.isDeviceLocked
|
||||
.map { isLocked -> lockIcon(isLocked = isLocked) }
|
||||
@@ -63,12 +63,12 @@ constructor(
|
||||
|
||||
/** Notifies that the lock button on the lock screen was clicked. */
|
||||
fun onLockButtonClicked() {
|
||||
interactor.dismissLockScreen()
|
||||
interactor.dismissLockscreen()
|
||||
}
|
||||
|
||||
/** Notifies that some content on the lock screen was clicked. */
|
||||
fun onContentClicked() {
|
||||
interactor.dismissLockScreen()
|
||||
interactor.dismissLockscreen()
|
||||
}
|
||||
|
||||
private fun upDestinationSceneKey(
|
||||
@@ -103,6 +103,6 @@ constructor(
|
||||
interface Factory {
|
||||
fun create(
|
||||
containerName: String,
|
||||
): LockScreenSceneViewModel
|
||||
): LockscreenSceneViewModel
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package com.android.systemui.qs.ui.viewmodel
|
||||
|
||||
import com.android.systemui.keyguard.domain.interactor.LockScreenSceneInteractor
|
||||
import com.android.systemui.keyguard.domain.interactor.LockscreenSceneInteractor
|
||||
import dagger.assisted.Assisted
|
||||
import dagger.assisted.AssistedFactory
|
||||
import dagger.assisted.AssistedInject
|
||||
@@ -25,15 +25,15 @@ import dagger.assisted.AssistedInject
|
||||
class QuickSettingsSceneViewModel
|
||||
@AssistedInject
|
||||
constructor(
|
||||
lockScreenSceneInteractorFactory: LockScreenSceneInteractor.Factory,
|
||||
lockscreenSceneInteractorFactory: LockscreenSceneInteractor.Factory,
|
||||
@Assisted containerName: String,
|
||||
) {
|
||||
private val lockScreenSceneInteractor: LockScreenSceneInteractor =
|
||||
lockScreenSceneInteractorFactory.create(containerName)
|
||||
private val lockscreenSceneInteractor: LockscreenSceneInteractor =
|
||||
lockscreenSceneInteractorFactory.create(containerName)
|
||||
|
||||
/** Notifies that some content in quick settings was clicked. */
|
||||
fun onContentClicked() {
|
||||
lockScreenSceneInteractor.dismissLockScreen()
|
||||
lockscreenSceneInteractor.dismissLockscreen()
|
||||
}
|
||||
|
||||
@AssistedFactory
|
||||
|
||||
@@ -32,8 +32,8 @@ sealed class SceneKey(
|
||||
*/
|
||||
object Gone : SceneKey("gone")
|
||||
|
||||
/** The lock screen is the scene that shows when the device is locked. */
|
||||
object LockScreen : SceneKey("lockscreen")
|
||||
/** The lockscreen is the scene that shows when the device is locked. */
|
||||
object Lockscreen : SceneKey("lockscreen")
|
||||
|
||||
/**
|
||||
* The shade is the scene whose primary purpose is to show a scrollable list of notifications.
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
package com.android.systemui.shade.ui.viewmodel
|
||||
|
||||
import com.android.systemui.dagger.qualifiers.Application
|
||||
import com.android.systemui.keyguard.domain.interactor.LockScreenSceneInteractor
|
||||
import com.android.systemui.keyguard.domain.interactor.LockscreenSceneInteractor
|
||||
import com.android.systemui.scene.shared.model.SceneKey
|
||||
import dagger.assisted.Assisted
|
||||
import dagger.assisted.AssistedFactory
|
||||
@@ -33,11 +33,11 @@ class ShadeSceneViewModel
|
||||
@AssistedInject
|
||||
constructor(
|
||||
@Application private val applicationScope: CoroutineScope,
|
||||
lockScreenSceneInteractorFactory: LockScreenSceneInteractor.Factory,
|
||||
lockscreenSceneInteractorFactory: LockscreenSceneInteractor.Factory,
|
||||
@Assisted private val containerName: String,
|
||||
) {
|
||||
private val lockScreenInteractor: LockScreenSceneInteractor =
|
||||
lockScreenSceneInteractorFactory.create(containerName)
|
||||
private val lockScreenInteractor: LockscreenSceneInteractor =
|
||||
lockscreenSceneInteractorFactory.create(containerName)
|
||||
|
||||
/** The key of the scene we should switch to when swiping up. */
|
||||
val upDestinationSceneKey: StateFlow<SceneKey> =
|
||||
@@ -54,13 +54,13 @@ constructor(
|
||||
|
||||
/** Notifies that some content in the shade was clicked. */
|
||||
fun onContentClicked() {
|
||||
lockScreenInteractor.dismissLockScreen()
|
||||
lockScreenInteractor.dismissLockscreen()
|
||||
}
|
||||
|
||||
private fun upDestinationSceneKey(
|
||||
isLocked: Boolean,
|
||||
): SceneKey {
|
||||
return if (isLocked) SceneKey.LockScreen else SceneKey.Gone
|
||||
return if (isLocked) SceneKey.Lockscreen else SceneKey.Gone
|
||||
}
|
||||
|
||||
@AssistedFactory
|
||||
|
||||
@@ -36,7 +36,7 @@ import org.junit.runners.JUnit4
|
||||
@OptIn(ExperimentalCoroutinesApi::class)
|
||||
@SmallTest
|
||||
@RunWith(JUnit4::class)
|
||||
class LockScreenSceneInteractorTest : SysuiTestCase() {
|
||||
class LockscreenSceneInteractorTest : SysuiTestCase() {
|
||||
|
||||
private val testScope = TestScope()
|
||||
private val utils = SceneTestUtils(this, testScope)
|
||||
@@ -96,9 +96,9 @@ class LockScreenSceneInteractorTest : SysuiTestCase() {
|
||||
val currentScene by collectLastValue(sceneInteractor.currentScene(CONTAINER_1))
|
||||
authenticationInteractor.lockDevice()
|
||||
authenticationInteractor.setAuthenticationMethod(AuthenticationMethodModel.PIN(1234))
|
||||
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.LockScreen))
|
||||
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.Lockscreen))
|
||||
|
||||
underTest.dismissLockScreen()
|
||||
underTest.dismissLockscreen()
|
||||
|
||||
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.Bouncer))
|
||||
}
|
||||
@@ -109,9 +109,9 @@ class LockScreenSceneInteractorTest : SysuiTestCase() {
|
||||
val currentScene by collectLastValue(sceneInteractor.currentScene(CONTAINER_1))
|
||||
authenticationInteractor.unlockDevice()
|
||||
authenticationInteractor.setAuthenticationMethod(AuthenticationMethodModel.PIN(1234))
|
||||
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.LockScreen))
|
||||
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.Lockscreen))
|
||||
|
||||
underTest.dismissLockScreen()
|
||||
underTest.dismissLockscreen()
|
||||
|
||||
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.Gone))
|
||||
}
|
||||
@@ -122,9 +122,9 @@ class LockScreenSceneInteractorTest : SysuiTestCase() {
|
||||
val currentScene by collectLastValue(sceneInteractor.currentScene(CONTAINER_1))
|
||||
authenticationInteractor.lockDevice()
|
||||
authenticationInteractor.setAuthenticationMethod(AuthenticationMethodModel.Swipe)
|
||||
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.LockScreen))
|
||||
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.Lockscreen))
|
||||
|
||||
underTest.dismissLockScreen()
|
||||
underTest.dismissLockscreen()
|
||||
|
||||
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.Gone))
|
||||
}
|
||||
@@ -142,7 +142,7 @@ class LockScreenSceneInteractorTest : SysuiTestCase() {
|
||||
|
||||
authenticationInteractor.lockDevice()
|
||||
|
||||
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.LockScreen))
|
||||
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.Lockscreen))
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -150,11 +150,11 @@ class LockScreenSceneInteractorTest : SysuiTestCase() {
|
||||
testScope.runTest {
|
||||
val currentScene by collectLastValue(sceneInteractor.currentScene(CONTAINER_1))
|
||||
authenticationInteractor.lockDevice()
|
||||
sceneInteractor.setCurrentScene(CONTAINER_1, SceneModel(SceneKey.LockScreen))
|
||||
sceneInteractor.setCurrentScene(CONTAINER_1, SceneModel(SceneKey.Lockscreen))
|
||||
if (!authenticationInteractor.isBypassEnabled.value) {
|
||||
authenticationInteractor.toggleBypassEnabled()
|
||||
}
|
||||
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.LockScreen))
|
||||
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.Lockscreen))
|
||||
|
||||
authenticationInteractor.biometricUnlock()
|
||||
|
||||
@@ -166,22 +166,22 @@ class LockScreenSceneInteractorTest : SysuiTestCase() {
|
||||
testScope.runTest {
|
||||
val currentScene by collectLastValue(sceneInteractor.currentScene(CONTAINER_1))
|
||||
authenticationInteractor.lockDevice()
|
||||
sceneInteractor.setCurrentScene(CONTAINER_1, SceneModel(SceneKey.LockScreen))
|
||||
sceneInteractor.setCurrentScene(CONTAINER_1, SceneModel(SceneKey.Lockscreen))
|
||||
if (authenticationInteractor.isBypassEnabled.value) {
|
||||
authenticationInteractor.toggleBypassEnabled()
|
||||
}
|
||||
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.LockScreen))
|
||||
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.Lockscreen))
|
||||
|
||||
authenticationInteractor.biometricUnlock()
|
||||
|
||||
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.LockScreen))
|
||||
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.Lockscreen))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun switchFromLockScreenToGone_authMethodSwipe_unlocksDevice() =
|
||||
testScope.runTest {
|
||||
val isUnlocked by collectLastValue(authenticationInteractor.isUnlocked)
|
||||
sceneInteractor.setCurrentScene(CONTAINER_1, SceneModel(SceneKey.LockScreen))
|
||||
sceneInteractor.setCurrentScene(CONTAINER_1, SceneModel(SceneKey.Lockscreen))
|
||||
authenticationInteractor.setAuthenticationMethod(AuthenticationMethodModel.Swipe)
|
||||
assertThat(isUnlocked).isFalse()
|
||||
|
||||
@@ -194,7 +194,7 @@ class LockScreenSceneInteractorTest : SysuiTestCase() {
|
||||
fun switchFromLockScreenToGone_authMethodNotSwipe_doesNotUnlockDevice() =
|
||||
testScope.runTest {
|
||||
val isUnlocked by collectLastValue(authenticationInteractor.isUnlocked)
|
||||
sceneInteractor.setCurrentScene(CONTAINER_1, SceneModel(SceneKey.LockScreen))
|
||||
sceneInteractor.setCurrentScene(CONTAINER_1, SceneModel(SceneKey.Lockscreen))
|
||||
authenticationInteractor.setAuthenticationMethod(AuthenticationMethodModel.PIN(1234))
|
||||
assertThat(isUnlocked).isFalse()
|
||||
|
||||
@@ -223,9 +223,9 @@ class LockScreenSceneInteractorTest : SysuiTestCase() {
|
||||
fun authMethodChangedToNone_onLockScreenScene_dismissesLockScreen() =
|
||||
testScope.runTest {
|
||||
val currentScene by collectLastValue(sceneInteractor.currentScene(CONTAINER_1))
|
||||
sceneInteractor.setCurrentScene(CONTAINER_1, SceneModel(SceneKey.LockScreen))
|
||||
sceneInteractor.setCurrentScene(CONTAINER_1, SceneModel(SceneKey.Lockscreen))
|
||||
authenticationInteractor.setAuthenticationMethod(AuthenticationMethodModel.Swipe)
|
||||
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.LockScreen))
|
||||
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.Lockscreen))
|
||||
|
||||
authenticationInteractor.setAuthenticationMethod(AuthenticationMethodModel.None)
|
||||
|
||||
@@ -22,7 +22,7 @@ import com.android.systemui.SysuiTestCase
|
||||
import com.android.systemui.authentication.shared.model.AuthenticationMethodModel
|
||||
import com.android.systemui.common.shared.model.Icon
|
||||
import com.android.systemui.coroutines.collectLastValue
|
||||
import com.android.systemui.keyguard.domain.interactor.LockScreenSceneInteractor
|
||||
import com.android.systemui.keyguard.domain.interactor.LockscreenSceneInteractor
|
||||
import com.android.systemui.scene.SceneTestUtils
|
||||
import com.android.systemui.scene.SceneTestUtils.Companion.CONTAINER_1
|
||||
import com.android.systemui.scene.shared.model.SceneKey
|
||||
@@ -39,7 +39,7 @@ import org.junit.runners.JUnit4
|
||||
@OptIn(ExperimentalCoroutinesApi::class)
|
||||
@SmallTest
|
||||
@RunWith(JUnit4::class)
|
||||
class LockScreenSceneViewModelTest : SysuiTestCase() {
|
||||
class LockscreenSceneViewModelTest : SysuiTestCase() {
|
||||
|
||||
private val testScope = TestScope()
|
||||
private val utils = SceneTestUtils(this, testScope)
|
||||
@@ -50,11 +50,11 @@ class LockScreenSceneViewModelTest : SysuiTestCase() {
|
||||
)
|
||||
|
||||
private val underTest =
|
||||
LockScreenSceneViewModel(
|
||||
LockscreenSceneViewModel(
|
||||
applicationScope = testScope.backgroundScope,
|
||||
interactorFactory =
|
||||
object : LockScreenSceneInteractor.Factory {
|
||||
override fun create(containerName: String): LockScreenSceneInteractor {
|
||||
object : LockscreenSceneInteractor.Factory {
|
||||
override fun create(containerName: String): LockscreenSceneInteractor {
|
||||
return utils.lockScreenSceneInteractor(
|
||||
authenticationInteractor = authenticationInteractor,
|
||||
sceneInteractor = sceneInteractor,
|
||||
@@ -20,7 +20,7 @@ import androidx.test.filters.SmallTest
|
||||
import com.android.systemui.SysuiTestCase
|
||||
import com.android.systemui.authentication.shared.model.AuthenticationMethodModel
|
||||
import com.android.systemui.coroutines.collectLastValue
|
||||
import com.android.systemui.keyguard.domain.interactor.LockScreenSceneInteractor
|
||||
import com.android.systemui.keyguard.domain.interactor.LockscreenSceneInteractor
|
||||
import com.android.systemui.scene.SceneTestUtils
|
||||
import com.android.systemui.scene.SceneTestUtils.Companion.CONTAINER_1
|
||||
import com.android.systemui.scene.shared.model.SceneKey
|
||||
@@ -49,9 +49,9 @@ class QuickSettingsSceneViewModelTest : SysuiTestCase() {
|
||||
|
||||
private val underTest =
|
||||
QuickSettingsSceneViewModel(
|
||||
lockScreenSceneInteractorFactory =
|
||||
object : LockScreenSceneInteractor.Factory {
|
||||
override fun create(containerName: String): LockScreenSceneInteractor {
|
||||
lockscreenSceneInteractorFactory =
|
||||
object : LockscreenSceneInteractor.Factory {
|
||||
override fun create(containerName: String): LockscreenSceneInteractor {
|
||||
return utils.lockScreenSceneInteractor(
|
||||
authenticationInteractor = authenticationInteractor,
|
||||
sceneInteractor = sceneInteractor,
|
||||
|
||||
@@ -45,7 +45,7 @@ class SceneContainerRepositoryTest : SysuiTestCase() {
|
||||
listOf(
|
||||
SceneKey.QuickSettings,
|
||||
SceneKey.Shade,
|
||||
SceneKey.LockScreen,
|
||||
SceneKey.Lockscreen,
|
||||
SceneKey.Bouncer,
|
||||
SceneKey.Gone,
|
||||
)
|
||||
@@ -62,7 +62,7 @@ class SceneContainerRepositoryTest : SysuiTestCase() {
|
||||
fun currentScene() = runTest {
|
||||
val underTest = utils.fakeSceneContainerRepository()
|
||||
val currentScene by collectLastValue(underTest.currentScene("container1"))
|
||||
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.LockScreen))
|
||||
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.Lockscreen))
|
||||
|
||||
underTest.setCurrentScene("container1", SceneModel(SceneKey.Shade))
|
||||
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.Shade))
|
||||
@@ -88,7 +88,7 @@ class SceneContainerRepositoryTest : SysuiTestCase() {
|
||||
utils.fakeSceneContainerConfig("container1"),
|
||||
utils.fakeSceneContainerConfig(
|
||||
"container2",
|
||||
listOf(SceneKey.QuickSettings, SceneKey.LockScreen)
|
||||
listOf(SceneKey.QuickSettings, SceneKey.Lockscreen)
|
||||
),
|
||||
)
|
||||
)
|
||||
|
||||
@@ -46,7 +46,7 @@ class SceneInteractorTest : SysuiTestCase() {
|
||||
@Test
|
||||
fun sceneTransitions() = runTest {
|
||||
val currentScene by collectLastValue(underTest.currentScene("container1"))
|
||||
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.LockScreen))
|
||||
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.Lockscreen))
|
||||
|
||||
underTest.setCurrentScene("container1", SceneModel(SceneKey.Shade))
|
||||
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.Shade))
|
||||
|
||||
@@ -63,7 +63,7 @@ class SceneContainerViewModelTest : SysuiTestCase() {
|
||||
@Test
|
||||
fun sceneTransition() = runTest {
|
||||
val currentScene by collectLastValue(underTest.currentScene)
|
||||
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.LockScreen))
|
||||
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.Lockscreen))
|
||||
|
||||
underTest.setCurrentScene(SceneModel(SceneKey.Shade))
|
||||
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.Shade))
|
||||
|
||||
@@ -20,7 +20,7 @@ import androidx.test.filters.SmallTest
|
||||
import com.android.systemui.SysuiTestCase
|
||||
import com.android.systemui.authentication.shared.model.AuthenticationMethodModel
|
||||
import com.android.systemui.coroutines.collectLastValue
|
||||
import com.android.systemui.keyguard.domain.interactor.LockScreenSceneInteractor
|
||||
import com.android.systemui.keyguard.domain.interactor.LockscreenSceneInteractor
|
||||
import com.android.systemui.scene.SceneTestUtils
|
||||
import com.android.systemui.scene.SceneTestUtils.Companion.CONTAINER_1
|
||||
import com.android.systemui.scene.shared.model.SceneKey
|
||||
@@ -50,9 +50,9 @@ class ShadeSceneViewModelTest : SysuiTestCase() {
|
||||
private val underTest =
|
||||
ShadeSceneViewModel(
|
||||
applicationScope = testScope.backgroundScope,
|
||||
lockScreenSceneInteractorFactory =
|
||||
object : LockScreenSceneInteractor.Factory {
|
||||
override fun create(containerName: String): LockScreenSceneInteractor {
|
||||
lockscreenSceneInteractorFactory =
|
||||
object : LockscreenSceneInteractor.Factory {
|
||||
override fun create(containerName: String): LockscreenSceneInteractor {
|
||||
return utils.lockScreenSceneInteractor(
|
||||
authenticationInteractor = authenticationInteractor,
|
||||
sceneInteractor = sceneInteractor,
|
||||
@@ -74,7 +74,7 @@ class ShadeSceneViewModelTest : SysuiTestCase() {
|
||||
authenticationInteractor.setAuthenticationMethod(AuthenticationMethodModel.PIN(1234))
|
||||
authenticationInteractor.lockDevice()
|
||||
|
||||
assertThat(upTransitionSceneKey).isEqualTo(SceneKey.LockScreen)
|
||||
assertThat(upTransitionSceneKey).isEqualTo(SceneKey.Lockscreen)
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -23,7 +23,7 @@ import com.android.systemui.authentication.domain.interactor.AuthenticationInter
|
||||
import com.android.systemui.bouncer.data.repo.BouncerRepository
|
||||
import com.android.systemui.bouncer.domain.interactor.BouncerInteractor
|
||||
import com.android.systemui.bouncer.ui.viewmodel.BouncerViewModel
|
||||
import com.android.systemui.keyguard.domain.interactor.LockScreenSceneInteractor
|
||||
import com.android.systemui.keyguard.domain.interactor.LockscreenSceneInteractor
|
||||
import com.android.systemui.scene.data.model.SceneContainerConfig
|
||||
import com.android.systemui.scene.data.repository.SceneContainerRepository
|
||||
import com.android.systemui.scene.domain.interactor.SceneInteractor
|
||||
@@ -58,7 +58,7 @@ class SceneTestUtils(
|
||||
return listOf(
|
||||
SceneKey.QuickSettings,
|
||||
SceneKey.Shade,
|
||||
SceneKey.LockScreen,
|
||||
SceneKey.Lockscreen,
|
||||
SceneKey.Bouncer,
|
||||
SceneKey.Gone,
|
||||
)
|
||||
@@ -71,7 +71,7 @@ class SceneTestUtils(
|
||||
return SceneContainerConfig(
|
||||
name = name,
|
||||
sceneKeys = sceneKeys,
|
||||
initialSceneKey = SceneKey.LockScreen,
|
||||
initialSceneKey = SceneKey.Lockscreen,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -139,8 +139,8 @@ class SceneTestUtils(
|
||||
authenticationInteractor: AuthenticationInteractor,
|
||||
sceneInteractor: SceneInteractor,
|
||||
bouncerInteractor: BouncerInteractor,
|
||||
): LockScreenSceneInteractor {
|
||||
return LockScreenSceneInteractor(
|
||||
): LockscreenSceneInteractor {
|
||||
return LockscreenSceneInteractor(
|
||||
applicationScope = applicationScope(),
|
||||
authenticationInteractor = authenticationInteractor,
|
||||
bouncerInteractorFactory =
|
||||
|
||||
Reference in New Issue
Block a user