<string name="settings_safetylegal_activity_loading">Loading\u2026</string>
<!-- ConfirmDeviceCredential settings-->
- <!-- Button text shown on BiometricPrompt (system dialog that asks for biometric authentication) giving the user the option to use an alternate form of authentication (Pin/Pattern/Pass) [CHAR LIMIT=30] -->
- <string name="confirm_device_credential_use_alternate_method">Use alternate method</string>
+ <!-- Button text shown on BiometricPrompt (system dialog that asks for biometric authentication) giving the user the option to use an alternate form of authentication (Pin) [CHAR LIMIT=30] -->
+ <string name="confirm_device_credential_pin">Use PIN</string>
+ <!-- Button text shown on BiometricPrompt (system dialog that asks for biometric authentication) giving the user the option to use an alternate form of authentication (Pattern) [CHAR LIMIT=30] -->
+ <string name="confirm_device_credential_pattern">Use pattern</string>
+ <!-- Button text shown on BiometricPrompt (system dialog that asks for biometric authentication) giving the user the option to use an alternate form of authentication (Pass) [CHAR LIMIT=30] -->
+ <string name="confirm_device_credential_password">Use password</string>
<!-- Lock Pattern settings -->
<!-- Header on first screen of choose password/PIN flow [CHAR LIMIT=40] -->
package com.android.settings.password;
import android.app.Activity;
+import android.app.admin.DevicePolicyManager;
import android.app.settings.SettingsEnums;
import android.content.DialogInterface;
import android.hardware.biometrics.BiometricConstants;
import androidx.annotation.NonNull;
+import com.android.internal.widget.LockPatternUtils;
import com.android.settings.R;
import com.android.settings.core.InstrumentedFragment;
+import com.android.settings.overlay.FeatureFactory;
import java.util.concurrent.Executor;
setRetainInstance(true);
mBundle = getArguments();
- mBiometricPrompt = new BiometricPrompt.Builder(getContext())
- .setTitle(mBundle.getString(BiometricPrompt.KEY_TITLE))
- .setUseDefaultTitle() // use default title if title is null/empty
- .setFromConfirmDeviceCredential()
- .setSubtitle(mBundle.getString(BiometricPrompt.KEY_SUBTITLE))
- .setDescription(mBundle.getString(BiometricPrompt.KEY_DESCRIPTION))
- .setConfirmationRequired(
- mBundle.getBoolean(BiometricPrompt.KEY_REQUIRE_CONFIRMATION, true))
- .setNegativeButton(getResources().getString(
- R.string.confirm_device_credential_use_alternate_method),
- mClientExecutor, mNegativeButtonListener)
- .build();
+ final BiometricPrompt.Builder builder = new BiometricPrompt.Builder(getContext())
+ .setTitle(mBundle.getString(BiometricPrompt.KEY_TITLE))
+ .setUseDefaultTitle() // use default title if title is null/empty
+ .setFromConfirmDeviceCredential()
+ .setSubtitle(mBundle.getString(BiometricPrompt.KEY_SUBTITLE))
+ .setDescription(mBundle.getString(BiometricPrompt.KEY_DESCRIPTION))
+ .setConfirmationRequired(
+ mBundle.getBoolean(BiometricPrompt.KEY_REQUIRE_CONFIRMATION, true));
+
+ final LockPatternUtils lockPatternUtils = FeatureFactory.getFactory(
+ getContext())
+ .getSecurityFeatureProvider()
+ .getLockPatternUtils(getContext());
+
+ switch (lockPatternUtils.getKeyguardStoredPasswordQuality(mUserId)) {
+ case DevicePolicyManager.PASSWORD_QUALITY_SOMETHING:
+ builder.setNegativeButton(getResources().getString(
+ R.string.confirm_device_credential_pattern),
+ mClientExecutor, mNegativeButtonListener);
+ break;
+ case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC:
+ case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC_COMPLEX:
+ builder.setNegativeButton(getResources().getString(
+ R.string.confirm_device_credential_pin),
+ mClientExecutor, mNegativeButtonListener);
+ break;
+ case DevicePolicyManager.PASSWORD_QUALITY_ALPHABETIC:
+ case DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC:
+ case DevicePolicyManager.PASSWORD_QUALITY_COMPLEX:
+ case DevicePolicyManager.PASSWORD_QUALITY_MANAGED:
+ builder.setNegativeButton(getResources().getString(
+ R.string.confirm_device_credential_password),
+ mClientExecutor, mNegativeButtonListener);
+ break;
+ }
+
+ mBiometricPrompt = builder.build();
mCancellationSignal = new CancellationSignal();
// TODO: CC doesn't use crypto for now