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

Commit 1dbbe7d6 authored by Nicolas Prevot's avatar Nicolas Prevot
Browse files

Refactor how StatusBarPolicy knows if keyguard is visible.

In the case where the keyguard has never been shown and thus
never been dismissed: StatusBarPolicy thought the keyguard was
still visible.

Instead of StatusBarPolicy keeping its own internal variable
for wether the keyguard is visible, directly use
StatusBarKeyguardViewManager.isShowing()

BUG:28755086
Change-Id: I1b30c0e6985aa7ff35eea41444ab5504c00ff130
parent bc733471
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -1178,6 +1178,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
        mKeyguardIndicationController.setStatusBarKeyguardViewManager(
                mStatusBarKeyguardViewManager);
        mFingerprintUnlockController.setStatusBarKeyguardViewManager(mStatusBarKeyguardViewManager);
        mIconPolicy.setStatusBarKeyguardViewManager(mStatusBarKeyguardViewManager);
        mRemoteInputController.addCallback(mStatusBarKeyguardViewManager);

        if (FORCE_REMOTE_INPUT_HISTORY) {
@@ -4065,12 +4066,10 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
        }
        if (mState == StatusBarState.KEYGUARD || mState == StatusBarState.SHADE_LOCKED) {
            mScrimController.setKeyguardShowing(true);
            mIconPolicy.setKeyguardShowing(true);
        } else {
            mScrimController.setKeyguardShowing(false);
            mIconPolicy.setKeyguardShowing(false);
        }

        mIconPolicy.notifyKeyguardShowingChanged();
        mNotificationPanel.setBarState(mState, mKeyguardFadingAway, goingToFullShade);
        updateDozingState();
        updatePublicMode();
+9 −6
Original line number Diff line number Diff line
@@ -80,6 +80,7 @@ public class PhoneStatusBarPolicy implements Callback, RotationLockController.Ro
    private final StatusBarIconController mIconController;
    private final RotationLockController mRotationLockController;
    private final DataSaverController mDataSaver;
    private StatusBarKeyguardViewManager mStatusBarKeyguardViewManager;

    // Assume it's all good unless we hear otherwise.  We don't always seem
    // to get broadcasts that it *is* there.
@@ -95,7 +96,6 @@ public class PhoneStatusBarPolicy implements Callback, RotationLockController.Ro
    private boolean mManagedProfileIconVisible = false;
    private boolean mManagedProfileInQuietMode = false;

    private boolean mKeyguardVisible = true;
    private BluetoothController mBluetooth;

    public PhoneStatusBarPolicy(Context context, StatusBarIconController iconController,
@@ -192,6 +192,11 @@ public class PhoneStatusBarPolicy implements Callback, RotationLockController.Ro
        mDataSaver.addListener(this);
    }

    public void setStatusBarKeyguardViewManager(
            StatusBarKeyguardViewManager statusBarKeyguardViewManager) {
        mStatusBarKeyguardViewManager = statusBarKeyguardViewManager;
    }

    public void setZenMode(int zen) {
        mZen = zen;
        updateVolumeZen();
@@ -385,10 +390,9 @@ public class PhoneStatusBarPolicy implements Callback, RotationLockController.Ro

    private void updateManagedProfile() {
        if (DEBUG) Log.v(TAG, "updateManagedProfile: mManagedProfileFocused: "
                + mManagedProfileFocused
                + " mKeyguardVisible: " + mKeyguardVisible);
                + mManagedProfileFocused);
        final boolean showIcon;
        if (mManagedProfileFocused && !mKeyguardVisible) {
        if (mManagedProfileFocused && !mStatusBarKeyguardViewManager.isShowing()) {
            showIcon = true;
            mIconController.setIcon(mSlotManagedProfile,
                    R.drawable.stat_sys_managed_profile_status,
@@ -446,8 +450,7 @@ public class PhoneStatusBarPolicy implements Callback, RotationLockController.Ro
        updateManagedProfile();
    }

    public void setKeyguardShowing(boolean visible) {
        mKeyguardVisible = visible;
    public void notifyKeyguardShowingChanged() {
        updateManagedProfile();
    }