summaryrefslogtreecommitdiffstats
path: root/policy
diff options
context:
space:
mode:
Diffstat (limited to 'policy')
-rw-r--r--policy/src/com/android/internal/policy/impl/KeyguardStatusViewManager.java4
-rw-r--r--policy/src/com/android/internal/policy/impl/KeyguardUpdateMonitor.java11
-rw-r--r--policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java10
3 files changed, 17 insertions, 8 deletions
diff --git a/policy/src/com/android/internal/policy/impl/KeyguardStatusViewManager.java b/policy/src/com/android/internal/policy/impl/KeyguardStatusViewManager.java
index ee54de1..dbdfb98 100644
--- a/policy/src/com/android/internal/policy/impl/KeyguardStatusViewManager.java
+++ b/policy/src/com/android/internal/policy/impl/KeyguardStatusViewManager.java
@@ -293,6 +293,10 @@ class KeyguardStatusViewManager implements OnClickListener {
mUpdateMonitor.registerInfoCallback(mInfoCallback);
mUpdateMonitor.registerSimStateCallback(mSimStateCallback);
resetStatusInfo();
+ //Issue the faceunlock failure message in a centralized place
+ if (mUpdateMonitor.getMaxFaceUnlockAttemptsReached()) {
+ setInstructionText(getContext().getString(R.string.faceunlock_multiple_failures));
+ }
}
void resetStatusInfo() {
diff --git a/policy/src/com/android/internal/policy/impl/KeyguardUpdateMonitor.java b/policy/src/com/android/internal/policy/impl/KeyguardUpdateMonitor.java
index b4b82aa..1d6f39a 100644
--- a/policy/src/com/android/internal/policy/impl/KeyguardUpdateMonitor.java
+++ b/policy/src/com/android/internal/policy/impl/KeyguardUpdateMonitor.java
@@ -81,6 +81,8 @@ public class KeyguardUpdateMonitor {
private CharSequence mTelephonySpn;
private int mFailedAttempts = 0;
+ private int mFailedFaceUnlockAttempts = 0;
+ private static final int FAILED_FACE_UNLOCK_ATTEMPTS_BEFORE_BACKUP = 15;
private boolean mClockVisible;
@@ -630,6 +632,7 @@ public class KeyguardUpdateMonitor {
public void clearFailedAttempts() {
mFailedAttempts = 0;
+ mFailedFaceUnlockAttempts = 0;
}
public void reportFailedAttempt() {
@@ -643,4 +646,12 @@ public class KeyguardUpdateMonitor {
public int getPhoneState() {
return mPhoneState;
}
+
+ public void reportFailedFaceUnlockAttempt() {
+ mFailedFaceUnlockAttempts++;
+ }
+
+ public boolean getMaxFaceUnlockAttemptsReached() {
+ return mFailedFaceUnlockAttempts >= FAILED_FACE_UNLOCK_ATTEMPTS_BEFORE_BACKUP;
+ }
}
diff --git a/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java b/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java
index 11da17c..7e48357 100644
--- a/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java
+++ b/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java
@@ -132,10 +132,6 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler
// So the user has a consistent amount of time when brought to the backup method from FaceLock
private final int BACKUP_LOCK_TIMEOUT = 5000;
- // Needed to keep track of failed FaceUnlock attempts
- private int mFailedFaceUnlockAttempts = 0;
- private static final int FAILED_FACE_UNLOCK_ATTEMPTS_BEFORE_BACKUP = 15;
-
/**
* The current {@link KeyguardScreen} will use this to communicate back to us.
*/
@@ -464,7 +460,6 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler
}
public void reportSuccessfulUnlockAttempt() {
- mFailedFaceUnlockAttempts = 0;
mLockPatternUtils.reportSuccessfulPasswordAttempt();
}
};
@@ -583,8 +578,7 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler
* FaceLock, but only if we're not dealing with a call
*/
private void activateFaceLockIfAble() {
- final boolean tooManyFaceUnlockTries =
- (mFailedFaceUnlockAttempts >= FAILED_FACE_UNLOCK_ATTEMPTS_BEFORE_BACKUP);
+ final boolean tooManyFaceUnlockTries = mUpdateMonitor.getMaxFaceUnlockAttemptsReached();
final int failedBackupAttempts = mUpdateMonitor.getFailedAttempts();
final boolean backupIsTimedOut =
(failedBackupAttempts >= LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT);
@@ -1398,7 +1392,7 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler
@Override
public void reportFailedAttempt() {
if (DEBUG) Log.d(TAG, "FaceLock reportFailedAttempt()");
- mFailedFaceUnlockAttempts++;
+ mUpdateMonitor.reportFailedFaceUnlockAttempt();
hideFaceLockArea(); // Expose fallback
stopFaceLock();
mKeyguardScreenCallback.pokeWakelock(BACKUP_LOCK_TIMEOUT);