Snap for 7412526 from d60ad9335f to sc-v2-release
Change-Id: I15ea5e94411950577eebe7d4e684ee51ce6f0d57
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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. -->
|
||||
|
||||
@@ -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"/>
|
||||
|
||||
@@ -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"/>
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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">
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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 -->
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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">
|
||||
|
||||
@@ -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">
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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" />
|
||||
|
||||
@@ -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>
|
||||
<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>
|
||||
|
||||
@@ -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>
|
||||
@@ -24,12 +24,10 @@ import static com.android.settings.accessibility.AccessibilityUtil.UserShortcutT
|
||||
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.annotation.VisibleForTesting;
|
||||
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 @@ public final class AccessibilityGestureNavigationTutorial {
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -134,7 +134,8 @@ public final class BluetoothPairingService extends Service {
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -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 androidx.preference.SwitchPreference;
|
||||
|
||||
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 @@ public final class EnableBlursPreferenceController extends DeveloperOptionsPrefe
|
||||
|
||||
@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 @@ public final class EnableBlursPreferenceController extends DeveloperOptionsPrefe
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,14 +104,16 @@ public class StorageCategoryFragment extends DashboardFragment
|
||||
return;
|
||||
}
|
||||
|
||||
mPreferenceController.setVolume(mSelectedStorageEntry.getVolumeInfo());
|
||||
|
||||
if (!mSelectedStorageEntry.isMounted()) {
|
||||
// Set null volume to hide category stats.
|
||||
mPreferenceController.setVolume(null);
|
||||
return;
|
||||
}
|
||||
if (mSelectedStorageEntry.isPrivate()) {
|
||||
mStorageInfo = null;
|
||||
mAppsResult = null;
|
||||
maybeSetLoading(isQuotaSupported());
|
||||
|
||||
// Stats data is only available on private volumes.
|
||||
getLoaderManager().restartLoader(STORAGE_JOB_ID, Bundle.EMPTY, this);
|
||||
getLoaderManager()
|
||||
@@ -156,7 +158,6 @@ public class StorageCategoryFragment extends DashboardFragment
|
||||
public void onViewCreated(View v, Bundle savedInstanceState) {
|
||||
super.onViewCreated(v, savedInstanceState);
|
||||
initializeCacheProvider();
|
||||
maybeSetLoading(isQuotaSupported());
|
||||
|
||||
EntityHeaderController.newInstance(getActivity(), this /*fragment*/,
|
||||
null /* header view */)
|
||||
@@ -179,33 +180,27 @@ public class StorageCategoryFragment extends DashboardFragment
|
||||
}
|
||||
|
||||
private void onReceivedSizes() {
|
||||
boolean stopLoading = false;
|
||||
if (mStorageInfo != null) {
|
||||
final long privateUsedBytes = mStorageInfo.totalBytes - mStorageInfo.freeBytes;
|
||||
mPreferenceController.setVolume(mSelectedStorageEntry.getVolumeInfo());
|
||||
mPreferenceController.setUsedSize(privateUsedBytes);
|
||||
mPreferenceController.setTotalSize(mStorageInfo.totalBytes);
|
||||
for (int i = 0, size = mSecondaryUsers.size(); i < size; i++) {
|
||||
final AbstractPreferenceController controller = mSecondaryUsers.get(i);
|
||||
if (controller instanceof SecondaryUserController) {
|
||||
SecondaryUserController userController = (SecondaryUserController) controller;
|
||||
userController.setTotalSize(mStorageInfo.totalBytes);
|
||||
}
|
||||
}
|
||||
stopLoading = true;
|
||||
if (mStorageInfo == null || mAppsResult == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mAppsResult != null) {
|
||||
mPreferenceController.onLoadFinished(mAppsResult, mUserId);
|
||||
updateSecondaryUserControllers(mSecondaryUsers, mAppsResult);
|
||||
stopLoading = true;
|
||||
final long privateUsedBytes = mStorageInfo.totalBytes - mStorageInfo.freeBytes;
|
||||
mPreferenceController.setVolume(mSelectedStorageEntry.getVolumeInfo());
|
||||
mPreferenceController.setUsedSize(privateUsedBytes);
|
||||
mPreferenceController.setTotalSize(mStorageInfo.totalBytes);
|
||||
for (int i = 0, size = mSecondaryUsers.size(); i < size; i++) {
|
||||
final AbstractPreferenceController controller = mSecondaryUsers.get(i);
|
||||
if (controller instanceof SecondaryUserController) {
|
||||
SecondaryUserController userController = (SecondaryUserController) controller;
|
||||
userController.setTotalSize(mStorageInfo.totalBytes);
|
||||
}
|
||||
}
|
||||
|
||||
// setLoading always causes a flicker, so let's avoid doing it.
|
||||
if (stopLoading) {
|
||||
if (getView().findViewById(R.id.loading_container).getVisibility() == View.VISIBLE) {
|
||||
setLoading(false, true);
|
||||
}
|
||||
mPreferenceController.onLoadFinished(mAppsResult, mUserId);
|
||||
updateSecondaryUserControllers(mSecondaryUsers, mAppsResult);
|
||||
|
||||
if (getView().findViewById(R.id.loading_container).getVisibility() == View.VISIBLE) {
|
||||
setLoading(false, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -232,14 +232,16 @@ public class StorageDashboardFragment extends DashboardFragment
|
||||
mOptionMenuController.setSelectedStorageEntry(mSelectedStorageEntry);
|
||||
getActivity().invalidateOptionsMenu();
|
||||
|
||||
mPreferenceController.setVolume(mSelectedStorageEntry.getVolumeInfo());
|
||||
|
||||
if (!mSelectedStorageEntry.isMounted()) {
|
||||
// Set null volume to hide category stats.
|
||||
mPreferenceController.setVolume(null);
|
||||
return;
|
||||
}
|
||||
if (mSelectedStorageEntry.isPrivate()) {
|
||||
mStorageInfo = null;
|
||||
mAppsResult = null;
|
||||
maybeSetLoading(isQuotaSupported());
|
||||
|
||||
// Stats data is only available on private volumes.
|
||||
getLoaderManager().restartLoader(STORAGE_JOB_ID, Bundle.EMPTY, this);
|
||||
getLoaderManager()
|
||||
@@ -315,7 +317,6 @@ public class StorageDashboardFragment extends DashboardFragment
|
||||
public void onViewCreated(View v, Bundle savedInstanceState) {
|
||||
super.onViewCreated(v, savedInstanceState);
|
||||
initializeCacheProvider();
|
||||
maybeSetLoading(isQuotaSupported());
|
||||
|
||||
EntityHeaderController.newInstance(getActivity(), this /*fragment*/,
|
||||
null /* header view */)
|
||||
@@ -350,33 +351,27 @@ public class StorageDashboardFragment extends DashboardFragment
|
||||
}
|
||||
|
||||
private void onReceivedSizes() {
|
||||
boolean stopLoading = false;
|
||||
if (mStorageInfo != null) {
|
||||
final long privateUsedBytes = mStorageInfo.totalBytes - mStorageInfo.freeBytes;
|
||||
mPreferenceController.setVolume(mSelectedStorageEntry.getVolumeInfo());
|
||||
mPreferenceController.setUsedSize(privateUsedBytes);
|
||||
mPreferenceController.setTotalSize(mStorageInfo.totalBytes);
|
||||
for (int i = 0, size = mSecondaryUsers.size(); i < size; i++) {
|
||||
final AbstractPreferenceController controller = mSecondaryUsers.get(i);
|
||||
if (controller instanceof SecondaryUserController) {
|
||||
SecondaryUserController userController = (SecondaryUserController) controller;
|
||||
userController.setTotalSize(mStorageInfo.totalBytes);
|
||||
}
|
||||
}
|
||||
stopLoading = true;
|
||||
if (mStorageInfo == null || mAppsResult == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mAppsResult != null) {
|
||||
mPreferenceController.onLoadFinished(mAppsResult, mUserId);
|
||||
updateSecondaryUserControllers(mSecondaryUsers, mAppsResult);
|
||||
stopLoading = true;
|
||||
final long privateUsedBytes = mStorageInfo.totalBytes - mStorageInfo.freeBytes;
|
||||
mPreferenceController.setVolume(mSelectedStorageEntry.getVolumeInfo());
|
||||
mPreferenceController.setUsedSize(privateUsedBytes);
|
||||
mPreferenceController.setTotalSize(mStorageInfo.totalBytes);
|
||||
for (int i = 0, size = mSecondaryUsers.size(); i < size; i++) {
|
||||
final AbstractPreferenceController controller = mSecondaryUsers.get(i);
|
||||
if (controller instanceof SecondaryUserController) {
|
||||
SecondaryUserController userController = (SecondaryUserController) controller;
|
||||
userController.setTotalSize(mStorageInfo.totalBytes);
|
||||
}
|
||||
}
|
||||
|
||||
// setLoading always causes a flicker, so let's avoid doing it.
|
||||
if (stopLoading) {
|
||||
if (getView().findViewById(R.id.loading_container).getVisibility() == View.VISIBLE) {
|
||||
setLoading(false, true);
|
||||
}
|
||||
mPreferenceController.onLoadFinished(mAppsResult, mUserId);
|
||||
updateSecondaryUserControllers(mSecondaryUsers, mAppsResult);
|
||||
|
||||
if (getView().findViewById(R.id.loading_container).getVisibility() == View.VISIBLE) {
|
||||
setLoading(false, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -222,7 +222,6 @@ public class StorageItemPreferenceController extends AbstractPreferenceControlle
|
||||
mVolume = volume;
|
||||
|
||||
updateCategoryPreferencesVisibility();
|
||||
updatePrivateStorageCategoryPreferencesOrder();
|
||||
}
|
||||
|
||||
// Stats data is only available on private volumes.
|
||||
@@ -353,14 +352,10 @@ public class StorageItemPreferenceController extends AbstractPreferenceControlle
|
||||
mDocumentsAndOtherPreference = screen.findPreference(DOCUMENTS_AND_OTHER_KEY);
|
||||
mSystemPreference = screen.findPreference(SYSTEM_KEY);
|
||||
mTrashPreference = screen.findPreference(TRASH_KEY);
|
||||
|
||||
updateCategoryPreferencesVisibility();
|
||||
updatePrivateStorageCategoryPreferencesOrder();
|
||||
}
|
||||
|
||||
/** Fragments use it to set storage result and update UI of this controller. */
|
||||
public void onLoadFinished(SparseArray<StorageAsyncLoader.StorageResult> result,
|
||||
int userId) {
|
||||
public void onLoadFinished(SparseArray<StorageAsyncLoader.StorageResult> result, int userId) {
|
||||
final StorageAsyncLoader.StorageResult data = result.get(userId);
|
||||
|
||||
mImagesPreference.setStorageSize(data.imagesSize, mTotalSize);
|
||||
@@ -374,8 +369,6 @@ public class StorageItemPreferenceController extends AbstractPreferenceControlle
|
||||
if (mSystemPreference != null) {
|
||||
// Everything else that hasn't already been attributed is tracked as
|
||||
// belonging to system.
|
||||
// TODO(b/170918505): Should revamp system size calculation with the data
|
||||
// from media provider.
|
||||
long attributedSize = 0;
|
||||
for (int i = 0; i < result.size(); i++) {
|
||||
final StorageAsyncLoader.StorageResult otherData = result.valueAt(i);
|
||||
|
||||
@@ -37,6 +37,7 @@ import com.android.settings.R;
|
||||
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 @@ public class ActionDisabledByAdminDialogHelper {
|
||||
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
|
||||
|
||||
@@ -25,7 +25,6 @@ import android.content.Intent;
|
||||
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.BatteryTipPreferenceController;
|
||||
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 @@ public class AdvancedPowerUsageDetail extends DashboardFragment implements
|
||||
@VisibleForTesting
|
||||
Preference mBackgroundPreference;
|
||||
@VisibleForTesting
|
||||
Preference mFooterPreference;
|
||||
FooterPreference mFooterPreference;
|
||||
@VisibleForTesting
|
||||
RadioButtonPreference mRestrictedPreference;
|
||||
@VisibleForTesting
|
||||
@@ -351,7 +352,13 @@ public class AdvancedPowerUsageDetail extends DashboardFragment implements
|
||||
//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
|
||||
|
||||
@@ -15,6 +15,8 @@ package com.android.settings.fuelgauge;
|
||||
|
||||
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 @@ public class BatteryChartView extends AppCompatImageView implements View.OnClick
|
||||
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 @@ public class BatteryChartView extends AppCompatImageView implements View.OnClick
|
||||
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 @@ public class BatteryChartView extends AppCompatImageView implements View.OnClick
|
||||
|
||||
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) {
|
||||
|
||||
@@ -76,11 +76,6 @@ public class BatteryDiffEntry {
|
||||
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 @@ public class BatteryDiffEntry {
|
||||
|
||||
/** 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 @@ public class BatteryDiffEntry {
|
||||
}
|
||||
// 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 @@ public class BatteryDiffEntry {
|
||||
}
|
||||
|
||||
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 @@ public class BatteryDiffEntry {
|
||||
/*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();
|
||||
}
|
||||
|
||||
|
||||
@@ -417,10 +417,6 @@ public class BatteryEntry {
|
||||
}
|
||||
|
||||
final String uidString = Integer.toString(uid);
|
||||
if (name == null) {
|
||||
name = uidString;
|
||||
}
|
||||
|
||||
if (icon == null) {
|
||||
icon = pm.getDefaultActivityIcon();
|
||||
}
|
||||
|
||||
@@ -74,8 +74,12 @@ public final class ConvertUtils {
|
||||
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 @@ public final class ConvertUtils {
|
||||
|
||||
/** 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. */
|
||||
|
||||
@@ -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 @@ public class BatterySaverSettings extends DashboardFragment {
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 @@ public class GesturesSettingPreferenceController extends BasePreferenceControlle
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -416,9 +416,14 @@ public class NetworkProviderSettings extends RestrictedSettingsFragment
|
||||
|
||||
@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;
|
||||
|
||||
@@ -125,6 +125,7 @@ public class PanelSlicesAdapter
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,11 +17,9 @@ package com.android.settings.system;
|
||||
|
||||
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 @@ public class ResetPreferenceController extends BasePreferenceController {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ import android.app.settings.SettingsEnums;
|
||||
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.PreferenceGroup;
|
||||
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 @@ public class SystemDashboardFragment extends DashboardFragment {
|
||||
|
||||
@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 class SystemDashboardFragment extends DashboardFragment {
|
||||
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);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1054,7 +1054,7 @@ public class WifiDetailPreferenceController2 extends AbstractPreferenceControlle
|
||||
}
|
||||
|
||||
public Drawable getIcon(boolean showX, int level) {
|
||||
return mContext.getDrawable(Utils.getWifiIconResource(showX, level)).mutate();
|
||||
return mContext.getDrawable(WifiUtils.getInternetIconResource(level, showX)).mutate();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
@@ -84,7 +84,7 @@ public class ConnectedDeviceDashboardFragmentTest {
|
||||
.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
|
||||
|
||||
@@ -23,7 +23,7 @@ import static org.mockito.Mockito.verify;
|
||||
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 final class EnableBlursPreferenceControllerTest {
|
||||
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 @@ public final class EnableBlursPreferenceControllerTest {
|
||||
|
||||
@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);
|
||||
|
||||
@@ -397,25 +397,6 @@ public class StorageItemPreferenceControllerTest {
|
||||
assertThat(mController.mDocumentsAndOtherPreference.isVisible()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void displayPreference_hideFilePreferenceWhenEmulatedStorageUnreadable() {
|
||||
when(mSvp.findEmulatedForPrivate(nullable(VolumeInfo.class))).thenReturn(mVolume);
|
||||
when(mVolume.isMountedReadable()).thenReturn(false);
|
||||
|
||||
mController.displayPreference(mPreferenceScreen);
|
||||
|
||||
assertThat(mController.mDocumentsAndOtherPreference.isVisible()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void displayPreference_noEmulatedInternalStorage_hidePreference() {
|
||||
when(mSvp.findEmulatedForPrivate(nullable(VolumeInfo.class))).thenReturn(null);
|
||||
|
||||
mController.displayPreference(mPreferenceScreen);
|
||||
|
||||
assertThat(mController.mDocumentsAndOtherPreference.isVisible()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setVolume_updateFilePreferenceToHideAfterSettingVolume_hidePreference() {
|
||||
when(mSvp.findEmulatedForPrivate(nullable(VolumeInfo.class))).thenReturn(mVolume);
|
||||
@@ -430,7 +411,6 @@ public class StorageItemPreferenceControllerTest {
|
||||
assertThat(mController.mDocumentsAndOtherPreference.isVisible()).isFalse();
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void setVolume_updateFilePreferenceToShowAfterSettingVolume_showPreference() {
|
||||
// This will hide it initially.
|
||||
|
||||
@@ -60,6 +60,7 @@ import com.android.settingslib.applications.ApplicationsState;
|
||||
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 @@ public class AdvancedPowerUsageDetailTest {
|
||||
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 @@ public class AdvancedPowerUsageDetailTest {
|
||||
|
||||
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);
|
||||
|
||||
@@ -371,6 +371,32 @@ public final class BatteryDiffEntryTest {
|
||||
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);
|
||||
|
||||
@@ -40,6 +40,7 @@ import java.util.ArrayList;
|
||||
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 @@ public final class ConvertUtilsTest {
|
||||
|
||||
@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(
|
||||
|
||||
@@ -20,22 +20,9 @@ import static com.android.settings.core.BasePreferenceController.AVAILABLE;
|
||||
|
||||
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.Mock;
|
||||
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 @@ public class GesturesSettingsPreferenceControllerTest {
|
||||
|
||||
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
|
||||
private Activity mActivity;
|
||||
@Mock
|
||||
private Preference mPreference;
|
||||
|
||||
private GesturesSettingPreferenceController mController;
|
||||
|
||||
@@ -67,7 +51,6 @@ public class GesturesSettingsPreferenceControllerTest {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
FakeFeatureFactory.setupForTest();
|
||||
mController = new GesturesSettingPreferenceController(mActivity);
|
||||
FeatureFlagUtils.setEnabled(RuntimeEnvironment.application, FeatureFlags.SILKY_HOME, false);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -96,43 +79,4 @@ public class GesturesSettingsPreferenceControllerTest {
|
||||
|
||||
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("");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,14 +18,6 @@ package com.android.settings.system;
|
||||
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.RuntimeEnvironment;
|
||||
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 class ResetPreferenceControllerTest {
|
||||
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 class ResetPreferenceControllerTest {
|
||||
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));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user