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

Commit 00094f3d authored by Danesh M's avatar Danesh M Committed by Gerrit Code Review
Browse files

Merge "Port Forward Quick Unlock" into cm-11.0

parents f88f81a0 5cbb5e91
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.os.CountDownTimer;
import android.os.SystemClock;
import android.provider.Settings;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.AttributeSet;
@@ -46,6 +47,7 @@ public abstract class KeyguardAbsKeyInputView extends LinearLayout
    protected View mEcaView;
    private Drawable mBouncerFrame;
    protected boolean mEnableHaptics;
    private boolean mQuickUnlock;

    // To avoid accidental lockout due to events while the device in in the pocket, ignore
    // any passwords with length less than or equal to this length.
@@ -104,6 +106,8 @@ public abstract class KeyguardAbsKeyInputView extends LinearLayout
        mPasswordEntry = (TextView) findViewById(getPasswordTextViewId());
        mPasswordEntry.setOnEditorActionListener(this);
        mPasswordEntry.addTextChangedListener(this);
        mQuickUnlock = (Settings.System.getInt(mContext.getContentResolver(),
                Settings.System.LOCKSCREEN_QUICK_UNLOCK_CONTROL, 0) == 1);

        // Set selected property on so the view can send accessibility events.
        mPasswordEntry.setSelected(true);
@@ -126,6 +130,14 @@ public abstract class KeyguardAbsKeyInputView extends LinearLayout
                if (mCallback != null) {
                    mCallback.userActivity(0);
                }
                if (mQuickUnlock) {
                    String entry = mPasswordEntry.getText().toString();
                    if (entry.length() > MINIMUM_PASSWORD_LENGTH_BEFORE_REPORT
                            && mLockPatternUtils.checkPassword(entry)) {
                        mCallback.reportSuccessfulUnlockAttempt();
                        mCallback.dismiss(true);
                    }
                }
            }
        });
        mSecurityMessageDisplay = new KeyguardMessageArea.Helper(this);