From 38c9b9eb5ee2734c4f6f78854951e79bd9e9d3cf Mon Sep 17 00:00:00 2001 From: Adrian Roos Date: Fri, 24 Jul 2015 11:30:14 -0700 Subject: [PATCH] Update FRP warning to spec Bug: 22672924 Change-Id: Ie275d5099553539707f86bf0e8cec5d5022ad227 --- res/values/strings.xml | 33 +++++++++++------ .../android/settings/ChooseLockGeneric.java | 35 ++++++++++++------- 2 files changed, 44 insertions(+), 24 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index b8a34014210..aede37c15dd 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -958,9 +958,6 @@ Current screen lock - - Device protection features will no longer work. - Disabled by administrator, encryption policy, or credential storage @@ -983,14 +980,28 @@ Turn off screen lock - - Remove unlock pattern - - Remove unlock PIN - - Remove unlock password - - Remove screen lock + + Remove device protection? + + + "Device protection features will not work without your pattern." + + "Device protection features will not work without your pattern.\n\nYour saved fingerprints will also be removed from this device and you won't be able to unlock your phone, authorize purchases, or sign in to apps with them." + + "Device protection features will not work without your PIN." + + "Device protection features will not work without your PIN.\n\nYour saved fingerprints will also be removed from this device and you won't be able to unlock your phone, authorize purchases, or sign in to apps with them." + + "Device protection features will not work without your password." + + "Device protection features will not work without your password.\n\nYour saved fingerprints will also be removed from this device and you won't be able to unlock your phone, authorize purchases, or sign in to apps with them." + + "Device protection features will not work without your screen lock." + + "Device protection features will not work without your screen lock.\n\nYour saved fingerprints will also be removed from this device and you won't be able to unlock your phone, authorize purchases, or sign in to apps with them." + + + Yes, remove Change unlock pattern diff --git a/src/com/android/settings/ChooseLockGeneric.java b/src/com/android/settings/ChooseLockGeneric.java index 27e8c93dab2..70ef4d9f97b 100644 --- a/src/com/android/settings/ChooseLockGeneric.java +++ b/src/com/android/settings/ChooseLockGeneric.java @@ -500,19 +500,28 @@ public class ChooseLockGeneric extends SettingsActivity { return R.string.help_url_choose_lockscreen; } - private int getResIdForFactoryResetProtectionWarningTitle() { + private int getResIdForFactoryResetProtectionWarningMessage() { + boolean hasFingerprints = mFingerprintManager.hasEnrolledFingerprints(); switch (mLockPatternUtils.getKeyguardStoredPasswordQuality(UserHandle.myUserId())) { case DevicePolicyManager.PASSWORD_QUALITY_SOMETHING: - return R.string.unlock_disable_lock_pattern_summary; + return hasFingerprints + ? R.string.unlock_disable_frp_warning_content_pattern_fingerprint + : R.string.unlock_disable_frp_warning_content_pattern; case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC: case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC_COMPLEX: - return R.string.unlock_disable_lock_pin_summary; + return hasFingerprints + ? R.string.unlock_disable_frp_warning_content_pin_fingerprint + : R.string.unlock_disable_frp_warning_content_pin; case DevicePolicyManager.PASSWORD_QUALITY_ALPHABETIC: case DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC: case DevicePolicyManager.PASSWORD_QUALITY_COMPLEX: - return R.string.unlock_disable_lock_password_summary; + return hasFingerprints + ? R.string.unlock_disable_frp_warning_content_password_fingerprint + : R.string.unlock_disable_frp_warning_content_password; default: - return R.string.unlock_disable_lock_unknown_summary; + return hasFingerprints + ? R.string.unlock_disable_frp_warning_content_unknown_fingerprint + : R.string.unlock_disable_frp_warning_content_unknown; } } @@ -547,23 +556,23 @@ public class ChooseLockGeneric extends SettingsActivity { } private void showFactoryResetProtectionWarningDialog(String unlockMethodToSet) { - int title = getResIdForFactoryResetProtectionWarningTitle(); + int message = getResIdForFactoryResetProtectionWarningMessage(); FactoryResetProtectionWarningDialog dialog = - FactoryResetProtectionWarningDialog.newInstance(title, unlockMethodToSet); + FactoryResetProtectionWarningDialog.newInstance(message, unlockMethodToSet); dialog.show(getChildFragmentManager(), TAG_FRP_WARNING_DIALOG); } public static class FactoryResetProtectionWarningDialog extends DialogFragment { - private static final String ARG_TITLE_RES = "titleRes"; + private static final String ARG_MESSAGE_RES = "messageRes"; private static final String ARG_UNLOCK_METHOD_TO_SET = "unlockMethodToSet"; - public static FactoryResetProtectionWarningDialog newInstance(int title, + public static FactoryResetProtectionWarningDialog newInstance(int messageRes, String unlockMethodToSet) { FactoryResetProtectionWarningDialog frag = new FactoryResetProtectionWarningDialog(); Bundle args = new Bundle(); - args.putInt(ARG_TITLE_RES, title); + args.putInt(ARG_MESSAGE_RES, messageRes); args.putString(ARG_UNLOCK_METHOD_TO_SET, unlockMethodToSet); frag.setArguments(args); return frag; @@ -582,9 +591,9 @@ public class ChooseLockGeneric extends SettingsActivity { final Bundle args = getArguments(); return new AlertDialog.Builder(getActivity()) - .setTitle(args.getInt(ARG_TITLE_RES)) - .setMessage(R.string.unlock_disable_frp_warning_content) - .setPositiveButton(R.string.okay, + .setTitle(R.string.unlock_disable_frp_warning_title) + .setMessage(args.getInt(ARG_MESSAGE_RES)) + .setPositiveButton(R.string.unlock_disable_frp_warning_ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int whichButton) {