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

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

Hide keyguard status bar until end of OCCLUDED transition

While occluded, the default status bar will be visible until the
end of the transition back to LOCKSCREEN. Hide the keyguard status
bar until the end, and reset with a value of -1

Fixes: 409316487
Test: atest OccludedToLockscreenTransitionViewModelTest
Flag: EXEMPT bugfix
Change-Id: I460e9465c8a18a80becf9d8cd7430a4f62d06694
parent d4de2ef3
Loading
Loading
Loading
Loading
+43 −0
Original line number Diff line number Diff line
@@ -76,6 +76,49 @@ class OccludedToLockscreenTransitionViewModelTest : SysuiTestCase() {
            values.forEach { assertThat(it).isIn(Range.closed(0f, 1f)) }
        }

    @Test
    fun statusBarAlphaEmitsZero() =
        testScope.runTest {
            val values by collectValues(underTest.statusBarAlpha)
            runCurrent()

            keyguardTransitionRepository.sendTransitionSteps(
                listOf(
                    step(0f, TransitionState.STARTED),
                    step(0.1f),
                    step(0.5f),
                    step(1f, TransitionState.FINISHED),
                ),
                testScope,
            )

            assertThat(values.size).isEqualTo(3)
            assertThat(values[0]).isEqualTo(0f)
            assertThat(values[1]).isEqualTo(0f)
            assertThat(values[2]).isEqualTo(-1f)
        }

    @Test
    fun statusBarAlphaOnCancel() =
        testScope.runTest {
            val values by collectValues(underTest.statusBarAlpha)
            runCurrent()

            keyguardTransitionRepository.sendTransitionSteps(
                listOf(
                    step(0f, TransitionState.STARTED),
                    step(0.1f),
                    step(0.5f, TransitionState.CANCELED),
                ),
                testScope,
            )

            assertThat(values.size).isEqualTo(3)
            assertThat(values[0]).isEqualTo(0f)
            assertThat(values[1]).isEqualTo(0f)
            assertThat(values[2]).isEqualTo(-1f)
        }

    @Test
    fun lockscreenTranslationY() =
        testScope.runTest {
+2 −0
Original line number Diff line number Diff line
@@ -53,6 +53,7 @@ import com.android.systemui.keyguard.shared.model.TransitionState.STARTED
import com.android.systemui.keyguard.shared.model.TransitionStep
import com.android.systemui.keyguard.ui.viewmodel.glanceableHubToLockscreenTransitionViewModel
import com.android.systemui.keyguard.ui.viewmodel.lockscreenToGlanceableHubTransitionViewModel
import com.android.systemui.keyguard.ui.viewmodel.occludedToLockscreenTransitionViewModel
import com.android.systemui.kosmos.Kosmos
import com.android.systemui.kosmos.testDispatcher
import com.android.systemui.kosmos.testScope
@@ -231,6 +232,7 @@ class KeyguardStatusBarViewControllerTest : SysuiTestCase() {
            kosmos.communalSceneInteractor,
            kosmos.glanceableHubToLockscreenTransitionViewModel,
            kosmos.lockscreenToGlanceableHubTransitionViewModel,
            kosmos.occludedToLockscreenTransitionViewModel,
            kosmos.dreamViewModel,
            kosmos.keyguardInteractor,
        )
+12 −0
Original line number Diff line number Diff line
@@ -106,6 +106,18 @@ constructor(
                .map { 0f },
        )

    /**
     * Emit 0f to prevent overlap with non-keyguard status bars. Sending -1f onFinish indicates a
     * reset.
     */
    val statusBarAlpha: Flow<Float> =
        transitionAnimation.sharedFlow(
            duration = TO_LOCKSCREEN_DURATION,
            onStep = { 0f },
            onCancel = { -1f },
            onFinish = { -1f },
        )

    val deviceEntryBackgroundViewAlpha: Flow<Float> =
        transitionAnimation.immediatelyTransitionTo(1f)

+6 −1
Original line number Diff line number Diff line
@@ -59,6 +59,7 @@ import com.android.systemui.dreams.ui.viewmodel.DreamViewModel;
import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor;
import com.android.systemui.keyguard.ui.viewmodel.GlanceableHubToLockscreenTransitionViewModel;
import com.android.systemui.keyguard.ui.viewmodel.LockscreenToGlanceableHubTransitionViewModel;
import com.android.systemui.keyguard.ui.viewmodel.OccludedToLockscreenTransitionViewModel;
import com.android.systemui.log.core.LogLevel;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.res.R;
@@ -161,6 +162,7 @@ public class KeyguardStatusBarViewController extends ViewController<KeyguardStat
    private final CommunalSceneInteractor mCommunalSceneInteractor;
    private final GlanceableHubToLockscreenTransitionViewModel mHubToLockscreenTransitionViewModel;
    private final LockscreenToGlanceableHubTransitionViewModel mLockscreenToHubTransitionViewModel;
    private final OccludedToLockscreenTransitionViewModel mOccludedToLockscreenTransitionViewModel;
    private final DreamViewModel mDreamViewModel;
    private final KeyguardInteractor mKeyguardInteractor;

@@ -383,6 +385,7 @@ public class KeyguardStatusBarViewController extends ViewController<KeyguardStat
                    glanceableHubToLockscreenTransitionViewModel,
            LockscreenToGlanceableHubTransitionViewModel
                    lockscreenToGlanceableHubTransitionViewModel,
            OccludedToLockscreenTransitionViewModel occludedToLockscreenTransitionViewModel,
            DreamViewModel dreamViewModel,
            KeyguardInteractor keyguardInteractor
    ) {
@@ -417,6 +420,7 @@ public class KeyguardStatusBarViewController extends ViewController<KeyguardStat
        mCommunalSceneInteractor = communalSceneInteractor;
        mHubToLockscreenTransitionViewModel = glanceableHubToLockscreenTransitionViewModel;
        mLockscreenToHubTransitionViewModel = lockscreenToGlanceableHubTransitionViewModel;
        mOccludedToLockscreenTransitionViewModel = occludedToLockscreenTransitionViewModel;
        mDreamViewModel = dreamViewModel;
        mKeyguardInteractor = keyguardInteractor;

@@ -513,6 +517,8 @@ public class KeyguardStatusBarViewController extends ViewController<KeyguardStat
        }
        collectFlow(mView, mDreamViewModel.getStatusBarAlpha(),
                this::setAlpha, mCoroutineDispatcher);
        collectFlow(mView, mOccludedToLockscreenTransitionViewModel.getStatusBarAlpha(),
                    (alpha) -> setAlpha(alpha), mCoroutineDispatcher);
        if (Flags.bouncerUiRevamp()) {
            collectFlow(mView, mKeyguardInteractor.primaryBouncerShowing, x -> updateViewState());
        }
@@ -709,7 +715,6 @@ public class KeyguardStatusBarViewController extends ViewController<KeyguardStat
                        && !hideForBypass
                        && !mDisableStateTracker.isDisabled()
                        ? View.VISIBLE : View.INVISIBLE;

        updateViewState(newAlpha, newVisibility);
    }