Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f90c24d1 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Updated ConfirmDeviceCredential strings" into qt-dev

parents 7af19fcb a104d290
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -3964,8 +3964,12 @@
    <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] -->
+40 −12
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
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;
@@ -32,8 +33,10 @@ import android.util.Log;

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;

@@ -137,18 +140,43 @@ public class BiometricFragment extends InstrumentedFragment {
        setRetainInstance(true);

        mBundle = getArguments();
        mBiometricPrompt = new BiometricPrompt.Builder(getContext())
        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))
            .setNegativeButton(getResources().getString(
                    R.string.confirm_device_credential_use_alternate_method),
                    mClientExecutor, mNegativeButtonListener)
            .build();
                        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