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

Commit 20a0e405 authored by Nicolas Prévot's avatar Nicolas Prévot Committed by Android (Google) Code Review
Browse files

Merge "Don't forward an intent if all handlers are suspended."

parents 23b1de11 f15150be
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -5369,9 +5369,15 @@ public class PackageManagerService extends IPackageManager.Stub {
        int targetUserId = filter.getTargetUserId();
        List<ResolveInfo> resultTargetUser = mActivities.queryIntent(intent,
                resolvedType, flags, targetUserId);
        if (resultTargetUser != null && !resultTargetUser.isEmpty()
                && isUserEnabled(targetUserId)) {
            return createForwardingResolveInfoUnchecked(filter, sourceUserId, targetUserId);
        if (resultTargetUser != null && isUserEnabled(targetUserId)) {
            // If all the matches in the target profile are suspended, return null.
            for (int i = resultTargetUser.size() - 1; i >= 0; i--) {
                if ((resultTargetUser.get(i).activityInfo.applicationInfo.flags
                        & ApplicationInfo.FLAG_SUSPENDED) == 0) {
                    return createForwardingResolveInfoUnchecked(filter, sourceUserId,
                            targetUserId);
                }
            }
        }
        return null;
    }