Fix 2579923: Make changing lock screen method more discoverable.

This changes the organization of lock screen security settings
to make choosing an alternate unlock method more discoverable.

Instead of having to disable the old lock method to use a new
one, the user now just has one set/change option in lock settings,
with a list of method-specific setting below it.

In addition, we ask the user to confirm their old credentials
before prompting them to choose a new one, which eliminates one
source of confusion.

Also, ChooseLockGeneric now shows a UI if quality isn't specified.
Any unlock method less secure than minimum specified by
DevicePolicyManager (if active) is greyed out.

Change-Id: Iecc6f64d4d3368a583f06f8d5fe9655cc3d5bd3b
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 5a62ae4..eaa32e2 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -514,6 +514,8 @@
     <!-- Menu item on Select time zone screen -->
     <string name="zone_list_menu_sort_by_timezone">Sort by time zone</string>
 
+    <!-- Security Settings --><skip />
+
     <!-- Main Settings screen setting option title for the item to take you the security and location screen -->
     <string name="security_settings_title">Location &amp; security</string>
     <!-- Location & security settings screen title -->
@@ -525,23 +527,49 @@
     <!-- In the security screen, the header title for settings related to  Passwords-->
     <string name="security_passwords_title">Passwords</string>
 
+    <!-- Unlock Picker Settings --><skip />
 
-    <!-- Unlock settings --><skip />
+    <!-- Security Picker --><skip />
+    <!--  Title for security picker to choose the unlock method: None/Pattern/PIN/Password -->
+    <string name="lock_settings_picker_title">Screen unlock security</string>
 
-    <!-- Title for preference that will guide the user through creating an unlock pattern -->
-    <string name="unlock_set_unlock_pattern_title">Set unlock pattern</string>
+    <!--  Main Security lock settings --><skip />
+    <!--  Title for PreferenceScreen to launch picker for security method when there is none -->
+    <string name="unlock_set_unlock_launch_picker_title">Set up screen lock</string>
+
+    <!--  Summary for PreferenceScreen to launch picker for security method when there is none -->
+    <string name="unlock_set_unlock_launch_picker_summary">Lock screen with a pattern, PIN, or password</string>
+
+    <!--  Title for PreferenceScreen to change security method: None/Pattern/PIN/Password  -->
+    <string name="unlock_set_unlock_launch_picker_change_title">Change screen lock</string>
+
+    <!--  Summary for PreferenceScreen to changeecurity method: None/Pattern/PIN/Password  -->
+    <string name="unlock_set_unlock_launch_picker_change_summary">Change or disable pattern, PIN, or password security</string>
+
+
+    <!-- Title for preference that disables unlock security -->
+    <string name="unlock_set_unlock_none_title">None</string>
+    <!-- Summary for preference that disables unlock security -->
+    <string name="unlock_set_unlock_none_summary">Disable screen unlock security</string>
+
+    <!-- Title for preference that guides the user through creating an unlock pattern -->
+    <string name="unlock_set_unlock_pattern_title">Pattern</string>
     <!-- Summary for preference that guides the user through creating an unlock pattern -->
-    <string name="unlock_set_unlock_pattern_summary">Must draw pattern to unlock screen</string>
+    <string name="unlock_set_unlock_pattern_summary">Draw pattern to unlock screen</string>
 
     <!-- Title for preference that guides the user through creating an unlock PIN (Personal Identification Number)  -->
-    <string name="unlock_set_unlock_pin_title">Set unlock PIN</string>
+    <string name="unlock_set_unlock_pin_title">PIN</string>
     <!-- Summary for preference that guides the user through creating an unlock PIN (Personal Identification Number)  -->
-    <string name="unlock_set_unlock_pin_summary">Must use a numeric PIN to unlock screen</string>
+    <string name="unlock_set_unlock_pin_summary">Enter a numeric PIN to unlock screen</string>
 
     <!-- Title for preference that guides the user through creating an unlock password -->
-    <string name="unlock_set_unlock_password_title">Set unlock password</string>
+    <string name="unlock_set_unlock_password_title">Password</string>
     <!-- Title for preference that guides the user through creating an unlock password -->
-    <string name="unlock_set_unlock_password_summary">Must use a password to unlock screen</string>
+    <string name="unlock_set_unlock_password_summary">Enter a password to unlock screen</string>
+
+    <!-- Summary for preference that has been disabled by DevicePolicyAdmin -->
+    <string name="unlock_set_unlock_disabled_summary">Disable by device policy</string>
+
 
     <!-- Title for option to turn of password/pin/pattern unlock. -->
     <string name="unlock_disable_lock_title">Turn off screen lock</string>
diff --git a/res/xml/security_settings_chooser.xml b/res/xml/security_settings_chooser.xml
index 4f5797f4..095c69f 100644
--- a/res/xml/security_settings_chooser.xml
+++ b/res/xml/security_settings_chooser.xml
@@ -21,21 +21,9 @@
         android:title="@string/lock_settings_title">
 
         <PreferenceScreen
