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

Commit ec08e5fa authored by eray orçunus's avatar eray orçunus Committed by Gerrit Code Review
Browse files

lockscreen: Add option for showing unlock screen directly (1/2)



* Option appears on PIN,pattern and password methods
* User should press back button to see swipe-up-to-unlock screen.
* Instantly hides keyguard if Smart Lock has unlocked phone.

Change-Id: I2ceeed348d7e61632b8344f35431f30cba62ca4f
Signed-off-by: default avatareray orçunus <erayorcunus@gmail.com>
parent 89b9cd6e
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -1234,6 +1234,7 @@ public final class Settings {
            MOVED_TO_SECURE.add(Secure.LOCK_PATTERN_ENABLED);
            MOVED_TO_SECURE.add(Secure.LOCK_PATTERN_VISIBLE);
            MOVED_TO_SECURE.add(Secure.LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED);
            MOVED_TO_SECURE.add(Secure.LOCK_PASS_TO_SECURITY_VIEW);
            MOVED_TO_SECURE.add(Secure.LOCK_PATTERN_SIZE);
            MOVED_TO_SECURE.add(Secure.LOCK_DOTS_VISIBLE);
            MOVED_TO_SECURE.add(Secure.LOCK_SHOW_ERROR_PATH);
@@ -3947,6 +3948,7 @@ public final class Settings {
            MOVED_TO_LOCK_SETTINGS.add(Secure.LOCK_PATTERN_ENABLED);
            MOVED_TO_LOCK_SETTINGS.add(Secure.LOCK_PATTERN_VISIBLE);
            MOVED_TO_LOCK_SETTINGS.add(Secure.LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED);
            MOVED_TO_LOCK_SETTINGS.add(Secure.LOCK_PASS_TO_SECURITY_VIEW);
            MOVED_TO_LOCK_SETTINGS.add(Secure.LOCK_PATTERN_SIZE);
            MOVED_TO_LOCK_SETTINGS.add(Secure.LOCK_DOTS_VISIBLE);
            MOVED_TO_LOCK_SETTINGS.add(Secure.LOCK_SHOW_ERROR_PATH);
@@ -4721,6 +4723,12 @@ public final class Settings {
        public static final String
                LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED = "lock_pattern_tactile_feedback_enabled";

        /**
         * Whether keyguard will direct show security view (0 = false, 1 = true)
         * @hide
         */
        public static final String LOCK_PASS_TO_SECURITY_VIEW = "lock_screen_pass_to_security_view";

        /**
         * Determines the width and height of the LockPatternView widget
         * @hide
+8 −0
Original line number Diff line number Diff line
@@ -1418,6 +1418,14 @@ public class LockPatternUtils {
        return getBoolean(Settings.Secure.LOCK_SHOW_ERROR_PATH, true);
    }

    public boolean shouldPassToSecurityView() {
        return getBoolean(Settings.Secure.LOCK_PASS_TO_SECURITY_VIEW, false);
    }

    public void setPassToSecurityView(boolean enabled) {
        setBoolean(Settings.Secure.LOCK_PASS_TO_SECURITY_VIEW, enabled);
    }

    /**
     * Set and store the lockout deadline, meaning the user can't attempt his/her unlock
     * pattern until the deadline has passed.
+1 −0
Original line number Diff line number Diff line
@@ -689,6 +689,7 @@ public class DatabaseHelper extends SQLiteOpenHelper {
                   Secure.LOCK_PATTERN_ENABLED,
                   Secure.LOCK_PATTERN_VISIBLE,
                   Secure.LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED,
                   Secure.LOCK_PASS_TO_SECURITY_VIEW,
                   Secure.LOCK_PATTERN_SIZE,
                   Secure.LOCK_DOTS_VISIBLE,
                   Secure.LOCK_SHOW_ERROR_PATH,
+1 −1
Original line number Diff line number Diff line
@@ -1849,7 +1849,7 @@ public class KeyguardViewMediator extends SystemUI {
    private void handleReset() {
        synchronized (KeyguardViewMediator.this) {
            if (DEBUG) Log.d(TAG, "handleReset");
            mStatusBarKeyguardViewManager.reset();
            mStatusBarKeyguardViewManager.reset(false);
        }
    }

+24 −8
Original line number Diff line number Diff line
@@ -38,6 +38,10 @@ import static com.android.keyguard.KeyguardSecurityModel.SecurityMode;
 */
public class KeyguardBouncer {

    public static final int UNLOCK_SEQUENCE_DEFAULT = 0;
    public static final int UNLOCK_SEQUENCE_BOUNCER_FIRST = 1;
    public static final int UNLOCK_SEQUENCE_FORCE_BOUNCER = 2;

    private Context mContext;
    private ViewMediatorCallback mCallback;
    private LockPatternUtils mLockPatternUtils;
@@ -191,27 +195,39 @@ public class KeyguardBouncer {
    }

    /**
     * @return True if and only if the security method should be shown before showing the
     * notifications on Keyguard, like SIM PIN/PUK.
     * @return Whether the bouncer should be shown first, this could be because of SIM PIN/PUK
     * or it just could be chosen to be shown first.
     */
    public boolean needsFullscreenBouncer() {
    public int needsFullscreenBouncer() {
        if (mKeyguardView != null) {
            SecurityMode mode = mKeyguardView.getSecurityMode();
            return mode == SecurityMode.SimPin || mode == SecurityMode.SimPuk;
            if (mode == SecurityMode.SimPin || mode == SecurityMode.SimPuk)
                return UNLOCK_SEQUENCE_FORCE_BOUNCER;
            // "Bouncer first" mode currently only available to some security methods.
            else if ((mode == SecurityMode.Pattern || mode == SecurityMode.Password
                    || mode == SecurityMode.PIN) && (mLockPatternUtils != null &&
                    mLockPatternUtils.shouldPassToSecurityView()))
                return UNLOCK_SEQUENCE_BOUNCER_FIRST;
        }
        return false;
        return UNLOCK_SEQUENCE_DEFAULT;
    }

    /**
     * Like {@link #needsFullscreenBouncer}, but uses the currently visible security method, which
     * makes this method much faster.
     */
    public boolean isFullscreenBouncer() {
    public int isFullscreenBouncer() {
        if (mKeyguardView != null) {
            SecurityMode mode = mKeyguardView.getCurrentSecurityMode();
            return mode == SecurityMode.SimPin || mode == SecurityMode.SimPuk;
        }
        return false;
            if (mode == SecurityMode.SimPin || mode == SecurityMode.SimPuk)
                return UNLOCK_SEQUENCE_FORCE_BOUNCER;
            // "Bouncer first" mode currently only available to some security methods.
            else if ((mode == SecurityMode.Pattern || mode == SecurityMode.Password
                    || mode == SecurityMode.PIN) && (mLockPatternUtils != null &&
                    mLockPatternUtils.shouldPassToSecurityView()))
                return UNLOCK_SEQUENCE_BOUNCER_FIRST;
        }
        return UNLOCK_SEQUENCE_DEFAULT;
    }

    /**
Loading