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:
Kevin Chyn
2020-09-09 13:28:28 -07:00
parent eb8c0f14ea
commit 87bb772e16
35 changed files with 1281 additions and 270 deletions

View File

@@ -81,7 +81,7 @@ public class ChooseLockPattern extends SettingsActivity {
* behavior. So, now an activity does not finish itself until it gets this
* result.
*/
static final int RESULT_FINISHED = RESULT_FIRST_USER;
public static final int RESULT_FINISHED = RESULT_FIRST_USER;
private static final String TAG = "ChooseLockPattern";
@@ -134,6 +134,11 @@ public class ChooseLockPattern extends SettingsActivity {
return this;
}
public IntentBuilder setForBiometrics(boolean forBiometrics) {
mIntent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_FOR_BIOMETRICS, forBiometrics);
return this;
}
/**
* Configures the launch such that at the end of the pattern enrollment, one of its
* managed profile (specified by {@code profileId}) will have its lockscreen unified
@@ -455,6 +460,7 @@ public class ChooseLockPattern extends SettingsActivity {
protected int mUserId;
protected boolean mForFingerprint;
protected boolean mForFace;
protected boolean mForBiometrics;
private static final String KEY_UI_STAGE = "uiStage";
private static final String KEY_PATTERN_CHOICE = "chosenPattern";
@@ -488,6 +494,8 @@ public class ChooseLockPattern 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);
}
@Override
@@ -506,6 +514,8 @@ public class ChooseLockPattern extends SettingsActivity {
layout.setIcon(getActivity().getDrawable(R.drawable.ic_fingerprint_header));
} else if (mForFace) {
layout.setIcon(getActivity().getDrawable(R.drawable.ic_face_header));
} else if (mForBiometrics) {
layout.setIcon(getActivity().getDrawable(R.drawable.ic_lock));
}
}
@@ -732,8 +742,8 @@ public class ChooseLockPattern extends SettingsActivity {
} else {
mHeaderText.setText(stage.headerMessage);
}
final boolean forBiometrics = mForFingerprint || mForFace;
int message = forBiometrics ? stage.messageForBiometrics : stage.message;
final boolean forAnyBiometric = mForFingerprint || mForFace || mForBiometrics;
int message = forAnyBiometric ? stage.messageForBiometrics : stage.message;
if (message == ID_EMPTY_MESSAGE) {
mMessageText.setText("");
} else {
@@ -756,7 +766,7 @@ public class ChooseLockPattern extends SettingsActivity {
mHeaderText.setTextColor(mDefaultHeaderColorList);
}
if (stage == Stage.NeedToConfirm && forBiometrics) {
if (stage == Stage.NeedToConfirm && forAnyBiometric) {
mHeaderText.setText("");
mTitleText.setText(R.string.lockpassword_draw_your_pattern_again_header);
}