Add a new special app access screen for long background tasks.

This new screen shows apps that hold the new RUN_LONG_JOBS permission.

Also add a reference to this screen in an app's info page under the
"Advanced" section for apps that have requested this permission.

Bug: 255821578
Test: atest AppFilterRegistryTest
Test: make -j RunSettingsRoboTests \
ROBOTTEST_FILTER="LongBackgroundTasksDetailsTest|
LongBackgroundTasksDetailsPreferenceControllerTest"
Test: visually via the Settings page

Change-Id: Idc498e52d29abc6df757c35e8bc91f00de92ba4a
This commit is contained in:
Varun Shah
2022-10-30 18:33:52 +00:00
parent 1111e51f2c
commit b33256a0fc
16 changed files with 743 additions and 5 deletions

View File

@@ -6032,7 +6032,8 @@
<string name="help_uri_about" translatable="false"></string>
<!-- Help URI, manage apps that can set alarms and reminders [DO NOT TRANSLATE] -->
<string name="help_uri_alarms_and_reminders" translatable="false"></string>
<!-- Help URI, manage apps that can run long background tasks [DO NOT TRANSLATE] -->
<string name="help_uri_long_background_tasks" translatable="false"></string>
<!-- Help URL, WiFi [DO NOT TRANSLATE] -->
<string name="help_url_wifi" translatable="false"></string>
<!-- Help URL, WiFi Direct [DO NOT TRANSLATE] -->
@@ -9123,6 +9124,22 @@
<!-- Title for the See more preference item in Special app access settings [CHAR LIMIT=30] -->
<string name="special_access_more">See more</string>
<!-- Label for the settings activity for controlling apps that can run long background tasks [CHAR LIMIT=30] -->
<string name="long_background_tasks_label">Long background tasks</string>
<!-- Label for the switch to toggle the permission for running long background tasks [CHAR LIMIT=50] -->
<string name="long_background_tasks_switch_title">Allow long-running background tasks</string>
<!-- Title for the settings screen for controlling apps that can run long background tasks [CHAR LIMIT=30] -->
<string name="long_background_tasks_title">Long background tasks</string>
<!-- Description that appears below the long_background_tasks switch [CHAR LIMIT=NONE] -->
<string name="long_background_tasks_footer_title">
Allow this app to run long background tasks. This lets the app run tasks that might
take longer than a few minutes to finish, such as downloads and uploads.
\n\nIf this permission is denied, the system will limit how long the app can perform
such tasks in the background.
</string>
<!-- Keywords for settings screen for controlling apps that can run long background tasks [CHAR LIMIT=NONE] -->
<string name="keywords_long_background_tasks">long jobs, data transfer, background tasks</string>
<!-- Reset rate-limiting in the system service ShortcutManager. "ShortcutManager" is the name of a system service and not translatable.
If the word "rate-limit" is hard to translate, use "Reset ShortcutManager API call limit" as the source text, which means
the same thing in this context.

View File

@@ -189,6 +189,12 @@
android:summary="@string/summary_placeholder"
settings:controller="com.android.settings.applications.appinfo.AlarmsAndRemindersDetailPreferenceController" />
<Preference
android:key="long_background_tasks"
android:title="@string/long_background_tasks_title"
android:summary="@string/summary_placeholder"
settings:controller="com.android.settings.applications.appinfo.LongBackgroundTasksDetailsPreferenceController" />
</PreferenceCategory>
<!-- App installer info -->

View File

@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2022 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"
android:title="@string/long_background_tasks_title">
<com.android.settings.widget.FilterTouchesRestrictedSwitchPreference
android:key="long_background_tasks_switch"
android:title="@string/long_background_tasks_switch_title" />
<com.android.settingslib.widget.FooterPreference
android:key="long_background_tasks_description"
android:title="@string/long_background_tasks_footer_title"
android:selectable="false" />
</PreferenceScreen>

View File

@@ -107,6 +107,16 @@
settings:isPreferenceVisible="@bool/config_show_data_saver"
settings:controller="com.android.settings.applications.specialaccess.DataSaverController" />
<Preference
android:key="long_background_tasks"
android:title="@string/long_background_tasks_title"
android:fragment="com.android.settings.applications.manageapplications.ManageApplications"
settings:keywords="@string/keywords_long_background_tasks">
<extra
android:name="classname"
android:value="com.android.settings.Settings$LongBackgroundTasksActivity" />
</Preference>
<Preference
android:key="manage_external_sources"
android:title="@string/install_other_apps"