diff options
| author | 2016-07-19 16:06:43 +0000 | |
|---|---|---|
| committer | 2016-07-19 16:06:44 +0000 | |
| commit | e723ed8b51c3dea7b662b5c1bed07e98773f78eb (patch) | |
| tree | 58edf8af7d146f5b55992bfb10608d7db6e5e0b0 | |
| parent | fb0ec9de846debcddfeadce4412b7e452eb2d1a7 (diff) | |
| parent | 58926243e0b4b760f87e86a15915c0b2a707f3bb (diff) | |
Merge "Don't append userIds for the current user's clipData uris." into nyc-mr1-dev
| -rw-r--r-- | core/java/android/content/ClipData.java | 13 | ||||
| -rw-r--r-- | services/core/java/com/android/server/clipboard/ClipboardService.java | 8 |
2 files changed, 21 insertions, 0 deletions
diff --git a/core/java/android/content/ClipData.java b/core/java/android/content/ClipData.java index c365e9ee9549..d9816a64db3a 100644 --- a/core/java/android/content/ClipData.java +++ b/core/java/android/content/ClipData.java @@ -191,6 +191,14 @@ public class ClipData implements Parcelable { final Intent mIntent; Uri mUri; + /** @hide */ + public Item(Item other) { + mText = other.mText; + mHtmlText = other.mHtmlText; + mIntent = other.mIntent; + mUri = other.mUri; + } + /** * Create an Item consisting of a single block of (possibly styled) text. */ @@ -816,6 +824,11 @@ public class ClipData implements Parcelable { return mItems.get(index); } + /** @hide */ + public void setItemAt(int index, Item item) { + mItems.set(index, item); + } + /** * Prepare this {@link ClipData} to leave an app process. * diff --git a/services/core/java/com/android/server/clipboard/ClipboardService.java b/services/core/java/com/android/server/clipboard/ClipboardService.java index 1c2684642c53..66aa40325a4f 100644 --- a/services/core/java/com/android/server/clipboard/ClipboardService.java +++ b/services/core/java/com/android/server/clipboard/ClipboardService.java @@ -188,6 +188,14 @@ public class ClipboardService extends IClipboard.Stub { if (!canCopy) { clip = null; } else { + // We want to fix the uris of the related user's clip without changing the + // uris of the current user's clip. + // So, copy the ClipData, and then copy all the items, so that nothing + // is shared in memmory. + clip = new ClipData(clip); + for (int i = clip.getItemCount() - 1; i >= 0; i--) { + clip.setItemAt(i, new ClipData.Item(clip.getItemAt(i))); + } clip.fixUrisLight(userId); } for (int i = 0; i < size; i++) { |