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

Commit 8fc06523 authored by Danny Baumann's avatar Danny Baumann Committed by Gerrit Code Review
Browse files

Don't let apps disable the SIM PIN entry screen.

As the user (who controls the app behaviour after all) likely doesn't
see the PIN screen as a lock screen (he likely wants telephony) and the
PIN screen is not shown on a timer-driven basis, it should be treated
specially.
parent b2212763
Loading
Loading
Loading
Loading
+15 −15
Original line number Diff line number Diff line
@@ -641,8 +641,22 @@ public class KeyguardViewMediator implements KeyguardViewCallback,
            boolean disableLockscreen=(Settings.System.getInt(mContext.getContentResolver(),
                    Settings.System.LOCKSCREEN_DISABLED, defValue) == 1);

            // if the setup wizard hasn't run yet, don't show
            final boolean requireSim = !SystemProperties.getBoolean("keyguard.no_require_sim",
                    false);
            final boolean provisioned = mUpdateMonitor.isDeviceProvisioned();
            final IccCard.State state = mUpdateMonitor.getSimState();
            final boolean lockedOrMissing = state.isPinLocked()
                    || ((state == IccCard.State.ABSENT) && requireSim);

            if (!lockedOrMissing && !provisioned) {
                if (DEBUG) Log.d(TAG, "doKeyguard: not showing because device isn't provisioned"
                        + " and the sim is not locked or missing");
                return;
            }

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

                // note: we *should* set mNeedToReshowWhenReenabled=true here, but that makes
@@ -657,20 +671,6 @@ public class KeyguardViewMediator implements KeyguardViewCallback,
                return;
            }

            // if the setup wizard hasn't run yet, don't show
            final boolean requireSim = !SystemProperties.getBoolean("keyguard.no_require_sim",
                    false);
            final boolean provisioned = mUpdateMonitor.isDeviceProvisioned();
            final IccCard.State state = mUpdateMonitor.getSimState();
            final boolean lockedOrMissing = state.isPinLocked()
                    || ((state == IccCard.State.ABSENT) && requireSim);

            if (!lockedOrMissing && !provisioned) {
                if (DEBUG) Log.d(TAG, "doKeyguard: not showing because device isn't provisioned"
                        + " and the sim is not locked or missing");
                return;
            }

            if (!disableLockscreen || state.isPinLocked()) {
                if (DEBUG)
                    Log.d(TAG, "doKeyguard: showing the applicable keyguard screen");