am d16f1252: am 60373e80: Merge "Fix the case where an intent bounces several times between users." into mnc-dev

* commit 'd16f1252e1e7924a95388a5479d7bb179279f04c':
  Fix the case where an intent bounces several times between users.
This commit is contained in:
Nicolas Prevot
2015-07-02 10:52:25 +00:00
committed by Android Git Automerger
3 changed files with 9 additions and 5 deletions

View File

@@ -6181,8 +6181,12 @@ public class Intent implements Parcelable, Cloneable {
* 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;
}
}
/**

View File

@@ -87,9 +87,9 @@ public class IntentForwarderActivity extends Activity {
if (canForward(newIntent, targetUserId)) {
if (newIntent.getAction().equals(Intent.ACTION_CHOOSER)) {
Intent innerIntent = (Intent) newIntent.getParcelableExtra(Intent.EXTRA_INTENT);
innerIntent.setContentUserHint(callingUserId);
innerIntent.prepareToLeaveUser(callingUserId);
} else {
newIntent.setContentUserHint(callingUserId);
newIntent.prepareToLeaveUser(callingUserId);
}
final android.content.pm.ResolveInfo ri = getPackageManager().resolveActivityAsUser(

View File

@@ -2829,7 +2829,7 @@ final class ActivityStack {
+ " res=" + resultCode + " data=" + resultData);
if (resultTo.userId != r.userId) {
if (resultData != null) {
resultData.setContentUserHint(r.userId);
resultData.prepareToLeaveUser(r.userId);
}
}
if (r.info.applicationInfo.uid > 0) {