OSDN Git Service

Showing message when max attempts are hit in face unlock fixes b/7306168
authorDanielle Millett <dmillett@google.com>
Thu, 1 Nov 2012 19:00:12 +0000 (15:00 -0400)
committerDanielle Millett <dmillett@google.com>
Thu, 1 Nov 2012 19:00:12 +0000 (15:00 -0400)
Added a check in pattern and PIN to showed the face unlock max attempts
failure message if that had been reached.  The max attempts can only
be true if face unlock is enabled so it doesn't need to also check if it's
enabled.

Change-Id: If8a26498961d79fa6a647abc923c72f0af407e61

policy/src/com/android/internal/policy/impl/keyguard/KeyguardPINView.java
policy/src/com/android/internal/policy/impl/keyguard/KeyguardPatternView.java

index 1255712..b7d9990 100644 (file)
@@ -42,7 +42,11 @@ public class KeyguardPINView extends KeyguardAbsKeyInputView
     }
 
     protected void resetState() {
-        mSecurityMessageDisplay.setMessage(R.string.kg_pin_instructions, false);
+        if (KeyguardUpdateMonitor.getInstance(mContext).getMaxBiometricUnlockAttemptsReached()) {
+            mSecurityMessageDisplay.setMessage(R.string.faceunlock_multiple_failures, true);
+        } else {
+            mSecurityMessageDisplay.setMessage(R.string.kg_pin_instructions, false);
+        }
         mPasswordEntry.setEnabled(true);
     }
 
index 6b3446a..82cb44b 100644 (file)
@@ -182,7 +182,7 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit
         if (deadline != 0) {
             handleAttemptLockout(deadline);
         } else {
-            mSecurityMessageDisplay.setMessage(R.string.kg_pattern_instructions, false);
+            displayDefaultSecurityMessage();
         }
 
         // the footer depends on how many total attempts the user has failed
@@ -197,6 +197,14 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit
 
     }
 
+    private void displayDefaultSecurityMessage() {
+        if (KeyguardUpdateMonitor.getInstance(mContext).getMaxBiometricUnlockAttemptsReached()) {
+            mSecurityMessageDisplay.setMessage(R.string.faceunlock_multiple_failures, true);
+        } else {
+            mSecurityMessageDisplay.setMessage(R.string.kg_pattern_instructions, false);
+        }
+    }
+
     @Override
     public void showUsabilityHint() {
     }
@@ -338,7 +346,7 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit
             @Override
             public void onFinish() {
                 mLockPatternView.setEnabled(true);
-                mSecurityMessageDisplay.setMessage(R.string.kg_pattern_instructions, false);
+                displayDefaultSecurityMessage();
                 // TODO mUnlockIcon.setVisibility(View.VISIBLE);
                 mFailedPatternAttemptsSinceLastTimeout = 0;
                 if (mEnableFallback) {