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

Commit f42fd869 authored by Andreas Miko's avatar Andreas Miko
Browse files

Refactor KeyguardState.isBouncerState()

Bug: 349785004
Flag: com.android.systemui.scene_container
Test: Existing unit tests
Change-Id: I8cbb7ee794ec4476ef4e5df2b296b40b581bb574
parent 07ccadf6
Loading
Loading
Loading
Loading
+12 −5
Original line number Diff line number Diff line
@@ -53,6 +53,7 @@ import com.android.systemui.dreams.dagger.DreamOverlayModule;
import com.android.systemui.keyguard.domain.interactor.KeyguardTransitionInteractor;
import com.android.systemui.keyguard.shared.model.KeyguardState;
import com.android.systemui.res.R;
import com.android.systemui.scene.shared.model.Scenes;
import com.android.systemui.shade.ShadeExpansionChangeEvent;
import com.android.systemui.shade.domain.interactor.ShadeInteractor;
import com.android.systemui.statusbar.BlurUtils;
@@ -274,13 +275,19 @@ public class DreamOverlayContainerViewController extends
            collectFlow(
                    mView,
                    FlowKt.distinctUntilChanged(combineFlows(
                            mKeyguardTransitionInteractor.isFinishedInStateWhere(
                                    KeyguardState::isBouncerState),
                            mKeyguardTransitionInteractor.isFinishedIn(
                                    Scenes.Bouncer, KeyguardState.PRIMARY_BOUNCER),
                            mKeyguardTransitionInteractor.isFinishedIn(
                                    KeyguardState.ALTERNATE_BOUNCER),
                            mShadeInteractor.isAnyExpanded(),
                            mCommunalInteractor.isCommunalShowing(),
                            (anyBouncerShowing, shadeExpanded, communalShowing) -> {
                                mAnyBouncerShowing = anyBouncerShowing;
                                return anyBouncerShowing || shadeExpanded || communalShowing;
                            (primaryBouncerShowing,
                                    alternateBouncerShowing,
                                    shadeExpanded,
                                    communalShowing) -> {
                                mAnyBouncerShowing = primaryBouncerShowing
                                        || alternateBouncerShowing;
                                return mAnyBouncerShowing || shadeExpanded || communalShowing;
                            })),
                    mDreamManager::setDreamIsObscured,
                    mBackgroundDispatcher);
+0 −6
Original line number Diff line number Diff line
@@ -146,12 +146,6 @@ enum class KeyguardState {
            return state != GONE
        }

        /** Whether either of the bouncers are visible when we're FINISHED in the given state. */
        @JvmStatic
        fun isBouncerState(state: KeyguardState): Boolean {
            return state == PRIMARY_BOUNCER || state == ALTERNATE_BOUNCER
        }

        /**
         * Whether the device is awake ([PowerInteractor.isAwake]) when we're FINISHED in the given
         * keyguard state.
+0 −5
Original line number Diff line number Diff line
@@ -47,8 +47,6 @@ import com.android.systemui.communal.ui.viewmodel.CommunalViewModel
import com.android.systemui.communal.util.CommunalColors
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor
import com.android.systemui.keyguard.domain.interactor.KeyguardTransitionInteractor
import com.android.systemui.keyguard.shared.model.KeyguardState
import com.android.systemui.lifecycle.repeatWhenAttached
import com.android.systemui.res.R
import com.android.systemui.scene.shared.flag.SceneContainerFlag
@@ -150,9 +148,6 @@ constructor(
    /**
     * True if either the primary or alternate bouncer are open, meaning the hub should not receive
     * any touch input.
     *
     * Tracks [KeyguardTransitionInteractor.isFinishedInStateWhere] for
     * [KeyguardState.isBouncerState].
     */
    private var anyBouncerShowing = false

+10 −0
Original line number Diff line number Diff line
@@ -106,3 +106,13 @@ fun <A, B, C, R> combineFlows(
): Flow<R> {
    return combine(flow1, flow2, flow3, trifunction)
}

fun <T1, T2, T3, T4, R> combineFlows(
    flow: Flow<T1>,
    flow2: Flow<T2>,
    flow3: Flow<T3>,
    flow4: Flow<T4>,
    transform: (T1, T2, T3, T4) -> R
): Flow<R> {
    return combine(flow, flow2, flow3, flow4, transform)
}