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

Commit 6ec3ac32 authored by Joseph Vincent's avatar Joseph Vincent Committed by Android (Google) Code Review
Browse files

Merge "To skip face enrollment for PS unlock setup based on intent extra" into main

parents 732636cb f9bc3236
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -87,6 +87,10 @@ public class BiometricEnrollActivity extends InstrumentedActivity {
    // this only applies to fingerprint.
    public static final String EXTRA_SKIP_INTRO = "skip_intro";

    // Intent extra. If true, support fingerprint enrollment only and skip other biometric
    // enrollment methods like face unlock.
    public static final String EXTRA_FINGERPRINT_ENROLLMENT_ONLY = "fingerprint_enrollment_only";

    // Intent extra. If true, parental consent will be requested before user enrollment.
    public static final String EXTRA_REQUIRE_PARENTAL_CONSENT = "require_consent";

@@ -194,7 +198,8 @@ public class BiometricEnrollActivity extends InstrumentedActivity {

        final PackageManager pm = getApplicationContext().getPackageManager();
        mHasFeatureFingerprint = pm.hasSystemFeature(PackageManager.FEATURE_FINGERPRINT);
        mHasFeatureFace = pm.hasSystemFeature(PackageManager.FEATURE_FACE);
        mHasFeatureFace = pm.hasSystemFeature(PackageManager.FEATURE_FACE)
                && !(intent.getBooleanExtra(EXTRA_FINGERPRINT_ENROLLMENT_ONLY, false));

        // Default behavior is to enroll BIOMETRIC_WEAK or above. See ACTION_BIOMETRIC_ENROLL.
        final int authenticators = getIntent().getIntExtra(
+10 −2
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ import static com.android.settings.password.ChooseLockSettingsHelper.EXTRA_KEY_C
import static com.android.settings.password.ChooseLockSettingsHelper.EXTRA_KEY_CHOOSE_LOCK_SCREEN_DESCRIPTION;
import static com.android.settings.password.ChooseLockSettingsHelper.EXTRA_KEY_CHOOSE_LOCK_SCREEN_TITLE;
import static com.android.settings.password.ChooseLockSettingsHelper.EXTRA_KEY_DEVICE_PASSWORD_REQUIREMENT_ONLY;
import static com.android.settings.password.ChooseLockSettingsHelper.EXTRA_KEY_FINGERPRINT_ENROLLMENT_ONLY;
import static com.android.settings.password.ChooseLockSettingsHelper.EXTRA_KEY_IS_CALLING_APP_ADMIN;
import static com.android.settings.password.ChooseLockSettingsHelper.EXTRA_KEY_REQUESTED_MIN_COMPLEXITY;
import static com.android.settings.password.ChooseLockSettingsHelper.EXTRA_KEY_REQUEST_WRITE_REPAIR_MODE_PW;
@@ -63,6 +64,7 @@ import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
import androidx.annotation.VisibleForTesting;
import androidx.appcompat.app.AlertDialog;
@@ -167,7 +169,7 @@ public class ChooseLockGeneric extends SettingsActivity {
        private boolean mWaitingForActivityResult = false;
        private LockscreenCredential mUserPassword;
        private FingerprintManager mFingerprintManager;
        private FaceManager mFaceManager;
        @Nullable private FaceManager mFaceManager;
        private int mUserId;
        private boolean mIsManagedProfile;
        private ManagedLockPasswordProvider mManagedPasswordProvider;
@@ -206,6 +208,7 @@ public class ChooseLockGeneric extends SettingsActivity {
        private int mExtraLockScreenTitleResId;
        private int mExtraLockScreenDescriptionResId;
        private boolean mWaitingForBiometricEnrollment = false;
        private boolean mEnrollFingerPrintOnly = false;

        @Override
        public int getMetricsCategory() {
@@ -225,8 +228,10 @@ public class ChooseLockGeneric extends SettingsActivity {
            }
            final Intent intent = activity.getIntent();
            String chooseLockAction = intent.getAction();
            mEnrollFingerPrintOnly =
                    intent.getBooleanExtra(EXTRA_KEY_FINGERPRINT_ENROLLMENT_ONLY, false);
            mFingerprintManager = Utils.getFingerprintManagerOrNull(activity);
            mFaceManager = Utils.getFaceManagerOrNull(activity);
            mFaceManager = !mEnrollFingerPrintOnly ? Utils.getFaceManagerOrNull(activity) : null;
            mDpm = (DevicePolicyManager) getSystemService(Context.DEVICE_POLICY_SERVICE);
            mLockPatternUtils = new LockPatternUtils(activity);
            mIsSetNewPassword = ACTION_SET_NEW_PARENT_PROFILE_PASSWORD.equals(chooseLockAction)
@@ -530,6 +535,9 @@ public class ChooseLockGeneric extends SettingsActivity {
            final Intent intent =
                    new Intent(context, BiometricEnrollActivity.InternalActivity.class);
            intent.putExtra(BiometricEnrollActivity.EXTRA_SKIP_INTRO, true);
            if (mEnrollFingerPrintOnly) {
                intent.putExtra(BiometricEnrollActivity.EXTRA_FINGERPRINT_ENROLLMENT_ONLY, true);
            }
            return intent;
        }

+2 −0
Original line number Diff line number Diff line
@@ -64,6 +64,8 @@ public final class ChooseLockSettingsHelper {
    public static final String EXTRA_KEY_FOR_FACE = "for_face";
    // For the paths where multiple biometric sensors exist
    public static final String EXTRA_KEY_FOR_BIOMETRICS = "for_biometrics";
    // To support fingerprint enrollment only and skip other biometric enrollments like face.
    public static final String EXTRA_KEY_FINGERPRINT_ENROLLMENT_ONLY = "for_fingerprint_only";
    // For the paths where setup biometrics in suw flow
    public static final String EXTRA_KEY_IS_SUW = "is_suw";
    public static final String EXTRA_KEY_FOREGROUND_ONLY = "foreground_only";
+3 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import static com.android.settings.password.ChooseLockSettingsHelper.EXTRA_KEY_C
import static com.android.settings.password.ChooseLockSettingsHelper.EXTRA_KEY_CHOOSE_LOCK_SCREEN_DESCRIPTION;
import static com.android.settings.password.ChooseLockSettingsHelper.EXTRA_KEY_CHOOSE_LOCK_SCREEN_TITLE;
import static com.android.settings.password.ChooseLockSettingsHelper.EXTRA_KEY_DEVICE_PASSWORD_REQUIREMENT_ONLY;
import static com.android.settings.password.ChooseLockSettingsHelper.EXTRA_KEY_FINGERPRINT_ENROLLMENT_ONLY;
import static com.android.settings.password.ChooseLockSettingsHelper.EXTRA_KEY_IS_CALLING_APP_ADMIN;
import static com.android.settings.password.ChooseLockSettingsHelper.EXTRA_KEY_REQUESTED_MIN_COMPLEXITY;

@@ -132,6 +133,8 @@ public class SetNewPasswordActivity extends Activity implements SetNewPasswordCo
                getIntent().getIntExtra(EXTRA_KEY_CHOOSE_LOCK_SCREEN_TITLE, -1));
        intent.putExtra(EXTRA_KEY_CHOOSE_LOCK_SCREEN_DESCRIPTION,
                getIntent().getIntExtra(EXTRA_KEY_CHOOSE_LOCK_SCREEN_DESCRIPTION, -1));
        intent.putExtra(EXTRA_KEY_FINGERPRINT_ENROLLMENT_ONLY,
                getIntent().getBooleanExtra(EXTRA_KEY_FINGERPRINT_ENROLLMENT_ONLY, false));
        if (mCallerAppName != null) {
            intent.putExtra(EXTRA_KEY_CALLER_APP_NAME, mCallerAppName);
        }
+5 −1
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import static android.app.admin.DevicePolicyManager.KEYGUARD_DISABLE_FACE;
import static android.app.admin.DevicePolicyManager.KEYGUARD_DISABLE_FINGERPRINT;

import static com.android.internal.util.Preconditions.checkNotNull;
import static com.android.settings.password.ChooseLockSettingsHelper.EXTRA_KEY_FINGERPRINT_ENROLLMENT_ONLY;

import android.app.ActivityManager;
import android.app.admin.DevicePolicyManager;
@@ -79,7 +80,10 @@ final class SetNewPasswordController {
        }
        // Create a wrapper of FingerprintManager for testing, see IFingerPrintManager for details.
        final FingerprintManager fingerprintManager = Utils.getFingerprintManagerOrNull(context);
        final FaceManager faceManager = Utils.getFaceManagerOrNull(context);
        final FaceManager faceManager =
                !intent.getBooleanExtra(EXTRA_KEY_FINGERPRINT_ENROLLMENT_ONLY, false)
                        ? Utils.getFaceManagerOrNull(context)
                        : null;
        return new SetNewPasswordController(userId,
                context.getPackageManager(),
                fingerprintManager, faceManager,
Loading