Add a permission for CDM apps to start FGS from the background

Previously, any apps with a CDM association was allowed to start
foreground services from the background.

Now, only apps with
REQUEST_COMPANION_START_FOREGROUND_SERVICES_FROM_BACKGROUND
(or REQUEST_COMPANION_RUN_IN_BACKGROUND) are allowed to do so.

Bug: 186536261
Test: Manual test with a test app using CDM. With and without these
    permissions.
Change-Id: Ic00aa1c7cfefc37bf89ea3079ef0977aee12499b
This commit is contained in:
Makoto Onuki
2021-05-13 09:30:42 -07:00
parent b04efdff70
commit dc4aa4b86e
4 changed files with 35 additions and 20 deletions

View File

@@ -141,6 +141,7 @@ package android {
field public static final String REORDER_TASKS = "android.permission.REORDER_TASKS";
field public static final String REQUEST_COMPANION_PROFILE_WATCH = "android.permission.REQUEST_COMPANION_PROFILE_WATCH";
field public static final String REQUEST_COMPANION_RUN_IN_BACKGROUND = "android.permission.REQUEST_COMPANION_RUN_IN_BACKGROUND";
field public static final String REQUEST_COMPANION_START_FOREGROUND_SERVICES_FROM_BACKGROUND = "android.permission.REQUEST_COMPANION_START_FOREGROUND_SERVICES_FROM_BACKGROUND";
field public static final String REQUEST_COMPANION_USE_DATA_IN_BACKGROUND = "android.permission.REQUEST_COMPANION_USE_DATA_IN_BACKGROUND";
field public static final String REQUEST_DELETE_PACKAGES = "android.permission.REQUEST_DELETE_PACKAGES";
field public static final String REQUEST_IGNORE_BATTERY_OPTIMIZATIONS = "android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS";