Merge "Fix back navigation in biometric enrollment." into sc-dev
diff --git a/color-check-baseline.xml b/color-check-baseline.xml
index 800d95b..0c61a47 100644
--- a/color-check-baseline.xml
+++ b/color-check-baseline.xml
@@ -4205,4 +4205,20 @@
column="5"/>
</issue>
+ <issue
+ id="HardCodedColor"
+ severity="Error"
+ message="Avoid using hardcoded color"
+ category="Correctness"
+ priority="4"
+ summary="Using hardcoded color"
+ explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
+ errorLine1=" <color name="battery_info_error_color_red">#fce8e6</color> <!-- Material Red 50 -->"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="res/values/colors.xml"
+ line="202"
+ column="5"/>
+ </issue>
+
</issues>
diff --git a/res/layout/face_remove_button.xml b/res/layout/face_remove_button.xml
index 98459f0..a05fb85 100644
--- a/res/layout/face_remove_button.xml
+++ b/res/layout/face_remove_button.xml
@@ -26,6 +26,6 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start"
- android:text="@string/security_settings_face_settings_remove_face_data"/>
+ android:text="@string/security_settings_face_settings_remove_face_model"/>
</LinearLayout>
\ No newline at end of file
diff --git a/res/layout/preference_battery_error.xml b/res/layout/preference_battery_error.xml
index 66ff96a..4efd13a 100644
--- a/res/layout/preference_battery_error.xml
+++ b/res/layout/preference_battery_error.xml
@@ -1,20 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
- ~ Copyright (C) 2021 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) 2021 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.
-->
-<!-- TODO(b/179237551): Refine the layout once the design been lock down. -->
+
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
@@ -23,26 +23,28 @@
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginStart="24dp"
- android:layout_marginEnd="24dp"
+ android:layout_margin="8dp"
style="@style/ContextualCardStyle">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="top|start"
android:orientation="vertical"
- android:padding="16dp"
- android:background="@color/homepage_emergency_background">
+ android:padding="20dp"
+ android:background="@color/battery_info_error_color_red">
<ImageView
android:id="@+id/battery_icon"
- android:src="@drawable/ic_battery_alert_24dp"
+ android:src="@drawable/ic_warning_24dp"
+ android:tint="@*android:color/material_red_A700"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView android:id="@+id/summary_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:layout_marginTop="12dp"
+ android:layout_marginBottom="16dp"
android:text="@string/battery_missing_message"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary" />
@@ -53,7 +55,7 @@
android:layout_gravity="end"
android:text="@string/battery_missing_link_message"
android:textAppearance="?android:attr/textAppearanceSmall"
- android:textColor="?android:attr/colorError" />
+ android:textColor="@*android:color/material_red_A700" />
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
</FrameLayout>
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 0aa309f..be32412 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -198,4 +198,6 @@
<color name="accessibility_magnification_background">#F50D60</color>
<color name="accessibility_daltonizer_background">#00BCD4</color>
<color name="accessibility_color_inversion_background">#546E7A</color>
+
+ <color name="battery_info_error_color_red">#fce8e6</color> <!-- Material Red 50 -->
</resources>
\ No newline at end of file
diff --git a/res/values/strings.xml b/res/values/strings.xml
index ed0ebd6..b00cb00 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -853,8 +853,6 @@
<string name="security_settings_face_settings_require_confirmation">Always require confirmation</string>
<!-- When authenticating in apps, always require confirmation (e.g. confirm button) after a face is authenticated. [CHAR LIMIT=70] -->
<string name="security_settings_face_settings_require_confirmation_details">When using face unlock in apps, always require confirmation step</string>
- <!-- Button text in face settings which removes the user's faces from the device [CHAR LIMIT=20] -->
- <string name="security_settings_face_settings_remove_face_data">Delete face data</string>
<!-- Button text in face settings which removes the user's face model from the device [CHAR LIMIT=40] -->
<string name="security_settings_face_settings_remove_face_model">Delete face model</string>
<!-- Button text in face settings which lets the user enroll their face [CHAR LIMIT=40] -->
@@ -866,9 +864,9 @@
<!-- Text shown in face settings explaining what your face can be used for. Used when attention checking is not supported. [CHAR LIMIT=NONE] -->
<string name="security_settings_face_settings_footer_attention_not_supported">Keep in mind:\nLooking at the phone can unlock it when you don\u2019t intend to.\n\nYour phone can be unlocked by someone else if it\u2019s held up to your face, even if your eyes are closed.\n\nYour phone can be unlocked by someone who looks a lot like you, say, an identical sibling.</string>
<!-- Dialog title shown when the user removes an enrollment [CHAR LIMIT=35] -->
- <string name="security_settings_face_settings_remove_dialog_title">Delete face data?</string>
+ <string name="security_settings_face_settings_remove_dialog_title">Delete face model?</string>
<!-- Dialog contents shown when the user removes an enrollment [CHAR LIMIT=NONE] -->
- <string name="security_settings_face_settings_remove_dialog_details">The face data used by face unlock will be permanently and securely deleted. After removal, you will need your PIN, pattern, or password to unlock your phone, sign in to apps, and confirm payments.</string>
+ <string name="security_settings_face_settings_remove_dialog_details">Your face model will be permanently and securely deleted. After deletion, you will need your PIN, pattern, or password to unlock your phone or for authentication in apps.</string>
<!-- Dialog title shown when the user chooses to delete an existing enrolled face model. [CHAR LIMIT=35] -->
<string name="security_settings_face_settings_remove_model_dialog_title">Delete face model?</string>
<!-- Dialog contents shown when the user chooses to delete an existing enrolled face model. [CHAR LIMIT=NONE] -->
@@ -889,8 +887,8 @@
<string name="fingerprint_enable_keyguard_toggle_title">screen lock</string>
<!-- Message showing the current number of fingerprints set up. Shown for a menu item that launches fingerprint settings or enrollment. -->
<plurals name="security_settings_fingerprint_preference_summary">
- <item quantity="one"><xliff:g id="count">%1$d</xliff:g> fingerprint set up</item>
- <item quantity="other"><xliff:g id="count">%1$d</xliff:g> fingerprints set up</item>
+ <item quantity="one">Fingerprint added</item>
+ <item quantity="other"><xliff:g id="count">%1$d</xliff:g> fingerprints added</item>
</plurals>
<!-- message shown in summary field when no fingerprints are registered -->
<string name="security_settings_fingerprint_preference_summary_none"></string>
@@ -971,9 +969,13 @@
<!-- Biometric settings --><skip />
<!-- Title shown for menu item that launches biometric settings. [CHAR LIMIT=66] -->
- <string name="security_settings_biometric_preference_title">Face & fingerprint unlock</string>
+ <string name="security_settings_biometric_preference_title">Face & Fingerprint Unlock</string>
<!-- Message shown in summary field of biometric settings. [CHAR LIMIT=66] -->
- <string name="security_settings_biometric_preference_summary">Face and fingerprint</string>
+ <string name="security_settings_biometric_preference_summary_none_enrolled">Tap to set up</string>
+ <!-- Message shown in summary field of biometric settings when face is enrolled, and multiple fingerprints are enrolled. [CHAR LIMIT=66]-->
+ <string name="security_settings_biometric_preference_summary_both_fp_multiple">Face and fingerprints added</string>
+ <!-- Message shown in summary field of biometric settings when face is enrolled, and a single fingerprintis enrolled. [CHAR LIMIT=66]-->
+ <string name="security_settings_biometric_preference_summary_both_fp_single">Face and fingerprint added</string>
<!-- Introduction shown in face and fingerprint page to introduce the biometric feature. [CHAR LIMIT=NONE]-->
<string name="biometric_settings_intro">When you set up face unlock and fingerprint, your phone will ask for your fingerprint when you wear a mask or are in a dark area.</string>
<!-- Biometric category title - biometric options for unlocking the device. [CHAR LIMIT=50] -->
@@ -1464,43 +1466,42 @@
<string name="unlock_disable_lock_title">Turn off 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>
+ <string name="unlock_disable_frp_warning_title">Delete screen lock?</string>
<!-- Title of the dialog shown when the user removes the profile lock [CHAR LIMIT=NONE] -->
<string name="unlock_disable_frp_warning_title_profile">Remove profile 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>
+ <string name="unlock_disable_frp_warning_content_pattern">"A pattern protects your phone if it\u2019s lost or stolen"</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>
+ <string name="unlock_disable_frp_warning_content_pattern_fingerprint">"A pattern protects your phone if it\u2019s lost or stolen.<xliff:g id="empty_line">\n\n</xliff:g>This also deletes the fingerprint model stored on your device. You won\u2019t be able to use your fingerprint for authentication in apps."</string>
+ <!-- Content of the dialog shown when the user removes the device lock pattern and the user has face authentication enrolled [CHAR LIMIT=NONE] -->
+ <string name="unlock_disable_frp_warning_content_pattern_face">"A pattern protects your phone if it\u2019s lost or stolen.<xliff:g id="empty_line">\n\n</xliff:g>Your face model will also be permanently and securely deleted. You won\u2019t be able to use your face for authentication in apps."</string>
+ <!-- Content of the dialog shown when the user removes the device lock pattern and the user has face authentication and fingerprint enrolled [CHAR LIMIT=NONE] -->
+ <string name="unlock_disable_frp_warning_content_pattern_face_fingerprint">"A pattern protects your phone if it\u2019s lost or stolen.<xliff:g id="empty_line">\n\n</xliff:g>This deletes the fingerprint model stored on your device. Your face model will also be permanently and securely deleted. You won\u2019t be able to use your face or fingerprint for authentication in apps."</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>
+ <string name="unlock_disable_frp_warning_content_pin">"A PIN protects your phone if it\u2019s lost or stolen"</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>
+ <string name="unlock_disable_frp_warning_content_pin_fingerprint">"A PIN protects your phone if it\u2019s lost or stolen.<xliff:g id="empty_line">\n\n</xliff:g>This also deletes the fingerprint model stored on your device. You won\u2019t be able to use your fingerprint for authentication in apps."</string>
+ <!-- Content of the dialog shown when the user removes the device lock PIN and the user has face enrolled [CHAR LIMIT=NONE] -->
+ <string name="unlock_disable_frp_warning_content_pin_face">"A PIN protects your phone if it\u2019s lost or stolen.<xliff:g id="empty_line">\n\n</xliff:g>Your face model will also be permanently and securely deleted. You won\u2019t be able to use your face for authentication in apps."</string>
+ <!-- Content of the dialog shown when the user removes the device lock PIN and the user has face authentication and fingerprint enrolled [CHAR LIMIT=NONE] -->
+ <string name="unlock_disable_frp_warning_content_pin_face_fingerprint">"A PIN protects your phone if it\u2019s lost or stolen.<xliff:g id="empty_line">\n\n</xliff:g>This deletes the fingerprint model stored on your device. Your face model will also be permanently and securely deleted. You won\u2019t be able to use your face or fingerprint for authentication in apps."</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>
+ <string name="unlock_disable_frp_warning_content_password">"A password protects your phone if it\u2019s lost or stolen"</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>
+ <string name="unlock_disable_frp_warning_content_password_fingerprint">"A password protects your phone if it\u2019s lost or stolen.<xliff:g id="empty_line">\n\n</xliff:g>This also deletes the fingerprint model stored on your device. You won\u2019t be able to use your fingerprint for authentication in apps."</string>
+ <!-- Content of the dialog shown when the user removes the device lock password and the user has face enrolled [CHAR LIMIT=NONE] -->
+ <string name="unlock_disable_frp_warning_content_password_face">"A password protects your phone if it\u2019s lost or stolen.<xliff:g id="empty_line">\n\n</xliff:g>Your face model will also be permanently and securely deleted. You won\u2019t be able to use your face for authentication in apps."</string>
+ <!-- Content of the dialog shown when the user removes the device lock password and the user has face authentication and fingerprint enrolled [CHAR LIMIT=NONE] -->
+ <string name="unlock_disable_frp_warning_content_password_face_fingerprint">"A password protects your phone if it\u2019s lost or stolen.<xliff:g id="empty_line">\n\n</xliff:g>This deletes the fingerprint model stored on your device. Your face model will also be permanently and securely deleted. You won\u2019t be able to use your face or fingerprint for authentication in apps."</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>
-
- <!-- Content of the dialog shown when the user removes the profile lock pattern [CHAR LIMIT=NONE] -->
- <string name="unlock_disable_frp_warning_content_pattern_profile">"Profile protection features will not work without your pattern."</string>
- <!-- Content of the dialog shown when the user removes the profile lock pattern and the user has fingerprints enrolled [CHAR LIMIT=NONE] -->
- <string name="unlock_disable_frp_warning_content_pattern_fingerprint_profile">"Profile 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 profile and you won\'t be able to unlock your profile, authorize purchases, or sign in to apps with them."</string>
- <!-- Content of the dialog shown when the user removes the profile lock PIN [CHAR LIMIT=NONE] -->
- <string name="unlock_disable_frp_warning_content_pin_profile">"Profile protection features will not work without your PIN."</string>
- <!-- Content of the dialog shown when the user removes the profile lock PIN and the user has fingerprints enrolled [CHAR LIMIT=NONE] -->
- <string name="unlock_disable_frp_warning_content_pin_fingerprint_profile">"Profile 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 profile and you won\'t be able to unlock your profile, authorize purchases, or sign in to apps with them."</string>
- <!-- Content of the dialog shown when the user removes the profile lock password [CHAR LIMIT=NONE] -->
- <string name="unlock_disable_frp_warning_content_password_profile">"Profile protection features will not work without your password."</string>
- <!-- Content of the dialog shown when the user removes the profile lock password and the user has fingerprints enrolled [CHAR LIMIT=NONE] -->
- <string name="unlock_disable_frp_warning_content_password_fingerprint_profile">"Profile 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 profile and you won\'t be able to unlock your profile, authorize purchases, or sign in to apps with them."</string>
- <!-- Content of the dialog shown when the user removes the profile lock of unknown type [CHAR LIMIT=NONE] -->
- <string name="unlock_disable_frp_warning_content_unknown_profile">"Profile protection features will not work without your screen lock."</string>
- <!-- Content of the dialog shown when the user removes the profile lock of unknown type and the user has fingerprints enrolled [CHAR LIMIT=NONE] -->
- <string name="unlock_disable_frp_warning_content_unknown_fingerprint_profile">"Profile 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 profile and you won\'t be able to unlock your profile, authorize purchases, or sign in to apps with them."</string>
+ <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>This also deletes the fingerprint model stored on your device. You won\u2019t be able to use your fingerprint for authentication in apps."</string>
+ <!-- Content of the dialog shown when the user removes the device lock of unknown type and the user has face enrolled [CHAR LIMIT=NONE] -->
+ <string name="unlock_disable_frp_warning_content_unknown_face">"Device protection features will not work without your screen lock.<xliff:g id="empty_line">\n\n</xliff:g>Your face model will also be permanently and securely deleted. You won\u2019t be able to use your face for authentication in apps."</string>
+ <!-- Content of the dialog shown when the user removes the device lock of unknown type and the user has face authentication and fingerprint enrolled [CHAR LIMIT=NONE] -->
+ <string name="unlock_disable_frp_warning_content_unknown_face_fingerprint">"Device protection features will not work without your screen lock.<xliff:g id="empty_line">\n\n</xliff:g>This deletes the fingerprint model stored on your device. Your face model will also be permanently and securely deleted. You won\u2019t be able to use your face or fingerprint for authentication in apps."</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>
@@ -13276,6 +13277,8 @@
<!-- Label for extra app info settings for a specific app [CHAR LIMIT=40] -->
<string name="extra_app_info_label" translatable="false"></string>
+ <!-- Summary for extra app info settings for a specific app [CHAR LIMIT=40] -->
+ <string name="extra_app_info_summary" translatable="false"></string>
<!-- Title for toggle controlling whether notifications are shown when an app pastes from clipboard. [CHAR LIMIT=50] -->
<string name="show_clip_access_notification">Show clipboard access</string>
diff --git a/res/xml/app_info_settings_v2.xml b/res/xml/app_info_settings_v2.xml
index 80c449a..8b9cf4f 100644
--- a/res/xml/app_info_settings_v2.xml
+++ b/res/xml/app_info_settings_v2.xml
@@ -83,6 +83,7 @@
<Preference
android:key="extra_app_info_settings"
android:title="@string/extra_app_info_label"
+ android:summary="@string/extra_app_info_summary"
settings:controller="com.android.settings.applications.appinfo.ExtraAppInfoPreferenceController" />
<Preference
diff --git a/res/xml/security_settings_face.xml b/res/xml/security_settings_face.xml
index 131f222..e1ac9b3 100644
--- a/res/xml/security_settings_face.xml
+++ b/res/xml/security_settings_face.xml
@@ -81,7 +81,7 @@
android:title="@string/security_settings_face_preference_title">
<com.android.settingslib.widget.LayoutPreference
android:key="security_settings_face_delete_faces_container"
- android:title="@string/security_settings_face_settings_remove_face_data"
+ android:title="@string/security_settings_face_settings_remove_face_model"
android:selectable="false"
android:layout="@layout/face_remove_button"
settings:allowDividerBelow="true"/>
diff --git a/src/com/android/settings/applications/appinfo/ExtraAppInfoFeatureProvider.java b/src/com/android/settings/applications/appinfo/ExtraAppInfoFeatureProvider.java
index 20938d1..4de1c2c 100644
--- a/src/com/android/settings/applications/appinfo/ExtraAppInfoFeatureProvider.java
+++ b/src/com/android/settings/applications/appinfo/ExtraAppInfoFeatureProvider.java
@@ -34,4 +34,9 @@
* Sets the package name
*/
void setPackageName(String packageName);
+
+ /**
+ * gets the summary name
+ */
+ String getSummary(Context context);
}
diff --git a/src/com/android/settings/applications/appinfo/ExtraAppInfoFeatureProviderImpl.java b/src/com/android/settings/applications/appinfo/ExtraAppInfoFeatureProviderImpl.java
index 3e5ef78..55b9bf0 100644
--- a/src/com/android/settings/applications/appinfo/ExtraAppInfoFeatureProviderImpl.java
+++ b/src/com/android/settings/applications/appinfo/ExtraAppInfoFeatureProviderImpl.java
@@ -37,4 +37,9 @@
public void setPackageName(String packageName) {
return;
}
+
+ @Override
+ public String getSummary(Context context) {
+ return "";
+ }
}
diff --git a/src/com/android/settings/applications/appinfo/ExtraAppInfoPreferenceController.java b/src/com/android/settings/applications/appinfo/ExtraAppInfoPreferenceController.java
index 0c1b3e3..0d72b74 100644
--- a/src/com/android/settings/applications/appinfo/ExtraAppInfoPreferenceController.java
+++ b/src/com/android/settings/applications/appinfo/ExtraAppInfoPreferenceController.java
@@ -50,6 +50,11 @@
return super.handlePreferenceTreeClick(preference);
}
+ @Override
+ public CharSequence getSummary() {
+ return mExtraAppInfoFeatureProvider.getSummary(mContext);
+ }
+
/**
* Set the local package name
*/
diff --git a/src/com/android/settings/biometrics/combination/CombinedBiometricStatusPreferenceController.java b/src/com/android/settings/biometrics/combination/CombinedBiometricStatusPreferenceController.java
index c3db174..6e989d8 100644
--- a/src/com/android/settings/biometrics/combination/CombinedBiometricStatusPreferenceController.java
+++ b/src/com/android/settings/biometrics/combination/CombinedBiometricStatusPreferenceController.java
@@ -16,6 +16,10 @@
package com.android.settings.biometrics.combination;
import android.content.Context;
+import android.hardware.face.FaceManager;
+import android.hardware.fingerprint.FingerprintManager;
+
+import androidx.annotation.Nullable;
import com.android.settings.R;
import com.android.settings.Settings;
@@ -30,6 +34,10 @@
BiometricStatusPreferenceController {
private static final String KEY_BIOMETRIC_SETTINGS = "biometric_settings";
+ @Nullable
+ FingerprintManager mFingerprintManager;
+ @Nullable
+ FaceManager mFaceManager;
public CombinedBiometricStatusPreferenceController(Context context) {
this(context, KEY_BIOMETRIC_SETTINGS);
@@ -37,6 +45,8 @@
public CombinedBiometricStatusPreferenceController(Context context, String key) {
super(context, key);
+ mFingerprintManager = Utils.getFingerprintManagerOrNull(context);
+ mFaceManager = Utils.getFaceManagerOrNull(context);
}
@Override
@@ -51,12 +61,34 @@
@Override
protected String getSummaryTextEnrolled() {
- return mContext.getString(R.string.security_settings_biometric_preference_summary);
+ // Note that this is currently never called (see the super class)
+ return mContext.getString(
+ R.string.security_settings_biometric_preference_summary_none_enrolled);
}
@Override
protected String getSummaryTextNoneEnrolled() {
- return mContext.getString(R.string.security_settings_biometric_preference_summary);
+ final int numFingerprintsEnrolled = mFingerprintManager != null ?
+ mFingerprintManager.getEnrolledFingerprints(getUserId()).size() : 0;
+ final boolean faceEnrolled = mFaceManager != null
+ && mFaceManager.hasEnrolledTemplates(getUserId());
+
+ if (faceEnrolled && numFingerprintsEnrolled > 1) {
+ return mContext.getString(
+ R.string.security_settings_biometric_preference_summary_both_fp_multiple);
+ } else if (faceEnrolled && numFingerprintsEnrolled == 1) {
+ return mContext.getString(
+ R.string.security_settings_biometric_preference_summary_both_fp_single);
+ } else if (faceEnrolled) {
+ return mContext.getString(R.string.security_settings_face_preference_summary);
+ } else if (numFingerprintsEnrolled > 0) {
+ return mContext.getResources().getQuantityString(
+ R.plurals.security_settings_fingerprint_preference_summary,
+ numFingerprintsEnrolled, numFingerprintsEnrolled);
+ } else {
+ return mContext.getString(
+ R.string.security_settings_biometric_preference_summary_none_enrolled);
+ }
}
@Override
diff --git a/src/com/android/settings/display/AdaptiveSleepPermissionPreferenceController.java b/src/com/android/settings/display/AdaptiveSleepPermissionPreferenceController.java
index 0d21e9c..c3db6f7 100644
--- a/src/com/android/settings/display/AdaptiveSleepPermissionPreferenceController.java
+++ b/src/com/android/settings/display/AdaptiveSleepPermissionPreferenceController.java
@@ -37,26 +37,18 @@
@VisibleForTesting
BannerMessagePreference mPreference;
private final PackageManager mPackageManager;
+ private final Context mContext;
public AdaptiveSleepPermissionPreferenceController(Context context) {
- final String packageName = context.getPackageManager().getAttentionServicePackageName();
mPackageManager = context.getPackageManager();
- final Intent intent = new Intent(
- android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
- intent.setData(Uri.parse("package:" + packageName));
- mPreference = new BannerMessagePreference(context);
- mPreference.setTitle(R.string.adaptive_sleep_title_no_permission);
- mPreference.setSummary(R.string.adaptive_sleep_summary_no_permission);
- mPreference.setPositiveButtonText(R.string.adaptive_sleep_manage_permission_button);
- mPreference.setPositiveButtonOnClickListener(p -> {
- context.startActivity(intent);
- });
+ mContext = context;
}
/**
* Adds the controlled preference to the provided preference screen.
*/
public void addToScreen(PreferenceScreen screen) {
+ initializePreference();
if (!hasSufficientPermission(mPackageManager)) {
screen.addPreference(mPreference);
}
@@ -66,6 +58,25 @@
* Refreshes the visibility of the preference.
*/
public void updateVisibility() {
+ initializePreference();
mPreference.setVisible(!hasSufficientPermission(mPackageManager));
}
+
+ private void initializePreference() {
+ if (mPreference == null) {
+ final String packageName =
+ mContext.getPackageManager().getAttentionServicePackageName();
+ final Intent intent = new Intent(
+ android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
+ intent.setData(Uri.parse("package:" + packageName));
+ mPreference = new BannerMessagePreference(mContext);
+ mPreference.setTitle(R.string.adaptive_sleep_title_no_permission);
+ mPreference.setSummary(R.string.adaptive_sleep_summary_no_permission);
+ mPreference.setPositiveButtonText(R.string.adaptive_sleep_manage_permission_button);
+ mPreference.setPositiveButtonOnClickListener(p -> {
+ mContext.startActivity(intent);
+ });
+ }
+ }
+
}
diff --git a/src/com/android/settings/display/AdaptiveSleepPreferenceController.java b/src/com/android/settings/display/AdaptiveSleepPreferenceController.java
index 70d8a79..7fbb01e 100644
--- a/src/com/android/settings/display/AdaptiveSleepPreferenceController.java
+++ b/src/com/android/settings/display/AdaptiveSleepPreferenceController.java
@@ -49,10 +49,10 @@
public static final String PREFERENCE_KEY = "adaptive_sleep";
private static final int DEFAULT_VALUE = 0;
private final SensorPrivacyManager mPrivacyManager;
- private RestrictionUtils mRestrictionUtils;
- private PackageManager mPackageManager;
- private Context mContext;
- private MetricsFeatureProvider mMetricsFeatureProvider;
+ private final RestrictionUtils mRestrictionUtils;
+ private final PackageManager mPackageManager;
+ private final Context mContext;
+ private final MetricsFeatureProvider mMetricsFeatureProvider;
@VisibleForTesting
RestrictedSwitchPreference mPreference;
@@ -62,19 +62,6 @@
mRestrictionUtils = restrictionUtils;
mMetricsFeatureProvider = FeatureFactory.getFactory(context).getMetricsFeatureProvider();
mPrivacyManager = SensorPrivacyManager.getInstance(context);
- mPreference = new RestrictedSwitchPreference(context);
- mPreference.setTitle(R.string.adaptive_sleep_title);
- mPreference.setSummary(R.string.adaptive_sleep_description);
- mPreference.setChecked(isChecked());
- mPreference.setKey(PREFERENCE_KEY);
- mPreference.setOnPreferenceClickListener(preference -> {
- final boolean isChecked = ((RestrictedSwitchPreference) preference).isChecked();
- mMetricsFeatureProvider.action(context, SettingsEnums.ACTION_SCREEN_ATTENTION_CHANGED,
- isChecked);
- Settings.Secure.putInt(context.getContentResolver(),
- Settings.Secure.ADAPTIVE_SLEEP, isChecked ? 1 : DEFAULT_VALUE);
- return true;
- });
mPackageManager = context.getPackageManager();
}
@@ -86,12 +73,13 @@
* Adds the controlled preference to the provided preference screen.
*/
public void addToScreen(PreferenceScreen screen) {
+ initializePreference();
updatePreference();
screen.addPreference(mPreference);
}
/**
- * Updates the appearance of the preference.
+ * Updates the appearance of the preference.
*/
public void updatePreference() {
final EnforcedAdmin enforcedAdmin = mRestrictionUtils.checkIfRestrictionEnforced(mContext,
@@ -104,6 +92,23 @@
}
@VisibleForTesting
+ void initializePreference() {
+ mPreference = new RestrictedSwitchPreference(mContext);
+ mPreference.setTitle(R.string.adaptive_sleep_title);
+ mPreference.setSummary(R.string.adaptive_sleep_description);
+ mPreference.setChecked(isChecked());
+ mPreference.setKey(PREFERENCE_KEY);
+ mPreference.setOnPreferenceChangeListener((preference, value) -> {
+ final boolean isChecked = (Boolean) value;
+ mMetricsFeatureProvider.action(mContext, SettingsEnums.ACTION_SCREEN_ATTENTION_CHANGED,
+ isChecked);
+ Settings.Secure.putInt(mContext.getContentResolver(),
+ Settings.Secure.ADAPTIVE_SLEEP, isChecked ? 1 : DEFAULT_VALUE);
+ return true;
+ });
+ }
+
+ @VisibleForTesting
boolean isChecked() {
return hasSufficientPermission(mContext.getPackageManager()) && !isCameraLocked()
&& Settings.Secure.getInt(mContext.getContentResolver(),
@@ -146,4 +151,4 @@
return attentionPackage != null && packageManager.checkPermission(
Manifest.permission.CAMERA, attentionPackage) == PackageManager.PERMISSION_GRANTED;
}
-}
\ No newline at end of file
+}
diff --git a/src/com/android/settings/display/ScreenTimeoutSettings.java b/src/com/android/settings/display/ScreenTimeoutSettings.java
index 27e1e1b..6dfb225 100644
--- a/src/com/android/settings/display/ScreenTimeoutSettings.java
+++ b/src/com/android/settings/display/ScreenTimeoutSettings.java
@@ -71,11 +71,15 @@
private CharSequence[] mInitialEntries;
private CharSequence[] mInitialValues;
private FooterPreference mPrivacyPreference;
- private MetricsFeatureProvider mMetricsFeatureProvider;
+ private final MetricsFeatureProvider mMetricsFeatureProvider;
private SensorPrivacyManager mPrivacyManager;
@VisibleForTesting
+ Context mContext;
+
+ @VisibleForTesting
RestrictedLockUtils.EnforcedAdmin mAdmin;
+
@VisibleForTesting
Preference mDisableOptionsPreference;
@@ -97,6 +101,7 @@
@Override
public void onAttach(Context context) {
super.onAttach(context);
+ mContext = context;
mInitialEntries = getResources().getStringArray(R.array.screen_timeout_entries);
mInitialValues = getResources().getStringArray(R.array.screen_timeout_values);
mAdaptiveSleepController = new AdaptiveSleepPreferenceController(context);
@@ -104,11 +109,6 @@
context);
mAdaptiveSleepCameraStatePreferenceController =
new AdaptiveSleepCameraStatePreferenceController(context);
- mPrivacyPreference = new FooterPreference(context);
- mPrivacyPreference.setIcon(R.drawable.ic_privacy_shield_24dp);
- mPrivacyPreference.setTitle(R.string.adaptive_sleep_privacy);
- mPrivacyPreference.setSelectable(false);
- mPrivacyPreference.setLayoutResource(R.layout.preference_footer);
mPrivacyManager = SensorPrivacyManager.getInstance(context);
mPrivacyManager.addSensorPrivacyListener(CAMERA,
(sensor, enabled) -> mAdaptiveSleepController.updatePreference());
@@ -167,6 +167,12 @@
preferenceWithLargestTimeout.setChecked(true);
}
+ mPrivacyPreference = new FooterPreference(mContext);
+ mPrivacyPreference.setIcon(R.drawable.ic_privacy_shield_24dp);
+ mPrivacyPreference.setTitle(R.string.adaptive_sleep_privacy);
+ mPrivacyPreference.setSelectable(false);
+ mPrivacyPreference.setLayoutResource(R.layout.preference_footer);
+
if (isScreenAttentionAvailable(getContext())) {
mAdaptiveSleepPermissionController.addToScreen(screen);
mAdaptiveSleepCameraStatePreferenceController.addToScreen(screen);
diff --git a/src/com/android/settings/network/telephony/BackupCallingPreferenceController.java b/src/com/android/settings/network/telephony/BackupCallingPreferenceController.java
index c4bf6b4..d1c9f7b 100644
--- a/src/com/android/settings/network/telephony/BackupCallingPreferenceController.java
+++ b/src/com/android/settings/network/telephony/BackupCallingPreferenceController.java
@@ -42,7 +42,6 @@
private static final String LOG_TAG = "BackupCallingPrefCtrl";
- private int mSubId;
private Preference mPreference;
/**
diff --git a/src/com/android/settings/password/ChooseLockGeneric.java b/src/com/android/settings/password/ChooseLockGeneric.java
index b8e1165..67fc7ef 100644
--- a/src/com/android/settings/password/ChooseLockGeneric.java
+++ b/src/com/android/settings/password/ChooseLockGeneric.java
@@ -975,31 +975,38 @@
private int getResIdForFactoryResetProtectionWarningMessage() {
final boolean hasFingerprints;
+ final boolean hasFace;
if (mFingerprintManager != null && mFingerprintManager.isHardwareDetected()) {
hasFingerprints = mFingerprintManager.hasEnrolledFingerprints(mUserId);
} else {
hasFingerprints = false;
}
+
+ if (mFaceManager != null && mFaceManager.isHardwareDetected()) {
+ hasFace = mFaceManager.hasEnrolledTemplates(mUserId);
+ } else {
+ hasFace = false;
+ }
+
switch (mLockPatternUtils.getKeyguardStoredPasswordQuality(mUserId)) {
case DevicePolicyManager.PASSWORD_QUALITY_SOMETHING:
- if (hasFingerprints && mIsManagedProfile) {
- return R.string
- .unlock_disable_frp_warning_content_pattern_fingerprint_profile;
- } else if (hasFingerprints && !mIsManagedProfile) {
+ if (hasFingerprints && hasFace) {
+ return R.string.unlock_disable_frp_warning_content_pattern_face_fingerprint;
+ } else if (hasFingerprints) {
return R.string.unlock_disable_frp_warning_content_pattern_fingerprint;
- } else if (mIsManagedProfile) {
- return R.string.unlock_disable_frp_warning_content_pattern_profile;
+ } else if (hasFace) {
+ return R.string.unlock_disable_frp_warning_content_pattern_face;
} else {
return R.string.unlock_disable_frp_warning_content_pattern;
}
case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC:
case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC_COMPLEX:
- if (hasFingerprints && mIsManagedProfile) {
- return R.string.unlock_disable_frp_warning_content_pin_fingerprint_profile;
- } else if (hasFingerprints && !mIsManagedProfile) {
+ if (hasFingerprints && hasFace) {
+ return R.string.unlock_disable_frp_warning_content_pin_face_fingerprint;
+ } else if (hasFingerprints) {
return R.string.unlock_disable_frp_warning_content_pin_fingerprint;
- } else if (mIsManagedProfile) {
- return R.string.unlock_disable_frp_warning_content_pin_profile;
+ } else if (hasFace) {
+ return R.string.unlock_disable_frp_warning_content_pin_face;
} else {
return R.string.unlock_disable_frp_warning_content_pin;
}
@@ -1007,24 +1014,23 @@
case DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC:
case DevicePolicyManager.PASSWORD_QUALITY_COMPLEX:
case DevicePolicyManager.PASSWORD_QUALITY_MANAGED:
- if (hasFingerprints && mIsManagedProfile) {
+ if (hasFingerprints && hasFace) {
return R.string
- .unlock_disable_frp_warning_content_password_fingerprint_profile;
- } else if (hasFingerprints && !mIsManagedProfile) {
+ .unlock_disable_frp_warning_content_password_face_fingerprint;
+ } else if (hasFingerprints) {
return R.string.unlock_disable_frp_warning_content_password_fingerprint;
- } else if (mIsManagedProfile) {
- return R.string.unlock_disable_frp_warning_content_password_profile;
+ } else if (hasFace) {
+ return R.string.unlock_disable_frp_warning_content_password_face;
} else {
return R.string.unlock_disable_frp_warning_content_password;
}
default:
- if (hasFingerprints && mIsManagedProfile) {
- return R.string
- .unlock_disable_frp_warning_content_unknown_fingerprint_profile;
- } else if (hasFingerprints && !mIsManagedProfile) {
+ if (hasFingerprints && hasFace) {
+ return R.string.unlock_disable_frp_warning_content_unknown_face_fingerprint;
+ } else if (hasFingerprints) {
return R.string.unlock_disable_frp_warning_content_unknown_fingerprint;
- } else if (mIsManagedProfile) {
- return R.string.unlock_disable_frp_warning_content_unknown_profile;
+ } else if (hasFace) {
+ return R.string.unlock_disable_frp_warning_content_unknown_face;
} else {
return R.string.unlock_disable_frp_warning_content_unknown;
}
diff --git a/tests/robotests/src/com/android/settings/display/AdaptiveSleepPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/display/AdaptiveSleepPreferenceControllerTest.java
index 843870d..880f9cc 100644
--- a/tests/robotests/src/com/android/settings/display/AdaptiveSleepPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/display/AdaptiveSleepPreferenceControllerTest.java
@@ -84,6 +84,7 @@
eq(UserManager.DISALLOW_CONFIG_SCREEN_TIMEOUT))).thenReturn(null);
mController = new AdaptiveSleepPreferenceController(mContext, mRestrictionUtils);
+ mController.initializePreference();
when(mController.isCameraLocked()).thenReturn(false);
}
diff --git a/tests/robotests/src/com/android/settings/display/ScreenTimeoutSettingsTest.java b/tests/robotests/src/com/android/settings/display/ScreenTimeoutSettingsTest.java
index c4f5580..24bcde8 100644
--- a/tests/robotests/src/com/android/settings/display/ScreenTimeoutSettingsTest.java
+++ b/tests/robotests/src/com/android/settings/display/ScreenTimeoutSettingsTest.java
@@ -60,8 +60,6 @@
private ScreenTimeoutSettings mSettings;
private Context mContext;
private ContentResolver mContentResolver;
-
- @Mock
private Resources mResources;
@Mock
@@ -85,7 +83,9 @@
FakeFeatureFactory.setupForTest();
mContext = spy(getApplicationContext());
mSettings = spy(new ScreenTimeoutSettings());
+ mSettings.mContext = mContext;
mContentResolver = mContext.getContentResolver();
+ mResources = spy(mContext.getResources());
doReturn(TIMEOUT_ENTRIES).when(mResources).getStringArray(R.array.screen_timeout_entries);
doReturn(TIMEOUT_VALUES).when(mResources).getStringArray(R.array.screen_timeout_entries);