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 mUserId;
|
||||||
private int mCredentialMode;
|
private int mCredentialMode;
|
||||||
private boolean mGoingToBackground;
|
private boolean mGoingToBackground;
|
||||||
|
private boolean mWaitingForBiometricCallback;
|
||||||
|
|
||||||
private Executor mExecutor = (runnable -> {
|
private Executor mExecutor = (runnable -> {
|
||||||
mHandler.post(runnable);
|
mHandler.post(runnable);
|
||||||
@@ -117,6 +118,7 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity {
|
|||||||
@Override
|
@Override
|
||||||
public void onAuthenticationError(int errorCode, @NonNull CharSequence errString) {
|
public void onAuthenticationError(int errorCode, @NonNull CharSequence errString) {
|
||||||
if (!mGoingToBackground) {
|
if (!mGoingToBackground) {
|
||||||
|
mWaitingForBiometricCallback = false;
|
||||||
if (errorCode == BiometricPrompt.BIOMETRIC_ERROR_USER_CANCELED
|
if (errorCode == BiometricPrompt.BIOMETRIC_ERROR_USER_CANCELED
|
||||||
|| errorCode == BiometricPrompt.BIOMETRIC_ERROR_CANCELED) {
|
|| errorCode == BiometricPrompt.BIOMETRIC_ERROR_CANCELED) {
|
||||||
finish();
|
finish();
|
||||||
@@ -124,11 +126,15 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity {
|
|||||||
// All other errors go to some version of CC
|
// All other errors go to some version of CC
|
||||||
showConfirmCredentials();
|
showConfirmCredentials();
|
||||||
}
|
}
|
||||||
|
} else if (mWaitingForBiometricCallback) { // mGoingToBackground is true
|
||||||
|
mWaitingForBiometricCallback = false;
|
||||||
|
finish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAuthenticationSucceeded(BiometricPrompt.AuthenticationResult result) {
|
public void onAuthenticationSucceeded(BiometricPrompt.AuthenticationResult result) {
|
||||||
|
mWaitingForBiometricCallback = false;
|
||||||
mTrustManager.setDeviceLockedForUser(mUserId, false);
|
mTrustManager.setDeviceLockedForUser(mUserId, false);
|
||||||
final boolean isStrongAuth = result.getAuthenticationType()
|
final boolean isStrongAuth = result.getAuthenticationType()
|
||||||
== BiometricPrompt.AUTHENTICATION_RESULT_TYPE_DEVICE_CREDENTIAL;
|
== BiometricPrompt.AUTHENTICATION_RESULT_TYPE_DEVICE_CREDENTIAL;
|
||||||
@@ -143,6 +149,7 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAuthenticationFailed() {
|
public void onAuthenticationFailed() {
|
||||||
|
mWaitingForBiometricCallback = false;
|
||||||
mDevicePolicyManager.reportFailedBiometricAttempt(mUserId);
|
mDevicePolicyManager.reportFailedBiometricAttempt(mUserId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -262,6 +269,7 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity {
|
|||||||
finish();
|
finish();
|
||||||
} else if (launchedBiometric) {
|
} else if (launchedBiometric) {
|
||||||
// Keep this activity alive until BiometricPrompt goes away
|
// Keep this activity alive until BiometricPrompt goes away
|
||||||
|
mWaitingForBiometricCallback = true;
|
||||||
} else {
|
} else {
|
||||||
Log.d(TAG, "No pattern, password or PIN set.");
|
Log.d(TAG, "No pattern, password or PIN set.");
|
||||||
setResult(Activity.RESULT_OK);
|
setResult(Activity.RESULT_OK);
|
||||||
@@ -320,7 +328,9 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity {
|
|||||||
super.onPause();
|
super.onPause();
|
||||||
if (!isChangingConfigurations()) {
|
if (!isChangingConfigurations()) {
|
||||||
mGoingToBackground = true;
|
mGoingToBackground = true;
|
||||||
|
if (!mWaitingForBiometricCallback) {
|
||||||
finish();
|
finish();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
mGoingToBackground = false;
|
mGoingToBackground = false;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user