Merge "Fix NPE when connect timeout" into qt-dev
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index c112115..8fd0769 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -1276,6 +1276,8 @@
</intent-filter>
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
android:value="com.android.settings.privacy.PrivacyDashboardFragment" />
+ <meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
+ android:value="true" />
</activity>
<activity android:name="SetFullBackupPassword"
@@ -1629,6 +1631,7 @@
android:resource="@string/suggestion_additional_fingerprints" />
<meta-data android:name="com.android.settings.summary"
android:resource="@string/suggestion_additional_fingerprints_summary" />
+ <meta-data android:name="com.android.settings.icon_tintable" android:value="true" />
</activity-alias>
<!-- Note this must not be exported since it returns the password in the intent -->
diff --git a/res/drawable-hdpi/ic_live_help.png b/res/drawable-hdpi/ic_live_help.png
deleted file mode 100644
index f3548f6..0000000
--- a/res/drawable-hdpi/ic_live_help.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_live_help.png b/res/drawable-mdpi/ic_live_help.png
deleted file mode 100644
index e958662..0000000
--- a/res/drawable-mdpi/ic_live_help.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xhdpi/ic_live_help.png b/res/drawable-xhdpi/ic_live_help.png
deleted file mode 100644
index dbbbfed..0000000
--- a/res/drawable-xhdpi/ic_live_help.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_live_help.png b/res/drawable-xxhdpi/ic_live_help.png
deleted file mode 100644
index f2a01fe..0000000
--- a/res/drawable-xxhdpi/ic_live_help.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_live_help.png b/res/drawable-xxxhdpi/ic_live_help.png
deleted file mode 100644
index 00338a0..0000000
--- a/res/drawable-xxxhdpi/ic_live_help.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable/ic_feedback_24dp.xml b/res/drawable/ic_feedback_24dp.xml
new file mode 100644
index 0000000..a65f444
--- /dev/null
+++ b/res/drawable/ic_feedback_24dp.xml
@@ -0,0 +1,30 @@
+<!--
+ ~ Copyright (C) 2019 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License
+ -->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24"
+ android:viewportHeight="24">
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M20,2H4C2.9,2 2.01,2.9 2.01,4L2,22l4,-4h14c1.1,0 2,-0.9 2,-2V4C22,2.9 21.1,2 20,2zM20,16H6H5.17l-0.59,0.59L4,17.17V4h16V16z"/>
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M11,12h2v2h-2z"/>
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M11,6h2v4h-2z"/>
+</vector>
diff --git a/res/raw/bubbles.mp4 b/res/raw/bubbles.mp4
new file mode 100644
index 0000000..c68ea57
--- /dev/null
+++ b/res/raw/bubbles.mp4
Binary files differ
diff --git a/res/values-night/colors.xml b/res/values-night/colors.xml
index f6f86f0..b7b30f5 100644
--- a/res/values-night/colors.xml
+++ b/res/values-night/colors.xml
@@ -24,5 +24,7 @@
<color name="homepage_card_dismissal_background">@*android:color/material_grey_900</color>
<color name="contextual_card_background">@*android:color/material_grey_900</color>
<color name="search_bar_background">@*android:color/material_grey_800</color>
+ <!-- Dialog background color -->
+ <color name="dialog_background">@*android:color/material_grey_800</color>
</resources>
diff --git a/res/values-night/themes.xml b/res/values-night/themes.xml
index 2227b88..782f482 100644
--- a/res/values-night/themes.xml
+++ b/res/values-night/themes.xml
@@ -33,6 +33,7 @@
<style name="Theme.AlertDialog.Base" parent="@style/Theme.AppCompat.DayNight.Dialog.Alert">
<item name="colorAccent">@*android:color/accent_device_default_dark</item>
+ <item name="android:background">@color/dialog_background</item>
</style>
</resources>
diff --git a/res/values/colors.xml b/res/values/colors.xml
index d4363b1..1245b37 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -143,4 +143,7 @@
<!-- Search bar background color -->
<color name="search_bar_background">@android:color/white</color>
+ <!-- Dialog background color -->
+ <color name="dialog_background">@*android:color/background_device_default_light</color>
+
</resources>
\ No newline at end of file
diff --git a/res/values/strings.xml b/res/values/strings.xml
index aac3c95..2a29f44 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -2763,6 +2763,8 @@
<string name="brightness_summary">Adjust the brightness of the screen</string>
<!-- Sound & display settings screen, setting option name to enable adaptive brightness [CHAR LIMIT=30] -->
<string name="auto_brightness_title">Adaptive brightness</string>
+ <!-- Summary about the feature adaptive brightness [CHAR LIMIT=NONE] -->
+ <string name="auto_brightness_summary">Screen brightness adjusts to environment</string>
<!-- Setting option summary when adaptive brightness is on [CHAR LIMIT=NONE] -->
<string name="auto_brightness_summary_on">On</string>
<!-- Setting option summary when adaptive brightness is off [CHAR LIMIT=NONE] -->
@@ -7196,8 +7198,6 @@
<string name="keywords_wifi">wifi, wi-fi, network connection, internet, wireless, data, wi fi</string>
<!-- Search keyword for "Open Network Notification" settings. [CHAR_LIMIT=NONE]-->
<string name="keywords_wifi_notify_open_networks">Wi\u2011Fi notification, wifi notification</string>
- <!-- Search keyword for "Adaptive brightness" settings. [CHAR_LIMIT=NONE]-->
- <string name="keywords_auto_brightness">Auto brightness</string>
<!-- Search keyword for "Vibrate on touch" settings. [CHAR_LIMIT=NONE]-->
<string name="keywords_vibrate_on_touch">Stop vibration, tap, keyboard</string>
<!-- Search keyword for "Time format" settings. [CHAR_LIMIT=NONE]-->
@@ -7284,7 +7284,7 @@
<string name="keywords_fingerprint_settings">fingerprint, add fingerprint</string>
<!-- Search keywords for adaptive brightness setting [CHAR LIMIT=NONE]-->
- <string name="keywords_display_auto_brightness">dim screen, touchscreen, battery, smart brightness, dynamic brightness</string>
+ <string name="keywords_display_auto_brightness">dim screen, touchscreen, battery, smart brightness, dynamic brightness, Auto brightness</string>
<!-- Search keywords for adaptive sleep setting [CHAR LIMIT=NONE]-->
<string name="keywords_display_adaptive_sleep">dim screen, sleep, battery, timeout, attention, display, screen, inactivity</string>
@@ -7810,19 +7810,19 @@
<string name="asst_capability_prioritizer_title">Automatic Prioritization</string>
<!-- Configure Notifications: setting summary [CHAR LIMIT=200] -->
- <string name="asst_capability_prioritizer_summary">Automatically de-prioritize less important notifications to the gentle section</string>
+ <string name="asst_capability_prioritizer_summary">Automatically set lower priority notifications to Gentle</string>
<!-- Configure Notifications: setting title [CHAR LIMIT=80] -->
- <string name="asst_capabilities_actions_replies_title">Smart actions and replies</string>
+ <string name="asst_capabilities_actions_replies_title">Suggested actions and replies</string>
<!-- Configure Notifications: setting summary [CHAR LIMIT=200] -->
- <string name="asst_capabilities_actions_replies_summary">Automatically add suggested actions and replies to notifications</string>
+ <string name="asst_capabilities_actions_replies_summary">Automatically show suggested actions & replies</string>
<!-- Configure Notifications: setting title [CHAR LIMIT=80] -->
- <string name="hide_silent_icons_title">Hide silent notification status icons</string>
+ <string name="hide_silent_icons_title">Hide icons from gentle notifications</string>
<!-- Configure Notifications: setting summary [CHAR LIMIT=NONE] -->
- <string name="hide_silent_icons_summary">Hide icons for silent notifications in the status bar</string>
+ <string name="hide_silent_icons_summary">Icons from gentle notifications aren\'t shown in the status bar</string>
<!-- Configure Notifications: Title for the notification badging option. [CHAR LIMIT=30 BACKUP_MESSAGE_ID=5125022693565388760] -->
<string name="notification_badging_title">Allow notification dots</string>
@@ -7979,33 +7979,38 @@
<string name="notification_channel_summary_min">In the pull-down shade, collapse notifications to one line</string>
<!-- [CHAR LIMIT=100] Notification Importance title: low importance level summary -->
- <string name="notification_channel_summary_low">Gentle notifications will display in pull-down list</string>
+ <string name="notification_channel_summary_low">Always silent. Displays in pull-down shade.</string>
<!-- [CHAR LIMIT=100] Notification Importance title: low importance level summary -->
- <string name="notification_channel_summary_low_status">Gentle notifications will display in pull-down list & status bar</string>
+ <string name="notification_channel_summary_low_status">Always silent. Displays in pull-down shade & status bar.</string>
<!-- [CHAR LIMIT=100] Notification Importance title: low importance level summary -->
- <string name="notification_channel_summary_low_lock">Gentle notifications will display in pull-down list & on lock screen</string>
+ <string name="notification_channel_summary_low_lock">Always silent. Displays in pull-down shade & on lock screen.</string>
<!-- [CHAR LIMIT=100] Notification Importance title: low importance level summary -->
- <string name="notification_channel_summary_low_status_lock">Gentle notifications will display in pull-down list, status bar & on lock screen</string>
+ <string name="notification_channel_summary_low_status_lock">Always silent. Displays in pull-down shade, status bar & on lock screen.</string>
<!-- [CHAR LIMIT=100] Notification Importance title: normal importance level summary -->
- <string name="notification_channel_summary_default">Prioritized notifications will alert and display in pull-down list, status bar & on lock screen</string>
+ <string name="notification_channel_summary_default">Makes sound and displays in pull-down shade, status bar & on lock screen.</string>
<!-- [CHAR LIMIT=100] Notification Importance title: high importance level summary -->
- <string name="notification_channel_summary_high">When phone is unlocked, show notifications as a banner across top of screen</string>
+ <string name="notification_channel_summary_high">When device is unlocked, show notifications as a banner across the top of the screen</string>
<!-- [CHAR LIMIT=100] Label for on/off toggle -->
<string name="notification_switch_label">Show notifications</string>
<!-- Default Apps > Default notification assistant -->
- <string name="default_notification_assistant">Notification assistant</string>
+ <string name="default_notification_assistant">Adaptive Notifications</string>
<!-- app summary of notification app list screen [CHAR LIMIT=100] -->
- <string name="notifications_sent_daily">~<xliff:g id="number">%1$s</xliff:g> per day</string>
- <!-- app summary of notification app list screen [CHAR LIMIT=100] -->
- <string name="notifications_sent_weekly">~<xliff:g id="number">%1$s</xliff:g> per week</string>
+ <plurals name="notifications_sent_daily">
+ <item quantity="one">~<xliff:g id="number">%d</xliff:g> notification per day</item>
+ <item quantity="other">~<xliff:g id="number">%d</xliff:g> notifications per day</item>
+ </plurals>
+ <plurals name="notifications_sent_weekly">
+ <item quantity="one">~<xliff:g id="number">%d</xliff:g> notification per week</item>
+ <item quantity="other">~<xliff:g id="number">%d</xliff:g> notifications per week</item>
+ </plurals>
<!-- app summary of notification app list screen [CHAR LIMIT=100] -->
<string name="notifications_sent_never">Never</string>
@@ -8027,10 +8032,10 @@
</plurals>
<!-- Title for Notification Assistant Picker screen [CHAR LIMIT=30]-->
- <string name="notification_assistant_title">Notification Assistant</string>
+ <string name="notification_assistant_title">Adaptive Notifications</string>
<!-- Label for no NotificationAssistantService [CHAR_LIMIT=NONE] -->
- <string name="no_notification_assistant">No assistant</string>
+ <string name="no_notification_assistant">None</string>
<!-- String to show in the list of notification listeners, when none is installed -->
<string name="no_notification_listeners">No installed apps have requested notification access.</string>
diff --git a/res/values/themes.xml b/res/values/themes.xml
index 5db5f2f..d29d78b 100644
--- a/res/values/themes.xml
+++ b/res/values/themes.xml
@@ -117,6 +117,7 @@
<style name="Theme.AlertDialog.Base" parent="@style/Theme.AppCompat.DayNight.Dialog.Alert">
<item name="colorAccent">@*android:color/accent_device_default_light</item>
+ <item name="android:background">@color/dialog_background</item>
</style>
<style name="Theme.AlertDialog" parent="Theme.AlertDialog.Base">
diff --git a/res/xml/auto_brightness_detail.xml b/res/xml/auto_brightness_detail.xml
index b10f1ad..abf535f 100644
--- a/res/xml/auto_brightness_detail.xml
+++ b/res/xml/auto_brightness_detail.xml
@@ -32,8 +32,9 @@
<com.android.settingslib.RestrictedSwitchPreference
android:key="auto_brightness"
android:title="@string/auto_brightness_title"
+ android:summary="@string/auto_brightness_summary"
settings:keywords="@string/keywords_display_auto_brightness"
- settings:controller="com.android.settings.display.AutoBrightnessPreferenceController"
+ settings:controller="com.android.settings.display.AutoBrightnessDetailPreferenceController"
settings:useAdminDisabledSummary="true"
settings:userRestriction="no_config_brightness"
settings:allowDividerAbove="true" />
diff --git a/res/xml/bubble_notification_settings.xml b/res/xml/bubble_notification_settings.xml
index 20783fa..7fba125 100644
--- a/res/xml/bubble_notification_settings.xml
+++ b/res/xml/bubble_notification_settings.xml
@@ -18,6 +18,14 @@
xmlns:settings="http://schemas.android.com/apk/res-auto"
android:title="@string/bubbles_app_toggle_title"
android:key="bubble_notification_settings">
+
+ <com.android.settings.widget.VideoPreference
+ android:key="bubbles_illustration"
+ android:title="@string/summary_placeholder"
+ settings:animation="@raw/bubbles"
+ settings:controller="com.android.settings.widget.VideoPreferenceController"
+ android:persistent="false" />
+
<!-- Notification bubbles -->
<SwitchPreference
android:key="global_notification_bubbles"
diff --git a/res/xml/display_settings.xml b/res/xml/display_settings.xml
index bcd5100..ad06e95 100644
--- a/res/xml/display_settings.xml
+++ b/res/xml/display_settings.xml
@@ -44,8 +44,7 @@
android:title="@string/auto_brightness_title"
android:summary="@string/summary_placeholder"
android:fragment="com.android.settings.display.AutoBrightnessSettings"
- settings:controller="com.android.settings.display.AutoBrightnessPreferenceController"
- settings:keywords="@string/keywords_auto_brightness"/>
+ settings:controller="com.android.settings.display.AutoBrightnessPreferenceController"/>
<com.android.settingslib.RestrictedPreference
android:key="wallpaper"
diff --git a/res/xml/mobile_network_settings_v2.xml b/res/xml/mobile_network_settings_v2.xml
index 6682437..6890a41 100644
--- a/res/xml/mobile_network_settings_v2.xml
+++ b/res/xml/mobile_network_settings_v2.xml
@@ -24,162 +24,170 @@
android:layout="@layout/styled_switch_bar"
settings:controller="com.android.settings.network.telephony.MobileNetworkSwitchController"/>
- <com.android.settings.datausage.DataUsageSummaryPreference
- android:key="status_header"
- android:visibility="gone"
- android:selectable="false" />
-
- <ListPreference
- android:key="calls_preference"
- android:title="@string/calls_preference"
- settings:controller="com.android.settings.network.telephony.CallsDefaultSubscriptionController"
- settings:allowDividerAbove="true" />
-
- <ListPreference
- android:key="sms_preference"
- android:title="@string/sms_preference"
- settings:controller="com.android.settings.network.telephony.SmsDefaultSubscriptionController" />
-
- <Preference
- android:key="cdma_lte_data_service_key"
- android:title="@string/cdma_lte_data_service"
- settings:controller="com.android.settings.network.telephony.DataServiceSetupPreferenceController"
- settings:allowDividerAbove="true"
- settings:allowDividerBelow="false" />
-
- <SwitchPreference
- android:key="mobile_data_enable"
- android:title="@string/mobile_data_settings_title"
- android:summary="@string/mobile_data_settings_summary"
- settings:controller="com.android.settings.network.telephony.MobileDataPreferenceController"
- settings:allowDividerAbove="true"/>
-
- <com.android.settingslib.RestrictedSwitchPreference
- android:key="button_roaming_key"
- android:title="@string/roaming"
- android:persistent="false"
- android:summaryOn="@string/roaming_enable"
- android:summaryOff="@string/roaming_disable"
- settings:userRestriction="no_data_roaming"
- settings:controller="com.android.settings.network.telephony.RoamingPreferenceController"/>
-
- <Preference
- android:key="data_usage_summary"
- android:title="@string/mobile_data_usage_title"
- settings:controller="com.android.settings.network.telephony.DataUsagePreferenceController"/>
-
- <com.android.settings.datausage.BillingCyclePreference
- android:key="billing_preference"
- android:title="@string/billing_cycle"
- settings:controller="com.android.settings.datausage.BillingCyclePreferenceController" />
-
- <SwitchPreference
- android:key="mms_message"
- android:title="@string/mms_message_title"
- android:summary="@string/mms_message_summary"
- settings:controller="com.android.settings.network.telephony.MmsMessagePreferenceController" />
-
- <SwitchPreference
- android:key="enhanced_4g_lte"
- android:title="@string/enhanced_4g_lte_mode_title"
- android:persistent="false"
- android:summary="@string/enhanced_4g_lte_mode_summary"
- settings:controller="com.android.settings.network.telephony.Enhanced4gLtePreferenceController"/>
-
- <ListPreference
- android:key="preferred_network_mode_key"
- android:title="@string/preferred_network_mode_title"
- android:summary="@string/preferred_network_mode_summary"
- android:entries="@array/preferred_network_mode_choices"
- android:entryValues="@array/preferred_network_mode_values"
- android:dialogTitle="@string/preferred_network_mode_dialogtitle"
- settings:controller="com.android.settings.network.telephony.PreferredNetworkModePreferenceController"/>
-
- <ListPreference
- android:key="enabled_networks_key"
- android:title="@string/preferred_network_mode_title"
- android:summary="@string/preferred_network_mode_summary"
- android:entries="@array/enabled_networks_choices"
- android:entryValues="@array/enabled_networks_values"
- android:dialogTitle="@string/preferred_network_mode_dialogtitle"
- settings:controller="com.android.settings.network.telephony.EnabledNetworkModePreferenceController"/>
-
- <Preference
- android:key="carrier_settings_version_key"
- android:title="@string/carrier_settings_version"
- settings:controller="com.android.settings.network.telephony.CarrierSettingsVersionPreferenceController"
- settings:enableCopying="true" />
-
<PreferenceCategory
- android:key="calling_category"
- android:title="@string/call_category">
+ android:key="enabled_state_container"
+ android:title="@string/summary_placeholder"
+ settings:controller="com.android.settings.network.telephony.DisabledSubscriptionController"
+ android:layout="@layout/preference_category_no_label">
- <PreferenceScreen
- android:key="wifi_calling_key"
- android:title="@string/wifi_calling_settings_title"
- settings:controller="com.android.settings.network.telephony.WifiCallingPreferenceController" >
- <intent android:action="android.intent.action.MAIN"
- android:targetPackage="com.android.settings"
- android:targetClass="com.android.settings.Settings$WifiCallingSettingsActivity">
- <extra android:name="show_drawer_menu" android:value="true" />
- </intent>
- </PreferenceScreen>
+ <com.android.settings.datausage.DataUsageSummaryPreference
+ android:key="status_header"
+ android:visibility="gone"
+ android:selectable="false" />
- <SwitchPreference
- android:key="video_calling_key"
- android:title="@string/video_calling_settings_title"
- android:persistent="true"
- settings:controller="com.android.settings.network.telephony.VideoCallingPreferenceController" />
+ <ListPreference
+ android:key="calls_preference"
+ android:title="@string/calls_preference"
+ settings:controller="com.android.settings.network.telephony.CallsDefaultSubscriptionController"
+ settings:allowDividerAbove="true"/>
- </PreferenceCategory>
-
- <com.android.settings.network.telephony.cdma.CdmaListPreference
- android:key="cdma_system_select_key"
- android:title="@string/cdma_system_select_title"
- android:summary="@string/cdma_system_select_summary"
- android:entries="@array/cdma_system_select_choices"
- android:entryValues="@array/cdma_system_select_values"
- android:dialogTitle="@string/cdma_system_select_dialogtitle"
- settings:controller="com.android.settings.network.telephony.cdma.CdmaSystemSelectPreferenceController"/>
-
- <com.android.settings.network.telephony.cdma.CdmaListPreference
- android:key="cdma_subscription_key"
- android:title="@string/cdma_subscription_title"
- android:summary="@string/cdma_subscription_summary"
- android:entries="@array/cdma_subscription_choices"
- android:entryValues="@array/cdma_subscription_values"
- android:dialogTitle="@string/cdma_subscription_dialogtitle"
- settings:controller="com.android.settings.network.telephony.cdma.CdmaSubscriptionPreferenceController"/>
-
- <PreferenceCategory
- android:key="network_operators_category_key"
- android:title="@string/network_operator_category"
- settings:controller="com.android.settings.widget.PreferenceCategoryController">
-
- <SwitchPreference
- android:key="auto_select_key"
- android:title="@string/select_automatically"
- settings:controller="com.android.settings.network.telephony.gsm.AutoSelectPreferenceController"/>
+ <ListPreference
+ android:key="sms_preference"
+ android:title="@string/sms_preference"
+ settings:controller="com.android.settings.network.telephony.SmsDefaultSubscriptionController"/>
<Preference
- android:key="choose_network_key"
- android:title="@string/choose_network_title"
- android:fragment="com.android.phone.NetworkSelectSetting"
- settings:controller="com.android.settings.network.telephony.gsm.OpenNetworkSelectPagePreferenceController"/>
+ android:key="cdma_lte_data_service_key"
+ android:title="@string/cdma_lte_data_service"
+ settings:controller="com.android.settings.network.telephony.DataServiceSetupPreferenceController"
+ settings:allowDividerAbove="true"
+ settings:allowDividerBelow="false"/>
+
+ <SwitchPreference
+ android:key="mobile_data_enable"
+ android:title="@string/mobile_data_settings_title"
+ android:summary="@string/mobile_data_settings_summary"
+ settings:controller="com.android.settings.network.telephony.MobileDataPreferenceController"
+ settings:allowDividerAbove="true"/>
+
+ <com.android.settingslib.RestrictedSwitchPreference
+ android:key="button_roaming_key"
+ android:title="@string/roaming"
+ android:persistent="false"
+ android:summaryOn="@string/roaming_enable"
+ android:summaryOff="@string/roaming_disable"
+ settings:userRestriction="no_data_roaming"
+ settings:controller="com.android.settings.network.telephony.RoamingPreferenceController"/>
+
+ <Preference
+ android:key="data_usage_summary"
+ android:title="@string/mobile_data_usage_title"
+ settings:controller="com.android.settings.network.telephony.DataUsagePreferenceController"/>
+
+ <com.android.settings.datausage.BillingCyclePreference
+ android:key="billing_preference"
+ android:title="@string/billing_cycle"
+ settings:controller="com.android.settings.datausage.BillingCyclePreferenceController"/>
+
+ <SwitchPreference
+ android:key="mms_message"
+ android:title="@string/mms_message_title"
+ android:summary="@string/mms_message_summary"
+ settings:controller="com.android.settings.network.telephony.MmsMessagePreferenceController"/>
+
+ <SwitchPreference
+ android:key="enhanced_4g_lte"
+ android:title="@string/enhanced_4g_lte_mode_title"
+ android:persistent="false"
+ android:summary="@string/enhanced_4g_lte_mode_summary"
+ settings:controller="com.android.settings.network.telephony.Enhanced4gLtePreferenceController"/>
+
+ <ListPreference
+ android:key="preferred_network_mode_key"
+ android:title="@string/preferred_network_mode_title"
+ android:summary="@string/preferred_network_mode_summary"
+ android:entries="@array/preferred_network_mode_choices"
+ android:entryValues="@array/preferred_network_mode_values"
+ android:dialogTitle="@string/preferred_network_mode_dialogtitle"
+ settings:controller="com.android.settings.network.telephony.PreferredNetworkModePreferenceController"/>
+
+ <ListPreference
+ android:key="enabled_networks_key"
+ android:title="@string/preferred_network_mode_title"
+ android:summary="@string/preferred_network_mode_summary"
+ android:entries="@array/enabled_networks_choices"
+ android:entryValues="@array/enabled_networks_values"
+ android:dialogTitle="@string/preferred_network_mode_dialogtitle"
+ settings:controller="com.android.settings.network.telephony.EnabledNetworkModePreferenceController"/>
+
+ <Preference
+ android:key="carrier_settings_version_key"
+ android:title="@string/carrier_settings_version"
+ settings:controller="com.android.settings.network.telephony.CarrierSettingsVersionPreferenceController"
+ settings:enableCopying="true"/>
+
+ <PreferenceCategory
+ android:key="calling_category"
+ android:title="@string/call_category">
+
+ <PreferenceScreen
+ android:key="wifi_calling_key"
+ android:title="@string/wifi_calling_settings_title"
+ settings:controller="com.android.settings.network.telephony.WifiCallingPreferenceController">
+ <intent android:action="android.intent.action.MAIN"
+ android:targetPackage="com.android.settings"
+ android:targetClass="com.android.settings.Settings$WifiCallingSettingsActivity">
+ <extra android:name="show_drawer_menu" android:value="true"/>
+ </intent>
+ </PreferenceScreen>
+
+ <SwitchPreference
+ android:key="video_calling_key"
+ android:title="@string/video_calling_settings_title"
+ android:persistent="true"
+ settings:controller="com.android.settings.network.telephony.VideoCallingPreferenceController"/>
+
+ </PreferenceCategory>
+
+ <com.android.settings.network.telephony.cdma.CdmaListPreference
+ android:key="cdma_system_select_key"
+ android:title="@string/cdma_system_select_title"
+ android:summary="@string/cdma_system_select_summary"
+ android:entries="@array/cdma_system_select_choices"
+ android:entryValues="@array/cdma_system_select_values"
+ android:dialogTitle="@string/cdma_system_select_dialogtitle"
+ settings:controller="com.android.settings.network.telephony.cdma.CdmaSystemSelectPreferenceController"/>
+
+ <com.android.settings.network.telephony.cdma.CdmaListPreference
+ android:key="cdma_subscription_key"
+ android:title="@string/cdma_subscription_title"
+ android:summary="@string/cdma_subscription_summary"
+ android:entries="@array/cdma_subscription_choices"
+ android:entryValues="@array/cdma_subscription_values"
+ android:dialogTitle="@string/cdma_subscription_dialogtitle"
+ settings:controller="com.android.settings.network.telephony.cdma.CdmaSubscriptionPreferenceController"/>
+
+ <PreferenceCategory
+ android:key="network_operators_category_key"
+ android:title="@string/network_operator_category"
+ settings:controller="com.android.settings.widget.PreferenceCategoryController">
+
+ <SwitchPreference
+ android:key="auto_select_key"
+ android:title="@string/select_automatically"
+ settings:controller="com.android.settings.network.telephony.gsm.AutoSelectPreferenceController"/>
+
+ <Preference
+ android:key="choose_network_key"
+ android:title="@string/choose_network_title"
+ android:fragment="com.android.phone.NetworkSelectSetting"
+ settings:controller="com.android.settings.network.telephony.gsm.OpenNetworkSelectPagePreferenceController"/>
+ </PreferenceCategory>
+
+ <!--We want separate APN setting from reset of settings because we want user to change it with caution-->
+ <com.android.settingslib.RestrictedPreference
+ android:key="telephony_apn_key"
+ android:persistent="false"
+ android:title="@string/mobile_network_apn_title"
+ settings:allowDividerAbove="true"
+ settings:controller="com.android.settings.network.telephony.ApnPreferenceController"/>
+
+ <Preference
+ android:key="carrier_settings_key"
+ android:title="@string/carrier_settings_title"
+ settings:controller="com.android.settings.network.telephony.CarrierPreferenceController">
+ </Preference>
+
</PreferenceCategory>
- <!--We want separate APN setting from reset of settings because we want user to change it with caution-->
- <com.android.settingslib.RestrictedPreference
- android:key="telephony_apn_key"
- android:persistent="false"
- android:title="@string/mobile_network_apn_title"
- settings:allowDividerAbove="true"
- settings:controller="com.android.settings.network.telephony.ApnPreferenceController"/>
-
- <Preference
- android:key="carrier_settings_key"
- android:title="@string/carrier_settings_title"
- settings:controller="com.android.settings.network.telephony.CarrierPreferenceController">
- </Preference>
-
</PreferenceScreen>
diff --git a/src/com/android/settings/applications/AppStateNotificationBridge.java b/src/com/android/settings/applications/AppStateNotificationBridge.java
index 86f265e..d179642 100644
--- a/src/com/android/settings/applications/AppStateNotificationBridge.java
+++ b/src/com/android/settings/applications/AppStateNotificationBridge.java
@@ -108,10 +108,12 @@
return StringUtil.formatRelativeTime(
context, System.currentTimeMillis() - state.lastSent, true);
} else if (sortOrder == R.id.sort_order_frequent_notification) {
- if (state.avgSentWeekly > 0) {
- return context.getString(R.string.notifications_sent_weekly, state.avgSentWeekly);
+ if (state.avgSentDaily > 0) {
+ return context.getResources().getQuantityString(
+ R.plurals.notifications_sent_daily, state.avgSentDaily, state.avgSentDaily);
}
- return context.getString(R.string.notifications_sent_daily, state.avgSentDaily);
+ return context.getResources().getQuantityString(R.plurals.notifications_sent_weekly,
+ state.avgSentWeekly, state.avgSentWeekly);
} else {
return "";
}
diff --git a/src/com/android/settings/biometrics/face/FaceSettings.java b/src/com/android/settings/biometrics/face/FaceSettings.java
index f5216d8..48370d9 100644
--- a/src/com/android/settings/biometrics/face/FaceSettings.java
+++ b/src/com/android/settings/biometrics/face/FaceSettings.java
@@ -54,7 +54,7 @@
public class FaceSettings extends DashboardFragment {
private static final String TAG = "FaceSettings";
- private static final String KEY_TOKEN = "key_token";
+ private static final String KEY_TOKEN = "hw_auth_token";
private UserManager mUserManager;
private FaceManager mFaceManager;
@@ -111,6 +111,7 @@
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+ mToken = getIntent().getByteArrayExtra(KEY_TOKEN);
mUserManager = getPrefContext().getSystemService(UserManager.class);
mFaceManager = getPrefContext().getSystemService(FaceManager.class);
mUserId = getActivity().getIntent().getIntExtra(
diff --git a/src/com/android/settings/deviceinfo/simstatus/SimStatusDialogController.java b/src/com/android/settings/deviceinfo/simstatus/SimStatusDialogController.java
index a014c29..95f913e 100644
--- a/src/com/android/settings/deviceinfo/simstatus/SimStatusDialogController.java
+++ b/src/com/android/settings/deviceinfo/simstatus/SimStatusDialogController.java
@@ -406,13 +406,7 @@
}
private SubscriptionInfo getPhoneSubscriptionInfo(int slotId) {
- final List<SubscriptionInfo> subscriptionInfoList = SubscriptionManager.from(
- mContext).getActiveSubscriptionInfoList(true);
- if (subscriptionInfoList != null && subscriptionInfoList.size() > slotId) {
- return subscriptionInfoList.get(slotId);
- } else {
- return null;
- }
+ return SubscriptionManager.from(mContext).getActiveSubscriptionInfoForSimSlotIndex(slotId);
}
@VisibleForTesting
diff --git a/src/com/android/settings/display/AutoBrightnessDetailPreferenceController.java b/src/com/android/settings/display/AutoBrightnessDetailPreferenceController.java
new file mode 100644
index 0000000..a04ddbf
--- /dev/null
+++ b/src/com/android/settings/display/AutoBrightnessDetailPreferenceController.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2019 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.display;
+
+import android.content.Context;
+
+public class AutoBrightnessDetailPreferenceController extends AutoBrightnessPreferenceController {
+
+ public AutoBrightnessDetailPreferenceController(Context context, String key) {
+ super(context, key);
+ }
+
+ @Override
+ @AvailabilityStatus
+ public int getAvailabilityStatus() {
+ return mContext.getResources().getBoolean(
+ com.android.internal.R.bool.config_automatic_brightness_available)
+ ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
+ }
+
+ @Override
+ public boolean isSliceable() {
+ return true;
+ }
+}
diff --git a/src/com/android/settings/display/AutoBrightnessPreferenceController.java b/src/com/android/settings/display/AutoBrightnessPreferenceController.java
index 3b53fa8..0018d84 100644
--- a/src/com/android/settings/display/AutoBrightnessPreferenceController.java
+++ b/src/com/android/settings/display/AutoBrightnessPreferenceController.java
@@ -19,7 +19,6 @@
import android.content.Context;
import android.provider.Settings;
-import android.text.TextUtils;
import com.android.settings.R;
import com.android.settings.core.TogglePreferenceController;
@@ -52,16 +51,11 @@
public int getAvailabilityStatus() {
return mContext.getResources().getBoolean(
com.android.internal.R.bool.config_automatic_brightness_available)
- ? AVAILABLE
+ ? AVAILABLE_UNSEARCHABLE
: UNSUPPORTED_ON_DEVICE;
}
@Override
- public boolean isSliceable() {
- return TextUtils.equals(getPreferenceKey(), "auto_brightness");
- }
-
- @Override
public CharSequence getSummary() {
return mContext.getText(isChecked()
? R.string.auto_brightness_summary_on
diff --git a/src/com/android/settings/network/telephony/DisabledSubscriptionController.java b/src/com/android/settings/network/telephony/DisabledSubscriptionController.java
new file mode 100644
index 0000000..22cbb13
--- /dev/null
+++ b/src/com/android/settings/network/telephony/DisabledSubscriptionController.java
@@ -0,0 +1,91 @@
+/*
+ * Copyright (C) 2019 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.network.telephony;
+
+import static androidx.lifecycle.Lifecycle.Event.ON_PAUSE;
+import static androidx.lifecycle.Lifecycle.Event.ON_RESUME;
+
+import android.content.Context;
+import android.telephony.SubscriptionManager;
+
+import androidx.lifecycle.Lifecycle;
+import androidx.lifecycle.LifecycleObserver;
+import androidx.lifecycle.OnLifecycleEvent;
+import androidx.preference.PreferenceCategory;
+import androidx.preference.PreferenceScreen;
+
+import com.android.settings.core.BasePreferenceController;
+import com.android.settings.network.SubscriptionsChangeListener;
+
+public class DisabledSubscriptionController extends BasePreferenceController implements
+ SubscriptionsChangeListener.SubscriptionsChangeListenerClient, LifecycleObserver {
+ private PreferenceCategory mCategory;
+ private int mSubId;
+ private SubscriptionsChangeListener mChangeListener;
+ private SubscriptionManager mSubscriptionManager;
+
+ public DisabledSubscriptionController(Context context, String preferenceKey) {
+ super(context, preferenceKey);
+ mSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
+ mSubscriptionManager = mContext.getSystemService(SubscriptionManager.class);
+ mChangeListener = new SubscriptionsChangeListener(context, this);
+ }
+
+ public void init(Lifecycle lifecycle, int subId) {
+ lifecycle.addObserver(this);
+ mSubId = subId;
+ }
+
+ @OnLifecycleEvent(ON_RESUME)
+ public void onResume() {
+ mChangeListener.start();
+ update();
+ }
+
+ @OnLifecycleEvent(ON_PAUSE)
+ public void onPause() {
+ mChangeListener.stop();
+ }
+
+ @Override
+ public void displayPreference(PreferenceScreen screen) {
+ super.displayPreference(screen);
+ mCategory = screen.findPreference(getPreferenceKey());
+ update();
+ }
+
+ private void update() {
+ if (mCategory == null || mSubId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
+ return;
+ }
+ mCategory.setVisible(mSubscriptionManager.isSubscriptionEnabled(mSubId));
+ }
+
+ @Override
+ public int getAvailabilityStatus() {
+ return AVAILABLE_UNSEARCHABLE;
+ }
+
+ @Override
+ public void onAirplaneModeChanged(boolean airplaneModeEnabled) {
+ }
+
+ @Override
+ public void onSubscriptionsChanged() {
+ update();
+ }
+}
diff --git a/src/com/android/settings/network/telephony/MobileDataPreferenceController.java b/src/com/android/settings/network/telephony/MobileDataPreferenceController.java
index a0e50fc..0a39bfd 100644
--- a/src/com/android/settings/network/telephony/MobileDataPreferenceController.java
+++ b/src/com/android/settings/network/telephony/MobileDataPreferenceController.java
@@ -17,27 +17,24 @@
package com.android.settings.network.telephony;
import android.content.Context;
-import android.database.ContentObserver;
-import android.net.Uri;
import android.os.Handler;
import android.os.Looper;
-import android.provider.Settings;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
-import com.android.settings.network.MobileDataContentObserver;
-import com.android.settingslib.core.lifecycle.LifecycleObserver;
-import com.android.settingslib.core.lifecycle.events.OnStart;
-import com.android.settingslib.core.lifecycle.events.OnStop;
-
import androidx.annotation.VisibleForTesting;
import androidx.fragment.app.FragmentManager;
import androidx.preference.Preference;
import androidx.preference.PreferenceScreen;
import androidx.preference.SwitchPreference;
+import com.android.settings.network.MobileDataContentObserver;
+import com.android.settingslib.core.lifecycle.LifecycleObserver;
+import com.android.settingslib.core.lifecycle.events.OnStart;
+import com.android.settingslib.core.lifecycle.events.OnStop;
+
/**
* Preference controller for "Mobile data"
*/
@@ -60,7 +57,7 @@
super(context, key);
mSubscriptionManager = context.getSystemService(SubscriptionManager.class);
mDataContentObserver = new MobileDataContentObserver(new Handler(Looper.getMainLooper()));
- mDataContentObserver.setOnMobileDataChangedListener(()-> updateState(mPreference));
+ mDataContentObserver.setOnMobileDataChangedListener(() -> updateState(mPreference));
}
@Override
@@ -144,18 +141,10 @@
final int defaultSubId = mSubscriptionManager.getDefaultDataSubscriptionId();
final boolean needToDisableOthers = mSubscriptionManager
.isActiveSubscriptionId(defaultSubId) && defaultSubId != mSubId;
- if (enableData) {
- if (isMultiSim && needToDisableOthers) {
- mDialogType = MobileDataDialogFragment.TYPE_MULTI_SIM_DIALOG;
- return true;
- }
- } else {
- if (!isMultiSim) {
- mDialogType = MobileDataDialogFragment.TYPE_DISABLE_DIALOG;
- return true;
- }
+ if (enableData && isMultiSim && needToDisableOthers) {
+ mDialogType = MobileDataDialogFragment.TYPE_MULTI_SIM_DIALOG;
+ return true;
}
-
return false;
}
diff --git a/src/com/android/settings/network/telephony/MobileNetworkSettings.java b/src/com/android/settings/network/telephony/MobileNetworkSettings.java
index db99258..eb00b9f 100644
--- a/src/com/android/settings/network/telephony/MobileNetworkSettings.java
+++ b/src/com/android/settings/network/telephony/MobileNetworkSettings.java
@@ -131,12 +131,13 @@
super.onAttach(context);
if (FeatureFlagPersistent.isEnabled(getContext(), FeatureFlags.NETWORK_INTERNET_V2)) {
- use(CallsDefaultSubscriptionController.class).init(getLifecycle());
- use(SmsDefaultSubscriptionController.class).init(getLifecycle());
- use(MobileNetworkSwitchController.class).init(getLifecycle(), mSubId);
- use(CarrierSettingsVersionPreferenceController.class).init(mSubId);
- use(BillingCyclePreferenceController.class).init(mSubId);
- use(MmsMessagePreferenceController.class).init(mSubId);
+ use(CallsDefaultSubscriptionController.class).init(getLifecycle());
+ use(SmsDefaultSubscriptionController.class).init(getLifecycle());
+ use(MobileNetworkSwitchController.class).init(getLifecycle(), mSubId);
+ use(CarrierSettingsVersionPreferenceController.class).init(mSubId);
+ use(BillingCyclePreferenceController.class).init(mSubId);
+ use(MmsMessagePreferenceController.class).init(mSubId);
+ use(DisabledSubscriptionController.class).init(getLifecycle(), mSubId);
}
use(MobileDataPreferenceController.class).init(getFragmentManager(), mSubId);
use(RoamingPreferenceController.class).init(getFragmentManager(), mSubId);
diff --git a/src/com/android/settings/notification/ImportancePreference.java b/src/com/android/settings/notification/ImportancePreference.java
index 5572b12..687782b 100644
--- a/src/com/android/settings/notification/ImportancePreference.java
+++ b/src/com/android/settings/notification/ImportancePreference.java
@@ -91,6 +91,7 @@
@Override
public void onBindViewHolder(PreferenceViewHolder holder) {
super.onBindViewHolder(holder);
+ holder.itemView.setClickable(false);
TextView textView = (TextView) holder.findViewById(R.id.description);
mSilenceButton = (Button) holder.findViewById(R.id.silence);
diff --git a/src/com/android/settings/notification/NotificationBackend.java b/src/com/android/settings/notification/NotificationBackend.java
index f27f979..def820c 100644
--- a/src/com/android/settings/notification/NotificationBackend.java
+++ b/src/com/android/settings/notification/NotificationBackend.java
@@ -425,10 +425,12 @@
return StringUtil.formatRelativeTime(
context, System.currentTimeMillis() - state.lastSent, true);
} else {
- if (state.avgSentWeekly > 0) {
- return context.getString(R.string.notifications_sent_weekly, state.avgSentWeekly);
+ if (state.avgSentDaily > 0) {
+ return context.getResources().getQuantityString(R.plurals.notifications_sent_daily,
+ state.avgSentDaily, state.avgSentDaily);
}
- return context.getString(R.string.notifications_sent_daily, state.avgSentDaily);
+ return context.getResources().getQuantityString(R.plurals.notifications_sent_weekly,
+ state.avgSentWeekly, state.avgSentWeekly);
}
}
diff --git a/src/com/android/settings/panel/PanelSlicesAdapter.java b/src/com/android/settings/panel/PanelSlicesAdapter.java
index dcd878e..0f525cc 100644
--- a/src/com/android/settings/panel/PanelSlicesAdapter.java
+++ b/src/com/android/settings/panel/PanelSlicesAdapter.java
@@ -33,6 +33,7 @@
import com.android.settings.R;
import com.android.settings.overlay.FeatureFactory;
+
import com.google.android.setupdesign.DividerItemDecoration;
import java.util.ArrayList;
@@ -128,7 +129,8 @@
.action(0 /* attribution */,
SettingsEnums.ACTION_PANEL_INTERACTION,
mMetricsCategory,
- sliceLiveData.toString() /* log key */,
+ sliceLiveData.getValue().getUri().getLastPathSegment()
+ /* log key */,
eventInfo.actionType /* value */);
})
);
diff --git a/src/com/android/settings/sim/SimListDialogFragment.java b/src/com/android/settings/sim/SimListDialogFragment.java
index 1802d65..3b78927 100644
--- a/src/com/android/settings/sim/SimListDialogFragment.java
+++ b/src/com/android/settings/sim/SimListDialogFragment.java
@@ -174,7 +174,7 @@
if (sub == null) {
title.setText(R.string.sim_calls_ask_first_prefs_title);
summary.setText("");
- icon.setImageDrawable(mContext.getDrawable(R.drawable.ic_help));
+ icon.setImageDrawable(mContext.getDrawable(R.drawable.ic_feedback_24dp));
icon.setImageTintList(
Utils.getColorAttr(mContext, android.R.attr.textColorSecondary));
} else {
diff --git a/tests/robotests/src/com/android/settings/applications/AppStateNotificationBridgeTest.java b/tests/robotests/src/com/android/settings/applications/AppStateNotificationBridgeTest.java
index 10f3706..24cb10d 100644
--- a/tests/robotests/src/com/android/settings/applications/AppStateNotificationBridgeTest.java
+++ b/tests/robotests/src/com/android/settings/applications/AppStateNotificationBridgeTest.java
@@ -398,8 +398,20 @@
mContext, sentRarely, R.id.sort_order_frequent_notification).toString())
.contains("1");
assertThat(AppStateNotificationBridge.getSummary(
+ mContext, sentRarely, R.id.sort_order_frequent_notification).toString())
+ .contains("notification ");
+ assertThat(AppStateNotificationBridge.getSummary(
+ mContext, sentRarely, R.id.sort_order_frequent_notification).toString())
+ .contains("week");
+ assertThat(AppStateNotificationBridge.getSummary(
mContext, sentOften, R.id.sort_order_frequent_notification).toString())
.contains("8");
+ assertThat(AppStateNotificationBridge.getSummary(
+ mContext, sentOften, R.id.sort_order_frequent_notification).toString())
+ .contains("notifications");
+ assertThat(AppStateNotificationBridge.getSummary(
+ mContext, sentOften, R.id.sort_order_frequent_notification).toString())
+ .contains("day");
}
@Test
diff --git a/tests/robotests/src/com/android/settings/display/AutoBrightnessDetailPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/display/AutoBrightnessDetailPreferenceControllerTest.java
new file mode 100644
index 0000000..e76cff6
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/display/AutoBrightnessDetailPreferenceControllerTest.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2019 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.display;
+
+import static com.android.settings.core.BasePreferenceController.AVAILABLE;
+import static com.android.settings.core.BasePreferenceController.UNSUPPORTED_ON_DEVICE;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import com.android.settings.testutils.shadow.SettingsShadowResources;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.MockitoAnnotations;
+import org.robolectric.RobolectricTestRunner;
+import org.robolectric.RuntimeEnvironment;
+import org.robolectric.annotation.Config;
+
+@RunWith(RobolectricTestRunner.class)
+@Config(shadows = {SettingsShadowResources.class})
+public class AutoBrightnessDetailPreferenceControllerTest {
+
+ private AutoBrightnessDetailPreferenceController mController;
+
+ @Before
+ public void setUp() {
+ MockitoAnnotations.initMocks(this);
+ mController = new AutoBrightnessDetailPreferenceController(
+ RuntimeEnvironment.application, "test_key");
+ }
+
+ @Test
+ public void isSliceable_returnTrue() {
+ mController.onPreferenceChange(null, true);
+
+ assertThat(mController.isSliceable()).isTrue();
+ }
+
+ @Test
+ public void getAvailabilityStatus_configTrueSet_shouldReturnAvailable() {
+ SettingsShadowResources.overrideResource(
+ com.android.internal.R.bool.config_automatic_brightness_available, true);
+
+ assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE);
+ }
+
+ @Test
+ public void getAvailabilityStatus_configFalseSet_shouldReturnUnsupportedOnDevice() {
+ SettingsShadowResources.overrideResource(
+ com.android.internal.R.bool.config_automatic_brightness_available, false);
+
+ assertThat(mController.getAvailabilityStatus()).isEqualTo(UNSUPPORTED_ON_DEVICE);
+ }
+}
diff --git a/tests/robotests/src/com/android/settings/display/AutoBrightnessPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/display/AutoBrightnessPreferenceControllerTest.java
index a8edc44..0229173 100644
--- a/tests/robotests/src/com/android/settings/display/AutoBrightnessPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/display/AutoBrightnessPreferenceControllerTest.java
@@ -20,6 +20,9 @@
import static android.provider.Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC;
import static android.provider.Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL;
+import static com.android.settings.core.BasePreferenceController.AVAILABLE_UNSEARCHABLE;
+import static com.android.settings.core.BasePreferenceController.UNSUPPORTED_ON_DEVICE;
+
import static com.google.common.truth.Truth.assertThat;
import android.content.ContentResolver;
@@ -27,6 +30,7 @@
import android.provider.Settings;
import com.android.settings.R;
+import com.android.settings.testutils.shadow.SettingsShadowResources;
import org.junit.Before;
import org.junit.Test;
@@ -34,8 +38,10 @@
import org.mockito.MockitoAnnotations;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.RuntimeEnvironment;
+import org.robolectric.annotation.Config;
@RunWith(RobolectricTestRunner.class)
+@Config(shadows = {SettingsShadowResources.class})
public class AutoBrightnessPreferenceControllerTest {
private static final String PREFERENCE_KEY = "auto_brightness";
@@ -115,17 +121,18 @@
}
@Test
- public void isSliceable_correctKey_returnsTrue() {
- final AutoBrightnessPreferenceController controller =
- new AutoBrightnessPreferenceController(mContext,
- "auto_brightness");
- assertThat(controller.isSliceable()).isTrue();
+ public void getAvailabilityStatus_configTrueSet_shouldReturnAvailableUnsearchable() {
+ SettingsShadowResources.overrideResource(
+ com.android.internal.R.bool.config_automatic_brightness_available, true);
+
+ assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE_UNSEARCHABLE);
}
@Test
- public void isSliceable_incorrectKey_returnsFalse() {
- final AutoBrightnessPreferenceController controller =
- new AutoBrightnessPreferenceController(mContext, "bad_key");
- assertThat(controller.isSliceable()).isFalse();
+ public void getAvailabilityStatus_configFalseSet_shouldReturnUnsupportedOnDevice() {
+ SettingsShadowResources.overrideResource(
+ com.android.internal.R.bool.config_automatic_brightness_available, false);
+
+ assertThat(mController.getAvailabilityStatus()).isEqualTo(UNSUPPORTED_ON_DEVICE);
}
}
diff --git a/tests/robotests/src/com/android/settings/homepage/contextualcards/slices/NotificationChannelSliceTest.java b/tests/robotests/src/com/android/settings/homepage/contextualcards/slices/NotificationChannelSliceTest.java
index 81f5797..6c020f8 100644
--- a/tests/robotests/src/com/android/settings/homepage/contextualcards/slices/NotificationChannelSliceTest.java
+++ b/tests/robotests/src/com/android/settings/homepage/contextualcards/slices/NotificationChannelSliceTest.java
@@ -151,7 +151,8 @@
for (int i = 0; i < rowItems.size(); i++) {
// Assert the summary text is the same as expectation.
assertThat(getSummaryFromSliceItem(rowItems.get(i))).isEqualTo(
- mContext.getString(R.string.notifications_sent_weekly, CHANNEL_COUNT - i));
+ mContext.getResources().getQuantityString(R.plurals.notifications_sent_weekly,
+ CHANNEL_COUNT - i, CHANNEL_COUNT - i));
}
}
diff --git a/tests/robotests/src/com/android/settings/network/telephony/DisabledSubscriptionControllerTest.java b/tests/robotests/src/com/android/settings/network/telephony/DisabledSubscriptionControllerTest.java
new file mode 100644
index 0000000..c1004fa
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/network/telephony/DisabledSubscriptionControllerTest.java
@@ -0,0 +1,101 @@
+/*
+ * Copyright (C) 2019 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.network.telephony;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.spy;
+
+import android.content.Context;
+import android.telephony.SubscriptionManager;
+
+import androidx.lifecycle.LifecycleOwner;
+import androidx.preference.PreferenceCategory;
+import androidx.preference.PreferenceScreen;
+
+import com.android.settingslib.core.lifecycle.Lifecycle;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.robolectric.RobolectricTestRunner;
+import org.robolectric.RuntimeEnvironment;
+
+@RunWith(RobolectricTestRunner.class)
+public class DisabledSubscriptionControllerTest {
+
+ private static final String KEY = "disabled_subscription_category";
+ private static final int SUB_ID = 111;
+
+ @Mock
+ private SubscriptionManager mSubscriptionManager;
+ @Mock
+ private PreferenceScreen mScreen;
+
+ private PreferenceCategory mCategory;
+ private Context mContext;
+ private Lifecycle mLifecycle;
+ private DisabledSubscriptionController mController;
+
+ @Before
+ public void setUp() {
+ MockitoAnnotations.initMocks(this);
+ mContext = spy(RuntimeEnvironment.application);
+ LifecycleOwner lifecycleOwner = () -> mLifecycle;
+ mLifecycle = new Lifecycle(lifecycleOwner);
+ doReturn(mSubscriptionManager).when(mContext).getSystemService(SubscriptionManager.class);
+ mCategory = new PreferenceCategory(mContext);
+ doReturn(mCategory).when(mScreen).findPreference(KEY);
+ mController = new DisabledSubscriptionController(mContext, KEY);
+ mController.init(mLifecycle, SUB_ID);
+ }
+
+ @Test
+ public void displayPreference_subscriptionEnabled_categoryIsVisible() {
+ doReturn(true).when(mSubscriptionManager).isSubscriptionEnabled(SUB_ID);
+ mController.displayPreference(mScreen);
+ assertThat(mCategory.isVisible()).isTrue();
+ }
+
+ @Test
+ public void displayPreference_subscriptionDisabled_categoryIsNotVisible() {
+ doReturn(false).when(mSubscriptionManager).isSubscriptionEnabled(SUB_ID);
+ mController.displayPreference(mScreen);
+ assertThat(mCategory.isVisible()).isFalse();
+ }
+
+ @Test
+ public void onSubscriptionsChanged_subscriptionBecomesDisabled_categoryIsNotVisible() {
+ doReturn(true).when(mSubscriptionManager).isSubscriptionEnabled(SUB_ID);
+ mController.displayPreference(mScreen);
+ doReturn(false).when(mSubscriptionManager).isSubscriptionEnabled(SUB_ID);
+ mController.onSubscriptionsChanged();
+ assertThat(mCategory.isVisible()).isFalse();
+ }
+
+ @Test
+ public void onSubscriptionsChanged_subscriptionBecomesEnabled_categoryIsVisible() {
+ doReturn(false).when(mSubscriptionManager).isSubscriptionEnabled(SUB_ID);
+ mController.displayPreference(mScreen);
+ doReturn(true).when(mSubscriptionManager).isSubscriptionEnabled(SUB_ID);
+ mController.onSubscriptionsChanged();
+ assertThat(mCategory.isVisible()).isTrue();
+ }
+}
diff --git a/tests/robotests/src/com/android/settings/network/telephony/MobileDataPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/network/telephony/MobileDataPreferenceControllerTest.java
index 1b7b4b4..e853c47 100644
--- a/tests/robotests/src/com/android/settings/network/telephony/MobileDataPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/network/telephony/MobileDataPreferenceControllerTest.java
@@ -21,7 +21,6 @@
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.never;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
@@ -30,6 +29,10 @@
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
+import androidx.fragment.app.FragmentManager;
+import androidx.fragment.app.FragmentTransaction;
+import androidx.preference.SwitchPreference;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -40,10 +43,6 @@
import org.robolectric.annotation.Config;
import org.robolectric.shadows.ShadowSubscriptionManager;
-import androidx.fragment.app.FragmentManager;
-import androidx.fragment.app.FragmentTransaction;
-import androidx.preference.SwitchPreference;
-
@RunWith(RobolectricTestRunner.class)
@Config(shadows = ShadowSubscriptionManager.class)
public class MobileDataPreferenceControllerTest {
@@ -94,14 +93,13 @@
}
@Test
- public void isDialogNeeded_disableSingleSim_returnTrue() {
+ public void isDialogNeeded_disableSingleSim_returnFalse() {
doReturn(true).when(mTelephonyManager).isDataEnabled();
doReturn(mSubscriptionInfo).when(mSubscriptionManager).getActiveSubscriptionInfo(SUB_ID);
doReturn(mSubscriptionInfo).when(mSubscriptionManager).getDefaultDataSubscriptionInfo();
doReturn(1).when(mTelephonyManager).getSimCount();
- assertThat(mController.isDialogNeeded()).isTrue();
- assertThat(mController.mDialogType).isEqualTo(MobileDataDialogFragment.TYPE_DISABLE_DIALOG);
+ assertThat(mController.isDialogNeeded()).isFalse();
}
@Test
@@ -127,7 +125,7 @@
}
@Test
- public void onPreferenceChange_needDialog_doNothing() {
+ public void onPreferenceChange_singleSim_On_shouldEnableData() {
doReturn(true).when(mTelephonyManager).isDataEnabled();
doReturn(mSubscriptionInfo).when(mSubscriptionManager).getActiveSubscriptionInfo(SUB_ID);
doReturn(mSubscriptionInfo).when(mSubscriptionManager).getDefaultDataSubscriptionInfo();
@@ -135,11 +133,11 @@
mController.onPreferenceChange(mPreference, true);
- verify(mTelephonyManager, never()).setDataEnabled(true);
+ verify(mTelephonyManager).setDataEnabled(true);
}
@Test
- public void onPreferenceChange_notNeedDialog_update() {
+ public void onPreferenceChange_multiSim_On_shouldEnableData() {
doReturn(true).when(mTelephonyManager).isDataEnabled();
doReturn(mSubscriptionInfo).when(mSubscriptionManager).getActiveSubscriptionInfo(SUB_ID);
doReturn(mSubscriptionInfo).when(mSubscriptionManager).getDefaultDataSubscriptionInfo();