OSDN Git Service

Merge "Plumb setRequireConfirmation to CC"
authorKevin Chyn <kchyn@google.com>
Thu, 24 Jan 2019 10:30:36 +0000 (10:30 +0000)
committerAndroid (Google) Code Review <android-gerrit@google.com>
Thu, 24 Jan 2019 10:30:36 +0000 (10:30 +0000)
src/com/android/settings/password/BiometricFragment.java
src/com/android/settings/password/ConfirmDeviceCredentialActivity.java

index 13ec543..171b61e 100644 (file)
@@ -43,6 +43,7 @@ public class BiometricFragment extends InstrumentedFragment {
     private static final String KEY_SUBTITLE = "subtitle";
     private static final String KEY_DESCRIPTION = "description";
     private static final String KEY_NEGATIVE_TEXT = "negative_text";
+    private static final String KEY_REQUIRE_CONFIRMATION = "require_confirmation";
 
     // Re-set by the application. Should be done upon orientation changes, etc
     private Executor mClientExecutor;
@@ -127,6 +128,7 @@ public class BiometricFragment extends InstrumentedFragment {
             .setDescription(mPromptInfo.getDescription())
             .setNegativeButton(mPromptInfo.getNegativeButtonText(), mClientExecutor,
                     mNegativeButtonListener)
+            .setRequireConfirmation(mPromptInfo.getRequireConfirmation())
             .build();
         mCancellationSignal = new CancellationSignal();
 
@@ -171,6 +173,10 @@ public class BiometricFragment extends InstrumentedFragment {
             return mBundle.getCharSequence(KEY_NEGATIVE_TEXT);
         }
 
+        public boolean getRequireConfirmation() {
+            return mBundle.getBoolean(KEY_REQUIRE_CONFIRMATION);
+        }
+
         public static class Builder {
             private final Bundle mBundle = new Bundle();
 
@@ -194,6 +200,11 @@ public class BiometricFragment extends InstrumentedFragment {
                 return this;
             }
 
+            public Builder setRequireConfirmation(boolean requireConfirmation) {
+                mBundle.putBoolean(KEY_REQUIRE_CONFIRMATION, requireConfirmation);
+                return this;
+            }
+
             public PromptInfo build() {
                 return new PromptInfo(mBundle);
             }
index 5eb1f32..0d9b21d 100644 (file)
@@ -136,6 +136,10 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity {
         Intent intent = getIntent();
         mTitle = intent.getStringExtra(KeyguardManager.EXTRA_TITLE);
         mDetails = intent.getStringExtra(KeyguardManager.EXTRA_DESCRIPTION);
+
+        final boolean requireConfirmation =
+                !intent.getBooleanExtra(KeyguardManager.EXTRA_USE_IMPLICIT, true);
+
         String alternateButton = intent.getStringExtra(
                 KeyguardManager.EXTRA_ALTERNATE_BUTTON_LABEL);
         boolean frp = KeyguardManager.ACTION_CONFIRM_FRP_CREDENTIAL.equals(intent.getAction());
@@ -170,7 +174,7 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity {
                 && !lockPatternUtils.isSeparateProfileChallengeEnabled(mUserId)) {
             mCredentialMode = CREDENTIAL_MANAGED;
             if (isBiometricAllowed(effectiveUserId)) {
-                showBiometricPrompt();
+                showBiometricPrompt(requireConfirmation);
                 launchedBiometric = true;
             } else {
                 showConfirmCredentials();
@@ -181,7 +185,7 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity {
             if (isBiometricAllowed(effectiveUserId)) {
                 // Don't need to check if biometrics / pin/pattern/pass are enrolled. It will go to
                 // onAuthenticationError and do the right thing automatically.
-                showBiometricPrompt();
+                showBiometricPrompt(requireConfirmation);
                 launchedBiometric = true;
             } else {
                 showConfirmCredentials();
@@ -242,7 +246,7 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity {
                 && !isBiometricDisabledByAdmin(effectiveUserId);
     }
 
-    private void showBiometricPrompt() {
+    private void showBiometricPrompt(boolean requireConfirmation) {
         mBiometricManager.setActiveUser(mUserId);
 
         mBiometricFragment = (BiometricFragment) getSupportFragmentManager()
@@ -255,6 +259,7 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity {
                     .setSubtitle(mDetails)
                     .setNegativeButtonText(getResources()
                             .getString(R.string.confirm_device_credential_use_alternate_method))
+                    .setRequireConfirmation(requireConfirmation)
                     .build();
             mBiometricFragment = BiometricFragment.newInstance(info);
             newFragment = true;