From ea88026fcb7aa405ebde0d38447d716b38b66971 Mon Sep 17 00:00:00 2001 From: Vitaly Kramskikh Date: Fri, 2 Mar 2012 15:31:16 +0400 Subject: policy: do not count invalid fingerprint swipes as bad tries Change-Id: I8179aadaf78a3d492524c9aeadce09b32ae992b6 --- .../internal/policy/impl/FingerUnlockScreen.java | 50 ++++++++-------------- 1 file changed, 17 insertions(+), 33 deletions(-) diff --git a/policy/src/com/android/internal/policy/impl/FingerUnlockScreen.java b/policy/src/com/android/internal/policy/impl/FingerUnlockScreen.java index d658280..43ec578 100644 --- a/policy/src/com/android/internal/policy/impl/FingerUnlockScreen.java +++ b/policy/src/com/android/internal/policy/impl/FingerUnlockScreen.java @@ -167,7 +167,7 @@ class FingerUnlockScreen extends LinearLayoutWithDefaultTouchRecepient static Thread mExecutionThread = null; private Thread mUiThread; - private boolean mbFeedbackDelivered = false; + private boolean mbInvalidSwipe = false; private VerifyRunner mVerifyRunner = new VerifyRunner(); private Context m_Context; @@ -1117,11 +1117,11 @@ class FingerUnlockScreen extends LinearLayoutWithDefaultTouchRecepient /* we've already displayed the feedback, so we don't want to worry */ /* about an additional message. */ if (target.equals("swipe_bad")) { - // Update the total failed attempts. - mTotalFailedPatternAttempts++; - mFailedPatternAttemptsSinceLastTimeout++; + if (!mbInvalidSwipe) { + // Update the total failed attempts. + mTotalFailedPatternAttempts++; + mFailedPatternAttemptsSinceLastTimeout++; - if (!mbFeedbackDelivered) { runOnUiThread(new Runnable() { public void run() { toast(getContext().getString(R.string.keyguard_finger_not_match)); @@ -1135,71 +1135,55 @@ class FingerUnlockScreen extends LinearLayoutWithDefaultTouchRecepient } }); } else { - runOnUiThread(new Runnable() { - public void run() { - mCallback.reportFailedUnlockAttempt(); - if (mFailedPatternAttemptsSinceLastTimeout >= - LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT) { - pokeWakelock(1000); - long deadline = mLockPatternUtils.setLockoutAttemptDeadline(); - handleAttemptLockout(deadline); - } - } - }); + mbInvalidSwipe = false; } - mbFeedbackDelivered = false; return; } /* if the target is any of our feedback messages, provide a toast... */ if (target.equals("swipe_too_fast")) { - mbFeedbackDelivered = true; + mbInvalidSwipe = true; runOnUiThread(new Runnable() { public void run() { toast(getContext().getString(R.string.keyguard_finger_swipe_too_fast)); } }); return; - } - if (target.equals("swipe_too_slow")) { - mbFeedbackDelivered = true; + } else if (target.equals("swipe_too_slow")) { + mbInvalidSwipe = true; runOnUiThread(new Runnable() { public void run() { toast(getContext().getString(R.string.keyguard_finger_swipe_too_slow)); } }); return; - } - if (target.equals("swipe_too_short")) { - mbFeedbackDelivered = true; + } else if (target.equals("swipe_too_short")) { + mbInvalidSwipe = true; runOnUiThread(new Runnable() { public void run() { toast(getContext().getString(R.string.keyguard_finger_swipe_too_short)); } }); return; - } - if (target.equals("swipe_too_skewed")) { - mbFeedbackDelivered = true; + } else if (target.equals("swipe_too_skewed")) { + mbInvalidSwipe = true; runOnUiThread(new Runnable() { public void run() { toast(getContext().getString(R.string.keyguard_finger_swipe_too_skewed)); } }); return; - } - if (target.equals("swipe_too_far_left")) { - mbFeedbackDelivered = true; + } else if (target.equals("swipe_too_far_left")) { + mbInvalidSwipe = true; runOnUiThread(new Runnable() { public void run() { toast(getContext().getString(R.string.keyguard_finger_swipe_too_far_left)); } }); return; - } - if (target.equals("swipe_too_far_right")) { - mbFeedbackDelivered = true; + } else if (target.equals("swipe_too_far_right")) { + mbInvalidSwipe = true; runOnUiThread(new Runnable() { public void run() { toast(getContext().getString(R.string.keyguard_finger_swipe_too_far_right)); -- cgit v1.1