From 4fa6711c0074e2628e4929d585764991a18cba89 Mon Sep 17 00:00:00 2001 From: Nikita Dubrovsky Date: Wed, 9 Mar 2022 13:20:29 -0800 Subject: [PATCH] Update READ_CLIPBOARD_IN_BACKGROUND to be grantable via roles ClipboardService currently has a special case to allow Android System Intelligence to read the clipboard in the background. The special case is implemented by checking if the calling package is the provider of ContentCaptureService. Rather than having to maintain this special case, we want to reuse the existing READ_CLIPBOARD_IN_BACKGROUND permission by allowing it to be associated with roles. This way the permission will be associated with the appropriate role held by Android System Intelligence and the special case can be removed from ClipboardService. This also decouples which PCC package provides ContentCaptureService vs which PCC package should be allowed to access the clipboard. The change to remove the special case logic from ClipboardService will be done as a separate CL. Bug: 216314180 Test: atest CtsPermission2TestCases:PermissionPolicyTest Test: atest CtsContentTestCases:ClipboardManagerTest Test: atest IntentResolverUnitTests:UnbundledChooserActivityTest Test: atest TextClassifierNotificationTests:CopyCodeActivityTest Change-Id: Ia9ddc7a4f883691c202bece7d9376bd95e6a14b7 --- core/api/system-current.txt | 1 + core/res/AndroidManifest.xml | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/core/api/system-current.txt b/core/api/system-current.txt index c06acc980806d..d27c2b6329b4a 100644 --- a/core/api/system-current.txt +++ b/core/api/system-current.txt @@ -244,6 +244,7 @@ package android { field public static final String READ_APP_SPECIFIC_LOCALES = "android.permission.READ_APP_SPECIFIC_LOCALES"; field public static final String READ_CARRIER_APP_INFO = "android.permission.READ_CARRIER_APP_INFO"; field public static final String READ_CELL_BROADCASTS = "android.permission.READ_CELL_BROADCASTS"; + field public static final String READ_CLIPBOARD_IN_BACKGROUND = "android.permission.READ_CLIPBOARD_IN_BACKGROUND"; field public static final String READ_CONTENT_RATING_SYSTEMS = "android.permission.READ_CONTENT_RATING_SYSTEMS"; field public static final String READ_DEVICE_CONFIG = "android.permission.READ_DEVICE_CONFIG"; field public static final String READ_DREAM_STATE = "android.permission.READ_DREAM_STATE"; diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml index d652b2ff4f4a8..58d8cdae60fc7 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -6051,10 +6051,10 @@ - + + android:protectionLevel="signature|role" />