am d814d4fa: Merge "going directly to backup after face unlock fails 15 times" into ics-mr0
* commit 'd814d4fa0c76a0384f7e32816e1ca36f237911c6': going directly to backup after face unlock fails 15 times
This commit is contained in:
@@ -21,5 +21,6 @@ import android.os.IBinder;
|
|||||||
oneway interface IFaceLockCallback {
|
oneway interface IFaceLockCallback {
|
||||||
void unlock();
|
void unlock();
|
||||||
void cancel();
|
void cancel();
|
||||||
|
void reportFailedAttempt();
|
||||||
void pokeWakelock();
|
void pokeWakelock();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -130,6 +130,10 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler
|
|||||||
// So the user has a consistent amount of time when brought to the backup method from FaceLock
|
// So the user has a consistent amount of time when brought to the backup method from FaceLock
|
||||||
private final int BACKUP_LOCK_TIMEOUT = 5000;
|
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.
|
* The current {@link KeyguardScreen} will use this to communicate back to us.
|
||||||
*/
|
*/
|
||||||
@@ -439,6 +443,7 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void reportSuccessfulUnlockAttempt() {
|
public void reportSuccessfulUnlockAttempt() {
|
||||||
|
mFailedFaceUnlockAttempts = 0;
|
||||||
mLockPatternUtils.reportSuccessfulPasswordAttempt();
|
mLockPatternUtils.reportSuccessfulPasswordAttempt();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -553,7 +558,16 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler
|
|||||||
* FaceLock, but only if we're not dealing with a call
|
* FaceLock, but only if we're not dealing with a call
|
||||||
*/
|
*/
|
||||||
private void activateFaceLockIfAble() {
|
private void activateFaceLockIfAble() {
|
||||||
if (mUpdateMonitor.getPhoneState() == TelephonyManager.CALL_STATE_IDLE && !mHasOverlay) {
|
final boolean tooManyFaceUnlockTries =
|
||||||
|
(mFailedFaceUnlockAttempts >= FAILED_FACE_UNLOCK_ATTEMPTS_BEFORE_BACKUP);
|
||||||
|
final int failedBackupAttempts = mUpdateMonitor.getFailedAttempts();
|
||||||
|
final boolean backupIsTimedOut =
|
||||||
|
(failedBackupAttempts >= LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT);
|
||||||
|
if (tooManyFaceUnlockTries) Log.i(TAG, "tooManyFaceUnlockTries: " + tooManyFaceUnlockTries);
|
||||||
|
if (mUpdateMonitor.getPhoneState() == TelephonyManager.CALL_STATE_IDLE
|
||||||
|
&& !mHasOverlay
|
||||||
|
&& !tooManyFaceUnlockTries
|
||||||
|
&& !backupIsTimedOut) {
|
||||||
bindToFaceLock();
|
bindToFaceLock();
|
||||||
// Show FaceLock area, but only for a little bit so lockpattern will become visible if
|
// Show FaceLock area, but only for a little bit so lockpattern will become visible if
|
||||||
// FaceLock fails to start or crashes
|
// FaceLock fails to start or crashes
|
||||||
@@ -1296,7 +1310,7 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Stops the FaceLock UI and exposes the backup method without unlocking
|
// Stops the FaceLock UI and exposes the backup method without unlocking
|
||||||
// This means either the user has cancelled out or FaceLock failed to recognize them
|
// This means the user has cancelled out
|
||||||
@Override
|
@Override
|
||||||
public void cancel() {
|
public void cancel() {
|
||||||
if (DEBUG) Log.d(TAG, "FaceLock cancel()");
|
if (DEBUG) Log.d(TAG, "FaceLock cancel()");
|
||||||
@@ -1305,6 +1319,17 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler
|
|||||||
mKeyguardScreenCallback.pokeWakelock(BACKUP_LOCK_TIMEOUT);
|
mKeyguardScreenCallback.pokeWakelock(BACKUP_LOCK_TIMEOUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Stops the FaceLock UI and exposes the backup method without unlocking
|
||||||
|
// This means FaceLock failed to recognize them
|
||||||
|
@Override
|
||||||
|
public void reportFailedAttempt() {
|
||||||
|
if (DEBUG) Log.d(TAG, "FaceLock reportFailedAttempt()");
|
||||||
|
mFailedFaceUnlockAttempts++;
|
||||||
|
hideFaceLockArea(); // Expose fallback
|
||||||
|
stopFaceLock();
|
||||||
|
mKeyguardScreenCallback.pokeWakelock(BACKUP_LOCK_TIMEOUT);
|
||||||
|
}
|
||||||
|
|
||||||
// Allows the Face Unlock service to poke the wake lock to keep the lockscreen alive
|
// Allows the Face Unlock service to poke the wake lock to keep the lockscreen alive
|
||||||
@Override
|
@Override
|
||||||
public void pokeWakelock() {
|
public void pokeWakelock() {
|
||||||
|
|||||||
Reference in New Issue
Block a user