From 560458593017c4911baf1e5cabd448b7dc3f4928 Mon Sep 17 00:00:00 2001 From: Curtis Belmonte Date: Mon, 8 Jul 2019 11:23:28 -0700 Subject: [PATCH] Fix work account setup lock screen content for face auth For devices which provide biometric authentication options, such as fingerprint or face, we should be showing different content on the lock setup screen during the corp account setup wizard. Namely, the title should read "Choose screen lock", and the "Not now" option should be changed to "Continue without [auth method]". However, we currently only check for whether fingerprint authentication is available, leading to incorrect text for devices with face authentication. This CL fixes the issue by changing the introducing a private method to check for any biometric authentication (currently just mForFingerprint || mForFace). It then uses this method in place of the existing mForFingerprint checks in SetupChooseLockGeneric. Test: On a device with fingerprint auth and one with face auth: 1. Set a work profile with TestDPC and add some password quality requirement 2. adb shell settings put global device_provisioned 3. adb shell am start -a android.app.action.SET_NEW_PARENT_PROFILE_PASSWORD 4. Verify that the correct content is now shown (screenshot/xZPVtpa3j3Z) 5. Verify that setting lock with and without biometric auth still works Fixes: 136556653 Change-Id: I46d3c964f05986aa97cc8ed77fe0ac125337ddd0 --- .../settings/password/SetupChooseLockGeneric.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/com/android/settings/password/SetupChooseLockGeneric.java b/src/com/android/settings/password/SetupChooseLockGeneric.java index 9a165297942..aa17f8e987f 100644 --- a/src/com/android/settings/password/SetupChooseLockGeneric.java +++ b/src/com/android/settings/password/SetupChooseLockGeneric.java @@ -111,7 +111,7 @@ public class SetupChooseLockGeneric extends ChooseLockGeneric { layout.setIcon(getContext().getDrawable(R.drawable.ic_lock)); - int titleResource = mForFingerprint ? + int titleResource = isForBiometric() ? R.string.lock_settings_picker_title : R.string.setup_lock_settings_picker_title; if (getActivity() != null) { getActivity().setTitle(titleResource); @@ -125,7 +125,7 @@ public class SetupChooseLockGeneric extends ChooseLockGeneric { @Override protected void addHeaderView() { - if (mForFingerprint || mForFace) { + if (isForBiometric()) { setHeaderView(R.layout.setup_choose_lock_generic_biometrics_header); } else { setHeaderView(R.layout.setup_choose_lock_generic_header); @@ -183,7 +183,7 @@ public class SetupChooseLockGeneric extends ChooseLockGeneric { @Override protected void addPreferences() { - if (mForFingerprint) { + if (isForBiometric()) { super.addPreferences(); } else { addPreferencesFromResource(R.xml.setup_security_settings_picker); @@ -240,6 +240,10 @@ public class SetupChooseLockGeneric extends ChooseLockGeneric { SetupWizardUtils.copySetupExtras(getActivity().getIntent(), intent); return intent; } + + private boolean isForBiometric() { + return mForFingerprint || mForFace; + } } public static class InternalActivity extends ChooseLockGeneric.InternalActivity { @@ -261,5 +265,4 @@ public class SetupChooseLockGeneric extends ChooseLockGeneric { } } } - }