Do not request cancel authentication unless currently authenticating
am: 49c7d07650
Change-Id: Id38d3648f75a79a3492677416c79fff960317a69
This commit is contained in:
@@ -58,11 +58,13 @@ public class BiometricFragment extends InstrumentedFragment {
|
|||||||
private Bundle mBundle;
|
private Bundle mBundle;
|
||||||
private BiometricPrompt mBiometricPrompt;
|
private BiometricPrompt mBiometricPrompt;
|
||||||
private CancellationSignal mCancellationSignal;
|
private CancellationSignal mCancellationSignal;
|
||||||
|
private boolean mAuthenticating;
|
||||||
|
|
||||||
private AuthenticationCallback mAuthenticationCallback =
|
private AuthenticationCallback mAuthenticationCallback =
|
||||||
new AuthenticationCallback() {
|
new AuthenticationCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onAuthenticationError(int error, @NonNull CharSequence message) {
|
public void onAuthenticationError(int error, @NonNull CharSequence message) {
|
||||||
|
mAuthenticating = false;
|
||||||
mClientExecutor.execute(() -> {
|
mClientExecutor.execute(() -> {
|
||||||
mClientCallback.onAuthenticationError(error, message);
|
mClientCallback.onAuthenticationError(error, message);
|
||||||
});
|
});
|
||||||
@@ -71,6 +73,7 @@ public class BiometricFragment extends InstrumentedFragment {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAuthenticationSucceeded(AuthenticationResult result) {
|
public void onAuthenticationSucceeded(AuthenticationResult result) {
|
||||||
|
mAuthenticating = false;
|
||||||
mClientExecutor.execute(() -> {
|
mClientExecutor.execute(() -> {
|
||||||
mClientCallback.onAuthenticationSucceeded(result);
|
mClientCallback.onAuthenticationSucceeded(result);
|
||||||
});
|
});
|
||||||
@@ -134,6 +137,10 @@ public class BiometricFragment extends InstrumentedFragment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean isAuthenticating() {
|
||||||
|
return mAuthenticating;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@@ -180,6 +187,7 @@ public class BiometricFragment extends InstrumentedFragment {
|
|||||||
mCancellationSignal = new CancellationSignal();
|
mCancellationSignal = new CancellationSignal();
|
||||||
|
|
||||||
// TODO: CC doesn't use crypto for now
|
// TODO: CC doesn't use crypto for now
|
||||||
|
mAuthenticating = true;
|
||||||
mBiometricPrompt.authenticateUser(mCancellationSignal, mClientExecutor,
|
mBiometricPrompt.authenticateUser(mCancellationSignal, mClientExecutor,
|
||||||
mAuthenticationCallback, mUserId, mCancelCallback);
|
mAuthenticationCallback, mUserId, mCancelCallback);
|
||||||
}
|
}
|
||||||
|
@@ -251,7 +251,10 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity {
|
|||||||
if (!isChangingConfigurations()) {
|
if (!isChangingConfigurations()) {
|
||||||
mGoingToBackground = true;
|
mGoingToBackground = true;
|
||||||
if (mBiometricFragment != null) {
|
if (mBiometricFragment != null) {
|
||||||
mBiometricFragment.cancel();
|
Log.d(TAG, "Authenticating: " + mBiometricFragment.isAuthenticating());
|
||||||
|
if (mBiometricFragment.isAuthenticating()) {
|
||||||
|
mBiometricFragment.cancel();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mIsFallback && !mCCLaunched) {
|
if (mIsFallback && !mCCLaunched) {
|
||||||
|
Reference in New Issue
Block a user