summaryrefslogtreecommitdiff
path: root/core/java/android/content/ClipData.java
diff options
context:
space:
mode:
authorNicolas Prevot <nprevot@google.com>2014-04-16 19:52:08 +0100
committerNicolas Prevot <nprevot@google.com>2014-05-13 14:59:52 +0100
commitd85fc72fb810858f7502e7e7f1bad53e1bf03edd (patch)
tree01c4624393d93312774716cf3233bcdcacf8243f /core/java/android/content/ClipData.java
parent2ac997917924161ed2eed5f4387246beb58c456e (diff)
Resolving resources across users.
When an intent is sent to another profile: For content uris contained in this intent: The userId of the source user is added to the userInfo part. The ActivityManagerService has been modified to resolve resources in the user specified by the uri. The user id to which the uri belongs to is stored in the UriPermission. Change-Id: I43dc76895aba692bf148d276253aeaf9c75fce34
Diffstat (limited to 'core/java/android/content/ClipData.java')
-rw-r--r--core/java/android/content/ClipData.java21
1 files changed, 20 insertions, 1 deletions
diff --git a/core/java/android/content/ClipData.java b/core/java/android/content/ClipData.java
index 50c4feda60b1..b44abf93eca2 100644
--- a/core/java/android/content/ClipData.java
+++ b/core/java/android/content/ClipData.java
@@ -16,6 +16,7 @@
package android.content;
+import static android.content.ContentProvider.maybeAddUserId;
import android.content.res.AssetFileDescriptor;
import android.graphics.Bitmap;
import android.net.Uri;
@@ -186,7 +187,7 @@ public class ClipData implements Parcelable {
final CharSequence mText;
final String mHtmlText;
final Intent mIntent;
- final Uri mUri;
+ Uri mUri;
/**
* Create an Item consisting of a single block of (possibly styled) text.
@@ -809,6 +810,24 @@ public class ClipData implements Parcelable {
}
}
+ /**
+ * Prepare this {@link ClipData} to leave an app process.
+ *
+ * @hide
+ */
+ public void prepareToLeaveUser(int userId) {
+ final int size = mItems.size();
+ for (int i = 0; i < size; i++) {
+ final Item item = mItems.get(i);
+ if (item.mIntent != null) {
+ item.mIntent.prepareToLeaveUser(userId);
+ }
+ if (item.mUri != null) {
+ item.mUri = maybeAddUserId(item.mUri, userId);
+ }
+ }
+ }
+
@Override
public String toString() {
StringBuilder b = new StringBuilder(128);