Merge "Remove silky flag from Display for official release" into sc-dev
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index a21c4bb..f992e45 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -2115,6 +2115,8 @@
android:value="com.android.settings.category.ia.system" />
<meta-data android:name="com.android.settings.summary"
android:resource="@string/summary_empty"/>
+ <meta-data android:name="com.android.settings.icon"
+ android:resource="@drawable/ic_settings_development" />
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
android:value="com.android.settings.development.DevelopmentSettingsDashboardFragment" />
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
@@ -2584,6 +2586,8 @@
android:value="com.android.settings.category.ia.system" />
<meta-data android:name="com.android.settings.summary_uri"
android:value="content://com.android.settings.dashboard.SummaryProvider/user" />
+ <meta-data android:name="com.android.settings.icon"
+ android:resource="@drawable/ic_settings_multiuser" />
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
android:value="com.android.settings.users.UserSettings" />
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
@@ -3288,6 +3292,8 @@
<!-- Tell Settings app which category it belongs to -->
<meta-data android:name="com.android.settings.category"
android:value="com.android.settings.category.ia.system" />
+ <meta-data android:name="com.android.settings.icon"
+ android:resource="@drawable/ic_settings_backup" />
<meta-data android:name="com.android.settings.order" android:value="-60"/>
</activity>
@@ -3318,15 +3324,6 @@
</activity>
<activity
- android:name=".Settings$AppAndNotificationDashboardActivity"
- android:label="@string/app_and_notification_dashboard_title"
- android:icon="@drawable/ic_homepage_apps"
- android:exported="true">
- <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
- android:value="com.android.settings.applications.AppAndNotificationDashboardFragment"/>
- </activity>
-
- <activity
android:name=".Settings$AppDashboardActivity"
android:label="@string/apps_dashboard_title"
android:icon="@drawable/ic_homepage_apps"
diff --git a/res/layout/accessibility_shortcut_secondary_action.xml b/res/layout/accessibility_shortcut_secondary_action.xml
index a114f05..8d0ef3b 100644
--- a/res/layout/accessibility_shortcut_secondary_action.xml
+++ b/res/layout/accessibility_shortcut_secondary_action.xml
@@ -21,6 +21,8 @@
android:layout_height="wrap_content"
android:minHeight="?android:attr/listPreferredItemHeightSmall"
android:gravity="center_vertical"
+ android:paddingStart="?android:attr/listPreferredItemPaddingStart"
+ android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
android:clipToPadding="false">
<LinearLayout
@@ -29,8 +31,7 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="start|center_vertical"
- android:paddingStart="?android:attr/listPreferredItemPaddingStart"
- android:paddingEnd="?android:attr/listPreferredItemPaddingEnd">
+ >
<FrameLayout
android:id="@+id/icon_frame"
diff --git a/res/layout/preference_single_target.xml b/res/layout/preference_single_target.xml
index b4a9de0..27c33ba 100644
--- a/res/layout/preference_single_target.xml
+++ b/res/layout/preference_single_target.xml
@@ -89,7 +89,7 @@
android:id="@android:id/widget_frame"
android:layout_width="wrap_content"
android:layout_height="match_parent"
- android:minWidth="64dp"
+ android:minWidth="@dimen/two_target_min_width"
android:gravity="center"
android:orientation="vertical" />
diff --git a/res/layout/preference_two_target_radio.xml b/res/layout/preference_two_target_radio.xml
index c7d0f5e..dc97f1d 100644
--- a/res/layout/preference_two_target_radio.xml
+++ b/res/layout/preference_two_target_radio.xml
@@ -85,7 +85,7 @@
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center"
- android:minWidth="64dp"
+ android:minWidth="@dimen/two_target_min_width"
android:orientation="vertical" />
</LinearLayout>
diff --git a/res/layout/preference_widget_gear.xml b/res/layout/preference_widget_gear.xml
index 11870ac..c4fc27d 100644
--- a/res/layout/preference_widget_gear.xml
+++ b/res/layout/preference_widget_gear.xml
@@ -21,8 +21,8 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
- android:paddingStart="?android:attr/listPreferredItemPaddingEnd"
- android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
+ android:paddingStart="24dp"
+ android:paddingEnd="24dp"
android:background="?android:attr/selectableItemBackground"
android:scaleType="center"
android:src="@drawable/ic_settings_accent"
diff --git a/res/layout/preference_widget_primary_switch.xml b/res/layout/preference_widget_primary_switch.xml
index 26929ab..53c06b5 100644
--- a/res/layout/preference_widget_primary_switch.xml
+++ b/res/layout/preference_widget_primary_switch.xml
@@ -22,6 +22,4 @@
android:layout_height="match_parent"
android:minWidth="@dimen/two_target_min_width"
android:gravity="center_vertical"
- android:paddingStart="?android:attr/listPreferredItemPaddingEnd"
- android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
android:clickable="false" />
diff --git a/res/layout/wifi_button_preference_widget.xml b/res/layout/wifi_button_preference_widget.xml
index f4f1618..92e006b 100644
--- a/res/layout/wifi_button_preference_widget.xml
+++ b/res/layout/wifi_button_preference_widget.xml
@@ -19,7 +19,7 @@
android:id="@+id/button_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:minWidth="64dp"
+ android:minWidth="@dimen/two_target_min_width"
android:minHeight="@dimen/min_tap_target_size"
android:layout_gravity="center"
android:background="?android:attr/selectableItemBackground"/>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 168480e..0048093 100755
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -394,8 +394,6 @@
<!-- Elevation of bluetooth icon -->
<dimen name="bt_icon_elevation">4dp</dimen>
- <dimen name="two_target_min_width">80dp</dimen>
-
<!-- Maximum height for SliceView, override on slices/view/src/main/res/values/dimens.xml -->
<dimen name="abc_slice_large_height">1800dp</dimen>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 4dc3060..424f7a2 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -8747,6 +8747,12 @@
<!-- Preference title for showing all apps on device [CHAR_LIMIT=50]-->
<string name="recent_notifications_see_all_title">See all from last 7 days</string>
+ <!-- notification header for general notification settings [CHAR LIMIT=80]-->
+ <string name="general_notification_header">General</string>
+
+ <!-- notification preference for app specific notification settings [CHAR LIMIT=80]-->
+ <string name="app_notification_field">App settings</string>
+
<!-- Configure Notifications: Advanced section header [CHAR LIMIT=30] -->
<string name="advanced_section_header">General</string>
diff --git a/res/xml/app_and_notification.xml b/res/xml/app_and_notification.xml
deleted file mode 100644
index 8b4c912..0000000
--- a/res/xml/app_and_notification.xml
+++ /dev/null
@@ -1,114 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright (C) 2016 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="apps_and_notification_screen"
- android:title="@string/app_and_notification_dashboard_title"
- settings:initialExpandedChildrenCount="4">
- <!-- the initial count should include the dynamic tiles -->
-
- <Preference
- android:key="all_app_info"
- android:title="@string/applications_settings"
- android:order="-999"
- android:fragment="com.android.settings.applications.manageapplications.ManageApplications"
- settings:controller="com.android.settings.applications.AllAppsInfoPreferenceController"
- settings:keywords="@string/keywords_applications_settings"/>
-
- <com.android.settingslib.widget.LayoutPreference
- android:key="recent_open_apps"
- android:title="@string/recent_app_category_title"
- android:layout="@layout/app_entities_header"
- android:selectable="false"
- android:order="-998"
- settings:allowDividerBelow="true"
- settings:controller="com.android.settings.applications.RecentAppsPreferenceController"/>
-
- <!-- Empty category to draw divider -->
- <PreferenceCategory
- android:key="recent_apps_divider"
- android:layout="@layout/preference_category_no_label"
- android:order="-997"/>
-
- <Preference
- android:key="conversations"
- android:title="@string/conversations_category_title"
- android:order="-550"
- settings:controller="com.android.settings.notification.ConversationListSummaryPreferenceController"
- android:fragment="com.android.settings.notification.app.ConversationListSettings"
- />
-
- <Preference
- android:key="configure_notification_settings"
- android:title="@string/configure_notification_settings"
- android:summary="@string/notification_screen_summary"
- android:order="-440"
- android:fragment="com.android.settings.notification.ConfigureNotificationSettings"/>
-
- <!-- Notifications (appears before manage_perms), default apps (appears after) -->
- <PreferenceCategory
- android:key="dashboard_tile_placeholder"
- android:order="10"/>
-
- <Preference
- android:key="default_apps"
- android:title="@string/app_default_dashboard_title"
- android:order="11"
- settings:controller="com.android.settings.applications.DefaultAppsPreferenceController">
- <intent android:action="android.settings.MANAGE_DEFAULT_APPS_SETTINGS"/>
- </Preference>
-
- <Preference
- android:key="manage_perms"
- android:title="@string/app_permissions"
- android:summary="@string/runtime_permissions_summary_control_app_access"
- android:order="12"
- settings:keywords="@string/keywords_app_permissions">
- <intent android:action="android.intent.action.MANAGE_PERMISSIONS"/>
- </Preference>
-
- <Preference
- android:key="hibernated_apps"
- android:title="@string/unused_apps"
- android:summary="@string/summary_placeholder"
- android:order="13"
- settings:keywords="app_hibernation_key"
- settings:controller="com.android.settings.applications.HibernatedAppsPreferenceController">
- <intent android:action="android.intent.action.MANAGE_UNUSED_APPS"/>
- </Preference>
-
- <com.android.settingslib.RestrictedPreference
- android:key="app_and_notif_cell_broadcast_settings"
- android:title="@string/cell_broadcast_settings"
- android:order="15"
- settings:useAdminDisabledSummary="true">
- <intent
- android:action="android.intent.action.MAIN"
- android:targetPackage="@string/config_cell_broadcast_receiver_package"
- android:targetClass="com.android.cellbroadcastreceiver.CellBroadcastSettings"/>
- </com.android.settingslib.RestrictedPreference>
-
- <Preference
- android:key="special_access"
- android:fragment="com.android.settings.applications.specialaccess.SpecialAccessSettings"
- android:title="@string/special_access"
- android:order="20"
- settings:controller="com.android.settings.applications.SpecialAppAccessPreferenceController"/>
-
-</PreferenceScreen>
diff --git a/res/xml/app_info_settings.xml b/res/xml/app_info_settings.xml
index f5d927e..fef5243 100644
--- a/res/xml/app_info_settings.xml
+++ b/res/xml/app_info_settings.xml
@@ -18,33 +18,33 @@
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res-auto"
- android:key="installed_app_detail_settings_screen"
- settings:initialExpandedChildrenCount="6">
+ android:key="installed_app_detail_settings_screen">
<com.android.settingslib.widget.LayoutPreference
android:key="header_view"
android:layout="@layout/settings_entity_header"
android:selectable="false"
- android:order="-10000"
- settings:allowDividerBelow="true"/>
+ android:order="-10000" />
<com.android.settingslib.widget.LayoutPreference
android:key="instant_app_buttons"
android:layout="@layout/instant_app_buttons"
android:selectable="false"
- android:order="-9999"
- settings:allowDividerAbove="true"
- settings:allowDividerBelow="true"/>
+ android:order="-9999" />
<com.android.settingslib.widget.ActionButtonsPreference
android:key="action_buttons"
android:order="-9998" />
<Preference
+ android:key="app_settings_link"
+ android:title="@string/app_settings_link"
+ settings:controller="com.android.settings.applications.appinfo.AppSettingPreferenceController" />
+
+ <Preference
android:key="notification_settings"
android:title="@string/notifications_label"
- settings:controller="com.android.settings.applications.appinfo.AppNotificationPreferenceController"
- settings:allowDividerAbove="true"/>
+ settings:controller="com.android.settings.applications.appinfo.AppNotificationPreferenceController" />
<com.android.settings.widget.FixedLineSummaryPreference
android:key="permission_settings"
@@ -72,6 +72,12 @@
settings:controller="com.android.settings.applications.appinfo.AppDataUsagePreferenceController" />
<Preference
+ android:key="extra_app_info_settings"
+ android:title="@string/extra_app_info_label"
+ android:summary="@string/extra_app_info_summary"
+ settings:controller="com.android.settings.applications.appinfo.ExtraAppInfoPreferenceController" />
+
+ <Preference
android:key="time_spent_in_app"
android:title="@string/time_spent_in_app_pref_title"
settings:controller="com.android.settings.applications.appinfo.TimeSpentInAppPreferenceController" />
@@ -185,12 +191,6 @@
</PreferenceCategory>
<Preference
- android:key="app_settings_link"
- android:title="@string/app_settings_link"
- settings:controller="com.android.settings.applications.appinfo.AppSettingPreferenceController"
- settings:allowDividerAbove="true" />
-
- <Preference
android:key="app_version"
android:selectable="false"
android:order="9999"
diff --git a/res/xml/app_info_settings_v2.xml b/res/xml/app_info_settings_v2.xml
deleted file mode 100644
index b4a82e0..0000000
--- a/res/xml/app_info_settings_v2.xml
+++ /dev/null
@@ -1,201 +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="installed_app_detail_settings_screen">
-
- <com.android.settingslib.widget.LayoutPreference
- android:key="header_view"
- android:layout="@layout/settings_entity_header"
- android:selectable="false"
- android:order="-10000" />
-
- <com.android.settingslib.widget.LayoutPreference
- android:key="instant_app_buttons"
- android:layout="@layout/instant_app_buttons"
- android:selectable="false"
- android:order="-9999" />
-
- <com.android.settingslib.widget.ActionButtonsPreference
- android:key="action_buttons"
- android:order="-9998" />
-
- <Preference
- android:key="app_settings_link"
- android:title="@string/app_settings_link"
- settings:controller="com.android.settings.applications.appinfo.AppSettingPreferenceController" />
-
- <Preference
- android:key="notification_settings"
- android:title="@string/notifications_label"
- settings:controller="com.android.settings.applications.appinfo.AppNotificationPreferenceController" />
-
- <com.android.settings.widget.FixedLineSummaryPreference
- android:key="permission_settings"
- android:title="@string/permissions_label"
- android:summary="@string/summary_placeholder"
- settings:summaryLineCount="1"
- settings:controller="com.android.settings.applications.appinfo.AppPermissionPreferenceController" />
-
- <Preference
- android:key="storage_settings"
- android:title="@string/storage_settings_for_app"
- android:summary="@string/summary_placeholder"
- settings:controller="com.android.settings.applications.appinfo.AppStoragePreferenceController" />
-
- <com.android.settings.applications.AppDomainsPreference
- android:key="instant_app_launch_supported_domain_urls"
- android:title="@string/app_launch_supported_domain_urls_title"
- android:selectable="true"
- settings:controller="com.android.settings.applications.appinfo.InstantAppDomainsPreferenceController" />
-
- <Preference
- android:key="data_settings"
- android:title="@string/data_usage_app_summary_title"
- android:summary="@string/summary_placeholder"
- settings:controller="com.android.settings.applications.appinfo.AppDataUsagePreferenceController" />
-
- <Preference
- android:key="extra_app_info_settings"
- android:title="@string/extra_app_info_label"
- android:summary="@string/extra_app_info_summary"
- settings:controller="com.android.settings.applications.appinfo.ExtraAppInfoPreferenceController" />
-
- <Preference
- android:key="time_spent_in_app"
- android:title="@string/time_spent_in_app_pref_title"
- settings:controller="com.android.settings.applications.appinfo.TimeSpentInAppPreferenceController" />
-
- <Preference
- android:key="battery"
- android:title="@string/power_usage_summary_title"
- android:summary="@string/summary_placeholder" />
-
- <Preference
- android:key="preferred_settings"
- android:title="@string/launch_by_default"
- android:summary="@string/summary_placeholder"
- android:selectable="true"
- settings:controller="com.android.settings.applications.appinfo.AppOpenByDefaultPreferenceController" />
-
- <Preference
- android:key="memory"
- android:title="@string/memory_settings_title"
- android:summary="@string/summary_placeholder"
- android:enabled="false" />
-
- <!-- Default apps shortcuts -->
- <Preference
- android:key="default_home"
- android:title="@string/home_app"
- android:summary="@string/summary_placeholder" />
-
- <Preference
- android:key="default_browser"
- android:title="@string/default_browser_title"
- android:summary="@string/summary_placeholder" />
-
- <Preference
- android:key="default_phone_app"
- android:title="@string/default_phone_title"
- android:summary="@string/default_phone_title" />
-
- <Preference
- android:key="default_emergency_app"
- android:title="@string/default_emergency_app"
- android:summary="@string/summary_placeholder" />
-
- <Preference
- android:key="default_sms_app"
- android:title="@string/sms_application_title"
- android:summary="@string/summary_placeholder" />
-
- <PreferenceCategory
- android:key="app_hibernation_info"
- android:title="@string/unused_apps"
- settings:controller=
- "com.android.settings.applications.appinfo.AppHibernationPreferenceCategoryController">
-
- <SwitchPreference
- android:key="hibernation_switch"
- android:title="@string/unused_apps_switch"
- settings:controller=
- "com.android.settings.applications.appinfo.HibernationSwitchPreferenceController" />
- </PreferenceCategory>
-
- <!-- Advanced apps settings -->
- <PreferenceCategory
- android:key="advanced_app_info"
- android:title="@string/advanced_apps"
- settings:controller="com.android.settings.applications.appinfo.AdvancedAppInfoPreferenceCategoryController">
-
- <Preference
- android:key="system_alert_window"
- android:title="@string/draw_overlay"
- android:summary="@string/summary_placeholder"
- settings:controller="com.android.settings.applications.appinfo.DrawOverlayDetailPreferenceController" />
-
- <Preference
- android:key="write_settings_apps"
- android:title="@string/write_settings"
- android:summary="@string/summary_placeholder"
- settings:controller="com.android.settings.applications.appinfo.WriteSystemSettingsPreferenceController" />
-
- <Preference
- android:key="picture_in_picture"
- android:title="@string/picture_in_picture_app_detail_title"
- android:summary="@string/summary_placeholder"
- settings:controller="com.android.settings.applications.specialaccess.pictureinpicture.PictureInPictureDetailPreferenceController" />
-
- <Preference
- android:key="install_other_apps"
- android:title="@string/install_other_apps"
- android:summary="@string/summary_placeholder"
- settings:controller="com.android.settings.applications.appinfo.ExternalSourceDetailPreferenceController" />
-
- <Preference
- android:key="interact_across_profiles"
- android:title="@string/interact_across_profiles_title"
- android:summary="@string/summary_placeholder"
- settings:controller="com.android.settings.applications.specialaccess.interactacrossprofiles.InteractAcrossProfilesDetailsPreferenceController" />
-
- </PreferenceCategory>
-
- <!-- App installer info -->
- <PreferenceCategory
- android:key="app_installer"
- android:title="@string/app_install_details_group_title"
- settings:controller="com.android.settings.applications.appinfo.AppInstallerPreferenceCategoryController">
-
- <Preference
- android:key="app_info_store"
- android:title="@string/app_install_details_title"
- settings:controller="com.android.settings.applications.appinfo.AppInstallerInfoPreferenceController" />
-
- </PreferenceCategory>
-
- <Preference
- android:key="app_version"
- android:selectable="false"
- android:order="9999"
- settings:controller="com.android.settings.applications.appinfo.AppVersionPreferenceController"
- settings:allowDividerAbove="true"
- settings:enableCopying="true"/>
-
-</PreferenceScreen>
diff --git a/res/xml/configure_notification_settings.xml b/res/xml/configure_notification_settings.xml
index ab22f73..dad5e0e 100644
--- a/res/xml/configure_notification_settings.xml
+++ b/res/xml/configure_notification_settings.xml
@@ -19,6 +19,39 @@
android:title="@string/configure_notification_settings">
<PreferenceCategory
+ android:key="general_notifications_category"
+ android:title="@string/general_notification_header">
+ <!-- See all apps button -->
+ <Preference
+ android:key="all_notifications"
+ android:order="10"
+ android:title="@string/app_notification_field"
+ android:fragment="com.android.settings.applications.manageapplications.ManageApplications"
+ settings:searchable="false">
+ <extra
+ android:name="classname"
+ android:value="com.android.settings.Settings$NotificationAppListActivity"/>
+ </Preference>
+ <Preference
+ android:key="notification_history"
+ android:order="11"
+ android:title="@string/notification_history"
+ android:summary="@string/notification_history_summary">
+ <intent
+ android:action="android.intent.action.MAIN"
+ android:targetPackage="com.android.settings"
+ android:targetClass="com.android.settings.notification.history.NotificationHistoryActivity" />
+ </Preference>
+ <Preference
+ android:key="notification_access"
+ android:order="12"
+ android:title="@string/manage_notification_access_title"
+ android:summary="@string/manage_notification_access_summary"
+ android:fragment="com.android.settings.notification.NotificationAccessSettings"
+ settings:controller="com.android.settings.applications.specialaccess.notificationaccess.NotificationAccessController" />
+ </PreferenceCategory>
+
+ <PreferenceCategory
android:key="conversation_category"
android:title="@string/conversation_notifs_category">
<Preference
@@ -40,58 +73,8 @@
</PreferenceCategory>
<PreferenceCategory
- android:key="recent_notifications_category"
- android:title="@string/recent_notifications">
- <!-- Placeholder for a list of recent apps -->
- <com.android.settings.widget.PrimarySwitchPreference
- android:key="app1"
- android:title=" "
- android:summary=" "
- android:order="5"/>
- <com.android.settings.widget.PrimarySwitchPreference
- android:key="app2"
- android:title=" "
- android:summary=" "
- android:order="6"/>
- <com.android.settings.widget.PrimarySwitchPreference
- android:key="app3"
- android:title=" "
- android:summary=" "
- android:order="7"/>
-
- <!-- See all apps button -->
- <Preference
- android:key="all_notifications"
- android:order="10"
- android:title="@string/notifications_title"
- android:fragment="com.android.settings.applications.manageapplications.ManageApplications"
- settings:searchable="false">
- <extra
- android:name="classname"
- android:value="com.android.settings.Settings$NotificationAppListActivity"/>
- </Preference>
- </PreferenceCategory>
-
- <PreferenceCategory
android:key="configure_notifications_lock"
android:title="@string/lock_screen_notifications_title">
- <Preference
- android:key="notification_history"
- android:order="11"
- android:title="@string/notification_history"
- android:summary="@string/notification_history_summary">
- <intent
- android:action="android.intent.action.MAIN"
- android:targetPackage="com.android.settings"
- android:targetClass="com.android.settings.notification.history.NotificationHistoryActivity" />
- </Preference>
- <Preference
- android:key="notification_access"
- android:order="12"
- android:title="@string/manage_notification_access_title"
- android:summary="@string/manage_notification_access_summary"
- android:fragment="com.android.settings.notification.NotificationAccessSettings"
- settings:controller="com.android.settings.applications.specialaccess.notificationaccess.NotificationAccessController" />
<!-- When device is locked -->
<com.android.settings.RestrictedListPreference
android:key="lock_screen_notifications"
diff --git a/res/xml/network_provider_settings.xml b/res/xml/network_provider_settings.xml
index b29755b..3d4ce80 100644
--- a/res/xml/network_provider_settings.xml
+++ b/res/xml/network_provider_settings.xml
@@ -25,16 +25,14 @@
android:key="resetting_your_internet"
android:title="@string/resetting_internet_text"
android:selectable="false"
- android:layout="@layout/resetting_internet"
- settings:allowDividerBelow="true"/>
+ android:layout="@layout/resetting_internet"/>
<!-- Airplane mode message -->
<com.android.settingslib.widget.LayoutPreference
android:key="airplane_mode_message"
android:title="@string/condition_airplane_title"
android:selectable="false"
- android:layout="@layout/airplane_mode_message_preference"
- settings:allowDividerBelow="true"/>
+ android:layout="@layout/airplane_mode_message_preference"/>
<Preference
android:key="connected_ethernet_network"
@@ -64,14 +62,12 @@
android:key="wifi_switch"
android:title="@string/wifi"
android:summary="@string/wifi_switch_summary"
- settings:allowDividerAbove="true"
settings:keywords="@string/keywords_wifi"/>
<Preference
android:key="configure_wifi_settings"
android:title="@string/network_and_internet_preferences_title"
android:summary="@string/network_and_internet_preferences_summary"
- settings:allowDividerAbove="true"
android:fragment="com.android.settings.wifi.ConfigureWifiSettings"/>
<Preference
diff --git a/res/xml/wifi_network_details_fragment2.xml b/res/xml/wifi_network_details_fragment2.xml
index 7847eba..1c4fe91 100644
--- a/res/xml/wifi_network_details_fragment2.xml
+++ b/res/xml/wifi_network_details_fragment2.xml
@@ -22,8 +22,7 @@
android:key="connection_header"
android:layout="@layout/settings_entity_header"
android:selectable="false"
- android:order="-10000"
- settings:allowDividerBelow="true"/>
+ android:order="-10000"/>
<com.android.settings.datausage.DataUsageSummaryPreference
android:key="status_header"
@@ -34,21 +33,18 @@
<com.android.settings.widget.LinkifySummaryPreference
android:key="second_summary"
android:icon="@drawable/ic_info_outline_24dp"
- android:selectable="false"
- settings:allowDividerAbove="false"/>
+ android:selectable="false"/>
<!-- Buttons -->
<com.android.settingslib.widget.ActionButtonsPreference
android:key="buttons"
- android:selectable="false"
- settings:allowDividerAbove="true"/>
+ android:selectable="false"/>
<!-- General Details Preferences -->
<Preference
android:key="signal_strength"
android:title="@string/wifi_signal"
- android:selectable="false"
- settings:allowDividerAbove="true"/>
+ android:selectable="false"/>
<Preference
android:key="frequency"
@@ -79,21 +75,18 @@
<Preference
android:key="subscription_detail"
android:title="@string/wifi_subscription"
- android:summary="@string/wifi_subscription_summary"
- settings:allowDividerAbove="true"/>
+ android:summary="@string/wifi_subscription_summary"/>
<SwitchPreference
android:key="auto_connect"
android:title="@string/wifi_auto_connect_title"
- android:summary="@string/wifi_auto_connect_summary"
- settings:allowDividerAbove="true"/>
+ android:summary="@string/wifi_auto_connect_summary"/>
<!-- Add device Preference -->
<Preference
android:key="add_device_to_network"
android:title="@string/wifi_dpp_add_device"
- android:summary="@string/wifi_dpp_connect_network_using_qr_code"
- settings:allowDividerAbove="true"/>
+ android:summary="@string/wifi_dpp_connect_network_using_qr_code"/>
<!-- Network Details -->
<PreferenceCategory
diff --git a/src/com/android/settings/accessibility/AccessibilitySettingsForSetupWizardActivity.java b/src/com/android/settings/accessibility/AccessibilitySettingsForSetupWizardActivity.java
index 2d58bed..48b3992 100644
--- a/src/com/android/settings/accessibility/AccessibilitySettingsForSetupWizardActivity.java
+++ b/src/com/android/settings/accessibility/AccessibilitySettingsForSetupWizardActivity.java
@@ -34,6 +34,7 @@
import com.android.settings.search.actionbar.SearchMenuController;
import com.android.settings.support.actionbar.HelpResourceProvider;
import com.android.settingslib.core.instrumentation.Instrumentable;
+import com.android.settingslib.transition.SettingsTransitionHelper;
import com.google.android.setupcompat.util.WizardManagerHelper;
import com.google.android.setupdesign.util.ThemeHelper;
@@ -92,6 +93,7 @@
: Instrumentable.METRICS_CATEGORY_UNKNOWN)
.setExtras(SetupWizardUtils.copyLifecycleExtra(getIntent().getExtras(),
new Bundle()))
+ .setTransitionType(SettingsTransitionHelper.TransitionType.TRANSITION_FADE)
.launch();
return true;
}
@@ -119,7 +121,8 @@
.setArguments(args)
.setSourceMetricsCategory(Instrumentable.METRICS_CATEGORY_UNKNOWN)
.setExtras(SetupWizardUtils.copyLifecycleExtra(getIntent().getExtras(),
- new Bundle()));
+ new Bundle()))
+ .setTransitionType(SettingsTransitionHelper.TransitionType.TRANSITION_FADE);
Log.d(LOG_TAG, "Launch font size settings");
subSettingLauncher.launch();
diff --git a/src/com/android/settings/applications/AllAppsInfoPreferenceController.java b/src/com/android/settings/applications/AllAppsInfoPreferenceController.java
deleted file mode 100644
index 325b25a..0000000
--- a/src/com/android/settings/applications/AllAppsInfoPreferenceController.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (C) 2019 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.settings.applications;
-
-import android.app.usage.UsageStats;
-import android.content.Context;
-
-import androidx.annotation.NonNull;
-import androidx.annotation.VisibleForTesting;
-import androidx.preference.Preference;
-import androidx.preference.PreferenceScreen;
-
-import com.android.settings.R;
-import com.android.settings.core.BasePreferenceController;
-
-import java.util.List;
-
-public class AllAppsInfoPreferenceController extends BasePreferenceController
- implements RecentAppStatsMixin.RecentAppStatsListener {
-
- @VisibleForTesting
- Preference mPreference;
-
- public AllAppsInfoPreferenceController(Context context, String key) {
- super(context, key);
- }
-
- @Override
- public int getAvailabilityStatus() {
- return AVAILABLE;
- }
-
- @Override
- public void displayPreference(PreferenceScreen screen) {
- super.displayPreference(screen);
- mPreference = screen.findPreference(getPreferenceKey());
- // In most cases, device has recently opened apps. So, we hide it by default.
- mPreference.setVisible(false);
- }
-
- @Override
- public void onReloadDataCompleted(@NonNull List<UsageStats> recentApps) {
- // If device has recently opened apps, we don't show all apps preference.
- if (!recentApps.isEmpty()) {
- mPreference.setVisible(false);
- return;
- }
-
- mPreference.setVisible(true);
- // Show total number of installed apps as See all's summary.
- new InstalledAppCounter(mContext, InstalledAppCounter.IGNORE_INSTALL_REASON,
- mContext.getPackageManager()) {
- @Override
- protected void onCountComplete(int num) {
- mPreference.setSummary(mContext.getString(R.string.apps_summary, num));
- }
- }.execute();
- }
-}
diff --git a/src/com/android/settings/applications/AppAndNotificationDashboardFragment.java b/src/com/android/settings/applications/AppAndNotificationDashboardFragment.java
deleted file mode 100644
index ddb3951..0000000
--- a/src/com/android/settings/applications/AppAndNotificationDashboardFragment.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.settings.applications;
-
-import android.app.settings.SettingsEnums;
-import android.app.usage.UsageStats;
-import android.content.Context;
-import android.os.Bundle;
-import android.provider.SearchIndexableResource;
-import android.util.FeatureFlagUtils;
-import android.view.View;
-
-import androidx.annotation.NonNull;
-
-import com.android.settings.R;
-import com.android.settings.Utils;
-import com.android.settings.core.FeatureFlags;
-import com.android.settings.dashboard.DashboardFragment;
-import com.android.settings.notification.EmergencyBroadcastPreferenceController;
-import com.android.settings.search.BaseSearchIndexProvider;
-import com.android.settingslib.core.AbstractPreferenceController;
-import com.android.settingslib.search.SearchIndexable;
-import com.android.settingslib.widget.AppEntitiesHeaderController;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-@SearchIndexable
-public class AppAndNotificationDashboardFragment extends DashboardFragment
- implements RecentAppStatsMixin.RecentAppStatsListener {
-
- private static final String TAG = "AppAndNotifDashboard";
-
- private RecentAppStatsMixin mRecentAppStatsMixin;
- private RecentAppsPreferenceController mRecentAppsPreferenceController;
- private AllAppsInfoPreferenceController mAllAppsInfoPreferenceController;
-
- @Override
- public int getMetricsCategory() {
- return SettingsEnums.SETTINGS_APP_NOTIF_CATEGORY;
- }
-
- @Override
- protected String getLogTag() {
- return TAG;
- }
-
- @Override
- public int getHelpResource() {
- return R.string.help_url_apps_and_notifications;
- }
-
- @Override
- protected int getPreferenceScreenResId() {
- return R.xml.app_and_notification;
- }
-
- @Override
- public void onAttach(Context context) {
- super.onAttach(context);
-
- use(SpecialAppAccessPreferenceController.class).setSession(getSettingsLifecycle());
-
- mRecentAppStatsMixin = new RecentAppStatsMixin(context,
- AppEntitiesHeaderController.MAXIMUM_APPS);
- getSettingsLifecycle().addObserver(mRecentAppStatsMixin);
- mRecentAppStatsMixin.addListener(this);
-
- mRecentAppsPreferenceController = use(RecentAppsPreferenceController.class);
- mRecentAppsPreferenceController.setFragment(this /* fragment */);
- mRecentAppStatsMixin.addListener(mRecentAppsPreferenceController);
-
- mAllAppsInfoPreferenceController = use(AllAppsInfoPreferenceController.class);
- mRecentAppStatsMixin.addListener(mAllAppsInfoPreferenceController);
- }
-
- @Override
- public void onViewCreated(View view, Bundle savedInstanceState) {
- super.onViewCreated(view, savedInstanceState);
- setPinnedHeaderView(R.layout.progress_header);
- showPinnedHeader(false);
- }
-
- @Override
- public void onStart() {
- super.onStart();
- showPinnedHeader(true);
- }
-
- @Override
- public void onReloadDataCompleted(@NonNull List<UsageStats> recentApps) {
- showPinnedHeader(false);
- if (!recentApps.isEmpty()) {
- Utils.setActionBarShadowAnimation(getActivity(), getSettingsLifecycle(),
- getListView());
- }
- }
-
- @Override
- protected List<AbstractPreferenceController> createPreferenceControllers(Context context) {
- return buildPreferenceControllers(context);
- }
-
- private static List<AbstractPreferenceController> buildPreferenceControllers(Context context) {
- final List<AbstractPreferenceController> controllers = new ArrayList<>();
- controllers.add(new EmergencyBroadcastPreferenceController(context,
- "app_and_notif_cell_broadcast_settings"));
- return controllers;
- }
-
- public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
- new BaseSearchIndexProvider() {
- @Override
- public List<SearchIndexableResource> getXmlResourcesToIndex(
- Context context, boolean enabled) {
- final SearchIndexableResource sir = new SearchIndexableResource(context);
- sir.xmlResId = R.xml.app_and_notification;
- return Arrays.asList(sir);
- }
-
- @Override
- public List<AbstractPreferenceController> createPreferenceControllers(
- Context context) {
- return buildPreferenceControllers(context);
- }
-
- @Override
- protected boolean isPageSearchEnabled(Context context) {
- // TODO(b/174964405): This method should be removed when silky home launched.
- // This page is going to deprecate, we should make this page unsearchable
- // when the silky home is enabled, otherwise search results will contain the
- // old data and launch this page even if the silky home is enabled.
- return !FeatureFlagUtils.isEnabled(context, FeatureFlags.SILKY_HOME);
- }
- };
-}
diff --git a/src/com/android/settings/applications/AppDashboardFragment.java b/src/com/android/settings/applications/AppDashboardFragment.java
index 3b1a977..65f2b61 100644
--- a/src/com/android/settings/applications/AppDashboardFragment.java
+++ b/src/com/android/settings/applications/AppDashboardFragment.java
@@ -19,14 +19,11 @@
import android.app.settings.SettingsEnums;
import android.content.Context;
import android.provider.SearchIndexableResource;
-import android.util.FeatureFlagUtils;
import com.android.settings.R;
-import com.android.settings.core.FeatureFlags;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settingslib.core.AbstractPreferenceController;
-import com.android.settingslib.drawer.CategoryKey;
import com.android.settingslib.search.SearchIndexable;
import java.util.ArrayList;
@@ -79,16 +76,6 @@
return buildPreferenceControllers(context);
}
- @Override
- public String getCategoryKey() {
- // TODO(b/174964405): Remove this function when the silky flag was deprecated.
- // To include injection tiles, map this app fragment to the app category in the short term.
- // When we deprecate the silky flag, we have to:
- // 1. Remove this method.
- // 2. Update the mapping in DashboardFragmentRegistry.PARENT_TO_CATEGORY_KEY_MAP.
- return CategoryKey.CATEGORY_APPS;
- }
-
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
new BaseSearchIndexProvider() {
@Override
@@ -104,12 +91,5 @@
Context context) {
return buildPreferenceControllers(context);
}
-
- @Override
- protected boolean isPageSearchEnabled(Context context) {
- // TODO(b/174964405): This method should be removed when silky home launched.
- // Only allow this page can be searchable when silky home enabled.
- return FeatureFlagUtils.isEnabled(context, FeatureFlags.SILKY_HOME);
- }
};
}
diff --git a/src/com/android/settings/applications/RecentAppsPreferenceController.java b/src/com/android/settings/applications/RecentAppsPreferenceController.java
deleted file mode 100644
index 20f9806..0000000
--- a/src/com/android/settings/applications/RecentAppsPreferenceController.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.settings.applications;
-
-import android.app.Application;
-import android.app.usage.UsageStats;
-import android.content.Context;
-import android.icu.text.RelativeDateTimeFormatter;
-import android.os.UserHandle;
-import android.view.View;
-
-import androidx.annotation.NonNull;
-import androidx.annotation.VisibleForTesting;
-import androidx.fragment.app.Fragment;
-import androidx.preference.Preference;
-import androidx.preference.PreferenceScreen;
-
-import com.android.settings.R;
-import com.android.settings.applications.appinfo.AppInfoDashboardFragment;
-import com.android.settings.applications.manageapplications.ManageApplications;
-import com.android.settings.core.BasePreferenceController;
-import com.android.settings.core.SubSettingLauncher;
-import com.android.settings.overlay.FeatureFactory;
-import com.android.settingslib.Utils;
-import com.android.settingslib.applications.ApplicationsState;
-import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
-import com.android.settingslib.utils.StringUtil;
-import com.android.settingslib.widget.AppEntitiesHeaderController;
-import com.android.settingslib.widget.AppEntityInfo;
-import com.android.settingslib.widget.LayoutPreference;
-
-import java.util.List;
-
-/**
- * This controller displays up to three recently used apps.
- * If there is no recently used app, we only show up an "App Info" preference.
- */
-public class RecentAppsPreferenceController extends BasePreferenceController
- implements RecentAppStatsMixin.RecentAppStatsListener {
-
- @VisibleForTesting
- static final String KEY_DIVIDER = "recent_apps_divider";
-
- @VisibleForTesting
- AppEntitiesHeaderController mAppEntitiesController;
- @VisibleForTesting
- LayoutPreference mRecentAppsPreference;
- @VisibleForTesting
- Preference mDivider;
-
- private final ApplicationsState mApplicationsState;
- private final int mUserId;
- private final MetricsFeatureProvider mMetricsFeatureProvider;
-
- private Fragment mHost;
- private List<UsageStats> mRecentApps;
-
- public RecentAppsPreferenceController(Context context, String key) {
- super(context, key);
- mApplicationsState = ApplicationsState.getInstance(
- (Application) mContext.getApplicationContext());
- mUserId = UserHandle.myUserId();
- mMetricsFeatureProvider = FeatureFactory.getFactory(mContext).getMetricsFeatureProvider();
- }
-
- public void setFragment(Fragment fragment) {
- mHost = fragment;
- }
-
- @Override
- public int getAvailabilityStatus() {
- return AVAILABLE_UNSEARCHABLE;
- }
-
- @Override
- public void displayPreference(PreferenceScreen screen) {
- super.displayPreference(screen);
-
- mDivider = screen.findPreference(KEY_DIVIDER);
- mRecentAppsPreference = screen.findPreference(getPreferenceKey());
- final View view = mRecentAppsPreference.findViewById(R.id.app_entities_header);
- mAppEntitiesController = AppEntitiesHeaderController.newInstance(mContext, view)
- .setHeaderTitleRes(R.string.recent_app_category_title)
- .setHeaderDetailsClickListener((View v) -> {
- mMetricsFeatureProvider.logClickedPreference(mRecentAppsPreference,
- getMetricsCategory());
- new SubSettingLauncher(mContext)
- .setDestination(ManageApplications.class.getName())
- .setArguments(null /* arguments */)
- .setTitleRes(R.string.application_info_label)
- .setSourceMetricsCategory(getMetricsCategory())
- .launch();
- });
- }
-
- @Override
- public void onReloadDataCompleted(@NonNull List<UsageStats> recentApps) {
- mRecentApps = recentApps;
- refreshUi();
- // Show total number of installed apps as See all's summary.
- new InstalledAppCounter(mContext, InstalledAppCounter.IGNORE_INSTALL_REASON,
- mContext.getPackageManager()) {
- @Override
- protected void onCountComplete(int num) {
- mAppEntitiesController.setHeaderDetails(
- mContext.getResources().getQuantityString(R.plurals.see_all_apps_title,
- num, num));
- mAppEntitiesController.apply();
- }
- }.execute();
- }
-
- private void refreshUi() {
- if (!mRecentApps.isEmpty()) {
- displayRecentApps();
- mRecentAppsPreference.setVisible(true);
- mDivider.setVisible(true);
- } else {
- mDivider.setVisible(false);
- mRecentAppsPreference.setVisible(false);
- }
- }
-
- private void displayRecentApps() {
- int showAppsCount = 0;
-
- for (UsageStats stat : mRecentApps) {
- final AppEntityInfo appEntityInfoInfo = createAppEntity(stat);
- if (appEntityInfoInfo != null) {
- mAppEntitiesController.setAppEntity(showAppsCount++, appEntityInfoInfo);
- }
-
- if (showAppsCount == AppEntitiesHeaderController.MAXIMUM_APPS) {
- break;
- }
- }
- }
-
- private AppEntityInfo createAppEntity(UsageStats stat) {
- final String pkgName = stat.getPackageName();
- final ApplicationsState.AppEntry appEntry =
- mApplicationsState.getEntry(pkgName, mUserId);
- if (appEntry == null) {
- return null;
- }
-
- return new AppEntityInfo.Builder()
- .setIcon(Utils.getBadgedIcon(mContext, appEntry.info))
- .setTitle(appEntry.label)
- .setSummary(StringUtil.formatRelativeTime(mContext,
- System.currentTimeMillis() - stat.getLastTimeUsed(), false,
- RelativeDateTimeFormatter.Style.SHORT))
- .setOnClickListener(v -> {
- mMetricsFeatureProvider.logClickedPreference(mRecentAppsPreference,
- getMetricsCategory());
- AppInfoBase.startAppInfoFragment(AppInfoDashboardFragment.class,
- R.string.application_info_label, pkgName, appEntry.info.uid,
- mHost, 1001 /*RequestCode*/, getMetricsCategory());
- })
- .build();
- }
-}
diff --git a/src/com/android/settings/applications/appinfo/AppBatteryPreferenceController.java b/src/com/android/settings/applications/appinfo/AppBatteryPreferenceController.java
index 6d515a3..79cae92 100644
--- a/src/com/android/settings/applications/appinfo/AppBatteryPreferenceController.java
+++ b/src/com/android/settings/applications/appinfo/AppBatteryPreferenceController.java
@@ -18,6 +18,7 @@
import android.content.Context;
import android.content.pm.PackageInfo;
+import android.os.AsyncTask;
import android.os.BatteryUsageStats;
import android.os.Bundle;
import android.os.UidBatteryConsumer;
@@ -34,6 +35,8 @@
import com.android.settings.Utils;
import com.android.settings.core.BasePreferenceController;
import com.android.settings.fuelgauge.AdvancedPowerUsageDetail;
+import com.android.settings.fuelgauge.BatteryChartPreferenceController;
+import com.android.settings.fuelgauge.BatteryDiffEntry;
import com.android.settings.fuelgauge.BatteryEntry;
import com.android.settings.fuelgauge.BatteryUsageStatsLoader;
import com.android.settings.fuelgauge.BatteryUtils;
@@ -63,13 +66,18 @@
private final AppInfoDashboardFragment mParent;
private String mBatteryPercent;
private final String mPackageName;
+ private final int mUid;
+ private BatteryDiffEntry mBatteryDiffEntry;
+ private boolean mBatteryUsageStatsLoaded = false;
+ private boolean mBatteryDiffEntriesLoaded = false;
public AppBatteryPreferenceController(Context context, AppInfoDashboardFragment parent,
- String packageName, Lifecycle lifecycle) {
+ String packageName, int uid, Lifecycle lifecycle) {
super(context, KEY_BATTERY);
mParent = parent;
mBatteryUtils = BatteryUtils.getInstance(mContext);
mPackageName = packageName;
+ mUid = uid;
if (lifecycle != null) {
lifecycle.addObserver(this);
}
@@ -87,6 +95,7 @@
super.displayPreference(screen);
mPreference = screen.findPreference(getPreferenceKey());
mPreference.setEnabled(false);
+ loadBatteryDiffEntries();
}
@Override
@@ -94,6 +103,17 @@
if (!KEY_BATTERY.equals(preference.getKey())) {
return false;
}
+ if (mBatteryDiffEntry != null) {
+ AdvancedPowerUsageDetail.startBatteryDetailPage(
+ mParent.getActivity(),
+ mParent,
+ mBatteryDiffEntry,
+ mBatteryPercent,
+ /*isValidToShowSummary=*/ true,
+ /*slotInformation=*/ null);
+ return true;
+ }
+
if (isBatteryStatsAvailable()) {
final UserManager userManager =
(UserManager) mContext.getSystemService(Context.USER_SERVICE);
@@ -121,6 +141,31 @@
AppInfoDashboardFragment.LOADER_BATTERY_USAGE_STATS);
}
+ private void loadBatteryDiffEntries() {
+ new AsyncTask<Void, Void, BatteryDiffEntry>() {
+ @Override
+ protected BatteryDiffEntry doInBackground(Void... unused) {
+ final List<BatteryDiffEntry> batteryDiffEntries =
+ BatteryChartPreferenceController.getBatteryLast24HrUsageData(mContext);
+ if (batteryDiffEntries != null) {
+ for (BatteryDiffEntry batteryDiffEntry : batteryDiffEntries) {
+ if (batteryDiffEntry.mBatteryHistEntry.mUid == mUid) {
+ return batteryDiffEntry;
+ }
+ }
+ }
+ return null;
+ }
+
+ @Override
+ protected void onPostExecute(BatteryDiffEntry batteryDiffEntry) {
+ mBatteryDiffEntry = batteryDiffEntry;
+ mBatteryDiffEntriesLoaded = true;
+ mPreference.setEnabled(mBatteryUsageStatsLoaded);
+ }
+ }.execute();
+ }
+
private void onLoadFinished() {
if (mBatteryUsageStats == null) {
return;
@@ -138,7 +183,8 @@
@VisibleForTesting
void updateBattery() {
- mPreference.setEnabled(true);
+ mBatteryUsageStatsLoaded = true;
+ mPreference.setEnabled(mBatteryDiffEntriesLoaded);
if (isBatteryStatsAvailable()) {
final int percentOfMax = (int) mBatteryUtils.calculateBatteryPercent(
mUidBatteryConsumer.getConsumedPower(), mBatteryUsageStats.getConsumedPower(),
diff --git a/src/com/android/settings/applications/appinfo/AppInfoDashboardFragment.java b/src/com/android/settings/applications/appinfo/AppInfoDashboardFragment.java
index 6a5c5df..cb0ed07 100755
--- a/src/com/android/settings/applications/appinfo/AppInfoDashboardFragment.java
+++ b/src/com/android/settings/applications/appinfo/AppInfoDashboardFragment.java
@@ -35,7 +35,6 @@
import android.os.UserHandle;
import android.os.UserManager;
import android.text.TextUtils;
-import android.util.FeatureFlagUtils;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
@@ -49,7 +48,6 @@
import com.android.settings.applications.manageapplications.ManageApplications;
import com.android.settings.applications.specialaccess.interactacrossprofiles.InteractAcrossProfilesDetailsPreferenceController;
import com.android.settings.applications.specialaccess.pictureinpicture.PictureInPictureDetailPreferenceController;
-import com.android.settings.core.FeatureFlags;
import com.android.settings.core.SubSettingLauncher;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settingslib.RestrictedLockUtilsInternal;
@@ -111,6 +109,7 @@
private PackageInfo mPackageInfo;
private int mUserId;
private String mPackageName;
+ private int mUid;
private DevicePolicyManager mDpm;
private UserManager mUserManager;
@@ -166,9 +165,7 @@
use(AppStoragePreferenceController.class).setParentFragment(this);
use(AppVersionPreferenceController.class).setParentFragment(this);
use(InstantAppDomainsPreferenceController.class).setParentFragment(this);
- if (FeatureFlagUtils.isEnabled(context, FeatureFlags.SILKY_HOME)) {
- use(ExtraAppInfoPreferenceController.class).setPackageName(packageName);
- }
+ use(ExtraAppInfoPreferenceController.class).setPackageName(packageName);
final HibernationSwitchPreferenceController appHibernationSettings =
use(HibernationSwitchPreferenceController.class);
@@ -258,9 +255,6 @@
@Override
protected int getPreferenceScreenResId() {
- if (FeatureFlagUtils.isEnabled(getContext(), FeatureFlags.SILKY_HOME)) {
- return R.xml.app_info_settings_v2;
- }
return R.xml.app_info_settings;
}
@@ -297,7 +291,8 @@
(SettingsActivity) getActivity(), this, lifecycle, packageName, mState,
REQUEST_UNINSTALL, REQUEST_REMOVE_DEVICE_ADMIN);
controllers.add(mAppButtonsPreferenceController);
- controllers.add(new AppBatteryPreferenceController(context, this, packageName, lifecycle));
+ controllers.add(new AppBatteryPreferenceController(
+ context, this, packageName, getUid(), lifecycle));
controllers.add(new AppMemoryPreferenceController(context, this, lifecycle));
controllers.add(new DefaultHomeShortcutPreferenceController(context, packageName));
controllers.add(new DefaultBrowserShortcutPreferenceController(context, packageName));
@@ -568,7 +563,7 @@
final Bundle args = getArguments();
mPackageName = (args != null) ? args.getString(ARG_PACKAGE_NAME) : null;
if (mPackageName == null) {
- final Intent intent = (args == null) ?
+ final Intent intent = args == null ?
getActivity().getIntent() : (Intent) args.getParcelable("intent");
if (intent != null) {
mPackageName = intent.getData().getSchemeSpecificPart();
@@ -577,6 +572,22 @@
return mPackageName;
}
+ private int getUid() {
+ if (mUid > 0) {
+ return mUid;
+ }
+ final Bundle args = getArguments();
+ mUid = (args != null) ? args.getInt(ARG_PACKAGE_UID) : -1;
+ if (mUid <= 0) {
+ final Intent intent = args == null
+ ? getActivity().getIntent() : (Intent) args.getParcelable("intent");
+ if (intent != null && intent.getExtras() != null) {
+ mUid = intent.getIntExtra("uId", -1);
+ }
+ }
+ return mUid;
+ }
+
@VisibleForTesting
void retrieveAppEntry() {
final Activity activity = getActivity();
diff --git a/src/com/android/settings/core/SettingsBaseActivity.java b/src/com/android/settings/core/SettingsBaseActivity.java
index c2d3ad3..8caae71 100644
--- a/src/com/android/settings/core/SettingsBaseActivity.java
+++ b/src/com/android/settings/core/SettingsBaseActivity.java
@@ -178,6 +178,10 @@
} else if (transitionType == TransitionType.TRANSITION_NONE) {
super.startActivity(intent, null);
return;
+ } else if (transitionType == TransitionType.TRANSITION_FADE) {
+ super.startActivity(intent, null);
+ overridePendingTransition(android.R.anim.fade_in, R.anim.sud_stay);
+ return;
}
super.startActivity(intent, createActivityOptionsBundleForTransition(null));
}
@@ -267,6 +271,10 @@
@Override
protected void onPause() {
+ // For accessibility activities launched from setup wizard.
+ if (getTransitionType(getIntent()) == TransitionType.TRANSITION_FADE) {
+ overridePendingTransition(R.anim.sud_stay, android.R.anim.fade_out);
+ }
unregisterReceiver(mPackageReceiver);
super.onPause();
}
diff --git a/src/com/android/settings/core/gateway/SettingsGateway.java b/src/com/android/settings/core/gateway/SettingsGateway.java
index faa320c..3719a5c 100644
--- a/src/com/android/settings/core/gateway/SettingsGateway.java
+++ b/src/com/android/settings/core/gateway/SettingsGateway.java
@@ -35,7 +35,6 @@
import com.android.settings.accounts.AccountSyncSettings;
import com.android.settings.accounts.ChooseAccountFragment;
import com.android.settings.accounts.ManagedProfileSettings;
-import com.android.settings.applications.AppAndNotificationDashboardFragment;
import com.android.settings.applications.AppDashboardFragment;
import com.android.settings.applications.ProcessStatsSummary;
import com.android.settings.applications.ProcessStatsUi;
@@ -293,7 +292,6 @@
NetworkDashboardFragment.class.getName(),
ConnectedDeviceDashboardFragment.class.getName(),
UsbDetailsFragment.class.getName(),
- AppAndNotificationDashboardFragment.class.getName(),
AppDashboardFragment.class.getName(),
WifiCallingDisclaimerFragment.class.getName(),
AccountDashboardFragment.class.getName(),
diff --git a/src/com/android/settings/dashboard/DashboardFragmentRegistry.java b/src/com/android/settings/dashboard/DashboardFragmentRegistry.java
index 2e326b0..89b21c9 100644
--- a/src/com/android/settings/dashboard/DashboardFragmentRegistry.java
+++ b/src/com/android/settings/dashboard/DashboardFragmentRegistry.java
@@ -22,7 +22,7 @@
import com.android.settings.LegalSettings;
import com.android.settings.accounts.AccountDashboardFragment;
import com.android.settings.accounts.AccountDetailDashboardFragment;
-import com.android.settings.applications.AppAndNotificationDashboardFragment;
+import com.android.settings.applications.AppDashboardFragment;
import com.android.settings.connecteddevice.AdvancedConnectedDeviceDashboardFragment;
import com.android.settings.connecteddevice.ConnectedDeviceDashboardFragment;
import com.android.settings.development.DevelopmentSettingsDashboardFragment;
@@ -76,7 +76,7 @@
CategoryKey.CATEGORY_CONNECT);
PARENT_TO_CATEGORY_KEY_MAP.put(AdvancedConnectedDeviceDashboardFragment.class.getName(),
CategoryKey.CATEGORY_DEVICE);
- PARENT_TO_CATEGORY_KEY_MAP.put(AppAndNotificationDashboardFragment.class.getName(),
+ PARENT_TO_CATEGORY_KEY_MAP.put(AppDashboardFragment.class.getName(),
CategoryKey.CATEGORY_APPS);
PARENT_TO_CATEGORY_KEY_MAP.put(PowerUsageSummary.class.getName(),
CategoryKey.CATEGORY_BATTERY);
diff --git a/src/com/android/settings/deviceinfo/StorageCategoryFragment.java b/src/com/android/settings/deviceinfo/StorageCategoryFragment.java
index ba59498..ce8f219 100644
--- a/src/com/android/settings/deviceinfo/StorageCategoryFragment.java
+++ b/src/com/android/settings/deviceinfo/StorageCategoryFragment.java
@@ -70,7 +70,7 @@
*/
public class StorageCategoryFragment extends DashboardFragment
implements
- LoaderManager.LoaderCallbacks<SparseArray<StorageAsyncLoader.AppsStorageResult>>,
+ LoaderManager.LoaderCallbacks<SparseArray<StorageAsyncLoader.StorageResult>>,
Preference.OnPreferenceClickListener {
private static final String TAG = "StorageCategoryFrag";
private static final String SUMMARY_PREF_KEY = "storage_summary";
@@ -83,7 +83,7 @@
private UserManager mUserManager;
private StorageEntry mSelectedStorageEntry;
private PrivateStorageInfo mStorageInfo;
- private SparseArray<StorageAsyncLoader.AppsStorageResult> mAppsResult;
+ private SparseArray<StorageAsyncLoader.StorageResult> mAppsResult;
private CachedStorageValuesHelper mCachedStorageValuesHelper;
private StorageItemPreferenceController mPreferenceController;
@@ -232,7 +232,7 @@
* Updates the secondary user controller sizes.
*/
private void updateSecondaryUserControllers(List<AbstractPreferenceController> controllers,
- SparseArray<StorageAsyncLoader.AppsStorageResult> stats) {
+ SparseArray<StorageAsyncLoader.StorageResult> stats) {
for (int i = 0, size = controllers.size(); i < size; i++) {
final AbstractPreferenceController controller = controllers.get(i);
if (controller instanceof StorageAsyncLoader.ResultHandler) {
@@ -244,7 +244,7 @@
}
@Override
- public Loader<SparseArray<StorageAsyncLoader.AppsStorageResult>> onCreateLoader(int id,
+ public Loader<SparseArray<StorageAsyncLoader.StorageResult>> onCreateLoader(int id,
Bundle args) {
final Context context = getContext();
return new StorageAsyncLoader(context, mUserManager,
@@ -254,15 +254,15 @@
}
@Override
- public void onLoadFinished(Loader<SparseArray<StorageAsyncLoader.AppsStorageResult>> loader,
- SparseArray<StorageAsyncLoader.AppsStorageResult> data) {
+ public void onLoadFinished(Loader<SparseArray<StorageAsyncLoader.StorageResult>> loader,
+ SparseArray<StorageAsyncLoader.StorageResult> data) {
mAppsResult = data;
maybeCacheFreshValues();
onReceivedSizes();
}
@Override
- public void onLoaderReset(Loader<SparseArray<StorageAsyncLoader.AppsStorageResult>> loader) {
+ public void onLoaderReset(Loader<SparseArray<StorageAsyncLoader.StorageResult>> loader) {
}
@Override
@@ -296,20 +296,20 @@
}
@VisibleForTesting
- public SparseArray<StorageAsyncLoader.AppsStorageResult> getAppsStorageResult() {
+ public SparseArray<StorageAsyncLoader.StorageResult> getStorageResult() {
return mAppsResult;
}
@VisibleForTesting
- public void setAppsStorageResult(SparseArray<StorageAsyncLoader.AppsStorageResult> info) {
+ public void setStorageResult(SparseArray<StorageAsyncLoader.StorageResult> info) {
mAppsResult = info;
}
@VisibleForTesting
void initializeCachedValues() {
final PrivateStorageInfo info = mCachedStorageValuesHelper.getCachedPrivateStorageInfo();
- final SparseArray<StorageAsyncLoader.AppsStorageResult> loaderResult =
- mCachedStorageValuesHelper.getCachedAppsStorageResult();
+ final SparseArray<StorageAsyncLoader.StorageResult> loaderResult =
+ mCachedStorageValuesHelper.getCachedStorageResult();
if (info == null || loaderResult == null) {
return;
}
diff --git a/src/com/android/settings/deviceinfo/StorageDashboardFragment.java b/src/com/android/settings/deviceinfo/StorageDashboardFragment.java
index cc7eff6..1145d7f 100644
--- a/src/com/android/settings/deviceinfo/StorageDashboardFragment.java
+++ b/src/com/android/settings/deviceinfo/StorageDashboardFragment.java
@@ -85,7 +85,7 @@
@SearchIndexable
public class StorageDashboardFragment extends DashboardFragment
implements
- LoaderManager.LoaderCallbacks<SparseArray<StorageAsyncLoader.AppsStorageResult>>,
+ LoaderManager.LoaderCallbacks<SparseArray<StorageAsyncLoader.StorageResult>>,
Preference.OnPreferenceClickListener {
private static final String TAG = "StorageDashboardFrag";
private static final String SUMMARY_PREF_KEY = "storage_summary";
@@ -100,7 +100,7 @@
private final List<StorageEntry> mStorageEntries = new ArrayList<>();
private StorageEntry mSelectedStorageEntry;
private PrivateStorageInfo mStorageInfo;
- private SparseArray<StorageAsyncLoader.AppsStorageResult> mAppsResult;
+ private SparseArray<StorageAsyncLoader.StorageResult> mAppsResult;
private CachedStorageValuesHelper mCachedStorageValuesHelper;
private StorageItemPreferenceController mPreferenceController;
@@ -414,7 +414,7 @@
* Updates the secondary user controller sizes.
*/
private void updateSecondaryUserControllers(List<AbstractPreferenceController> controllers,
- SparseArray<StorageAsyncLoader.AppsStorageResult> stats) {
+ SparseArray<StorageAsyncLoader.StorageResult> stats) {
for (int i = 0, size = controllers.size(); i < size; i++) {
final AbstractPreferenceController controller = controllers.get(i);
if (controller instanceof StorageAsyncLoader.ResultHandler) {
@@ -455,7 +455,7 @@
};
@Override
- public Loader<SparseArray<StorageAsyncLoader.AppsStorageResult>> onCreateLoader(int id,
+ public Loader<SparseArray<StorageAsyncLoader.StorageResult>> onCreateLoader(int id,
Bundle args) {
final Context context = getContext();
return new StorageAsyncLoader(context, mUserManager,
@@ -465,15 +465,15 @@
}
@Override
- public void onLoadFinished(Loader<SparseArray<StorageAsyncLoader.AppsStorageResult>> loader,
- SparseArray<StorageAsyncLoader.AppsStorageResult> data) {
+ public void onLoadFinished(Loader<SparseArray<StorageAsyncLoader.StorageResult>> loader,
+ SparseArray<StorageAsyncLoader.StorageResult> data) {
mAppsResult = data;
maybeCacheFreshValues();
onReceivedSizes();
}
@Override
- public void onLoaderReset(Loader<SparseArray<StorageAsyncLoader.AppsStorageResult>> loader) {
+ public void onLoaderReset(Loader<SparseArray<StorageAsyncLoader.StorageResult>> loader) {
}
@Override
@@ -507,20 +507,20 @@
}
@VisibleForTesting
- public SparseArray<StorageAsyncLoader.AppsStorageResult> getAppsStorageResult() {
+ public SparseArray<StorageAsyncLoader.StorageResult> getStorageResult() {
return mAppsResult;
}
@VisibleForTesting
- public void setAppsStorageResult(SparseArray<StorageAsyncLoader.AppsStorageResult> info) {
+ public void setStorageResult(SparseArray<StorageAsyncLoader.StorageResult> info) {
mAppsResult = info;
}
@VisibleForTesting
void initializeCachedValues() {
final PrivateStorageInfo info = mCachedStorageValuesHelper.getCachedPrivateStorageInfo();
- final SparseArray<StorageAsyncLoader.AppsStorageResult> loaderResult =
- mCachedStorageValuesHelper.getCachedAppsStorageResult();
+ final SparseArray<StorageAsyncLoader.StorageResult> loaderResult =
+ mCachedStorageValuesHelper.getCachedStorageResult();
if (info == null || loaderResult == null) {
return;
}
diff --git a/src/com/android/settings/deviceinfo/StorageItemPreference.java b/src/com/android/settings/deviceinfo/StorageItemPreference.java
index 65ef6f4..8410e42 100644
--- a/src/com/android/settings/deviceinfo/StorageItemPreference.java
+++ b/src/com/android/settings/deviceinfo/StorageItemPreference.java
@@ -17,7 +17,8 @@
package com.android.settings.deviceinfo;
import android.content.Context;
-import android.content.res.Resources;
+import android.text.TextUtils;
+import android.text.format.Formatter;
import android.util.AttributeSet;
import android.widget.ProgressBar;
@@ -25,7 +26,6 @@
import androidx.preference.PreferenceViewHolder;
import com.android.settings.R;
-import com.android.settings.utils.FileSizeFormatter;
public class StorageItemPreference extends Preference {
public int userHandle;
@@ -49,12 +49,8 @@
public void setStorageSize(long size, long total) {
mStorageSize = size;
- setSummary(
- FileSizeFormatter.formatFileSize(
- getContext(),
- size,
- getGigabyteSuffix(getContext().getResources()),
- FileSizeFormatter.GIGABYTE_IN_BYTES));
+ setSummary(getStorageSummary(size));
+
if (total == 0) {
mProgressPercent = 0;
} else {
@@ -82,7 +78,10 @@
super.onBindViewHolder(view);
}
- private static int getGigabyteSuffix(Resources res) {
- return res.getIdentifier("gigabyteShort", "string", "android");
+ private String getStorageSummary(long bytes) {
+ final Formatter.BytesResult result = Formatter.formatBytes(getContext().getResources(),
+ bytes, Formatter.FLAG_SHORTER);
+ return TextUtils.expandTemplate(getContext().getText(R.string.storage_size_large),
+ result.value, result.units).toString();
}
}
diff --git a/src/com/android/settings/deviceinfo/storage/CachedStorageValuesHelper.java b/src/com/android/settings/deviceinfo/storage/CachedStorageValuesHelper.java
index e6d9a72..4ca623d 100644
--- a/src/com/android/settings/deviceinfo/storage/CachedStorageValuesHelper.java
+++ b/src/com/android/settings/deviceinfo/storage/CachedStorageValuesHelper.java
@@ -35,9 +35,11 @@
public static final String FREE_BYTES_KEY = "free_bytes";
public static final String TOTAL_BYTES_KEY = "total_bytes";
public static final String GAME_APPS_SIZE_KEY = "game_apps_size";
- public static final String MUSIC_APPS_SIZE_KEY = "music_apps_size";
- public static final String VIDEO_APPS_SIZE_KEY = "video_apps_size";
- public static final String PHOTO_APPS_SIZE_KEY = "photo_apps_size";
+ public static final String AUDIO_SIZE_KEY = "audio_size";
+ public static final String VIDEOS_SIZE_KEY = "videos_size";
+ public static final String IMAGES_SIZE_KEY = "images_size";
+ public static final String DOCUMENTS_AND_OTHER_SIZE_KEY = "documents_and_other_size";
+ public static final String TRASH_SIZE_KEY = "trash_size";
public static final String OTHER_APPS_SIZE_KEY = "other_apps_size";
public static final String CACHE_APPS_SIZE_KEY = "cache_apps_size";
public static final String EXTERNAL_TOTAL_BYTES = "external_total_bytes";
@@ -78,21 +80,27 @@
return new PrivateStorageInfo(freeBytes, totalBytes);
}
- public SparseArray<StorageAsyncLoader.AppsStorageResult> getCachedAppsStorageResult() {
+ /** Returns cached storage result or null if it's not available. */
+ public SparseArray<StorageAsyncLoader.StorageResult> getCachedStorageResult() {
if (!isDataValid()) {
return null;
}
final long gamesSize = mSharedPreferences.getLong(GAME_APPS_SIZE_KEY, -1);
- final long musicAppsSize = mSharedPreferences.getLong(MUSIC_APPS_SIZE_KEY, -1);
- final long videoAppsSize = mSharedPreferences.getLong(VIDEO_APPS_SIZE_KEY, -1);
- final long photoAppSize = mSharedPreferences.getLong(PHOTO_APPS_SIZE_KEY, -1);
- final long otherAppsSize = mSharedPreferences.getLong(OTHER_APPS_SIZE_KEY, -1);
+ final long audioSize = mSharedPreferences.getLong(AUDIO_SIZE_KEY, -1);
+ final long videosSize = mSharedPreferences.getLong(VIDEOS_SIZE_KEY, -1);
+ final long imagesSize = mSharedPreferences.getLong(IMAGES_SIZE_KEY, -1);
+ final long documentsAndOtherSize =
+ mSharedPreferences.getLong(DOCUMENTS_AND_OTHER_SIZE_KEY, -1);
+ final long trashSize = mSharedPreferences.getLong(TRASH_SIZE_KEY, -1);
+ final long allAppsExceptGamesSize = mSharedPreferences.getLong(OTHER_APPS_SIZE_KEY, -1);
final long cacheSize = mSharedPreferences.getLong(CACHE_APPS_SIZE_KEY, -1);
if (gamesSize < 0
- || musicAppsSize < 0
- || videoAppsSize < 0
- || photoAppSize < 0
- || otherAppsSize < 0
+ || audioSize < 0
+ || videosSize < 0
+ || imagesSize < 0
+ || documentsAndOtherSize < 0
+ || trashSize < 0
+ || allAppsExceptGamesSize < 0
|| cacheSize < 0) {
return null;
}
@@ -117,31 +125,34 @@
externalVideoBytes,
externalImageBytes,
externalAppBytes);
- final StorageAsyncLoader.AppsStorageResult result =
- new StorageAsyncLoader.AppsStorageResult();
+ final StorageAsyncLoader.StorageResult result = new StorageAsyncLoader.StorageResult();
result.gamesSize = gamesSize;
- result.musicAppsSize = musicAppsSize;
- result.videoAppsSize = videoAppsSize;
- result.photosAppsSize = photoAppSize;
- result.otherAppsSize = otherAppsSize;
+ result.audioSize = audioSize;
+ result.videosSize = videosSize;
+ result.imagesSize = imagesSize;
+ result.documentsAndOtherSize = documentsAndOtherSize;
+ result.trashSize = trashSize;
+ result.allAppsExceptGamesSize = allAppsExceptGamesSize;
result.cacheSize = cacheSize;
result.externalStats = externalStats;
- final SparseArray<StorageAsyncLoader.AppsStorageResult> resultArray = new SparseArray<>();
+ final SparseArray<StorageAsyncLoader.StorageResult> resultArray = new SparseArray<>();
resultArray.append(mUserId, result);
return resultArray;
}
public void cacheResult(
- PrivateStorageInfo storageInfo, StorageAsyncLoader.AppsStorageResult result) {
+ PrivateStorageInfo storageInfo, StorageAsyncLoader.StorageResult result) {
mSharedPreferences
.edit()
.putLong(FREE_BYTES_KEY, storageInfo.freeBytes)
.putLong(TOTAL_BYTES_KEY, storageInfo.totalBytes)
.putLong(GAME_APPS_SIZE_KEY, result.gamesSize)
- .putLong(MUSIC_APPS_SIZE_KEY, result.musicAppsSize)
- .putLong(VIDEO_APPS_SIZE_KEY, result.videoAppsSize)
- .putLong(PHOTO_APPS_SIZE_KEY, result.photosAppsSize)
- .putLong(OTHER_APPS_SIZE_KEY, result.otherAppsSize)
+ .putLong(AUDIO_SIZE_KEY, result.audioSize)
+ .putLong(VIDEOS_SIZE_KEY, result.videosSize)
+ .putLong(IMAGES_SIZE_KEY, result.imagesSize)
+ .putLong(DOCUMENTS_AND_OTHER_SIZE_KEY, result.documentsAndOtherSize)
+ .putLong(TRASH_SIZE_KEY, result.trashSize)
+ .putLong(OTHER_APPS_SIZE_KEY, result.allAppsExceptGamesSize)
.putLong(CACHE_APPS_SIZE_KEY, result.cacheSize)
.putLong(EXTERNAL_TOTAL_BYTES, result.externalStats.totalBytes)
.putLong(EXTERNAL_AUDIO_BYTES, result.externalStats.audioBytes)
diff --git a/src/com/android/settings/deviceinfo/storage/SecondaryUserController.java b/src/com/android/settings/deviceinfo/storage/SecondaryUserController.java
index 99b6752..6475029 100644
--- a/src/com/android/settings/deviceinfo/storage/SecondaryUserController.java
+++ b/src/com/android/settings/deviceinfo/storage/SecondaryUserController.java
@@ -168,9 +168,9 @@
mTotalSizeBytes = totalSizeBytes;
}
- public void handleResult(SparseArray<StorageAsyncLoader.AppsStorageResult> stats) {
- int userId = getUser().id;
- StorageAsyncLoader.AppsStorageResult result = stats.get(userId);
+ @Override
+ public void handleResult(SparseArray<StorageAsyncLoader.StorageResult> stats) {
+ final StorageAsyncLoader.StorageResult result = stats.get(getUser().id);
if (result != null) {
setSize(result.externalStats.totalBytes);
}
diff --git a/src/com/android/settings/deviceinfo/storage/StorageAsyncLoader.java b/src/com/android/settings/deviceinfo/storage/StorageAsyncLoader.java
index 3d8a822..0a67ef2 100644
--- a/src/com/android/settings/deviceinfo/storage/StorageAsyncLoader.java
+++ b/src/com/android/settings/deviceinfo/storage/StorageAsyncLoader.java
@@ -21,13 +21,20 @@
import static android.content.pm.ApplicationInfo.CATEGORY_IMAGE;
import static android.content.pm.ApplicationInfo.CATEGORY_VIDEO;
+import android.content.ContentResolver;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.UserInfo;
+import android.database.Cursor;
+import android.net.Uri;
+import android.os.Bundle;
import android.os.UserHandle;
import android.os.UserManager;
+import android.provider.MediaStore;
+import android.provider.MediaStore.Files.FileColumns;
+import android.provider.MediaStore.MediaColumns;
import android.util.ArraySet;
import android.util.Log;
import android.util.SparseArray;
@@ -37,7 +44,6 @@
import java.io.IOException;
import java.util.Collections;
-import java.util.Comparator;
import java.util.List;
/**
@@ -45,7 +51,7 @@
* users
*/
public class StorageAsyncLoader
- extends AsyncLoaderCompat<SparseArray<StorageAsyncLoader.AppsStorageResult>> {
+ extends AsyncLoaderCompat<SparseArray<StorageAsyncLoader.StorageResult>> {
private UserManager mUserManager;
private static final String TAG = "StorageAsyncLoader";
@@ -64,38 +70,81 @@
}
@Override
- public SparseArray<AppsStorageResult> loadInBackground() {
- return loadApps();
+ public SparseArray<StorageResult> loadInBackground() {
+ return getStorageResultsForUsers();
}
- private SparseArray<AppsStorageResult> loadApps() {
+ private SparseArray<StorageResult> getStorageResultsForUsers() {
mSeenPackages = new ArraySet<>();
- SparseArray<AppsStorageResult> result = new SparseArray<>();
- List<UserInfo> infos = mUserManager.getUsers();
+ final SparseArray<StorageResult> results = new SparseArray<>();
+ final List<UserInfo> infos = mUserManager.getUsers();
+
// Sort the users by user id ascending.
- Collections.sort(
- infos,
- new Comparator<UserInfo>() {
- @Override
- public int compare(UserInfo userInfo, UserInfo otherUser) {
- return Integer.compare(userInfo.id, otherUser.id);
- }
- });
- for (int i = 0, userCount = infos.size(); i < userCount; i++) {
- final UserInfo info = infos.get(i);
- result.put(info.id, getStorageResultForUser(info.id));
+ Collections.sort(infos,
+ (userInfo, otherUser) -> Integer.compare(userInfo.id, otherUser.id));
+
+ for (UserInfo info : infos) {
+ final StorageResult result = getAppsAndGamesSize(info.id);
+
+ result.imagesSize = getFilesSize(info.id, MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
+ null /* queryArgs */);
+ result.videosSize = getFilesSize(info.id, MediaStore.Video.Media.EXTERNAL_CONTENT_URI,
+ null /* queryArgs */);
+ result.audioSize = getFilesSize(info.id, MediaStore.Audio.Media.EXTERNAL_CONTENT_URI,
+ null /* queryArgs */);
+
+ final Bundle documentsAndOtherQueryArgs = new Bundle();
+ documentsAndOtherQueryArgs.putString(ContentResolver.QUERY_ARG_SQL_SELECTION,
+ FileColumns.MEDIA_TYPE + "!=" + FileColumns.MEDIA_TYPE_IMAGE
+ + " AND " + FileColumns.MEDIA_TYPE + "!=" + FileColumns.MEDIA_TYPE_VIDEO
+ + " AND " + FileColumns.MEDIA_TYPE + "!=" + FileColumns.MEDIA_TYPE_AUDIO
+ + " AND " + FileColumns.MIME_TYPE + " IS NOT NULL");
+ result.documentsAndOtherSize = getFilesSize(info.id,
+ MediaStore.Files.getContentUri(MediaStore.VOLUME_EXTERNAL),
+ documentsAndOtherQueryArgs);
+
+ final Bundle trashQueryArgs = new Bundle();
+ trashQueryArgs.putInt(MediaStore.QUERY_ARG_MATCH_TRASHED, MediaStore.MATCH_ONLY);
+ result.trashSize = getFilesSize(info.id,
+ MediaStore.Files.getContentUri(MediaStore.VOLUME_EXTERNAL), trashQueryArgs);
+
+ results.put(info.id, result);
}
- return result;
+ return results;
}
- private AppsStorageResult getStorageResultForUser(int userId) {
+ private long getFilesSize(int userId, Uri uri, Bundle queryArgs) {
+ final Context perUserContext;
+ try {
+ perUserContext = getContext().createPackageContextAsUser(
+ getContext().getApplicationContext().getPackageName(),
+ 0 /* flags= */,
+ UserHandle.of(userId));
+ } catch (NameNotFoundException e) {
+ Log.e(TAG, "Not able to get Context for user ID " + userId);
+ return 0;
+ }
+
+ try (Cursor cursor = perUserContext.getContentResolver().query(
+ uri,
+ new String[] {"sum(" + MediaColumns.SIZE + ")"},
+ queryArgs,
+ null /* cancellationSignal */)) {
+ if (cursor == null) {
+ return 0;
+ }
+ return cursor.moveToFirst() ? cursor.getInt(0) : 0;
+ }
+ }
+
+ private StorageResult getAppsAndGamesSize(int userId) {
Log.d(TAG, "Loading apps");
- List<ApplicationInfo> applicationInfos =
+ final List<ApplicationInfo> applicationInfos =
mPackageManager.getInstalledApplicationsAsUser(0, userId);
- AppsStorageResult result = new AppsStorageResult();
- UserHandle myUser = UserHandle.of(userId);
+ final StorageResult result = new StorageResult();
+ final UserHandle myUser = UserHandle.of(userId);
for (int i = 0, size = applicationInfos.size(); i < size; i++) {
- ApplicationInfo app = applicationInfos.get(i);
+ final ApplicationInfo app = applicationInfos.get(i);
StorageStatsSource.AppStorageStats stats;
try {
@@ -131,28 +180,9 @@
result.gamesSize += blamedSize;
break;
case CATEGORY_AUDIO:
- // TODO(b/170918505): Should revamp audio size calculation with the data
- // from media provider.
- result.musicAppsSize += blamedSize;
- result.musicAppsSize -= stats.getCodeBytes();
-
- result.otherAppsSize += blamedSize;
- break;
case CATEGORY_VIDEO:
- // TODO(b/170918505): Should revamp video size calculation with the data
- // from media provider.
- result.videoAppsSize += blamedSize;
- result.videoAppsSize -= stats.getCodeBytes();
-
- result.otherAppsSize += blamedSize;
- break;
case CATEGORY_IMAGE:
- // TODO(b/170918505): Should revamp image size calculation with the data
- // from media provider.
- result.photosAppsSize += blamedSize;
- result.photosAppsSize -= stats.getCodeBytes();
-
- result.otherAppsSize += blamedSize;
+ result.allAppsExceptGamesSize += blamedSize;
break;
default:
// The deprecated game flag does not set the category.
@@ -160,7 +190,7 @@
result.gamesSize += blamedSize;
break;
}
- result.otherAppsSize += blamedSize;
+ result.allAppsExceptGamesSize += blamedSize;
break;
}
}
@@ -177,15 +207,22 @@
}
@Override
- protected void onDiscardResult(SparseArray<AppsStorageResult> result) {
+ protected void onDiscardResult(SparseArray<StorageResult> result) {
}
- public static class AppsStorageResult {
+ /** Storage result for displaying file categories size in Storage Settings. */
+ public static class StorageResult {
+ // APP based sizes.
public long gamesSize;
- public long musicAppsSize;
- public long photosAppsSize;
- public long videoAppsSize;
- public long otherAppsSize;
+ public long allAppsExceptGamesSize;
+
+ // File based sizes.
+ public long audioSize;
+ public long imagesSize;
+ public long videosSize;
+ public long documentsAndOtherSize;
+ public long trashSize;
+
public long cacheSize;
public long duplicateCodeSize;
public StorageStatsSource.ExternalStorageStats externalStats;
@@ -196,6 +233,7 @@
* {@link StorageAsyncLoader}.
*/
public interface ResultHandler {
- void handleResult(SparseArray<AppsStorageResult> result);
+ /** Overrides this method to get storage result once it's available. */
+ void handleResult(SparseArray<StorageResult> result);
}
}
diff --git a/src/com/android/settings/deviceinfo/storage/StorageItemPreferenceController.java b/src/com/android/settings/deviceinfo/storage/StorageItemPreferenceController.java
index 241c852..67a5bb7 100644
--- a/src/com/android/settings/deviceinfo/storage/StorageItemPreferenceController.java
+++ b/src/com/android/settings/deviceinfo/storage/StorageItemPreferenceController.java
@@ -357,18 +357,18 @@
updatePrivateStorageCategoryPreferencesOrder();
}
- public void onLoadFinished(SparseArray<StorageAsyncLoader.AppsStorageResult> result,
+ /** Fragments use it to set storage result and update UI of this controller. */
+ public void onLoadFinished(SparseArray<StorageAsyncLoader.StorageResult> result,
int userId) {
- final StorageAsyncLoader.AppsStorageResult data = result.get(userId);
+ final StorageAsyncLoader.StorageResult data = result.get(userId);
- mImagesPreference.setStorageSize(getImagesSize(data), mTotalSize);
- mVideosPreference.setStorageSize(getVideosSize(data), mTotalSize);
- mAudioPreference.setStorageSize(getAudioSize(data), mTotalSize);
- mAppsPreference.setStorageSize(getAppsSize(data), mTotalSize);
- mGamesPreference.setStorageSize(getGamesSize(data), mTotalSize);
- mDocumentsAndOtherPreference.setStorageSize(getDocumentsAndOtherSize(data),
- mTotalSize);
- mTrashPreference.setStorageSize(getTrashSize(data), mTotalSize);
+ mImagesPreference.setStorageSize(data.imagesSize, mTotalSize);
+ mVideosPreference.setStorageSize(data.videosSize, mTotalSize);
+ mAudioPreference.setStorageSize(data.audioSize, mTotalSize);
+ mAppsPreference.setStorageSize(data.allAppsExceptGamesSize, mTotalSize);
+ mGamesPreference.setStorageSize(data.gamesSize, mTotalSize);
+ mDocumentsAndOtherPreference.setStorageSize(data.documentsAndOtherSize, mTotalSize);
+ mTrashPreference.setStorageSize(data.trashSize, mTotalSize);
if (mSystemPreference != null) {
// Everything else that hasn't already been attributed is tracked as
@@ -377,13 +377,15 @@
// from media provider.
long attributedSize = 0;
for (int i = 0; i < result.size(); i++) {
- final StorageAsyncLoader.AppsStorageResult otherData = result.valueAt(i);
+ final StorageAsyncLoader.StorageResult otherData = result.valueAt(i);
attributedSize +=
otherData.gamesSize
- + otherData.musicAppsSize
- + otherData.videoAppsSize
- + otherData.photosAppsSize
- + otherData.otherAppsSize;
+ + otherData.audioSize
+ + otherData.videosSize
+ + otherData.imagesSize
+ + otherData.documentsAndOtherSize
+ + otherData.trashSize
+ + otherData.allAppsExceptGamesSize;
attributedSize += otherData.externalStats.totalBytes
- otherData.externalStats.appBytes;
attributedSize -= otherData.duplicateCodeSize;
@@ -418,18 +420,6 @@
mContext.startActivityAsUser(intent, new UserHandle(mUserId));
}
- private long getImagesSize(StorageAsyncLoader.AppsStorageResult data) {
- return data.photosAppsSize + data.externalStats.imageBytes + data.externalStats.videoBytes;
- }
-
- private long getVideosSize(StorageAsyncLoader.AppsStorageResult data) {
- return data.videoAppsSize;
- }
-
- private long getAudioSize(StorageAsyncLoader.AppsStorageResult data) {
- return data.musicAppsSize + data.externalStats.audioBytes;
- }
-
private void launchAppsIntent() {
final Bundle args = getWorkAnnotatedBundle(3);
args.putString(ManageApplications.EXTRA_CLASSNAME,
@@ -446,10 +436,6 @@
Utils.launchIntent(mFragment, intent);
}
- private long getAppsSize(StorageAsyncLoader.AppsStorageResult data) {
- return data.otherAppsSize;
- }
-
private void launchGamesIntent() {
final Bundle args = getWorkAnnotatedBundle(1);
args.putString(ManageApplications.EXTRA_CLASSNAME,
@@ -464,10 +450,6 @@
Utils.launchIntent(mFragment, intent);
}
- private long getGamesSize(StorageAsyncLoader.AppsStorageResult data) {
- return data.gamesSize;
- }
-
private Bundle getWorkAnnotatedBundle(int additionalCapacity) {
final Bundle args = new Bundle(1 + additionalCapacity);
args.putInt(SettingsActivity.EXTRA_SHOW_FRAGMENT_TAB,
@@ -475,14 +457,6 @@
return args;
}
- private long getDocumentsAndOtherSize(StorageAsyncLoader.AppsStorageResult data) {
- return data.externalStats.totalBytes
- - data.externalStats.audioBytes
- - data.externalStats.videoBytes
- - data.externalStats.imageBytes
- - data.externalStats.appBytes;
- }
-
private void launchTrashIntent() {
final Intent intent = new Intent("android.settings.VIEW_TRASH");
@@ -493,11 +467,6 @@
}
}
- private long getTrashSize(StorageAsyncLoader.AppsStorageResult data) {
- // TODO(170918505): Implement it.
- return 0L;
- }
-
private static long totalValues(StorageMeasurement.MeasurementDetails details, int userId,
String... keys) {
long total = 0;
diff --git a/src/com/android/settings/enterprise/ActionDisabledLearnMoreButtonLauncherImpl.java b/src/com/android/settings/enterprise/ActionDisabledLearnMoreButtonLauncherImpl.java
index b4d97e4..98cad65 100644
--- a/src/com/android/settings/enterprise/ActionDisabledLearnMoreButtonLauncherImpl.java
+++ b/src/com/android/settings/enterprise/ActionDisabledLearnMoreButtonLauncherImpl.java
@@ -20,6 +20,7 @@
import android.app.Activity;
import android.app.admin.DevicePolicyManager;
+import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.UserHandle;
@@ -54,32 +55,33 @@
@Override
public void setupLearnMoreButtonToShowAdminPolicies(
- Activity activity,
- AlertDialog.Builder builder,
+ Context context,
+ Object alertDialogBuilder,
int enforcementAdminUserId,
EnforcedAdmin enforcedAdmin) {
- requireNonNull(activity);
- requireNonNull(builder);
+ requireNonNull(context);
+ requireNonNull(alertDialogBuilder);
requireNonNull(enforcedAdmin);
// The "Learn more" button appears only if the restriction is enforced by an admin in the
// same profile group. Otherwise the admin package and its policies are not accessible to
// the current user.
- final UserManager um = UserManager.get(activity);
+ final UserManager um = UserManager.get(context);
if (um.isSameProfileGroup(enforcementAdminUserId, um.getUserHandle())) {
- setupLearnMoreButton(builder, () ->
- SHOW_ADMIN_POLICIES.accept(activity, enforcedAdmin));
+ setupLearnMoreButton((AlertDialog.Builder) alertDialogBuilder, () ->
+ SHOW_ADMIN_POLICIES.accept((Activity) context, enforcedAdmin));
}
}
@Override
public void setupLearnMoreButtonToLaunchHelpPage(
- Activity activity,
- AlertDialog.Builder builder,
+ Context context,
+ Object alertDialogBuilder,
String url) {
- requireNonNull(activity);
- requireNonNull(builder);
+ requireNonNull(context);
+ requireNonNull(alertDialogBuilder);
requireNonNull(url);
- setupLearnMoreButton(builder, () -> LAUNCH_HELP_PAGE.accept(activity, url));
+ setupLearnMoreButton((AlertDialog.Builder) alertDialogBuilder,
+ () -> LAUNCH_HELP_PAGE.accept((Activity) context, url));
}
private void setupLearnMoreButton(AlertDialog.Builder builder, Runnable runnable) {
diff --git a/src/com/android/settings/fuelgauge/BatteryChartPreferenceController.java b/src/com/android/settings/fuelgauge/BatteryChartPreferenceController.java
index f93f0a3..dbbafe6 100644
--- a/src/com/android/settings/fuelgauge/BatteryChartPreferenceController.java
+++ b/src/com/android/settings/fuelgauge/BatteryChartPreferenceController.java
@@ -51,8 +51,8 @@
import com.android.settingslib.utils.StringUtil;
import com.android.settingslib.widget.FooterPreference;
-import java.util.Arrays;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
@@ -627,7 +627,7 @@
return true;
}
- static List<BatteryDiffEntry> getBatteryLast24HrUsageData(Context context) {
+ public static List<BatteryDiffEntry> getBatteryLast24HrUsageData(Context context) {
final long start = System.currentTimeMillis();
final Map<Long, Map<String, BatteryHistEntry>> batteryHistoryMap =
FeatureFactory.getFactory(context)
diff --git a/src/com/android/settings/fuelgauge/BatteryEntry.java b/src/com/android/settings/fuelgauge/BatteryEntry.java
index 25a66b6..636d265 100644
--- a/src/com/android/settings/fuelgauge/BatteryEntry.java
+++ b/src/com/android/settings/fuelgauge/BatteryEntry.java
@@ -241,7 +241,7 @@
mBatteryConsumer = null;
mIsHidden = false;
mPowerComponentId = powerComponentId;
- mConsumedPower = devicePowerMah - appsPowerMah;
+ mConsumedPower = devicePowerMah;
mUsageDurationMs = usageDurationMs;
mConsumerType = ConvertUtils.CONSUMER_TYPE_SYSTEM_BATTERY;
@@ -265,11 +265,10 @@
icon = context.getDrawable(iconId);
name = powerComponentName;
- mConsumedPower = devicePowerMah - appsPowerMah;
+ mConsumedPower = devicePowerMah;
mConsumerType = ConvertUtils.CONSUMER_TYPE_SYSTEM_BATTERY;
}
-
public Drawable getIcon() {
return icon;
}
diff --git a/src/com/android/settings/notification/ConfigureNotificationSettings.java b/src/com/android/settings/notification/ConfigureNotificationSettings.java
index e3d0249..a41fab6 100644
--- a/src/com/android/settings/notification/ConfigureNotificationSettings.java
+++ b/src/com/android/settings/notification/ConfigureNotificationSettings.java
@@ -96,10 +96,6 @@
private static List<AbstractPreferenceController> buildPreferenceControllers(Context context,
Application app, Fragment host) {
final List<AbstractPreferenceController> controllers = new ArrayList<>();
- controllers.add(new RecentNotifyingAppsPreferenceController(
- context, new NotificationBackend(), IUsageStatsManager.Stub.asInterface(
- ServiceManager.getService(Context.USAGE_STATS_SERVICE)),
- context.getSystemService(UserManager.class), app, host));
controllers.add(new ShowOnLockScreenNotificationPreferenceController(
context, KEY_LOCKSCREEN));
controllers.add(new NotificationRingtonePreferenceController(context) {
diff --git a/src/com/android/settings/notification/RecentNotifyingAppsPreferenceController.java b/src/com/android/settings/notification/RecentNotifyingAppsPreferenceController.java
deleted file mode 100644
index 8e0807d..0000000
--- a/src/com/android/settings/notification/RecentNotifyingAppsPreferenceController.java
+++ /dev/null
@@ -1,301 +0,0 @@
-/*
- * Copyright (C) 2018 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.settings.notification;
-
-import android.app.Application;
-import android.app.settings.SettingsEnums;
-import android.app.usage.IUsageStatsManager;
-import android.app.usage.UsageEvents;
-import android.content.Context;
-import android.content.pm.PackageManager;
-import android.os.Bundle;
-import android.os.RemoteException;
-import android.os.UserHandle;
-import android.os.UserManager;
-import android.service.notification.NotifyingApp;
-import android.text.TextUtils;
-import android.util.ArrayMap;
-import android.util.IconDrawableFactory;
-import android.util.Slog;
-
-import androidx.annotation.VisibleForTesting;
-import androidx.fragment.app.Fragment;
-import androidx.preference.Preference;
-import androidx.preference.PreferenceCategory;
-import androidx.preference.PreferenceScreen;
-
-import com.android.settings.R;
-import com.android.settings.Utils;
-import com.android.settings.applications.AppInfoBase;
-import com.android.settings.core.PreferenceControllerMixin;
-import com.android.settings.core.SubSettingLauncher;
-import com.android.settings.notification.app.AppNotificationSettings;
-import com.android.settings.widget.PrimarySwitchPreference;
-import com.android.settingslib.applications.ApplicationsState;
-import com.android.settingslib.core.AbstractPreferenceController;
-import com.android.settingslib.utils.StringUtil;
-import com.android.settingslib.utils.ThreadUtils;
-import com.android.settingslib.widget.TwoTargetPreference;
-
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * This controller displays a list of recently used apps and a "See all" button. If there is
- * no recently used app, "See all" will be displayed as "Notifications".
- */
-public class RecentNotifyingAppsPreferenceController extends AbstractPreferenceController
- implements PreferenceControllerMixin {
-
- private static final String TAG = "RecentNotisCtrl";
- private static final String KEY_PREF_CATEGORY = "recent_notifications_category";
-
- @VisibleForTesting
- static final String KEY_SEE_ALL = "all_notifications";
- static final String KEY_PLACEHOLDER = "app";
- private static final int SHOW_RECENT_APP_COUNT = 3;
- private static final int DAYS = 3;
-
- private final Fragment mHost;
- private final PackageManager mPm;
- private final NotificationBackend mNotificationBackend;
- private IUsageStatsManager mUsageStatsManager;
- private final IconDrawableFactory mIconDrawableFactory;
-
- private Calendar mCal;
- List<NotifyingApp> mApps;
- private final ApplicationsState mApplicationsState;
-
- private PreferenceCategory mCategory;
- private Preference mSeeAllPref;
- protected List<Integer> mUserIds;
-
- public RecentNotifyingAppsPreferenceController(Context context, NotificationBackend backend,
- IUsageStatsManager usageStatsManager, UserManager userManager,
- Application app, Fragment host) {
- this(context, backend, usageStatsManager, userManager,
- app == null ? null : ApplicationsState.getInstance(app), host);
- }
-
- @VisibleForTesting(otherwise = VisibleForTesting.PACKAGE_PRIVATE)
- RecentNotifyingAppsPreferenceController(Context context, NotificationBackend backend,
- IUsageStatsManager usageStatsManager, UserManager userManager,
- ApplicationsState appState, Fragment host) {
- super(context);
- mIconDrawableFactory = IconDrawableFactory.newInstance(context);
- mPm = context.getPackageManager();
- mHost = host;
- mApplicationsState = appState;
- mNotificationBackend = backend;
- mUsageStatsManager = usageStatsManager;
- mUserIds = new ArrayList<>();
- mUserIds.add(mContext.getUserId());
- int workUserId = Utils.getManagedProfileId(userManager, mContext.getUserId());
- if (workUserId != UserHandle.USER_NULL) {
- mUserIds.add(workUserId);
- }
- }
-
- @Override
- public boolean isAvailable() {
- return mApplicationsState != null;
- }
-
- @Override
- public String getPreferenceKey() {
- return KEY_PREF_CATEGORY;
- }
-
- @Override
- public void updateNonIndexableKeys(List<String> keys) {
- PreferenceControllerMixin.super.updateNonIndexableKeys(keys);
- // Don't index category name into search. It's not actionable.
- keys.add(KEY_PREF_CATEGORY);
- }
-
- @Override
- public void displayPreference(PreferenceScreen screen) {
- mCategory = screen.findPreference(getPreferenceKey());
- mSeeAllPref = screen.findPreference(KEY_SEE_ALL);
- super.displayPreference(screen);
- refreshUi(mCategory.getContext());
- }
-
- @Override
- public void updateState(Preference preference) {
- super.updateState(preference);
- refreshUi(mCategory.getContext());
- mSeeAllPref.setTitle(mContext.getString(R.string.recent_notifications_see_all_title));
- }
-
- @VisibleForTesting
- void refreshUi(Context prefContext) {
- for (int i = 1; i <= SHOW_RECENT_APP_COUNT; i++) {
- PrimarySwitchPreference app = mCategory.findPreference(KEY_PLACEHOLDER + i);
- if (app != null) {
- app.setChecked(true);
- }
- }
- ThreadUtils.postOnBackgroundThread(() -> {
- reloadData();
- final List<NotifyingApp> recentApps = getDisplayableRecentAppList();
- ThreadUtils.postOnMainThread(() -> {
- if (recentApps != null && !recentApps.isEmpty()) {
- displayRecentApps(prefContext, recentApps);
- } else {
- displayOnlyAllAppsLink();
- }
- });
- });
- }
-
- @VisibleForTesting
- void reloadData() {
- mApps = new ArrayList<>();
- mCal = Calendar.getInstance();
- mCal.add(Calendar.DAY_OF_YEAR, -DAYS);
- for (int userId : mUserIds) {
- UsageEvents events = null;
- try {
- events = mUsageStatsManager.queryEventsForUser(mCal.getTimeInMillis(),
- System.currentTimeMillis(), userId, mContext.getPackageName());
- } catch (RemoteException e) {
- e.printStackTrace();
- }
- if (events != null) {
- ArrayMap<String, NotifyingApp> aggregatedStats = new ArrayMap<>();
-
- UsageEvents.Event event = new UsageEvents.Event();
- while (events.hasNextEvent()) {
- events.getNextEvent(event);
-
- if (event.getEventType() == UsageEvents.Event.NOTIFICATION_INTERRUPTION) {
- NotifyingApp app =
- aggregatedStats.get(getKey(userId, event.getPackageName()));
- if (app == null) {
- app = new NotifyingApp();
- aggregatedStats.put(getKey(userId, event.getPackageName()), app);
- app.setPackage(event.getPackageName());
- app.setUserId(userId);
- }
- if (event.getTimeStamp() > app.getLastNotified()) {
- app.setLastNotified(event.getTimeStamp());
- }
- }
-
- }
-
- mApps.addAll(aggregatedStats.values());
- }
- }
- }
-
- private static String getKey(int userId, String pkg) {
- return userId + "|" + pkg;
- }
-
- private void displayOnlyAllAppsLink() {
- mCategory.setTitle(null);
- mSeeAllPref.setTitle(R.string.notifications_title);
- mSeeAllPref.setIcon(null);
- int prefCount = mCategory.getPreferenceCount();
- for (int i = prefCount - 1; i >= 0; i--) {
- final Preference pref = mCategory.getPreference(i);
- if (!TextUtils.equals(pref.getKey(), KEY_SEE_ALL)) {
- mCategory.removePreference(pref);
- }
- }
- }
-
- private void displayRecentApps(Context prefContext, List<NotifyingApp> recentApps) {
- mCategory.setTitle(R.string.recent_notifications);
- mSeeAllPref.setSummary(null);
- mSeeAllPref.setIcon(R.drawable.ic_chevron_right_24dp);
-
- int keyIndex = 1;
- final int recentAppsCount = recentApps.size();
- for (int i = 0; i < recentAppsCount; i++, keyIndex++) {
- final NotifyingApp app = recentApps.get(i);
- // Bind recent apps to existing prefs if possible, or create a new pref.
- final String pkgName = app.getPackage();
- final ApplicationsState.AppEntry appEntry =
- mApplicationsState.getEntry(app.getPackage(), app.getUserId());
- if (appEntry == null || appEntry.label == null) {
- continue;
- }
-
- PrimarySwitchPreference pref = mCategory.findPreference(KEY_PLACEHOLDER + keyIndex);
- pref.setTitle(appEntry.label);
- pref.setIcon(mIconDrawableFactory.getBadgedIcon(appEntry.info));
- pref.setIconSize(TwoTargetPreference.ICON_SIZE_SMALL);
- pref.setSummary(StringUtil.formatRelativeTime(mContext,
- System.currentTimeMillis() - app.getLastNotified(), true));
- Bundle args = new Bundle();
- args.putString(AppInfoBase.ARG_PACKAGE_NAME, pkgName);
- args.putInt(AppInfoBase.ARG_PACKAGE_UID, appEntry.info.uid);
- pref.setOnPreferenceClickListener(preference -> {
- new SubSettingLauncher(mHost.getActivity())
- .setDestination(AppNotificationSettings.class.getName())
- .setTitleRes(R.string.notifications_title)
- .setArguments(args)
- .setUserHandle(new UserHandle(UserHandle.getUserId(appEntry.info.uid)))
- .setSourceMetricsCategory(
- SettingsEnums.MANAGE_APPLICATIONS_NOTIFICATIONS)
- .launch();
- return true;
- });
- pref.setSwitchEnabled(mNotificationBackend.isBlockable(mContext, appEntry.info));
- pref.setOnPreferenceChangeListener((preference, newValue) -> {
- mNotificationBackend.setNotificationsEnabledForPackage(
- pkgName, appEntry.info.uid, (Boolean) newValue);
- return true;
- });
- pref.setChecked(
- !mNotificationBackend.getNotificationsBanned(pkgName, appEntry.info.uid));
-
- }
- // If there are less than SHOW_RECENT_APP_COUNT recent apps, remove placeholders
- for (int i = keyIndex; i <= SHOW_RECENT_APP_COUNT; i++) {
- mCategory.removePreferenceRecursively(KEY_PLACEHOLDER + i);
- }
- }
-
- private List<NotifyingApp> getDisplayableRecentAppList() {
- Collections.sort(mApps);
- List<NotifyingApp> displayableApps = new ArrayList<>(SHOW_RECENT_APP_COUNT);
- int count = 0;
- for (NotifyingApp app : mApps) {
- try {
- final ApplicationsState.AppEntry appEntry = mApplicationsState.getEntry(
- app.getPackage(), app.getUserId());
- if (appEntry == null) {
- continue;
- }
- displayableApps.add(app);
- count++;
- if (count >= SHOW_RECENT_APP_COUNT) {
- break;
- }
- } catch (Exception e) {
- Slog.e(TAG, "Failed to find app " + app.getPackage() + "/" + app.getUserId(), e);
- }
- }
- return displayableApps;
- }
-}
diff --git a/src/com/android/settings/notification/zen/ZenModeSettingsFooterPreferenceController.java b/src/com/android/settings/notification/zen/ZenModeSettingsFooterPreferenceController.java
index ca6eb42..6a57441 100644
--- a/src/com/android/settings/notification/zen/ZenModeSettingsFooterPreferenceController.java
+++ b/src/com/android/settings/notification/zen/ZenModeSettingsFooterPreferenceController.java
@@ -274,7 +274,7 @@
}
private int getAllowRes(boolean allow) {
- return allow ? R.string.zen_mode_sound_summary_on : R.string.zen_mode_sound_summary_off;
+ return allow ? R.string.zen_mode_sound_summary_on : R.string.switch_off_text;
}
@Override
diff --git a/src/com/android/settings/password/ChooseLockSettingsHelper.java b/src/com/android/settings/password/ChooseLockSettingsHelper.java
index 5ed43fa..77fcbed 100644
--- a/src/com/android/settings/password/ChooseLockSettingsHelper.java
+++ b/src/com/android/settings/password/ChooseLockSettingsHelper.java
@@ -34,7 +34,9 @@
import com.android.internal.widget.LockPatternUtils;
import com.android.settings.SetupWizardUtils;
import com.android.settings.Utils;
+import com.android.settings.core.SettingsBaseActivity;
import com.android.settings.core.SubSettingLauncher;
+import com.android.settingslib.transition.SettingsTransitionHelper;
import com.google.android.setupcompat.util.WizardManagerHelper;
@@ -359,6 +361,8 @@
requestGatekeeperPasswordHandle);
intent.setClassName(SETTINGS_PACKAGE_NAME, activityClass.getName());
+ intent.putExtra(SettingsBaseActivity.EXTRA_PAGE_TRANSITION_TYPE,
+ SettingsTransitionHelper.TransitionType.TRANSITION_SLIDE);
Intent inIntent = mFragment != null ? mFragment.getActivity().getIntent() :
mActivity.getIntent();
diff --git a/src/com/android/settings/search/CustomSiteMapRegistry.java b/src/com/android/settings/search/CustomSiteMapRegistry.java
index 8448846..ab33fa2 100644
--- a/src/com/android/settings/search/CustomSiteMapRegistry.java
+++ b/src/com/android/settings/search/CustomSiteMapRegistry.java
@@ -18,7 +18,6 @@
import android.util.ArrayMap;
-import com.android.settings.DisplaySettings;
import com.android.settings.backup.UserBackupSettingsActivity;
import com.android.settings.connecteddevice.ConnectedDeviceDashboardFragment;
import com.android.settings.connecteddevice.usb.UsbDetailsFragment;
@@ -34,7 +33,6 @@
import com.android.settings.security.SecuritySettings;
import com.android.settings.security.screenlock.ScreenLockSettings;
import com.android.settings.system.SystemDashboardFragment;
-import com.android.settings.wallpaper.WallpaperSuggestionActivity;
import com.android.settings.wifi.WifiSettings;
import java.util.Map;
@@ -53,8 +51,6 @@
CUSTOM_SITE_MAP = new ArrayMap<>();
CUSTOM_SITE_MAP.put(ScreenLockSettings.class.getName(), SecuritySettings.class.getName());
CUSTOM_SITE_MAP.put(
- WallpaperSuggestionActivity.class.getName(), DisplaySettings.class.getName());
- CUSTOM_SITE_MAP.put(
WifiSettings.class.getName(), NetworkDashboardFragment.class.getName());
CUSTOM_SITE_MAP.put(PowerUsageAdvanced.class.getName(), PowerUsageSummary.class.getName());
CUSTOM_SITE_MAP.put(RecentLocationAccessSeeAllFragment.class.getName(),
diff --git a/src/com/android/settings/security/ChangeScreenLockPreferenceController.java b/src/com/android/settings/security/ChangeScreenLockPreferenceController.java
index 7ea9879..5439fef 100644
--- a/src/com/android/settings/security/ChangeScreenLockPreferenceController.java
+++ b/src/com/android/settings/security/ChangeScreenLockPreferenceController.java
@@ -42,6 +42,7 @@
import com.android.settingslib.RestrictedPreference;
import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
+import com.android.settingslib.transition.SettingsTransitionHelper;
public class ChangeScreenLockPreferenceController extends AbstractPreferenceController implements
PreferenceControllerMixin, GearPreference.OnGearClickListener {
@@ -138,6 +139,7 @@
new SubSettingLauncher(mContext)
.setDestination(ChooseLockGeneric.ChooseLockGenericFragment.class.getName())
.setSourceMetricsCategory(mHost.getMetricsCategory())
+ .setTransitionType(SettingsTransitionHelper.TransitionType.TRANSITION_SLIDE)
.launch();
return true;
}
diff --git a/tests/robotests/src/com/android/settings/applications/AllAppsInfoPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/applications/AllAppsInfoPreferenceControllerTest.java
deleted file mode 100644
index 2944db2..0000000
--- a/tests/robotests/src/com/android/settings/applications/AllAppsInfoPreferenceControllerTest.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright (C) 2019 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.settings.applications;
-
-import static com.android.settings.core.BasePreferenceController.AVAILABLE;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import static org.mockito.ArgumentMatchers.anyInt;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.when;
-
-import android.app.usage.UsageStats;
-import android.content.Context;
-import android.os.UserManager;
-
-import androidx.preference.Preference;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.robolectric.RobolectricTestRunner;
-import org.robolectric.RuntimeEnvironment;
-
-import java.util.ArrayList;
-import java.util.List;
-
-@RunWith(RobolectricTestRunner.class)
-public class AllAppsInfoPreferenceControllerTest {
-
- @Mock
- private UserManager mUserManager;
- private AllAppsInfoPreferenceController mController;
-
- @Before
- public void setUp() {
- MockitoAnnotations.initMocks(this);
- final Context context = spy(RuntimeEnvironment.application);
- final Preference preference = new Preference(context);
- doReturn(mUserManager).when(context).getSystemService(Context.USER_SERVICE);
- when(mUserManager.getProfileIdsWithDisabled(anyInt())).thenReturn(new int[]{});
- mController = new AllAppsInfoPreferenceController(context, "test_key");
- mController.mPreference = preference;
- }
-
- @Test
- public void getAvailabilityStatus_shouldReturnAVAILABLE() {
- assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE);
- }
-
- @Test
- public void onReloadDataCompleted_recentAppsSet_hidePreference() {
- final List<UsageStats> stats = new ArrayList<>();
- final UsageStats stat1 = new UsageStats();
- stat1.mLastTimeUsed = System.currentTimeMillis();
- stat1.mPackageName = "pkg.class";
- stats.add(stat1);
-
- mController.onReloadDataCompleted(stats);
-
- assertThat(mController.mPreference.isVisible()).isFalse();
- }
-
- @Test
- public void onReloadDataCompleted_noRecentAppSet_showPreference() {
- final List<UsageStats> stats = new ArrayList<>();
-
- mController.onReloadDataCompleted(stats);
-
- assertThat(mController.mPreference.isVisible()).isTrue();
- }
-}
diff --git a/tests/robotests/src/com/android/settings/applications/RecentAppsPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/applications/RecentAppsPreferenceControllerTest.java
deleted file mode 100644
index 2928d6f..0000000
--- a/tests/robotests/src/com/android/settings/applications/RecentAppsPreferenceControllerTest.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.settings.applications;
-
-import static com.android.settings.core.BasePreferenceController.AVAILABLE_UNSEARCHABLE;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.anyInt;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import android.app.usage.UsageStats;
-import android.content.Context;
-import android.content.pm.ApplicationInfo;
-import android.content.pm.PackageManager;
-import android.os.UserHandle;
-import android.os.UserManager;
-import android.view.LayoutInflater;
-import android.view.View;
-
-import androidx.fragment.app.Fragment;
-import androidx.preference.Preference;
-import androidx.preference.PreferenceScreen;
-
-import com.android.settings.R;
-import com.android.settingslib.applications.ApplicationsState;
-import com.android.settingslib.widget.AppEntitiesHeaderController;
-import com.android.settingslib.widget.AppEntityInfo;
-import com.android.settingslib.widget.LayoutPreference;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.robolectric.RobolectricTestRunner;
-import org.robolectric.RuntimeEnvironment;
-import org.robolectric.util.ReflectionHelpers;
-
-import java.util.ArrayList;
-import java.util.List;
-
-@RunWith(RobolectricTestRunner.class)
-public class RecentAppsPreferenceControllerTest {
-
- @Mock
- private PreferenceScreen mScreen;
- @Mock
- private UserManager mUserManager;
- @Mock
- private ApplicationsState mAppState;
- @Mock
- private PackageManager mPackageManager;
- @Mock
- private ApplicationsState.AppEntry mAppEntry;
- @Mock
- private ApplicationInfo mApplicationInfo;
- @Mock
- private Fragment mFragment;
-
- private RecentAppsPreferenceController mController;
-
- @Before
- public void setUp() {
- MockitoAnnotations.initMocks(this);
- final Context context = spy(RuntimeEnvironment.application);
- when(context.getApplicationContext()).thenReturn(context);
- ReflectionHelpers.setStaticField(ApplicationsState.class, "sInstance", mAppState);
- doReturn(mUserManager).when(context).getSystemService(Context.USER_SERVICE);
- doReturn(mPackageManager).when(context).getPackageManager();
- when(mUserManager.getProfileIdsWithDisabled(anyInt())).thenReturn(new int[]{});
-
- final View appEntitiesHeaderView = LayoutInflater.from(context).inflate(
- R.layout.app_entities_header, null /* root */);
- final Preference dividerPreference = new Preference(context);
- final LayoutPreference recentAppsPreference =
- spy(new LayoutPreference(context, appEntitiesHeaderView));
-
- mController = spy(new RecentAppsPreferenceController(context, "test_key"));
- mController.setFragment(mFragment);
-
- mController.mAppEntitiesController = mock(AppEntitiesHeaderController.class);
- mController.mRecentAppsPreference = recentAppsPreference;
- mController.mDivider = dividerPreference;
-
- when(mScreen.findPreference(RecentAppsPreferenceController.KEY_DIVIDER))
- .thenReturn(dividerPreference);
- when(mScreen.findPreference("test_key")).thenReturn(recentAppsPreference);
- when(recentAppsPreference.findViewById(R.id.app_entities_header)).thenReturn(
- appEntitiesHeaderView);
- }
-
- @Test
- public void getAvailabilityStatus_shouldReturnAVAILABLE_UNSEARCHABLE() {
- assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE_UNSEARCHABLE);
- }
-
- @Test
- public void displayPreference_shouldSetupAppEntitiesHeaderController() {
- mController.displayPreference(mScreen);
-
- assertThat(mController.mAppEntitiesController).isNotNull();
- }
-
- @Test
- public void onReloadDataCompleted_threeValidRecentOpenAppsSet_setAppEntityThreeTime() {
- final List<UsageStats> stats = new ArrayList<>();
- final UsageStats stat1 = new UsageStats();
- final UsageStats stat2 = new UsageStats();
- final UsageStats stat3 = new UsageStats();
- stat1.mLastTimeUsed = System.currentTimeMillis();
- stat1.mPackageName = "pkg.class";
- stats.add(stat1);
-
- stat2.mLastTimeUsed = System.currentTimeMillis();
- stat2.mPackageName = "pkg.class2";
- stats.add(stat2);
-
- stat3.mLastTimeUsed = System.currentTimeMillis();
- stat3.mPackageName = "pkg.class3";
- stats.add(stat3);
- when(mAppState.getEntry(stat1.mPackageName, UserHandle.myUserId()))
- .thenReturn(mAppEntry);
- when(mAppState.getEntry(stat2.mPackageName, UserHandle.myUserId()))
- .thenReturn(mAppEntry);
- when(mAppState.getEntry(stat3.mPackageName, UserHandle.myUserId()))
- .thenReturn(mAppEntry);
- mAppEntry.info = mApplicationInfo;
-
- mController.onReloadDataCompleted(stats);
-
- verify(mController.mAppEntitiesController, times(3))
- .setAppEntity(anyInt(), any(AppEntityInfo.class));
- assertThat(mController.mRecentAppsPreference.isVisible()).isTrue();
- assertThat(mController.mDivider.isVisible()).isTrue();
- }
-
- @Test
- public void onReloadDataCompleted_noRecentOpenAppsSet_shouldHideRecentAppPreference() {
- final List<UsageStats> stats = new ArrayList<>();
-
- mController.onReloadDataCompleted(stats);
-
- assertThat(mController.mRecentAppsPreference.isVisible()).isFalse();
- assertThat(mController.mDivider.isVisible()).isFalse();
- }
-}
diff --git a/tests/robotests/src/com/android/settings/applications/appinfo/AppBatteryPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/applications/appinfo/AppBatteryPreferenceControllerTest.java
index 71ab334..73e9bed 100644
--- a/tests/robotests/src/com/android/settings/applications/appinfo/AppBatteryPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/applications/appinfo/AppBatteryPreferenceControllerTest.java
@@ -96,7 +96,11 @@
when(mOtherUidBatteryConsumer.getUid()).thenReturn(OTHER_UID);
mController = spy(new AppBatteryPreferenceController(
- RuntimeEnvironment.application, mFragment, "package1", null /* lifecycle */));
+ RuntimeEnvironment.application,
+ mFragment,
+ "package1" /* packageName */,
+ 0 /* uId */,
+ null /* lifecycle */));
mController.mBatteryUtils = mBatteryUtils;
when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mBatteryPreference);
}
diff --git a/tests/robotests/src/com/android/settings/deviceinfo/StorageDashboardFragmentTest.java b/tests/robotests/src/com/android/settings/deviceinfo/StorageDashboardFragmentTest.java
index 4e4375d..af1900a 100644
--- a/tests/robotests/src/com/android/settings/deviceinfo/StorageDashboardFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/deviceinfo/StorageDashboardFragmentTest.java
@@ -77,14 +77,14 @@
CachedStorageValuesHelper helper = mock(CachedStorageValuesHelper.class);
PrivateStorageInfo info = new PrivateStorageInfo(0, 0);
when(helper.getCachedPrivateStorageInfo()).thenReturn(info);
- SparseArray<StorageAsyncLoader.AppsStorageResult> result = new SparseArray<>();
- when(helper.getCachedAppsStorageResult()).thenReturn(result);
+ SparseArray<StorageAsyncLoader.StorageResult> result = new SparseArray<>();
+ when(helper.getCachedStorageResult()).thenReturn(result);
mFragment.setCachedStorageValuesHelper(helper);
mFragment.initializeCachedValues();
assertThat(mFragment.getPrivateStorageInfo()).isEqualTo(info);
- assertThat(mFragment.getAppsStorageResult()).isEqualTo(result);
+ assertThat(mFragment.getStorageResult()).isEqualTo(result);
}
@Test
@@ -97,20 +97,20 @@
mFragment.initializeCachedValues();
assertThat(mFragment.getPrivateStorageInfo()).isNull();
- assertThat(mFragment.getAppsStorageResult()).isNull();
+ assertThat(mFragment.getStorageResult()).isNull();
}
@Test
public void test_cacheProviderDoesntProvideValuesIfVolumeInfoMissing() {
CachedStorageValuesHelper helper = mock(CachedStorageValuesHelper.class);
- SparseArray<StorageAsyncLoader.AppsStorageResult> result = new SparseArray<>();
- when(helper.getCachedAppsStorageResult()).thenReturn(result);
+ SparseArray<StorageAsyncLoader.StorageResult> result = new SparseArray<>();
+ when(helper.getCachedStorageResult()).thenReturn(result);
mFragment.setCachedStorageValuesHelper(helper);
mFragment.initializeCachedValues();
assertThat(mFragment.getPrivateStorageInfo()).isNull();
- assertThat(mFragment.getAppsStorageResult()).isNull();
+ assertThat(mFragment.getStorageResult()).isNull();
}
@Test
@@ -169,7 +169,7 @@
mFragment = spy(mFragment);
when(mFragment.getView()).thenReturn(fakeView);
when(mFragment.getListView()).thenReturn(fakeRecyclerView);
- mFragment.setAppsStorageResult(new SparseArray<>());
+ mFragment.setStorageResult(new SparseArray<>());
mFragment.maybeSetLoading(true);
@@ -185,7 +185,7 @@
when(mFragment.getView()).thenReturn(fakeView);
when(mFragment.getListView()).thenReturn(fakeRecyclerView);
- mFragment.setAppsStorageResult(new SparseArray<>());
+ mFragment.setStorageResult(new SparseArray<>());
PrivateStorageInfo storageInfo = new PrivateStorageInfo(0, 0);
mFragment.setPrivateStorageInfo(storageInfo);
@@ -203,4 +203,4 @@
assertThat(indexRes).isNotNull();
assertThat(indexRes.get(0).xmlResId).isEqualTo(mFragment.getPreferenceScreenResId());
}
-}
\ No newline at end of file
+}
diff --git a/tests/robotests/src/com/android/settings/deviceinfo/StorageItemPreferenceTest.java b/tests/robotests/src/com/android/settings/deviceinfo/StorageItemPreferenceTest.java
index 5795157..24543801 100644
--- a/tests/robotests/src/com/android/settings/deviceinfo/StorageItemPreferenceTest.java
+++ b/tests/robotests/src/com/android/settings/deviceinfo/StorageItemPreferenceTest.java
@@ -54,7 +54,7 @@
@Test
public void testAfterLoad() {
mPreference.setStorageSize(MEGABYTE_IN_BYTES * 10, MEGABYTE_IN_BYTES * 100);
- assertThat(mPreference.getSummary()).isEqualTo("0.01 GB");
+ assertThat(mPreference.getSummary()).isEqualTo("10 MB");
}
@Test
diff --git a/tests/robotests/src/com/android/settings/deviceinfo/storage/CachedStorageValuesHelperTest.java b/tests/robotests/src/com/android/settings/deviceinfo/storage/CachedStorageValuesHelperTest.java
index d4048ac..ccc9152 100644
--- a/tests/robotests/src/com/android/settings/deviceinfo/storage/CachedStorageValuesHelperTest.java
+++ b/tests/robotests/src/com/android/settings/deviceinfo/storage/CachedStorageValuesHelperTest.java
@@ -16,7 +16,9 @@
package com.android.settings.deviceinfo.storage;
+import static com.android.settings.deviceinfo.storage.CachedStorageValuesHelper.AUDIO_SIZE_KEY;
import static com.android.settings.deviceinfo.storage.CachedStorageValuesHelper.CACHE_APPS_SIZE_KEY;
+import static com.android.settings.deviceinfo.storage.CachedStorageValuesHelper.DOCUMENTS_AND_OTHER_SIZE_KEY;
import static com.android.settings.deviceinfo.storage.CachedStorageValuesHelper.EXTERNAL_APP_BYTES;
import static com.android.settings.deviceinfo.storage.CachedStorageValuesHelper
.EXTERNAL_AUDIO_BYTES;
@@ -28,15 +30,15 @@
.EXTERNAL_VIDEO_BYTES;
import static com.android.settings.deviceinfo.storage.CachedStorageValuesHelper.FREE_BYTES_KEY;
import static com.android.settings.deviceinfo.storage.CachedStorageValuesHelper.GAME_APPS_SIZE_KEY;
-import static com.android.settings.deviceinfo.storage.CachedStorageValuesHelper.MUSIC_APPS_SIZE_KEY;
+import static com.android.settings.deviceinfo.storage.CachedStorageValuesHelper.IMAGES_SIZE_KEY;
import static com.android.settings.deviceinfo.storage.CachedStorageValuesHelper.OTHER_APPS_SIZE_KEY;
-import static com.android.settings.deviceinfo.storage.CachedStorageValuesHelper.PHOTO_APPS_SIZE_KEY;
import static com.android.settings.deviceinfo.storage.CachedStorageValuesHelper
.SHARED_PREFERENCES_NAME;
import static com.android.settings.deviceinfo.storage.CachedStorageValuesHelper.TIMESTAMP_KEY;
import static com.android.settings.deviceinfo.storage.CachedStorageValuesHelper.TOTAL_BYTES_KEY;
+import static com.android.settings.deviceinfo.storage.CachedStorageValuesHelper.TRASH_SIZE_KEY;
import static com.android.settings.deviceinfo.storage.CachedStorageValuesHelper.USER_ID_KEY;
-import static com.android.settings.deviceinfo.storage.CachedStorageValuesHelper.VIDEO_APPS_SIZE_KEY;
+import static com.android.settings.deviceinfo.storage.CachedStorageValuesHelper.VIDEOS_SIZE_KEY;
import static com.google.common.truth.Truth.assertThat;
@@ -81,9 +83,9 @@
mSharedPreferences
.edit()
.putLong(GAME_APPS_SIZE_KEY, 0)
- .putLong(MUSIC_APPS_SIZE_KEY, 10)
- .putLong(VIDEO_APPS_SIZE_KEY, 100)
- .putLong(PHOTO_APPS_SIZE_KEY, 1000)
+ .putLong(AUDIO_SIZE_KEY, 10)
+ .putLong(VIDEOS_SIZE_KEY, 100)
+ .putLong(IMAGES_SIZE_KEY, 1000)
.putLong(OTHER_APPS_SIZE_KEY, 10000)
.putLong(CACHE_APPS_SIZE_KEY, 100000)
.putLong(EXTERNAL_TOTAL_BYTES, 2)
@@ -104,14 +106,16 @@
}
@Test
- public void getCachedAppsStorageResult_cachedValuesAreLoaded() {
+ public void getCachedStorageResult_cachedValuesAreLoaded() {
when(mMockClock.getCurrentTime()).thenReturn(10001L);
mSharedPreferences
.edit()
.putLong(GAME_APPS_SIZE_KEY, 1)
- .putLong(MUSIC_APPS_SIZE_KEY, 10)
- .putLong(VIDEO_APPS_SIZE_KEY, 100)
- .putLong(PHOTO_APPS_SIZE_KEY, 1000)
+ .putLong(AUDIO_SIZE_KEY, 10)
+ .putLong(VIDEOS_SIZE_KEY, 100)
+ .putLong(IMAGES_SIZE_KEY, 1000)
+ .putLong(DOCUMENTS_AND_OTHER_SIZE_KEY, 1001)
+ .putLong(TRASH_SIZE_KEY, 1002)
.putLong(OTHER_APPS_SIZE_KEY, 10000)
.putLong(CACHE_APPS_SIZE_KEY, 100000)
.putLong(EXTERNAL_TOTAL_BYTES, 222222)
@@ -125,15 +129,17 @@
.putLong(TIMESTAMP_KEY, 10000L)
.apply();
- final SparseArray<StorageAsyncLoader.AppsStorageResult> result =
- mCachedValuesHelper.getCachedAppsStorageResult();
+ final SparseArray<StorageAsyncLoader.StorageResult> result =
+ mCachedValuesHelper.getCachedStorageResult();
- StorageAsyncLoader.AppsStorageResult primaryResult = result.get(0);
+ StorageAsyncLoader.StorageResult primaryResult = result.get(0);
assertThat(primaryResult.gamesSize).isEqualTo(1L);
- assertThat(primaryResult.musicAppsSize).isEqualTo(10L);
- assertThat(primaryResult.videoAppsSize).isEqualTo(100L);
- assertThat(primaryResult.photosAppsSize).isEqualTo(1000L);
- assertThat(primaryResult.otherAppsSize).isEqualTo(10000L);
+ assertThat(primaryResult.audioSize).isEqualTo(10L);
+ assertThat(primaryResult.videosSize).isEqualTo(100L);
+ assertThat(primaryResult.imagesSize).isEqualTo(1000L);
+ assertThat(primaryResult.documentsAndOtherSize).isEqualTo(1001L);
+ assertThat(primaryResult.trashSize).isEqualTo(1002L);
+ assertThat(primaryResult.allAppsExceptGamesSize).isEqualTo(10000L);
assertThat(primaryResult.cacheSize).isEqualTo(100000L);
assertThat(primaryResult.externalStats.totalBytes).isEqualTo(222222L);
assertThat(primaryResult.externalStats.audioBytes).isEqualTo(22L);
@@ -148,9 +154,9 @@
mSharedPreferences
.edit()
.putLong(GAME_APPS_SIZE_KEY, 0)
- .putLong(MUSIC_APPS_SIZE_KEY, 10)
- .putLong(VIDEO_APPS_SIZE_KEY, 100)
- .putLong(PHOTO_APPS_SIZE_KEY, 1000)
+ .putLong(AUDIO_SIZE_KEY, 10)
+ .putLong(VIDEOS_SIZE_KEY, 100)
+ .putLong(IMAGES_SIZE_KEY, 1000)
.putLong(OTHER_APPS_SIZE_KEY, 10000)
.putLong(CACHE_APPS_SIZE_KEY, 100000)
.putLong(EXTERNAL_TOTAL_BYTES, 2)
@@ -169,14 +175,14 @@
}
@Test
- public void getCachedAppsStorageResult_nullIfDataIsStale() {
+ public void getCachedStorageResult_nullIfDataIsStale() {
when(mMockClock.getCurrentTime()).thenReturn(10000000L);
mSharedPreferences
.edit()
.putLong(GAME_APPS_SIZE_KEY, 0)
- .putLong(MUSIC_APPS_SIZE_KEY, 10)
- .putLong(VIDEO_APPS_SIZE_KEY, 100)
- .putLong(PHOTO_APPS_SIZE_KEY, 1000)
+ .putLong(AUDIO_SIZE_KEY, 10)
+ .putLong(VIDEOS_SIZE_KEY, 100)
+ .putLong(IMAGES_SIZE_KEY, 1000)
.putLong(OTHER_APPS_SIZE_KEY, 10000)
.putLong(CACHE_APPS_SIZE_KEY, 100000)
.putLong(EXTERNAL_TOTAL_BYTES, 2)
@@ -190,8 +196,8 @@
.putLong(TIMESTAMP_KEY, 10000L)
.apply();
- final SparseArray<StorageAsyncLoader.AppsStorageResult> result =
- mCachedValuesHelper.getCachedAppsStorageResult();
+ final SparseArray<StorageAsyncLoader.StorageResult> result =
+ mCachedValuesHelper.getCachedStorageResult();
assertThat(result).isNull();
}
@@ -201,9 +207,9 @@
mSharedPreferences
.edit()
.putLong(GAME_APPS_SIZE_KEY, 0)
- .putLong(MUSIC_APPS_SIZE_KEY, 10)
- .putLong(VIDEO_APPS_SIZE_KEY, 100)
- .putLong(PHOTO_APPS_SIZE_KEY, 1000)
+ .putLong(AUDIO_SIZE_KEY, 10)
+ .putLong(VIDEOS_SIZE_KEY, 100)
+ .putLong(IMAGES_SIZE_KEY, 1000)
.putLong(OTHER_APPS_SIZE_KEY, 10000)
.putLong(CACHE_APPS_SIZE_KEY, 100000)
.putLong(EXTERNAL_TOTAL_BYTES, 2)
@@ -222,14 +228,14 @@
}
@Test
- public void getCachedAppsStorageResult_nullIfWrongUser() {
+ public void getCachedStorageResult_nullIfWrongUser() {
when(mMockClock.getCurrentTime()).thenReturn(10001L);
mSharedPreferences
.edit()
.putLong(GAME_APPS_SIZE_KEY, 0)
- .putLong(MUSIC_APPS_SIZE_KEY, 10)
- .putLong(VIDEO_APPS_SIZE_KEY, 100)
- .putLong(PHOTO_APPS_SIZE_KEY, 1000)
+ .putLong(AUDIO_SIZE_KEY, 10)
+ .putLong(VIDEOS_SIZE_KEY, 100)
+ .putLong(IMAGES_SIZE_KEY, 1000)
.putLong(OTHER_APPS_SIZE_KEY, 10000)
.putLong(CACHE_APPS_SIZE_KEY, 100000)
.putLong(EXTERNAL_TOTAL_BYTES, 2)
@@ -243,8 +249,8 @@
.putLong(TIMESTAMP_KEY, 10000L)
.apply();
- final SparseArray<StorageAsyncLoader.AppsStorageResult> result =
- mCachedValuesHelper.getCachedAppsStorageResult();
+ final SparseArray<StorageAsyncLoader.StorageResult> result =
+ mCachedValuesHelper.getCachedStorageResult();
assertThat(result).isNull();
}
@@ -255,9 +261,9 @@
}
@Test
- public void getCachedAppsStorageResult_nullIfEmpty() {
- final SparseArray<StorageAsyncLoader.AppsStorageResult> result =
- mCachedValuesHelper.getCachedAppsStorageResult();
+ public void getCachedStorageResult_nullIfEmpty() {
+ final SparseArray<StorageAsyncLoader.StorageResult> result =
+ mCachedValuesHelper.getCachedStorageResult();
assertThat(result).isNull();
}
@@ -266,13 +272,13 @@
when(mMockClock.getCurrentTime()).thenReturn(10000L);
final StorageStatsSource.ExternalStorageStats externalStats =
new StorageStatsSource.ExternalStorageStats(22222L, 2L, 20L, 200L, 2000L);
- final StorageAsyncLoader.AppsStorageResult result =
- new StorageAsyncLoader.AppsStorageResult();
+ final StorageAsyncLoader.StorageResult result =
+ new StorageAsyncLoader.StorageResult();
result.gamesSize = 1L;
- result.musicAppsSize = 10L;
- result.videoAppsSize = 100L;
- result.photosAppsSize = 1000L;
- result.otherAppsSize = 10000L;
+ result.audioSize = 10L;
+ result.videosSize = 100L;
+ result.imagesSize = 1000L;
+ result.allAppsExceptGamesSize = 10000L;
result.cacheSize = 100000L;
result.externalStats = externalStats;
final PrivateStorageInfo info = new PrivateStorageInfo(1000L, 6000L);
@@ -280,9 +286,9 @@
mCachedValuesHelper.cacheResult(info, result);
assertThat(mSharedPreferences.getLong(GAME_APPS_SIZE_KEY, -1)).isEqualTo(1L);
- assertThat(mSharedPreferences.getLong(MUSIC_APPS_SIZE_KEY, -1)).isEqualTo(10L);
- assertThat(mSharedPreferences.getLong(VIDEO_APPS_SIZE_KEY, -1)).isEqualTo(100L);
- assertThat(mSharedPreferences.getLong(PHOTO_APPS_SIZE_KEY, -1)).isEqualTo(1000L);
+ assertThat(mSharedPreferences.getLong(AUDIO_SIZE_KEY, -1)).isEqualTo(10L);
+ assertThat(mSharedPreferences.getLong(VIDEOS_SIZE_KEY, -1)).isEqualTo(100L);
+ assertThat(mSharedPreferences.getLong(IMAGES_SIZE_KEY, -1)).isEqualTo(1000L);
assertThat(mSharedPreferences.getLong(OTHER_APPS_SIZE_KEY, -1)).isEqualTo(10000L);
assertThat(mSharedPreferences.getLong(CACHE_APPS_SIZE_KEY, -1)).isEqualTo(100000L);
assertThat(mSharedPreferences.getLong(EXTERNAL_TOTAL_BYTES, -1)).isEqualTo(22222L);
diff --git a/tests/robotests/src/com/android/settings/deviceinfo/storage/SecondaryUserControllerTest.java b/tests/robotests/src/com/android/settings/deviceinfo/storage/SecondaryUserControllerTest.java
index ec0f4d0..ad811dc 100644
--- a/tests/robotests/src/com/android/settings/deviceinfo/storage/SecondaryUserControllerTest.java
+++ b/tests/robotests/src/com/android/settings/deviceinfo/storage/SecondaryUserControllerTest.java
@@ -103,7 +103,7 @@
verify(mGroup).addPreference(argumentCaptor.capture());
final Preference preference = argumentCaptor.getValue();
- assertThat(preference.getSummary()).isEqualTo("0.01 GB");
+ assertThat(preference.getSummary()).isEqualTo("10 MB");
}
@Test
@@ -201,9 +201,9 @@
mPrimaryUser.name = TEST_NAME;
mPrimaryUser.id = 10;
mController.displayPreference(mScreen);
- final StorageAsyncLoader.AppsStorageResult userResult =
- new StorageAsyncLoader.AppsStorageResult();
- final SparseArray<StorageAsyncLoader.AppsStorageResult> result = new SparseArray<>();
+ final StorageAsyncLoader.StorageResult userResult =
+ new StorageAsyncLoader.StorageResult();
+ final SparseArray<StorageAsyncLoader.StorageResult> result = new SparseArray<>();
userResult.externalStats =
new StorageStatsSource.ExternalStorageStats(
MEGABYTE_IN_BYTES * 30,
@@ -217,7 +217,7 @@
verify(mGroup).addPreference(argumentCaptor.capture());
final Preference preference = argumentCaptor.getValue();
- assertThat(preference.getSummary()).isEqualTo("0.03 GB");
+ assertThat(preference.getSummary()).isEqualTo("30 MB");
}
@Test
diff --git a/tests/robotests/src/com/android/settings/deviceinfo/storage/StorageItemPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/deviceinfo/storage/StorageItemPreferenceControllerTest.java
index 0a87d08..d55975a 100644
--- a/tests/robotests/src/com/android/settings/deviceinfo/storage/StorageItemPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/deviceinfo/storage/StorageItemPreferenceControllerTest.java
@@ -16,6 +16,8 @@
package com.android.settings.deviceinfo.storage;
import static com.android.settings.applications.manageapplications.ManageApplications.EXTRA_WORK_ID;
+import static com.android.settings.utils.FileSizeFormatter.GIGABYTE_IN_BYTES;
+import static com.android.settings.utils.FileSizeFormatter.KILOBYTE_IN_BYTES;
import static com.android.settings.utils.FileSizeFormatter.MEGABYTE_IN_BYTES;
import static com.google.common.truth.Truth.assertThat;
@@ -336,12 +338,14 @@
mController.displayPreference(mPreferenceScreen);
mController.setUsedSize(MEGABYTE_IN_BYTES * 970); // There should 870MB attributed.
- final StorageAsyncLoader.AppsStorageResult result =
- new StorageAsyncLoader.AppsStorageResult();
+ final StorageAsyncLoader.StorageResult result = new StorageAsyncLoader.StorageResult();
result.gamesSize = MEGABYTE_IN_BYTES * 80;
- result.videoAppsSize = MEGABYTE_IN_BYTES * 160;
- result.musicAppsSize = MEGABYTE_IN_BYTES * 40;
- result.otherAppsSize = MEGABYTE_IN_BYTES * 90;
+ result.imagesSize = MEGABYTE_IN_BYTES * 350;
+ result.videosSize = GIGABYTE_IN_BYTES * 30;
+ result.audioSize = MEGABYTE_IN_BYTES * 40;
+ result.documentsAndOtherSize = MEGABYTE_IN_BYTES * 50;
+ result.trashSize = KILOBYTE_IN_BYTES * 100;
+ result.allAppsExceptGamesSize = MEGABYTE_IN_BYTES * 90;
result.externalStats =
new StorageStatsSource.ExternalStorageStats(
MEGABYTE_IN_BYTES * 500, // total
@@ -349,17 +353,18 @@
MEGABYTE_IN_BYTES * 150, // video
MEGABYTE_IN_BYTES * 200, 0); // image
- final SparseArray<StorageAsyncLoader.AppsStorageResult> results = new SparseArray<>();
+ final SparseArray<StorageAsyncLoader.StorageResult> results = new SparseArray<>();
results.put(0, result);
mController.onLoadFinished(results, 0);
- assertThat(mController.mImagesPreference.getSummary().toString()).isEqualTo("0.35 GB");
- assertThat(mController.mVideosPreference.getSummary().toString()).isEqualTo("0.16 GB");
- assertThat(mController.mAudioPreference.getSummary().toString()).isEqualTo("0.14 GB");
- assertThat(mController.mAppsPreference.getSummary().toString()).isEqualTo("0.09 GB");
- assertThat(mController.mGamesPreference.getSummary().toString()).isEqualTo("0.08 GB");
+ assertThat(mController.mImagesPreference.getSummary().toString()).isEqualTo("350 MB");
+ assertThat(mController.mVideosPreference.getSummary().toString()).isEqualTo("30 GB");
+ assertThat(mController.mAudioPreference.getSummary().toString()).isEqualTo("40 MB");
+ assertThat(mController.mAppsPreference.getSummary().toString()).isEqualTo("90 MB");
+ assertThat(mController.mGamesPreference.getSummary().toString()).isEqualTo("80 MB");
assertThat(mController.mDocumentsAndOtherPreference.getSummary().toString())
- .isEqualTo("0.05 GB");
+ .isEqualTo("50 MB");
+ assertThat(mController.mTrashPreference.getSummary().toString()).isEqualTo("100 kB");
}
@Test
diff --git a/tests/robotests/src/com/android/settings/notification/RecentNotifyingAppsPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/RecentNotifyingAppsPreferenceControllerTest.java
deleted file mode 100644
index f6eb93b..0000000
--- a/tests/robotests/src/com/android/settings/notification/RecentNotifyingAppsPreferenceControllerTest.java
+++ /dev/null
@@ -1,389 +0,0 @@
-/*
- * Copyright (C) 2018 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.settings.notification;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.anyInt;
-import static org.mockito.ArgumentMatchers.anyLong;
-import static org.mockito.ArgumentMatchers.anyString;
-import static org.mockito.ArgumentMatchers.argThat;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.Mockito.doNothing;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import android.app.usage.IUsageStatsManager;
-import android.app.usage.UsageEvents;
-import android.app.usage.UsageEvents.Event;
-import android.content.Context;
-import android.content.Intent;
-import android.content.pm.ApplicationInfo;
-import android.content.pm.PackageManager;
-import android.content.pm.ResolveInfo;
-import android.os.Parcel;
-import android.os.UserHandle;
-import android.os.UserManager;
-import android.service.notification.NotifyingApp;
-import android.text.TextUtils;
-
-import com.android.settings.R;
-import com.android.settings.widget.PrimarySwitchPreference;
-import com.android.settingslib.applications.AppUtils;
-import com.android.settingslib.applications.ApplicationsState;
-import com.android.settingslib.applications.instantapps.InstantAppDataProvider;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.ArgumentCaptor;
-import org.mockito.ArgumentMatcher;
-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;
-import java.util.List;
-
-import androidx.fragment.app.Fragment;
-import androidx.fragment.app.FragmentActivity;
-import androidx.preference.Preference;
-import androidx.preference.PreferenceCategory;
-import androidx.preference.PreferenceScreen;
-
-@RunWith(RobolectricTestRunner.class)
-public class RecentNotifyingAppsPreferenceControllerTest {
-
- @Mock
- private PreferenceScreen mScreen;
- @Mock
- private PreferenceCategory mCategory;
- private PrimarySwitchPreference mApp1;
- private PrimarySwitchPreference mApp2;
- private PrimarySwitchPreference mApp3;
- @Mock
- private Preference mSeeAllPref;
- @Mock
- private UserManager mUserManager;
- @Mock
- private ApplicationsState mAppState;
- @Mock
- private PackageManager mPackageManager;
- @Mock
- private ApplicationsState.AppEntry mAppEntry;
- @Mock
- private ApplicationInfo mApplicationInfo;
- @Mock
- private NotificationBackend mBackend;
- @Mock
- private Fragment mHost;
- @Mock
- private FragmentActivity mActivity;
- @Mock
- private IUsageStatsManager mIUsageStatsManager;
-
- private Context mContext;
- private RecentNotifyingAppsPreferenceController mController;
-
- @Before
- public void setUp() {
- MockitoAnnotations.initMocks(this);
- mContext = spy(RuntimeEnvironment.application);
- doReturn(mUserManager).when(mContext).getSystemService(Context.USER_SERVICE);
- doReturn(mPackageManager).when(mContext).getPackageManager();
- when(mUserManager.getProfileIdsWithDisabled(0)).thenReturn(new int[] {0});
-
- mController = new RecentNotifyingAppsPreferenceController(
- mContext, mBackend, mIUsageStatsManager, mUserManager, mAppState, mHost);
- when(mScreen.findPreference(anyString())).thenReturn(mCategory);
- mApp1 = new PrimarySwitchPreference(mContext);
- mApp1.setKey("app1");
- mApp2 = new PrimarySwitchPreference(mContext);
- mApp2.setKey("app2");
- mApp3 = new PrimarySwitchPreference(mContext);
- mApp3.setKey("app3");
- when(mCategory.findPreference("app1")).thenReturn(mApp1);
- when(mCategory.findPreference("app2")).thenReturn(mApp2);
- when(mCategory.findPreference("app3")).thenReturn(mApp3);
-
- when(mScreen.findPreference(RecentNotifyingAppsPreferenceController.KEY_SEE_ALL))
- .thenReturn(mSeeAllPref);
- when(mCategory.getContext()).thenReturn(mContext);
- when(mHost.getActivity()).thenReturn(mActivity);
- }
-
- @Test
- public void isAlwaysAvailable() {
- assertThat(mController.isAvailable()).isTrue();
- }
-
- @Test
- public void onDisplayAndUpdateState_shouldRefreshUi() {
- mController = spy(new RecentNotifyingAppsPreferenceController(
- mContext, null, mIUsageStatsManager, mUserManager, (ApplicationsState) null, null));
-
- doNothing().when(mController).refreshUi(mContext);
-
- mController.displayPreference(mScreen);
- mController.updateState(mCategory);
-
- verify(mController, times(2)).refreshUi(mContext);
- }
-
- @Test
- @Config(qualifiers = "mcc999")
- public void display_shouldNotShowRecents_showAppInfoPreference() {
- mController.displayPreference(mScreen);
-
- verify(mCategory, never()).addPreference(any(Preference.class));
- verify(mCategory).setTitle(null);
- verify(mSeeAllPref).setTitle(R.string.notifications_title);
- verify(mSeeAllPref).setIcon(null);
- }
-
- @Test
- public void display_showRecents() throws Exception {
- List<Event> events = new ArrayList<>();
- Event app = new Event();
- app.mEventType = Event.NOTIFICATION_INTERRUPTION;
- app.mPackage = "a";
- app.mTimeStamp = System.currentTimeMillis();
- events.add(app);
- Event app1 = new Event();
- app1.mEventType = Event.NOTIFICATION_INTERRUPTION;
- app1.mPackage = "com.android.settings";
- app1.mTimeStamp = System.currentTimeMillis();
- events.add(app1);
- Event app2 = new Event();
- app2.mEventType = Event.NOTIFICATION_INTERRUPTION;
- app2.mPackage = "pkg.class2";
- app2.mTimeStamp = System.currentTimeMillis() - 1000;
- events.add(app2);
- ApplicationsState.AppEntry app1Entry = mock(ApplicationsState.AppEntry.class);
- ApplicationsState.AppEntry app2Entry = mock(ApplicationsState.AppEntry.class);
- app1Entry.info = mApplicationInfo;
- app1Entry.label = "app 1";
- app2Entry.info = mApplicationInfo;
- app2Entry.label = "app 2";
-
- // app1, app2 are valid apps. app3 is invalid.
- when(mAppState.getEntry(app.getPackageName(), UserHandle.myUserId()))
- .thenReturn(app1Entry);
- when(mAppState.getEntry(app1.getPackageName(), UserHandle.myUserId()))
- .thenReturn(app2Entry);
- when(mAppState.getEntry(app2.getPackageName(), UserHandle.myUserId()))
- .thenReturn(null);
- when(mPackageManager.resolveActivity(any(Intent.class), anyInt())).thenReturn(
- new ResolveInfo());
-
- UsageEvents usageEvents = getUsageEvents(
- new String[] {app.getPackageName(), app1.getPackageName(), app2.getPackageName()},
- events);
- when(mIUsageStatsManager.queryEventsForUser(anyLong(), anyLong(), anyInt(), anyString()))
- .thenReturn(usageEvents);
-
- mAppEntry.info = mApplicationInfo;
-
- mController.displayPreference(mScreen);
-
- verify(mCategory).setTitle(R.string.recent_notifications);
- // Only add app1 & app2. app3 skipped because it's invalid app.
- assertThat(mApp1.getTitle()).isEqualTo(app1Entry.label);
- assertThat(mApp2.getTitle()).isEqualTo(app2Entry.label);
-
- verify(mCategory).removePreferenceRecursively(mApp3.getKey());
-
- verify(mSeeAllPref).setSummary(null);
- verify(mSeeAllPref).setIcon(R.drawable.ic_chevron_right_24dp);
- }
-
- @Test
- public void display_noCrashIfLessThan3() throws Exception {
- List<Event> events = new ArrayList<>();
- Event app = new Event();
- app.mEventType = Event.NOTIFICATION_INTERRUPTION;
- app.mPackage = "a";
- app.mTimeStamp = System.currentTimeMillis();
- events.add(app);
- ApplicationsState.AppEntry app1Entry = mock(ApplicationsState.AppEntry.class);
- app1Entry.info = mApplicationInfo;
- app1Entry.label = "app 1";
-
- when(mAppState.getEntry(app.getPackageName(), UserHandle.myUserId()))
- .thenReturn(app1Entry);
- when(mPackageManager.resolveActivity(any(Intent.class), anyInt())).thenReturn(
- new ResolveInfo());
-
- UsageEvents usageEvents = getUsageEvents(
- new String[] {app.getPackageName()},
- events);
- when(mIUsageStatsManager.queryEventsForUser(anyLong(), anyLong(), anyInt(), anyString()))
- .thenReturn(usageEvents);
-
- mAppEntry.info = mApplicationInfo;
-
- mController.displayPreference(mScreen);
-
- verify(mCategory).setTitle(R.string.recent_notifications);
- // Only add app1 & app2. app3 skipped because it's invalid app.
- assertThat(mApp1.getTitle()).isEqualTo(app1Entry.label);
-
- verify(mCategory).removePreferenceRecursively("app2");
-
- mController.refreshUi(mContext);
- }
-
- @Test
- public void display_showRecentsWithInstantApp() throws Exception {
- List<Event> events = new ArrayList<>();
- Event app = new Event();
- app.mEventType = Event.NOTIFICATION_INTERRUPTION;
- app.mPackage = "com.foo.bar";
- app.mTimeStamp = System.currentTimeMillis();
- events.add(app);
- Event app1 = new Event();
- app1.mEventType = Event.NOTIFICATION_INTERRUPTION;
- app1.mPackage = "com.foo.barinstant";
- app1.mTimeStamp = System.currentTimeMillis() - 200;
- events.add(app1);
- UsageEvents usageEvents = getUsageEvents(
- new String[] {"com.foo.bar", "com.foo.barinstant"}, events);
- when(mIUsageStatsManager.queryEventsForUser(anyLong(), anyLong(), anyInt(), anyString()))
- .thenReturn(usageEvents);
-
- ApplicationsState.AppEntry appEntry = mock(ApplicationsState.AppEntry.class);
- ApplicationsState.AppEntry app1Entry = mock(ApplicationsState.AppEntry.class);
- appEntry.info = mApplicationInfo;
- appEntry.label = "app 1";
- app1Entry.info = mApplicationInfo;
- app1Entry.label = "app 2";
-
- when(mAppState.getEntry(
- app.getPackageName(), UserHandle.myUserId())).thenReturn(appEntry);
- when(mAppState.getEntry(
- app1.getPackageName(), UserHandle.myUserId())).thenReturn(app1Entry);
-
- // Only the regular app app1 should have its intent resolve.
- when(mPackageManager.resolveActivity(argThat(intentMatcher(app.getPackageName())),
- anyInt())).thenReturn(new ResolveInfo());
-
- // Make sure app2 is considered an instant app.
- ReflectionHelpers.setStaticField(AppUtils.class, "sInstantAppDataProvider",
- (InstantAppDataProvider) (ApplicationInfo info) -> {
- if (info == app1Entry.info) {
- return true;
- } else {
- return false;
- }
- });
-
- mController.displayPreference(mScreen);
-
- assertThat(mApp1.getTitle()).isEqualTo(appEntry.label);
- assertThat(mApp1.getSummary()).isEqualTo("Just now");
- assertThat(mApp2.getTitle()).isEqualTo(app1Entry.label);
-
- verify(mCategory).removePreferenceRecursively(mApp3.getKey());
- }
-
- @Test
- public void reloadData() throws Exception {
- when(mUserManager.getProfileIdsWithDisabled(0)).thenReturn(new int[] {0, 10});
-
- mController = new RecentNotifyingAppsPreferenceController(
- mContext, mBackend, mIUsageStatsManager, mUserManager, mAppState, mHost);
-
- List<Event> events = new ArrayList<>();
- Event app = new Event();
- app.mEventType = Event.NOTIFICATION_INTERRUPTION;
- app.mPackage = "b";
- app.mTimeStamp = 1;
- events.add(app);
- Event app1 = new Event();
- app1.mEventType = Event.MAX_EVENT_TYPE;
- app1.mPackage = "com.foo.bar";
- app1.mTimeStamp = 10;
- events.add(app1);
- UsageEvents usageEvents = getUsageEvents(
- new String[] {"b", "com.foo.bar"}, events);
- when(mIUsageStatsManager.queryEventsForUser(anyLong(), anyLong(), eq(0), anyString()))
- .thenReturn(usageEvents);
-
- List<Event> events10 = new ArrayList<>();
- Event app10 = new Event();
- app10.mEventType = Event.NOTIFICATION_INTERRUPTION;
- app10.mPackage = "a";
- app10.mTimeStamp = 2;
- events10.add(app10);
- Event app10a = new Event();
- app10a.mEventType = Event.NOTIFICATION_INTERRUPTION;
- app10a.mPackage = "a";
- app10a.mTimeStamp = 20;
- events10.add(app10a);
- UsageEvents usageEvents10 = getUsageEvents(
- new String[] {"a"}, events10);
- when(mIUsageStatsManager.queryEventsForUser(anyLong(), anyLong(), eq(10), anyString()))
- .thenReturn(usageEvents10);
-
- mController.reloadData();
-
- assertThat(mController.mApps.size()).isEqualTo(2);
- boolean foundPkg0 = false;
- boolean foundPkg10 = false;
- for (NotifyingApp notifyingApp : mController.mApps) {
- if (notifyingApp.getLastNotified() == 20
- && notifyingApp.getPackage().equals("a")
- && notifyingApp.getUserId() == 10) {
- foundPkg10 = true;
- }
- if (notifyingApp.getLastNotified() == 1
- && notifyingApp.getPackage().equals("b")
- && notifyingApp.getUserId() == 0) {
- foundPkg0 = true;
- }
- }
- assertThat(foundPkg0).isTrue();
- assertThat(foundPkg10).isTrue();
- }
-
- private static ArgumentMatcher<Preference> summaryMatches(String expected) {
- return preference -> TextUtils.equals(expected, preference.getSummary());
- }
-
- // Used for matching an intent with a specific package name.
- private static ArgumentMatcher<Intent> intentMatcher(String packageName) {
- return intent -> packageName.equals(intent.getPackage());
- }
-
- private UsageEvents getUsageEvents(String[] pkgs, List<Event> events) {
- UsageEvents usageEvents = new UsageEvents(events, pkgs);
- Parcel parcel = Parcel.obtain();
- parcel.setDataPosition(0);
- usageEvents.writeToParcel(parcel, 0);
- parcel.setDataPosition(0);
- return UsageEvents.CREATOR.createFromParcel(parcel);
- }
-}
diff --git a/tests/unit/src/com/android/settings/deviceinfo/storage/StorageAsyncLoaderTest.java b/tests/unit/src/com/android/settings/deviceinfo/storage/StorageAsyncLoaderTest.java
index a271e9b..671da95 100644
--- a/tests/unit/src/com/android/settings/deviceinfo/storage/StorageAsyncLoaderTest.java
+++ b/tests/unit/src/com/android/settings/deviceinfo/storage/StorageAsyncLoaderTest.java
@@ -101,22 +101,22 @@
addPackage(PACKAGE_NAME_1, 0, 1, 10, ApplicationInfo.CATEGORY_UNDEFINED);
addPackage(PACKAGE_NAME_2, 0, 100, 1000, ApplicationInfo.CATEGORY_UNDEFINED);
- SparseArray<StorageAsyncLoader.AppsStorageResult> result = mLoader.loadInBackground();
+ SparseArray<StorageAsyncLoader.StorageResult> result = mLoader.loadInBackground();
assertThat(result.size()).isEqualTo(1);
assertThat(result.get(PRIMARY_USER_ID).gamesSize).isEqualTo(0L);
- assertThat(result.get(PRIMARY_USER_ID).otherAppsSize).isEqualTo(1111L);
+ assertThat(result.get(PRIMARY_USER_ID).allAppsExceptGamesSize).isEqualTo(1111L);
}
@Test
public void testGamesAreFiltered() throws Exception {
addPackage(PACKAGE_NAME_1, 0, 1, 10, ApplicationInfo.CATEGORY_GAME);
- SparseArray<StorageAsyncLoader.AppsStorageResult> result = mLoader.loadInBackground();
+ SparseArray<StorageAsyncLoader.StorageResult> result = mLoader.loadInBackground();
assertThat(result.size()).isEqualTo(1);
assertThat(result.get(PRIMARY_USER_ID).gamesSize).isEqualTo(11L);
- assertThat(result.get(PRIMARY_USER_ID).otherAppsSize).isEqualTo(0);
+ assertThat(result.get(PRIMARY_USER_ID).allAppsExceptGamesSize).isEqualTo(0);
}
@Test
@@ -125,21 +125,21 @@
addPackage(PACKAGE_NAME_1, 0, 1, 10, ApplicationInfo.CATEGORY_UNDEFINED);
info.flags = ApplicationInfo.FLAG_IS_GAME;
- SparseArray<StorageAsyncLoader.AppsStorageResult> result = mLoader.loadInBackground();
+ SparseArray<StorageAsyncLoader.StorageResult> result = mLoader.loadInBackground();
assertThat(result.size()).isEqualTo(1);
assertThat(result.get(PRIMARY_USER_ID).gamesSize).isEqualTo(11L);
- assertThat(result.get(PRIMARY_USER_ID).otherAppsSize).isEqualTo(0);
+ assertThat(result.get(PRIMARY_USER_ID).allAppsExceptGamesSize).isEqualTo(0);
}
@Test
public void testCacheIsNotIgnored() throws Exception {
addPackage(PACKAGE_NAME_1, 100, 1, 10, ApplicationInfo.CATEGORY_UNDEFINED);
- SparseArray<StorageAsyncLoader.AppsStorageResult> result = mLoader.loadInBackground();
+ SparseArray<StorageAsyncLoader.StorageResult> result = mLoader.loadInBackground();
assertThat(result.size()).isEqualTo(1);
- assertThat(result.get(PRIMARY_USER_ID).otherAppsSize).isEqualTo(111L);
+ assertThat(result.get(PRIMARY_USER_ID).allAppsExceptGamesSize).isEqualTo(111L);
}
@Test
@@ -152,7 +152,7 @@
when(mSource.getExternalStorageStats(anyString(), eq(new UserHandle(SECONDARY_USER_ID))))
.thenReturn(new StorageStatsSource.ExternalStorageStats(10, 3, 3, 4, 0));
- SparseArray<StorageAsyncLoader.AppsStorageResult> result = mLoader.loadInBackground();
+ SparseArray<StorageAsyncLoader.StorageResult> result = mLoader.loadInBackground();
assertThat(result.size()).isEqualTo(2);
assertThat(result.get(PRIMARY_USER_ID).externalStats.totalBytes).isEqualTo(9L);
@@ -165,21 +165,10 @@
addPackage(PACKAGE_NAME_1, 100, 1, 10, ApplicationInfo.CATEGORY_UNDEFINED);
systemApp.flags = ApplicationInfo.FLAG_SYSTEM & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP;
- SparseArray<StorageAsyncLoader.AppsStorageResult> result = mLoader.loadInBackground();
+ SparseArray<StorageAsyncLoader.StorageResult> result = mLoader.loadInBackground();
assertThat(result.size()).isEqualTo(1);
- assertThat(result.get(PRIMARY_USER_ID).otherAppsSize).isEqualTo(111L);
- }
-
- @Test
- public void testVideoAppsAreFiltered() throws Exception {
- addPackage(PACKAGE_NAME_1, 0, 1, 10, ApplicationInfo.CATEGORY_VIDEO);
-
- SparseArray<StorageAsyncLoader.AppsStorageResult> result = mLoader.loadInBackground();
-
- assertThat(result.size()).isEqualTo(1);
- // Code size is not included for file based video category.
- assertThat(result.get(PRIMARY_USER_ID).videoAppsSize).isEqualTo(10L);
+ assertThat(result.get(PRIMARY_USER_ID).allAppsExceptGamesSize).isEqualTo(111L);
}
@Test
@@ -191,44 +180,20 @@
when(mSource.getStatsForPackage(anyString(), anyString(), any(UserHandle.class)))
.thenThrow(new NameNotFoundException());
- SparseArray<StorageAsyncLoader.AppsStorageResult> result = mLoader.loadInBackground();
+ SparseArray<StorageAsyncLoader.StorageResult> result = mLoader.loadInBackground();
// Should not crash.
}
@Test
- public void testPackageIsNotDoubleCounted() throws Exception {
- UserInfo info = new UserInfo();
- info.id = SECONDARY_USER_ID;
- mUsers.add(info);
- when(mSource.getExternalStorageStats(anyString(), eq(UserHandle.SYSTEM)))
- .thenReturn(new StorageStatsSource.ExternalStorageStats(9, 2, 3, 4, 0));
- when(mSource.getExternalStorageStats(anyString(), eq(new UserHandle(SECONDARY_USER_ID))))
- .thenReturn(new StorageStatsSource.ExternalStorageStats(10, 3, 3, 4, 0));
- addPackage(PACKAGE_NAME_1, 0, 1, 10, ApplicationInfo.CATEGORY_VIDEO);
- ArrayList<ApplicationInfo> secondaryUserApps = new ArrayList<>();
- ApplicationInfo appInfo = new ApplicationInfo();
- appInfo.packageName = PACKAGE_NAME_1;
- appInfo.category = ApplicationInfo.CATEGORY_VIDEO;
- secondaryUserApps.add(appInfo);
-
- SparseArray<StorageAsyncLoader.AppsStorageResult> result = mLoader.loadInBackground();
-
- assertThat(result.size()).isEqualTo(2);
- // Code size is not included for file based video category.
- assertThat(result.get(PRIMARY_USER_ID).videoAppsSize).isEqualTo(10L);
- // No code size for the second user.
- assertThat(result.get(SECONDARY_USER_ID).videoAppsSize).isEqualTo(10L);
- }
-
- @Test
public void testCacheOveragesAreCountedAsFree() throws Exception {
addPackage(PACKAGE_NAME_1, DEFAULT_QUOTA + 100, 1, 10, ApplicationInfo.CATEGORY_UNDEFINED);
- SparseArray<StorageAsyncLoader.AppsStorageResult> result = mLoader.loadInBackground();
+ SparseArray<StorageAsyncLoader.StorageResult> result = mLoader.loadInBackground();
assertThat(result.size()).isEqualTo(1);
- assertThat(result.get(PRIMARY_USER_ID).otherAppsSize).isEqualTo(DEFAULT_QUOTA + 11);
+ assertThat(result.get(PRIMARY_USER_ID).allAppsExceptGamesSize)
+ .isEqualTo(DEFAULT_QUOTA + 11);
}
@Test
@@ -237,10 +202,10 @@
addPackage(PACKAGE_NAME_2, 0, 1, 10, ApplicationInfo.CATEGORY_VIDEO);
addPackage(PACKAGE_NAME_3, 0, 1, 10, ApplicationInfo.CATEGORY_AUDIO);
- SparseArray<StorageAsyncLoader.AppsStorageResult> result = mLoader.loadInBackground();
+ SparseArray<StorageAsyncLoader.StorageResult> result = mLoader.loadInBackground();
assertThat(result.size()).isEqualTo(1);
- assertThat(result.get(PRIMARY_USER_ID).otherAppsSize).isEqualTo(33L);
+ assertThat(result.get(PRIMARY_USER_ID).allAppsExceptGamesSize).isEqualTo(33L);
}
private ApplicationInfo addPackage(String packageName, long cacheSize, long codeSize,
diff --git a/tests/unit/src/com/android/settings/search/CustomSiteMapRegistryTest.java b/tests/unit/src/com/android/settings/search/CustomSiteMapRegistryTest.java
index b8c3d57..3848fe4 100644
--- a/tests/unit/src/com/android/settings/search/CustomSiteMapRegistryTest.java
+++ b/tests/unit/src/com/android/settings/search/CustomSiteMapRegistryTest.java
@@ -20,7 +20,6 @@
import androidx.test.ext.junit.runners.AndroidJUnit4;
-import com.android.settings.DisplaySettings;
import com.android.settings.backup.UserBackupSettingsActivity;
import com.android.settings.connecteddevice.ConnectedDeviceDashboardFragment;
import com.android.settings.connecteddevice.usb.UsbDetailsFragment;
@@ -36,7 +35,6 @@
import com.android.settings.security.SecuritySettings;
import com.android.settings.security.screenlock.ScreenLockSettings;
import com.android.settings.system.SystemDashboardFragment;
-import com.android.settings.wallpaper.WallpaperSuggestionActivity;
import com.android.settings.wifi.WifiSettings;
import org.junit.Test;
@@ -52,13 +50,6 @@
}
@Test
- public void shouldContainWallpaperSuggestionActivityPairs() {
- assertThat(CustomSiteMapRegistry.CUSTOM_SITE_MAP.get(
- WallpaperSuggestionActivity.class.getName()))
- .isEqualTo(DisplaySettings.class.getName());
- }
-
- @Test
public void shouldContainWifiSettingsPairs() {
assertThat(CustomSiteMapRegistry.CUSTOM_SITE_MAP.get(WifiSettings.class.getName()))
.isEqualTo(NetworkDashboardFragment.class.getName());