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

Commit fc0de957 authored by Matt Pietal's avatar Matt Pietal
Browse files

Fix shade showing over dream with bouncer

Swiping down on the bouncer over a dream, or swiping back
could show the shade. Prevent those touches from opening
the shade.

Fixes: 328503913
Test: atest KeyguardTransitionScenariosTest
Test: manual - swipe down/back on bouncer over dream
Flag: ACONFIG com.android.systemui.migrate_clocks_to_blueprint
TEAMFOOD

Change-Id: I7803c08fff11b86365f2aee582513da1b125b67f
parent d38bec27
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ import com.android.systemui.keyguard.shared.model.DozeStateModel
import com.android.systemui.keyguard.shared.model.KeyguardState
import com.android.systemui.power.domain.interactor.PowerInteractor
import com.android.systemui.util.kotlin.Utils.Companion.sample as sampleCombine
import com.android.systemui.util.kotlin.sample
import javax.inject.Inject
import kotlin.time.Duration.Companion.milliseconds
import kotlin.time.Duration.Companion.seconds
@@ -71,6 +72,7 @@ constructor(
        listenForDreamingToAodOrDozing()
        listenForTransitionToCamera(scope, keyguardInteractor)
        listenForDreamingToGlanceableHub()
        listenForDreamingToPrimaryBouncer()
    }

    private fun listenForDreamingToGlanceableHub() {
@@ -84,6 +86,21 @@ constructor(
        }
    }

    private fun listenForDreamingToPrimaryBouncer() {
        scope.launch {
            keyguardInteractor.primaryBouncerShowing
                .sample(startedKeyguardTransitionStep, ::Pair)
                .collect { pair ->
                    val (isBouncerShowing, lastStartedTransitionStep) = pair
                    if (
                        isBouncerShowing && lastStartedTransitionStep.to == KeyguardState.DREAMING
                    ) {
                        startTransitionTo(KeyguardState.PRIMARY_BOUNCER)
                    }
                }
        }
    }

    fun startToLockscreenTransition() {
        scope.launch {
            KeyguardWmStateRefactor.isUnexpectedlyInLegacyMode()
+9 −6
Original line number Diff line number Diff line
@@ -382,6 +382,8 @@ public class NotificationShadeWindowViewController implements Dumpable {
                    float x = ev.getRawX();
                    float y = ev.getRawY();
                    if (mStatusBarViewController.touchIsWithinView(x, y)) {
                        if (!(MigrateClocksToBlueprint.isEnabled()
                                && mPrimaryBouncerInteractor.isBouncerShowing())) {
                            if (mStatusBarWindowStateController.windowIsShowing()) {
                                mIsTrackingBarGesture = true;
                                return logDownDispatch(ev, "sending touch to status bar",
@@ -390,6 +392,7 @@ public class NotificationShadeWindowViewController implements Dumpable {
                                return logDownDispatch(ev, "hidden or hiding", true);
                            }
                        }
                    }
                } else if (mIsTrackingBarGesture) {
                    final boolean sendToStatusBar = mStatusBarViewController.sendTouchToView(ev);
                    if (isUp || isCancel) {
+3 −1
Original line number Diff line number Diff line
@@ -1296,9 +1296,11 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
            return;
        }

        boolean hideBouncerOverDream = isBouncerShowing()
                && mDreamOverlayStateController.isOverlayActive();
        mCentralSurfaces.endAffordanceLaunch();
        // The second condition is for SIM card locked bouncer
        if (primaryBouncerIsScrimmed() && !needsFullscreenBouncer()) {
        if (hideBouncerOverDream || (primaryBouncerIsScrimmed() && !needsFullscreenBouncer())) {
            hideBouncer(false);
            updateStates();
        } else {
+24 −0
Original line number Diff line number Diff line
@@ -1388,6 +1388,30 @@ class KeyguardTransitionScenariosTest : SysuiTestCase() {
            coroutineContext.cancelChildren()
        }

    @Test
    fun dreamingToPrimaryBouncer() =
        testScope.runTest {
            // GIVEN a prior transition has run to DREAMING
            keyguardRepository.setDreaming(true)
            runTransitionAndSetWakefulness(KeyguardState.LOCKSCREEN, KeyguardState.DREAMING)
            runCurrent()

            // WHEN the primary bouncer is set to show
            bouncerRepository.setPrimaryShow(true)
            runCurrent()

            // THEN a transition to PRIMARY_BOUNCER should occur
            assertThat(transitionRepository)
                .startedTransition(
                    ownerName = "FromDreamingTransitionInteractor",
                    from = KeyguardState.DREAMING,
                    to = KeyguardState.PRIMARY_BOUNCER,
                    animatorAssertion = { it.isNotNull() },
                )

            coroutineContext.cancelChildren()
        }

    @Test
    fun dreamingToAod() =
        testScope.runTest {