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

Commit 2a98a4cb authored by Jim Miller's avatar Jim Miller
Browse files

Fix 3024522: Add "no lock screen" support to the framework.

This adds a new feature where LockScreen can be disabled to
allow the device to go straight to the home screen when
powered on.

Change-Id: I288e8d5359442c042ae7911340885877a864faff
parent 360a102f
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -95,6 +95,7 @@ public class LockPatternUtils {
    private final static String PATTERN_EVER_CHOSEN_KEY = "lockscreen.patterneverchosen";
    public final static String PASSWORD_TYPE_KEY = "lockscreen.password_type";
    private final static String LOCK_PASSWORD_SALT_KEY = "lockscreen.password_salt";
    private final static String DISABLE_LOCKSCREEN_KEY = "lockscreen.disabled";

    private final static String PASSWORD_HISTORY_KEY = "lockscreen.passwordhistory";

@@ -354,6 +355,26 @@ public class LockPatternUtils {
        setLong(PASSWORD_TYPE_KEY, DevicePolicyManager.PASSWORD_QUALITY_SOMETHING);
    }

    /**
     * Disable showing lock screen at all when the DevicePolicyManager allows it.
     * This is only meaningful if pattern, pin or password are not set.
     *
     * @param disable Disables lock screen when true
     */
    public void setLockScreenDisabled(boolean disable) {
        setLong(DISABLE_LOCKSCREEN_KEY, disable ? 1 : 0);
    }

    /**
     * Determine if LockScreen can be disabled. This is used, for example, to tell if we should
     * show LockScreen or go straight to the home screen.
     *
     * @return true if lock screen is can be disabled
     */
    public boolean isLockScreenDisabled() {
        return !isSecure() && getLong(DISABLE_LOCKSCREEN_KEY, 0) != 0;
    }

    /**
     * Save a lock pattern.
     * @param pattern The new pattern to save.
+7 −2
Original line number Diff line number Diff line
@@ -589,6 +589,11 @@ public class KeyguardViewMediator implements KeyguardViewCallback,
                return;
            }

            if (mLockPatternUtils.isLockScreenDisabled()) {
                if (DEBUG) Log.d(TAG, "doKeyguard: not showing because lockscreen is off");
                return;
            }

            if (DEBUG) Log.d(TAG, "doKeyguard: showing the lock screen");
            showLocked();
        }