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

Commit 757c109f authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Do not throw SecurityException from getPrimaryClip." into sc-dev

parents c0fd5a95 6bc896f7
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -379,7 +379,15 @@ public class ClipboardService extends SystemService {
                return null;
            }
            synchronized (mLock) {
                try {
                    addActiveOwnerLocked(intendingUid, pkg);
                } catch (SecurityException e) {
                    // Permission could not be granted - URI may be invalid
                    Slog.i(TAG, "Could not grant permission to primary clip. Clearing clipboard.");
                    setPrimaryClipInternalLocked(null, intendingUid, pkg);
                    return null;
                }

                PerUserClipboard clipboard = getClipboardLocked(intendingUserId);
                showAccessNotificationLocked(pkg, intendingUid, intendingUserId, clipboard);
                notifyTextClassifierLocked(clipboard, pkg, intendingUid);