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

Commit bf491bdf authored by Sarup Dalwani's avatar Sarup Dalwani Committed by Android (Google) Code Review
Browse files

Merge "Creating internal only getActivityInfo for Cross Profile"

parents bb926946 76140770
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -124,6 +124,14 @@ public interface Computer extends PackageDataSnapshot {
            String instantAppPkgName);
    ActivityInfo getActivityInfo(ComponentName component, long flags, int userId);

    /**
     * Similar to {@link Computer#getActivityInfo(android.content.ComponentName, long, int)} but
     * only visible as internal service. This method bypass INTERACT_ACROSS_USERS or
     * INTERACT_ACROSS_USERS_FULL permission checks and only to be used for intent resolution across
     * chained cross profiles
     */
    ActivityInfo getActivityInfoCrossProfile(ComponentName component, long flags, int userId);

    /**
     * Important: The provided filterCallingUid is used exclusively to filter out activities
     * that can be seen based on user state. It's typically the original caller uid prior
+19 −1
Original line number Diff line number Diff line
@@ -834,6 +834,24 @@ public class ComputerEngine implements Computer {
        return getActivityInfoInternal(component, flags, Binder.getCallingUid(), userId);
    }

    /**
     * Similar to {@link Computer#getActivityInfo(android.content.ComponentName, long, int)} but
     * only visible as internal service. This method bypass INTERACT_ACROSS_USERS or
     * INTERACT_ACROSS_USERS_FULL permission checks and only to be used for intent resolution across
     * chained cross profiles
     * @param component application's component
     * @param flags resolve info flags
     * @param userId user id where activity resides
     * @return ActivityInfo corresponding to requested component.
     */
    public final ActivityInfo getActivityInfoCrossProfile(ComponentName component,
            @PackageManager.ResolveInfoFlagsBits long flags, int userId) {
        if (!mUserManager.exists(userId)) return null;
        flags = updateFlagsForComponent(flags, userId);

        return getActivityInfoInternalBody(component, flags, Binder.getCallingUid(), userId);
    }

    /**
     * Important: The provided filterCallingUid is used exclusively to filter out activities
     * that can be seen based on user state. It's typically the original caller uid prior
@@ -1711,7 +1729,7 @@ public class ComputerEngine implements Computer {
        ComponentName forwardingActivityComponentName = new ComponentName(
                androidApplication().packageName, className);
        ActivityInfo forwardingActivityInfo =
                getActivityInfo(forwardingActivityComponentName, 0,
                getActivityInfoCrossProfile(forwardingActivityComponentName, 0,
                        sourceUserId);
        if (!targetIsProfile) {
            forwardingActivityInfo.showUserIcon = targetUserId;