Finish biometric enroll screens when backgrounded

Currently, there are some biometric security setting and enrollment
screens which remain open after the user has backgrounded them. This
means that they can later be resumed without requiring the user to
confirm their device credential as normal.

This commit fixes the issue in AOSP by adding logic to the affected
biometric enrollment/setting activities in to finish() with
RESULT_TIMEOUT in onStop(). We don't want to finish() these activities
prematurely if the user is currently in a wizard setup flow, however. In
that case, this commit ensures that the newly added logic will not run.

Test: Pixel 3 - Background at each step of fingerprint enroll => finish
Test: Pixel 3 - Rotate at each step of fingerprint enroll => no finish
Test: Pixel 3 - Proceed though fingerprint setup wizard => no change

Bug: 142544519
Change-Id: I8ec0fa1e30bafe097d9dc82991ff786ebf24844b
This commit is contained in:
Curtis Belmonte
2019-12-18 11:13:47 -08:00
parent 6b7b92ced5
commit 4ac1d25c2a
10 changed files with 103 additions and 51 deletions

View File

@@ -178,6 +178,11 @@ public abstract class BiometricEnrollIntroduction extends BiometricEnrollBase
}
}
@Override
protected boolean shouldFinishWhenBackgrounded() {
return super.shouldFinishWhenBackgrounded() && !mConfirmingCredentials && !mNextClicked;
}
private void updatePasswordQuality() {
final int passwordQuality = new ChooseLockSettingsHelper(this).utils()
.getActivePasswordQuality(mUserManager.getCredentialOwnerProfile(mUserId));
@@ -243,7 +248,8 @@ public abstract class BiometricEnrollIntroduction extends BiometricEnrollBase
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == BIOMETRIC_FIND_SENSOR_REQUEST) {
if (resultCode == RESULT_FINISHED || resultCode == RESULT_SKIP) {
if (resultCode == RESULT_FINISHED || resultCode == RESULT_SKIP
|| resultCode == RESULT_TIMEOUT) {
setResult(resultCode, data);
finish();
return;