From b65d331b94b8040b08a52f0e97f9cdd8b7d031b4 Mon Sep 17 00:00:00 2001 From: Jim Miller Date: Tue, 2 Mar 2010 17:24:48 -0800 Subject: [PATCH] Fix 2481917: allows keyboards with overlapping qwerty/numeric keys to work w/o requiring hitting the key. Some devices have a qwerty layout without separate numeric keys. This makes PIN entry painful. The workaround is to set an explicit numeric key listener when in numeric mode. --- .../com/android/internal/policy/impl/PasswordUnlockScreen.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/phone/com/android/internal/policy/impl/PasswordUnlockScreen.java b/phone/com/android/internal/policy/impl/PasswordUnlockScreen.java index a721c47..c52ef53 100644 --- a/phone/com/android/internal/policy/impl/PasswordUnlockScreen.java +++ b/phone/com/android/internal/policy/impl/PasswordUnlockScreen.java @@ -23,6 +23,8 @@ import com.android.internal.widget.LockPatternUtils; import com.android.internal.widget.PasswordEntryKeyboardView; import android.telephony.TelephonyManager; +import android.text.method.DigitsKeyListener; +import android.text.method.TextKeyListener; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.View; @@ -92,6 +94,14 @@ public class PasswordUnlockScreen extends LinearLayout implements KeyguardScreen mKeyboardView.setVisibility(mCreatedWithKeyboardOpen ? View.INVISIBLE : View.VISIBLE); mPasswordEntry.requestFocus(); + // This allows keyboards with overlapping qwerty/numeric keys to choose just the + // numeric keys. + if (isAlpha) { + mPasswordEntry.setKeyListener(TextKeyListener.getInstance()); + } else { + mPasswordEntry.setKeyListener(DigitsKeyListener.getInstance()); + } + mKeyboardHelper.setVibratePattern(mLockPatternUtils.isTactileFeedbackEnabled() ? com.android.internal.R.array.config_virtualKeyVibePattern : 0); -- 2.11.0