Skip clipboard access toasts for VirtualDevice owner app

When the privileged app which owns a VirtualDevice reads the siloed
clipboard reserved for that VirtualDevice, don't show a toast.

Bug: 276507183
Test: atest StreamedAppClipboardToast
Change-Id: I5d228191e58306980ca77940792e0dda9f1bc875
This commit is contained in:
Antony Sargent
2023-04-24 15:58:32 -07:00
parent 550f35fcdb
commit 62280d26ff

View File

@@ -1389,6 +1389,11 @@ public class ClipboardService extends SystemService {
callingPackage) == PackageManager.PERMISSION_GRANTED) {
return;
}
// Don't notify if this access is coming from the privileged app which owns the device.
if (clipboard.deviceId != DEVICE_ID_DEFAULT && mVdmInternal.getDeviceOwnerUid(
clipboard.deviceId) == uid) {
return;
}
// Don't notify if already notified for this uid and clip.
if (clipboard.mNotifiedUids.get(uid)) {
return;