Merge "Reduce flickers when launching Storage Settings" into sc-dev
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index f992e45..c4bf977 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -2448,7 +2448,7 @@
<activity
android:name="com.android.settings.accounts.AddAccountSettings"
- android:theme="@android:style/Theme.Translucent.NoTitleBar"
+ android:theme="@style/Theme.SubSettings"
android:configChanges="orientation|keyboardHidden|screenSize"
android:exported="true"
android:label="@string/header_add_an_account">
@@ -3190,7 +3190,7 @@
</activity>
<activity android:name=".enterprise.ActionDisabledByAdminDialog"
- android:theme="@style/Transparent"
+ android:theme="@style/Theme.AlertDialog"
android:taskAffinity="com.android.settings.enterprise"
android:excludeFromRecents="true"
android:exported="true"
diff --git a/res/layout/battery_chart_graph.xml b/res/layout/battery_chart_graph.xml
index 65d41cf..db86693 100644
--- a/res/layout/battery_chart_graph.xml
+++ b/res/layout/battery_chart_graph.xml
@@ -34,8 +34,8 @@
<com.android.settings.fuelgauge.BatteryChartView
android:id="@+id/battery_chart"
android:layout_width="match_parent"
- android:layout_height="165dp"
- android:layout_marginBottom="16dp"
+ android:layout_height="170dp"
+ android:layout_marginBottom="6dp"
android:visibility="invisible"
android:contentDescription="@string/battery_usage_chart"
android:textAppearance="?android:attr/textAppearanceSmall"
diff --git a/res/layout/preference_volume_slider.xml b/res/layout/preference_volume_slider.xml
index 34c732d..7c07d5e 100644
--- a/res/layout/preference_volume_slider.xml
+++ b/res/layout/preference_volume_slider.xml
@@ -58,8 +58,7 @@
android:layout_weight="1"
android:paddingStart="12dp"
android:singleLine="true"
- android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Subhead"
- android:textColor="?android:attr/textColorPrimary"
+ android:textAppearance="@style/TextAppearance.PreferenceTitle.SettingsLib"
android:ellipsize="marquee"
android:fadingEdge="horizontal"/>
<!-- Preference should place its actual preference widget here. -->
diff --git a/res/layout/reset_esim_checkbox.xml b/res/layout/reset_esim_checkbox.xml
index 44b9a28..626ecc3 100644
--- a/res/layout/reset_esim_checkbox.xml
+++ b/res/layout/reset_esim_checkbox.xml
@@ -43,13 +43,13 @@
android:orientation="vertical">
<TextView
- style="@style/TextAppearance.SudGlifItemTitle"
+ style="@style/TextAppearance.PreferenceTitle.SettingsLib"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/reset_esim_title"/>
<TextView
- style="@style/TextAppearance.SudGlifItemSummary"
+ style="?android:attr/textAppearanceSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/reset_esim_desc"/>
diff --git a/res/layout/reset_network.xml b/res/layout/reset_network.xml
index 47fa56a..ac1563e 100644
--- a/res/layout/reset_network.xml
+++ b/res/layout/reset_network.xml
@@ -18,12 +18,12 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
+ android:paddingStart="?android:attr/listPreferredItemPaddingStart"
+ android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
android:orientation="vertical" >
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="0dip"
- android:layout_marginStart="@dimen/reset_network_margin_start"
- android:layout_marginEnd="@dimen/reset_network_margin_end"
android:layout_marginTop="12dp"
android:layout_weight="1">
<LinearLayout
@@ -33,7 +33,7 @@
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:textSize="18sp"
+ android:textAppearance="@style/TextAppearance.PreferenceTitle.SettingsLib"
android:textDirection="locale"
android:text="@string/reset_network_desc" />
<include layout="@layout/reset_esim_checkbox"/>
diff --git a/res/layout/reset_network_confirm.xml b/res/layout/reset_network_confirm.xml
index 456049e..4a95942 100644
--- a/res/layout/reset_network_confirm.xml
+++ b/res/layout/reset_network_confirm.xml
@@ -22,10 +22,10 @@
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"
- android:layout_marginStart="@dimen/reset_network_margin_start"
- android:layout_marginEnd="@dimen/reset_network_margin_end"
+ android:layout_marginStart="?android:attr/listPreferredItemPaddingStart"
+ android:layout_marginEnd="?android:attr/listPreferredItemPaddingEnd"
android:layout_marginTop="12dp"
- android:textSize="18sp"
+ android:textAppearance="@style/TextAppearance.PreferenceTitle.SettingsLib"
android:text="@string/reset_network_final_desc" />
<Button
android:id="@+id/execute_reset_network"
diff --git a/res/layout/settings_summary_preference.xml b/res/layout/settings_summary_preference.xml
index e76190f..c4b6c1c 100644
--- a/res/layout/settings_summary_preference.xml
+++ b/res/layout/settings_summary_preference.xml
@@ -18,7 +18,7 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:paddingStart="@dimen/preference_no_icon_padding_start"
+ android:paddingStart="?android:attr/listPreferredItemPaddingStart"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
android:orientation="vertical">
diff --git a/res/values-night/colors.xml b/res/values-night/colors.xml
index 2cdbd3f..3c829f4 100644
--- a/res/values-night/colors.xml
+++ b/res/values-night/colors.xml
@@ -21,8 +21,6 @@
<color name="homepage_support_background">#3F5FBD</color>
<color name="homepage_card_dismissal_background">@*android:color/material_grey_900</color>
<color name="contextual_card_background">@*android:color/material_grey_900</color>
- <!-- Dialog background color. -->
- <color name="dialog_background">@*android:color/material_grey_800</color>
<color name="notification_importance_selection_bg">@*android:color/material_grey_800</color>
<color name="notification_importance_button_selected">#AECBFA</color> <!-- material blue 200 -->
<color name="notification_importance_button_unselected">#5F6368</color>
diff --git a/res/values-night/themes.xml b/res/values-night/themes.xml
index d80b271..9faaede 100644
--- a/res/values-night/themes.xml
+++ b/res/values-night/themes.xml
@@ -15,7 +15,8 @@
limitations under the License.
-->
-<resources>
+<resources
+ xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
<style name="Theme.Settings.Home" parent="Theme.Settings.HomeBase">
<item name="colorPrimary">@*android:color/primary_device_default_settings</item>
@@ -31,7 +32,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:colorBackground">@color/dialog_background</item>
+ <item name="android:colorBackground">?androidprv:attr/colorSurface</item>
</style>
<!-- Material theme for the pages containing TabLayout and ViewPager -->
diff --git a/res/values/colors.xml b/res/values/colors.xml
index ab8489c..c4f28f7 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -147,9 +147,6 @@
<!-- Search bar background color -->
<color name="search_bar_background">?androidprv:attr/colorSurface</color>
- <!-- Dialog background color -->
- <color name="dialog_background">@*android:color/background_device_default_light</color>
-
<color name="face_intro_outline">#ffdadce0</color>
<color name="back_gesture_indicator">#4182ef</color>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index e023c70..bb38fcc 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -5188,7 +5188,7 @@
<!-- Label for suggested action which will allow the user to change the font size and other accessibility settings. [CHAR LIMIT=40] -->
<string name="vision_settings_suggestion_title">Change font size</string>
<!-- Title for the accessibility preference category of screen reader services and settings. [CHAR LIMIT=50] -->
- <string name="screen_reader_category_title">Screen readers</string>
+ <string name="screen_reader_category_title">Screen reader</string>
<!-- Title for the accessibility preference category of caption services and settings. [CHAR LIMIT=50] -->
<string name="captions_category_title">Captions</string>
<!-- Title for the accessibility preference category of audio services and settings. [CHAR LIMIT=50] -->
@@ -5999,6 +5999,8 @@
<string name="manager_battery_usage_unrestricted_only">unrestricted</string>
<!-- The state when app is limited to optimized option only (e.g This app requires optimized battery usage) [CHAR_LIMIT=40] -->
<string name="manager_battery_usage_optimized_only">optimized</string>
+ <!-- Accessibility description for battery usage learn more link [CHAR LIMIT=NONE] -->
+ <string name="manager_battery_usage_link_a11y">Learn more about battery usage options</string>
<!-- Title for the screen usage in power use UI [CHAR_LIMIT=60] -->
<string name="device_screen_usage">Screen usage since full charge</string>
@@ -6087,6 +6089,8 @@
<string name="battery_tip_early_heads_up_summary">Battery may run out earlier than usual</string>
<!-- Title when early heads up is solved [CHAR LIMIT=NONE] -->
<string name="battery_tip_early_heads_up_done_title">Battery Saver on</string>
+ <!-- Accessibility description for battery saver learn more link [CHAR LIMIT=NONE] -->
+ <string name="battery_saver_link_a11y">Learn more about Battery saver</string>
<!-- Summary when early heads up is solved [CHAR LIMIT=NONE] -->
<string name="battery_tip_early_heads_up_done_summary">Some features may be limited</string>
<!-- Title for the battery high usage tip [CHAR LIMIT=NONE] -->
@@ -12152,6 +12156,9 @@
<!-- Help URI, battery saver page [DO NOT TRANSLATE] -->
<string name="help_url_battery_saver_settings" translatable="false"></string>
+ <!-- Help URI, app usage page [DO NOT TRANSLATE] -->
+ <string name="help_url_app_usage_settings" translatable="false"></string>
+
<!-- Help URI, smart battery page [DO NOT TRANSLATE] -->
<string name="help_uri_smart_battery_settings" translatable="false"></string>
@@ -12905,9 +12912,7 @@
<string name="hwui_force_dark_summary">Overrides the force-dark feature to be always-on</string>
<!-- If blurs are supported on SurfaceFlinger. [CHAR LIMIT=60] -->
- <string name="enable_blurs_on_windows_title">Enable blurs</string>
- <!-- If blurs are supported on SurfaceFlinger, summary. [CHAR LIMIT=NONE] -->
- <string name="enable_blurs_on_windows_summary">Enables window blurs at compositor level. Requires device reboot.</string>
+ <string name="enable_blurs_on_windows_title">Window-level blurs</string>
<!-- Title for the top level Privacy Settings [CHAR LIMIT=30]-->
<string name="privacy_dashboard_title">Privacy</string>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 7b8a75d..2a13b32 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -409,7 +409,9 @@
<item name="android:scaleY">0.5</item>
</style>
- <style name="ActionPrimaryButton" parent="android:Widget.DeviceDefault.Button.Colored"/>
+ <style name="ActionPrimaryButton" parent="android:Widget.DeviceDefault.Button.Colored">
+ <item name="android:theme">@style/RoundedCornerThemeOverlay</item>
+ </style>
<style name="ActionSecondaryButton" parent="android:Widget.DeviceDefault.Button"/>
<style name="RoundedCornerThemeOverlay">
diff --git a/res/values/themes.xml b/res/values/themes.xml
index 9681b03..07ca82d 100644
--- a/res/values/themes.xml
+++ b/res/values/themes.xml
@@ -14,7 +14,8 @@
limitations under the License.
-->
-<resources>
+<resources
+ xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
<style name="Transparent">
<item name="alertDialogTheme">@style/Theme.AlertDialog</item>
@@ -129,7 +130,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:colorBackground">@color/dialog_background</item>
+ <item name="android:colorBackground">?androidprv:attr/colorSurface</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 ebcf174..d0bf334 100644
--- a/res/xml/auto_brightness_detail.xml
+++ b/res/xml/auto_brightness_detail.xml
@@ -20,12 +20,6 @@
xmlns:settings="http://schemas.android.com/apk/res-auto"
android:title="@string/auto_brightness_title">
- <com.android.settingslib.widget.MainSwitchPreference
- android:key="auto_brightness"
- android:title="@string/adaptive_brightness_main_switch_title"
- settings:keywords="@string/keywords_display_auto_brightness"
- settings:controller="com.android.settings.display.AutoBrightnessDetailPreferenceController"/>
-
<com.android.settings.widget.VideoPreference
android:key="auto_brightness_video"
android:title="@string/summary_placeholder"
@@ -33,6 +27,12 @@
settings:preview="@drawable/aab_brightness"
settings:controller="com.android.settings.widget.VideoPreferenceController"/>
+ <com.android.settingslib.widget.MainSwitchPreference
+ android:key="auto_brightness"
+ android:title="@string/adaptive_brightness_main_switch_title"
+ settings:keywords="@string/keywords_display_auto_brightness"
+ settings:controller="com.android.settings.display.AutoBrightnessDetailPreferenceController"/>
+
<com.android.settingslib.widget.FooterPreference
android:key="auto_brightness_footer"
android:title="@string/auto_brightness_description"
diff --git a/res/xml/dark_mode_settings.xml b/res/xml/dark_mode_settings.xml
index 5ac9e26..41946c1 100644
--- a/res/xml/dark_mode_settings.xml
+++ b/res/xml/dark_mode_settings.xml
@@ -20,6 +20,11 @@
android:title="@string/dark_ui_mode"
settings:keywords="@string/keywords_dark_ui_mode">
+ <com.android.settingslib.widget.TopIntroPreference
+ android:key="dark_ui_top_intro"
+ android:title="@string/dark_ui_text"
+ settings:searchable="false"/>
+
<com.android.settingslib.widget.MainSwitchPreference
android:key="dark_ui_activated"
android:title="@string/dark_theme_main_switch_title"
@@ -30,11 +35,6 @@
android:title="@string/twilight_mode_location_off_dialog_message"
settings:controller="com.android.settings.display.TwilightLocationPreferenceController"/>
- <com.android.settingslib.widget.TopIntroPreference
- android:key="dark_ui_top_intro"
- android:title="@string/dark_ui_text"
- settings:searchable="false"/>
-
<DropDownPreference
android:key="dark_ui_auto_mode"
android:title="@string/dark_ui_auto_mode_title"
diff --git a/res/xml/development_settings.xml b/res/xml/development_settings.xml
index 7827180..51733ff 100644
--- a/res/xml/development_settings.xml
+++ b/res/xml/development_settings.xml
@@ -25,7 +25,6 @@
<Preference
android:key="memory"
- android:icon="@drawable/ic_settings_memory"
android:title="@string/memory_settings_title"
android:summary="@string/summary_placeholder"
android:fragment="com.android.settings.applications.ProcessStatsSummary" />
@@ -297,7 +296,6 @@
<com.android.settingslib.RestrictedSwitchPreference
android:key="default_usb_configuration"
android:fragment="com.android.settings.connecteddevice.usb.UsbDefaultFragment"
- android:icon="@drawable/ic_usb"
android:title="@string/usb_default_label"/>
<SwitchPreference
@@ -492,8 +490,7 @@
<SwitchPreference
android:key="enable_blurs_on_windows"
- android:title="@string/enable_blurs_on_windows_title"
- android:summary="@string/enable_blurs_on_windows_summary" />
+ android:title="@string/enable_blurs_on_windows_title"/>
<SwitchPreference
android:key="force_msaa"
diff --git a/res/xml/night_display_settings.xml b/res/xml/night_display_settings.xml
index 23afccf..95d5034 100644
--- a/res/xml/night_display_settings.xml
+++ b/res/xml/night_display_settings.xml
@@ -20,6 +20,11 @@
android:title="@string/night_display_title"
settings:keywords="@string/keywords_display_night_display">
+ <com.android.settingslib.widget.TopIntroPreference
+ android:key="night_display_top_intro"
+ android:title="@string/night_display_text"
+ settings:controller="com.android.settings.display.NightDisplayTopIntroPreferenceController"/>
+
<com.android.settingslib.widget.MainSwitchPreference
android:key="night_display_activated"
android:title="@string/night_light_main_switch_title"
@@ -30,11 +35,6 @@
android:title="@string/twilight_mode_location_off_dialog_message"
settings:controller="com.android.settings.display.TwilightLocationPreferenceController"/>
- <com.android.settingslib.widget.TopIntroPreference
- android:key="night_display_top_intro"
- android:title="@string/night_display_text"
- settings:controller="com.android.settings.display.NightDisplayTopIntroPreferenceController"/>
-
<DropDownPreference
android:key="night_display_auto_mode"
android:title="@string/night_display_auto_mode_title"
diff --git a/res/xml/prevent_ringing_gesture_settings.xml b/res/xml/prevent_ringing_gesture_settings.xml
index 4080375..13e98e2 100644
--- a/res/xml/prevent_ringing_gesture_settings.xml
+++ b/res/xml/prevent_ringing_gesture_settings.xml
@@ -20,15 +20,15 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:title="@string/gesture_prevent_ringing_screen_title">
- <com.android.settingslib.widget.MainSwitchPreference
- android:key="gesture_prevent_ringing_switch" />
-
<com.android.settings.widget.VideoPreference
android:key="gesture_prevent_ringing_video"
app:animation="@raw/gesture_prevent_ringing"
app:preview="@drawable/gesture_prevent_ringing"
app:controller="com.android.settings.widget.VideoPreferenceController" />
+ <com.android.settingslib.widget.MainSwitchPreference
+ android:key="gesture_prevent_ringing_switch" />
+
<PreferenceCategory
android:key="gesture_prevent_ringing_category"
android:title="@string/gesture_prevent_ringing_title" />
diff --git a/res/xml/system_dashboard_fragment.xml b/res/xml/system_dashboard_fragment.xml
index 88b8d2f..9228ddd 100644
--- a/res/xml/system_dashboard_fragment.xml
+++ b/res/xml/system_dashboard_fragment.xml
@@ -18,16 +18,14 @@
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res-auto"
android:key="system_dashboard_screen"
- android:title="@string/header_category_system"
- settings:initialExpandedChildrenCount="4">
+ android:title="@string/header_category_system">
<Preference
android:key="language_input_settings"
android:title="@string/language_settings"
android:icon="@drawable/ic_settings_language"
android:order="-260"
- android:fragment="com.android.settings.language.LanguageAndInputSettings"
- settings:controller="com.android.settings.language.LanguageAndInputPreferenceController"/>
+ android:fragment="com.android.settings.language.LanguageAndInputSettings"/>
<Preference
android:key="gesture_settings"
@@ -45,35 +43,33 @@
android:fragment="com.android.settings.datetime.DateTimeSettings"
settings:controller="com.android.settings.datetime.DateTimePreferenceController"/>
- <Preference
- android:key="reset_dashboard"
- android:title="@string/reset_dashboard_title"
- android:summary="@string/reset_dashboard_summary"
- android:icon="@drawable/ic_restore"
- android:order="-50"
- android:fragment="com.android.settings.system.ResetDashboardFragment"
- settings:controller="com.android.settings.system.ResetPreferenceController"/>
-
<!-- System updates -->
<Preference
- android:key="system_update_settings"
- android:title="@string/system_update_settings_list_item_title"
- android:summary="@string/summary_placeholder"
- android:icon="@drawable/ic_system_update"
- android:order="-30"
- settings:keywords="@string/keywords_system_update_settings"
- settings:controller="com.android.settings.system.SystemUpdatePreferenceController">
- <intent android:action="android.settings.SYSTEM_UPDATE_SETTINGS"/>
- </Preference>
-
- <Preference
android:key="additional_system_update_settings"
android:title="@string/additional_system_update_settings_list_item_title"
- android:order="-31"
+ android:order="-59"
settings:controller="com.android.settings.system.AdditionalSystemUpdatePreferenceController">
<intent android:action="android.intent.action.MAIN"
android:targetPackage="@string/additional_system_update"
android:targetClass="@string/additional_system_update_menu"/>
</Preference>
-</PreferenceScreen>
\ No newline at end of file
+ <Preference
+ android:key="system_update_settings"
+ android:title="@string/system_update_settings_list_item_title"
+ android:summary="@string/summary_placeholder"
+ android:icon="@drawable/ic_system_update"
+ android:order="-58"
+ settings:keywords="@string/keywords_system_update_settings"
+ settings:controller="com.android.settings.system.SystemUpdatePreferenceController">
+ <intent android:action="android.settings.SYSTEM_UPDATE_SETTINGS"/>
+ </Preference>
+
+ <Preference
+ android:key="reset_dashboard"
+ android:title="@string/reset_dashboard_title"
+ android:icon="@drawable/ic_restore"
+ android:order="-30"
+ android:fragment="com.android.settings.system.ResetDashboardFragment"
+ settings:controller="com.android.settings.system.ResetPreferenceController"/>
+</PreferenceScreen>
diff --git a/res/xml/system_dashboard_fragment_v2.xml b/res/xml/system_dashboard_fragment_v2.xml
deleted file mode 100644
index 57174e9..0000000
--- a/res/xml/system_dashboard_fragment_v2.xml
+++ /dev/null
@@ -1,75 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2021 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<PreferenceScreen
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:settings="http://schemas.android.com/apk/res-auto"
- android:key="system_dashboard_screen"
- android:title="@string/header_category_system">
-
- <Preference
- android:key="language_input_settings"
- android:title="@string/language_settings"
- android:icon="@drawable/ic_settings_language"
- android:order="-260"
- android:fragment="com.android.settings.language.LanguageAndInputSettings"/>
-
- <Preference
- android:key="gesture_settings"
- android:title="@string/gesture_preference_title"
- android:icon="@drawable/ic_settings_gestures"
- android:order="-250"
- android:fragment="com.android.settings.gestures.GestureSettings"
- settings:controller="com.android.settings.gestures.GesturesSettingPreferenceController"/>
-
- <Preference
- android:key="date_time_settings"
- android:title="@string/date_and_time"
- android:icon="@drawable/ic_settings_date_time"
- android:order="-240"
- android:fragment="com.android.settings.datetime.DateTimeSettings"
- settings:controller="com.android.settings.datetime.DateTimePreferenceController"/>
-
- <!-- System updates -->
- <Preference
- android:key="system_update_settings"
- android:title="@string/system_update_settings_list_item_title"
- android:summary="@string/summary_placeholder"
- android:icon="@drawable/ic_system_update"
- android:order="-58"
- settings:keywords="@string/keywords_system_update_settings"
- settings:controller="com.android.settings.system.SystemUpdatePreferenceController">
- <intent android:action="android.settings.SYSTEM_UPDATE_SETTINGS"/>
- </Preference>
-
- <Preference
- android:key="additional_system_update_settings"
- android:title="@string/additional_system_update_settings_list_item_title"
- android:order="-59"
- settings:controller="com.android.settings.system.AdditionalSystemUpdatePreferenceController">
- <intent android:action="android.intent.action.MAIN"
- android:targetPackage="@string/additional_system_update"
- android:targetClass="@string/additional_system_update_menu"/>
- </Preference>
-
- <Preference
- android:key="reset_dashboard"
- android:title="@string/reset_dashboard_title"
- android:icon="@drawable/ic_restore"
- android:order="-30"
- android:fragment="com.android.settings.system.ResetDashboardFragment"
- settings:controller="com.android.settings.system.ResetPreferenceController"/>
-</PreferenceScreen>
\ No newline at end of file
diff --git a/src/com/android/settings/accessibility/AccessibilityGestureNavigationTutorial.java b/src/com/android/settings/accessibility/AccessibilityGestureNavigationTutorial.java
index 5ea5462..f8cdcb3 100644
--- a/src/com/android/settings/accessibility/AccessibilityGestureNavigationTutorial.java
+++ b/src/com/android/settings/accessibility/AccessibilityGestureNavigationTutorial.java
@@ -24,12 +24,10 @@
import android.content.Context;
import android.content.DialogInterface;
import android.content.res.TypedArray;
-import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.style.ImageSpan;
-import android.util.TypedValue;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.TextureView;
@@ -49,11 +47,11 @@
import androidx.appcompat.app.AlertDialog;
import androidx.core.content.ContextCompat;
import androidx.core.util.Preconditions;
+import androidx.core.widget.TextViewCompat;
import androidx.viewpager.widget.PagerAdapter;
import androidx.viewpager.widget.ViewPager;
import com.android.settings.R;
-import com.android.settings.Utils;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -310,25 +308,17 @@
}
private static View makeTitleView(Context context) {
- final String familyName =
- context.getString(
- com.android.internal.R.string.config_headlineFontFamilyMedium);
final TextView textView = new TextView(context);
-
- textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, /* size= */ 20);
- textView.setTextColor(Utils.getColorAttr(context, android.R.attr.textColorPrimary));
+ // Sets the text color, size, style, hint color, and highlight color from the specified
+ // TextAppearance resource.
+ TextViewCompat.setTextAppearance(textView, R.style.AccessibilityDialogTitle);
textView.setGravity(Gravity.CENTER);
- textView.setTypeface(Typeface.create(familyName, Typeface.NORMAL));
-
return textView;
}
private static View makeInstructionView(Context context) {
final TextView textView = new TextView(context);
- textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, /* size= */ 16);
- textView.setTextColor(Utils.getColorAttr(context, android.R.attr.textColorPrimary));
- textView.setTypeface(
- Typeface.create(/* familyName= */ "sans-serif", Typeface.NORMAL));
+ TextViewCompat.setTextAppearance(textView, R.style.AccessibilityDialogDescription);
return textView;
}
diff --git a/src/com/android/settings/applications/intentpicker/AppLaunchSettings.java b/src/com/android/settings/applications/intentpicker/AppLaunchSettings.java
index 8683f56..439a6a3 100644
--- a/src/com/android/settings/applications/intentpicker/AppLaunchSettings.java
+++ b/src/com/android/settings/applications/intentpicker/AppLaunchSettings.java
@@ -312,6 +312,7 @@
/** Initialize add link preference */
private void initAddLinkPreference() {
mAddLinkPreference = findPreference(ADD_LINK_PREF_KEY);
+ mAddLinkPreference.setVisible(isAddLinksShown());
mAddLinkPreference.setEnabled(isAddLinksNotEmpty());
mAddLinkPreference.setOnPreferenceClickListener(preference -> {
final int stateNoneLinksNo = getLinksNumber(DOMAIN_STATE_NONE);
@@ -327,6 +328,10 @@
return getLinksNumber(DOMAIN_STATE_NONE) > 0;
}
+ private boolean isAddLinksShown() {
+ return (isAddLinksNotEmpty() || getLinksNumber(DOMAIN_STATE_SELECTED) > 0);
+ }
+
private void showProgressDialogFragment() {
final Bundle args = new Bundle();
args.putString(APP_PACKAGE_KEY, mPackageName);
diff --git a/src/com/android/settings/bluetooth/BluetoothPairingService.java b/src/com/android/settings/bluetooth/BluetoothPairingService.java
index 47565d3..4c3c9a9 100644
--- a/src/com/android/settings/bluetooth/BluetoothPairingService.java
+++ b/src/com/android/settings/bluetooth/BluetoothPairingService.java
@@ -134,7 +134,8 @@
mDevice = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
if (mDevice != null && mDevice.getBondState() != BluetoothDevice.BOND_BONDING) {
- Log.w(TAG, "Device " + mDevice + " not bonding: " + mDevice.getBondState());
+ Log.w(TAG, "Device " + mDevice.getName() + " not bonding: " + mDevice.getBondState());
+ mNm.cancel(NOTIFICATION_ID);
stopSelf();
return START_NOT_STICKY;
}
diff --git a/src/com/android/settings/development/EnableBlursPreferenceController.java b/src/com/android/settings/development/EnableBlursPreferenceController.java
index 88e0db1..129d999 100644
--- a/src/com/android/settings/development/EnableBlursPreferenceController.java
+++ b/src/com/android/settings/development/EnableBlursPreferenceController.java
@@ -16,8 +16,10 @@
package com.android.settings.development;
+import static android.view.CrossWindowBlurListeners.CROSS_WINDOW_BLUR_SUPPORTED;
+
import android.content.Context;
-import android.os.SystemProperties;
+import android.provider.Settings;
import androidx.annotation.VisibleForTesting;
import androidx.preference.Preference;
@@ -25,22 +27,18 @@
import com.android.settings.core.PreferenceControllerMixin;
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
-import com.android.settingslib.development.SystemPropPoker;
/**
- * Controller that toggles window blurs on SurfaceFlinger on devices that support it.
+ * Controller that toggles window blurs on devices that support it.
*/
public final class EnableBlursPreferenceController extends DeveloperOptionsPreferenceController
implements Preference.OnPreferenceChangeListener, PreferenceControllerMixin {
- @VisibleForTesting
- static final String DISABLE_BLURS_SYSPROP = "persist.sys.sf.disable_blurs";
private static final String ENABLE_BLURS_ON_WINDOWS = "enable_blurs_on_windows";
private final boolean mBlurSupported;
public EnableBlursPreferenceController(Context context) {
- this(context, SystemProperties
- .getBoolean("ro.surface_flinger.supports_background_blur", false));
+ this(context, CROSS_WINDOW_BLUR_SUPPORTED);
}
@VisibleForTesting
@@ -56,9 +54,9 @@
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
- final boolean isDisabled = !(Boolean) newValue;
- SystemProperties.set(DISABLE_BLURS_SYSPROP, isDisabled ? "1" : "0");
- SystemPropPoker.getInstance().poke();
+ boolean enabled = (Boolean) newValue;
+ Settings.Global.putInt(mContext.getContentResolver(),
+ Settings.Global.DISABLE_WINDOW_BLURS, enabled ? 0 : 1);
return true;
}
@@ -69,15 +67,16 @@
@Override
public void updateState(Preference preference) {
- boolean isEnabled = !SystemProperties.getBoolean(
- DISABLE_BLURS_SYSPROP, false /* default */);
+ boolean isEnabled = Settings.Global.getInt(mContext.getContentResolver(),
+ Settings.Global.DISABLE_WINDOW_BLURS, 0) == 0;
((SwitchPreference) mPreference).setChecked(isEnabled);
}
@Override
protected void onDeveloperOptionsSwitchDisabled() {
super.onDeveloperOptionsSwitchDisabled();
- SystemProperties.set(DISABLE_BLURS_SYSPROP, null);
+ Settings.Global.putInt(mContext.getContentResolver(),
+ Settings.Global.DISABLE_WINDOW_BLURS, 0);
updateState(null);
}
}
diff --git a/src/com/android/settings/enterprise/ActionDisabledByAdminDialogHelper.java b/src/com/android/settings/enterprise/ActionDisabledByAdminDialogHelper.java
index 2a5eda2..056afdb 100644
--- a/src/com/android/settings/enterprise/ActionDisabledByAdminDialogHelper.java
+++ b/src/com/android/settings/enterprise/ActionDisabledByAdminDialogHelper.java
@@ -37,6 +37,7 @@
import com.android.settingslib.RestrictedLockUtils;
import com.android.settingslib.RestrictedLockUtils.EnforcedAdmin;
import com.android.settingslib.RestrictedLockUtilsInternal;
+import com.android.settingslib.Utils;
import com.android.settingslib.enterprise.ActionDisabledByAdminController;
import com.android.settingslib.enterprise.ActionDisabledByAdminControllerFactory;
@@ -139,7 +140,9 @@
void setAdminSupportIcon(View root, ComponentName admin, int userId) {
ImageView supportIconView = root.requireViewById(R.id.admin_support_icon);
supportIconView.setImageDrawable(
- mActivity.getDrawable(com.android.internal.R.drawable.ic_corp_badge));
+ mActivity.getDrawable(R.drawable.ic_lock_closed));
+
+ supportIconView.setImageTintList(Utils.getColorAccent(mActivity));
}
@VisibleForTesting
diff --git a/src/com/android/settings/fuelgauge/AdvancedPowerUsageDetail.java b/src/com/android/settings/fuelgauge/AdvancedPowerUsageDetail.java
index cd0c114..ca228e6 100644
--- a/src/com/android/settings/fuelgauge/AdvancedPowerUsageDetail.java
+++ b/src/com/android/settings/fuelgauge/AdvancedPowerUsageDetail.java
@@ -25,7 +25,6 @@
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.os.UserHandle;
-import android.text.Html;
import android.text.TextUtils;
import android.text.format.DateUtils;
import android.util.Log;
@@ -47,10 +46,12 @@
import com.android.settings.fuelgauge.batterytip.tips.BatteryTip;
import com.android.settings.overlay.FeatureFactory;
import com.android.settings.widget.EntityHeaderController;
+import com.android.settingslib.HelpUtils;
import com.android.settingslib.applications.AppUtils;
import com.android.settingslib.applications.ApplicationsState;
import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.utils.StringUtil;
+import com.android.settingslib.widget.FooterPreference;
import com.android.settingslib.widget.LayoutPreference;
import com.android.settingslib.widget.RadioButtonPreference;
@@ -104,7 +105,7 @@
@VisibleForTesting
Preference mBackgroundPreference;
@VisibleForTesting
- Preference mFooterPreference;
+ FooterPreference mFooterPreference;
@VisibleForTesting
RadioButtonPreference mRestrictedPreference;
@VisibleForTesting
@@ -351,7 +352,13 @@
//Present default string to normal app.
footerString = context.getString(R.string.manager_battery_usage_footer);
}
- mFooterPreference.setTitle(Html.fromHtml(footerString, Html.FROM_HTML_MODE_COMPACT));
+ mFooterPreference.setTitle(footerString);
+ mFooterPreference.setLearnMoreAction(v ->
+ startActivityForResult(HelpUtils.getHelpIntent(context,
+ context.getString(R.string.help_url_app_usage_settings),
+ /*backupContext=*/ ""), /*requestCode=*/ 0));
+ mFooterPreference.setLearnMoreContentDescription(
+ context.getString(R.string.manager_battery_usage_link_a11y));
}
@Override
diff --git a/src/com/android/settings/fuelgauge/BatteryChartView.java b/src/com/android/settings/fuelgauge/BatteryChartView.java
index c6dab22..ed64177 100644
--- a/src/com/android/settings/fuelgauge/BatteryChartView.java
+++ b/src/com/android/settings/fuelgauge/BatteryChartView.java
@@ -15,6 +15,8 @@
import static java.lang.Math.round;
+import static com.android.settings.Utils.formatPercentage;
+
import android.accessibilityservice.AccessibilityServiceInfo;
import android.content.Context;
import android.content.res.Resources;
@@ -53,8 +55,13 @@
private static final String TAG = "BatteryChartView";
private static final List<String> ACCESSIBILITY_SERVICE_NAMES =
Arrays.asList("SwitchAccessService", "TalkBackService", "JustSpeakService");
+
// For drawing the percentage information.
- private static final String[] PERCENTAGES = new String[] {"100%", "50%", "0%"};
+ private static final String[] PERCENTAGES = new String[] {
+ formatPercentage(/*percentage=*/ 100, /*round=*/ true),
+ formatPercentage(/*percentage=*/ 50, /*round=*/ true),
+ formatPercentage(/*percentage=*/ 0, /*round=*/ true)};
+
private static final int DEFAULT_TRAPEZOID_COUNT = 12;
private static final int DEFAULT_TIMESTAMP_COUNT = 4;
private static final int DIVIDER_COLOR = Color.parseColor("#CDCCC5");
@@ -220,13 +227,14 @@
mIndent.right = mPercentageBounds[0].width() + mTextPadding;
if (mTimestamps != null) {
+ int maxHeight = 0;
for (int index = 0; index < DEFAULT_TIMESTAMP_COUNT; index++) {
mTextPaint.getTextBounds(
mTimestamps[index], 0, mTimestamps[index].length(),
mTimestampsBounds[index]);
+ maxHeight = Math.max(maxHeight, mTimestampsBounds[index].height());
}
- mIndent.bottom = mTimestampsBounds[0].height()
- + round(mTextPadding * 1.5f);
+ mIndent.bottom = maxHeight + round(mTextPadding * 1.5f);
}
Log.d(TAG, "setIndent:" + mPercentageBounds[0]);
} else {
@@ -451,7 +459,8 @@
private int getTimestampY(int index) {
return getHeight() - mTimestampsBounds[index].height()
- - mTimestampsBounds[index].top;
+ + (mTimestampsBounds[index].height() + mTimestampsBounds[index].top)
+ + round(mTextPadding * 1.5f);
}
private void drawTrapezoids(Canvas canvas) {
diff --git a/src/com/android/settings/fuelgauge/BatteryDiffEntry.java b/src/com/android/settings/fuelgauge/BatteryDiffEntry.java
index c6b2d45..3ad768a 100644
--- a/src/com/android/settings/fuelgauge/BatteryDiffEntry.java
+++ b/src/com/android/settings/fuelgauge/BatteryDiffEntry.java
@@ -76,11 +76,6 @@
mBackgroundUsageTimeInMs = backgroundUsageTimeInMs;
mBatteryHistEntry = batteryHistEntry;
mUserManager = context.getSystemService(UserManager.class);
- if (foregroundUsageTimeInMs == 0
- && backgroundUsageTimeInMs == 0
- && consumePower != 0) {
- Log.w(TAG, "abnornal BatteryDiffEntry:\n" + this);
- }
}
/** Sets the total consumed power in a specific time slot. */
@@ -128,8 +123,16 @@
/** Gets the searching package name for UID battery type. */
public String getPackageName() {
- return mDefaultPackageName != null
+ final String packageName = mDefaultPackageName != null
? mDefaultPackageName : mBatteryHistEntry.mPackageName;
+ if (packageName == null) {
+ return packageName;
+ }
+ // Removes potential appended process name in the PackageName.
+ // From "com.opera.browser:privileged_process0" to "com.opera.browser"
+ final String[] splittedPackageNames = packageName.split(":");
+ return splittedPackageNames != null && splittedPackageNames.length > 0
+ ? splittedPackageNames[0] : packageName;
}
/** Whether this item is valid for users to launch restriction page? */
@@ -168,8 +171,6 @@
}
// Both nameAndIcon and restriction configuration have cached data.
if (nameAndIcon != null && validForRestriction != null) {
- Log.w(TAG, String.format("cannot find cache data nameAndIcon:%s "
- + "validForRestriction:%s", nameAndIcon, validForRestriction));
return;
}
mIsLoaded = true;
@@ -270,7 +271,7 @@
}
private void loadNameAndIconForUid() {
- final String packageName = mBatteryHistEntry.mPackageName;
+ final String packageName = getPackageName();
final PackageManager packageManager = mContext.getPackageManager();
// Gets the application label from PackageManager.
if (packageName != null && packageName.length() != 0) {
@@ -332,9 +333,9 @@
/*withSeconds=*/ true, /*collapseTimeUnit=*/ false),
StringUtil.formatElapsedTime(mContext, mBackgroundUsageTimeInMs,
/*withSeconds=*/ true, /*collapseTimeUnit=*/ false)))
- .append(String.format("\n\tpackage:%s uid:%d userId:%d",
- mBatteryHistEntry.mPackageName, mBatteryHistEntry.mUid,
- mBatteryHistEntry.mUserId));
+ .append(String.format("\n\tpackage:%s|%s uid:%d userId:%d",
+ mBatteryHistEntry.mPackageName, getPackageName(),
+ mBatteryHistEntry.mUid, mBatteryHistEntry.mUserId));
return builder.toString();
}
diff --git a/src/com/android/settings/fuelgauge/BatteryEntry.java b/src/com/android/settings/fuelgauge/BatteryEntry.java
index 125409c..78ab962 100644
--- a/src/com/android/settings/fuelgauge/BatteryEntry.java
+++ b/src/com/android/settings/fuelgauge/BatteryEntry.java
@@ -417,10 +417,6 @@
}
final String uidString = Integer.toString(uid);
- if (name == null) {
- name = uidString;
- }
-
if (icon == null) {
icon = pm.getDefaultActivityIcon();
}
diff --git a/src/com/android/settings/fuelgauge/ConvertUtils.java b/src/com/android/settings/fuelgauge/ConvertUtils.java
index 82133ee..1980564 100644
--- a/src/com/android/settings/fuelgauge/ConvertUtils.java
+++ b/src/com/android/settings/fuelgauge/ConvertUtils.java
@@ -74,8 +74,12 @@
public static final int CONSUMER_TYPE_USER_BATTERY = 2;
public static final int CONSUMER_TYPE_SYSTEM_BATTERY = 3;
- private static String sZoneId;
- private static String sZoneIdForHour;
+ // For language is changed.
+ @VisibleForTesting static Locale sLocale;
+ @VisibleForTesting static Locale sLocaleForHour;
+ // For time zone is changed.
+ @VisibleForTesting static String sZoneId;
+ @VisibleForTesting static String sZoneIdForHour;
private static boolean sIs24HourFormat;
@VisibleForTesting
@@ -130,28 +134,35 @@
/** Converts UTC timestamp to human readable local time string. */
public static String utcToLocalTime(long timestamp) {
+ final Locale currentLocale = Locale.getDefault();
final String currentZoneId = TimeZone.getDefault().getID();
- if (!currentZoneId.equals(sZoneId) || sSimpleDateFormat == null) {
+ if (!currentZoneId.equals(sZoneId)
+ || !currentLocale.equals(sLocale)
+ || sSimpleDateFormat == null) {
+ sLocale = currentLocale;
sZoneId = currentZoneId;
sSimpleDateFormat =
- new SimpleDateFormat("MMM dd,yyyy HH:mm:ss", Locale.ENGLISH);
+ new SimpleDateFormat("MMM dd,yyyy HH:mm:ss", currentLocale);
}
return sSimpleDateFormat.format(new Date(timestamp));
}
/** Converts UTC timestamp to local time hour data. */
public static String utcToLocalTimeHour(long timestamp, boolean is24HourFormat) {
+ final Locale currentLocale = Locale.getDefault();
final String currentZoneId = TimeZone.getDefault().getID();
if (!currentZoneId.equals(sZoneIdForHour)
+ || !currentLocale.equals(sLocaleForHour)
|| sIs24HourFormat != is24HourFormat
|| sSimpleDateFormatForHour == null) {
+ sLocaleForHour = currentLocale;
sZoneIdForHour = currentZoneId;
sIs24HourFormat = is24HourFormat;
sSimpleDateFormatForHour = new SimpleDateFormat(
- sIs24HourFormat ? "HH" : "h aa", Locale.ENGLISH);
+ sIs24HourFormat ? "HH" : "h aa", currentLocale);
}
return sSimpleDateFormatForHour.format(new Date(timestamp))
- .toLowerCase(Locale.getDefault());
+ .toLowerCase(currentLocale);
}
/** Gets indexed battery usage data for each corresponding time slot. */
diff --git a/src/com/android/settings/fuelgauge/batterysaver/BatterySaverSettings.java b/src/com/android/settings/fuelgauge/batterysaver/BatterySaverSettings.java
index f857611..676ed20 100644
--- a/src/com/android/settings/fuelgauge/batterysaver/BatterySaverSettings.java
+++ b/src/com/android/settings/fuelgauge/batterysaver/BatterySaverSettings.java
@@ -17,17 +17,10 @@
package com.android.settings.fuelgauge.batterysaver;
import android.app.settings.SettingsEnums;
-import android.text.Annotation;
-import android.text.Spannable;
import android.text.SpannableStringBuilder;
-import android.text.Spanned;
-import android.text.TextPaint;
import android.text.TextUtils;
-import android.text.style.URLSpan;
-import android.view.View;
import androidx.annotation.VisibleForTesting;
-import androidx.fragment.app.Fragment;
import com.android.settings.R;
import com.android.settings.dashboard.DashboardFragment;
@@ -94,64 +87,16 @@
void addHelpLink() {
FooterPreference pref = getPreferenceScreen().findPreference(KEY_FOOTER_PREFERENCE);
if (pref != null) {
- SupportPageLearnMoreSpan.linkify(mFooterText, this, mHelpUri);
pref.setTitle(mFooterText);
pref.setSelectable(false);
- }
- }
-
- /**
- * A {@link URLSpan} that opens a support page when clicked
- */
- public static class SupportPageLearnMoreSpan extends URLSpan {
-
-
- private static final String ANNOTATION_URL = "url";
- private final Fragment mFragment;
- private final String mUriString;
-
- public SupportPageLearnMoreSpan(Fragment fragment, String uriString) {
- // sets the url to empty string so we can prevent any other span processing from
- // from clearing things we need in this string.
- super("");
- mFragment = fragment;
- mUriString = uriString;
- }
-
- @Override
- public void onClick(View widget) {
- if (mFragment != null) {
- // launch the support page
- mFragment.startActivityForResult(HelpUtils.getHelpIntent(mFragment.getContext(),
- mUriString, ""), 0);
- }
- }
-
- @Override
- public void updateDrawState(TextPaint ds) {
- super.updateDrawState(ds);
- }
-
- /**
- * This method takes a string and turns it into a url span that will launch a support page
- * @param msg The text to turn into a link
- * @param fragment The fragment which contains this span
- * @param uriString The URI string of the help article to open when clicked
- * @return A CharSequence containing the original text content as a url
- */
- public static CharSequence linkify(Spannable msg, Fragment fragment, String uriString) {
- Annotation[] spans = msg.getSpans(0, msg.length(), Annotation.class);
- for (Annotation annotation : spans) {
- int start = msg.getSpanStart(annotation);
- int end = msg.getSpanEnd(annotation);
- if (ANNOTATION_URL.equals(annotation.getValue())) {
- SupportPageLearnMoreSpan link =
- new SupportPageLearnMoreSpan(fragment, uriString);
- msg.removeSpan(annotation);
- msg.setSpan(link, start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
- }
- }
- return msg;
+ pref.setLearnMoreAction(v -> {
+ mMetricsFeatureProvider.action(getContext(),
+ SettingsEnums.ACTION_APP_BATTERY_LEARN_MORE);
+ startActivityForResult(HelpUtils.getHelpIntent(getContext(),
+ getString(R.string.help_url_battery_saver_settings),
+ /*backupContext=*/ ""), /*requestCode=*/ 0);
+ });
+ pref.setLearnMoreContentDescription(getString(R.string.battery_saver_link_a11y));
}
}
}
diff --git a/src/com/android/settings/gestures/GesturesSettingPreferenceController.java b/src/com/android/settings/gestures/GesturesSettingPreferenceController.java
index e01bc88..ff069ab 100644
--- a/src/com/android/settings/gestures/GesturesSettingPreferenceController.java
+++ b/src/com/android/settings/gestures/GesturesSettingPreferenceController.java
@@ -16,19 +16,13 @@
package com.android.settings.gestures;
-import android.content.ContentResolver;
import android.content.Context;
import android.hardware.display.AmbientDisplayConfiguration;
-import android.provider.Settings;
-import android.text.TextUtils;
-import android.util.FeatureFlagUtils;
import androidx.annotation.NonNull;
-import com.android.settings.R;
import com.android.settings.aware.AwareFeatureProvider;
import com.android.settings.core.BasePreferenceController;
-import com.android.settings.core.FeatureFlags;
import com.android.settings.overlay.FeatureFactory;
import com.android.settingslib.core.AbstractPreferenceController;
@@ -85,37 +79,4 @@
controllers.add(new PreventRingingParentPreferenceController(context, FAKE_PREF_KEY));
return controllers;
}
-
- @Override
- public CharSequence getSummary() {
- if (FeatureFlagUtils.isEnabled(mContext, FeatureFlags.SILKY_HOME)) {
- return null;
- }
-
- if (!mFeatureProvider.isSensorAvailable(mContext)) {
- return "";
- }
- final ContentResolver contentResolver = mContext.getContentResolver();
- final boolean assistGestureEnabled = Settings.Secure.getInt(
- contentResolver, Settings.Secure.ASSIST_GESTURE_ENABLED, 1) != 0;
- final boolean assistGestureSilenceEnabled = Settings.Secure.getInt(
- contentResolver, Settings.Secure.ASSIST_GESTURE_SILENCE_ALERTS_ENABLED, 1) != 0;
- final boolean sensorSupported = mFeatureProvider.isSupported(mContext);
-
- final CharSequence awareSummary = mAwareFeatureProvider.getGestureSummary(mContext,
- sensorSupported, assistGestureEnabled, assistGestureSilenceEnabled);
- if (!TextUtils.isEmpty(awareSummary)) {
- return awareSummary;
- }
-
- if (sensorSupported && assistGestureEnabled) {
- return mContext.getText(
- R.string.language_input_gesture_summary_on_with_assist);
- }
- if (assistGestureSilenceEnabled) {
- return mContext.getText(
- R.string.language_input_gesture_summary_on_non_assist);
- }
- return mContext.getText(R.string.language_input_gesture_summary_off);
- }
}
diff --git a/src/com/android/settings/network/NetworkProviderSettings.java b/src/com/android/settings/network/NetworkProviderSettings.java
index 4c5552d..b1611cd 100644
--- a/src/com/android/settings/network/NetworkProviderSettings.java
+++ b/src/com/android/settings/network/NetworkProviderSettings.java
@@ -416,9 +416,14 @@
@Override
public void onResume() {
- final Activity activity = getActivity();
super.onResume();
+ // Disable the animation of the preference list
+ final RecyclerView prefListView = getListView();
+ if (prefListView != null) {
+ prefListView.setItemAnimator(null);
+ }
+
// Because RestrictedSettingsFragment's onResume potentially requests authorization,
// which changes the restriction state, recalculate it.
final boolean alreadyImmutablyRestricted = mIsRestricted;
diff --git a/src/com/android/settings/panel/PanelSlicesAdapter.java b/src/com/android/settings/panel/PanelSlicesAdapter.java
index 4c8698a..d398074 100644
--- a/src/com/android/settings/panel/PanelSlicesAdapter.java
+++ b/src/com/android/settings/panel/PanelSlicesAdapter.java
@@ -125,6 +125,7 @@
sliceView = view.findViewById(R.id.slice_view);
sliceView.setMode(SliceView.MODE_LARGE);
sliceView.setShowTitleItems(true);
+ sliceView.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO);
mSliceSliderLayout = view.findViewById(R.id.slice_slider_layout);
}
diff --git a/src/com/android/settings/system/ResetPreferenceController.java b/src/com/android/settings/system/ResetPreferenceController.java
index ad33d30..0740ac9 100644
--- a/src/com/android/settings/system/ResetPreferenceController.java
+++ b/src/com/android/settings/system/ResetPreferenceController.java
@@ -17,11 +17,9 @@
import android.content.Context;
import android.os.UserManager;
-import android.util.FeatureFlagUtils;
import com.android.settings.R;
import com.android.settings.core.BasePreferenceController;
-import com.android.settings.core.FeatureFlags;
import com.android.settings.network.NetworkResetPreferenceController;
public class ResetPreferenceController extends BasePreferenceController {
@@ -42,17 +40,4 @@
return mContext.getResources().getBoolean(R.bool.config_show_reset_dashboard)
? AVAILABLE : UNSUPPORTED_ON_DEVICE;
}
-
- @Override
- public CharSequence getSummary() {
- if (FeatureFlagUtils.isEnabled(mContext, FeatureFlags.SILKY_HOME)) {
- return null;
- }
-
- if (!mNetworkReset.isAvailable() && !mFactpruReset.isAvailable()) {
- return mContext.getText(R.string.reset_dashboard_summary_onlyApps);
- }
-
- return mContext.getText(R.string.reset_dashboard_summary);
- }
}
diff --git a/src/com/android/settings/system/SystemDashboardFragment.java b/src/com/android/settings/system/SystemDashboardFragment.java
index 997678b..eed9814 100644
--- a/src/com/android/settings/system/SystemDashboardFragment.java
+++ b/src/com/android/settings/system/SystemDashboardFragment.java
@@ -19,7 +19,6 @@
import android.content.Context;
import android.os.Bundle;
import android.provider.SearchIndexableResource;
-import android.util.FeatureFlagUtils;
import androidx.annotation.VisibleForTesting;
import androidx.preference.Preference;
@@ -27,7 +26,6 @@
import androidx.preference.PreferenceScreen;
import com.android.settings.R;
-import com.android.settings.core.FeatureFlags;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.overlay.FeatureFactory;
import com.android.settings.search.BaseSearchIndexProvider;
@@ -77,9 +75,6 @@
@Override
protected int getPreferenceScreenResId() {
- if (FeatureFlagUtils.isEnabled(getContext(), FeatureFlags.SILKY_HOME)) {
- return R.xml.system_dashboard_fragment_v2;
- }
return R.xml.system_dashboard_fragment;
}
@@ -110,8 +105,7 @@
public List<SearchIndexableResource> getXmlResourcesToIndex(
Context context, boolean enabled) {
final SearchIndexableResource sir = new SearchIndexableResource(context);
- sir.xmlResId = FeatureFlagUtils.isEnabled(context, FeatureFlags.SILKY_HOME)
- ? R.xml.system_dashboard_fragment_v2 : R.xml.system_dashboard_fragment;
+ sir.xmlResId = R.xml.system_dashboard_fragment;
return Arrays.asList(sir);
}
};
diff --git a/src/com/android/settings/wifi/details2/WifiDetailPreferenceController2.java b/src/com/android/settings/wifi/details2/WifiDetailPreferenceController2.java
index 18cd553..e47dfe7 100644
--- a/src/com/android/settings/wifi/details2/WifiDetailPreferenceController2.java
+++ b/src/com/android/settings/wifi/details2/WifiDetailPreferenceController2.java
@@ -1054,7 +1054,7 @@
}
public Drawable getIcon(boolean showX, int level) {
- return mContext.getDrawable(Utils.getWifiIconResource(showX, level)).mutate();
+ return mContext.getDrawable(WifiUtils.getInternetIconResource(level, showX)).mutate();
}
}
diff --git a/tests/componenttests/src/com/android/settingslib/applications/ApplicationStateComponentTest.java b/tests/componenttests/src/com/android/settingslib/applications/ApplicationStateComponentTest.java
new file mode 100644
index 0000000..1928a88
--- /dev/null
+++ b/tests/componenttests/src/com/android/settingslib/applications/ApplicationStateComponentTest.java
@@ -0,0 +1,100 @@
+/*
+ * 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.settingslib.applications;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.ApplicationInfo;
+
+import androidx.test.core.app.ActivityScenario;
+import androidx.test.ext.junit.rules.ActivityScenarioRule;
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+import androidx.test.filters.SmallTest;
+
+import com.android.settings.Settings;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.util.UUID;
+
+@RunWith(AndroidJUnit4.class)
+@SmallTest
+public class ApplicationStateComponentTest {
+ private static final String TAG =
+ ApplicationStateComponentTest.class.getSimpleName();
+ private Context mRuntimeApplication;
+ private ApplicationsState mApplicationsState;
+
+ @Rule
+ public ActivityScenarioRule<Settings.ManageApplicationsActivity> rule =
+ new ActivityScenarioRule<>(
+ new Intent(
+ android.provider.Settings.ACTION_MANAGE_ALL_APPLICATIONS_SETTINGS)
+ .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
+
+ private ApplicationsState.AppEntry createAppEntry(String label, String packageName, int id) {
+ ApplicationInfo appInfo = createApplicationInfo(packageName, id);
+ ApplicationsState.AppEntry appEntry = new ApplicationsState.AppEntry(mRuntimeApplication,
+ appInfo, id);
+ appEntry.label = label;
+ appEntry.mounted = true;
+ return appEntry;
+ }
+
+ private ApplicationInfo createApplicationInfo(String packageName, int uid) {
+ ApplicationInfo appInfo = new ApplicationInfo();
+ appInfo.sourceDir = "foo";
+ appInfo.flags |= ApplicationInfo.FLAG_INSTALLED;
+ appInfo.storageUuid = UUID.randomUUID();
+ appInfo.packageName = packageName;
+ appInfo.uid = uid;
+ return appInfo;
+ }
+
+ @Test
+ public void test_all_apps_sorting_alpha() {
+ // TODO: Potential unit test candidate.
+ // To test all app list has sorted alphabetical, only need to verify sort function.
+ // This case focus on logic in sort function, and ignore origin locale sorting rule by Java.
+
+ ActivityScenario scenario = rule.getScenario();
+
+ scenario.onActivity(activity -> {
+ mRuntimeApplication = activity.getApplication();
+ mApplicationsState = ApplicationsState.getInstance(activity.getApplication());
+
+ ApplicationsState.AppEntry entry1 = createAppEntry("Info01", "Package1", 0);
+ ApplicationsState.AppEntry entry2 = createAppEntry("Info02", "Package1", 0);
+ ApplicationsState.AppEntry entry3 = createAppEntry("Info01", "Package2", 0);
+ ApplicationsState.AppEntry entry4 = createAppEntry("Info02", "Package2", 0);
+ ApplicationsState.AppEntry entry5 = createAppEntry("Info02", "Package2", 1);
+ assertThat(ApplicationsState.ALPHA_COMPARATOR.compare(entry1, entry2)).isEqualTo(-1);
+ assertThat(ApplicationsState.ALPHA_COMPARATOR.compare(entry2, entry3)).isEqualTo(1);
+ assertThat(ApplicationsState.ALPHA_COMPARATOR.compare(entry3, entry2)).isEqualTo(-1);
+ assertThat(ApplicationsState.ALPHA_COMPARATOR.compare(entry3, entry3)).isEqualTo(0);
+ assertThat(ApplicationsState.ALPHA_COMPARATOR.compare(entry1, entry3)).isEqualTo(-1);
+ assertThat(ApplicationsState.ALPHA_COMPARATOR.compare(entry4, entry5)).isEqualTo(-1);
+ assertThat(ApplicationsState.ALPHA_COMPARATOR.compare(entry5, entry3)).isEqualTo(1);
+
+ });
+
+ }
+}
diff --git a/tests/robotests/src/com/android/settings/connecteddevice/ConnectedDeviceDashboardFragmentTest.java b/tests/robotests/src/com/android/settings/connecteddevice/ConnectedDeviceDashboardFragmentTest.java
index ea6947e..97d5485 100644
--- a/tests/robotests/src/com/android/settings/connecteddevice/ConnectedDeviceDashboardFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/connecteddevice/ConnectedDeviceDashboardFragmentTest.java
@@ -84,7 +84,7 @@
.getNonIndexableKeys(mContext);
assertThat(niks).containsExactly(KEY_CONNECTED_DEVICES, KEY_AVAILABLE_DEVICES,
- KEY_NEARBY_DEVICES, KEY_DISCOVERABLE_FOOTER, KEY_SEE_ALL, KEY_ADD_BT_DEVICES);
+ KEY_NEARBY_DEVICES, KEY_DISCOVERABLE_FOOTER, KEY_SEE_ALL);
}
@Test
diff --git a/tests/robotests/src/com/android/settings/development/EnableBlursPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/EnableBlursPreferenceControllerTest.java
index d943cb1..a63b851 100644
--- a/tests/robotests/src/com/android/settings/development/EnableBlursPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/EnableBlursPreferenceControllerTest.java
@@ -23,7 +23,7 @@
import static org.mockito.Mockito.when;
import android.content.Context;
-import android.os.SystemProperties;
+import android.provider.Settings;
import androidx.preference.PreferenceScreen;
import androidx.preference.SwitchPreference;
@@ -65,26 +65,25 @@
public void onPreferenceChanged_settingEnabled_enableBlurs() {
mController.onPreferenceChange(mPreference, true /* new value */);
- final boolean mode = SystemProperties
- .getBoolean(EnableBlursPreferenceController.DISABLE_BLURS_SYSPROP,
- false /* default */);
- assertThat(mode).isFalse();
+ final boolean blursDisabled = Settings.Global.getInt(mContext.getContentResolver(),
+ Settings.Global.DISABLE_WINDOW_BLURS, 0) == 1;
+ assertThat(blursDisabled).isFalse();
}
@Test
public void onPreferenceChanged_settingDisabled_disableBlurs() {
mController.onPreferenceChange(mPreference, false /* new value */);
- final boolean mode = SystemProperties
- .getBoolean(EnableBlursPreferenceController.DISABLE_BLURS_SYSPROP,
- false /* default */);
+ final boolean blursDisabled = Settings.Global.getInt(mContext.getContentResolver(),
+ Settings.Global.DISABLE_WINDOW_BLURS, 0) == 1;
- assertThat(mode).isTrue();
+ assertThat(blursDisabled).isTrue();
}
@Test
public void updateState_settingEnabled_preferenceShouldNotBeChecked() {
- SystemProperties.set(EnableBlursPreferenceController.DISABLE_BLURS_SYSPROP, "1");
+ Settings.Global.putInt(mContext.getContentResolver(),
+ Settings.Global.DISABLE_WINDOW_BLURS, 1);
mController.updateState(mPreference);
verify(mPreference).setChecked(false);
@@ -92,7 +91,8 @@
@Test
public void updateState_settingDisabled_preferenceShouldBeChecked() {
- SystemProperties.set(EnableBlursPreferenceController.DISABLE_BLURS_SYSPROP, "0");
+ Settings.Global.putInt(mContext.getContentResolver(),
+ Settings.Global.DISABLE_WINDOW_BLURS, 0);
mController.updateState(mPreference);
verify(mPreference).setChecked(true);
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/AdvancedPowerUsageDetailTest.java b/tests/robotests/src/com/android/settings/fuelgauge/AdvancedPowerUsageDetailTest.java
index ba978b9..014ce29 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/AdvancedPowerUsageDetailTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/AdvancedPowerUsageDetailTest.java
@@ -60,6 +60,7 @@
import com.android.settingslib.applications.instantapps.InstantAppDataProvider;
import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
import com.android.settingslib.core.lifecycle.Lifecycle;
+import com.android.settingslib.widget.FooterPreference;
import com.android.settingslib.widget.LayoutPreference;
import com.android.settingslib.widget.RadioButtonPreference;
@@ -125,7 +126,7 @@
private Context mContext;
private Preference mForegroundPreference;
private Preference mBackgroundPreference;
- private Preference mFooterPreference;
+ private FooterPreference mFooterPreference;
private RadioButtonPreference mRestrictedPreference;
private RadioButtonPreference mOptimizePreference;
private RadioButtonPreference mUnrestrictedPreference;
@@ -206,7 +207,7 @@
mForegroundPreference = new Preference(mContext);
mBackgroundPreference = new Preference(mContext);
- mFooterPreference = new Preference(mContext);
+ mFooterPreference = new FooterPreference(mContext);
mRestrictedPreference = new RadioButtonPreference(mContext);
mOptimizePreference = new RadioButtonPreference(mContext);
mUnrestrictedPreference = new RadioButtonPreference(mContext);
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/BatteryDiffEntryTest.java b/tests/robotests/src/com/android/settings/fuelgauge/BatteryDiffEntryTest.java
index 0df53f1..85ac941 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/BatteryDiffEntryTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/BatteryDiffEntryTest.java
@@ -371,6 +371,32 @@
assertThat(entry.mValidForRestriction).isTrue();
}
+ @Test
+ public void testGetPackageName_returnExpectedResult() {
+ final String expectedPackageName = "com.fake.google.com";
+ final ContentValues values = getContentValuesWithType(
+ ConvertUtils.CONSUMER_TYPE_UID_BATTERY);
+ values.put("packageName", expectedPackageName);
+ final BatteryDiffEntry entry =
+ createBatteryDiffEntry(10, new BatteryHistEntry(values));
+
+ assertThat(entry.getPackageName()).isEqualTo(expectedPackageName);
+ }
+
+ @Test
+ public void testGetPackageName_withProcessName_returnExpectedResult() {
+ final String expectedPackageName = "com.fake.google.com";
+ final ContentValues values = getContentValuesWithType(
+ ConvertUtils.CONSUMER_TYPE_UID_BATTERY);
+ values.put(
+ "packageName",
+ expectedPackageName + ":privileged_process0");
+ final BatteryDiffEntry entry =
+ createBatteryDiffEntry(10, new BatteryHistEntry(values));
+
+ assertThat(entry.getPackageName()).isEqualTo(expectedPackageName);
+ }
+
private BatteryDiffEntry createBatteryDiffEntry(
int consumerType, long uid, boolean isHidden) {
final ContentValues values = getContentValuesWithType(consumerType);
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/ConvertUtilsTest.java b/tests/robotests/src/com/android/settings/fuelgauge/ConvertUtilsTest.java
index c9c5e46..0c96b8e 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/ConvertUtilsTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/ConvertUtilsTest.java
@@ -40,6 +40,7 @@
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import java.util.TimeZone;
@@ -316,41 +317,56 @@
@Test
public void testUtcToLocalTime_returnExpectedResult() {
+ ConvertUtils.sZoneId = null;
+ ConvertUtils.sLocale = null;
final long timestamp = 1619196786769L;
+ final String expectedZoneId = "America/Los_Angeles";
ConvertUtils.sSimpleDateFormat = null;
// Invokes the method first to create the SimpleDateFormat.
ConvertUtils.utcToLocalTime(/*timestamp=*/ 0);
ConvertUtils.sSimpleDateFormat
- .setTimeZone(TimeZone.getTimeZone("America/Los_Angeles"));
+ .setTimeZone(TimeZone.getTimeZone(expectedZoneId));
assertThat(ConvertUtils.utcToLocalTime(timestamp))
.isEqualTo("Apr 23,2021 09:53:06");
+ assertThat(ConvertUtils.sZoneId).isNotEqualTo(expectedZoneId);
+ assertThat(ConvertUtils.sLocale).isEqualTo(Locale.getDefault());
}
@Test
public void testUtcToLocalTimeHour_12HourFormat_returnExpectedResult() {
+ ConvertUtils.sZoneIdForHour = null;
+ ConvertUtils.sLocaleForHour = null;
final long timestamp = 1619196786769L;
+ final String expectedZoneId = "America/Los_Angeles";
ConvertUtils.sSimpleDateFormatForHour = null;
// Invokes the method first to create the SimpleDateFormat.
ConvertUtils.utcToLocalTimeHour(/*timestamp=*/ 0, /*is24HourFormat=*/ false);
ConvertUtils.sSimpleDateFormatForHour
- .setTimeZone(TimeZone.getTimeZone("America/Los_Angeles"));
+ .setTimeZone(TimeZone.getTimeZone(expectedZoneId));
assertThat(ConvertUtils.utcToLocalTimeHour(
timestamp, /*is24HourFormat=*/ false)).isEqualTo("9 am");
+ assertThat(ConvertUtils.sZoneIdForHour).isNotEqualTo(expectedZoneId);
+ assertThat(ConvertUtils.sLocaleForHour).isEqualTo(Locale.getDefault());
}
@Test
public void testUtcToLocalTimeHour_24HourFormat_returnExpectedResult() {
+ ConvertUtils.sZoneIdForHour = null;
+ ConvertUtils.sLocaleForHour = null;
final long timestamp = 1619196786769L;
+ final String expectedZoneId = "America/Los_Angeles";
ConvertUtils.sSimpleDateFormatForHour = null;
// Invokes the method first to create the SimpleDateFormat.
ConvertUtils.utcToLocalTimeHour(/*timestamp=*/ 0, /*is24HourFormat=*/ true);
ConvertUtils.sSimpleDateFormatForHour
- .setTimeZone(TimeZone.getTimeZone("America/Los_Angeles"));
+ .setTimeZone(TimeZone.getTimeZone(expectedZoneId));
assertThat(ConvertUtils.utcToLocalTimeHour(
timestamp, /*is24HourFormat=*/ true)).isEqualTo("09");
+ assertThat(ConvertUtils.sZoneIdForHour).isNotEqualTo(expectedZoneId);
+ assertThat(ConvertUtils.sLocaleForHour).isEqualTo(Locale.getDefault());
}
private static BatteryHistEntry createBatteryHistEntry(
diff --git a/tests/robotests/src/com/android/settings/gestures/GesturesSettingsPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/gestures/GesturesSettingsPreferenceControllerTest.java
index df1dfd0..c185810 100644
--- a/tests/robotests/src/com/android/settings/gestures/GesturesSettingsPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/gestures/GesturesSettingsPreferenceControllerTest.java
@@ -20,22 +20,9 @@
import static com.google.common.truth.Truth.assertThat;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
import android.app.Activity;
-import android.content.ContentResolver;
-import android.content.Context;
-import android.provider.Settings;
-import android.util.FeatureFlagUtils;
-import androidx.preference.Preference;
-
-import com.android.settings.R;
-import com.android.settings.core.FeatureFlags;
import com.android.settings.testutils.FakeFeatureFactory;
-import com.android.settings.testutils.shadow.ShadowSecureSettings;
import com.android.settingslib.core.AbstractPreferenceController;
import org.junit.Before;
@@ -46,7 +33,6 @@
import org.mockito.MockitoAnnotations;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.RuntimeEnvironment;
-import org.robolectric.annotation.Config;
import org.robolectric.util.ReflectionHelpers;
import java.util.ArrayList;
@@ -57,8 +43,6 @@
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
private Activity mActivity;
- @Mock
- private Preference mPreference;
private GesturesSettingPreferenceController mController;
@@ -67,7 +51,6 @@
MockitoAnnotations.initMocks(this);
FakeFeatureFactory.setupForTest();
mController = new GesturesSettingPreferenceController(mActivity);
- FeatureFlagUtils.setEnabled(RuntimeEnvironment.application, FeatureFlags.SILKY_HOME, false);
}
@Test
@@ -96,43 +79,4 @@
assertThat(mController.isAvailable()).isFalse();
}
-
- @Test
- @Config(shadows = ShadowSecureSettings.class)
- public void updateState_assistSupported_shouldSetToAssistGestureStatus() {
- final FakeFeatureFactory featureFactory =
- (FakeFeatureFactory) FakeFeatureFactory.getFactory(mActivity);
- when(featureFactory.assistGestureFeatureProvider.isSupported(any(Context.class)))
- .thenReturn(true);
- when(featureFactory.assistGestureFeatureProvider.isSensorAvailable(any(Context.class)))
- .thenReturn(true);
-
- final ContentResolver cr = mActivity.getContentResolver();
- Settings.Secure.putInt(cr, Settings.Secure.ASSIST_GESTURE_ENABLED, 0);
- Settings.Secure.putInt(cr, Settings.Secure.ASSIST_GESTURE_SILENCE_ALERTS_ENABLED, 0);
- mController.updateState(mPreference);
- verify(mActivity).getText(R.string.language_input_gesture_summary_off);
-
- Settings.Secure.putInt(cr, Settings.Secure.ASSIST_GESTURE_ENABLED, 1);
- Settings.Secure.putInt(cr, Settings.Secure.ASSIST_GESTURE_SILENCE_ALERTS_ENABLED, 0);
- mController.updateState(mPreference);
- verify(mActivity).getText(R.string.language_input_gesture_summary_on_with_assist);
-
- Settings.Secure.putInt(cr, Settings.Secure.ASSIST_GESTURE_ENABLED, 0);
- Settings.Secure.putInt(cr, Settings.Secure.ASSIST_GESTURE_SILENCE_ALERTS_ENABLED, 1);
- mController.updateState(mPreference);
- verify(mActivity).getText(R.string.language_input_gesture_summary_on_non_assist);
- }
-
- @Test
- @Config(shadows = ShadowSecureSettings.class)
- public void updateState_sensorNotAvailable_shouldSetToEmptyStatus() {
- final FakeFeatureFactory featureFactory =
- (FakeFeatureFactory) FakeFeatureFactory.getFactory(mActivity);
- when(featureFactory.assistGestureFeatureProvider.isSensorAvailable(any(Context.class)))
- .thenReturn(false);
-
- mController.updateState(mPreference);
- verify(mPreference).setSummary("");
- }
}
diff --git a/tests/robotests/src/com/android/settings/system/ResetPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/system/ResetPreferenceControllerTest.java
index e80e77a..dd95d29 100644
--- a/tests/robotests/src/com/android/settings/system/ResetPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/system/ResetPreferenceControllerTest.java
@@ -18,14 +18,6 @@
import static com.google.common.truth.Truth.assertThat;
import android.content.Context;
-import android.content.pm.UserInfo;
-import android.os.UserHandle;
-import android.provider.Settings;
-import android.util.FeatureFlagUtils;
-
-import com.android.settings.R;
-import com.android.settings.core.FeatureFlags;
-import com.android.settings.testutils.shadow.ShadowUserManager;
import org.junit.Before;
import org.junit.Test;
@@ -35,11 +27,9 @@
import org.robolectric.annotation.Config;
@RunWith(RobolectricTestRunner.class)
-@Config(shadows = ShadowUserManager.class)
public class ResetPreferenceControllerTest {
private static final String KEY_RESET_DASHBOARD = "reset_dashboard";
- private ShadowUserManager mShadowUserManager;
private Context mContext;
private ResetPreferenceController mController;
@@ -48,8 +38,6 @@
public void setUp() {
mContext = RuntimeEnvironment.application;
mController = new ResetPreferenceController(mContext, KEY_RESET_DASHBOARD);
- mShadowUserManager = ShadowUserManager.getShadow();
- FeatureFlagUtils.setEnabled(mContext, FeatureFlags.SILKY_HOME, false);
}
@Test
@@ -62,35 +50,4 @@
public void isAvailable_ifNotVisible_false() {
assertThat(mController.isAvailable()).isFalse();
}
-
- @Test
- public void getSummary_systemUser_shouldReturnFullSummary() {
- mShadowUserManager.setIsAdminUser(true);
-
- assertThat(mController.getSummary()).isEqualTo(
- mContext.getString(R.string.reset_dashboard_summary));
- }
-
- @Test
- public void getSummary_nonSystemUser_shouldReturnAppsSummary() {
- mShadowUserManager.setIsAdminUser(false);
- mShadowUserManager.setIsDemoUser(false);
-
- assertThat(mController.getSummary()).isEqualTo(
- mContext.getString(R.string.reset_dashboard_summary_onlyApps));
- }
-
- @Test
- public void getSummary_demoUser_shouldReturnFullSummary() {
- mShadowUserManager.setIsAdminUser(false);
-
- // Place the device in demo mode.
- Settings.Global.putInt(mContext.getContentResolver(), Settings.Global.DEVICE_DEMO_MODE, 1);
-
- // Indicate the user is a demo user.
- mShadowUserManager.addUser(UserHandle.myUserId(), "test", UserInfo.FLAG_DEMO);
-
- assertThat(mController.getSummary()).isEqualTo(
- mContext.getString(R.string.reset_dashboard_summary));
- }
}
\ No newline at end of file