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

@@ -43,6 +43,7 @@ public class FaceSettingsEnrollButtonPreferenceController extends BasePreference
private SettingsActivity mActivity;
private Button mButton;
private boolean mIsClicked;
private Listener mListener;
public FaceSettingsEnrollButtonPreferenceController(Context context) {
this(context, KEY);
@@ -69,7 +70,11 @@ public class FaceSettingsEnrollButtonPreferenceController extends BasePreference
intent.setClassName("com.android.settings", FaceEnrollIntroduction.class.getName());
intent.putExtra(Intent.EXTRA_USER_ID, mUserId);
intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN, mToken);
mContext.startActivity(intent);
if (mListener != null) {
mListener.onStartEnrolling(intent);
} else {
mContext.startActivity(intent);
}
}
@Override
@@ -95,4 +100,19 @@ public class FaceSettingsEnrollButtonPreferenceController extends BasePreference
public void setActivity(SettingsActivity activity) {
mActivity = activity;
}
public void setListener(Listener listener) {
mListener = listener;
}
/**
* Interface for registering callbacks related to the face enroll preference button.
*/
public interface Listener {
/**
* Called when the user has indicated an intent to begin enrolling a new face.
* @param intent The Intent that should be used to launch face enrollment.
*/
void onStartEnrolling(Intent intent);
}
}