Android-x86
Fork
Faire un don

  • R/O
  • HTTP
  • SSH
  • HTTPS

packages-apps-Settings: Commit

packages/apps/Settings


Commit MetaInfo

Révisionadef4840f3ffdc97503fe1ac0943381d43efe10d (tree)
l'heure2019-07-29 07:26:26
AuteurKevin Chyn <kchyn@goog...>
Commiterandroid-build-team Robot

Message de Log

Do not request cancel authentication unless currently authenticating

Currently we always send cancel() if ConfirmDeviceCredentialActivity
goes into the background. However, if the biometric state is no longer
authenticating, requesting cancel() in this state will result in an
inconsistent state between BiometricService/client and
ConfirmDeviceCredentials.

BiometricService/client will receive the ERROR_CANCELED message incorrectly,
while ConfirmDeviceCredential is showing / pending user password. When
the password is entered, its result is ignored.

The correct behavior is for ConfirmDeviceCredentialActivity to invoke
cancel() only if it's still authenticating. Otherwise BiometricService
and its client will receive ERROR_CANCELED, instead of the actual password
auth result.

Bug: 138279856

Test: BiometricPromptDemo, enable device credential fallback, get into

lockout state, successfully enter password. API result is
success instead of "canceled" now.

Change-Id: I6521e896d0402fe856dc85476f51149c9b3084a8
Merged-In: I6521e896d0402fe856dc85476f51149c9b3084a8
(cherry picked from commit 49c7d0765090750f88f11153dfcf9ec378b0c84d)

Change Summary

Modification

--- a/src/com/android/settings/password/BiometricFragment.java
+++ b/src/com/android/settings/password/BiometricFragment.java
@@ -58,11 +58,13 @@ public class BiometricFragment extends InstrumentedFragment {
5858 private Bundle mBundle;
5959 private BiometricPrompt mBiometricPrompt;
6060 private CancellationSignal mCancellationSignal;
61+ private boolean mAuthenticating;
6162
6263 private AuthenticationCallback mAuthenticationCallback =
6364 new AuthenticationCallback() {
6465 @Override
6566 public void onAuthenticationError(int error, @NonNull CharSequence message) {
67+ mAuthenticating = false;
6668 mClientExecutor.execute(() -> {
6769 mClientCallback.onAuthenticationError(error, message);
6870 });
@@ -71,6 +73,7 @@ public class BiometricFragment extends InstrumentedFragment {
7173
7274 @Override
7375 public void onAuthenticationSucceeded(AuthenticationResult result) {
76+ mAuthenticating = false;
7477 mClientExecutor.execute(() -> {
7578 mClientCallback.onAuthenticationSucceeded(result);
7679 });
@@ -134,6 +137,10 @@ public class BiometricFragment extends InstrumentedFragment {
134137 }
135138 }
136139
140+ boolean isAuthenticating() {
141+ return mAuthenticating;
142+ }
143+
137144 @Override
138145 public void onCreate(Bundle savedInstanceState) {
139146 super.onCreate(savedInstanceState);
@@ -180,6 +187,7 @@ public class BiometricFragment extends InstrumentedFragment {
180187 mCancellationSignal = new CancellationSignal();
181188
182189 // TODO: CC doesn't use crypto for now
190+ mAuthenticating = true;
183191 mBiometricPrompt.authenticateUser(mCancellationSignal, mClientExecutor,
184192 mAuthenticationCallback, mUserId, mCancelCallback);
185193 }
--- a/src/com/android/settings/password/ConfirmDeviceCredentialActivity.java
+++ b/src/com/android/settings/password/ConfirmDeviceCredentialActivity.java
@@ -251,7 +251,10 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity {
251251 if (!isChangingConfigurations()) {
252252 mGoingToBackground = true;
253253 if (mBiometricFragment != null) {
254- mBiometricFragment.cancel();
254+ Log.d(TAG, "Authenticating: " + mBiometricFragment.isAuthenticating());
255+ if (mBiometricFragment.isAuthenticating()) {
256+ mBiometricFragment.cancel();
257+ }
255258 }
256259
257260 if (mIsFallback && !mCCLaunched) {
Afficher sur ancien navigateur de dépôt.