Loading core/java/com/android/internal/app/ResolverActivity.java +0 −12 Original line number Diff line number Diff line Loading @@ -1233,9 +1233,6 @@ public class ResolverActivity extends Activity implements } if (target != null) { if (intent != null && isLaunchingTargetInOtherProfile()) { prepareIntentForCrossProfileLaunch(intent); } safelyStartActivity(target); // Rely on the ActivityManager to pop up a dialog regarding app suspension Loading @@ -1248,15 +1245,6 @@ public class ResolverActivity extends Activity implements return true; } private void prepareIntentForCrossProfileLaunch(Intent intent) { intent.fixUris(UserHandle.myUserId()); } private boolean isLaunchingTargetInOtherProfile() { return mMultiProfilePagerAdapter.getCurrentUserHandle().getIdentifier() != UserHandle.myUserId(); } @VisibleForTesting public void safelyStartActivity(TargetInfo cti) { // We're dispatching intents that might be coming from legacy apps, so Loading core/java/com/android/internal/app/chooser/DisplayResolveInfo.java +2 −0 Original line number Diff line number Diff line Loading @@ -178,6 +178,7 @@ public class DisplayResolveInfo implements TargetInfo { if (ENABLE_CHOOSER_DELEGATE) { return activity.startAsCallerImpl(mResolvedIntent, options, false, userId); } else { TargetInfo.prepareIntentForCrossProfileLaunch(mResolvedIntent, userId); activity.startActivityAsCaller(mResolvedIntent, options, null, false, userId); return true; } Loading @@ -185,6 +186,7 @@ public class DisplayResolveInfo implements TargetInfo { @Override public boolean startAsUser(Activity activity, Bundle options, UserHandle user) { TargetInfo.prepareIntentForCrossProfileLaunch(mResolvedIntent, user.getIdentifier()); activity.startActivityAsUser(mResolvedIntent, options, user); return false; } Loading core/java/com/android/internal/app/chooser/SelectableTargetInfo.java +1 −0 Original line number Diff line number Diff line Loading @@ -230,6 +230,7 @@ public final class SelectableTargetInfo implements ChooserTargetInfo { } intent.setComponent(mChooserTarget.getComponentName()); intent.putExtras(mChooserTarget.getIntentExtras()); TargetInfo.prepareIntentForCrossProfileLaunch(intent, userId); // Important: we will ignore the target security checks in ActivityManager // if and only if the ChooserTarget's target package is the same package Loading core/java/com/android/internal/app/chooser/TargetInfo.java +11 −0 Original line number Diff line number Diff line Loading @@ -130,4 +130,15 @@ public interface TargetInfo { * @return true if this target should be pinned to the front by the request of the user */ boolean isPinned(); /** * Fix the URIs in {@code intent} if cross-profile sharing is required. This should be called * before launching the intent as another user. */ static void prepareIntentForCrossProfileLaunch(Intent intent, int targetUserId) { final int currentUserId = UserHandle.myUserId(); if (targetUserId != currentUserId) { intent.fixUris(currentUserId); } } } Loading
core/java/com/android/internal/app/ResolverActivity.java +0 −12 Original line number Diff line number Diff line Loading @@ -1233,9 +1233,6 @@ public class ResolverActivity extends Activity implements } if (target != null) { if (intent != null && isLaunchingTargetInOtherProfile()) { prepareIntentForCrossProfileLaunch(intent); } safelyStartActivity(target); // Rely on the ActivityManager to pop up a dialog regarding app suspension Loading @@ -1248,15 +1245,6 @@ public class ResolverActivity extends Activity implements return true; } private void prepareIntentForCrossProfileLaunch(Intent intent) { intent.fixUris(UserHandle.myUserId()); } private boolean isLaunchingTargetInOtherProfile() { return mMultiProfilePagerAdapter.getCurrentUserHandle().getIdentifier() != UserHandle.myUserId(); } @VisibleForTesting public void safelyStartActivity(TargetInfo cti) { // We're dispatching intents that might be coming from legacy apps, so Loading
core/java/com/android/internal/app/chooser/DisplayResolveInfo.java +2 −0 Original line number Diff line number Diff line Loading @@ -178,6 +178,7 @@ public class DisplayResolveInfo implements TargetInfo { if (ENABLE_CHOOSER_DELEGATE) { return activity.startAsCallerImpl(mResolvedIntent, options, false, userId); } else { TargetInfo.prepareIntentForCrossProfileLaunch(mResolvedIntent, userId); activity.startActivityAsCaller(mResolvedIntent, options, null, false, userId); return true; } Loading @@ -185,6 +186,7 @@ public class DisplayResolveInfo implements TargetInfo { @Override public boolean startAsUser(Activity activity, Bundle options, UserHandle user) { TargetInfo.prepareIntentForCrossProfileLaunch(mResolvedIntent, user.getIdentifier()); activity.startActivityAsUser(mResolvedIntent, options, user); return false; } Loading
core/java/com/android/internal/app/chooser/SelectableTargetInfo.java +1 −0 Original line number Diff line number Diff line Loading @@ -230,6 +230,7 @@ public final class SelectableTargetInfo implements ChooserTargetInfo { } intent.setComponent(mChooserTarget.getComponentName()); intent.putExtras(mChooserTarget.getIntentExtras()); TargetInfo.prepareIntentForCrossProfileLaunch(intent, userId); // Important: we will ignore the target security checks in ActivityManager // if and only if the ChooserTarget's target package is the same package Loading
core/java/com/android/internal/app/chooser/TargetInfo.java +11 −0 Original line number Diff line number Diff line Loading @@ -130,4 +130,15 @@ public interface TargetInfo { * @return true if this target should be pinned to the front by the request of the user */ boolean isPinned(); /** * Fix the URIs in {@code intent} if cross-profile sharing is required. This should be called * before launching the intent as another user. */ static void prepareIntentForCrossProfileLaunch(Intent intent, int targetUserId) { final int currentUserId = UserHandle.myUserId(); if (targetUserId != currentUserId) { intent.fixUris(currentUserId); } } }