From 71724ae03c47909e4d8a7bae00ffa68d68795171 Mon Sep 17 00:00:00 2001 From: Kevin Chyn Date: Thu, 27 Dec 2018 13:38:35 -0800 Subject: [PATCH] Show "Done" button to prevent user from getting stuck When the user has already reached max enrollments, we should show a done button. It's possible to get to the introduction page (back button during SUW, or launching android.settings.BIOMETRIC_ENROLL). Bug: 111548033 Test: Done button is shown and works as expected when max enrollments Change-Id: Ia70c21f63606393116e222ca940ee93bcfb25995 --- .../biometrics/BiometricEnrollIntroduction.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/com/android/settings/biometrics/BiometricEnrollIntroduction.java b/src/com/android/settings/biometrics/BiometricEnrollIntroduction.java index 0ddc1fc298c..798c188dde1 100644 --- a/src/com/android/settings/biometrics/BiometricEnrollIntroduction.java +++ b/src/com/android/settings/biometrics/BiometricEnrollIntroduction.java @@ -150,7 +150,8 @@ public abstract class BiometricEnrollIntroduction extends BiometricEnrollBase getNextButton().setVisibility(View.VISIBLE); } else { mErrorText.setText(errorMsg); - getNextButton().setVisibility(View.GONE); + getNextButton().setText(getResources().getString(R.string.done)); + getNextButton().setVisibility(View.VISIBLE); } } @@ -162,8 +163,13 @@ public abstract class BiometricEnrollIntroduction extends BiometricEnrollBase @Override protected void onNextButtonClick(View view) { - // Lock thingy is already set up, launch directly to the next page - launchNextEnrollingActivity(mToken); + if (checkMaxEnrolled() == 0) { + // Lock thingy is already set up, launch directly to the next page + launchNextEnrollingActivity(mToken); + } else { + setResult(RESULT_FINISHED); + finish(); + } } private void launchChooseLock() {