From 87bb772e161d22671119845cc21d5d354155d059 Mon Sep 17 00:00:00 2001 From: Kevin Chyn Date: Wed, 9 Sep 2020 13:28:28 -0700 Subject: [PATCH] 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 --- res/drawable/ic_face_24dp.xml | 5 +- res/layout/biometric_enroll_checkbox.xml | 64 ++++ res/layout/biometric_enroll_layout.xml | 80 +++++ ... choose_lock_generic_biometric_header.xml} | 6 +- ...choose_lock_generic_fingerprint_header.xml | 26 -- res/values/attrs.xml | 7 + res/values/strings.xml | 71 +++- res/values/styles.xml | 8 +- res/xml/security_settings_picker.xml | 5 + .../settings/EncryptionInterstitial.java | 8 + .../biometrics/BiometricEnrollActivity.java | 314 +++++++++++++++--- .../biometrics/BiometricEnrollBase.java | 8 + .../biometrics/BiometricEnrollCheckbox.java | 115 +++++++ .../BiometricEnrollIntroduction.java | 35 +- .../settings/biometrics/BiometricUtils.java | 197 ++++++++++- .../MultiBiometricEnrollHelper.java | 113 +++++++ .../biometrics/face/FaceEnrollEducation.java | 2 + .../face/FaceEnrollIntroduction.java | 60 ++-- .../biometrics/face/FaceSettings.java | 2 +- .../FingerprintEnrollFindSensor.java | 5 +- .../FingerprintEnrollIntroduction.java | 26 +- .../fingerprint/FingerprintSettings.java | 2 +- .../SetupFingerprintEnrollIntroduction.java | 30 +- .../settings/password/ChooseLockGeneric.java | 41 ++- .../settings/password/ChooseLockPassword.java | 47 ++- .../settings/password/ChooseLockPattern.java | 18 +- .../password/ChooseLockSettingsHelper.java | 4 + .../password/SetNewPasswordController.java | 41 ++- .../password/SetupChooseLockGeneric.java | 7 +- .../password/SetupChooseLockPassword.java | 25 +- .../password/SetupChooseLockPattern.java | 25 +- .../settings/password/SetupSkipDialog.java | 29 +- ...etupFingerprintEnrollIntroductionTest.java | 12 + .../password/SetupSkipDialogTest.java | 101 ++++-- .../shadow/ShadowFingerprintManager.java | 12 +- 35 files changed, 1281 insertions(+), 270 deletions(-) create mode 100644 res/layout/biometric_enroll_checkbox.xml create mode 100644 res/layout/biometric_enroll_layout.xml rename res/layout/{choose_lock_generic_face_header.xml => choose_lock_generic_biometric_header.xml} (86%) delete mode 100644 res/layout/choose_lock_generic_fingerprint_header.xml create mode 100644 src/com/android/settings/biometrics/BiometricEnrollCheckbox.java create mode 100644 src/com/android/settings/biometrics/MultiBiometricEnrollHelper.java diff --git a/res/drawable/ic_face_24dp.xml b/res/drawable/ic_face_24dp.xml index 7920c12570e..d9bf27d17eb 100644 --- a/res/drawable/ic_face_24dp.xml +++ b/res/drawable/ic_face_24dp.xml @@ -14,13 +14,12 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License --> - - + android:viewportHeight="24" + android:tint="?android:attr/colorControlNormal"> diff --git a/res/layout/biometric_enroll_checkbox.xml b/res/layout/biometric_enroll_checkbox.xml new file mode 100644 index 00000000000..028b511ff25 --- /dev/null +++ b/res/layout/biometric_enroll_checkbox.xml @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/res/layout/biometric_enroll_layout.xml b/res/layout/biometric_enroll_layout.xml new file mode 100644 index 00000000000..bf41fcc79a7 --- /dev/null +++ b/res/layout/biometric_enroll_layout.xml @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/res/layout/choose_lock_generic_face_header.xml b/res/layout/choose_lock_generic_biometric_header.xml similarity index 86% rename from res/layout/choose_lock_generic_face_header.xml rename to res/layout/choose_lock_generic_biometric_header.xml index b97b0d6048e..1db0cc6bbeb 100644 --- a/res/layout/choose_lock_generic_face_header.xml +++ b/res/layout/choose_lock_generic_biometric_header.xml @@ -16,12 +16,12 @@ --> + android:text="@string/lock_settings_picker_biometric_message" + style="@style/BiometricHeaderStyle" /> diff --git a/res/layout/choose_lock_generic_fingerprint_header.xml b/res/layout/choose_lock_generic_fingerprint_header.xml deleted file mode 100644 index 6a107bf06d5..00000000000 --- a/res/layout/choose_lock_generic_fingerprint_header.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - diff --git a/res/values/attrs.xml b/res/values/attrs.xml index ee47124beaa..f78120c7e78 100644 --- a/res/values/attrs.xml +++ b/res/values/attrs.xml @@ -148,6 +148,13 @@ + + + + + + + diff --git a/res/values/strings.xml b/res/values/strings.xml index ddd0733f4ae..f958e06cb13 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -711,6 +711,26 @@ Screen lock + + + Unlock your phone securely with your face and fingerprint + + You can also sign in to apps and confirm payment + + Set up unlock with: + + Face unlock + + Make unlocking your phone a breeze + + Fingerprint + + Save time unlocking phone in your pocket + + Skip + + Next + Face added @@ -865,6 +885,8 @@ Use your fingerprint to unlock your phone or approve purchases.\n\nNote: Your fingerprint may be less secure than a strong pattern or PIN. Cancel + + No thanks Continue @@ -939,6 +961,12 @@ By protecting your device with a screen lock option, no one will be able to use it if it is lost or stolen. You also need a screen lock option to set up face unlock. To go back, tap Cancel. By protecting your phone with a screen lock option, no one will be able to use it if it is lost or stolen. You also need a screen lock option to set up face unlock. To go back, tap Cancel. + + By protecting your tablet with a screen lock option, no one will be able to use it if it is lost or stolen. You also need a screen lock option to set up biometrics. To go back, tap Cancel. + + By protecting your device with a screen lock option, no one will be able to use it if it is lost or stolen. You also need a screen lock option to set up biometrics. To go back, tap Cancel. + + By protecting your phone with a screen lock option, no one will be able to use it if it is lost or stolen. You also need a screen lock option to set up biometrics. To go back, tap Cancel. Skip PIN setup? @@ -1179,11 +1207,8 @@ Prevent others from using this phone without your permission by activating device protection features. Choose the screen lock you want to use. - - Choose your backup screen lock method - - - Choose your backup screen lock method + + Choose your backup screen lock method Screen lock options @@ -1247,34 +1272,37 @@ Fingerprint + Pattern - Fingerprint + PIN - Fingerprint + Password - Continue without fingerprint - You can unlock your phone using your fingerprint. For security, this option requires a backup screen lock. Face unlock + Pattern - Face unlock + PIN - Face unlock + Password - Continue without face unlock - You can unlock your phone using your face. For security, this option requires a backup screen lock. + + Biometrics + Pattern + + Biometrics + PIN + + Biometrics + Password + + Continue without biometrics + + You can unlock your phone using your biometrics. For security, this option requires a backup screen lock. + Disabled by admin, encryption policy, or credential storage @@ -4110,6 +4138,15 @@ To use face unlock, set pattern To use face unlock, set PIN + + + To use biometrics, set password + + To use biometrics, set pattern + + To use biometrics, set PIN + + Forgot your password? @@ -9400,6 +9437,14 @@ In addition to using your face to unlock your device, you can further protect this device by requiring your password before it starts up. Until the device starts up, it can\u2019t receive calls, messages, or notifications, including alarms.\n\nThis helps protect data on lost or stolen devices. Require password to start your device? + + In addition to using your biometrics to unlock your device, you can further protect this device by requiring your PIN before it starts up. Until the device starts up, it can\u2019t receive calls, messages, or notifications, including alarms.\n\nThis helps protect data on lost or stolen devices. Require PIN to start your device? + + In addition to using your biometrics to unlock your device, you can further protect this device by requiring your pattern before it starts up. Until the device starts up, it can\u2019t receive calls, messages, or notifications, including alarms.\n\nThis helps protect data on lost or stolen devices. Require pattern to start your device? + + In addition to using your biometrics to unlock your device, you can further protect this device by requiring your password before it starts up. Until the device starts up, it can\u2019t receive calls, messages, or notifications, including alarms.\n\nThis helps protect data on lost or stolen devices. Require password to start your device? + + Yes diff --git a/res/values/styles.xml b/res/values/styles.xml index 7ba1156c594..a4f6fbeaec7 100644 --- a/res/values/styles.xml +++ b/res/values/styles.xml @@ -396,13 +396,7 @@ center_vertical - - -