2/n: Add default implementation for multi-biometric enroll
1) Adds a layout for multi-biometric selection in BiometricEnrollActivity 2) Adds widgets for checkboxes 3) Shows ConfirmLock*/ChooseLock* for multi-biometric devices in BiometricEnrollActivity 4) finish()'s when loses foreground 5) Adds default string for ChooseLock* and multi-biometrics, e.g. "Set up Password + Biometrics", as well as associated plumbing to bring the user back to BiometricEnrollActivity once the credential is enrolled 6) When max templates enrolled, checkbox becomes disabled and description string is updated Bug: 162341940 Bug: 152242790 Fixes: 161742393 No effect on existing devices with the following: Test: adb shell am start -a android.settings.BIOMETRIC_ENROLL Test: SUW Test: make -j RunSettingsRoboTests Exempt-From-Owner-Approval: Biometric-related change to EncryptionInterstitial Change-Id: I855460d50228ace24d4ec5fbe330f02ab406cc02
This commit is contained in:
@@ -103,6 +103,7 @@ public class ChooseLockGeneric extends SettingsActivity {
|
||||
private static final String TAG = "ChooseLockGenericFragment";
|
||||
private static final String KEY_SKIP_FINGERPRINT = "unlock_skip_fingerprint";
|
||||
private static final String KEY_SKIP_FACE = "unlock_skip_face";
|
||||
private static final String KEY_SKIP_BIOMETRICS = "unlock_skip_biometrics";
|
||||
private static final String PASSWORD_CONFIRMED = "password_confirmed";
|
||||
private static final String WAITING_FOR_CONFIRMATION = "waiting_for_confirmation";
|
||||
public static final String MINIMUM_QUALITY_KEY = "minimum_quality";
|
||||
@@ -175,6 +176,7 @@ public class ChooseLockGeneric extends SettingsActivity {
|
||||
|
||||
protected boolean mForFingerprint = false;
|
||||
protected boolean mForFace = false;
|
||||
protected boolean mForBiometrics = false;
|
||||
|
||||
@Override
|
||||
public int getMetricsCategory() {
|
||||
@@ -216,6 +218,9 @@ public class ChooseLockGeneric extends SettingsActivity {
|
||||
ChooseLockSettingsHelper.EXTRA_KEY_FOR_FINGERPRINT, false);
|
||||
mForFace = intent.getBooleanExtra(
|
||||
ChooseLockSettingsHelper.EXTRA_KEY_FOR_FACE, false);
|
||||
mForBiometrics = intent.getBooleanExtra(
|
||||
ChooseLockSettingsHelper.EXTRA_KEY_FOR_BIOMETRICS, false);
|
||||
|
||||
mRequestedMinComplexity = intent
|
||||
.getIntExtra(EXTRA_KEY_REQUESTED_MIN_COMPLEXITY, PASSWORD_COMPLEXITY_NONE);
|
||||
mCallerAppName =
|
||||
@@ -303,17 +308,20 @@ public class ChooseLockGeneric extends SettingsActivity {
|
||||
}
|
||||
|
||||
protected void addHeaderView() {
|
||||
setHeaderView(R.layout.choose_lock_generic_biometric_header);
|
||||
TextView textView = getHeaderView().findViewById(R.id.biometric_header_description);
|
||||
|
||||
if (mForFingerprint) {
|
||||
setHeaderView(R.layout.choose_lock_generic_fingerprint_header);
|
||||
if (mIsSetNewPassword) {
|
||||
((TextView) getHeaderView().findViewById(R.id.fingerprint_header_description))
|
||||
.setText(R.string.fingerprint_unlock_title);
|
||||
textView.setText(R.string.fingerprint_unlock_title);
|
||||
}
|
||||
} else if (mForFace) {
|
||||
setHeaderView(R.layout.choose_lock_generic_face_header);
|
||||
if (mIsSetNewPassword) {
|
||||
((TextView) getHeaderView().findViewById(R.id.face_header_description))
|
||||
.setText(R.string.face_unlock_title);
|
||||
textView.setText(R.string.face_unlock_title);
|
||||
}
|
||||
} else if (mForBiometrics) {
|
||||
if (mIsSetNewPassword) {
|
||||
textView.setText(R.string.biometrics_unlock_title);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -328,7 +336,8 @@ public class ChooseLockGeneric extends SettingsActivity {
|
||||
// unlock method to an insecure one
|
||||
showFactoryResetProtectionWarningDialog(key);
|
||||
return true;
|
||||
} else if (KEY_SKIP_FINGERPRINT.equals(key) || KEY_SKIP_FACE.equals(key)) {
|
||||
} else if (KEY_SKIP_FINGERPRINT.equals(key) || KEY_SKIP_FACE.equals(key)
|
||||
|| KEY_SKIP_BIOMETRICS.equals(key)) {
|
||||
Intent chooseLockGenericIntent = new Intent(getActivity(),
|
||||
getInternalActivityClass());
|
||||
chooseLockGenericIntent.setAction(getIntent().getAction());
|
||||
@@ -357,7 +366,7 @@ public class ChooseLockGeneric extends SettingsActivity {
|
||||
* @param disabled
|
||||
*/
|
||||
// TODO: why does this take disabled, its always called with a quality higher than
|
||||
// what makes sense with disabled == true
|
||||
// what makes sense with disabled == true
|
||||
private void maybeEnableEncryption(int quality, boolean disabled) {
|
||||
DevicePolicyManager dpm = (DevicePolicyManager) getSystemService(DEVICE_POLICY_SERVICE);
|
||||
if (UserManager.get(getActivity()).isAdminUser()
|
||||
@@ -381,8 +390,8 @@ public class ChooseLockGeneric extends SettingsActivity {
|
||||
unlockMethodIntent);
|
||||
intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_FOR_FINGERPRINT,
|
||||
mForFingerprint);
|
||||
intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_FOR_FACE,
|
||||
mForFace);
|
||||
intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_FOR_FACE, mForFace);
|
||||
intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_FOR_BIOMETRICS, mForBiometrics);
|
||||
// If the caller requested Gatekeeper Password to be returned, we assume it came
|
||||
// from biometric enrollment. This should be cleaned up, since requesting
|
||||
// Gatekeeper Password should not imply it came from biometric setup/settings.
|
||||
@@ -531,6 +540,7 @@ public class ChooseLockGeneric extends SettingsActivity {
|
||||
findPreference(ScreenLockType.NONE.preferenceKey).setViewId(R.id.lock_none);
|
||||
findPreference(KEY_SKIP_FINGERPRINT).setViewId(R.id.lock_none);
|
||||
findPreference(KEY_SKIP_FACE).setViewId(R.id.lock_none);
|
||||
findPreference(KEY_SKIP_BIOMETRICS).setViewId(R.id.lock_none);
|
||||
findPreference(ScreenLockType.PIN.preferenceKey).setViewId(R.id.lock_pin);
|
||||
findPreference(ScreenLockType.PASSWORD.preferenceKey).setViewId(R.id.lock_password);
|
||||
}
|
||||
@@ -569,6 +579,12 @@ public class ChooseLockGeneric extends SettingsActivity {
|
||||
setPreferenceTitle(ScreenLockType.PIN, R.string.face_unlock_set_unlock_pin);
|
||||
setPreferenceTitle(ScreenLockType.PASSWORD,
|
||||
R.string.face_unlock_set_unlock_password);
|
||||
} else if (mForBiometrics) {
|
||||
setPreferenceTitle(ScreenLockType.PATTERN,
|
||||
R.string.biometrics_unlock_set_unlock_pattern);
|
||||
setPreferenceTitle(ScreenLockType.PIN, R.string.biometrics_unlock_set_unlock_pin);
|
||||
setPreferenceTitle(ScreenLockType.PASSWORD,
|
||||
R.string.biometrics_unlock_set_unlock_password);
|
||||
}
|
||||
|
||||
if (mManagedPasswordProvider.isSettingManagedPasswordSupported()) {
|
||||
@@ -584,6 +600,9 @@ public class ChooseLockGeneric extends SettingsActivity {
|
||||
if (!(mForFace && mIsSetNewPassword)) {
|
||||
removePreference(KEY_SKIP_FACE);
|
||||
}
|
||||
if (!(mForBiometrics && mIsSetNewPassword)) {
|
||||
removePreference(KEY_SKIP_BIOMETRICS);
|
||||
}
|
||||
}
|
||||
|
||||
private void setPreferenceTitle(ScreenLockType lock, @StringRes int title) {
|
||||
@@ -727,6 +746,7 @@ public class ChooseLockGeneric extends SettingsActivity {
|
||||
.setRequestedMinComplexity(mRequestedMinComplexity)
|
||||
.setForFingerprint(mForFingerprint)
|
||||
.setForFace(mForFace)
|
||||
.setForBiometrics(mForBiometrics)
|
||||
.setUserId(mUserId)
|
||||
.setRequestGatekeeperPasswordHandle(mRequestGatekeeperPasswordHandle);
|
||||
if (mUserPassword != null) {
|
||||
@@ -743,6 +763,7 @@ public class ChooseLockGeneric extends SettingsActivity {
|
||||
new ChooseLockPattern.IntentBuilder(getContext())
|
||||
.setForFingerprint(mForFingerprint)
|
||||
.setForFace(mForFace)
|
||||
.setForBiometrics(mForBiometrics)
|
||||
.setUserId(mUserId)
|
||||
.setRequestGatekeeperPasswordHandle(mRequestGatekeeperPasswordHandle);
|
||||
if (mUserPassword != null) {
|
||||
|
Reference in New Issue
Block a user