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

Commit 756d1d9a authored by Danny Burakov's avatar Danny Burakov Committed by Android (Google) Code Review
Browse files

Merge "[bc25] Update references to shade in WindowRootViewVisibilityInteractor." into main

parents 2e13098f 0d226d69
Loading
Loading
Loading
Loading
+13 −11
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import com.android.systemui.keyguard.shared.model.StatusBarState
import com.android.systemui.power.domain.interactor.PowerInteractor
import com.android.systemui.scene.data.repository.WindowRootViewVisibilityRepository
import com.android.systemui.scene.shared.flag.SceneContainerFlag
import com.android.systemui.scene.shared.model.Overlays
import com.android.systemui.scene.shared.model.Scenes
import com.android.systemui.statusbar.NotificationPresenter
import com.android.systemui.statusbar.notification.domain.interactor.ActiveNotificationsInteractor
@@ -34,6 +35,7 @@ import com.android.systemui.statusbar.policy.HeadsUpManager
import javax.inject.Inject
import javax.inject.Provider
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.combine
@@ -45,6 +47,7 @@ import kotlinx.coroutines.flow.stateIn
import kotlinx.coroutines.launch

/** Business logic about the visibility of various parts of the window root view. */
@OptIn(ExperimentalCoroutinesApi::class)
@SysUISingleton
class WindowRootViewVisibilityInteractor
@Inject
@@ -80,9 +83,9 @@ constructor(
                        is ObservableTransitionState.Idle ->
                            flowOf(
                                state.currentScene == Scenes.Shade ||
                                    state.currentScene == Scenes.NotificationsShade ||
                                    state.currentScene == Scenes.QuickSettingsShade ||
                                    state.currentScene == Scenes.Lockscreen
                                    state.currentScene == Scenes.Lockscreen ||
                                    Overlays.NotificationsShade in state.currentOverlays ||
                                    Overlays.QuickSettingsShade in state.currentOverlays
                            )
                        is ObservableTransitionState.Transition ->
                            if (
@@ -94,12 +97,12 @@ constructor(
                            } else {
                                flowOf(
                                    state.toContent == Scenes.Shade ||
                                        state.toContent == Scenes.NotificationsShade ||
                                        state.toContent == Scenes.QuickSettingsShade ||
                                        state.toContent == Overlays.NotificationsShade ||
                                        state.toContent == Overlays.QuickSettingsShade ||
                                        state.toContent == Scenes.Lockscreen ||
                                        state.fromContent == Scenes.Shade ||
                                        state.fromContent == Scenes.NotificationsShade ||
                                        state.fromContent == Scenes.QuickSettingsShade ||
                                        state.fromContent == Overlays.NotificationsShade ||
                                        state.fromContent == Overlays.QuickSettingsShade ||
                                        state.fromContent == Scenes.Lockscreen
                                )
                            }
@@ -115,10 +118,9 @@ constructor(
     * false if the device is asleep.
     */
    val isLockscreenOrShadeVisibleAndInteractive: StateFlow<Boolean> =
        combine(
                isLockscreenOrShadeVisible,
                powerInteractor.isAwake,
            ) { isKeyguardAodOrShadeVisible, isAwake ->
        combine(isLockscreenOrShadeVisible, powerInteractor.isAwake) {
                isKeyguardAodOrShadeVisible,
                isAwake ->
                isKeyguardAodOrShadeVisible && isAwake
            }
            .stateIn(scope, SharingStarted.Eagerly, initialValue = false)