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

Commit f6f76bcf authored by Adrian Roos's avatar Adrian Roos
Browse files

StatusBar: Make sure showKeyguard is called when needed

- Fixes an issue where the keyguard was not visible after returning
  from the bouncer because the panel was not expanded
- Fixes an issue where the keyguard was not hiding sensitive content
  because the showKeyguard call was made before the keyguard became
  locked
- Fixes an issue where the ambient display was showing bad state because
  the panel was not expanded when turning the screen off.

Test: trigger bouncer, press back. Observe that keyguard shows again. Also, trigger bouncer, then lock. Observe that ambient display works. Also turn on "hide sensitive notifications on lockscreen", observe that it actually does that.
Fixes: 37868130
Bug: 37907366
Change-Id: Ic03e46a067d6e6a0152796136c39a0de66301008
parent b2d2442a
Loading
Loading
Loading
Loading
+18 −8
Original line number Diff line number Diff line
@@ -4062,7 +4062,10 @@ public class StatusBar extends SystemUI implements DemoMode,

    public void showKeyguard() {
        mKeyguardRequested = true;
        updateIsKeyguard();
        // Unconditionally show keyguard again. There's some logic that relies on this
        // being called even when the keyguard is already showing, e.g. for updating
        // sensitiveness of notifications and making sure the panels are expanded.
        showKeyguardImpl();
    }

    public boolean hideKeyguard() {
@@ -4075,7 +4078,10 @@ public class StatusBar extends SystemUI implements DemoMode,
        // there's no surface we can show to the user.
        boolean keyguardForDozing = mDozingRequested && !mDeviceInteractive;
        boolean shouldBeKeyguard = mKeyguardRequested || keyguardForDozing;
        if (shouldBeKeyguard && !mIsKeyguard) {
        if (keyguardForDozing) {
            updatePanelExpansionForKeyguard();
        }
        if (shouldBeKeyguard) {
            showKeyguardImpl();
        } else if (!shouldBeKeyguard && mIsKeyguard) {
            return hideKeyguardImpl();
@@ -4103,11 +4109,7 @@ public class StatusBar extends SystemUI implements DemoMode,
            // Keyguard.
            mNotificationPanel.setTouchDisabled(true);
        }
        if (mState == StatusBarState.KEYGUARD) {
            instantExpandNotificationsPanel();
        } else if (mState == StatusBarState.FULLSCREEN_USER_SWITCHER) {
            instantCollapseNotificationPanel();
        }
        updatePanelExpansionForKeyguard();
        mLeaveOpenOnKeyguardHide = false;
        if (mDraggedDownRow != null) {
            mDraggedDownRow.setUserLocked(false);
@@ -4118,6 +4120,14 @@ public class StatusBar extends SystemUI implements DemoMode,
        mAssistManager.onLockscreenShown();
    }

    private void updatePanelExpansionForKeyguard() {
        if (mState == StatusBarState.KEYGUARD) {
            instantExpandNotificationsPanel();
        } else if (mState == StatusBarState.FULLSCREEN_USER_SWITCHER) {
            instantCollapseNotificationPanel();
        }
    }

    private void onLaunchTransitionFadingEnded() {
        mNotificationPanel.setAlpha(1.0f);
        mNotificationPanel.onAffordanceLaunchEnded();
@@ -4506,7 +4516,6 @@ public class StatusBar extends SystemUI implements DemoMode,
    }

    private void instantExpandNotificationsPanel() {

        // Make our window larger and the panel expanded.
        makeExpandedVisible(true);
        mNotificationPanel.expand(false /* animate */);
@@ -5087,6 +5096,7 @@ public class StatusBar extends SystemUI implements DemoMode,
                mDozingRequested = true;
                DozeLog.traceDozing(mContext, mDozing);
                updateDozing();

            }
        }