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

Commit 4f7c67fc authored by Adrian Roos's avatar Adrian Roos Committed by Android (Google) Code Review
Browse files

Merge "AOD: Show keyguard while dozing but not locked"

parents 8f3a5a58 087826ad
Loading
Loading
Loading
Loading
+31 −1
Original line number Diff line number Diff line
@@ -709,6 +709,8 @@ public class StatusBar extends SystemUI implements DemoMode,
    private KeyguardMonitorImpl mKeyguardMonitor;
    private BatteryController mBatteryController;
    private boolean mPanelExpanded;
    private boolean mKeyguardRequested;
    private boolean mIsKeyguard;
    private LogMaker mStatusBarStateLog;
    private LockscreenGestureLogger mLockscreenGestureLogger = new LockscreenGestureLogger();
    private NotificationIconAreaController mNotificationIconAreaController;
@@ -4058,6 +4060,30 @@ public class StatusBar extends SystemUI implements DemoMode,
    }

    public void showKeyguard() {
        mKeyguardRequested = true;
        updateIsKeyguard();
    }

    public boolean hideKeyguard() {
        mKeyguardRequested = false;
        return updateIsKeyguard();
    }

    private boolean updateIsKeyguard() {
        // For dozing, keyguard needs to be shown whenever the device is non-interactive. Otherwise
        // there's no surface we can show to the user.
        boolean keyguardForDozing = mDozingRequested && !mDeviceInteractive;
        boolean shouldBeKeyguard = mKeyguardRequested || keyguardForDozing;
        if (shouldBeKeyguard && !mIsKeyguard) {
            showKeyguardImpl();
        } else if (!shouldBeKeyguard && mIsKeyguard) {
            return hideKeyguardImpl();
        }
        return false;
    }

    public void showKeyguardImpl() {
        mIsKeyguard = true;
        if (mLaunchTransitionFadingAway) {
            mNotificationPanel.animate().cancel();
            onLaunchTransitionFadingEnded();
@@ -4211,7 +4237,8 @@ public class StatusBar extends SystemUI implements DemoMode,
    /**
     * @return true if we would like to stay in the shade, false if it should go away entirely
     */
    public boolean hideKeyguard() {
    public boolean hideKeyguardImpl() {
        mIsKeyguard = false;
        Trace.beginSection("StatusBar#hideKeyguard");
        boolean staying = mLeaveOpenOnKeyguardHide;
        setBarState(StatusBarState.SHADE);
@@ -4890,6 +4917,7 @@ public class StatusBar extends SystemUI implements DemoMode,
                }
            });
        }
        updateIsKeyguard();
    }

    public void onStartedWakingUp() {
@@ -4898,6 +4926,7 @@ public class StatusBar extends SystemUI implements DemoMode,
        mVisualStabilityManager.setScreenOn(true);
        mNotificationPanel.setTouchDisabled(false);
        updateVisibleToUser();
        updateIsKeyguard();
    }

    public void onScreenTurningOn() {
@@ -5012,6 +5041,7 @@ public class StatusBar extends SystemUI implements DemoMode,
                || mFingerprintUnlockController.getMode()
                        == FingerprintUnlockController.MODE_WAKE_AND_UNLOCK_PULSING;
        mStatusBarWindowManager.setDozing(mDozing);
        mStatusBarKeyguardViewManager.setDozing(mDozing);
        updateDozingState();
        Trace.endSection();
    }
+15 −6
Original line number Diff line number Diff line
@@ -84,6 +84,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
    protected boolean mShowing;
    protected boolean mOccluded;
    protected boolean mRemoteInputActive;
    private boolean mDozing;

    protected boolean mFirstUpdate = true;
    protected boolean mLastShowing;
@@ -91,6 +92,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
    private boolean mLastBouncerShowing;
    private boolean mLastBouncerDismissible;
    protected boolean mLastRemoteInputActive;
    private boolean mLastDozing;

    private OnDismissAction mAfterKeyguardGoneAction;
    private final ArrayList<Runnable> mAfterKeyguardGoneRunnables = new ArrayList<>();
@@ -239,6 +241,11 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
        updateStates();
    }

    public void setDozing(boolean dozing) {
        mDozing = dozing;
        updateStates();
    }

    public void onScreenTurnedOff() {
        mScreenTurnedOn = false;
        mStatusBar.onScreenTurnedOff();
@@ -481,11 +488,11 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
    private long getNavBarShowDelay() {
        if (mStatusBar.isKeyguardFadingAway()) {
            return mStatusBar.getKeyguardFadingAwayDelay();
        } else {

            // Keyguard is not going away, thus we are showing the navigation bar because the
            // bouncer is appearing.
        } else if (mBouncer.isShowing()) {
            return NAV_BAR_SHOW_DELAY_BOUNCER;
        } else {
            // No longer dozing, or remote input is active. No delay.
            return 0;
        }
    }

@@ -553,6 +560,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
        mLastBouncerShowing = bouncerShowing;
        mLastBouncerDismissible = bouncerDismissible;
        mLastRemoteInputActive = remoteInputActive;
        mLastDozing = mDozing;

        mStatusBar.onKeyguardViewManagerStatesUpdated();
    }
@@ -561,14 +569,15 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
     * @return Whether the navigation bar should be made visible based on the current state.
     */
    protected boolean isNavBarVisible() {
        return !(mShowing && !mOccluded) || mBouncer.isShowing() || mRemoteInputActive;
        return !(mShowing && !mOccluded) && !mDozing || mBouncer.isShowing() || mRemoteInputActive;
    }

    /**
     * @return Whether the navigation bar was made visible based on the last known state.
     */
    protected boolean getLastNavBarVisible() {
        return !(mLastShowing && !mLastOccluded) || mLastBouncerShowing || mLastRemoteInputActive;
        return !(mLastShowing && !mLastOccluded) && !mLastDozing || mLastBouncerShowing
                || mLastRemoteInputActive;
    }

    public boolean shouldDismissOnMenuPressed() {