Add SET_CLIP_SOURCE permission.

This adds a permission that allows the holder to provide the source
package when setting the primary clip in clipboard. This will be done
using a new system API.

This is needed to ensure that the clipboard access notifications can be
properly attributed. For example, when a copy is performed through the
share sheet, the data should be attributed to the app that opened the
share sheet, not Android System.

Bug: 180577866
Test: builds
Change-Id: If3193d476fa923b849b505ad8b6dd893a2feae8f
This commit is contained in:
Oli Lan
2021-02-26 11:16:33 +00:00
parent 22a93daf9f
commit 265752d824
4 changed files with 12 additions and 0 deletions

View File

@@ -247,6 +247,7 @@ package android {
field public static final String SEND_SMS_NO_CONFIRMATION = "android.permission.SEND_SMS_NO_CONFIRMATION";
field public static final String SERIAL_PORT = "android.permission.SERIAL_PORT";
field public static final String SET_ACTIVITY_WATCHER = "android.permission.SET_ACTIVITY_WATCHER";
field public static final String SET_CLIP_SOURCE = "android.permission.SET_CLIP_SOURCE";
field public static final String SET_HARMFUL_APP_WARNINGS = "android.permission.SET_HARMFUL_APP_WARNINGS";
field public static final String SET_MEDIA_KEY_LISTENER = "android.permission.SET_MEDIA_KEY_LISTENER";
field public static final String SET_ORIENTATION = "android.permission.SET_ORIENTATION";

View File

@@ -5566,6 +5566,12 @@
<permission android:name="android.permission.RENOUNCE_PERMISSIONS"
android:protectionLevel="signature|privileged" />
<!-- @SystemApi Allows the holder to set the source of the data when setting a clip on the
clipboard.
@hide -->
<permission android:name="android.permission.SET_CLIP_SOURCE"
android:protectionLevel="signature|recents" />
<!-- Attribution for Geofencing service. -->
<attribution android:tag="GeofencingService" android:label="@string/geofencing_service"/>
<!-- Attribution for Country Detector. -->

View File

@@ -486,6 +486,8 @@ applications that come with the platform
<permission name="android.permission.READ_PEOPLE_DATA" />
<!-- Permission required for CTS test - UiTranslationManagerTest -->
<permission name="android.permission.MANAGE_UI_TRANSLATION" />
<!-- Permission required for CTS test - ClipboardManagerTest -->
<permission name="android.permission.SET_CLIP_SOURCE" />
</privapp-permissions>
<privapp-permissions package="com.android.statementservice">

View File

@@ -421,6 +421,9 @@
<!-- Permission required for CTS test - CtsGameManagerTestCases -->
<uses-permission android:name="android.permission.MANAGE_GAME_MODE" />
<!-- Permission required for CTS test - ClipboardManagerTest -->
<uses-permission android:name="android.permission.SET_CLIP_SOURCE" />
<application android:label="@string/app_label"
android:theme="@android:style/Theme.DeviceDefault.DayNight"
android:defaultToDeviceProtectedStorage="true"