ConfirmDeviceCredential should respond to cancel when launched through BP
Fixes: 128747871 Test: BiometricPrompt launched by ConfirmDeviceCredential is canceled Test: ConfirmLock* can also now be canceled Test: No effect on non-biometric related paths Change-Id: I237de136e63d523fece87fad7a93f4ecd66d800b
This commit is contained in:
@@ -106,13 +106,11 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity {
|
||||
private AuthenticationCallback mAuthenticationCallback = new AuthenticationCallback() {
|
||||
public void onAuthenticationError(int errorCode, @NonNull CharSequence errString) {
|
||||
if (!mGoingToBackground) {
|
||||
if (errorCode == BiometricPrompt.BIOMETRIC_ERROR_USER_CANCELED) {
|
||||
if (errorCode == BiometricPrompt.BIOMETRIC_ERROR_USER_CANCELED
|
||||
|| errorCode == BiometricPrompt.BIOMETRIC_ERROR_CANCELED) {
|
||||
if (mIsFallback) {
|
||||
mBiometricManager.onConfirmDeviceCredentialError(
|
||||
BiometricConstants.BIOMETRIC_ERROR_USER_CANCELED,
|
||||
getString(
|
||||
com.android.internal.R.string
|
||||
.biometric_error_user_canceled));
|
||||
errorCode, getStringForError(errorCode));
|
||||
}
|
||||
finish();
|
||||
} else {
|
||||
@@ -139,6 +137,17 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity {
|
||||
}
|
||||
};
|
||||
|
||||
private String getStringForError(int errorCode) {
|
||||
switch (errorCode) {
|
||||
case BiometricConstants.BIOMETRIC_ERROR_USER_CANCELED:
|
||||
return getString(com.android.internal.R.string.biometric_error_user_canceled);
|
||||
case BiometricConstants.BIOMETRIC_ERROR_CANCELED:
|
||||
return getString(com.android.internal.R.string.biometric_error_canceled);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -178,7 +187,6 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity {
|
||||
intent.getBundleExtra(KeyguardManager.EXTRA_BIOMETRIC_PROMPT_BUNDLE);
|
||||
if (bpBundle != null) {
|
||||
mIsFallback = true;
|
||||
// TODO: CDC maybe should show description as well.
|
||||
mTitle = bpBundle.getString(BiometricPrompt.KEY_TITLE);
|
||||
mDetails = bpBundle.getString(BiometricPrompt.KEY_SUBTITLE);
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user