Update fingerprint settings to spec
- Make it look like a sub settings activity, with back button
- Add disclaimer to describe what your fingerprint can be used for
- Update visuals and text for "Add fingerprint"
- Update related string
Bug: 20594955
Change-Id: I0adfcc743db386e0abf9cfdafff3d068ebc3b4bc
diff --git a/res/drawable/ic_add_24dp.xml b/res/drawable/ic_add_24dp.xml
new file mode 100644
index 0000000..6535107
--- /dev/null
+++ b/res/drawable/ic_add_24dp.xml
@@ -0,0 +1,24 @@
+<!--
+ ~ 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="24.0dp"
+ android:height="24.0dp"
+ android:viewportWidth="48.0"
+ android:viewportHeight="48.0">
+ <path
+ android:fillColor="?android:attr/colorAccent"
+ android:pathData="M38.0,26.0L26.0,26.0l0.0,12.0l-4.0,0.0L22.0,26.0L10.0,26.0l0.0,-4.0l12.0,0.0L22.0,10.0l4.0,0.0l0.0,12.0l12.0,0.0l0.0,4.0z"/>
+</vector>
diff --git a/res/layout/fingerprint_settings_footer.xml b/res/layout/fingerprint_settings_footer.xml
new file mode 100644
index 0000000..e3e3c08
--- /dev/null
+++ b/res/layout/fingerprint_settings_footer.xml
@@ -0,0 +1,27 @@
+<?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
+ -->
+<TextView
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ style="@android:style/TextAppearance.Material.Body1"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textColor="?android:attr/textColorSecondary"
+ android:paddingTop="32dp"
+ android:paddingStart="16dp"
+ android:paddingEnd="16dp"
+ android:selectable="false">
+</TextView>
\ No newline at end of file
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 9c553a4..3f5e9e9 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -740,7 +740,7 @@
<!-- Fingerprint category title - configuration options for managing fingerprint enrollment [CHAR LIMIT=22] -->
<string name="fingerprint_usage_category_title">Use fingerprint for</string>
<!-- Preference to add another fingerprint -->
- <string name="fingerprint_add_title">Add</string>
+ <string name="fingerprint_add_title">Add fingerprint</string>
<!-- switch for allowing fingerprint to be used for keyguard -->
<string name="fingerprint_enable_keyguard_toggle_title">screen lock</string>
<!-- message shown for menu item that launches fingerprint settings or enrollment -->
@@ -752,7 +752,7 @@
<string name="security_settings_fingerprint_enroll_onboard_title">Fingerprint setup</string>
<!-- Introduction message shown in fingerprint enrollment dialog when the user needs to choose an
alternate screen unlock (pin, pattern or password) as a backup to fingerprint. -->
- <string name="security_settings_fingerprint_enroll_onboard_message">To use your fingerprint to unlock your screen or confirm purchases, we\'ll need to:</string>
+ <string name="security_settings_fingerprint_enroll_onboard_message">To use your fingerprint to unlock your screen or confirm purchases, you\'ll need to:</string>
<!-- Introduction message shown in fingerprint enrollment dialog, first item to describe what
the user needs to do. -->
<string name="security_settings_fingerprint_enroll_onboard_message_1">Setup your backup screen lock method</string>
@@ -796,6 +796,10 @@
<string name="fingerprint_enroll_button_add">Add another</string>
<!-- Button text shown at the end of enrollment that allows the user to move to the next step -->
<string name="fingerprint_enroll_button_next">Next</string>
+ <!-- Text shown in fingerprint settings explaining what the fingerprint can be used for. [CHAR LIMIT=NONE] -->
+ <string name="security_settings_fingerprint_enroll_disclaimer">In addition to unlocking your phone, you can also use your fingerprint to authorize purchases and app access. <annotation id="url">Learn more</annotation></string>
+ <!-- Text shown in fingerprint settings explaining what the fingerprint can be used for in the case unlocking is disabled [CHAR LIMIT=NONE] -->
+ <string name="security_settings_fingerprint_enroll_disclaimer_lockscreen_disabled">Screen lock option disabled. You can still use your fingerprint to authorize purchases and app access. <annotation id="url">Learn more</annotation></string>
<!-- Title of the preferences category for preference items to control encryption -->
<string name="crypt_keeper_settings_title">Encryption</string>
@@ -5625,6 +5629,8 @@
<string name="help_url_nfc_payment" translatable="false"></string>
<!-- Help URL, Remote display [DO NOT TRANSLATE] -->
<string name="help_url_remote_display" translatable="false"></string>
+ <!-- Help URL, Fingerprint [DO NOT TRANSLATE] -->
+ <string name="help_url_fingerprint" translatable="false"></string>
<!-- User account title [CHAR LIMIT=30] -->
<string name="user_account_title">Account for content</string>
diff --git a/res/xml/security_settings_fingerprint.xml b/res/xml/security_settings_fingerprint.xml
index 7cc3a56..804ef88 100644
--- a/res/xml/security_settings_fingerprint.xml
+++ b/res/xml/security_settings_fingerprint.xml
@@ -14,25 +14,7 @@
limitations under the License.
-->
-<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
- android:title="@string/security_settings_fingerprint_preference_title">
-
- <PreferenceCategory
- android:key="fingerprint_manage_category"
- android:title="@string/fingerprint_manage_category_title">
- </PreferenceCategory>
-
- <PreferenceCategory
- android:key="fingerprint_usage_category"
- android:title="@string/fingerprint_usage_category_title">
-
- <SwitchPreference
- android:key="fingerprint_enable_keyguard_toggle"
- android:title="@string/fingerprint_enable_keyguard_toggle_title"
- android:persistent="false" />
-
- </PreferenceCategory>
-
-</PreferenceScreen>
+<PreferenceScreen
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:title="@string/security_settings_fingerprint_preference_title"/>
diff --git a/src/com/android/settings/HelpUtils.java b/src/com/android/settings/HelpUtils.java
index 36fb194..67e7b53 100644
--- a/src/com/android/settings/HelpUtils.java
+++ b/src/com/android/settings/HelpUtils.java
@@ -118,7 +118,7 @@
}
}
- private static Intent getHelpIntent(Context context, String helpUriString) {
+ public static Intent getHelpIntent(Context context, String helpUriString) {
// Try to handle as Intent Uri, otherwise just treat as Uri.
try {
return Intent.parseUri(helpUriString,
diff --git a/src/com/android/settings/SettingsActivity.java b/src/com/android/settings/SettingsActivity.java
index 502f164..fcbb512 100644
--- a/src/com/android/settings/SettingsActivity.java
+++ b/src/com/android/settings/SettingsActivity.java
@@ -557,7 +557,7 @@
// This is a "Sub Settings" when:
// - this is a real SubSettings
// - or :settings:show_fragment_as_subsetting is passed to the Intent
- final boolean isSubSettings = className.equals(SubSettings.class.getName()) ||
+ final boolean isSubSettings = this instanceof SubSettings ||
intent.getBooleanExtra(EXTRA_SHOW_FRAGMENT_AS_SUBSETTING, false);
// If this is a sub settings, then apply the SubSettings Theme for the ActionBar content insets
diff --git a/src/com/android/settings/fingerprint/FingerprintSettings.java b/src/com/android/settings/fingerprint/FingerprintSettings.java
index 85d3762..5a69147 100644
--- a/src/com/android/settings/fingerprint/FingerprintSettings.java
+++ b/src/com/android/settings/fingerprint/FingerprintSettings.java
@@ -17,13 +17,22 @@
package com.android.settings.fingerprint;
+import android.annotation.Nullable;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.admin.DevicePolicyManager;
+import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
+import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
+import android.hardware.fingerprint.Fingerprint;
+import android.hardware.fingerprint.FingerprintManager;
+import android.hardware.fingerprint.FingerprintManager.AuthenticationCallback;
+import android.hardware.fingerprint.FingerprintManager.AuthenticationResult;
+import android.hardware.fingerprint.FingerprintManager.RemovalCallback;
+import android.net.Uri;
import android.os.Bundle;
import android.os.CancellationSignal;
import android.os.Handler;
@@ -31,25 +40,29 @@
import android.preference.Preference.OnPreferenceChangeListener;
import android.preference.PreferenceGroup;
import android.preference.PreferenceScreen;
-import android.hardware.fingerprint.Fingerprint;
-import android.hardware.fingerprint.FingerprintManager;
-import android.hardware.fingerprint.FingerprintManager.AuthenticationCallback;
-import android.hardware.fingerprint.FingerprintManager.RemovalCallback;
-import android.hardware.fingerprint.FingerprintManager.AuthenticationResult;
+import android.provider.Browser;
+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.AttributeSet;
import android.util.Log;
+import android.view.LayoutInflater;
import android.view.View;
import android.view.WindowManager;
import android.widget.EditText;
+import android.widget.TextView;
import android.widget.Toast;
import com.android.internal.logging.MetricsLogger;
import com.android.settings.ChooseLockGeneric;
import com.android.settings.ChooseLockSettingsHelper;
+import com.android.settings.HelpUtils;
import com.android.settings.R;
-import com.android.settings.SettingsActivity;
import com.android.settings.SettingsPreferenceFragment;
-import com.android.settings.fingerprint.FingerprintEnrollEnrolling;
+import com.android.settings.SubSettings;
import com.android.settings.search.Indexable;
import java.util.List;
@@ -57,7 +70,7 @@
/**
* Settings screen for fingerprints
*/
-public class FingerprintSettings extends SettingsActivity {
+public class FingerprintSettings extends SubSettings {
/**
* Used by the FP settings wizard to indicate the wizard is
* finished, and each activity in the wizard should finish.
@@ -96,9 +109,7 @@
private static final String TAG = "FingerprintSettings";
private static final String KEY_FINGERPRINT_ITEM_PREFIX = "key_fingerprint_item";
- private static final String KEY_USAGE_CATEGORY = "fingerprint_usage_category";
private static final String KEY_FINGERPRINT_ADD = "key_fingerprint_add";
- private static final String KEY_MANAGE_CATEGORY = "fingerprint_manage_category";
private static final String KEY_FINGERPRINT_ENABLE_KEYGUARD_TOGGLE =
"fingerprint_enable_keyguard_toggle";
private static final String KEY_LAUNCHED_CONFIRM = "launched_confirm";
@@ -112,7 +123,6 @@
private static final int ADD_FINGERPRINT_REQUEST = 10;
- private static final boolean ENABLE_USAGE_CATEGORY = false;
protected static final boolean DEBUG = true;
private FingerprintManager mFingerprintManager;
@@ -226,6 +236,27 @@
}
}
+ @Override
+ public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
+ super.onViewCreated(view, savedInstanceState);
+ TextView v = (TextView) LayoutInflater.from(view.getContext()).inflate(
+ R.layout.fingerprint_settings_footer, null);
+ v.setText(LearnMoreSpan.linkify(getText(isFingerprintDisabled()
+ ? R.string.security_settings_fingerprint_enroll_disclaimer_lockscreen_disabled
+ : R.string.security_settings_fingerprint_enroll_disclaimer),
+ getString(getHelpResource())));
+ v.setMovementMethod(new LinkMovementMethod());
+ getListView().addFooterView(v);
+ getListView().setFooterDividersEnabled(false);
+ }
+
+ private boolean isFingerprintDisabled() {
+ final DevicePolicyManager dpm =
+ (DevicePolicyManager) getSystemService(Context.DEVICE_POLICY_SERVICE);
+ return dpm != null && (dpm.getKeyguardDisabledFeatures(null)
+ & DevicePolicyManager.KEYGUARD_DISABLE_FINGERPRINT) != 0;
+ }
+
protected void removeFingerprintPreference(int fingerprintId) {
String name = genKey(fingerprintId);
Preference prefToRemove = mManageCategory.findPreference(name);
@@ -251,48 +282,29 @@
}
addPreferencesFromResource(R.xml.security_settings_fingerprint);
root = getPreferenceScreen();
-
- // Fingerprint items
- mManageCategory = (PreferenceGroup) root.findPreference(KEY_MANAGE_CATEGORY);
- if (mManageCategory != null) {
- addFingerprintItemPreferences(mManageCategory);
- }
-
- // Fingerprint usage options
- PreferenceGroup usageCategory = (PreferenceGroup) root.findPreference(
- KEY_USAGE_CATEGORY);
- if (usageCategory != null) {
- Preference toggle = root.findPreference(KEY_FINGERPRINT_ENABLE_KEYGUARD_TOGGLE);
- toggle.setOnPreferenceChangeListener(this);
- if (!ENABLE_USAGE_CATEGORY) {
- root.removePreference(usageCategory);
- } else {
- toggle.setOnPreferenceChangeListener(this);
- }
- }
-
+ addFingerprintItemPreferences(root);
return root;
}
- private void addFingerprintItemPreferences(PreferenceGroup manageFingerprintCategory) {
- manageFingerprintCategory.removeAll();
+ private void addFingerprintItemPreferences(PreferenceGroup root) {
+ root.removeAll();
final List<Fingerprint> items = mFingerprintManager.getEnrolledFingerprints();
final int fingerprintCount = items.size();
for (int i = 0; i < fingerprintCount; i++) {
final Fingerprint item = items.get(i);
- FingerprintPreference pref = new FingerprintPreference(
- manageFingerprintCategory.getContext());
+ FingerprintPreference pref = new FingerprintPreference(root.getContext());
pref.setKey(genKey(item.getFingerId()));
pref.setTitle(item.getName());
pref.setFingerprint(item);
pref.setPersistent(false);
- manageFingerprintCategory.addPreference(pref);
+ root.addPreference(pref);
pref.setOnPreferenceChangeListener(this);
}
- Preference addPreference = new Preference(manageFingerprintCategory.getContext());
+ Preference addPreference = new Preference(root.getContext());
addPreference.setKey(KEY_FINGERPRINT_ADD);
addPreference.setTitle(R.string.fingerprint_add_title);
- manageFingerprintCategory.addPreference(addPreference);
+ addPreference.setIcon(R.drawable.ic_add_24dp);
+ root.addPreference(addPreference);
addPreference.setOnPreferenceChangeListener(this);
}
@@ -403,7 +415,7 @@
@Override
protected int getHelpResource() {
- return R.string.help_url_security;
+ return R.string.help_url_fingerprint;
}
@Override
@@ -508,4 +520,46 @@
mView = view;
}
};
+
+ private static class LearnMoreSpan extends URLSpan {
+
+ 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());
+ try {
+ ctx.startActivity(intent);
+ } catch (ActivityNotFoundException e) {
+ Log.w(FingerprintSettingsFragment.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;
+ }
+ }
}