Add mandatory biometric prompt to platform surfaces (1/N)

1. Face settings
2. Fingerprint settings
3. Change device credential

Flag: android.hardware.biometrics.Flags.MANDATORY_BIOMETRICS
Bug: 339910718
Test: atest UtilsTest

Change-Id: I69778d1733ea9fb312e7c26ae0fa23b6008dde5d
This commit is contained in:
Diya Bera
2024-06-28 16:55:57 +00:00
parent b67c157e2f
commit 049de84f2d
10 changed files with 275 additions and 3 deletions

View File

@@ -160,11 +160,13 @@ public class ChooseLockGeneric extends SettingsActivity {
static final int CHOOSE_LOCK_BEFORE_BIOMETRIC_REQUEST = 103;
@VisibleForTesting
static final int SKIP_FINGERPRINT_REQUEST = 104;
private static final int BIOMETRIC_AUTH_REQUEST = 105;
private LockPatternUtils mLockPatternUtils;
private DevicePolicyManager mDpm;
private boolean mRequestGatekeeperPasswordHandle = false;
private boolean mPasswordConfirmed = false;
private boolean mBiometricsAuthSuccessful = false;
private boolean mWaitingForConfirmation = false;
private boolean mWaitingForActivityResult = false;
private LockscreenCredential mUserPassword;
@@ -488,6 +490,17 @@ public class ChooseLockGeneric extends SettingsActivity {
? data.getParcelableExtra(ChooseLockSettingsHelper.EXTRA_KEY_PASSWORD)
: null;
updatePreferencesOrFinish(false /* isRecreatingActivity */);
if (Utils.requestBiometricAuthenticationForMandatoryBiometrics(getContext(),
mBiometricsAuthSuccessful, mWaitingForConfirmation)) {
mWaitingForConfirmation = true;
Utils.launchBiometricPromptForMandatoryBiometrics(this, BIOMETRIC_AUTH_REQUEST);
}
} else if (requestCode == BIOMETRIC_AUTH_REQUEST) {
if (resultCode == Activity.RESULT_OK) {
mBiometricsAuthSuccessful = true;
} else {
finish();
}
} else if (requestCode == CHOOSE_LOCK_REQUEST) {
if (resultCode != RESULT_CANCELED) {
getActivity().setResult(resultCode, data);