Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 370fae65 authored by Nikita Dubrovsky's avatar Nikita Dubrovsky
Browse files

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 PermissionPolicyTest
Change-Id: I68abf8c200f6827fc350ab2f990eb78d9d850c8b
parent 836db75e
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -242,6 +242,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";
+3 −3
Original line number Diff line number Diff line
@@ -6026,10 +6026,10 @@
    <permission android:name="android.permission.MANAGE_APPOPS"
                android:protectionLevel="signature" />

    <!-- @hide Permission that allows background clipboard access.
         <p>Not for use by third-party applications. -->
    <!-- @SystemApi Permission that allows background clipboard access.
         @hide Not for use by third-party applications. -->
    <permission android:name="android.permission.READ_CLIPBOARD_IN_BACKGROUND"
        android:protectionLevel="signature" />
        android:protectionLevel="internal|role" />
    <!-- @hide Permission that suppresses the notification when the clipboard is accessed.
         <p>Not for use by third-party applications. -->
    <permission android:name="android.permission.SUPPRESS_CLIPBOARD_ACCESS_NOTIFICATION"