Loading api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -11572,6 +11572,7 @@ package android.content.pm { method @NonNull public CharSequence getProfileSwitchingLabel(@NonNull android.os.UserHandle); method @NonNull public java.util.List<android.os.UserHandle> getTargetUserProfiles(); method @RequiresPermission(anyOf={android.Manifest.permission.INTERACT_ACROSS_PROFILES, "android.permission.INTERACT_ACROSS_USERS"}) public void startActivity(@NonNull android.content.Intent, @NonNull android.os.UserHandle, @Nullable android.app.Activity); method @RequiresPermission(anyOf={android.Manifest.permission.INTERACT_ACROSS_PROFILES, "android.permission.INTERACT_ACROSS_USERS"}) public void startActivity(@NonNull android.content.Intent, @NonNull android.os.UserHandle, @Nullable android.app.Activity, @Nullable android.os.Bundle); method public void startMainActivity(@NonNull android.content.ComponentName, @NonNull android.os.UserHandle); field public static final String ACTION_CAN_INTERACT_ACROSS_PROFILES_CHANGED = "android.content.pm.action.CAN_INTERACT_ACROSS_PROFILES_CHANGED"; } core/java/android/content/pm/CrossProfileApps.java +32 −1 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import android.content.Intent; import android.content.res.Resources; import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.Bundle; import android.os.RemoteException; import android.os.UserHandle; import android.os.UserManager; Loading Loading @@ -128,6 +129,35 @@ public class CrossProfileApps { @NonNull Intent intent, @NonNull UserHandle targetUser, @Nullable Activity callingActivity) { startActivity(intent, targetUser, callingActivity, /* options= */ null); } /** * Starts the specified activity of the caller package in the specified profile. * * <p>The caller must have the {@link android.Manifest.permission#INTERACT_ACROSS_PROFILES}, * {@code android.Manifest.permission#INTERACT_ACROSS_USERS}, or {@code * android.Manifest.permission#INTERACT_ACROSS_USERS_FULL} permission. Both the caller and * target user profiles must be in the same profile group. The target user must be a valid user * returned from {@link #getTargetUserProfiles()}. * * @param intent The intent to launch. A component in the caller package must be specified. * @param targetUser The {@link UserHandle} of the profile; must be one of the users returned by * {@link #getTargetUserProfiles()} if different to the calling user, otherwise a * {@link SecurityException} will be thrown. * @param callingActivity The activity to start the new activity from for the purposes of * deciding which task the new activity should belong to. If {@code null}, the activity * will always be started in a new task. * @param options The activity options or {@code null}. See {@link android.app.ActivityOptions}. */ @RequiresPermission(anyOf = { android.Manifest.permission.INTERACT_ACROSS_PROFILES, android.Manifest.permission.INTERACT_ACROSS_USERS}) public void startActivity( @NonNull Intent intent, @NonNull UserHandle targetUser, @Nullable Activity callingActivity, @Nullable Bundle options) { try { mService.startActivityAsUserByIntent( mContext.getIApplicationThread(), Loading @@ -135,7 +165,8 @@ public class CrossProfileApps { mContext.getFeatureId(), intent, targetUser.getIdentifier(), callingActivity != null ? callingActivity.getActivityToken() : null); callingActivity != null ? callingActivity.getActivityToken() : null, options); } catch (RemoteException ex) { throw ex.rethrowFromSystemServer(); } Loading core/java/android/content/pm/ICrossProfileApps.aidl +2 −1 Original line number Diff line number Diff line Loading @@ -31,7 +31,8 @@ interface ICrossProfileApps { in String callingFeatureId, in ComponentName component, int userId, boolean launchMainActivity); void startActivityAsUserByIntent(in IApplicationThread caller, in String callingPackage, in String callingFeatureId, in Intent intent, int userId, in IBinder callingActivity); in String callingFeatureId, in Intent intent, int userId, in IBinder callingActivity, in Bundle options); List<UserHandle> getTargetUserProfiles(in String callingPackage); boolean canInteractAcrossProfiles(in String callingPackage); boolean canRequestInteractAcrossProfiles(in String callingPackage); Loading services/core/java/com/android/server/pm/CrossProfileAppsServiceImpl.java +4 −2 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ import android.content.pm.PackageManager; import android.content.pm.PackageManagerInternal; import android.content.pm.ResolveInfo; import android.os.Binder; import android.os.Bundle; import android.os.IBinder; import android.os.RemoteException; import android.os.UserHandle; Loading Loading @@ -183,7 +184,8 @@ public class CrossProfileAppsServiceImpl extends ICrossProfileApps.Stub { String callingFeatureId, Intent intent, @UserIdInt int userId, IBinder callingActivity) throws RemoteException { IBinder callingActivity, Bundle options) throws RemoteException { Objects.requireNonNull(callingPackage); Objects.requireNonNull(intent); Objects.requireNonNull(intent.getComponent(), "The intent must have a Component set"); Loading Loading @@ -226,7 +228,7 @@ public class CrossProfileAppsServiceImpl extends ICrossProfileApps.Stub { launchIntent, callingActivity, /* startFlags= */ 0, /* options= */ null, options, userId); logStartActivityByIntent(callingPackage); } Loading Loading
api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -11572,6 +11572,7 @@ package android.content.pm { method @NonNull public CharSequence getProfileSwitchingLabel(@NonNull android.os.UserHandle); method @NonNull public java.util.List<android.os.UserHandle> getTargetUserProfiles(); method @RequiresPermission(anyOf={android.Manifest.permission.INTERACT_ACROSS_PROFILES, "android.permission.INTERACT_ACROSS_USERS"}) public void startActivity(@NonNull android.content.Intent, @NonNull android.os.UserHandle, @Nullable android.app.Activity); method @RequiresPermission(anyOf={android.Manifest.permission.INTERACT_ACROSS_PROFILES, "android.permission.INTERACT_ACROSS_USERS"}) public void startActivity(@NonNull android.content.Intent, @NonNull android.os.UserHandle, @Nullable android.app.Activity, @Nullable android.os.Bundle); method public void startMainActivity(@NonNull android.content.ComponentName, @NonNull android.os.UserHandle); field public static final String ACTION_CAN_INTERACT_ACROSS_PROFILES_CHANGED = "android.content.pm.action.CAN_INTERACT_ACROSS_PROFILES_CHANGED"; }
core/java/android/content/pm/CrossProfileApps.java +32 −1 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import android.content.Intent; import android.content.res.Resources; import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.Bundle; import android.os.RemoteException; import android.os.UserHandle; import android.os.UserManager; Loading Loading @@ -128,6 +129,35 @@ public class CrossProfileApps { @NonNull Intent intent, @NonNull UserHandle targetUser, @Nullable Activity callingActivity) { startActivity(intent, targetUser, callingActivity, /* options= */ null); } /** * Starts the specified activity of the caller package in the specified profile. * * <p>The caller must have the {@link android.Manifest.permission#INTERACT_ACROSS_PROFILES}, * {@code android.Manifest.permission#INTERACT_ACROSS_USERS}, or {@code * android.Manifest.permission#INTERACT_ACROSS_USERS_FULL} permission. Both the caller and * target user profiles must be in the same profile group. The target user must be a valid user * returned from {@link #getTargetUserProfiles()}. * * @param intent The intent to launch. A component in the caller package must be specified. * @param targetUser The {@link UserHandle} of the profile; must be one of the users returned by * {@link #getTargetUserProfiles()} if different to the calling user, otherwise a * {@link SecurityException} will be thrown. * @param callingActivity The activity to start the new activity from for the purposes of * deciding which task the new activity should belong to. If {@code null}, the activity * will always be started in a new task. * @param options The activity options or {@code null}. See {@link android.app.ActivityOptions}. */ @RequiresPermission(anyOf = { android.Manifest.permission.INTERACT_ACROSS_PROFILES, android.Manifest.permission.INTERACT_ACROSS_USERS}) public void startActivity( @NonNull Intent intent, @NonNull UserHandle targetUser, @Nullable Activity callingActivity, @Nullable Bundle options) { try { mService.startActivityAsUserByIntent( mContext.getIApplicationThread(), Loading @@ -135,7 +165,8 @@ public class CrossProfileApps { mContext.getFeatureId(), intent, targetUser.getIdentifier(), callingActivity != null ? callingActivity.getActivityToken() : null); callingActivity != null ? callingActivity.getActivityToken() : null, options); } catch (RemoteException ex) { throw ex.rethrowFromSystemServer(); } Loading
core/java/android/content/pm/ICrossProfileApps.aidl +2 −1 Original line number Diff line number Diff line Loading @@ -31,7 +31,8 @@ interface ICrossProfileApps { in String callingFeatureId, in ComponentName component, int userId, boolean launchMainActivity); void startActivityAsUserByIntent(in IApplicationThread caller, in String callingPackage, in String callingFeatureId, in Intent intent, int userId, in IBinder callingActivity); in String callingFeatureId, in Intent intent, int userId, in IBinder callingActivity, in Bundle options); List<UserHandle> getTargetUserProfiles(in String callingPackage); boolean canInteractAcrossProfiles(in String callingPackage); boolean canRequestInteractAcrossProfiles(in String callingPackage); Loading
services/core/java/com/android/server/pm/CrossProfileAppsServiceImpl.java +4 −2 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ import android.content.pm.PackageManager; import android.content.pm.PackageManagerInternal; import android.content.pm.ResolveInfo; import android.os.Binder; import android.os.Bundle; import android.os.IBinder; import android.os.RemoteException; import android.os.UserHandle; Loading Loading @@ -183,7 +184,8 @@ public class CrossProfileAppsServiceImpl extends ICrossProfileApps.Stub { String callingFeatureId, Intent intent, @UserIdInt int userId, IBinder callingActivity) throws RemoteException { IBinder callingActivity, Bundle options) throws RemoteException { Objects.requireNonNull(callingPackage); Objects.requireNonNull(intent); Objects.requireNonNull(intent.getComponent(), "The intent must have a Component set"); Loading Loading @@ -226,7 +228,7 @@ public class CrossProfileAppsServiceImpl extends ICrossProfileApps.Stub { launchIntent, callingActivity, /* startFlags= */ 0, /* options= */ null, options, userId); logStartActivityByIntent(callingPackage); } Loading