Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit de77b6fe authored by Varun Shah's avatar Varun Shah Committed by Android (Google) Code Review
Browse files

Merge "Clarified CrossProfileApps API and documentation."

parents 20581a35 bdb849f8
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1336,7 +1336,7 @@ package android.content.pm {
  }
  public class CrossProfileApps {
    method public void startAnyActivity(android.content.ComponentName, android.os.UserHandle);
    method public void startActivity(android.content.ComponentName, android.os.UserHandle);
  }
  public final class InstantAppInfo implements android.os.Parcelable {
+19 −4
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package android.content.pm;
import android.annotation.NonNull;
import android.annotation.RequiresPermission;
import android.annotation.SystemApi;
import android.annotation.UnsupportedAppUsage;
import android.content.ComponentName;
import android.content.Context;
import android.content.res.Resources;
@@ -76,9 +77,23 @@ public class CrossProfileApps {
    }

    /**
     * Starts the specified activity of the caller package in the specified profile if the caller
     * has {@link android.Manifest.permission#INTERACT_ACROSS_PROFILES} permission and
     * both the caller and target user profiles are in the same user group.
     * @deprecated use {@link #startActivity(ComponentName, UserHandle)} instead.
     *
     * @removed
     * @hide
     */
    @Deprecated
    @UnsupportedAppUsage
    public void startAnyActivity(@NonNull ComponentName component, @NonNull UserHandle targetUser) {
        startActivity(component, targetUser);
    }

    /**
     * Starts the specified activity of the caller package in the specified profile. Unlike
     * {@link #startMainActivity}, this can start any activity of the caller package, not just
     * the main activity.
     * The caller must have the {@link android.Manifest.permission#INTERACT_ACROSS_PROFILES}
     * permission and both the caller and target user profiles must be in the same profile group.
     *
     * @param component The ComponentName of the activity to launch. It must be exported.
     * @param targetUser The UserHandle of the profile, must be one of the users returned by
@@ -88,7 +103,7 @@ public class CrossProfileApps {
     */
    @SystemApi
    @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_PROFILES)
    public void startAnyActivity(@NonNull ComponentName component, @NonNull UserHandle targetUser) {
    public void startActivity(@NonNull ComponentName component, @NonNull UserHandle targetUser) {
        try {
            mService.startActivityAsUser(mContext.getIApplicationThread(),
                    mContext.getPackageName(), component, targetUser.getIdentifier(), false);
+3 −2
Original line number Diff line number Diff line
@@ -2210,8 +2210,9 @@
    <permission android:name="android.permission.INTERACT_ACROSS_USERS_FULL"
        android:protectionLevel="signature|installer" />

    <!-- @SystemApi Allows an application to start an activity within its managed profile from
         the personal profile.
    <!-- @SystemApi Allows an application to start its own activities, but on a different profile
         associated with the user. For example, an application running on the main profile of a user
         can start an activity on a managed profile of that user.
         This permission is not available to third party applications.
         @hide -->
    <permission android:name="android.permission.INTERACT_ACROSS_PROFILES"