Merge "Move face auth timeout error handling into a separate method." into tm-qpr-dev
This commit is contained in:
@@ -51,7 +51,6 @@ import android.content.pm.UserInfo;
|
|||||||
import android.content.res.ColorStateList;
|
import android.content.res.ColorStateList;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.hardware.biometrics.BiometricFaceConstants;
|
|
||||||
import android.hardware.biometrics.BiometricSourceType;
|
import android.hardware.biometrics.BiometricSourceType;
|
||||||
import android.hardware.face.FaceManager;
|
import android.hardware.face.FaceManager;
|
||||||
import android.hardware.fingerprint.FingerprintManager;
|
import android.hardware.fingerprint.FingerprintManager;
|
||||||
@@ -1064,9 +1063,7 @@ public class KeyguardIndicationController {
|
|||||||
&& msgId != BIOMETRIC_HELP_FACE_NOT_RECOGNIZED;
|
&& msgId != BIOMETRIC_HELP_FACE_NOT_RECOGNIZED;
|
||||||
final boolean faceAuthFailed = biometricSourceType == FACE
|
final boolean faceAuthFailed = biometricSourceType == FACE
|
||||||
&& msgId == BIOMETRIC_HELP_FACE_NOT_RECOGNIZED; // ran through matcher & failed
|
&& msgId == BIOMETRIC_HELP_FACE_NOT_RECOGNIZED; // ran through matcher & failed
|
||||||
final boolean isUnlockWithFingerprintPossible =
|
final boolean isUnlockWithFingerprintPossible = canUnlockWithFingerprint();
|
||||||
mKeyguardUpdateMonitor.getCachedIsUnlockWithFingerprintPossible(
|
|
||||||
getCurrentUser());
|
|
||||||
final boolean isCoExFaceAcquisitionMessage =
|
final boolean isCoExFaceAcquisitionMessage =
|
||||||
faceAuthSoftError && isUnlockWithFingerprintPossible;
|
faceAuthSoftError && isUnlockWithFingerprintPossible;
|
||||||
if (isCoExFaceAcquisitionMessage && !mCoExFaceAcquisitionMsgIdsToShow.contains(msgId)) {
|
if (isCoExFaceAcquisitionMessage && !mCoExFaceAcquisitionMsgIdsToShow.contains(msgId)) {
|
||||||
@@ -1119,44 +1116,14 @@ public class KeyguardIndicationController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void onFaceAuthError(int msgId, String errString) {
|
private void onFaceAuthError(int msgId, String errString) {
|
||||||
CharSequence deferredFaceMessage = null;
|
CharSequence deferredFaceMessage = mFaceAcquiredMessageDeferral.getDeferredMessage();
|
||||||
if (msgId == BiometricFaceConstants.FACE_ERROR_TIMEOUT) {
|
|
||||||
deferredFaceMessage = mFaceAcquiredMessageDeferral.getDeferredMessage();
|
|
||||||
debugLog("showDeferredFaceMessage msgId=" + deferredFaceMessage);
|
|
||||||
}
|
|
||||||
mFaceAcquiredMessageDeferral.reset();
|
mFaceAcquiredMessageDeferral.reset();
|
||||||
if (shouldSuppressFaceError(msgId, mKeyguardUpdateMonitor)) {
|
if (shouldSuppressFaceError(msgId, mKeyguardUpdateMonitor)) {
|
||||||
debugLog("suppressingFaceError msgId=" + msgId + " errString= " + errString);
|
debugLog("suppressingFaceError msgId=" + msgId + " errString= " + errString);
|
||||||
} else if (msgId == FaceManager.FACE_ERROR_TIMEOUT) {
|
|
||||||
// Co-ex: show deferred message OR nothing
|
|
||||||
if (mKeyguardUpdateMonitor.getCachedIsUnlockWithFingerprintPossible(
|
|
||||||
KeyguardUpdateMonitor.getCurrentUser())) {
|
|
||||||
// if we're on the lock screen (bouncer isn't showing), show the deferred msg
|
|
||||||
if (deferredFaceMessage != null
|
|
||||||
&& !mStatusBarKeyguardViewManager.isBouncerShowing()) {
|
|
||||||
showBiometricMessage(
|
|
||||||
deferredFaceMessage,
|
|
||||||
mContext.getString(R.string.keyguard_suggest_fingerprint)
|
|
||||||
);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (msgId == FaceManager.FACE_ERROR_TIMEOUT) {
|
||||||
// otherwise, don't show any message
|
handleFaceAuthTimeoutError(deferredFaceMessage);
|
||||||
debugLog("skip showing FACE_ERROR_TIMEOUT due to co-ex logic");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Face-only: The face timeout message is not very actionable, let's ask the user to
|
|
||||||
// manually retry.
|
|
||||||
if (deferredFaceMessage != null) {
|
|
||||||
showBiometricMessage(
|
|
||||||
deferredFaceMessage,
|
|
||||||
mContext.getString(R.string.keyguard_unlock)
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
// suggest swiping up to unlock (try face auth again or swipe up to bouncer)
|
|
||||||
showActionToUnlock();
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
handleGenericBiometricError(errString);
|
handleGenericBiometricError(errString);
|
||||||
}
|
}
|
||||||
@@ -1267,6 +1234,40 @@ public class KeyguardIndicationController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void handleFaceAuthTimeoutError(@Nullable CharSequence deferredFaceMessage) {
|
||||||
|
debugLog("showDeferredFaceMessage msgId=" + deferredFaceMessage);
|
||||||
|
if (canUnlockWithFingerprint()) {
|
||||||
|
// Co-ex: show deferred message OR nothing
|
||||||
|
// if we're on the lock screen (bouncer isn't showing), show the deferred msg
|
||||||
|
if (deferredFaceMessage != null
|
||||||
|
&& !mStatusBarKeyguardViewManager.isBouncerShowing()) {
|
||||||
|
showBiometricMessage(
|
||||||
|
deferredFaceMessage,
|
||||||
|
mContext.getString(R.string.keyguard_suggest_fingerprint)
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
// otherwise, don't show any message
|
||||||
|
debugLog("skip showing FACE_ERROR_TIMEOUT due to co-ex logic");
|
||||||
|
}
|
||||||
|
} else if (deferredFaceMessage != null) {
|
||||||
|
// Face-only: The face timeout message is not very actionable, let's ask the
|
||||||
|
// user to manually retry.
|
||||||
|
showBiometricMessage(
|
||||||
|
deferredFaceMessage,
|
||||||
|
mContext.getString(R.string.keyguard_unlock)
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
// Face-only
|
||||||
|
// suggest swiping up to unlock (try face auth again or swipe up to bouncer)
|
||||||
|
showActionToUnlock();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean canUnlockWithFingerprint() {
|
||||||
|
return mKeyguardUpdateMonitor.getCachedIsUnlockWithFingerprintPossible(
|
||||||
|
KeyguardUpdateMonitor.getCurrentUser());
|
||||||
|
}
|
||||||
|
|
||||||
private void debugLog(String logMsg) {
|
private void debugLog(String logMsg) {
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
Log.d(TAG, logMsg);
|
Log.d(TAG, logMsg);
|
||||||
|
|||||||
Reference in New Issue
Block a user