-            android:key="unlock_set_pattern"
-            android:title="@string/unlock_set_unlock_pattern_title"
-            android:summary="@string/unlock_set_unlock_pattern_summary"
-            android:persistent="false"/>
-
-        <PreferenceScreen
-            android:key="unlock_set_pin"
-            android:title="@string/unlock_set_unlock_pin_title"
-            android:summary="@string/unlock_set_unlock_pin_summary"
-            android:persistent="false"/>
-
-        <PreferenceScreen
-            android:key="unlock_set_password"
-            android:title="@string/unlock_set_unlock_password_title"
-            android:summary="@string/unlock_set_unlock_password_summary"
+            android:key="unlock_set_or_change"
+            android:title="@string/unlock_set_unlock_launch_picker_title"
+            android:summary="@string/unlock_set_unlock_launch_picker_summary"
             android:persistent="false"/>
 
     </PreferenceCategory>
diff --git a/res/xml/security_settings_password.xml b/res/xml/security_settings_password.xml
index 9addee4..ac06711 100644
--- a/res/xml/security_settings_password.xml
+++ b/res/xml/security_settings_password.xml
@@ -21,14 +21,9 @@
         android:title="@string/lock_settings_title">
 
         <PreferenceScreen
-            android:key="unlock_method_disable"
-            android:title="@string/unlock_disable_lock_title"
-            android:summary="@string/unlock_disable_lock_password_summary"
-            android:persistent="false"/>
-
-        <PreferenceScreen
-            android:key="unlock_method_change_current"
-            android:title="@string/unlock_change_lock_password_title"
+            android:key="unlock_set_or_change"
+            android:title="@string/unlock_set_unlock_launch_picker_change_title"
+            android:summary="@string/unlock_set_unlock_launch_picker_change_summary"
             android:persistent="false"/>
 
         <CheckBoxPreference
diff --git a/res/xml/security_settings_pattern.xml b/res/xml/security_settings_pattern.xml
index 467fbd7..095828a 100644
--- a/res/xml/security_settings_pattern.xml
+++ b/res/xml/security_settings_pattern.xml
@@ -21,14 +21,9 @@
         android:title="@string/lock_settings_title">
 
         <PreferenceScreen
-            android:key="unlock_method_disable"
-            android:title="@string/unlock_disable_lock_title"
-            android:summary="@string/unlock_disable_lock_pattern_summary"
-            android:persistent="false"/>
-
-        <PreferenceScreen
-            android:key="unlock_method_change_current"
-            android:title="@string/unlock_change_lock_pattern_title"
+            android:key="unlock_set_or_change"
+            android:title="@string/unlock_set_unlock_launch_picker_change_title"
+            android:summary="@string/unlock_set_unlock_launch_picker_change_summary"
             android:persistent="false"/>
 
         <CheckBoxPreference
diff --git a/res/xml/security_settings_picker.xml b/res/xml/security_settings_picker.xml
new file mode 100644
index 0000000..cbed209
--- /dev/null
+++ b/res/xml/security_settings_picker.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2008 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
+
+     <PreferenceCategory
+        android:key="security_picker_category"
+        android:title="@string/lock_settings_picker_title">
+
+        <PreferenceScreen
+            android:key="unlock_set_none"
+            android:title="@string/unlock_set_unlock_none_title"
+            android:summary="@string/unlock_set_unlock_none_summary"
+            android:persistent="false"/>
+
+        <PreferenceScreen
+            android:key="unlock_set_pattern"
+            android:title="@string/unlock_set_unlock_pattern_title"
+            android:summary="@string/unlock_set_unlock_pattern_summary"
+            android:persistent="false"/>
+
+        <PreferenceScreen
+            android:key="unlock_set_pin"
+            android:title="@string/unlock_set_unlock_pin_title"
+            android:summary="@string/unlock_set_unlock_pin_summary"
+            android:persistent="false"/>
+
+        <PreferenceScreen
+            android:key="unlock_set_password"
+            android:title="@string/unlock_set_unlock_password_title"
+            android:summary="@string/unlock_set_unlock_password_summary"
+            android:persistent="false"/>
+
+    </PreferenceCategory>
+
+</PreferenceScreen>
diff --git a/res/xml/security_settings_pin.xml b/res/xml/security_settings_pin.xml
index fb77714..ac06711 100644
--- a/res/xml/security_settings_pin.xml
+++ b/res/xml/security_settings_pin.xml
@@ -21,14 +21,9 @@
         android:title="@string/lock_settings_title">
 
         <PreferenceScreen
-            android:key="unlock_method_disable"
-            android:title="@string/unlock_disable_lock_title"
-            android:summary="@string/unlock_disable_lock_pin_summary"
-            android:persistent="false"/>
-
-        <PreferenceScreen
-            android:key="unlock_method_change_current"
-            android:title="@string/unlock_change_lock_pin_title"
+            android:key="unlock_set_or_change"
+            android:title="@string/unlock_set_unlock_launch_picker_change_title"
+            android:summary="@string/unlock_set_unlock_launch_picker_change_summary"
             android:persistent="false"/>
 
         <CheckBoxPreference