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

Commit 40bb68ba authored by Andreas Miko's avatar Andreas Miko
Browse files

[Scene container] Disable boot to GONE

Some part of the transition implemented for flag off is missing here.
There are two things achieved with this:
1. Keyguard is hidden when the setup wizard is shown. This part is
already implemented in scene container by disabling visibility instead
of going to Gone. See [SceneContainerStartable.hydrateVisibility]. We
might want to unify this logic here.
2. When the auth method is set to NONE device boots into Gone
(Launcher). For this we would just need to call changeScene(Scene.Gone).
Unfortunately STL doesn't seem to be initialized at this point,
therefore it needs a different solution.

Bug: 336576536
Flag: com.android.systemui.scene_container
Test: manual smoke test
Change-Id: If6425f1a23b6cdbffa44486567efd87a9fdc31c9
parent b3189e40
Loading
Loading
Loading
Loading
+22 −13
Original line number Diff line number Diff line
@@ -22,7 +22,10 @@ import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Application
import com.android.systemui.deviceentry.domain.interactor.DeviceEntryInteractor
import com.android.systemui.keyguard.data.repository.KeyguardTransitionRepository
import com.android.systemui.keyguard.shared.model.KeyguardState
import com.android.systemui.keyguard.shared.model.KeyguardState.GONE
import com.android.systemui.keyguard.shared.model.KeyguardState.LOCKSCREEN
import com.android.systemui.keyguard.shared.model.KeyguardState.OFF
import com.android.systemui.scene.shared.flag.SceneContainerFlag
import com.android.systemui.statusbar.policy.domain.interactor.DeviceProvisioningInteractor
import javax.inject.Inject
import kotlinx.coroutines.CoroutineScope
@@ -57,17 +60,7 @@ constructor(

    override fun start() {
        scope.launch {
            val state =
                if (showLockscreenOnBoot.first()) {
                    KeyguardState.LOCKSCREEN
                } else {
                    KeyguardState.GONE
                }

            if (
                internalTransitionInteractor.currentTransitionInfoInternal.value.from !=
                    KeyguardState.OFF
            ) {
            if (internalTransitionInteractor.currentTransitionInfoInternal.value.from != OFF) {
                Log.e(
                    "KeyguardTransitionInteractor",
                    "showLockscreenOnBoot emitted, but we've already " +
@@ -75,7 +68,23 @@ constructor(
                        "transition, but this should not happen."
                )
            } else {
                repository.emitInitialStepsFromOff(state)
                if (SceneContainerFlag.isEnabled) {
                    // TODO(b/336576536): Some part of the transition implemented for flag off is
                    //  missing here. There are two things achieved with this:
                    //  1. Keyguard is hidden when the setup wizard is shown. This part is already
                    //     implemented in scene container by disabling visibility instead of going
                    //     to Gone. See [SceneContainerStartable.hydrateVisibility]. We might want
                    //     to unify this logic here.
                    //  2. When the auth method is set to NONE device boots into Gone (Launcher).
                    //     For this we would just need to call changeScene(Scene.Gone).
                    //     Unfortunately STL doesn't seem to be initialized at this point, therefore
                    //     it needs a different solution.
                    repository.emitInitialStepsFromOff(LOCKSCREEN)
                } else {
                    repository.emitInitialStepsFromOff(
                        if (showLockscreenOnBoot.first()) LOCKSCREEN else GONE
                    )
                }
            }
        }
    }