Fix the case where an intent bounces several times between users.
An intent may bounce several times between users.
In this case, we want mContentUserHint to refer to the original
user.
BUG:19656340
Change-Id: I22a35fab0c228140dcb223899f5e38ff33ee5aed
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java
index b1d80f0..c9f9b56 100644
--- a/core/java/android/content/Intent.java
+++ b/core/java/android/content/Intent.java
@@ -6181,8 +6181,12 @@
* who sent the intent.
* @hide
*/
- public void setContentUserHint(int contentUserHint) {
- mContentUserHint = contentUserHint;
+ public void prepareToLeaveUser(int userId) {
+ // If mContentUserHint is not UserHandle.USER_CURRENT, the intent has already left a user.
+ // We want mContentUserHint to refer to the original user, so don't do anything.
+ if (mContentUserHint == UserHandle.USER_CURRENT) {
+ mContentUserHint = userId;
+ }
}
/**