Loading api/current.txt +1 −1 Original line number Diff line number Diff line Loading @@ -11560,7 +11560,7 @@ package android.content.pm { method @NonNull public android.graphics.drawable.Drawable getProfileSwitchingIconDrawable(@NonNull android.os.UserHandle); 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); 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 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 +10 −2 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.RequiresPermission; import android.annotation.SystemApi; import android.app.Activity; import android.app.AppOpsManager.Mode; import android.content.ComponentName; import android.content.Context; Loading Loading @@ -116,18 +117,25 @@ public class CrossProfileApps { * @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. */ @RequiresPermission(anyOf = { android.Manifest.permission.INTERACT_ACROSS_PROFILES, android.Manifest.permission.INTERACT_ACROSS_USERS}) public void startActivity(@NonNull Intent intent, @NonNull UserHandle targetUser) { public void startActivity( @NonNull Intent intent, @NonNull UserHandle targetUser, @Nullable Activity callingActivity) { try { mService.startActivityAsUserByIntent( mContext.getIApplicationThread(), mContext.getPackageName(), mContext.getFeatureId(), intent, targetUser.getIdentifier()); targetUser.getIdentifier(), callingActivity != null ? callingActivity.getActivityToken() : null); } catch (RemoteException ex) { throw ex.rethrowFromSystemServer(); } Loading core/java/android/content/pm/ICrossProfileApps.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -31,7 +31,7 @@ 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 String callingFeatureId, in Intent intent, int userId, in IBinder callingActivity); 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 +15 −3 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.IBinder; import android.os.RemoteException; import android.os.UserHandle; import android.os.UserManager; Loading Loading @@ -167,6 +168,8 @@ public class CrossProfileAppsServiceImpl extends ICrossProfileApps.Stub { launchIntent.setComponent(component); mInjector.getActivityTaskManagerInternal().startActivityAsUser( caller, callingPackage, callingFeatureId, launchIntent, /* resultTo= */ null, Intent.FLAG_ACTIVITY_NEW_TASK, launchMainActivity ? ActivityOptions.makeOpenCrossProfileAppsAnimation().toBundle() : null, Loading @@ -179,7 +182,8 @@ public class CrossProfileAppsServiceImpl extends ICrossProfileApps.Stub { String callingPackage, String callingFeatureId, Intent intent, @UserIdInt int userId) throws RemoteException { @UserIdInt int userId, IBinder callingActivity) throws RemoteException { Objects.requireNonNull(callingPackage); Objects.requireNonNull(intent); Objects.requireNonNull(intent.getComponent(), "The intent must have a Component set"); Loading Loading @@ -214,8 +218,16 @@ public class CrossProfileAppsServiceImpl extends ICrossProfileApps.Stub { verifyActivityCanHandleIntent(launchIntent, callingUid, userId); mInjector.getActivityTaskManagerInternal().startActivityAsUser(caller, callingPackage, callingFeatureId, launchIntent, /* options= */ null, userId); mInjector.getActivityTaskManagerInternal() .startActivityAsUser( caller, callingPackage, callingFeatureId, launchIntent, callingActivity, /* startFlags= */ 0, /* options= */ null, userId); logStartActivityByIntent(callingPackage); } Loading services/core/java/com/android/server/pm/LauncherAppsService.java +6 −3 Original line number Diff line number Diff line Loading @@ -896,7 +896,8 @@ public class LauncherAppsService extends SystemService { i.setSourceBounds(sourceBounds); mActivityTaskManagerInternal.startActivityAsUser(caller, callingPackage, callingFeatureId, i, opts, userId); callingFeatureId, i, /* resultTo= */ null, Intent.FLAG_ACTIVITY_NEW_TASK, opts, userId); } @Override Loading Loading @@ -955,7 +956,8 @@ public class LauncherAppsService extends SystemService { Binder.restoreCallingIdentity(ident); } mActivityTaskManagerInternal.startActivityAsUser(caller, callingPackage, callingFeatureId, launchIntent, opts, user.getIdentifier()); callingFeatureId, launchIntent, /* resultTo= */ null, Intent.FLAG_ACTIVITY_NEW_TASK, opts, user.getIdentifier()); } @Override Loading @@ -978,7 +980,8 @@ public class LauncherAppsService extends SystemService { Binder.restoreCallingIdentity(ident); } mActivityTaskManagerInternal.startActivityAsUser(caller, callingPackage, callingFeatureId, intent, opts, user.getIdentifier()); callingFeatureId, intent, /* resultTo= */ null, Intent.FLAG_ACTIVITY_NEW_TASK, opts, user.getIdentifier()); } /** Checks if user is a profile of or same as listeningUser. Loading Loading
api/current.txt +1 −1 Original line number Diff line number Diff line Loading @@ -11560,7 +11560,7 @@ package android.content.pm { method @NonNull public android.graphics.drawable.Drawable getProfileSwitchingIconDrawable(@NonNull android.os.UserHandle); 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); 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 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 +10 −2 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.RequiresPermission; import android.annotation.SystemApi; import android.app.Activity; import android.app.AppOpsManager.Mode; import android.content.ComponentName; import android.content.Context; Loading Loading @@ -116,18 +117,25 @@ public class CrossProfileApps { * @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. */ @RequiresPermission(anyOf = { android.Manifest.permission.INTERACT_ACROSS_PROFILES, android.Manifest.permission.INTERACT_ACROSS_USERS}) public void startActivity(@NonNull Intent intent, @NonNull UserHandle targetUser) { public void startActivity( @NonNull Intent intent, @NonNull UserHandle targetUser, @Nullable Activity callingActivity) { try { mService.startActivityAsUserByIntent( mContext.getIApplicationThread(), mContext.getPackageName(), mContext.getFeatureId(), intent, targetUser.getIdentifier()); targetUser.getIdentifier(), callingActivity != null ? callingActivity.getActivityToken() : null); } catch (RemoteException ex) { throw ex.rethrowFromSystemServer(); } Loading
core/java/android/content/pm/ICrossProfileApps.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -31,7 +31,7 @@ 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 String callingFeatureId, in Intent intent, int userId, in IBinder callingActivity); 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 +15 −3 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.IBinder; import android.os.RemoteException; import android.os.UserHandle; import android.os.UserManager; Loading Loading @@ -167,6 +168,8 @@ public class CrossProfileAppsServiceImpl extends ICrossProfileApps.Stub { launchIntent.setComponent(component); mInjector.getActivityTaskManagerInternal().startActivityAsUser( caller, callingPackage, callingFeatureId, launchIntent, /* resultTo= */ null, Intent.FLAG_ACTIVITY_NEW_TASK, launchMainActivity ? ActivityOptions.makeOpenCrossProfileAppsAnimation().toBundle() : null, Loading @@ -179,7 +182,8 @@ public class CrossProfileAppsServiceImpl extends ICrossProfileApps.Stub { String callingPackage, String callingFeatureId, Intent intent, @UserIdInt int userId) throws RemoteException { @UserIdInt int userId, IBinder callingActivity) throws RemoteException { Objects.requireNonNull(callingPackage); Objects.requireNonNull(intent); Objects.requireNonNull(intent.getComponent(), "The intent must have a Component set"); Loading Loading @@ -214,8 +218,16 @@ public class CrossProfileAppsServiceImpl extends ICrossProfileApps.Stub { verifyActivityCanHandleIntent(launchIntent, callingUid, userId); mInjector.getActivityTaskManagerInternal().startActivityAsUser(caller, callingPackage, callingFeatureId, launchIntent, /* options= */ null, userId); mInjector.getActivityTaskManagerInternal() .startActivityAsUser( caller, callingPackage, callingFeatureId, launchIntent, callingActivity, /* startFlags= */ 0, /* options= */ null, userId); logStartActivityByIntent(callingPackage); } Loading
services/core/java/com/android/server/pm/LauncherAppsService.java +6 −3 Original line number Diff line number Diff line Loading @@ -896,7 +896,8 @@ public class LauncherAppsService extends SystemService { i.setSourceBounds(sourceBounds); mActivityTaskManagerInternal.startActivityAsUser(caller, callingPackage, callingFeatureId, i, opts, userId); callingFeatureId, i, /* resultTo= */ null, Intent.FLAG_ACTIVITY_NEW_TASK, opts, userId); } @Override Loading Loading @@ -955,7 +956,8 @@ public class LauncherAppsService extends SystemService { Binder.restoreCallingIdentity(ident); } mActivityTaskManagerInternal.startActivityAsUser(caller, callingPackage, callingFeatureId, launchIntent, opts, user.getIdentifier()); callingFeatureId, launchIntent, /* resultTo= */ null, Intent.FLAG_ACTIVITY_NEW_TASK, opts, user.getIdentifier()); } @Override Loading @@ -978,7 +980,8 @@ public class LauncherAppsService extends SystemService { Binder.restoreCallingIdentity(ident); } mActivityTaskManagerInternal.startActivityAsUser(caller, callingPackage, callingFeatureId, intent, opts, user.getIdentifier()); callingFeatureId, intent, /* resultTo= */ null, Intent.FLAG_ACTIVITY_NEW_TASK, opts, user.getIdentifier()); } /** Checks if user is a profile of or same as listeningUser. Loading