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

Commit f9a848fb authored by Roman Birg's avatar Roman Birg
Browse files

SystemUI: prompt for SIM PIN if lockscreen is disabled



Ref: CYNGNOS-1930

Change-Id: Ie5d2557c84c1ff9f1053de525e68c5ed790ecb99
Signed-off-by: default avatarRoman Birg <roman@cyngn.com>
parent ac8c7b01
Loading
Loading
Loading
Loading
+28 −22
Original line number Diff line number Diff line
@@ -517,7 +517,9 @@ public class KeyguardViewMediator extends SystemUI {
                    break;
                case READY:
                    synchronized (this) {
                        if (mShowing) {
                        if (mInternallyDisabled) {
                            hideLocked();
                        } else if (mShowing) {
                            resetStateLocked();
                        }
                    }
@@ -761,7 +763,7 @@ public class KeyguardViewMediator extends SystemUI {
                    Slog.w(TAG, "Failed to call onKeyguardExitResult(false)", e);
                }
                mExitSecureCallback = null;
                if (!mExternallyEnabled) {
                if (!mInternallyDisabled && !mExternallyEnabled) {
                    hideLocked();
                }
            } else if (mShowing) {
@@ -914,6 +916,10 @@ public class KeyguardViewMediator extends SystemUI {
            if (DEBUG) Log.d(TAG, "isKeyguardDisabled: keyguard is disabled by setting");
            return true;
        }
        if (mInternallyDisabled) {
            if (DEBUG) Log.d(TAG, "isKeyguardDisabled: keyguard is disabled internally");
            return true;
        }
        Profile profile = mProfileManager.getActiveProfile();
        if (profile != null) {
            if (profile.getScreenLockMode().getValue() == Profile.LockMode.DISABLE) {
@@ -973,15 +979,15 @@ public class KeyguardViewMediator extends SystemUI {
    public void setKeyguardEnabled(boolean enabled) {
        synchronized (this) {
            if (DEBUG) Log.d(TAG, "setKeyguardEnabled(" + enabled + ")");

            if (mInternallyDisabled && enabled && !lockscreenEnforcedByDevicePolicy()) {
            mExternallyEnabled = enabled;
            if (mInternallyDisabled
                    && enabled
                    && !lockscreenEnforcedByDevicePolicy()) {
                // if keyguard is forcefully disabled internally (by lock screen tile), don't allow
                // it to be enabled externally, unless the device policy manager says so.
                return;
            }

            mExternallyEnabled = enabled;

            if (!enabled && mShowing) {
                if (mExitSecureCallback != null) {
                    if (DEBUG) Log.d(TAG, "in process of verifyUnlock request, ignoring");
@@ -1173,22 +1179,6 @@ public class KeyguardViewMediator extends SystemUI {
     * Enable the keyguard if the settings are appropriate.
     */
    private void doKeyguardLocked(Bundle options) {
        // if another app is disabling us, don't show
        if (!mExternallyEnabled) {
            if (DEBUG) Log.d(TAG, "doKeyguard: not showing because externally disabled");

            // note: we *should* set mNeedToReshowWhenReenabled=true here, but that makes
            // for an occasional ugly flicker in this situation:
            // 1) receive a call with the screen on (no keyguard) or make a call
            // 2) screen times out
            // 3) user hits key to turn screen back on
            // instead, we reenable the keyguard when we know the screen is off and the call
            // ends (see the broadcast receiver below)
            // TODO: clean this up when we have better support at the window manager level
            // for apps that wish to be on top of the keyguard
            return;
        }

        // if the keyguard is already showing, don't bother
        if (mStatusBarKeyguardViewManager.isShowing()) {
            if (DEBUG) Log.d(TAG, "doKeyguard: not showing because it is already showing");
@@ -1211,6 +1201,22 @@ public class KeyguardViewMediator extends SystemUI {
            return;
        }

        // if another app is disabling us, don't show
        if (!mExternallyEnabled && !lockedOrMissing) {
            if (DEBUG) Log.d(TAG, "doKeyguard: not showing because externally disabled");

            // note: we *should* set mNeedToReshowWhenReenabled=true here, but that makes
            // for an occasional ugly flicker in this situation:
            // 1) receive a call with the screen on (no keyguard) or make a call
            // 2) screen times out
            // 3) user hits key to turn screen back on
            // instead, we reenable the keyguard when we know the screen is off and the call
            // ends (see the broadcast receiver below)
            // TODO: clean this up when we have better support at the window manager level
            // for apps that wish to be on top of the keyguard
            return;
        }

        if (isKeyguardDisabled(KeyguardUpdateMonitor.getCurrentUser())
                && !lockedOrMissing) {
            if (DEBUG) Log.d(TAG, "doKeyguard: not showing because lockscreen is off");