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

Commit c788487a authored by Alexandra Gherghina's avatar Alexandra Gherghina
Browse files

Removing the NO_CROSS_PROFILE flag for intent forwarding

Bug: 17435289
Change-Id: Iffbecd3cf9338a8633bfcc5bc47247bfc50e7546
parent 5f183f06
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -200,12 +200,6 @@ public abstract class PackageManager {
     */
    public static final int MATCH_DEFAULT_ONLY   = 0x00010000;

    /**
     * Resolution and querying flag: do not resolve intents cross-profile.
     * @hide
     */
    public static final int NO_CROSS_PROFILE = 0x00020000;

    /**
     * Flag for {@link addCrossProfileIntentFilter}: if this flag is set:
     * when resolving an intent that matches the {@link CrossProfileIntentFilter}, the current
@@ -2431,7 +2425,6 @@ public abstract class PackageManager {
     * @see #MATCH_DEFAULT_ONLY
     * @see #GET_INTENT_FILTERS
     * @see #GET_RESOLVED_FILTER
     * @see #NO_CROSS_PROFILE
     * @hide
     */
    public abstract List<ResolveInfo> queryIntentActivitiesAsUser(Intent intent,
+2 −4
Original line number Diff line number Diff line
@@ -199,8 +199,7 @@ public class LauncherAppsService extends SystemService {
            mainIntent.setPackage(packageName);
            long ident = Binder.clearCallingIdentity();
            try {
                List<ResolveInfo> apps = mPm.queryIntentActivitiesAsUser(mainIntent,
                        PackageManager.NO_CROSS_PROFILE, // We only want the apps for this user
                List<ResolveInfo> apps = mPm.queryIntentActivitiesAsUser(mainIntent, 0 /* flags */,
                        user.getIdentifier());
                return apps;
            } finally {
@@ -288,8 +287,7 @@ public class LauncherAppsService extends SystemService {
                // as calling startActivityAsUser ignores the category and just
                // resolves based on the component if present.
                List<ResolveInfo> apps = mPm.queryIntentActivitiesAsUser(launchIntent,
                        PackageManager.NO_CROSS_PROFILE, // We only want the apps for this user
                        user.getIdentifier());
                        0 /* flags */, user.getIdentifier());
                final int size = apps.size();
                for (int i = 0; i < size; ++i) {
                    ActivityInfo activityInfo = apps.get(i).activityInfo;
+28 −31
Original line number Diff line number Diff line
@@ -3240,10 +3240,9 @@ public class PackageManagerService extends IPackageManager.Stub {
        // reader
        synchronized (mPackages) {
            final String pkgName = intent.getPackage();
            boolean queryCrossProfile = (flags & PackageManager.NO_CROSS_PROFILE) == 0;
            if (pkgName == null) {
                ResolveInfo resolveInfo = null;
                if (queryCrossProfile) {
                // Check if the intent needs to be forwarded to another user for this package
                ArrayList<ResolveInfo> crossProfileResult =
                        queryIntentActivitiesCrossProfilePackage(
@@ -3265,7 +3264,7 @@ public class PackageManagerService extends IPackageManager.Stub {
                // Check for cross profile results.
                resolveInfo = queryCrossProfileIntents(
                        matchingFilters, intent, resolvedType, flags, userId);
                }
                // Check for results in the current profile.
                List<ResolveInfo> result = mActivities.queryIntent(
                        intent, resolvedType, flags, userId);
@@ -3277,7 +3276,6 @@ public class PackageManagerService extends IPackageManager.Stub {
            }
            final PackageParser.Package pkg = mPackages.get(pkgName);
            if (pkg != null) {
                if (queryCrossProfile) {
                ArrayList<ResolveInfo> crossProfileResult =
                        queryIntentActivitiesCrossProfilePackage(
                                intent, resolvedType, flags, userId, pkg, pkgName);
@@ -3285,7 +3283,6 @@ public class PackageManagerService extends IPackageManager.Stub {
                    // Skip the current profile
                    return crossProfileResult;
                }
                }
                return mActivities.queryIntentForPackage(intent, resolvedType, flags,
                        pkg.activities, userId);
            }