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

Commit 5193237c authored by Alejandro Nijamkin's avatar Alejandro Nijamkin
Browse files

[flexiglass] Integrates scrim state.

- New startable that hydrates scrim state
- Old code paths to set scrim state from CentralSurfacesImpl turned off
- Code to figure out the right ScrimState is an almost intact copy-paste
  from the current code in CentralSurfacesImpl. A couple of differences
  regarding the elimination of callbacks and side-effects (I figure we
  can add those later if we need them)

Bug: 343298208
Flag: com.android.systemui.scene_container
Test: manually verified that the attached bug isn't reproducible anymore
and that the wallpaper is visible when the unfolded/unlocked device is
closed shut
Test: submitting this CL early to ublock others working on Flexiglass;
working on unit tests in followup CL

Change-Id: Iceb6c7441831ab56f3a049d0ec4044e0a29fe262
parent 1fc11fc9
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -183,7 +183,7 @@ interface KeyguardRepository {
    val statusBarState: StateFlow<StatusBarState>

    /** Observable for biometric unlock state which includes the mode and unlock source */
    val biometricUnlockState: Flow<BiometricUnlockModel>
    val biometricUnlockState: StateFlow<BiometricUnlockModel>

    fun setBiometricUnlockState(
        unlockMode: BiometricUnlockMode,
@@ -307,17 +307,20 @@ constructor(
    private val _dismissAction: MutableStateFlow<DismissAction> =
        MutableStateFlow(DismissAction.None)
    override val dismissAction = _dismissAction.asStateFlow()

    override fun setDismissAction(dismissAction: DismissAction) {
        _dismissAction.value = dismissAction
    }

    private val _keyguardDone: MutableSharedFlow<KeyguardDone> = MutableSharedFlow()
    override val keyguardDone = _keyguardDone.asSharedFlow()

    override suspend fun setKeyguardDone(keyguardDoneType: KeyguardDone) {
        _keyguardDone.emit(keyguardDoneType)
    }

    override val keyguardDoneAnimationsFinished: MutableSharedFlow<Unit> = MutableSharedFlow()

    override fun keyguardDoneAnimationsFinished() {
        keyguardDoneAnimationsFinished.tryEmit(Unit)
    }
@@ -490,6 +493,7 @@ constructor(
                        override fun onStartDream() {
                            trySendWithFailureLogging(true, TAG, "updated isDreamingWithOverlay")
                        }

                        override fun onWakeUp() {
                            trySendWithFailureLogging(false, TAG, "updated isDreamingWithOverlay")
                        }
@@ -618,7 +622,8 @@ constructor(

    private val _biometricUnlockState: MutableStateFlow<BiometricUnlockModel> =
        MutableStateFlow(BiometricUnlockModel(BiometricUnlockMode.NONE, null))
    override val biometricUnlockState = _biometricUnlockState.asStateFlow()
    override val biometricUnlockState: StateFlow<BiometricUnlockModel> =
        _biometricUnlockState.asStateFlow()

    override fun setBiometricUnlockState(
        unlockMode: BiometricUnlockMode,
+4 −0
Original line number Diff line number Diff line
@@ -3,6 +3,7 @@ package com.android.systemui.keyguard.domain.interactor
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.keyguard.data.repository.KeyguardRepository
import com.android.systemui.keyguard.shared.model.BiometricUnlockMode
import com.android.systemui.keyguard.shared.model.BiometricUnlockModel
import com.android.systemui.keyguard.shared.model.BiometricUnlockSource
import com.android.systemui.statusbar.phone.BiometricUnlockController.MODE_DISMISS_BOUNCER
import com.android.systemui.statusbar.phone.BiometricUnlockController.MODE_NONE
@@ -15,6 +16,7 @@ import com.android.systemui.statusbar.phone.BiometricUnlockController.MODE_WAKE_
import com.android.systemui.statusbar.phone.BiometricUnlockController.WakeAndUnlockMode
import javax.inject.Inject
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.StateFlow

@ExperimentalCoroutinesApi
@SysUISingleton
@@ -24,6 +26,8 @@ constructor(
    private val keyguardRepository: KeyguardRepository,
) {

    val unlockState: StateFlow<BiometricUnlockModel> = keyguardRepository.biometricUnlockState

    fun setBiometricUnlockState(
        @WakeAndUnlockMode unlockStateInt: Int,
        biometricUnlockSource: BiometricUnlockSource?,
+2 −0
Original line number Diff line number Diff line
@@ -181,6 +181,8 @@ constructor(
    /** Doze transition information. */
    val dozeTransitionModel: Flow<DozeTransitionModel> = repository.dozeTransitionModel

    val isPulsing: Flow<Boolean> = dozeTransitionModel.map { it.to == DozeStateModel.DOZE_PULSING }

    /**
     * Whether the system is dreaming. [isDreaming] will be always be true when [isDozing] is true,
     * but not vice-versa.
+6 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import com.android.systemui.CoreStartable
import com.android.systemui.notifications.ui.composable.NotificationsShadeSessionModule
import com.android.systemui.scene.domain.interactor.WindowRootViewVisibilityInteractor
import com.android.systemui.scene.domain.startable.SceneContainerStartable
import com.android.systemui.scene.domain.startable.ScrimStartable
import com.android.systemui.scene.shared.model.SceneContainerConfig
import com.android.systemui.scene.shared.model.Scenes
import com.android.systemui.shade.shared.flag.DualShade
@@ -48,6 +49,11 @@ interface KeyguardlessSceneContainerFrameworkModule {
    @ClassKey(SceneContainerStartable::class)
    fun containerStartable(impl: SceneContainerStartable): CoreStartable

    @Binds
    @IntoMap
    @ClassKey(ScrimStartable::class)
    fun scrimStartable(impl: ScrimStartable): CoreStartable

    @Binds
    @IntoMap
    @ClassKey(WindowRootViewVisibilityInteractor::class)
+6 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import com.android.systemui.bouncer.shared.flag.ComposeBouncerFlagsModule
import com.android.systemui.notifications.ui.composable.NotificationsShadeSessionModule
import com.android.systemui.scene.domain.interactor.WindowRootViewVisibilityInteractor
import com.android.systemui.scene.domain.startable.SceneContainerStartable
import com.android.systemui.scene.domain.startable.ScrimStartable
import com.android.systemui.scene.shared.model.SceneContainerConfig
import com.android.systemui.scene.shared.model.Scenes
import com.android.systemui.shade.shared.flag.DualShade
@@ -54,6 +55,11 @@ interface SceneContainerFrameworkModule {
    @ClassKey(SceneContainerStartable::class)
    fun containerStartable(impl: SceneContainerStartable): CoreStartable

    @Binds
    @IntoMap
    @ClassKey(ScrimStartable::class)
    fun scrimStartable(impl: ScrimStartable): CoreStartable

    @Binds
    @IntoMap
    @ClassKey(WindowRootViewVisibilityInteractor::class)
Loading