Merge "Fix disappearing biometric prompt for the managed profile" into rvc-dev am: 4d44702659
am: e3e2ce74f7
am: a9df21b508
am: 43a459cb1b
Change-Id: I0ffcb7bfd8fed9aa2f769a144e1c33c330d7c9ff
This commit is contained in:
@@ -108,6 +108,7 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity {
|
||||
private int mUserId;
|
||||
private int mCredentialMode;
|
||||
private boolean mGoingToBackground;
|
||||
private boolean mWaitingForBiometricCallback;
|
||||
|
||||
private Executor mExecutor = (runnable -> {
|
||||
mHandler.post(runnable);
|
||||
@@ -117,6 +118,7 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity {
|
||||
@Override
|
||||
public void onAuthenticationError(int errorCode, @NonNull CharSequence errString) {
|
||||
if (!mGoingToBackground) {
|
||||
mWaitingForBiometricCallback = false;
|
||||
if (errorCode == BiometricPrompt.BIOMETRIC_ERROR_USER_CANCELED
|
||||
|| errorCode == BiometricPrompt.BIOMETRIC_ERROR_CANCELED) {
|
||||
finish();
|
||||
@@ -124,11 +126,15 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity {
|
||||
// All other errors go to some version of CC
|
||||
showConfirmCredentials();
|
||||
}
|
||||
} else if (mWaitingForBiometricCallback) { // mGoingToBackground is true
|
||||
mWaitingForBiometricCallback = false;
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAuthenticationSucceeded(BiometricPrompt.AuthenticationResult result) {
|
||||
mWaitingForBiometricCallback = false;
|
||||
mTrustManager.setDeviceLockedForUser(mUserId, false);
|
||||
final boolean isStrongAuth = result.getAuthenticationType()
|
||||
== BiometricPrompt.AUTHENTICATION_RESULT_TYPE_DEVICE_CREDENTIAL;
|
||||
@@ -143,6 +149,7 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity {
|
||||
|
||||
@Override
|
||||
public void onAuthenticationFailed() {
|
||||
mWaitingForBiometricCallback = false;
|
||||
mDevicePolicyManager.reportFailedBiometricAttempt(mUserId);
|
||||
}
|
||||
|
||||
@@ -262,6 +269,7 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity {
|
||||
finish();
|
||||
} else if (launchedBiometric) {
|
||||
// Keep this activity alive until BiometricPrompt goes away
|
||||
mWaitingForBiometricCallback = true;
|
||||
} else {
|
||||
Log.d(TAG, "No pattern, password or PIN set.");
|
||||
setResult(Activity.RESULT_OK);
|
||||
@@ -320,7 +328,9 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity {
|
||||
super.onPause();
|
||||
if (!isChangingConfigurations()) {
|
||||
mGoingToBackground = true;
|
||||
finish();
|
||||
if (!mWaitingForBiometricCallback) {
|
||||
finish();
|
||||
}
|
||||
} else {
|
||||
mGoingToBackground = false;
|
||||
}
|
||||
|
Reference in New Issue
Block a user