Fix "Wrong password" message shown when using BT keyboard.

The code was assuming we're always using soft IME. When a physical
keyboard is attached, we get two events; ACTION_DOWN and ACTION_UP.
The code attempted to unlock the device twice.  The second attempt
failed because the TextView was cleared by the first successful attempt.

Fixes bug 17690585

Change-Id: Ia92a97400b4404d0cbe86aacb727009e95914327
This commit is contained in:
Jim Miller
2014-10-03 18:54:03 -07:00
parent 6ec5a256d7
commit e8fed24be6

View File

@@ -295,8 +295,14 @@ public class KeyguardPasswordView extends KeyguardAbsKeyInputView
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
// Check if this was the result of hitting the enter key
if (actionId == EditorInfo.IME_NULL || actionId == EditorInfo.IME_ACTION_DONE
|| actionId == EditorInfo.IME_ACTION_NEXT) {
final boolean isSoftImeEvent = event == null
&& (actionId == EditorInfo.IME_NULL
|| actionId == EditorInfo.IME_ACTION_DONE
|| actionId == EditorInfo.IME_ACTION_NEXT);
final boolean isKeyboardEnterKey = event != null
&& KeyEvent.isConfirmKey(event.getKeyCode())
&& event.getAction() == KeyEvent.ACTION_DOWN;
if (isSoftImeEvent || isKeyboardEnterKey) {
verifyPasswordAndUnlock();
return true;
}