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

Commit 17554c93 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Check device sleeping state for bouncer visibility" into main

parents 19bed91f 7910e6a2
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -182,6 +182,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
    private boolean mBouncerShowingOverDream;
    private int mAttemptsToShowBouncer = 0;
    private DelayableExecutor mExecutor;
    private boolean mIsSleeping = false;

    private final PrimaryBouncerExpansionCallback mExpansionCallback =
            new PrimaryBouncerExpansionCallback() {
@@ -713,7 +714,11 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
     * {@link #needsFullscreenBouncer()}.
     */
    protected void showBouncerOrKeyguard(boolean hideBouncerWhenShowing, boolean isFalsingReset) {
        if (needsFullscreenBouncer() && !mDozing) {
        boolean showBouncer = needsFullscreenBouncer() && !mDozing;
        if (Flags.simPinRaceConditionOnRestart()) {
            showBouncer = showBouncer && !mIsSleeping;
        }
        if (showBouncer) {
            // The keyguard might be showing (already). So we need to hide it.
            if (!primaryBouncerIsShowing()) {
                if (SceneContainerFlag.isEnabled()) {
@@ -1041,6 +1046,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb

    @Override
    public void onStartedWakingUp() {
        mIsSleeping = false;
        setRootViewAnimationDisabled(false);
        NavigationBarView navBarView = mCentralSurfaces.getNavigationBarView();
        if (navBarView != null) {
@@ -1054,6 +1060,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb

    @Override
    public void onStartedGoingToSleep() {
        mIsSleeping = true;
        setRootViewAnimationDisabled(true);
        NavigationBarView navBarView = mCentralSurfaces.getNavigationBarView();
        if (navBarView != null) {
+19 −0
Original line number Diff line number Diff line
@@ -1112,9 +1112,11 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase {
    public void testShowBouncerOrKeyguard_showsKeyguardIfShowBouncerReturnsFalse() {
        when(mKeyguardSecurityModel.getSecurityMode(anyInt())).thenReturn(
                KeyguardSecurityModel.SecurityMode.SimPin);
        // Returning false means unable to show the bouncer
        when(mPrimaryBouncerInteractor.show(true)).thenReturn(false);
        when(mKeyguardTransitionInteractor.getTransitionState().getValue().getTo())
                .thenReturn(KeyguardState.LOCKSCREEN);
        mStatusBarKeyguardViewManager.onStartedWakingUp();

        reset(mCentralSurfaces);
        // Advance past reattempts
@@ -1125,6 +1127,23 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase {
        verify(mCentralSurfaces).showKeyguard();
    }

    @Test
    @DisableSceneContainer
    @EnableFlags(Flags.FLAG_SIM_PIN_RACE_CONDITION_ON_RESTART)
    public void testShowBouncerOrKeyguard_showsKeyguardIfSleeping() {
        when(mKeyguardTransitionInteractor.getTransitionState().getValue().getTo())
                .thenReturn(KeyguardState.LOCKSCREEN);
        mStatusBarKeyguardViewManager.onStartedGoingToSleep();

        reset(mCentralSurfaces);
        reset(mPrimaryBouncerInteractor);
        mStatusBarKeyguardViewManager.showBouncerOrKeyguard(
                /* hideBouncerWhenShowing= */true, false);
        verify(mCentralSurfaces).showKeyguard();
        verify(mPrimaryBouncerInteractor).hide();
    }


    @Test
    @DisableSceneContainer
    public void testShowBouncerOrKeyguard_needsFullScreen_bouncerAlreadyShowing() {