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

Commit 5043585e authored by Ricardo Cerqueira's avatar Ricardo Cerqueira
Browse files

Keyguard: Turn lock-before-unlock into a user-configurable setting

Showing the unsecured lock screen (Slider/widget screen) before the
security screen is now a secure Setting (still defaulting to off)

Change-Id: I0a11f82ffe074d289129b2b972ffc0135eea81ed
parent d86503d7
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -3211,6 +3211,14 @@ public final class Settings {
        public static final String LOCK_SCREEN_OWNER_INFO_ENABLED =
            "lock_screen_owner_info_enabled";

        /**
         * Whether the unsecure widget screen will be shown before a secure
         * lock screen
         * @hide
         */
        public static final String LOCK_BEFORE_UNLOCK =
            "lock_before_unlock";

        /**
         * The saved value for WindowManagerService.setForcedDisplaySize().
         * Two integers separated by a comma.  If unset, then use the real display size.
+9 −0
Original line number Diff line number Diff line
@@ -1103,4 +1103,13 @@ public class LockPatternUtils {
        return getBoolean(LOCKSCREEN_POWER_BUTTON_INSTANTLY_LOCKS, true);
    }

    /**
     * @hide
     * Set the lock-before-unlock option (show widgets before the secure
     * unlock screen). See config_enableLockBeforeUnlockScreen
     */
    public void setLockBeforeUnlock(boolean enabled) {
        setBoolean(Settings.Secure.LOCK_BEFORE_UNLOCK, enabled);
    }

}
+9 −1
Original line number Diff line number Diff line
@@ -59,6 +59,7 @@ import android.os.Parcelable;
import android.os.RemoteException;
import android.os.SystemClock;
import android.os.SystemProperties;
import android.provider.Settings;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.Log;
@@ -740,7 +741,9 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler

    protected void onConfigurationChanged(Configuration newConfig) {
        Resources resources = getResources();
        mShowLockBeforeUnlock = resources.getBoolean(R.bool.config_enableLockBeforeUnlockScreen);
        mShowLockBeforeUnlock = resources.getBoolean(R.bool.config_enableLockBeforeUnlockScreen) ||
                        (Settings.Secure.getInt(mContext.getContentResolver(),
                        Settings.Secure.LOCK_BEFORE_UNLOCK, 0) != 0);
        mConfiguration = newConfig;
        if (DEBUG_CONFIGURATION) Log.v(TAG, "**** re-creating lock screen since config changed");
        saveWidgetState();
@@ -1032,6 +1035,11 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler
     */
    private Mode getInitialMode() {
        final IccCard.State simState = mUpdateMonitor.getSimState();

        mShowLockBeforeUnlock = mContext.getResources().getBoolean(R.bool.config_enableLockBeforeUnlockScreen) ||
                        (Settings.Secure.getInt(mContext.getContentResolver(),
                        Settings.Secure.LOCK_BEFORE_UNLOCK, 0) != 0);

        if (stuckOnLockScreenBecauseSimMissing() ||
                (simState == IccCard.State.PUK_REQUIRED &&
                        !mLockPatternUtils.isPukUnlockScreenEnable())) {