Update FRP warning to spec

Bug: 22672924
Change-Id: Ie275d5099553539707f86bf0e8cec5d5022ad227
diff --git a/res/values/strings.xml b/res/values/strings.xml
index b8a3401..aede37c 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -958,9 +958,6 @@
     <!-- Summary specifying that this is the current screen lock setting [CHAR LIMIT=45] -->
     <string name="current_screen_lock">Current screen lock</string>
 
-    <!--  Content of warning dialog about disabling device protection features when user is switching from a secure unlock method to an insecure one. [CHAR LIMIT=NONE] -->
-    <string name="unlock_disable_frp_warning_content">Device protection features will no longer work.</string>
-
     <!-- Summary for preference that has been disabled by because of the DevicePolicyAdmin, or because device encryption is enabled, or because there are credentials in the credential storage [CHAR LIMIT=50] -->
     <string name="unlock_set_unlock_disabled_summary">Disabled by administrator, encryption policy, or credential storage</string>
 
@@ -983,14 +980,28 @@
     <!-- Title for option to turn of password/pin/pattern unlock. [CHAR LIMIT=22] -->
     <string name="unlock_disable_lock_title">Turn off screen lock</string>
 
-    <!-- Summary shown under unlock_disable_lock_title when pattern is in use and can be removed [CHAR LIMIT=45] -->
-    <string name="unlock_disable_lock_pattern_summary">Remove unlock pattern</string>
-    <!-- Summary shown under unlock_disable_lock_title when PIN is in use and can be removed [CHAR LIMIT=45]-->
-    <string name="unlock_disable_lock_pin_summary">Remove unlock PIN</string>
-    <!-- Summary shown under unlock_disable_lock_title when password is in use and can be removed [CHAR LIMIT=45]-->
-    <string name="unlock_disable_lock_password_summary">Remove unlock password</string>
-    <!-- Summary shown under unlock_disable_lock_title when an unknown secure unlocking method is in use and can be removed [CHAR LIMIT=45]-->
-    <string name="unlock_disable_lock_unknown_summary">Remove screen lock</string>
+    <!-- Title of the dialog shown when the user removes the device lock [CHAR LIMIT=NONE] -->
+    <string name="unlock_disable_frp_warning_title">Remove device protection?</string>
+
+    <!-- Content of the dialog shown when the user removes the device lock pattern [CHAR LIMIT=NONE] -->
+    <string name="unlock_disable_frp_warning_content_pattern">"Device protection features will not work without your pattern."</string>
+    <!-- Content of the dialog shown when the user removes the device lock pattern and the user has fingerprints enrolled [CHAR LIMIT=NONE] -->
+    <string name="unlock_disable_frp_warning_content_pattern_fingerprint">"Device protection features will not work without your pattern.<xliff:g id="empty_line">\n\n</xliff:g>Your 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."</string>
+    <!-- Content of the dialog shown when the user removes the device lock PIN [CHAR LIMIT=NONE] -->
+    <string name="unlock_disable_frp_warning_content_pin">"Device protection features will not work without your PIN."</string>
+    <!-- Content of the dialog shown when the user removes the device lock PIN and the user has fingerprints enrolled [CHAR LIMIT=NONE] -->
+    <string name="unlock_disable_frp_warning_content_pin_fingerprint">"Device protection features will not work without your PIN.<xliff:g id="empty_line">\n\n</xliff:g>Your 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."</string>
+    <!-- Content of the dialog shown when the user removes the device lock password [CHAR LIMIT=NONE] -->
+    <string name="unlock_disable_frp_warning_content_password">"Device protection features will not work without your password."</string>
+    <!-- Content of the dialog shown when the user removes the device lock password and the user has fingerprints enrolled [CHAR LIMIT=NONE] -->
+    <string name="unlock_disable_frp_warning_content_password_fingerprint">"Device protection features will not work without your password.<xliff:g id="empty_line">\n\n</xliff:g>Your 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."</string>
+    <!-- Content of the dialog shown when the user removes the device lock of unknown type [CHAR LIMIT=NONE] -->
+    <string name="unlock_disable_frp_warning_content_unknown">"Device protection features will not work without your screen lock."</string>
+    <!-- Content of the dialog shown when the user removes the device lock of unknown type and the user has fingerprints enrolled [CHAR LIMIT=NONE] -->
+    <string name="unlock_disable_frp_warning_content_unknown_fingerprint">"Device protection features will not work without your screen lock.<xliff:g id="empty_line">\n\n</xliff:g>Your 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."</string>
+
+    <!-- Affirmative action of the dialog shown when the user removes the device lock [CHAR LIMIT=25] -->
+    <string name="unlock_disable_frp_warning_ok">Yes, remove</string>
 
     <!-- Title shown on security settings to allow the user to change their lockscreen pattern [CHAR LIMIT=22] -->
     <string name="unlock_change_lock_pattern_title">Change unlock pattern</string>
diff --git a/src/com/android/settings/ChooseLockGeneric.java b/src/com/android/settings/ChooseLockGeneric.java
index 27e8c93..70ef4d9 100644
--- a/src/com/android/settings/ChooseLockGeneric.java
+++ b/src/com/android/settings/ChooseLockGeneric.java
@@ -500,19 +500,28 @@
             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 @@
         }
 
         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 @@
                 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) {