Reworks lock screen flows.
This also adds frp warning dialogs in case the user skips lock
screen setup initially.
bug:26880444
Change-Id: I732b6a806e139fb6c1c1b334b8d1608c229f217c
diff --git a/proguard.flags b/proguard.flags
index 448cd72..2b5d4fa 100644
--- a/proguard.flags
+++ b/proguard.flags
@@ -22,3 +22,7 @@
-keepclassmembers class com.android.settings.inputmethod.UserDictionaryAddWordActivity {
*** onClick*(...);
}
+
+-keep public class * extends com.android.setupwizardlib.items.ItemHierarchy {
+ public <init>(android.content.Context, android.util.AttributeSet);
+}
\ No newline at end of file
diff --git a/res/drawable/ic_fingerprint.xml b/res/drawable/ic_fingerprint.xml
index 2f27753..03bc034 100644
--- a/res/drawable/ic_fingerprint.xml
+++ b/res/drawable/ic_fingerprint.xml
@@ -1,18 +1,19 @@
<!--
- ~ Copyright (C) 2015 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
- -->
+ Copyright (C) 2015 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
+-->
+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="32dp"
android:height="32dp"
diff --git a/res/drawable/ic_fingerprint_list_icon.xml b/res/drawable/ic_fingerprint_list_icon.xml
new file mode 100644
index 0000000..ce1ce5e
--- /dev/null
+++ b/res/drawable/ic_fingerprint_list_icon.xml
@@ -0,0 +1,24 @@
+<!--
+ Copyright (C) 2016 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
+ -->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0">
+ <path
+ android:fillColor="?attr/suwListItemIconColor"
+ android:pathData="M17.81,4.47c-0.08,0 -0.16,-0.02 -0.23,-0.06C15.66,3.42 14,3 12.01,3c-1.98,0 -3.86,0.47 -5.57,1.41 -0.24,0.13 -0.54,0.04 -0.68,-0.2 -0.13,-0.24 -0.04,-0.55 0.2,-0.68C7.82,2.52 9.86,2 12.01,2c2.13,0 3.99,0.47 6.03,1.52 0.25,0.13 0.34,0.43 0.21,0.67 -0.09,0.18 -0.26,0.28 -0.44,0.28zM3.5,9.72c-0.1,0 -0.2,-0.03 -0.29,-0.09 -0.23,-0.16 -0.28,-0.47 -0.12,-0.7 0.99,-1.4 2.25,-2.5 3.75,-3.27C9.98,4.04 14,4.03 17.15,5.65c1.5,0.77 2.76,1.86 3.75,3.25 0.16,0.22 0.11,0.54 -0.12,0.7 -0.23,0.16 -0.54,0.11 -0.7,-0.12 -0.9,-1.26 -2.04,-2.25 -3.39,-2.94 -2.87,-1.47 -6.54,-1.47 -9.4,0.01 -1.36,0.7 -2.5,1.7 -3.4,2.96 -0.08,0.14 -0.23,0.21 -0.39,0.21zM9.75,21.79c-0.13,0 -0.26,-0.05 -0.35,-0.15 -0.87,-0.87 -1.34,-1.43 -2.01,-2.64 -0.69,-1.23 -1.05,-2.73 -1.05,-4.34 0,-2.97 2.54,-5.39 5.66,-5.39s5.66,2.42 5.66,5.39c0,0.28 -0.22,0.5 -0.5,0.5s-0.5,-0.22 -0.5,-0.5c0,-2.42 -2.09,-4.39 -4.66,-4.39 -2.57,0 -4.66,1.97 -4.66,4.39 0,1.44 0.32,2.77 0.93,3.85 0.64,1.15 1.08,1.64 1.85,2.42 0.19,0.2 0.19,0.51 0,0.71 -0.11,0.1 -0.24,0.15 -0.37,0.15zM16.92,19.94c-1.19,0 -2.24,-0.3 -3.1,-0.89 -1.49,-1.01 -2.38,-2.65 -2.38,-4.39 0,-0.28 0.22,-0.5 0.5,-0.5s0.5,0.22 0.5,0.5c0,1.41 0.72,2.74 1.94,3.56 0.71,0.48 1.54,0.71 2.54,0.71 0.24,0 0.64,-0.03 1.04,-0.1 0.27,-0.05 0.53,0.13 0.58,0.41 0.05,0.27 -0.13,0.53 -0.41,0.58 -0.57,0.11 -1.07,0.12 -1.21,0.12zM14.91,22c-0.04,0 -0.09,-0.01 -0.13,-0.02 -1.59,-0.44 -2.63,-1.03 -3.72,-2.1 -1.4,-1.39 -2.17,-3.24 -2.17,-5.22 0,-1.62 1.38,-2.94 3.08,-2.94 1.7,0 3.08,1.32 3.08,2.94 0,1.07 0.93,1.94 2.08,1.94s2.08,-0.87 2.08,-1.94c0,-3.77 -3.25,-6.83 -7.25,-6.83 -2.84,0 -5.44,1.58 -6.61,4.03 -0.39,0.81 -0.59,1.76 -0.59,2.8 0,0.78 0.07,2.01 0.67,3.61 0.1,0.26 -0.03,0.55 -0.29,0.64 -0.26,0.1 -0.55,-0.04 -0.64,-0.29 -0.49,-1.31 -0.73,-2.61 -0.73,-3.96 0,-1.2 0.23,-2.29 0.68,-3.24 1.33,-2.79 4.28,-4.6 7.51,-4.6 4.55,0 8.25,3.51 8.25,7.83 0,1.62 -1.38,2.94 -3.08,2.94s-3.08,-1.32 -3.08,-2.94c0,-1.07 -0.93,-1.94 -2.08,-1.94s-2.08,0.87 -2.08,1.94c0,1.71 0.66,3.31 1.87,4.51 0.95,0.94 1.86,1.46 3.27,1.85 0.27,0.07 0.42,0.35 0.35,0.61 -0.05,0.23 -0.26,0.38 -0.47,0.38z"/>
+</vector>
diff --git a/res/drawable/ic_skip.xml b/res/drawable/ic_skip.xml
new file mode 100644
index 0000000..4376215
--- /dev/null
+++ b/res/drawable/ic_skip.xml
@@ -0,0 +1,26 @@
+<!--
+ Copyright (C) 2016 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
+-->
+
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24"
+ android:viewportHeight="24"
+ android:autoMirrored="true">
+ <path
+ android:fillColor="?attr/suwListItemIconColor"
+ android:pathData="M18.4,10.6C16.55,8.99 14.15,8 11.5,8c-4.65,0 -8.58,3.03 -9.96,7.22L3.9,16c1.05,-3.19 4.05,-5.5 7.6,-5.5 1.95,0 3.73,0.72 5.12,1.88L13,16h9V7l-3.6,3.6z"/>
+</vector>
diff --git a/res/layout/fingerprint_enroll_introduction.xml b/res/layout/fingerprint_enroll_introduction.xml
index b05abd8..ee2a95f 100644
--- a/res/layout/fingerprint_enroll_introduction.xml
+++ b/res/layout/fingerprint_enroll_introduction.xml
@@ -1,89 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
- ~ Copyright (C) 2015 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
- -->
+ Copyright (C) 2015 The Android Open Source Project
-<com.android.setupwizardlib.SetupWizardLayout
+ 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
+-->
+
+<com.android.setupwizardlib.SetupWizardItemsLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/setup_wizard_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
- style="?attr/fingerprint_layout_theme">
-
- <LinearLayout
- style="@style/SuwContentFrame"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical"
- android:clipToPadding="false"
- android:clipChildren="false">
-
- <TextView
- style="@style/TextAppearance.FingerprintMessage"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="@dimen/suw_description_margin_top"
- android:text="@string/security_settings_fingerprint_enroll_introduction_message"/>
-
- <TextView
- style="@style/TextAppearance.FingerprintMessage"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="24dp"
- android:text="@string/security_settings_fingerprint_enroll_introduction_message_warning"/>
-
- <TextView
- style="@style/TextAppearance.FingerprintLink"
- android:id="@+id/learn_more_button"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginTop="4dp"
- android:text="@string/security_settings_fingerprint_enroll_introduction_risk_link_text"/>
-
- <View
- android:layout_height="0dp"
- android:layout_width="match_parent"
- android:layout_weight="1"/>
-
- <LinearLayout
- android:id="@+id/button_bar"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginEnd="-12dp"
- android:layout_marginBottom="4dp"
- android:layout_gravity="end"
- android:orientation="horizontal">
-
- <Button
- style="@style/Button.FingerprintButton"
- android:id="@+id/cancel_button"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginEnd="8dp"
- android:text="@string/security_settings_fingerprint_enroll_introduction_cancel" />
-
- <Button
- style="@style/Button.FingerprintButton"
- android:id="@+id/next_button"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:gravity="end|center_vertical"
- android:text="@string/security_settings_fingerprint_enroll_introduction_continue" />
-
- </LinearLayout>
-
- </LinearLayout>
-
-</com.android.setupwizardlib.SetupWizardLayout>
+ android:entries="@xml/fingerprint_enroll_introduction_items"
+ style="?attr/fingerprint_layout_theme" />
diff --git a/res/layout/setup_choose_lock_generic_fingerprint_header.xml b/res/layout/setup_choose_lock_generic_fingerprint_header.xml
new file mode 100644
index 0000000..d4e5af7
--- /dev/null
+++ b/res/layout/setup_choose_lock_generic_fingerprint_header.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2016 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.
+-->
+
+<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center_vertical"
+ android:minHeight="56dp"
+ android:paddingBottom="@dimen/suw_description_margin_bottom"
+ android:paddingStart="?android:attr/listPreferredItemPaddingStart"
+ android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
+ android:paddingTop="@dimen/suw_description_margin_top"
+ android:text="@string/setup_lock_settings_picker_fingerprint_message"
+ android:lineSpacingExtra="@dimen/suw_description_line_spacing_extra"
+ android:textAppearance="?android:attr/textAppearanceListItem" />
diff --git a/res/layout/setup_choose_lock_generic_header.xml b/res/layout/setup_choose_lock_generic_header.xml
new file mode 100644
index 0000000..074f816
--- /dev/null
+++ b/res/layout/setup_choose_lock_generic_header.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2016 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.
+-->
+
+<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center_vertical"
+ android:minHeight="56dp"
+ android:paddingBottom="@dimen/suw_description_margin_bottom"
+ android:paddingStart="?android:attr/listPreferredItemPaddingStart"
+ android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
+ android:paddingTop="@dimen/suw_description_margin_top"
+ android:text="@string/setup_lock_settings_picker_message"
+ android:lineSpacingExtra="@dimen/suw_description_line_spacing_extra"
+ android:textAppearance="?android:attr/textAppearanceListItem" />
diff --git a/res/layout/setup_fingerprint_enroll_find_sensor_base.xml b/res/layout/setup_fingerprint_enroll_find_sensor_base.xml
index 9bb216b..184d6b9 100644
--- a/res/layout/setup_fingerprint_enroll_find_sensor_base.xml
+++ b/res/layout/setup_fingerprint_enroll_find_sensor_base.xml
@@ -1,18 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
- ~ Copyright (C) 2015 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
+ Copyright (C) 2015 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
-->
<com.android.setupwizardlib.SetupWizardLayout
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 5d093f1..0d76780 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -739,13 +739,27 @@
<!-- Introduction detail message shown in fingerprint enrollment dialog [CHAR LIMIT=NONE]-->
<string name="security_settings_fingerprint_enroll_introduction_message">Just touch the fingerprint sensor to unlock your phone, authorize purchases, or sign in to apps. \n\n Be careful whose fingerprints you add - any fingerprints added will be able to do these things.</string>
<!-- Introduction detail message shown in fingerprint enrollment dialog to warn the user [CHAR LIMIT=NONE]-->
- <string name="security_settings_fingerprint_enroll_introduction_message_warning">Note: Your fingerprint may be less secure than a strong pattern or PIN.</string>
- <!-- Link text shown bellow the warning to learn morn about fingerprint risk [CHAR LIMIT=22]-->
- <string name="security_settings_fingerprint_enroll_introduction_risk_link_text">Learn more</string>
+ <string name="security_settings_fingerprint_enroll_introduction_message_warning">Note: Your fingerprint may be less secure than a strong pattern or PIN. <annotation id="url">Learn more</annotation></string>
<!-- Button text to cancel enrollment from the introduction [CHAR LIMIT=22] -->
<string name="security_settings_fingerprint_enroll_introduction_cancel">Cancel</string>
<!-- Button text to continue to the next screen from the introduction [CHAR LIMIT=22] -->
<string name="security_settings_fingerprint_enroll_introduction_continue">Continue</string>
+ <!-- Dialog text shown when the user tries to skip setting up a screen lock, warning them of potential consequences of not doing so, including loss of factory reset protection. (tablet) [CHAR LIMIT=NONE] -->
+ <string name="lock_screen_intro_skip_dialog_text_frp" product="tablet">Device protection features will not be activated. You won\u2019t be able to prevent others from using this tablet if it\u2019s lost, stolen or wiped.</string>
+ <!-- Dialog text shown when the user tries to skip setting up a screen lock, warning them of potential consequences of not doing so, including loss of factory reset protection. (device) [CHAR LIMIT=NONE] -->
+ <string name="lock_screen_intro_skip_dialog_text_frp" product="device">Device protection features will not be activated. You won\u2019t be able to prevent others from using this device if it\u2019s lost, stolen or wiped.</string>
+ <!-- Dialog text shown when the user tries to skip setting up a screen lock, warning them of potential consequences of not doing so, including loss of factory reset protection. (phone) [CHAR LIMIT=NONE] -->
+ <string name="lock_screen_intro_skip_dialog_text_frp" product="default">Device protection features will not be activated. You won\u2019t be able to prevent others from using this phone if it\u2019s lost, stolen or wiped.</string>
+ <!-- Dialog text shown when the user tries to skip setting up a screen lock, warning them of potential consequences of not doing so. (tablet) [CHAR LIMIT=NONE] -->
+ <string name="lock_screen_intro_skip_dialog_text" product="tablet">Device protection features will not be activated. You won\u2019t be able to prevent others from using this tablet if it\u2019s lost or stolen.</string>
+ <!-- Dialog text shown when the user tries to skip setting up a screen lock, warning them of potential consequences of not doing so. (device) [CHAR LIMIT=NONE] -->
+ <string name="lock_screen_intro_skip_dialog_text" product="device">Device protection features will not be activated. You won\u2019t be able to prevent others from using this device if it\u2019s lost or stolen.</string>
+ <!-- Dialog text shown when the user tries to skip setting up a screen lock, warning them of potential consequences of not doing so. (phone) [CHAR LIMIT=NONE] -->
+ <string name="lock_screen_intro_skip_dialog_text" product="default">Device protection features will not be activated. You won\u2019t be able to prevent others from using this phone if it\u2019s lost or stolen.</string>
+ <!-- Button for skipping a step after having been warned of a potential concern [CHAR LIMIT=30] -->
+ <string name="skip_anyway_button_label">Skip anyway</string>
+ <!-- Button for going to the previous screen or step [CHAR LIMIT=20] -->
+ <string name="go_back_button_label">Go back</string>
<!-- Introduction title shown in fingerprint enrollment dialog to locate the sensor [CHAR LIMIT=29] -->
<string name="security_settings_fingerprint_enroll_find_sensor_title">Find the sensor</string>
<!-- Message shown in fingerprint enrollment dialog to locate the sensor -->
@@ -972,8 +986,18 @@
<!-- Title for security picker to choose the unlock method: None/Pattern/PIN/Password [CHAR LIMIT=22] -->
<string name="lock_settings_picker_title">Choose screen lock</string>
- <!-- Title for screen in setup wizard, prompting user to choose the unlock method: None/Pattern/PIN/Password [CHAR LIMIT=40] -->
- <string name="setup_lock_settings_picker_title">Choose screen lock</string>
+ <!-- Title for security picker in setup wizard to choose the unlock method: None/Pattern/PIN/Password [CHAR LIMIT=22] -->
+ <string name="setup_lock_settings_picker_title">Protect your phone</string>
+
+ <!-- Title for screen in setup wizard, prompting user to choose the their backup screen lock method [CHAR LIMIT=NONE] -->
+ <string name="setup_lock_settings_picker_fingerprint_message">Fingerprint may be less secure than a strong pattern, PIN or password. Set up a backup lock screen to be secure.</string>
+
+ <!-- Description text for screen in setup wizard asking user to set up screen lock, explaining to the user how setting up a screen lock protect them from losing data. (tablet) [CHAR LIMIT=NONE] -->
+ <string name="setup_lock_settings_picker_message" product="tablet">Prevent others from using this tablet without your permission by activating device protection features. Choose the screen lock you want to use.</string>
+ <!-- Description text for screen in setup wizard asking user to set up screen lock, explaining to the user how setting up a screen lock protect them from losing data. (device) [CHAR LIMIT=NONE] -->
+ <string name="setup_lock_settings_picker_message" product="device">Prevent others from using this device without your permission by activating device protection features. Choose the screen lock you want to use.</string>
+ <!-- Description text for screen in setup wizard asking user to set up screen lock, explaining to the user how setting up a screen lock protect them from losing data. (phone) [CHAR LIMIT=NONE] -->
+ <string name="setup_lock_settings_picker_message" product="default">Prevent others from using this phone without your permission by activating device protection features. Choose the screen lock you want to use.</string>
<!-- Message shown in screen lock picker while setting up the backup/fallback screen lock method for fingerprint. Users can choose to use this method to unlock the screen instead of fingerprint, or when fingerprint is not accepted. [CHAR LIMIT=80] [BACKUP_MESSAGE_ID=2799884038398627882] -->
<string name="lock_settings_picker_fingerprint_message">Choose your backup screen lock method</string>
@@ -1016,6 +1040,9 @@
<!-- Title for preference that guides the user through creating an unlock password [CHAR LIMIT=45] -->
<string name="unlock_set_unlock_password_summary">High security</string>
+ <!-- Title for preference that allows the user to setup their lock screen preference later [CHAR LIMIT=22] -->
+ <string name="unlock_set_do_later_title">Not now</string>
+
<!-- Summary specifying that this is the current screen lock setting [CHAR LIMIT=45] -->
<string name="current_screen_lock">Current screen lock</string>
diff --git a/res/values/themes.xml b/res/values/themes.xml
index ae7149c..5bab837 100644
--- a/res/values/themes.xml
+++ b/res/values/themes.xml
@@ -283,8 +283,13 @@
</style>
<style name="Theme.FingerprintEnroll" parent="@*android:style/Theme.Material.Settings.NoActionBar">
+ <item name="android:listPreferredItemHeight">@dimen/suw_items_preferred_height</item>
+ <item name="android:listPreferredItemPaddingEnd">@dimen/suw_layout_margin_sides</item>
+ <item name="android:listPreferredItemPaddingStart">@dimen/suw_layout_margin_sides</item>
+ <item name="android:textAppearanceListItemSmall">@android:style/TextAppearance.Material.Body1</item>
<item name="android:windowAnimationStyle">@style/Animation.SuwWindowAnimation</item>
+ <item name="suwListItemIconColor">?android:attr/colorAccent</item>
<item name="suwMarginSides">@dimen/suw_layout_margin_sides</item>
</style>
diff --git a/res/xml/fingerprint_enroll_introduction_items.xml b/res/xml/fingerprint_enroll_introduction_items.xml
new file mode 100644
index 0000000..3368843
--- /dev/null
+++ b/res/xml/fingerprint_enroll_introduction_items.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2016 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.
+-->
+
+<ItemGroup xmlns:android="http://schemas.android.com/apk/res/android">
+
+ <Item
+ android:enabled="false"
+ android:layout="@layout/suw_items_description"
+ android:title="@string/security_settings_fingerprint_enroll_introduction_message" />
+
+ <Item
+ android:enabled="false"
+ android:id="@+id/fingerprint_introduction_message_warning"
+ android:layout="@layout/suw_items_description" />
+
+ <Item
+ android:id="@+id/next_button"
+ android:icon="@drawable/ic_fingerprint_list_icon"
+ android:title="@string/security_settings_fingerprint_enroll_introduction_continue" />
+
+ <Item
+ android:id="@+id/cancel_button"
+ android:icon="@drawable/ic_skip"
+ android:title="@string/security_settings_fingerprint_enroll_introduction_cancel" />
+
+</ItemGroup>
\ No newline at end of file
diff --git a/res/xml/setup_security_settings_picker.xml b/res/xml/setup_security_settings_picker.xml
new file mode 100644
index 0000000..6441b03
--- /dev/null
+++ b/res/xml/setup_security_settings_picker.xml
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2016 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"
+ android:title="@string/lock_settings_picker_title"
+ android:key="lock_settings_picker">
+
+ <com.android.settingslib.RestrictedPreference
+ android:key="unlock_set_off"
+ android:title="@string/unlock_set_unlock_off_title"
+ android:persistent="false"/>
+
+ <com.android.settingslib.RestrictedPreference
+ android:key="unlock_set_none"
+ android:title="@string/unlock_set_unlock_none_title"
+ android:persistent="false"/>
+
+ <com.android.settingslib.RestrictedPreference
+ android:key="unlock_set_pattern"
+ android:title="@string/unlock_set_unlock_pattern_title"
+ android:persistent="false"/>
+
+ <com.android.settingslib.RestrictedPreference
+ android:key="unlock_set_pin"
+ android:title="@string/unlock_set_unlock_pin_title"
+ android:persistent="false"/>
+
+ <com.android.settingslib.RestrictedPreference
+ android:key="unlock_set_password"
+ android:title="@string/unlock_set_unlock_password_title"
+ android:persistent="false"/>
+
+ <com.android.settingslib.RestrictedPreference
+ android:key="unlock_set_do_later"
+ android:title="@string/unlock_set_do_later_title"
+ android:persistent="false"/>
+
+</PreferenceScreen>
diff --git a/src/com/android/settings/ChooseLockGeneric.java b/src/com/android/settings/ChooseLockGeneric.java
index c0027d5..2592e83 100644
--- a/src/com/android/settings/ChooseLockGeneric.java
+++ b/src/com/android/settings/ChooseLockGeneric.java
@@ -104,7 +104,6 @@
private int mEncryptionRequestQuality;
private boolean mEncryptionRequestDisabled;
private boolean mRequirePassword;
- private boolean mForFingerprint = false;
private boolean mForChangeCredRequiredForBoot = false;
private String mUserPassword;
private LockPatternUtils mLockPatternUtils;
@@ -130,6 +129,8 @@
}
};
+ protected boolean mForFingerprint = false;
+
@Override
protected int getMetricsCategory() {
return MetricsEvent.CHOOSE_LOCK_GENERIC;
@@ -204,6 +205,10 @@
mWaitingForConfirmation = true;
}
}
+ addHeaderView();
+ }
+
+ protected void addHeaderView() {
if (mForFingerprint) {
setHeaderView(R.layout.choose_lock_generic_fingerprint_header);
}
@@ -323,7 +328,7 @@
if (prefScreen != null) {
prefScreen.removeAll();
}
- addPreferencesFromResource(R.xml.security_settings_picker);
+ addPreferences();
disableUnusablePreferences(quality, hideDisabledPrefs);
updatePreferenceText();
updateCurrentPreference();
@@ -333,6 +338,10 @@
}
}
+ protected void addPreferences() {
+ addPreferencesFromResource(R.xml.security_settings_picker);
+ }
+
private void updatePreferenceText() {
if (mForFingerprint) {
Preference pattern = findPreference(KEY_UNLOCK_SET_PATTERN);
diff --git a/src/com/android/settings/SetupChooseLockGeneric.java b/src/com/android/settings/SetupChooseLockGeneric.java
index 9559f8d..f1fbfc9 100644
--- a/src/com/android/settings/SetupChooseLockGeneric.java
+++ b/src/com/android/settings/SetupChooseLockGeneric.java
@@ -23,10 +23,13 @@
import android.content.res.Resources;
import android.os.Bundle;
import android.os.UserHandle;
+import android.support.v7.preference.Preference;
import android.support.v14.preference.PreferenceFragment;
import android.view.View;
+import android.widget.Button;
import com.android.internal.widget.LockPatternUtils;
+import com.android.settings.fingerprint.SetupSkipDialog;
import com.android.setupwizardlib.SetupWizardLayout;
import com.android.setupwizardlib.view.NavigationBar;
@@ -39,6 +42,8 @@
*/
public class SetupChooseLockGeneric extends ChooseLockGeneric {
+ private static final String KEY_UNLOCK_SET_DO_LATER = "unlock_set_do_later";
+
@Override
protected boolean isValidFragment(String fragmentName) {
return SetupChooseLockGenericFragment.class.getName().equals(fragmentName);
@@ -58,7 +63,7 @@
public static class SetupChooseLockGenericFragment extends ChooseLockGenericFragment
implements NavigationBar.NavigationBarListener {
- private static final String EXTRA_PASSWORD_QUALITY = ":settings:password_quality";
+ public static final String EXTRA_PASSWORD_QUALITY = ":settings:password_quality";
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
@@ -68,12 +73,28 @@
SetupWizardLayout layout = (SetupWizardLayout) view;
final NavigationBar navigationBar = layout.getNavigationBar();
- navigationBar.getNextButton().setEnabled(false);
+ Button nextButton = navigationBar.getNextButton();
+ nextButton.setText(null);
+ nextButton.setEnabled(false);
navigationBar.setNavigationBarListener(this);
layout.setIllustration(R.drawable.setup_illustration_lock_screen,
R.drawable.setup_illustration_horizontal_tile);
- layout.setHeaderText(R.string.setup_lock_settings_picker_title);
+ if (!mForFingerprint) {
+ layout.setHeaderText(R.string.setup_lock_settings_picker_title);
+ } else {
+ layout.setHeaderText(R.string.lock_settings_picker_title);
+ }
+
+ }
+
+ @Override
+ protected void addHeaderView() {
+ if (mForFingerprint) {
+ setHeaderView(R.layout.setup_choose_lock_generic_fingerprint_header);
+ } else {
+ setHeaderView(R.layout.setup_choose_lock_generic_header);
+ }
}
@Override
@@ -113,6 +134,28 @@
}
@Override
+ protected void addPreferences() {
+ if (mForFingerprint) {
+ super.addPreferences();
+ } else {
+ addPreferencesFromResource(R.xml.setup_security_settings_picker);
+ }
+ }
+
+ @Override
+ public boolean onPreferenceTreeClick(Preference preference) {
+ final String key = preference.getKey();
+ if (KEY_UNLOCK_SET_DO_LATER.equals(key)) {
+ // show warning.
+ SetupSkipDialog dialog = SetupSkipDialog.newInstance(getActivity().getIntent()
+ .getBooleanExtra(SetupSkipDialog.EXTRA_FRP_SUPPORTED, false));
+ dialog.show(getFragmentManager());
+ return true;
+ }
+ return super.onPreferenceTreeClick(preference);
+ }
+
+ @Override
protected Intent getLockPasswordIntent(Context context, int quality,
int minLength, final int maxLength,
boolean requirePasswordToDecrypt, boolean confirmCredentials, int userId) {
diff --git a/src/com/android/settings/fingerprint/FingerprintEnrollIntroduction.java b/src/com/android/settings/fingerprint/FingerprintEnrollIntroduction.java
index 83d936f..7144745 100644
--- a/src/com/android/settings/fingerprint/FingerprintEnrollIntroduction.java
+++ b/src/com/android/settings/fingerprint/FingerprintEnrollIntroduction.java
@@ -16,26 +16,43 @@
package com.android.settings.fingerprint;
+import android.app.Activity;
import android.app.admin.DevicePolicyManager;
+import android.content.ActivityNotFoundException;
+import android.content.Context;
import android.content.Intent;
import android.hardware.fingerprint.FingerprintManager;
+import android.graphics.Typeface;
+import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.UserHandle;
+import android.text.Annotation;
+import android.text.SpannableString;
+import android.text.SpannableStringBuilder;
+import android.text.TextPaint;
+import android.text.method.LinkMovementMethod;
+import android.text.style.URLSpan;
+import android.util.Log;
import android.view.View;
+import android.widget.AdapterView;
import com.android.internal.logging.MetricsProto.MetricsEvent;
import com.android.settings.ChooseLockGeneric;
import com.android.settings.ChooseLockSettingsHelper;
import com.android.settings.HelpUtils;
import com.android.settings.R;
+import com.android.setupwizardlib.SetupWizardItemsLayout;
+import com.android.setupwizardlib.items.Item;
+import com.android.setupwizardlib.items.ItemAdapter;
/**
* Onboarding activity for fingerprint enrollment.
*/
-public class FingerprintEnrollIntroduction extends FingerprintEnrollBase {
+public class FingerprintEnrollIntroduction extends FingerprintEnrollBase
+ implements AdapterView.OnItemClickListener {
- private static final int CHOOSE_LOCK_GENERIC_REQUEST = 1;
- private static final int FINGERPRINT_FIND_SENSOR_REQUEST = 2;
+ protected static final int CHOOSE_LOCK_GENERIC_REQUEST = 1;
+ protected static final int FINGERPRINT_FIND_SENSOR_REQUEST = 2;
private boolean mHasPassword;
@@ -44,8 +61,14 @@
super.onCreate(savedInstanceState);
setContentView(R.layout.fingerprint_enroll_introduction);
setHeaderText(R.string.security_settings_fingerprint_enroll_introduction_title);
- findViewById(R.id.cancel_button).setOnClickListener(this);
- findViewById(R.id.learn_more_button).setOnClickListener(this);
+ final SetupWizardItemsLayout layout =
+ (SetupWizardItemsLayout) findViewById(R.id.setup_wizard_layout);
+ layout.getListView().setOnItemClickListener(this);
+ final ItemAdapter adapter = (ItemAdapter) layout.getAdapter();
+ Item item = (Item) adapter.findItemById(R.id.fingerprint_introduction_message_warning);
+ item.setTitle(LearnMoreSpan.linkify(
+ getText(R.string.security_settings_fingerprint_enroll_introduction_message_warning),
+ getString(R.string.help_url_fingerprint)));
updatePasswordQuality();
}
@@ -107,7 +130,7 @@
if (requestCode == FINGERPRINT_FIND_SENSOR_REQUEST) {
if (isResultFinished || resultCode == RESULT_SKIP) {
final int result = isResultFinished ? RESULT_OK : RESULT_SKIP;
- setResult(result);
+ setResult(result, data);
finish();
return;
}
@@ -124,24 +147,66 @@
}
@Override
- public void onClick(View v) {
- if (v.getId() == R.id.cancel_button) {
- finish();
+ public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
+ final Item item = (Item) parent.getItemAtPosition(position);
+ switch (item.getId()) {
+ case R.id.next_button:
+ onNextButtonClick();
+ break;
+ case R.id.cancel_button:
+ onCancelButtonClick();
+ break;
}
- if (v.getId() == R.id.learn_more_button) {
- launchFingerprintHelp();
- }
- super.onClick(v);
- }
-
- private void launchFingerprintHelp() {
- Intent helpIntent = HelpUtils.getHelpIntent(this,
- getString(R.string.help_url_fingerprint), getClass().getName());
- startActivity(helpIntent);
}
@Override
protected int getMetricsCategory() {
return MetricsEvent.FINGERPRINT_ENROLL_INTRO;
}
+
+ protected void onCancelButtonClick() {
+ finish();
+ }
+
+ private static class LearnMoreSpan extends URLSpan {
+ private static final String TAG = "LearnMoreSpan";
+ private static final Typeface TYPEFACE_MEDIUM =
+ Typeface.create("sans-serif-medium", Typeface.NORMAL);
+
+ private LearnMoreSpan(String url) {
+ super(url);
+ }
+
+ @Override
+ public void onClick(View widget) {
+ Context ctx = widget.getContext();
+ Intent intent = HelpUtils.getHelpIntent(ctx, getURL(), ctx.getClass().getName());
+ try {
+ ((Activity) ctx).startActivity(intent);
+ } catch (ActivityNotFoundException e) {
+ Log.w(LearnMoreSpan.TAG,
+ "Actvity was not found for intent, " + intent.toString());
+ }
+ }
+
+ @Override
+ public void updateDrawState(TextPaint ds) {
+ super.updateDrawState(ds);
+ ds.setUnderlineText(false);
+ ds.setTypeface(TYPEFACE_MEDIUM);
+ }
+
+ public static CharSequence linkify(CharSequence rawText, String uri) {
+ SpannableString msg = new SpannableString(rawText);
+ Annotation[] spans = msg.getSpans(0, msg.length(), Annotation.class);
+ SpannableStringBuilder builder = new SpannableStringBuilder(msg);
+ for (Annotation annotation : spans) {
+ int start = msg.getSpanStart(annotation);
+ int end = msg.getSpanEnd(annotation);
+ LearnMoreSpan link = new LearnMoreSpan(uri);
+ builder.setSpan(link, start, end, msg.getSpanFlags(link));
+ }
+ return builder;
+ }
+ }
}
diff --git a/src/com/android/settings/fingerprint/SetupFingerprintEnrollIntroduction.java b/src/com/android/settings/fingerprint/SetupFingerprintEnrollIntroduction.java
index ec6d3cf..0c142b6 100644
--- a/src/com/android/settings/fingerprint/SetupFingerprintEnrollIntroduction.java
+++ b/src/com/android/settings/fingerprint/SetupFingerprintEnrollIntroduction.java
@@ -18,10 +18,13 @@
import android.content.Intent;
import android.content.res.Resources;
+import android.os.UserHandle;
+import android.support.v14.preference.PreferenceFragment;
import android.view.View;
import android.widget.Button;
import com.android.internal.logging.MetricsProto.MetricsEvent;
+import com.android.internal.widget.LockPatternUtils;
import com.android.settings.R;
import com.android.settings.SetupChooseLockGeneric;
import com.android.settings.SetupWizardUtils;
@@ -53,18 +56,31 @@
@Override
protected void initViews() {
SetupWizardUtils.setImmersiveMode(this);
-
- final View buttonBar = findViewById(R.id.button_bar);
- if (buttonBar != null) {
- buttonBar.setVisibility(View.GONE);
- }
-
getNavigationBar().setNavigationBarListener(this);
+ Button nextButton = getNavigationBar().getNextButton();
+ nextButton.setText(null);
+ nextButton.setEnabled(false);
}
@Override
- protected Button getNextButton() {
- return getNavigationBar().getNextButton();
+ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+ if (requestCode == FINGERPRINT_FIND_SENSOR_REQUEST) {
+ if (data == null) {
+ data = new Intent();
+ }
+ LockPatternUtils lockPatternUtils = new LockPatternUtils(this);
+ data.putExtra(SetupChooseLockGeneric.
+ SetupChooseLockGenericFragment.EXTRA_PASSWORD_QUALITY,
+ lockPatternUtils.getKeyguardStoredPasswordQuality(UserHandle.myUserId()));
+ }
+ super.onActivityResult(requestCode, resultCode, data);
+ }
+
+ @Override
+ protected void onCancelButtonClick() {
+ SetupSkipDialog dialog = SetupSkipDialog.newInstance(
+ getIntent().getBooleanExtra(SetupSkipDialog.EXTRA_FRP_SUPPORTED, false));
+ dialog.show(getFragmentManager());
}
@Override
@@ -74,7 +90,7 @@
@Override
public void onNavigateNext() {
- onNextButtonClick();
+ // next is handled via the onNextButtonClick method in FingerprintEnrollIntroduction
}
@Override
diff --git a/src/com/android/settings/fingerprint/SetupSkipDialog.java b/src/com/android/settings/fingerprint/SetupSkipDialog.java
new file mode 100644
index 0000000..11e6936
--- /dev/null
+++ b/src/com/android/settings/fingerprint/SetupSkipDialog.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2016 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
+ */
+
+package com.android.settings.fingerprint;
+
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.app.DialogFragment;
+import android.app.FragmentManager;
+import android.content.DialogInterface;
+import android.os.Build.VERSION;
+import android.os.Build.VERSION_CODES;
+import android.os.Bundle;
+import android.os.Handler;
+import android.support.annotation.NonNull;
+import android.view.View;
+import android.view.Window;
+import android.view.WindowManager;
+
+import com.android.settings.R;
+import com.android.setupwizardlib.util.SystemBarHelper;
+
+public class SetupSkipDialog extends DialogFragment implements DialogInterface.OnClickListener {
+
+ public static final String EXTRA_FRP_SUPPORTED = ":settings:frp_supported";
+
+ private static final String ARG_FRP_SUPPORTED = "frp_supported";
+ private static final String TAG_SKIP_DIALOG = "skip_dialog";
+ private static final int RESULT_SKIP = Activity.RESULT_FIRST_USER + 10;
+
+ public static SetupSkipDialog newInstance(boolean isFrpSupported) {
+ SetupSkipDialog dialog = new SetupSkipDialog();
+ Bundle args = new Bundle();
+ args.putBoolean(ARG_FRP_SUPPORTED, isFrpSupported);
+ dialog.setArguments(args);
+ return dialog;
+ }
+
+ @Override
+ public Dialog onCreateDialog(Bundle savedInstanceState) {
+ final AlertDialog dialog = onCreateDialogBuilder().create();
+ // hide system status bar.
+ SystemBarHelper.hideSystemBars(dialog);
+ return dialog;
+ }
+
+ @NonNull
+ public AlertDialog.Builder onCreateDialogBuilder() {
+ Bundle args = getArguments();
+ return new AlertDialog.Builder(getContext())
+ .setPositiveButton(R.string.skip_anyway_button_label, this)
+ .setNegativeButton(R.string.go_back_button_label, this)
+ .setMessage(args.getBoolean(ARG_FRP_SUPPORTED) ?
+ R.string.lock_screen_intro_skip_dialog_text_frp :
+ R.string.lock_screen_intro_skip_dialog_text);
+ }
+
+ @Override
+ public void onClick(DialogInterface dialog, int button) {
+ switch (button) {
+ case DialogInterface.BUTTON_POSITIVE:
+ Activity activity = getActivity();
+ activity.setResult(RESULT_SKIP);
+ activity.finish();
+ break;
+ }
+ }
+
+ public void show(FragmentManager manager) {
+ show(manager, TAG_SKIP_DIALOG);
+ }
+}
\ No newline at end of file