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:
@@ -133,6 +133,7 @@ public class FingerprintSettings extends SubSettings {
|
||||
private Drawable mHighlightDrawable;
|
||||
private int mUserId;
|
||||
private CharSequence mFooterTitle;
|
||||
private boolean mEnrollClicked;
|
||||
|
||||
private static final String TAG_AUTHENTICATE_SIDECAR = "authenticate_sidecar";
|
||||
private static final String TAG_REMOVAL_SIDECAR = "removal_sidecar";
|
||||
@@ -463,6 +464,14 @@ public class FingerprintSettings extends SubSettings {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop() {
|
||||
super.onStop();
|
||||
if (!getActivity().isChangingConfigurations() && !mLaunchedConfirm && !mEnrollClicked) {
|
||||
getActivity().finish();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(final Bundle outState) {
|
||||
outState.putByteArray(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN,
|
||||
@@ -475,6 +484,7 @@ public class FingerprintSettings extends SubSettings {
|
||||
public boolean onPreferenceTreeClick(Preference pref) {
|
||||
final String key = pref.getKey();
|
||||
if (KEY_FINGERPRINT_ADD.equals(key)) {
|
||||
mEnrollClicked = true;
|
||||
Intent intent = new Intent();
|
||||
intent.setClassName(SETTINGS_PACKAGE_NAME,
|
||||
FingerprintEnrollEnrolling.class.getName());
|
||||
@@ -564,9 +574,10 @@ public class FingerprintSettings extends SubSettings {
|
||||
}
|
||||
}
|
||||
} else if (requestCode == ADD_FINGERPRINT_REQUEST) {
|
||||
mEnrollClicked = false;
|
||||
if (resultCode == RESULT_TIMEOUT) {
|
||||
Activity activity = getActivity();
|
||||
activity.setResult(RESULT_TIMEOUT);
|
||||
activity.setResult(resultCode);
|
||||
activity.finish();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user