Merge "Change ScrollView to NestedScrollView for language list" into sc-dev
diff --git a/res/drawable/ic_fingerprint_introduction_shield_24dp.xml b/res/drawable/ic_fingerprint_introduction_shield_24dp.xml
new file mode 100644
index 0000000..28c9984
--- /dev/null
+++ b/res/drawable/ic_fingerprint_introduction_shield_24dp.xml
@@ -0,0 +1,45 @@
+<!--
+ 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.
+-->
+
+<animated-vector xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:aapt="http://schemas.android.com/aapt">
+ <aapt:attr name="android:drawable">
+ <vector android:height="24dp" android:width="24dp" android:viewportHeight="24"
+ android:viewportWidth="24"
+ android:tint="?android:attr/colorControlNormal">
+ <group android:name="_R_G">
+ <group android:name="_R_G_L_0_G">
+ <path android:name="_R_G_L_0_G_D_0_P_0" android:fillColor="#000000"
+ android:fillAlpha="1" android:fillType="nonZero"
+ android:pathData=" M12 2 C12,2 3.82,5.64 3.82,5.64 C3.82,5.64 3.82,11.09 3.82,11.09 C3.82,16.14 7.31,20.85 12,22 C16.69,20.85 20.18,16.14 20.18,11.09 C20.18,11.09 20.18,5.64 20.18,5.64 C20.18,5.64 12,2 12,2c M18.18 11.09 C18.18,12.64 17.77,14.14 17.08,15.47 C15.77,14.5 13.4,14 12,14 C10.6,14 8.23,14.5 6.92,15.47 C6.23,14.14 5.82,12.64 5.82,11.09 C5.82,11.09 5.82,6.94 5.82,6.94 C5.82,6.94 12,4.19 12,4.19 C12,4.19 18.18,6.94 18.18,6.94 C18.18,6.94 18.18,11.09 18.18,11.09c "/>
+ <path android:name="_R_G_L_0_G_D_1_P_0" android:fillColor="#000000"
+ android:fillAlpha="1" android:fillType="nonZero"
+ android:pathData=" M12 7.5 C13.66,7.5 15,8.84 15,10.5 C15,12.16 13.66,13.5 12,13.5 C10.34,13.5 9,12.16 9,10.5 C9,8.84 10.34,7.5 12,7.5c "/>
+ </group>
+ </group>
+ <group android:name="time_group"/>
+ </vector>
+ </aapt:attr>
+ <target android:name="time_group">
+ <aapt:attr name="android:animation">
+ <set android:ordering="together">
+ <objectAnimator android:propertyName="translateX" android:duration="2000"
+ android:startOffset="0" android:valueFrom="0" android:valueTo="1"
+ android:valueType="floatType"/>
+ </set>
+ </aapt:attr>
+ </target>
+</animated-vector>
\ No newline at end of file
diff --git a/res/layout/fingerprint_enroll_introduction.xml b/res/layout/fingerprint_enroll_introduction.xml
index 0aa18fb..8555f1a 100644
--- a/res/layout/fingerprint_enroll_introduction.xml
+++ b/res/layout/fingerprint_enroll_introduction.xml
@@ -31,22 +31,15 @@
android:orientation="vertical">
<com.google.android.setupdesign.view.RichTextView
- android:id="@+id/sud_layout_description"
- style="@style/SudDescription.Glif"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="@string/security_settings_fingerprint_enroll_introduction_message" />
-
- <com.google.android.setupdesign.view.RichTextView
android:id="@+id/error_text"
style="@style/SudDescription.Glif"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
- <com.google.android.setupdesign.view.FillContentLayout
+ <FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_weight="1">
+ android:layout_marginVertical="12dp">
<ImageView
style="@style/SudContentIllustration"
@@ -55,25 +48,89 @@
android:contentDescription="@null"
android:src="@drawable/fingerprint_enroll_introduction" />
- </com.google.android.setupdesign.view.FillContentLayout>
+ </FrameLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:orientation="horizontal">
-
- <ImageView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:contentDescription="@null"
- android:src="@drawable/ic_info_outline_24dp"/>
+ android:orientation="vertical">
<com.google.android.setupdesign.view.RichTextView
- android:id="@+id/sud_layout_info"
style="@style/SudDescription.Glif"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:text="@string/security_settings_fingerprint_enroll_introduction_bottom_message" />
+ android:textAlignment="viewStart"
+ android:paddingTop="12dp"
+ android:text="@string/security_settings_fingerprint_enroll_introduction_footer_title_1" />
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ android:paddingTop="12dp">
+
+ <ImageView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:contentDescription="@null"
+ android:src="@drawable/ic_fingerprint_introduction_shield_24dp"/>
+ <Space
+ android:layout_width="24dp"
+ android:layout_height="wrap_content"/>
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/security_settings_fingerprint_enroll_introduction_footer_message_1" />
+ </LinearLayout>
+
+ <TextView
+ style="@style/SudDescription.Glif"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:textAlignment="viewStart"
+ android:paddingTop="24dp"
+ android:text="@string/security_settings_fingerprint_enroll_introduction_footer_title_2" />
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ android:paddingTop="12dp">
+
+ <ImageView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:contentDescription="@null"
+ android:src="@drawable/ic_info_outline_24dp"/>
+ <Space
+ android:layout_width="24dp"
+ android:layout_height="wrap_content"/>
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/security_settings_fingerprint_enroll_introduction_footer_message_2" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ android:paddingTop="24dp">
+
+ <ImageView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:contentDescription="@null"
+ android:src="@drawable/ic_fingerprint_24dp"/>
+ <Space
+ android:layout_width="24dp"
+ android:layout_height="wrap_content"/>
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/security_settings_fingerprint_enroll_introduction_footer_message_3" />
+ </LinearLayout>
+
</LinearLayout>
</LinearLayout>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 75884fa..eabbf8b 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -884,13 +884,21 @@
<!-- message shown in summary field when no fingerprints are registered -->
<string name="security_settings_fingerprint_preference_summary_none"></string>
<!-- Introduction title shown in fingerprint enrollment to introduce the fingerprint feature[CHAR LIMIT=29] -->
- <string name="security_settings_fingerprint_enroll_introduction_title">Unlock with fingerprint</string>
- <!-- Introduction title shown in fingerprint enrollment to introduce the fingerprint feature, when fingerprint unlock is disabed by device admin [CHAR LIMIT=40] -->
+ <string name="security_settings_fingerprint_enroll_introduction_title">Set up your fingerprint</string>
+ <!-- Introduction title shown in fingerprint enrollment to introduce the fingerprint feature, when fingerprint unlock is disabled by device admin [CHAR LIMIT=40] -->
<string name="security_settings_fingerprint_enroll_introduction_title_unlock_disabled">Use your fingerprint</string>
<!-- 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. Be careful whose fingerprints you add. Even one added print can do any of these things.</string>
+ <!-- Introduction title shown in the bottom of fingerprint enrollment dialog [CHAR LIMIT=NONE]-->
+ <string name="security_settings_fingerprint_enroll_introduction_footer_title_1">You\u2019re in control</string>
+ <!-- Introduction title shown in the bottom of fingerprint enrollment dialog [CHAR LIMIT=NONE]-->
+ <string name="security_settings_fingerprint_enroll_introduction_footer_title_2">Keep in mind</string>
<!-- Introduction detail message shown in the bottom of fingerprint enrollment dialog [CHAR LIMIT=NONE]-->
- <string name="security_settings_fingerprint_enroll_introduction_bottom_message">Your fingerprint may be less secure than a strong pattern or PIN.</string>
+ <string name="security_settings_fingerprint_enroll_introduction_footer_message_1">The data recorded by Fingerprint is stored securely and never leaves your phone. You can delete your data anytime in Settings.</string>
+ <!-- Introduction detail message shown in the bottom of fingerprint enrollment dialog [CHAR LIMIT=NONE]-->
+ <string name="security_settings_fingerprint_enroll_introduction_footer_message_2">Your fingerprint may be less secure than a strong pattern or PIN.</string>
+ <!-- Introduction detail message shown in the bottom of fingerprint enrollment dialog [CHAR LIMIT=NONE]-->
+ <string name="security_settings_fingerprint_enroll_introduction_footer_message_3" product="default">Your phone will occasionally use your recent fingerprint images to create improved fingerprint models.</string>
<!-- Introduction detail message shown in fingerprint enrollment dialog, when fingerprint unlock is disabled by device admin [CHAR LIMIT=NONE]-->
<string name="security_settings_fingerprint_enroll_introduction_message_unlock_disabled">Use your fingerprint to unlock your phone or approve purchases.\n\nNote: You can\u2019t use your fingerprint to unlock this device. For more information, contact your organization\u2019s admin.</string>
<!-- Introduction detail message shown in fingerprint enrollment screen in setup wizard. [CHAR LIMIT=NONE]-->
@@ -899,8 +907,12 @@
<string name="security_settings_fingerprint_enroll_introduction_cancel">Cancel</string>
<!-- Button text to cancel enrollment [CHAR LIMIT=30] -->
<string name="security_settings_fingerprint_enroll_introduction_no_thanks">No thanks</string>
+ <!-- Button text to skip enrollment [CHAR LIMIT=30] -->
+ <string name="security_settings_fingerprint_enroll_introduction_skip">Skip</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>
+ <!-- Button text to agree the consent and continue to the next screen from the introduction [CHAR LIMIT=22] -->
+ <string name="security_settings_fingerprint_enroll_introduction_agree">Agree</string>
<!-- Button text to cancel enrollment from the introduction (this string variant is used while in setup wizard) [CHAR LIMIT=22] -->
<string name="security_settings_fingerprint_enroll_introduction_cancel_setup">Skip</string>
<!-- Button text to continue to the next screen from the introduction (this string variant is used while in setup wizard) [CHAR LIMIT=22] -->
@@ -4482,13 +4494,13 @@
<!-- Manage applications, restore updated system application to factory version -->
<string name="app_factory_reset">Uninstall updates</string>
<!-- Manage applications, individual application info screen, screen, message text under Launch by default heading. This is present if the app is set as a default for some actions. -->
- <string name="auto_launch_enable_text">You\u2019ve chosen to launch this app by default for some actions.</string>
+ <string name="auto_launch_enable_text">Some activities you\u2019ve selected open in this app by default.</string>
<!-- Manage applications, individual application info screen, screen, message text under Launch by default heading. This is present if the app was given user permission to create widgets. -->
<string name="always_allow_bind_appwidgets_text">You\u2019ve chosen to allow this app to create widgets and access their data.</string>
<!-- Manage applications, individual application screen, text under Launch by default heading if the app is NOT a default for actions -->
<string name="auto_launch_disable_text">No defaults set.</string>
<!-- Manage applications, individual application screen, button label under Launch by default heading. This is used to clear any default actions that may be assigned to this app. -->
- <string name="clear_activities">Clear defaults</string>
+ <string name="clear_activities">Clear default preferences</string>
<!-- Manage applications, individual application info screen, screen, message text under screen compatibility heading -->
<string name="screen_compatibility_text">This app may not be designed for your screen. You can control how it
adjusts to your screen here.</string>
@@ -8773,8 +8785,10 @@
<!-- app summary of notification app list screen [CHAR LIMIT=100] -->
<string name="notifications_sent_never">Never</string>
- <!-- Sound & notification > Advanced section: Title for managing notification listeners option. [CHAR LIMIT=30] -->
- <string name="manage_notification_access_title">Notification access</string>
+ <!-- Sound & notification > Advanced section: Title for managing notification listeners option. [CHAR LIMIT=60] -->
+ <string name="manage_notification_access_title">Device & app notifications</string>
+
+ <string name="manage_notification_access_summary">Control which notifications show on your apps and devices</string>
<!-- Notification Access section: Indicates that the work profile admin doesn't allow this
notification listener to access work profile notifications [CHAR LIMIT=100] -->
@@ -8833,26 +8847,19 @@
<string name="notification_listener_disable_warning_confirm">Turn off</string>
<string name="notification_listener_disable_warning_cancel">Cancel</string>
<string name="notification_listener_type_title">Allowed notification types</string>
- <string name="notif_type_ongoing">Important ongoing notifications</string>
- <string name="notif_type_conversation">Conversation notifications</string>
- <string name="notif_type_alerting">Alerting notifications</string>
- <string name="notif_type_silent">Silent notifications</string>
-
- <!-- Per notification listener, launches a list of apps whose notifications this listener cannot see -->
- <string name="notif_listener_excluded_title">Apps that are not bridged to this listener</string>
-
- <!-- Per notification listener, when the listener can see notifications from all apps -->
- <string name="notif_listener_excluded_summary_zero">All apps are bridged</string>
-
- <!-- Per notification listener, a summary of how many apps this listener cannot see
- notifications from -->
- <plurals name="notif_listener_excluded_summary_nonzero">
- <item quantity="one">%d app is not bridged</item>
- <item quantity="other">%d apps are not bridged</item>
- </plurals>
+ <string name="notif_type_ongoing">Real-time</string>
+ <string name="notif_type_ongoing_summary">Real-time communication from apps in use, navigation, phone calls, and more</string>
+ <string name="notif_type_conversation">Conversations</string>
+ <string name="notif_type_conversation_summary">SMS and other communications</string>
+ <string name="notif_type_alerting">Default</string>
+ <string name="notif_type_alerting_summary">Notifications that may ring or vibrate based on settings</string>
+ <string name="notif_type_silent">Silent</string>
+ <string name="notif_type_silent_summary">Notifications that never make sound or vibrations</string>
<!-- Per notification listener, a list of apps whose notifications this listener cannot see -->
- <string name="notif_listener_excluded_app_title">Bridged apps</string>
+ <string name="notif_listener_excluded_app_title">See all apps</string>
+ <string name="notif_listener_excluded_app_summary">Change notification settings for each app that can send notifications</string>
+ <string name="notif_listener_excluded_app_screen_title">Apps shown on device</string>
<!-- Title for managing VR (virtual reality) helper services. [CHAR LIMIT=50] -->
<string name="vr_listeners_title">VR helper services</string>
@@ -9668,9 +9675,46 @@
<!-- Category name for App Launch -->
<string name="app_launch_domain_links_title">Opening links</string>
<string name="app_launch_open_domain_urls_title">Open supported links</string>
+ <!-- Preference title for Supported links open in this app. [CHAR LIMIT=60] -->
+ <string name="app_launch_top_intro_message">Supported links open in this app</string>
+ <!-- Preference title for Links to open in this app. [CHAR LIMIT=60] -->
+ <string name="app_launch_links_category">Links to open in this app</string>
+
<string name="app_launch_open_domain_urls_summary">Open without asking</string>
<string name="app_launch_supported_domain_urls_title">Supported links</string>
- <string name="app_launch_other_defaults_title">Other defaults</string>
+
+ <string name="app_launch_other_defaults_title">Other default preferences</string>
+ <!-- Preference title for Add link [CHAR LIMIT=60] -->
+ <string name="app_launch_add_link">Add link</string>
+ <!-- Footer for Open by default. [CHAR LIMIT=NONE] -->
+ <string name="app_launch_footer">An app can verify links to automatically open in the app. <annotation id="url">Learn more</annotation></string>
+
+ <!-- Title, message and button for verified links dialog. -->
+ <plurals name="app_launch_verified_links_title">
+ <item quantity="one"><xliff:g id="count">%d</xliff:g> verified link</item>
+ <item quantity="other"><xliff:g id="count">%d</xliff:g> verified links</item>
+ </plurals>
+ <plurals name="app_launch_verified_links_message">
+ <item quantity="one">This link is verified and automatically opens in this app.</item>
+ <item quantity="other">These links are verified and automatically open in this app.</item>
+ </plurals>
+ <!-- OK button for verified links dialog. [CHAR LIMIT=20] -->
+ <string name="app_launch_dialog_ok">OK</string>
+
+ <!-- Title for Checking other supported links dialog. [CHAR LIMIT=50] -->
+ <string name="app_launch_checking_links_title">Checking for other supported links\u2026</string>
+ <!-- Cancel button for Checking other supported links dialog. [CHAR LIMIT=20] -->
+ <string name="app_launch_dialog_cancel">Cancel</string>
+
+ <!-- Title and button for supported links dialog. -->
+ <plurals name="app_launch_supported_links_title">
+ <item quantity="one"><xliff:g id="count">%d</xliff:g> supported link</item>
+ <item quantity="other"><xliff:g id="count">%d</xliff:g> supported links</item>
+ </plurals>
+ <!-- Add button for supported links dialog. [CHAR LIMIT=20] -->
+ <string name="app_launch_supported_links_add">Add</string>
+ <!-- The subtext of the link title in supported links dialog. [CHAR LIMIT=30] -->
+ <string name="app_launch_supported_links_subtext">Opens in <xliff:g id="app_label" example="Reddit">%s</xliff:g></string>
<!-- Summary for app storage preference -->
<string name="storage_summary_format"><xliff:g id="size" example="30.00MB">%1$s</xliff:g> used in <xliff:g id="storage_type" example="internal memory">%2$s</xliff:g></string>
@@ -11481,8 +11525,10 @@
<!-- AutoFill strings -->
<!-- Preference label for choosing auto-fill service. [CHAR LIMIT=60] -->
<string name="autofill_app">Autofill service</string>
+ <!-- Preference category for showing auto-fill services with saved passwords. [CHAR LIMIT=60] -->
+ <string name="autofill_passwords">Passwords</string>
<!-- Keywords for the auto-fill feature. [CHAR LIMIT=NONE] -->
- <string name="autofill_keywords">auto, fill, autofill</string>
+ <string name="autofill_keywords">auto, fill, autofill, password</string>
<!-- Message of the warning dialog for setting the auto-fill app. [CHAR_LIMIT=NONE] -->
<string name="autofill_confirmation_message">
@@ -12627,10 +12673,8 @@
<string name="provider_internet_settings">Internet</string>
<!-- Provider Model: SIMs controls settings screen, item title to go into the SIMs settings -->
<string name="provider_network_settings_title">SIMs</string>
- <!-- Provider Model: Airplane mode networks controls settings screen -->
- <string name="airplane_safe_networks">Show airplane mode networks</string>
- <!-- Provider Model: Summary for showing airplane mode networks-->
- <string name="airplane_safe_networks_summary">Find and connect to networks in airplane mode.</string>
+ <!-- Provider Model: Summary for Wi-Fi switch [CHAR LIMIT=NONE] -->
+ <string name="wifi_switch_summary">Find and connect to Wi\u2011Fi networks</string>
<!-- Provider Model: List of synonyms for the airplane-safe networks, used to match in settings search [CHAR LIMIT=NONE] -->
<string name="keywords_airplane_safe_networks">airplane, airplane-safe</string>
<!-- Provider Model: Calls and SMS controllers settings screen, item title to go into the Calls and SMS settings -->
@@ -12805,4 +12849,7 @@
<string name="enable_2g_title">Allow 2G</string>
<!-- Title for toggle if user wants to enable 2G [CHAR LIMIT=NONE] -->
<string name="enable_2g_summary">Use 2G cellular connections. For emergency calls, 2G is always turned on.</string>
+
+ <!-- Label for extra app info settings for a specific app [CHAR LIMIT=40] -->
+ <string name="extra_app_info_label" translatable="false"></string>
</resources>
diff --git a/res/xml/app_info_settings_v2.xml b/res/xml/app_info_settings_v2.xml
index 805df59..574fc01 100644
--- a/res/xml/app_info_settings_v2.xml
+++ b/res/xml/app_info_settings_v2.xml
@@ -81,6 +81,11 @@
settings:controller="com.android.settings.applications.appinfo.AppDataUsagePreferenceController" />
<Preference
+ android:key="extra_app_info_settings"
+ android:title="@string/extra_app_info_label"
+ settings:controller="com.android.settings.applications.appinfo.ExtraAppInfoPreferenceController" />
+
+ <Preference
android:key="time_spent_in_app"
android:title="@string/time_spent_in_app_pref_title"
settings:controller="com.android.settings.applications.appinfo.TimeSpentInAppPreferenceController" />
diff --git a/res/xml/configure_notification_settings_v2.xml b/res/xml/configure_notification_settings_v2.xml
index 9029220..b7cc2c8 100644
--- a/res/xml/configure_notification_settings_v2.xml
+++ b/res/xml/configure_notification_settings_v2.xml
@@ -23,12 +23,14 @@
android:title="@string/conversation_notifs_category">
<Preference
android:key="conversations"
+ android:order="1"
android:title="@string/conversations_category_title"
settings:controller="com.android.settings.notification.ConversationListSummaryPreferenceController"
android:fragment="com.android.settings.notification.app.ConversationListSettings"
/>
<Preference
android:key="notification_bubbles"
+ android:order="2"
android:title="@string/notification_bubbles_title"
android:summary="@string/notifications_bubble_setting_on_summary"
settings:controller="com.android.settings.notification.BubbleSummaryNotificationPreferenceController"
@@ -44,6 +46,7 @@
<!-- See all apps button -->
<Preference
android:key="all_notifications"
+ android:order="10"
android:title="@string/notifications_title"
android:fragment="com.android.settings.applications.manageapplications.ManageApplications"
settings:searchable="false">
@@ -58,6 +61,7 @@
android:title="@string/lock_screen_notifications_title">
<Preference
android:key="notification_history"
+ android:order="11"
android:title="@string/notification_history"
android:summary="@string/notification_history_summary">
<intent
@@ -65,27 +69,38 @@
android:targetPackage="com.android.settings"
android:targetClass="com.android.settings.notification.history.NotificationHistoryActivity" />
</Preference>
+ <Preference
+ android:key="notification_access"
+ android:order="12"
+ android:title="@string/manage_notification_access_title"
+ android:summary="@string/manage_notification_access_summary"
+ android:fragment="com.android.settings.notification.NotificationAccessSettings"
+ settings:controller="com.android.settings.applications.specialaccess.notificationaccess.NotificationAccessController" />
<!-- When device is locked -->
<com.android.settings.RestrictedListPreference
android:key="lock_screen_notifications"
+ android:order="13"
android:title="@string/lock_screen_notifs_title"
android:singleLineTitle="false"
android:summary="@string/summary_placeholder" />
<SwitchPreference
android:key="lock_screen_redact"
+ android:order="14"
android:title="@string/lock_screen_notifs_redact"
android:summary="@string/lock_screen_notifs_redact_summary"
settings:controller="com.android.settings.notification.RedactNotificationPreferenceController" />
<SwitchPreference
android:key="lock_screen_work_redact"
+ android:order="15"
android:title="@string/lock_screen_notifs_redact_work"
android:summary="@string/lock_screen_notifs_redact_work_summary"
settings:controller="com.android.settings.notification.RedactNotificationPreferenceController" />
<SwitchPreference
android:key="notification_lockscreen_bypass"
+ android:order="16"
android:title="@string/lockscreen_bypass_title"
android:summary="@string/lockscreen_bypass_summary"
settings:searchable="false"
@@ -98,6 +113,7 @@
android:title="@string/advanced_section_header">
<com.android.settingslib.RestrictedPreference
android:key="zen_mode_notifications"
+ android:order="17"
android:title="@string/zen_mode_settings_title"
settings:useAdminDisabledSummary="true"
android:fragment="com.android.settings.notification.zen.ZenModeSettings"
@@ -105,6 +121,7 @@
/>
<com.android.settingslib.RestrictedPreference
android:key="app_and_notif_cell_broadcast_settings"
+ android:order="18"
android:title="@string/cell_broadcast_settings"
settings:useAdminDisabledSummary="true">
<intent
@@ -115,23 +132,27 @@
<SwitchPreference
android:key="silent_icons"
+ android:order="19"
android:title="@string/silent_notifications_status_bar"
settings:controller="com.android.settings.notification.SilentStatusBarPreferenceController"/>
<SwitchPreference
android:key="show_snooze_options"
+ android:order="20"
android:title="@string/snooze_options_title"
settings:controller="com.android.settings.notification.SnoozeNotificationPreferenceController" />
<!-- Notification badging -->
<SwitchPreference
android:key="notification_badging"
+ android:order="21"
android:title="@string/notification_badging_title"
settings:controller="com.android.settings.notification.BadgingNotificationPreferenceController"/>
<!-- Pulse notification light, on devices that support it -->
<SwitchPreference
android:key="notification_pulse"
+ android:order="22"
android:title="@string/notification_pulse_title"
settings:controller="com.android.settings.notification.PulseNotificationPreferenceController"/>
</PreferenceCategory>
diff --git a/res/xml/default_autofill_picker_settings.xml b/res/xml/default_autofill_picker_settings.xml
index bfc285b..392f733 100644
--- a/res/xml/default_autofill_picker_settings.xml
+++ b/res/xml/default_autofill_picker_settings.xml
@@ -22,14 +22,27 @@
android:title="@string/autofill_app"
settings:keywords="@string/autofill_keywords">
- <com.android.settings.widget.GearPreference
- android:key="default_autofill_main"
- android:title="@string/autofill_app"
- android:fragment="com.android.settings.applications.defaultapps.DefaultAutofillPicker"
- settings:searchable="false"
- settings:keywords="@string/autofill_keywords">
- <extra android:name="for_work" android:value="false" />
- </com.android.settings.widget.GearPreference>
+ <PreferenceCategory
+ android:key="passwords_category"
+ android:persistent="false"
+ android:title="@string/autofill_passwords"
+ settings:controller="com.android.settings.applications.autofill.PasswordsPreferenceController" >
+ </PreferenceCategory>
+
+ <PreferenceCategory
+ android:key="default_service_category"
+ android:title="@string/autofill_app">
+
+ <!-- TODO(b/169455298): Fix the redundant title. -->
+ <com.android.settings.widget.GearPreference
+ android:key="default_autofill_main"
+ android:title="@string/autofill_app"
+ android:fragment="com.android.settings.applications.defaultapps.DefaultAutofillPicker"
+ settings:searchable="false"
+ settings:keywords="@string/autofill_keywords">
+ <extra android:name="for_work" android:value="false" />
+ </com.android.settings.widget.GearPreference>
+ </PreferenceCategory>
<com.android.settings.widget.WorkOnlyCategory
diff --git a/res/xml/network_provider_internet.xml b/res/xml/network_provider_internet.xml
index 90a04f1..035026b 100644
--- a/res/xml/network_provider_internet.xml
+++ b/res/xml/network_provider_internet.xml
@@ -61,15 +61,6 @@
settings:controller="com.android.settings.network.AirplaneModePreferenceController"
settings:userRestriction="no_airplane_mode"/>
- <com.android.settingslib.RestrictedSwitchPreference
- android:key="airplane_safe_networks"
- android:title="@string/airplane_safe_networks"
- android:icon="@drawable/ic_airplane_safe_networks_24dp"
- android:summary="@string/airplane_safe_networks_summary"
- android:order="-4"
- settings:userRestriction="no_airplane_mode"
- settings:keywords="@string/keywords_airplane_safe_networks" />
-
<com.android.settingslib.RestrictedPreference
android:key="manage_mobile_plan"
android:title="@string/manage_mobile_plan_title"
diff --git a/res/xml/network_provider_settings.xml b/res/xml/network_provider_settings.xml
index 0a8dbaa..a824b34 100644
--- a/res/xml/network_provider_settings.xml
+++ b/res/xml/network_provider_settings.xml
@@ -56,6 +56,13 @@
android:key="access_points"
android:layout="@layout/preference_category_no_label"/>
+ <com.android.settingslib.RestrictedSwitchPreference
+ android:key="wifi_switch"
+ android:title="@string/wifi"
+ android:summary="@string/wifi_switch_summary"
+ settings:allowDividerAbove="true"
+ settings:keywords="@string/keywords_wifi"/>
+
<Preference
android:key="configure_wifi_settings"
android:title="@string/network_and_internet_preferences_title"
diff --git a/res/xml/notification_access_bridged_apps_settings.xml b/res/xml/notification_access_bridged_apps_settings.xml
index 590a468..535a040 100644
--- a/res/xml/notification_access_bridged_apps_settings.xml
+++ b/res/xml/notification_access_bridged_apps_settings.xml
@@ -19,7 +19,7 @@
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res-auto"
android:key="nonbridged_apps"
- android:title="@string/notif_listener_excluded_app_title"
+ android:title="@string/notif_listener_excluded_app_screen_title"
settings:controller="com.android.settings.applications.specialaccess.notificationaccess.BridgedAppsPreferenceController"
settings:searchable="false">
</PreferenceScreen>
diff --git a/res/xml/notification_access_permission_details.xml b/res/xml/notification_access_permission_details.xml
index 0b76430..c4bb7f0 100644
--- a/res/xml/notification_access_permission_details.xml
+++ b/res/xml/notification_access_permission_details.xml
@@ -34,27 +34,32 @@
<CheckBoxPreference
android:key="type_filter_ongoing"
android:title="@string/notif_type_ongoing"
+ android:summary="@string/notif_type_ongoing_summary"
android:icon="@drawable/ic_ongoing_notification"
settings:controller="com.android.settings.applications.specialaccess.notificationaccess.OngoingTypeFilterPreferenceController"/>
<CheckBoxPreference
android:key="type_filter_conversation"
android:title="@string/notif_type_conversation"
+ android:summary="@string/notif_type_conversation_summary"
android:icon="@drawable/ic_promote_conversation"
settings:controller="com.android.settings.applications.specialaccess.notificationaccess.ConversationTypeFilterPreferenceController"/>
<CheckBoxPreference
android:key="type_filter_alerting"
android:title="@string/notif_type_alerting"
+ android:summary="@string/notif_type_alerting_summary"
android:icon="@drawable/ic_notification_alert"
settings:controller="com.android.settings.applications.specialaccess.notificationaccess.AlertingTypeFilterPreferenceController"/>
<CheckBoxPreference
android:key="type_filter_silent"
android:title="@string/notif_type_silent"
+ android:summary="@string/notif_type_silent_summary"
android:icon="@drawable/ic_notification_silence"
settings:controller="com.android.settings.applications.specialaccess.notificationaccess.SilentTypeFilterPreferenceController"/>
<Preference
android:key="bridged_apps"
android:title="@string/notif_listener_excluded_app_title"
+ android:summary="@string/notif_listener_excluded_app_summary"
android:fragment="com.android.settings.applications.specialaccess.notificationaccess.BridgedAppsSettings"
settings:searchable="false"
settings:controller="com.android.settings.applications.specialaccess.notificationaccess.BridgedAppsPreferenceController" />
diff --git a/res/xml/power_usage_summary.xml b/res/xml/power_usage_summary.xml
index b5e414b..75bbca0 100644
--- a/res/xml/power_usage_summary.xml
+++ b/res/xml/power_usage_summary.xml
@@ -17,6 +17,7 @@
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res-auto"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
android:key="power_usage_summary_screen"
android:title="@string/power_usage_summary_title"
settings:keywords="@string/keywords_battery">
@@ -31,6 +32,7 @@
android:fragment="com.android.settings.fuelgauge.PowerUsageAdvanced"
android:key="battery_usage_summary"
android:title="@string/advanced_battery_preference_title"
+ app:iconSpaceReserved="false"
settings:searchable="false" />
<com.android.settings.widget.CardPreference
@@ -38,23 +40,27 @@
android:title="@string/summary_placeholder"
settings:controller="com.android.settings.fuelgauge.batterytip.BatteryTipPreferenceController" />
- <com.android.settings.widget.PrimarySwitchPreference
- android:fragment="com.android.settings.fuelgauge.batterysaver.BatterySaverSettings"
- android:key="battery_saver_summary"
- android:title="@string/battery_saver"
- settings:controller="com.android.settings.fuelgauge.BatterySaverController" />
+ <PreferenceCategory>
+ <SwitchPreference
+ android:key="battery_percentage"
+ android:title="@string/battery_percentage"
+ android:summary="@string/battery_percentage_description"
+ settings:controller="com.android.settings.display.BatteryPercentagePreferenceController" />
+ </PreferenceCategory>
- <SwitchPreference
- android:key="battery_percentage"
- android:title="@string/battery_percentage"
- android:summary="@string/battery_percentage_description"
- settings:controller="com.android.settings.display.BatteryPercentagePreferenceController" />
+ <PreferenceCategory>
+ <Preference
+ android:fragment="com.android.settings.fuelgauge.batterysaver.BatterySaverSettings"
+ android:key="battery_saver_summary"
+ android:title="@string/battery_saver"
+ settings:controller="com.android.settings.fuelgauge.BatterySaverController" />
- <Preference
- android:fragment="com.android.settings.fuelgauge.SmartBatterySettings"
- android:key="smart_battery_manager"
- android:title="@string/smart_battery_manager_title"
- settings:controller="com.android.settings.fuelgauge.batterytip.BatteryManagerPreferenceController" />
+ <Preference
+ android:fragment="com.android.settings.fuelgauge.SmartBatterySettings"
+ android:key="smart_battery_manager"
+ android:title="@string/smart_battery_manager_title"
+ settings:controller="com.android.settings.fuelgauge.batterytip.BatteryManagerPreferenceController" />
+ </PreferenceCategory>
<com.android.settingslib.widget.FooterPreference
android:key="power_usage_footer"
diff --git a/src/com/android/settings/applications/appinfo/AppInfoDashboardFragment.java b/src/com/android/settings/applications/appinfo/AppInfoDashboardFragment.java
index 6a86c71c..1878f5f 100755
--- a/src/com/android/settings/applications/appinfo/AppInfoDashboardFragment.java
+++ b/src/com/android/settings/applications/appinfo/AppInfoDashboardFragment.java
@@ -166,6 +166,9 @@
use(AppStoragePreferenceController.class).setParentFragment(this);
use(AppVersionPreferenceController.class).setParentFragment(this);
use(InstantAppDomainsPreferenceController.class).setParentFragment(this);
+ if (FeatureFlagUtils.isEnabled(context, FeatureFlags.SILKY_HOME)) {
+ use(ExtraAppInfoPreferenceController.class).setPackageName(packageName);
+ }
final WriteSystemSettingsPreferenceController writeSystemSettings =
use(WriteSystemSettingsPreferenceController.class);
diff --git a/src/com/android/settings/applications/appinfo/ExtraAppInfoFeatureProvider.java b/src/com/android/settings/applications/appinfo/ExtraAppInfoFeatureProvider.java
new file mode 100644
index 0000000..20938d1
--- /dev/null
+++ b/src/com/android/settings/applications/appinfo/ExtraAppInfoFeatureProvider.java
@@ -0,0 +1,37 @@
+/*
+ * 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.
+ */
+
+package com.android.settings.applications.appinfo;
+
+import android.content.Context;
+
+/**
+ * Provider for Extra App Info related feature
+ */
+public interface ExtraAppInfoFeatureProvider {
+ /** Returns true if the feature is supported. */
+ boolean isSupported(Context context);
+
+ /**
+ * Launch ExtraAppInfoSettings
+ */
+ void launchExtraAppInfoSettings(Context context);
+
+ /**
+ * Sets the package name
+ */
+ void setPackageName(String packageName);
+}
diff --git a/src/com/android/settings/applications/appinfo/ExtraAppInfoFeatureProviderImpl.java b/src/com/android/settings/applications/appinfo/ExtraAppInfoFeatureProviderImpl.java
new file mode 100644
index 0000000..3e5ef78
--- /dev/null
+++ b/src/com/android/settings/applications/appinfo/ExtraAppInfoFeatureProviderImpl.java
@@ -0,0 +1,40 @@
+/*
+ * 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.
+ */
+
+package com.android.settings.applications.appinfo;
+
+import android.content.Context;
+
+/**
+ * Provider for Extra App Info related feature
+ */
+public class ExtraAppInfoFeatureProviderImpl implements
+ ExtraAppInfoFeatureProvider {
+ @Override
+ public boolean isSupported(Context context) {
+ return false;
+ }
+
+ @Override
+ public void launchExtraAppInfoSettings(Context context) {
+ return;
+ }
+
+ @Override
+ public void setPackageName(String packageName) {
+ return;
+ }
+}
diff --git a/src/com/android/settings/applications/appinfo/ExtraAppInfoPreferenceController.java b/src/com/android/settings/applications/appinfo/ExtraAppInfoPreferenceController.java
new file mode 100644
index 0000000..0c1b3e3
--- /dev/null
+++ b/src/com/android/settings/applications/appinfo/ExtraAppInfoPreferenceController.java
@@ -0,0 +1,61 @@
+/*
+ * 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.
+ */
+
+package com.android.settings.applications.appinfo;
+
+import android.content.Context;
+import android.text.TextUtils;
+
+import androidx.preference.Preference;
+
+import com.android.settings.core.BasePreferenceController;
+import com.android.settings.overlay.FeatureFactory;
+
+/** Contains logic that deals with showing extra app info in app settings. */
+public class ExtraAppInfoPreferenceController extends BasePreferenceController {
+
+ private final ExtraAppInfoFeatureProvider mExtraAppInfoFeatureProvider;
+
+ public ExtraAppInfoPreferenceController(Context context, String key) {
+ super(context, key);
+ mExtraAppInfoFeatureProvider =
+ FeatureFactory.getFactory(context).getExtraAppInfoFeatureProvider();
+ }
+
+ @Override
+ public int getAvailabilityStatus() {
+ return mExtraAppInfoFeatureProvider.isSupported(mContext)
+ ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
+ }
+
+ @Override
+ public boolean handlePreferenceTreeClick(Preference preference) {
+ if (TextUtils.equals(getPreferenceKey(), preference.getKey())) {
+ mExtraAppInfoFeatureProvider.launchExtraAppInfoSettings(mContext);
+ return true;
+ }
+ return super.handlePreferenceTreeClick(preference);
+ }
+
+ /**
+ * Set the local package name
+ */
+ public void setPackageName(String packageName) {
+ if (mExtraAppInfoFeatureProvider != null) {
+ mExtraAppInfoFeatureProvider.setPackageName(packageName);
+ }
+ }
+}
diff --git a/src/com/android/settings/applications/assist/OWNERS b/src/com/android/settings/applications/assist/OWNERS
new file mode 100644
index 0000000..22e486d
--- /dev/null
+++ b/src/com/android/settings/applications/assist/OWNERS
@@ -0,0 +1,9 @@
+# Default reviewers for this and subdirectories.
+adamhe@google.com
+augale@google.com
+joannechung@google.com
+lpeter@google.com
+svetoslavganov@google.com
+tymtsai@google.com
+
+# Emergency approvers in case the above are not available
diff --git a/src/com/android/settings/applications/autofill/OWNERS b/src/com/android/settings/applications/autofill/OWNERS
new file mode 100644
index 0000000..22e486d
--- /dev/null
+++ b/src/com/android/settings/applications/autofill/OWNERS
@@ -0,0 +1,9 @@
+# Default reviewers for this and subdirectories.
+adamhe@google.com
+augale@google.com
+joannechung@google.com
+lpeter@google.com
+svetoslavganov@google.com
+tymtsai@google.com
+
+# Emergency approvers in case the above are not available
diff --git a/src/com/android/settings/applications/autofill/PasswordsPreferenceController.java b/src/com/android/settings/applications/autofill/PasswordsPreferenceController.java
new file mode 100644
index 0000000..792f2ee
--- /dev/null
+++ b/src/com/android/settings/applications/autofill/PasswordsPreferenceController.java
@@ -0,0 +1,94 @@
+/*
+ * 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.
+ */
+
+package com.android.settings.applications.autofill;
+
+import android.annotation.UserIdInt;
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.content.pm.ServiceInfo;
+import android.graphics.drawable.Drawable;
+import android.os.UserHandle;
+import android.service.autofill.AutofillServiceInfo;
+import android.text.TextUtils;
+import android.util.IconDrawableFactory;
+
+import androidx.preference.Preference;
+import androidx.preference.PreferenceGroup;
+import androidx.preference.PreferenceScreen;
+
+import com.android.settings.Utils;
+import com.android.settings.core.BasePreferenceController;
+
+import java.util.List;
+
+/**
+ * Queries available autofill services and adds preferences for those that declare passwords
+ * settings.
+ */
+public class PasswordsPreferenceController extends BasePreferenceController {
+
+ private final PackageManager mPm;
+ private final IconDrawableFactory mIconFactory;
+ private final List<AutofillServiceInfo> mServices;
+
+ public PasswordsPreferenceController(Context context, String preferenceKey) {
+ super(context, preferenceKey);
+ mPm = context.getPackageManager();
+ mIconFactory = IconDrawableFactory.newInstance(mContext);
+ mServices = AutofillServiceInfo.getAvailableServices(mContext, UserHandle.myUserId());
+ for (int i = mServices.size() - 1; i >= 0; i--) {
+ final String passwordsActivity = mServices.get(i).getPasswordsActivity();
+ if (TextUtils.isEmpty(passwordsActivity)) {
+ mServices.remove(i);
+ }
+ }
+ }
+
+ @Override
+ public int getAvailabilityStatus() {
+ return mServices.isEmpty() ? CONDITIONALLY_UNAVAILABLE : AVAILABLE;
+ }
+
+ @Override
+ public void displayPreference(PreferenceScreen screen) {
+ super.displayPreference(screen);
+ final PreferenceGroup group = screen.findPreference(getPreferenceKey());
+ // TODO(b/169455298): Show work profile passwords too.
+ addPasswordPreferences(screen.getContext(), UserHandle.myUserId(), group);
+ }
+
+ private void addPasswordPreferences(
+ Context prefContext, @UserIdInt int user, PreferenceGroup group) {
+ for (int i = 0; i < mServices.size(); i++) {
+ final AutofillServiceInfo service = mServices.get(i);
+ final Preference pref = new Preference(prefContext);
+ final ServiceInfo serviceInfo = service.getServiceInfo();
+ pref.setTitle(serviceInfo.loadLabel(mPm));
+ final Drawable icon =
+ mIconFactory.getBadgedIcon(
+ serviceInfo,
+ serviceInfo.applicationInfo,
+ user);
+ Utils.setSafeIcon(pref, icon);
+ pref.setIntent(
+ new Intent(Intent.ACTION_MAIN)
+ .setClassName(serviceInfo.packageName, service.getPasswordsActivity()));
+ group.addPreference(pref);
+ }
+ }
+}
diff --git a/src/com/android/settings/applications/specialaccess/notificationaccess/NotificationAccessDetails.java b/src/com/android/settings/applications/specialaccess/notificationaccess/NotificationAccessDetails.java
index 16aa078..1ac578d 100644
--- a/src/com/android/settings/applications/specialaccess/notificationaccess/NotificationAccessDetails.java
+++ b/src/com/android/settings/applications/specialaccess/notificationaccess/NotificationAccessDetails.java
@@ -60,7 +60,6 @@
private static final String TAG = "NotifAccessDetails";
private NotificationBackend mNm = new NotificationBackend();
- private NotificationListenerFilter mNlf;
private ComponentName mComponentName;
private CharSequence mServiceName;
protected ServiceInfo mServiceInfo;
@@ -157,13 +156,6 @@
Preference apps = getPreferenceScreen().findPreference(
use(BridgedAppsPreferenceController.class).getPreferenceKey());
if (apps != null) {
- mNlf = mNm.getListenerFilter(mComponentName, mUserId);
- int nonBridgedCount = mNlf.getDisallowedPackages().size();
- apps.setSummary(nonBridgedCount == 0 ?
- getString(R.string.notif_listener_excluded_summary_zero)
- : getResources().getQuantityString(
- R.plurals.notif_listener_excluded_summary_nonzero,
- nonBridgedCount, nonBridgedCount));
apps.setOnPreferenceClickListener(preference -> {
final Bundle args = new Bundle();
@@ -174,7 +166,7 @@
new SubSettingLauncher(getContext())
.setDestination(BridgedAppsSettings.class.getName())
.setSourceMetricsCategory(getMetricsCategory())
- .setTitleRes(R.string.notif_listener_excluded_app_title)
+ .setTitleRes(R.string.notif_listener_excluded_app_screen_title)
.setArguments(args)
.setUserHandle(UserHandle.of(mUserId))
.launch();
diff --git a/src/com/android/settings/biometrics/BiometricEnrollBase.java b/src/com/android/settings/biometrics/BiometricEnrollBase.java
index 7936f66..3fb8941 100644
--- a/src/com/android/settings/biometrics/BiometricEnrollBase.java
+++ b/src/com/android/settings/biometrics/BiometricEnrollBase.java
@@ -173,6 +173,10 @@
setHeaderText(resId, false /* force */);
}
+ protected void setDescriptionText(int resId) {
+ getLayout().setDescriptionText(resId);
+ }
+
protected FooterButton getNextButton() {
if (mFooterBarMixin != null) {
return mFooterBarMixin.getPrimaryButton();
diff --git a/src/com/android/settings/biometrics/BiometricEnrollIntroduction.java b/src/com/android/settings/biometrics/BiometricEnrollIntroduction.java
index 26df474..09344b0 100644
--- a/src/com/android/settings/biometrics/BiometricEnrollIntroduction.java
+++ b/src/com/android/settings/biometrics/BiometricEnrollIntroduction.java
@@ -309,9 +309,8 @@
protected void initViews() {
super.initViews();
- TextView description = (TextView) findViewById(R.id.sud_layout_description);
if (mBiometricUnlockDisabledByAdmin) {
- description.setText(getDescriptionResDisabledByAdmin());
+ setDescriptionText(getDescriptionResDisabledByAdmin());
}
}
}
diff --git a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollIntroduction.java b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollIntroduction.java
index 23a1133..0996a58 100644
--- a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollIntroduction.java
+++ b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollIntroduction.java
@@ -57,6 +57,8 @@
super.onCreate(savedInstanceState);
+ setDescriptionText(R.string.security_settings_fingerprint_enroll_introduction_message);
+
mFooterBarMixin = getLayout().getMixin(FooterBarMixin.class);
mFooterBarMixin.setSecondaryButton(
new FooterButton.Builder(this)
@@ -69,7 +71,7 @@
mFooterBarMixin.setPrimaryButton(
new FooterButton.Builder(this)
- .setText(R.string.wizard_next)
+ .setText(R.string.security_settings_fingerprint_enroll_introduction_agree)
.setListener(this::onNextButtonClick)
.setButtonType(FooterButton.ButtonType.NEXT)
.setTheme(R.style.SudGlifButton_Primary)
@@ -78,7 +80,7 @@
}
int getNegativeButtonTextId() {
- return R.string.security_settings_fingerprint_enroll_introduction_no_thanks;
+ return R.string.security_settings_fingerprint_enroll_introduction_skip;
}
@Override
diff --git a/src/com/android/settings/biometrics/fingerprint/SetupFingerprintEnrollIntroduction.java b/src/com/android/settings/biometrics/fingerprint/SetupFingerprintEnrollIntroduction.java
index c8a4c05..d767d53 100644
--- a/src/com/android/settings/biometrics/fingerprint/SetupFingerprintEnrollIntroduction.java
+++ b/src/com/android/settings/biometrics/fingerprint/SetupFingerprintEnrollIntroduction.java
@@ -18,22 +18,18 @@
import android.app.Activity;
import android.app.KeyguardManager;
-import android.app.admin.DevicePolicyManager;
import android.app.settings.SettingsEnums;
import android.content.Intent;
import android.hardware.fingerprint.FingerprintManager;
import android.os.Bundle;
import android.os.UserHandle;
-import android.os.storage.StorageManager;
import android.view.View;
-import android.widget.TextView;
import com.android.internal.widget.LockPatternUtils;
import com.android.settings.R;
import com.android.settings.SetupWizardUtils;
import com.android.settings.Utils;
import com.android.settings.biometrics.BiometricUtils;
-import com.android.settings.password.ChooseLockGeneric.ChooseLockGenericFragment;
import com.android.settings.password.ChooseLockSettingsHelper;
import com.android.settings.password.SetupChooseLockGeneric;
import com.android.settings.password.SetupSkipDialog;
@@ -86,8 +82,7 @@
protected void initViews() {
super.initViews();
- TextView description = (TextView) findViewById(R.id.sud_layout_description);
- description.setText(
+ setDescriptionText(
R.string.security_settings_fingerprint_enroll_introduction_message_setup);
FooterButton nextButton = getNextButton();
diff --git a/src/com/android/settings/connecteddevice/usb/UsbDefaultFragment.java b/src/com/android/settings/connecteddevice/usb/UsbDefaultFragment.java
index 668ec3f..de08f38 100644
--- a/src/com/android/settings/connecteddevice/usb/UsbDefaultFragment.java
+++ b/src/com/android/settings/connecteddevice/usb/UsbDefaultFragment.java
@@ -64,14 +64,24 @@
private UsbConnectionBroadcastReceiver mUsbReceiver;
private Handler mHandler = new Handler();
+ private boolean mIsConnected = false;
@VisibleForTesting
UsbConnectionBroadcastReceiver.UsbConnectionListener mUsbConnectionListener =
(connected, functions, powerRole, dataRole) -> {
+ final long defaultFunctions = mUsbBackend.getDefaultUsbFunctions();
+ Log.d(TAG, "UsbConnectionListener() connected : " + connected + ", functions : "
+ + functions + ", defaultFunctions : " + defaultFunctions);
+ if (connected && !mIsConnected && defaultFunctions == UsbManager.FUNCTION_RNDIS) {
+ startTethering();
+ }
+
if (mIsStartTethering) {
mCurrentFunctions = functions;
refresh(functions);
+ mIsStartTethering = false;
}
+ mIsConnected = connected;
};
@Override
@@ -146,9 +156,7 @@
if (functions == UsbManager.FUNCTION_RNDIS) {
// We need to have entitlement check for usb tethering, so use API in
// TetheringManager.
- mIsStartTethering = true;
- mTetheringManager.startTethering(TETHERING_USB, new HandlerExecutor(mHandler),
- mOnStartTetheringCallback);
+ startTethering();
} else {
mIsStartTethering = false;
mCurrentFunctions = functions;
@@ -159,6 +167,13 @@
return true;
}
+ private void startTethering() {
+ Log.d(TAG, "startTethering()");
+ mIsStartTethering = true;
+ mTetheringManager.startTethering(TETHERING_USB, new HandlerExecutor(mHandler),
+ mOnStartTetheringCallback);
+ }
+
@Override
public void onPause() {
super.onPause();
@@ -171,6 +186,7 @@
@Override
public void onTetheringStarted() {
+ Log.d(TAG, "onTetheringStarted()");
// Set default usb functions again to make internal data persistent
mCurrentFunctions = UsbManager.FUNCTION_RNDIS;
mUsbBackend.setDefaultUsbFunctions(UsbManager.FUNCTION_RNDIS);
diff --git a/src/com/android/settings/fuelgauge/BatterySaverController.java b/src/com/android/settings/fuelgauge/BatterySaverController.java
index a91f85c..fba163d 100644
--- a/src/com/android/settings/fuelgauge/BatterySaverController.java
+++ b/src/com/android/settings/fuelgauge/BatterySaverController.java
@@ -15,14 +15,21 @@
*/
package com.android.settings.fuelgauge;
+import android.content.ContentResolver;
import android.content.Context;
+import android.database.ContentObserver;
+import android.os.Handler;
+import android.os.Looper;
import android.os.PowerManager;
+import android.provider.Settings;
+import android.provider.Settings.Global;
-import androidx.annotation.VisibleForTesting;
+import androidx.preference.Preference;
import androidx.preference.PreferenceScreen;
-import com.android.settings.core.TogglePreferenceController;
-import com.android.settings.widget.PrimarySwitchPreference;
+import com.android.settings.R;
+import com.android.settings.Utils;
+import com.android.settings.core.BasePreferenceController;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.android.settingslib.core.lifecycle.events.OnStart;
import com.android.settingslib.core.lifecycle.events.OnStop;
@@ -31,14 +38,19 @@
/**
* Controller to update the battery saver entry preference.
*/
-public class BatterySaverController extends TogglePreferenceController
+public class BatterySaverController extends BasePreferenceController
implements LifecycleObserver, OnStart, OnStop, BatterySaverReceiver.BatterySaverListener {
private static final String KEY_BATTERY_SAVER = "battery_saver_summary";
private final BatterySaverReceiver mBatteryStateChangeReceiver;
private final PowerManager mPowerManager;
-
- @VisibleForTesting
- PrimarySwitchPreference mBatterySaverPref;
+ private Preference mBatterySaverPref;
+ private final ContentObserver mObserver = new ContentObserver(
+ new Handler(Looper.getMainLooper())) {
+ @Override
+ public void onChange(boolean selfChange) {
+ updateSummary();
+ }
+ };
public BatterySaverController(Context context) {
super(context, KEY_BATTERY_SAVER);
@@ -67,38 +79,54 @@
@Override
public void onStart() {
+ mContext.getContentResolver().registerContentObserver(
+ Settings.Global.getUriFor(Settings.Global.LOW_POWER_MODE_TRIGGER_LEVEL),
+ true /* notifyForDescendants */, mObserver);
mBatteryStateChangeReceiver.setListening(true);
+ updateSummary();
}
@Override
public void onStop() {
+ mContext.getContentResolver().unregisterContentObserver(mObserver);
mBatteryStateChangeReceiver.setListening(false);
}
@Override
- public void onPowerSaveModeChanged() {
- final boolean isChecked = isChecked();
- if (mBatterySaverPref != null && mBatterySaverPref.isChecked() != isChecked) {
- mBatterySaverPref.setChecked(isChecked);
+ public CharSequence getSummary() {
+ final boolean isPowerSaveOn = mPowerManager.isPowerSaveMode();
+ if (isPowerSaveOn) {
+ return mContext.getString(R.string.battery_saver_on_summary);
}
+
+ final ContentResolver resolver = mContext.getContentResolver();
+ final int mode = Settings.Global.getInt(resolver,
+ Global.AUTOMATIC_POWER_SAVE_MODE, PowerManager.POWER_SAVE_MODE_TRIGGER_PERCENTAGE);
+ if (mode == PowerManager.POWER_SAVE_MODE_TRIGGER_PERCENTAGE) {
+ final int percent = Settings.Global.getInt(resolver,
+ Settings.Global.LOW_POWER_MODE_TRIGGER_LEVEL, 0);
+ return percent != 0 ?
+ mContext.getString(R.string.battery_saver_off_scheduled_summary,
+ Utils.formatPercentage(percent)) :
+ mContext.getString(R.string.battery_saver_off_summary);
+ } else {
+ return mContext.getString(R.string.battery_saver_auto_routine);
+ }
+ }
+
+ private void updateSummary() {
+ if (mBatterySaverPref != null) {
+ mBatterySaverPref.setSummary(getSummary());
+ }
+ }
+
+ @Override
+ public void onPowerSaveModeChanged() {
+ updateSummary();
}
@Override
public void onBatteryChanged(boolean pluggedIn) {
- if (mBatterySaverPref != null) {
- mBatterySaverPref.setSwitchEnabled(!pluggedIn);
- }
- }
-
- @Override
- public boolean isChecked() {
- return mPowerManager.isPowerSaveMode();
- }
-
- @Override
- public boolean setChecked(boolean stateOn) {
- return BatterySaverUtils.setPowerSaveMode(mContext, stateOn,
- false /* needFirstTimeWarning */);
}
}
diff --git a/src/com/android/settings/network/AllowedNetworkTypesListener.java b/src/com/android/settings/network/AllowedNetworkTypesListener.java
index a11f3b4..a9ed8be 100644
--- a/src/com/android/settings/network/AllowedNetworkTypesListener.java
+++ b/src/com/android/settings/network/AllowedNetworkTypesListener.java
@@ -18,6 +18,7 @@
import android.content.Context;
import android.telephony.PhoneStateListener;
+import android.telephony.TelephonyCallback;
import android.telephony.TelephonyManager;
import android.util.Log;
@@ -28,14 +29,14 @@
/**
- * {@link PhoneStateListener} to listen to Allowed Network Types changed
+ * {@link TelephonyCallback} to listen to Allowed Network Types changed
*/
-public class AllowedNetworkTypesListener extends PhoneStateListener implements
- PhoneStateListener.AllowedNetworkTypesChangedListener {
+public class AllowedNetworkTypesListener extends TelephonyCallback implements
+ TelephonyCallback.AllowedNetworkTypesListener {
private static final String LOG_TAG = "NetworkModeListener";
@VisibleForTesting
- AllowedNetworkTypesListener.OnAllowedNetworkTypesChangedListener mListener;
+ OnAllowedNetworkTypesListener mListener;
private long mAllowedNetworkType = -1;
private Executor mExecutor;
@@ -44,7 +45,7 @@
mExecutor = executor;
}
- public void setAllowedNetworkTypesChangedListener(OnAllowedNetworkTypesChangedListener lsn) {
+ public void setAllowedNetworkTypesListener(OnAllowedNetworkTypesListener lsn) {
mListener = lsn;
}
@@ -56,7 +57,7 @@
public void register(Context context, int subId) {
TelephonyManager telephonyManager = context.getSystemService(
TelephonyManager.class).createForSubscriptionId(subId);
- telephonyManager.registerPhoneStateListener(mExecutor, this);
+ telephonyManager.registerTelephonyCallback(mExecutor, this);
}
/**
@@ -67,7 +68,7 @@
public void unregister(Context context, int subId) {
TelephonyManager telephonyManager = context.getSystemService(
TelephonyManager.class).createForSubscriptionId(subId);
- telephonyManager.unregisterPhoneStateListener(this);
+ telephonyManager.unregisterTelephonyCallback(this);
}
@Override
@@ -84,7 +85,7 @@
/**
* Listener for update of Preferred Network Mode change
*/
- public interface OnAllowedNetworkTypesChangedListener {
+ public interface OnAllowedNetworkTypesListener {
/**
* Notify the allowed network type changed.
*/
diff --git a/src/com/android/settings/network/NetworkDashboardFragment.java b/src/com/android/settings/network/NetworkDashboardFragment.java
index 14d85e9..f023ced 100644
--- a/src/com/android/settings/network/NetworkDashboardFragment.java
+++ b/src/com/android/settings/network/NetworkDashboardFragment.java
@@ -146,7 +146,6 @@
controllers.add(privateDnsPreferenceController);
if (Utils.isProviderModelEnabled(context)) {
controllers.add(new NetworkProviderCallsSmsController(context, lifecycle));
- controllers.add(new AirplaneSafeNetworksPreferenceController(context, lifecycle));
}
return controllers;
}
diff --git a/src/com/android/settings/network/NetworkProviderSettings.java b/src/com/android/settings/network/NetworkProviderSettings.java
index ebf59a2..4d6849b 100644
--- a/src/com/android/settings/network/NetworkProviderSettings.java
+++ b/src/com/android/settings/network/NetworkProviderSettings.java
@@ -196,6 +196,7 @@
private PreferenceCategory mWifiEntryPreferenceCategory;
@VisibleForTesting
AddWifiNetworkPreference mAddWifiNetworkPreference;
+ private WifiSwitchPreferenceController mWifiSwitchPreferenceController;
@VisibleForTesting
Preference mConfigureWifiSettingsPreference;
@VisibleForTesting
@@ -270,6 +271,7 @@
addNetworkMobileProviderController();
addViewAirplaneModeNetworksButtonController();
addConnectedEthernetNetworkController();
+ addWifiSwitchPreferenceController();
}
private void addNetworkMobileProviderController() {
@@ -298,6 +300,14 @@
mConnectedEthernetNetworkController.displayPreference(getPreferenceScreen());
}
+ private void addWifiSwitchPreferenceController() {
+ if (mWifiSwitchPreferenceController == null) {
+ mWifiSwitchPreferenceController =
+ new WifiSwitchPreferenceController(getContext(), getSettingsLifecycle());
+ }
+ mWifiSwitchPreferenceController.displayPreference(getPreferenceScreen());
+ }
+
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
diff --git a/src/com/android/settings/network/SubscriptionsPreferenceController.java b/src/com/android/settings/network/SubscriptionsPreferenceController.java
index 392ccc6..f89ccfd 100644
--- a/src/com/android/settings/network/SubscriptionsPreferenceController.java
+++ b/src/com/android/settings/network/SubscriptionsPreferenceController.java
@@ -257,9 +257,10 @@
}
private CharSequence getMobilePreferenceSummary(int subId) {
+ TelephonyManager tm = mTelephonyManager.createForSubscriptionId(subId);
String result = mSubsPrefCtrlInjector.getNetworkType(
mContext, mConfig, mTelephonyDisplayInfo, subId);
- if (!mTelephonyManager.isDataEnabled()) {
+ if (!tm.isDataEnabled()) {
return mContext.getString(R.string.mobile_data_off_summary);
}
if (!result.isEmpty() && mSubsPrefCtrlInjector.isActiveCellularNetwork(mContext)) {
diff --git a/src/com/android/settings/network/AirplaneSafeNetworksPreferenceController.java b/src/com/android/settings/network/WifiSwitchPreferenceController.java
similarity index 74%
rename from src/com/android/settings/network/AirplaneSafeNetworksPreferenceController.java
rename to src/com/android/settings/network/WifiSwitchPreferenceController.java
index fa80c38..2ee407a 100644
--- a/src/com/android/settings/network/AirplaneSafeNetworksPreferenceController.java
+++ b/src/com/android/settings/network/WifiSwitchPreferenceController.java
@@ -23,41 +23,41 @@
import androidx.lifecycle.OnLifecycleEvent;
import androidx.preference.PreferenceScreen;
-import com.android.settings.AirplaneModeEnabler;
import com.android.settings.overlay.FeatureFactory;
import com.android.settings.widget.GenericSwitchController;
import com.android.settings.wifi.WifiEnabler;
import com.android.settingslib.RestrictedSwitchPreference;
import com.android.settingslib.core.AbstractPreferenceController;
-public class AirplaneSafeNetworksPreferenceController extends AbstractPreferenceController
- implements LifecycleObserver, AirplaneModeEnabler.OnAirplaneModeChangedListener {
+/**
+ * This controller helps to manage the state of wifi switch preference.
+ */
+public class WifiSwitchPreferenceController extends AbstractPreferenceController implements
+ LifecycleObserver {
- private static final String PREFERENCE_KEY = "airplane_safe_networks";
+ public static final String KEY = "wifi_switch";
private RestrictedSwitchPreference mPreference;
- private AirplaneModeEnabler mAirplaneModeEnabler;
private WifiEnabler mWifiEnabler;
- public AirplaneSafeNetworksPreferenceController(Context context, Lifecycle lifecycle) {
+ public WifiSwitchPreferenceController(Context context, Lifecycle lifecycle) {
super(context);
if (lifecycle == null) {
throw new IllegalArgumentException("Lifecycle must be set");
}
- mAirplaneModeEnabler = new AirplaneModeEnabler(mContext, this);
lifecycle.addObserver(this);
}
@Override
public String getPreferenceKey() {
- return PREFERENCE_KEY;
+ return KEY;
}
@Override
public boolean isAvailable() {
- return mAirplaneModeEnabler.isAirplaneModeOn();
+ return true;
}
@Override
@@ -66,23 +66,24 @@
mPreference = screen.findPreference(getPreferenceKey());
}
+ /** Lifecycle.Event.ON_START */
@OnLifecycleEvent(Lifecycle.Event.ON_START)
public void onStart() {
- mAirplaneModeEnabler.start();
if (mPreference != null) {
mWifiEnabler = new WifiEnabler(mContext, new GenericSwitchController(mPreference),
FeatureFactory.getFactory(mContext).getMetricsFeatureProvider());
}
}
+ /** Lifecycle.Event.ON_STOP */
@OnLifecycleEvent(Lifecycle.Event.ON_STOP)
public void onStop() {
- mAirplaneModeEnabler.stop();
if (mWifiEnabler != null) {
mWifiEnabler.teardownSwitchController();
}
}
+ /** Lifecycle.Event.ON_RESUME */
@OnLifecycleEvent(Lifecycle.Event.ON_RESUME)
public void onResume() {
if (mWifiEnabler != null) {
@@ -90,17 +91,11 @@
}
}
+ /** Lifecycle.Event.ON_PAUSE */
@OnLifecycleEvent(Lifecycle.Event.ON_PAUSE)
public void onPause() {
if (mWifiEnabler != null) {
mWifiEnabler.pause();
}
}
-
- @Override
- public void onAirplaneModeChanged(boolean isAirplaneModeOn) {
- if (mPreference != null) {
- mPreference.setVisible(isAirplaneModeOn);
- }
- }
}
diff --git a/src/com/android/settings/network/telephony/Enable2gPreferenceController.java b/src/com/android/settings/network/telephony/Enable2gPreferenceController.java
index c780234..cf08d10 100644
--- a/src/com/android/settings/network/telephony/Enable2gPreferenceController.java
+++ b/src/com/android/settings/network/telephony/Enable2gPreferenceController.java
@@ -15,6 +15,7 @@
*/
package com.android.settings.network.telephony;
+import android.app.settings.SettingsEnums;
import android.content.Context;
import android.os.PersistableBundle;
import android.telephony.CarrierConfigManager;
@@ -22,6 +23,9 @@
import android.telephony.TelephonyManager;
import android.util.Log;
+import com.android.settings.overlay.FeatureFactory;
+import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
+
/**
* Preference controller for "Enable 2G"
*/
@@ -34,6 +38,8 @@
| TelephonyManager.NETWORK_TYPE_BITMASK_CDMA
| TelephonyManager.NETWORK_TYPE_BITMASK_1xRTT;
+ private final MetricsFeatureProvider mMetricsFeatureProvider;
+
private CarrierConfigManager mCarrierConfigManager;
private TelephonyManager mTelephonyManager;
@@ -46,6 +52,7 @@
public Enable2gPreferenceController(Context context, String key) {
super(context, key);
mCarrierConfigManager = context.getSystemService(CarrierConfigManager.class);
+ mMetricsFeatureProvider = FeatureFactory.getFactory(context).getMetricsFeatureProvider();
}
/**
@@ -98,6 +105,8 @@
}
mTelephonyManager.setAllowedNetworkTypesForReason(
mTelephonyManager.ALLOWED_NETWORK_TYPES_REASON_ENABLE_2G, newAllowedNetworkTypes);
+ mMetricsFeatureProvider.action(
+ mContext, SettingsEnums.ACTION_2G_ENABLED, isChecked);
return true;
}
}
diff --git a/src/com/android/settings/network/telephony/EnabledNetworkModePreferenceController.java b/src/com/android/settings/network/telephony/EnabledNetworkModePreferenceController.java
index 5680bf6..f0d4a43 100644
--- a/src/com/android/settings/network/telephony/EnabledNetworkModePreferenceController.java
+++ b/src/com/android/settings/network/telephony/EnabledNetworkModePreferenceController.java
@@ -151,7 +151,7 @@
if (mAllowedNetworkTypesListener == null) {
mAllowedNetworkTypesListener = new AllowedNetworkTypesListener(
mContext.getMainExecutor());
- mAllowedNetworkTypesListener.setAllowedNetworkTypesChangedListener(
+ mAllowedNetworkTypesListener.setAllowedNetworkTypesListener(
() -> updatePreference());
}
diff --git a/src/com/android/settings/network/telephony/NetworkPreferenceCategoryController.java b/src/com/android/settings/network/telephony/NetworkPreferenceCategoryController.java
index 25651f5..4ebcb7a 100644
--- a/src/com/android/settings/network/telephony/NetworkPreferenceCategoryController.java
+++ b/src/com/android/settings/network/telephony/NetworkPreferenceCategoryController.java
@@ -45,7 +45,7 @@
mSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
mAllowedNetworkTypesListener = new AllowedNetworkTypesListener(
context.getMainExecutor());
- mAllowedNetworkTypesListener.setAllowedNetworkTypesChangedListener(
+ mAllowedNetworkTypesListener.setAllowedNetworkTypesListener(
() -> updatePreference());
}
diff --git a/src/com/android/settings/network/telephony/NetworkProviderWorker.java b/src/com/android/settings/network/telephony/NetworkProviderWorker.java
index 9e23c7c..57f17b5 100644
--- a/src/com/android/settings/network/telephony/NetworkProviderWorker.java
+++ b/src/com/android/settings/network/telephony/NetworkProviderWorker.java
@@ -25,9 +25,9 @@
import android.net.Uri;
import android.os.Handler;
import android.os.Looper;
-import android.telephony.PhoneStateListener;
import android.telephony.ServiceState;
import android.telephony.SubscriptionManager;
+import android.telephony.TelephonyCallback;
import android.telephony.TelephonyDisplayInfo;
import android.telephony.TelephonyManager;
import android.util.Log;
@@ -62,7 +62,7 @@
private final Context mContext;
final Handler mHandler;
@VisibleForTesting
- final PhoneStateListener mPhoneStateListener;
+ final NetworkProviderTelephonyCallback mTelephonyCallback;
private TelephonyManager mTelephonyManager;
private Config mConfig = null;
private TelephonyDisplayInfo mTelephonyDisplayInfo =
@@ -82,7 +82,7 @@
mTelephonyManager = mContext.getSystemService(
TelephonyManager.class).createForSubscriptionId(mDefaultDataSubid);
- mPhoneStateListener = new NetworkProviderPhoneStateListener();
+ mTelephonyCallback = new NetworkProviderTelephonyCallback();
mSubscriptionsListener = new SubscriptionsChangeListener(context, this);
mDataEnabledListener = new MobileDataEnabledListener(context, this);
mConnectivityListener = new DataConnectivityListener(context, this);
@@ -100,7 +100,7 @@
mDataEnabledListener.start(mDefaultDataSubid);
mConnectivityListener.start();
mSignalStrengthListener.resume();
- mTelephonyManager.registerPhoneStateListener(mHandler::post, mPhoneStateListener);
+ mTelephonyManager.registerTelephonyCallback(mHandler::post, mTelephonyCallback);
super.onSlicePinned();
}
@@ -111,7 +111,7 @@
mDataEnabledListener.stop();
mConnectivityListener.stop();
mSignalStrengthListener.pause();
- mTelephonyManager.unregisterPhoneStateListener(mPhoneStateListener);
+ mTelephonyManager.unregisterTelephonyCallback(mTelephonyCallback);
super.onSliceUnpinned();
}
@@ -141,12 +141,12 @@
return;
}
if (SubscriptionManager.isUsableSubscriptionId(defaultDataSubId)) {
- mTelephonyManager.unregisterPhoneStateListener(mPhoneStateListener);
+ mTelephonyManager.unregisterTelephonyCallback(mTelephonyCallback);
mMobileDataObserver.unregister(mContext);
mSignalStrengthListener.updateSubscriptionIds(Collections.singleton(defaultDataSubId));
mTelephonyManager = mTelephonyManager.createForSubscriptionId(defaultDataSubId);
- mTelephonyManager.registerPhoneStateListener(mHandler::post, mPhoneStateListener);
+ mTelephonyManager.registerTelephonyCallback(mHandler::post, mTelephonyCallback);
mMobileDataObserver.register(mContext, mDefaultDataSubid);
mConfig = getConfig(mContext);
} else {
@@ -216,10 +216,10 @@
}
}
- class NetworkProviderPhoneStateListener extends PhoneStateListener implements
- PhoneStateListener.DataConnectionStateChangedListener,
- PhoneStateListener.DisplayInfoChangedListener,
- PhoneStateListener.ServiceStateChangedListener {
+ class NetworkProviderTelephonyCallback extends TelephonyCallback implements
+ TelephonyCallback.DataConnectionStateListener,
+ TelephonyCallback.DisplayInfoListener,
+ TelephonyCallback.ServiceStateListener {
@Override
public void onServiceStateChanged(ServiceState state) {
Log.d(TAG, "onServiceStateChanged voiceState=" + state.getState()
diff --git a/src/com/android/settings/network/telephony/cdma/CdmaBasePreferenceController.java b/src/com/android/settings/network/telephony/cdma/CdmaBasePreferenceController.java
index 06c3edb..4d1d319 100644
--- a/src/com/android/settings/network/telephony/cdma/CdmaBasePreferenceController.java
+++ b/src/com/android/settings/network/telephony/cdma/CdmaBasePreferenceController.java
@@ -77,7 +77,7 @@
if (mAllowedNetworkTypesListener == null) {
mAllowedNetworkTypesListener = new AllowedNetworkTypesListener(
mContext.getMainExecutor());
- mAllowedNetworkTypesListener.setAllowedNetworkTypesChangedListener(
+ mAllowedNetworkTypesListener.setAllowedNetworkTypesListener(
() -> updatePreference());
}
}
diff --git a/src/com/android/settings/network/telephony/gsm/AutoSelectPreferenceController.java b/src/com/android/settings/network/telephony/gsm/AutoSelectPreferenceController.java
index 19302da..997235c 100644
--- a/src/com/android/settings/network/telephony/gsm/AutoSelectPreferenceController.java
+++ b/src/com/android/settings/network/telephony/gsm/AutoSelectPreferenceController.java
@@ -81,7 +81,7 @@
mUiHandler = new Handler(Looper.getMainLooper());
mAllowedNetworkTypesListener = new AllowedNetworkTypesListener(
new HandlerExecutor(mUiHandler));
- mAllowedNetworkTypesListener.setAllowedNetworkTypesChangedListener(
+ mAllowedNetworkTypesListener.setAllowedNetworkTypesListener(
() -> updatePreference());
}
diff --git a/src/com/android/settings/network/telephony/gsm/OpenNetworkSelectPagePreferenceController.java b/src/com/android/settings/network/telephony/gsm/OpenNetworkSelectPagePreferenceController.java
index 1b77c6d..cdeb1e5 100644
--- a/src/com/android/settings/network/telephony/gsm/OpenNetworkSelectPagePreferenceController.java
+++ b/src/com/android/settings/network/telephony/gsm/OpenNetworkSelectPagePreferenceController.java
@@ -60,7 +60,7 @@
mSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
mAllowedNetworkTypesListener = new AllowedNetworkTypesListener(
context.getMainExecutor());
- mAllowedNetworkTypesListener.setAllowedNetworkTypesChangedListener(
+ mAllowedNetworkTypesListener.setAllowedNetworkTypesListener(
() -> updatePreference());
}
diff --git a/src/com/android/settings/overlay/FeatureFactory.java b/src/com/android/settings/overlay/FeatureFactory.java
index a15075e..42d98e0 100644
--- a/src/com/android/settings/overlay/FeatureFactory.java
+++ b/src/com/android/settings/overlay/FeatureFactory.java
@@ -25,6 +25,7 @@
import com.android.settings.R;
import com.android.settings.accounts.AccountFeatureProvider;
import com.android.settings.applications.ApplicationFeatureProvider;
+import com.android.settings.applications.appinfo.ExtraAppInfoFeatureProvider;
import com.android.settings.aware.AwareFeatureProvider;
import com.android.settings.biometrics.face.FaceFeatureProvider;
import com.android.settings.bluetooth.BluetoothFeatureProvider;
@@ -149,6 +150,11 @@
*/
public abstract WifiTrackerLibProvider getWifiTrackerLibProvider();
+ /**
+ * Retrieve implementation for Extra App Info feature.
+ */
+ public abstract ExtraAppInfoFeatureProvider getExtraAppInfoFeatureProvider();
+
public static final class FactoryNotFoundException extends RuntimeException {
public FactoryNotFoundException(Throwable throwable) {
super("Unable to create factory. Did you misconfigure Proguard?", throwable);
diff --git a/src/com/android/settings/overlay/FeatureFactoryImpl.java b/src/com/android/settings/overlay/FeatureFactoryImpl.java
index a1b70d9..46b263a 100644
--- a/src/com/android/settings/overlay/FeatureFactoryImpl.java
+++ b/src/com/android/settings/overlay/FeatureFactoryImpl.java
@@ -29,6 +29,8 @@
import com.android.settings.accounts.AccountFeatureProviderImpl;
import com.android.settings.applications.ApplicationFeatureProvider;
import com.android.settings.applications.ApplicationFeatureProviderImpl;
+import com.android.settings.applications.appinfo.ExtraAppInfoFeatureProvider;
+import com.android.settings.applications.appinfo.ExtraAppInfoFeatureProviderImpl;
import com.android.settings.aware.AwareFeatureProvider;
import com.android.settings.aware.AwareFeatureProviderImpl;
import com.android.settings.biometrics.face.FaceFeatureProvider;
@@ -94,6 +96,7 @@
private AwareFeatureProvider mAwareFeatureProvider;
private FaceFeatureProvider mFaceFeatureProvider;
private WifiTrackerLibProvider mWifiTrackerLibProvider;
+ private ExtraAppInfoFeatureProvider mExtraAppInfoFeatureProvider;
@Override
public SupportFeatureProvider getSupportFeatureProvider(Context context) {
@@ -291,4 +294,12 @@
}
return mWifiTrackerLibProvider;
}
+
+ @Override
+ public ExtraAppInfoFeatureProvider getExtraAppInfoFeatureProvider() {
+ if (mExtraAppInfoFeatureProvider == null) {
+ mExtraAppInfoFeatureProvider = new ExtraAppInfoFeatureProviderImpl();
+ }
+ return mExtraAppInfoFeatureProvider;
+ }
}
diff --git a/src/com/android/settings/wifi/WifiConfigController.java b/src/com/android/settings/wifi/WifiConfigController.java
index b2eca78..ee2abf8 100644
--- a/src/com/android/settings/wifi/WifiConfigController.java
+++ b/src/com/android/settings/wifi/WifiConfigController.java
@@ -536,8 +536,9 @@
} else {
enabled = ipAndProxyFieldsAreValid();
}
- if ((mAccessPointSecurity == AccessPoint.SECURITY_EAP ||
- mAccessPointSecurity == AccessPoint.SECURITY_EAP_SUITE_B)
+ if ((mAccessPointSecurity == AccessPoint.SECURITY_EAP
+ || mAccessPointSecurity == AccessPoint.SECURITY_EAP_WPA3_ENTERPRISE
+ || mAccessPointSecurity == AccessPoint.SECURITY_EAP_SUITE_B)
&& mEapCaCertSpinner != null
&& mView.findViewById(R.id.l_ca_cert).getVisibility() != View.GONE) {
String caCertSelection = (String) mEapCaCertSpinner.getSelectedItem();
@@ -553,8 +554,9 @@
enabled = false;
}
}
- if ((mAccessPointSecurity == AccessPoint.SECURITY_EAP ||
- mAccessPointSecurity == AccessPoint.SECURITY_EAP_SUITE_B)
+ if ((mAccessPointSecurity == AccessPoint.SECURITY_EAP
+ || mAccessPointSecurity == AccessPoint.SECURITY_EAP_WPA3_ENTERPRISE
+ || mAccessPointSecurity == AccessPoint.SECURITY_EAP_SUITE_B)
&& mEapUserCertSpinner != null
&& mView.findViewById(R.id.l_user_cert).getVisibility() != View.GONE
&& mEapUserCertSpinner.getSelectedItem().equals(mUnspecifiedCertString)) {
@@ -651,10 +653,13 @@
break;
case AccessPoint.SECURITY_EAP:
+ case AccessPoint.SECURITY_EAP_WPA3_ENTERPRISE:
case AccessPoint.SECURITY_EAP_SUITE_B:
if (mAccessPointSecurity == AccessPoint.SECURITY_EAP_SUITE_B) {
// allowedSuiteBCiphers will be set according to certificate type
config.setSecurityParams(WifiConfiguration.SECURITY_TYPE_EAP_SUITE_B);
+ } else if (mAccessPointSecurity == AccessPoint.SECURITY_EAP_WPA3_ENTERPRISE) {
+ config.setSecurityParams(WifiConfiguration.SECURITY_TYPE_EAP_WPA3_ENTERPRISE);
} else {
config.setSecurityParams(WifiConfiguration.SECURITY_TYPE_EAP);
}
@@ -1693,9 +1698,14 @@
if (mWifiManager.isWpa3SaeSupported()) {
spinnerAdapter.add(mContext.getString(R.string.wifi_security_sae));
mSecurityInPosition[idx++] = AccessPoint.SECURITY_SAE;
+ spinnerAdapter.add(mContext.getString(R.string.wifi_security_eap_wpa_wpa2));
+ mSecurityInPosition[idx++] = AccessPoint.SECURITY_EAP;
+ spinnerAdapter.add(mContext.getString(R.string.wifi_security_eap_wpa3));
+ mSecurityInPosition[idx++] = AccessPoint.SECURITY_EAP_WPA3_ENTERPRISE;
+ } else {
+ spinnerAdapter.add(mContext.getString(R.string.wifi_security_eap));
+ mSecurityInPosition[idx++] = AccessPoint.SECURITY_EAP;
}
- spinnerAdapter.add(mContext.getString(R.string.wifi_security_eap));
- mSecurityInPosition[idx++] = AccessPoint.SECURITY_EAP;
if (mWifiManager.isWpa3SuiteBSupported()) {
spinnerAdapter.add(mContext.getString(R.string.wifi_security_eap_suiteb));
mSecurityInPosition[idx++] = AccessPoint.SECURITY_EAP_SUITE_B;
diff --git a/src/com/android/settings/wifi/WifiConfigController2.java b/src/com/android/settings/wifi/WifiConfigController2.java
index b4e26a6..32152de 100644
--- a/src/com/android/settings/wifi/WifiConfigController2.java
+++ b/src/com/android/settings/wifi/WifiConfigController2.java
@@ -500,6 +500,7 @@
enabled = ipAndProxyFieldsAreValid();
}
if ((mWifiEntrySecurity == WifiEntry.SECURITY_EAP
+ || mWifiEntrySecurity == WifiEntry.SECURITY_EAP_WPA3_ENTERPRISE
|| mWifiEntrySecurity == WifiEntry.SECURITY_EAP_SUITE_B)
&& mEapCaCertSpinner != null
&& mView.findViewById(R.id.l_ca_cert).getVisibility() != View.GONE) {
@@ -517,6 +518,7 @@
}
}
if ((mWifiEntrySecurity == WifiEntry.SECURITY_EAP
+ || mWifiEntrySecurity == WifiEntry.SECURITY_EAP_WPA3_ENTERPRISE
|| mWifiEntrySecurity == WifiEntry.SECURITY_EAP_SUITE_B)
&& mEapUserCertSpinner != null
&& mView.findViewById(R.id.l_user_cert).getVisibility() != View.GONE
@@ -615,10 +617,13 @@
break;
case WifiEntry.SECURITY_EAP:
+ case WifiEntry.SECURITY_EAP_WPA3_ENTERPRISE:
case WifiEntry.SECURITY_EAP_SUITE_B:
if (mWifiEntrySecurity == WifiEntry.SECURITY_EAP_SUITE_B) {
// allowedSuiteBCiphers will be set according to certificate type
config.setSecurityParams(WifiConfiguration.SECURITY_TYPE_EAP_SUITE_B);
+ } else if (mWifiEntrySecurity == WifiEntry.SECURITY_EAP_WPA3_ENTERPRISE) {
+ config.setSecurityParams(WifiConfiguration.SECURITY_TYPE_EAP_WPA3_ENTERPRISE);
} else {
config.setSecurityParams(WifiConfiguration.SECURITY_TYPE_EAP);
}
@@ -942,6 +947,7 @@
}
if (mWifiEntrySecurity != WifiEntry.SECURITY_EAP
+ && mWifiEntrySecurity != WifiEntry.SECURITY_EAP_WPA3_ENTERPRISE
&& mWifiEntrySecurity != WifiEntry.SECURITY_EAP_SUITE_B) {
mView.findViewById(R.id.eap).setVisibility(View.GONE);
return;
@@ -1660,9 +1666,14 @@
if (mWifiManager.isWpa3SaeSupported()) {
spinnerAdapter.add(mContext.getString(R.string.wifi_security_sae));
mSecurityInPosition[idx++] = WifiEntry.SECURITY_SAE;
+ spinnerAdapter.add(mContext.getString(R.string.wifi_security_eap_wpa_wpa2));
+ mSecurityInPosition[idx++] = WifiEntry.SECURITY_EAP;
+ spinnerAdapter.add(mContext.getString(R.string.wifi_security_eap_wpa3));
+ mSecurityInPosition[idx++] = WifiEntry.SECURITY_EAP_WPA3_ENTERPRISE;
+ } else {
+ spinnerAdapter.add(mContext.getString(R.string.wifi_security_eap));
+ mSecurityInPosition[idx++] = WifiEntry.SECURITY_EAP;
}
- spinnerAdapter.add(mContext.getString(R.string.wifi_security_eap));
- mSecurityInPosition[idx++] = WifiEntry.SECURITY_EAP;
if (mWifiManager.isWpa3SuiteBSupported()) {
spinnerAdapter.add(mContext.getString(R.string.wifi_security_eap_suiteb));
mSecurityInPosition[idx++] = WifiEntry.SECURITY_EAP_SUITE_B;
diff --git a/tests/robotests/src/com/android/settings/applications/appinfo/ExtraAppInfoPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/applications/appinfo/ExtraAppInfoPreferenceControllerTest.java
new file mode 100644
index 0000000..f413908
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/applications/appinfo/ExtraAppInfoPreferenceControllerTest.java
@@ -0,0 +1,46 @@
+/*
+ * 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.
+ */
+
+package com.android.settings.applications.appinfo;
+
+import static com.android.settings.core.BasePreferenceController.UNSUPPORTED_ON_DEVICE;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.content.Context;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.robolectric.RobolectricTestRunner;
+import org.robolectric.RuntimeEnvironment;
+
+@RunWith(RobolectricTestRunner.class)
+public class ExtraAppInfoPreferenceControllerTest {
+ private Context mContext;
+ private ExtraAppInfoPreferenceController mController;
+
+ @Before
+ public void setUp() {
+ mContext = RuntimeEnvironment.application;
+ mController = new ExtraAppInfoPreferenceController(mContext, "test_key");
+ }
+
+ @Test
+ public void getAvailabilityStatus_unavailableByDefault() {
+ assertThat(mController.getAvailabilityStatus()).isEqualTo(UNSUPPORTED_ON_DEVICE);
+ }
+}
diff --git a/tests/robotests/src/com/android/settings/applications/assist/OWNERS b/tests/robotests/src/com/android/settings/applications/assist/OWNERS
new file mode 100644
index 0000000..bf069f4
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/applications/assist/OWNERS
@@ -0,0 +1 @@
+include /src/com/android/settings/applications/assist/OWNERS
diff --git a/tests/robotests/src/com/android/settings/connecteddevice/usb/UsbDefaultFragmentTest.java b/tests/robotests/src/com/android/settings/connecteddevice/usb/UsbDefaultFragmentTest.java
index c751e98..3108150 100644
--- a/tests/robotests/src/com/android/settings/connecteddevice/usb/UsbDefaultFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/connecteddevice/usb/UsbDefaultFragmentTest.java
@@ -224,6 +224,32 @@
assertThat(mFragment.mCurrentFunctions).isEqualTo(UsbManager.FUNCTION_MIDI);
}
+ @Test
+ public void usbIsPluginAndUsbTetheringIsOn_startTetheringIsInvoked() {
+ when(mUsbBackend.getDefaultUsbFunctions()).thenReturn(UsbManager.FUNCTION_RNDIS);
+
+ mFragment.mUsbConnectionListener.onUsbConnectionChanged(false /* connected */,
+ UsbManager.FUNCTION_RNDIS, POWER_ROLE_SINK, DATA_ROLE_DEVICE);
+ mFragment.mUsbConnectionListener.onUsbConnectionChanged(true /* connected */,
+ UsbManager.FUNCTION_RNDIS, POWER_ROLE_SINK, DATA_ROLE_DEVICE);
+
+ verify(mTetheringManager).startTethering(eq(TetheringManager.TETHERING_USB),
+ any(),
+ eq(mFragment.mOnStartTetheringCallback));
+ }
+
+ @Test
+ public void usbIsNotPluginAndUsbTetheringIsOn_startTetheringIsNotInvoked() {
+ when(mUsbBackend.getDefaultUsbFunctions()).thenReturn(UsbManager.FUNCTION_RNDIS);
+
+ mFragment.mUsbConnectionListener.onUsbConnectionChanged(false /* connected */,
+ UsbManager.FUNCTION_RNDIS, POWER_ROLE_SINK, DATA_ROLE_DEVICE);
+
+ verify(mTetheringManager, never()).startTethering(eq(TetheringManager.TETHERING_USB),
+ any(),
+ eq(mFragment.mOnStartTetheringCallback));
+ }
+
public static class TestFragment extends UsbDefaultFragment {
public final PreferenceScreen mScreen;
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/BatterySaverControllerTest.java b/tests/robotests/src/com/android/settings/fuelgauge/BatterySaverControllerTest.java
index 4d2910e..b3b8196 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/BatterySaverControllerTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/BatterySaverControllerTest.java
@@ -17,20 +17,15 @@
import static com.google.common.truth.Truth.assertThat;
-import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import android.content.Context;
import android.os.PowerManager;
-import android.view.LayoutInflater;
-import android.widget.LinearLayout;
+import android.provider.Settings;
-import androidx.preference.PreferenceViewHolder;
-
-import com.android.settings.R;
-import com.android.settings.widget.PrimarySwitchPreference;
+import androidx.preference.Preference;
import org.junit.Before;
import org.junit.Test;
@@ -39,108 +34,84 @@
import org.mockito.MockitoAnnotations;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.RuntimeEnvironment;
+import org.robolectric.util.ReflectionHelpers;
@RunWith(RobolectricTestRunner.class)
public class BatterySaverControllerTest {
@Mock
+ private Preference mBatterySaverPref;
+ @Mock
private PowerManager mPowerManager;
private BatterySaverController mBatterySaverController;
- private PrimarySwitchPreference mBatterySaverPref;
+ private Context mContext;
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
- final Context mContext = spy(RuntimeEnvironment.application);
- mBatterySaverPref = new PrimarySwitchPreference(mContext);
- final LayoutInflater inflater = LayoutInflater.from(mContext);
- final PreferenceViewHolder mHolder =
- PreferenceViewHolder.createInstanceForTests(inflater.inflate(
- com.android.settingslib.R.layout.preference_two_target, null));
- final LinearLayout mWidgetView = mHolder.itemView.findViewById(android.R.id.widget_frame);
- inflater.inflate(R.layout.restricted_preference_widget_primary_switch, mWidgetView, true);
- mBatterySaverPref.onBindViewHolder(mHolder);
+ mContext = RuntimeEnvironment.application;
+ mBatterySaverController = spy(new BatterySaverController(mContext));
+ ReflectionHelpers.setField(mBatterySaverController, "mPowerManager", mPowerManager);
+ ReflectionHelpers.setField(mBatterySaverController, "mBatterySaverPref", mBatterySaverPref);
- doReturn(mPowerManager).when(mContext).getSystemService(Context.POWER_SERVICE);
-
- mBatterySaverController = new BatterySaverController(mContext);
- mBatterySaverController.mBatterySaverPref = mBatterySaverPref;
+ Settings.Global.putInt(mContext.getContentResolver(),
+ Settings.Global.LOW_POWER_MODE_TRIGGER_LEVEL, 0);
}
@Test
- public void onBatteryChanged_true_switchEnabled() {
- mBatterySaverController.onBatteryChanged(true);
-
- assertThat(mBatterySaverPref.getSwitch().isEnabled()).isFalse();
+ public void onPreferenceChange_onStart() {
+ mBatterySaverController.onStart();
+ verify(mBatterySaverPref).setSummary("Off");
}
@Test
- public void onBatteryChanged_false_switchDisabled() {
- mBatterySaverController.onBatteryChanged(false);
-
- assertThat(mBatterySaverPref.getSwitch().isEnabled()).isTrue();
+ public void onPreferenceChange_onPowerSaveModeChanged() {
+ mBatterySaverController.onPowerSaveModeChanged();
+ verify(mBatterySaverPref).setSummary("Off");
}
@Test
- public void onPowerSaveModeChanged_differentState_updateToIsChecked() {
+ public void getSummary_batterySaverOn_showSummaryOn() {
when(mPowerManager.isPowerSaveMode()).thenReturn(true);
- assertThat(mBatterySaverPref.isChecked()).isFalse();
-
- mBatterySaverController.onPowerSaveModeChanged();
-
- assertThat(mBatterySaverPref.isChecked()).isTrue();
+ assertThat(mBatterySaverController.getSummary()).isEqualTo("On");
}
@Test
- public void onPowerSaveModeChanged_differentState_updateToUnChecked() {
- mBatterySaverPref.setChecked(true);
-
+ public void getSummary_batterySaverOffButScheduled_showSummaryScheduled() {
when(mPowerManager.isPowerSaveMode()).thenReturn(false);
- assertThat(mBatterySaverPref.isChecked()).isTrue();
+ Settings.Global.putInt(mContext.getContentResolver(),
+ Settings.Global.LOW_POWER_MODE_TRIGGER_LEVEL, 15);
- mBatterySaverController.onPowerSaveModeChanged();
-
- assertThat(mBatterySaverPref.isChecked()).isFalse();
+ assertThat(mBatterySaverController.getSummary()).isEqualTo("Will turn on at 15%");
}
@Test
- public void onPowerSaveModeChanged_sameState_noUpdate() {
+ public void getSummary_batterySaverOffButScheduledZeroPercent_showSummaryOff() {
when(mPowerManager.isPowerSaveMode()).thenReturn(false);
- assertThat(mBatterySaverPref.isChecked()).isFalse();
+ Settings.Global.putInt(mContext.getContentResolver(),
+ Settings.Global.LOW_POWER_MODE_TRIGGER_LEVEL, 0);
- mBatterySaverController.onPowerSaveModeChanged();
-
- assertThat(mBatterySaverPref.isChecked()).isFalse();
+ assertThat(mBatterySaverController.getSummary()).isEqualTo("Off");
}
@Test
- public void setChecked_on_setPowerSaveMode() {
- mBatterySaverController.setChecked(true);
+ public void getSummary_batterySaverOffButScheduledBasedOnRoutine_showSummaryBasedOnRoutine() {
+ when(mPowerManager.isPowerSaveMode()).thenReturn(false);
+ Settings.Global.putInt(
+ mContext.getContentResolver(),
+ Settings.Global.AUTOMATIC_POWER_SAVE_MODE,
+ PowerManager.POWER_SAVE_MODE_TRIGGER_DYNAMIC);
- verify(mPowerManager).setPowerSaveModeEnabled(true);
+ assertThat(mBatterySaverController.getSummary()).isEqualTo("Based on your routine");
}
@Test
- public void setChecked_off_unsetPowerSaveMode() {
- mBatterySaverController.setChecked(false);
-
- verify(mPowerManager).setPowerSaveModeEnabled(false);
- }
-
- @Test
- public void isChecked_on_powerSaveModeOn() {
- when(mPowerManager.isPowerSaveMode()).thenReturn(true);
-
- assertThat(mBatterySaverController.isChecked()).isTrue();
- }
-
- @Test
- public void isChecked_off_powerSaveModeOff() {
+ public void getSummary_batterySaverOff_showSummaryOff() {
when(mPowerManager.isPowerSaveMode()).thenReturn(false);
- assertThat(mBatterySaverController.isChecked()).isFalse();
+ assertThat(mBatterySaverController.getSummary()).isEqualTo("Off");
}
}
diff --git a/tests/robotests/src/com/android/settings/testutils/FakeFeatureFactory.java b/tests/robotests/src/com/android/settings/testutils/FakeFeatureFactory.java
index 6fb2eae..a48b3eb 100644
--- a/tests/robotests/src/com/android/settings/testutils/FakeFeatureFactory.java
+++ b/tests/robotests/src/com/android/settings/testutils/FakeFeatureFactory.java
@@ -23,6 +23,7 @@
import com.android.settings.accounts.AccountFeatureProvider;
import com.android.settings.applications.ApplicationFeatureProvider;
+import com.android.settings.applications.appinfo.ExtraAppInfoFeatureProvider;
import com.android.settings.aware.AwareFeatureProvider;
import com.android.settings.biometrics.face.FaceFeatureProvider;
import com.android.settings.bluetooth.BluetoothFeatureProvider;
@@ -79,6 +80,7 @@
public ContextualCardFeatureProvider mContextualCardFeatureProvider;
public WifiTrackerLibProvider wifiTrackerLibProvider;
+ public ExtraAppInfoFeatureProvider extraAppInfoFeatureProvider;
/**
* Call this in {@code @Before} method of the test class to use fake factory.
@@ -124,6 +126,7 @@
mAwareFeatureProvider = mock(AwareFeatureProvider.class);
mFaceFeatureProvider = mock(FaceFeatureProvider.class);
wifiTrackerLibProvider = mock(WifiTrackerLibProvider.class);
+ extraAppInfoFeatureProvider = mock(ExtraAppInfoFeatureProvider.class);
}
@Override
@@ -240,4 +243,9 @@
public WifiTrackerLibProvider getWifiTrackerLibProvider() {
return wifiTrackerLibProvider;
}
+
+ @Override
+ public ExtraAppInfoFeatureProvider getExtraAppInfoFeatureProvider() {
+ return extraAppInfoFeatureProvider;
+ }
}
diff --git a/tests/unit/src/com/android/settings/applications/autofill/OWNERS b/tests/unit/src/com/android/settings/applications/autofill/OWNERS
new file mode 100644
index 0000000..fe93c13
--- /dev/null
+++ b/tests/unit/src/com/android/settings/applications/autofill/OWNERS
@@ -0,0 +1 @@
+include /src/com/android/settings/applications/autofill/OWNERS
diff --git a/tests/unit/src/com/android/settings/network/AllowedNetworkTypesListenerTest.java b/tests/unit/src/com/android/settings/network/AllowedNetworkTypesListenerTest.java
index 3387368..d8f3c78 100644
--- a/tests/unit/src/com/android/settings/network/AllowedNetworkTypesListenerTest.java
+++ b/tests/unit/src/com/android/settings/network/AllowedNetworkTypesListenerTest.java
@@ -25,8 +25,8 @@
import android.content.Context;
import android.os.HandlerExecutor;
-import android.telephony.PhoneStateListener;
import android.telephony.RadioAccessFamily;
+import android.telephony.TelephonyCallback;
import android.telephony.TelephonyManager;
import android.test.mock.MockContentResolver;
@@ -53,7 +53,7 @@
private AllowedNetworkTypesListener mAllowedNetworkTypesListener;
@Mock
- private AllowedNetworkTypesListener.OnAllowedNetworkTypesChangedListener mListener;
+ private AllowedNetworkTypesListener.OnAllowedNetworkTypesListener mListener;
@Mock
private TelephonyManager mTelephonyManager;
@@ -87,15 +87,15 @@
public void register_shouldRegisterContentObserver() {
mAllowedNetworkTypesListener.register(mContext, SUB_ID);
- verify(mTelephonyManager, times(1)).registerPhoneStateListener(any(HandlerExecutor.class),
- any(PhoneStateListener.class));
+ verify(mTelephonyManager, times(1)).registerTelephonyCallback(any(HandlerExecutor.class),
+ any(TelephonyCallback.class));
}
@Test
public void unregister_shouldUnregisterContentObserver() {
mAllowedNetworkTypesListener.unregister(mContext, SUB_ID);
- verify(mTelephonyManager).unregisterPhoneStateListener(
+ verify(mTelephonyManager).unregisterTelephonyCallback(
mAllowedNetworkTypesListener);
}
}
diff --git a/tests/unit/src/com/android/settings/network/SubscriptionsPreferenceControllerTest.java b/tests/unit/src/com/android/settings/network/SubscriptionsPreferenceControllerTest.java
index 6b31342..6997607 100644
--- a/tests/unit/src/com/android/settings/network/SubscriptionsPreferenceControllerTest.java
+++ b/tests/unit/src/com/android/settings/network/SubscriptionsPreferenceControllerTest.java
@@ -97,6 +97,7 @@
private LifecycleOwner mLifecycleOwner;
@Mock
private WifiPickerTrackerHelper mWifiPickerTrackerHelper;
+
private LifecycleRegistry mLifecycleRegistry;
private int mOnChildUpdatedCount;
private Context mContext;
@@ -428,7 +429,6 @@
doReturn(mock(MobileMappings.Config.class)).when(sInjector).getConfig(mContext);
doReturn(networkType)
.when(sInjector).getNetworkType(any(), any(), any(), anyInt());
- when(mTelephonyManager.isDataEnabled()).thenReturn(true);
mController.onResume();
mController.displayPreference(mPreferenceScreen);
@@ -447,7 +447,7 @@
final List<SubscriptionInfo> sub = setupMockSubscriptions(2);
doReturn(true).when(sInjector).isProviderModelEnabled(mContext);
doReturn(sub.get(0)).when(mSubscriptionManager).getDefaultDataSubscriptionInfo();
- setupGetIconConditions(sub.get(0).getSubscriptionId(), false, true,
+ setupGetIconConditions(sub.get(0).getSubscriptionId(), false, false,
TelephonyManager.DATA_CONNECTED, ServiceState.STATE_IN_SERVICE);
doReturn(networkType)
.when(sInjector).getNetworkType(any(), any(), any(), anyInt());
@@ -534,7 +534,6 @@
doReturn(mock(MobileMappings.Config.class)).when(sInjector).getConfig(mContext);
doReturn(networkType)
.when(sInjector).getNetworkType(any(), any(), any(), anyInt());
- when(mTelephonyManager.isDataEnabled()).thenReturn(true);
mController.onResume();
mController.displayPreference(mPreferenceScreen);
diff --git a/tests/unit/src/com/android/settings/network/AirplaneSafeNetworksPreferenceControllerTest.java b/tests/unit/src/com/android/settings/network/WifiSwitchPreferenceControllerTest.java
similarity index 71%
rename from tests/unit/src/com/android/settings/network/AirplaneSafeNetworksPreferenceControllerTest.java
rename to tests/unit/src/com/android/settings/network/WifiSwitchPreferenceControllerTest.java
index 4c4c5bd..1244db8 100644
--- a/tests/unit/src/com/android/settings/network/AirplaneSafeNetworksPreferenceControllerTest.java
+++ b/tests/unit/src/com/android/settings/network/WifiSwitchPreferenceControllerTest.java
@@ -22,11 +22,9 @@
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
-import android.content.ContentResolver;
import android.content.Context;
import android.net.wifi.WifiManager;
import android.os.Looper;
-import android.provider.Settings;
import androidx.preference.PreferenceManager;
import androidx.preference.PreferenceScreen;
@@ -43,17 +41,11 @@
import org.mockito.MockitoAnnotations;
@RunWith(AndroidJUnit4.class)
-public class AirplaneSafeNetworksPreferenceControllerTest {
+public class WifiSwitchPreferenceControllerTest {
- private static final String KEY_AIRPLANE_SAFE_NETWORKS = "airplane_safe_networks";
-
- private static final int ON = 1;
- private static final int OFF = 0;
-
- private ContentResolver mResolver;
private PreferenceScreen mScreen;
private RestrictedSwitchPreference mPreference;
- private AirplaneSafeNetworksPreferenceController mController;
+ private WifiSwitchPreferenceController mController;
@Mock
private WifiManager mWifiManager;
@@ -62,37 +54,21 @@
public void setUp() {
MockitoAnnotations.initMocks(this);
final Context context = spy(ApplicationProvider.getApplicationContext());
- mResolver = context.getContentResolver();
doReturn(mWifiManager).when(context).getSystemService(Context.WIFI_SERVICE);
- mController = new AirplaneSafeNetworksPreferenceController(context, mock(Lifecycle.class));
+ mController = new WifiSwitchPreferenceController(context, mock(Lifecycle.class));
if (Looper.myLooper() == null) {
Looper.prepare();
}
final PreferenceManager preferenceManager = new PreferenceManager(context);
mScreen = preferenceManager.createPreferenceScreen(context);
mPreference = new RestrictedSwitchPreference(context);
- mPreference.setKey(KEY_AIRPLANE_SAFE_NETWORKS);
+ mPreference.setKey(WifiSwitchPreferenceController.KEY);
mScreen.addPreference(mPreference);
}
@Test
- public void isAvailable_airplaneModeOff_returnFalse() {
- Settings.Global.putInt(mResolver, Settings.Global.AIRPLANE_MODE_ON, OFF);
-
- mController.displayPreference(mScreen);
- mController.onStart();
-
- assertThat(mController.isAvailable()).isFalse();
- }
-
- @Test
- public void isAvailable_airplaneModeOn_returnTrue() {
- Settings.Global.putInt(mResolver, Settings.Global.AIRPLANE_MODE_ON, ON);
-
- mController.displayPreference(mScreen);
- mController.onStart();
-
+ public void isAvailable_returnTrue() {
assertThat(mController.isAvailable()).isTrue();
}
diff --git a/tests/unit/src/com/android/settings/network/telephony/NetworkProviderWorkerTest.java b/tests/unit/src/com/android/settings/network/telephony/NetworkProviderWorkerTest.java
index 2ce9a51..97f8e11 100644
--- a/tests/unit/src/com/android/settings/network/telephony/NetworkProviderWorkerTest.java
+++ b/tests/unit/src/com/android/settings/network/telephony/NetworkProviderWorkerTest.java
@@ -207,22 +207,22 @@
@Test
@UiThreadTest
- public void onServiceStateChanged_notifyPhoneStateListener_callUpdateSlice() {
+ public void onServiceStateChanged_notifyTelephonyCallback_callUpdateSlice() {
mMockNetworkProviderWorker.onSlicePinned();
mMockNetworkProviderWorker.receiveNotification(false);
- mMockNetworkProviderWorker.mPhoneStateListener.onServiceStateChanged(new ServiceState());
+ mMockNetworkProviderWorker.mTelephonyCallback.onServiceStateChanged(new ServiceState());
assertThat(mMockNetworkProviderWorker.hasNotification()).isTrue();
}
@Test
@UiThreadTest
- public void onDisplayInfoChanged_notifyPhoneStateListener_callUpdateSlice() {
+ public void onDisplayInfoChanged_notifyTelephonyCallback_callUpdateSlice() {
mMockNetworkProviderWorker.onSlicePinned();
mMockNetworkProviderWorker.receiveNotification(false);
- mMockNetworkProviderWorker.mPhoneStateListener.onDisplayInfoChanged(
+ mMockNetworkProviderWorker.mTelephonyCallback.onDisplayInfoChanged(
new TelephonyDisplayInfo(14, 0));
assertThat(mMockNetworkProviderWorker.hasNotification()).isTrue();
@@ -230,11 +230,11 @@
@Test
@UiThreadTest
- public void onDataConnectionStateChanged_notifyPhoneStateListener_callUpdateSlice() {
+ public void onDataConnectionStateChanged_notifyTelephonyCallback_callUpdateSlice() {
mMockNetworkProviderWorker.onSlicePinned();
mMockNetworkProviderWorker.receiveNotification(false);
- mMockNetworkProviderWorker.mPhoneStateListener.onDataConnectionStateChanged(
+ mMockNetworkProviderWorker.mTelephonyCallback.onDataConnectionStateChanged(
TelephonyManager.DATA_DISCONNECTED, TelephonyManager.NETWORK_TYPE_LTE);
assertThat(mMockNetworkProviderWorker.hasNotification()).isTrue();
diff --git a/tests/unit/src/com/android/settings/testutils/FakeFeatureFactory.java b/tests/unit/src/com/android/settings/testutils/FakeFeatureFactory.java
index d20fc12..6955dc4 100644
--- a/tests/unit/src/com/android/settings/testutils/FakeFeatureFactory.java
+++ b/tests/unit/src/com/android/settings/testutils/FakeFeatureFactory.java
@@ -21,6 +21,7 @@
import com.android.settings.accounts.AccountFeatureProvider;
import com.android.settings.applications.ApplicationFeatureProvider;
+import com.android.settings.applications.appinfo.ExtraAppInfoFeatureProvider;
import com.android.settings.aware.AwareFeatureProvider;
import com.android.settings.biometrics.face.FaceFeatureProvider;
import com.android.settings.bluetooth.BluetoothFeatureProvider;
@@ -74,6 +75,7 @@
public ContextualCardFeatureProvider mContextualCardFeatureProvider;
public WifiTrackerLibProvider wifiTrackerLibProvider;
+ public ExtraAppInfoFeatureProvider extraAppInfoFeatureProvider;
/**
* Call this in {@code @Before} method of the test class to use fake factory.
@@ -110,6 +112,7 @@
mAwareFeatureProvider = mock(AwareFeatureProvider.class);
mFaceFeatureProvider = mock(FaceFeatureProvider.class);
wifiTrackerLibProvider = mock(WifiTrackerLibProvider.class);
+ extraAppInfoFeatureProvider = mock(ExtraAppInfoFeatureProvider.class);
}
@Override
@@ -226,4 +229,9 @@
public WifiTrackerLibProvider getWifiTrackerLibProvider() {
return wifiTrackerLibProvider;
}
+
+ @Override
+ public ExtraAppInfoFeatureProvider getExtraAppInfoFeatureProvider() {
+ return extraAppInfoFeatureProvider;
+ }
}