Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ca1ed768 authored by Ale Nijamkin's avatar Ale Nijamkin Committed by Automerger Merge Worker
Browse files

Merge "[flexiglass] Lock screen -> Lockscreen." into udc-dev am: 32becff0 am: e53e343c

parents 5ae04b0e e53e343c
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -62,7 +62,7 @@ constructor(
    override fun destinationScenes(): StateFlow<Map<UserAction, SceneModel>> =
    override fun destinationScenes(): StateFlow<Map<UserAction, SceneModel>> =
        MutableStateFlow<Map<UserAction, SceneModel>>(
        MutableStateFlow<Map<UserAction, SceneModel>>(
                mapOf(
                mapOf(
                    UserAction.Back to SceneModel(SceneKey.LockScreen),
                    UserAction.Back to SceneModel(SceneKey.Lockscreen),
                )
                )
            )
            )
            .asStateFlow()
            .asStateFlow()
+8 −8
Original line number Original line Diff line number Diff line
@@ -33,7 +33,7 @@ import com.android.systemui.common.shared.model.Icon
import com.android.systemui.common.ui.compose.Icon
import com.android.systemui.common.ui.compose.Icon
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Application
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.Direction
import com.android.systemui.scene.shared.model.SceneKey
import com.android.systemui.scene.shared.model.SceneKey
import com.android.systemui.scene.shared.model.SceneModel
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. */
/** The lock screen scene shows when the device is locked. */
@SysUISingleton
@SysUISingleton
class LockScreenScene
class LockscreenScene
@Inject
@Inject
constructor(
constructor(
    @Application private val applicationScope: CoroutineScope,
    @Application private val applicationScope: CoroutineScope,
    private val viewModel: LockScreenSceneViewModel,
    private val viewModel: LockscreenSceneViewModel,
) : ComposableScene {
) : ComposableScene {
    override val key = SceneKey.LockScreen
    override val key = SceneKey.Lockscreen


    override fun destinationScenes(): StateFlow<Map<UserAction, SceneModel>> =
    override fun destinationScenes(): StateFlow<Map<UserAction, SceneModel>> =
        viewModel.upDestinationSceneKey
        viewModel.upDestinationSceneKey
@@ -69,7 +69,7 @@ constructor(
    override fun Content(
    override fun Content(
        modifier: Modifier,
        modifier: Modifier,
    ) {
    ) {
        LockScreenScene(
        LockscreenScene(
            viewModel = viewModel,
            viewModel = viewModel,
            modifier = modifier,
            modifier = modifier,
        )
        )
@@ -86,8 +86,8 @@ constructor(
}
}


@Composable
@Composable
private fun LockScreenScene(
private fun LockscreenScene(
    viewModel: LockScreenSceneViewModel,
    viewModel: LockscreenSceneViewModel,
    modifier: Modifier = Modifier,
    modifier: Modifier = Modifier,
) {
) {
    // TODO(b/280879610): implement the real UI.
    // TODO(b/280879610): implement the real UI.
+1 −1
Original line number Original line Diff line number Diff line
@@ -73,7 +73,7 @@ constructor(
                            is AuthenticationMethodModel.Swipe ->
                            is AuthenticationMethodModel.Swipe ->
                                sceneInteractor.setCurrentScene(
                                sceneInteractor.setCurrentScene(
                                    containerName,
                                    containerName,
                                    SceneModel(SceneKey.LockScreen),
                                    SceneModel(SceneKey.Lockscreen),
                                )
                                )
                            else -> Unit
                            else -> Unit
                        }
                        }
+17 −17
Original line number Original line Diff line number Diff line
@@ -37,7 +37,7 @@ import kotlinx.coroutines.flow.stateIn
import kotlinx.coroutines.launch
import kotlinx.coroutines.launch


/** Hosts business and application state accessing logic for the lockscreen scene. */
/** Hosts business and application state accessing logic for the lockscreen scene. */
class LockScreenSceneInteractor
class LockscreenSceneInteractor
@AssistedInject
@AssistedInject
constructor(
constructor(
    @Application applicationScope: CoroutineScope,
    @Application applicationScope: CoroutineScope,
@@ -81,7 +81,7 @@ constructor(
            )
            )


    init {
    init {
        // LOCKING SHOWS LOCK SCREEN.
        // LOCKING SHOWS Lockscreen.
        //
        //
        // Move to the lockscreen 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 {
        applicationScope.launch {
@@ -92,7 +92,7 @@ constructor(
                    if (isLocked) {
                    if (isLocked) {
                        sceneInteractor.setCurrentScene(
                        sceneInteractor.setCurrentScene(
                            containerName = containerName,
                            containerName = containerName,
                            scene = SceneModel(SceneKey.LockScreen),
                            scene = SceneModel(SceneKey.Lockscreen),
                        )
                        )
                    }
                    }
                }
                }
@@ -110,7 +110,7 @@ constructor(
                    ::Triple,
                    ::Triple,
                )
                )
                .collect { (isBypassEnabled, isUnlocked, currentScene) ->
                .collect { (isBypassEnabled, isUnlocked, currentScene) ->
                    if (isBypassEnabled && isUnlocked && currentScene.key == SceneKey.LockScreen) {
                    if (isBypassEnabled && isUnlocked && currentScene.key == SceneKey.Lockscreen) {
                        sceneInteractor.setCurrentScene(
                        sceneInteractor.setCurrentScene(
                            containerName = containerName,
                            containerName = containerName,
                            scene = SceneModel(SceneKey.Gone),
                            scene = SceneModel(SceneKey.Gone),
@@ -119,7 +119,7 @@ constructor(
                }
                }
        }
        }


        // SWIPE TO DISMISS LOCK SCREEN.
        // SWIPE TO DISMISS Lockscreen.
        //
        //
        // If switched from the lockscreen 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.
        // unlocks the device.
@@ -133,7 +133,7 @@ constructor(
                    val (previousScene, currentScene) = scenes
                    val (previousScene, currentScene) = scenes
                    if (
                    if (
                        authMethod is AuthenticationMethodModel.Swipe &&
                        authMethod is AuthenticationMethodModel.Swipe &&
                            previousScene.key == SceneKey.LockScreen &&
                            previousScene.key == SceneKey.Lockscreen &&
                            currentScene.key == SceneKey.Gone
                            currentScene.key == SceneKey.Gone
                    ) {
                    ) {
                        authenticationInteractor.unlockDevice()
                        authenticationInteractor.unlockDevice()
@@ -141,7 +141,7 @@ 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 lockscreen scene, dismisses the lock
        // If the auth method becomes None while on the lockscreen scene, dismisses the lock
        // screen.
        // screen.
@@ -153,7 +153,7 @@ constructor(
                )
                )
                .collect { (authMethod, scene) ->
                .collect { (authMethod, scene) ->
                    if (
                    if (
                        scene.key == SceneKey.LockScreen &&
                        scene.key == SceneKey.Lockscreen &&
                            authMethod == AuthenticationMethodModel.None
                            authMethod == AuthenticationMethodModel.None
                    ) {
                    ) {
                        sceneInteractor.setCurrentScene(
                        sceneInteractor.setCurrentScene(
@@ -166,7 +166,7 @@ constructor(
    }
    }


    /** Attempts to dismiss the lockscreen. This will cause the bouncer to show, if needed. */
    /** Attempts to dismiss the lockscreen. This will cause the bouncer to show, if needed. */
    fun dismissLockScreen() {
    fun dismissLockscreen() {
        bouncerInteractor.showOrUnlockDevice(containerName = containerName)
        bouncerInteractor.showOrUnlockDevice(containerName = containerName)
    }
    }


@@ -181,6 +181,6 @@ constructor(
    interface Factory {
    interface Factory {
        fun create(
        fun create(
            containerName: String,
            containerName: String,
        ): LockScreenSceneInteractor
        ): LockscreenSceneInteractor
    }
    }
}
}
+9 −9
Original line number Original line Diff line number Diff line
@@ -20,7 +20,7 @@ import com.android.systemui.R
import com.android.systemui.common.shared.model.ContentDescription
import com.android.systemui.common.shared.model.ContentDescription
import com.android.systemui.common.shared.model.Icon
import com.android.systemui.common.shared.model.Icon
import com.android.systemui.dagger.qualifiers.Application
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 com.android.systemui.scene.shared.model.SceneKey
import dagger.assisted.Assisted
import dagger.assisted.Assisted
import dagger.assisted.AssistedFactory
import dagger.assisted.AssistedFactory
@@ -32,14 +32,14 @@ import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.stateIn
import kotlinx.coroutines.flow.stateIn


/** Models UI state and handles user input for the lockscreen scene. */
/** Models UI state and handles user input for the lockscreen scene. */
class LockScreenSceneViewModel
class LockscreenSceneViewModel
@AssistedInject
@AssistedInject
constructor(
constructor(
    @Application applicationScope: CoroutineScope,
    @Application applicationScope: CoroutineScope,
    interactorFactory: LockScreenSceneInteractor.Factory,
    interactorFactory: LockscreenSceneInteractor.Factory,
    @Assisted containerName: String,
    @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 lockscreen. */
    /** The icon for the "lock" button on the lockscreen. */
    val lockButtonIcon: StateFlow<Icon> =
    val lockButtonIcon: StateFlow<Icon> =
@@ -63,12 +63,12 @@ constructor(


    /** Notifies that the lock button on the lock screen was clicked. */
    /** Notifies that the lock button on the lock screen was clicked. */
    fun onLockButtonClicked() {
    fun onLockButtonClicked() {
        interactor.dismissLockScreen()
        interactor.dismissLockscreen()
    }
    }


    /** Notifies that some content on the lock screen was clicked. */
    /** Notifies that some content on the lock screen was clicked. */
    fun onContentClicked() {
    fun onContentClicked() {
        interactor.dismissLockScreen()
        interactor.dismissLockscreen()
    }
    }


    private fun upDestinationSceneKey(
    private fun upDestinationSceneKey(
@@ -103,6 +103,6 @@ constructor(
    interface Factory {
    interface Factory {
        fun create(
        fun create(
            containerName: String,
            containerName: String,
        ): LockScreenSceneViewModel
        ): LockscreenSceneViewModel
    }
    }
}
}
Loading