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

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

Merge "Clear cross-profile intent filters in the right user."

parents dec9a216 4afb83e9
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -4994,12 +4994,18 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
            IPackageManager pm = AppGlobals.getPackageManager();
            long id = Binder.clearCallingIdentity();
            try {
                // Removing those that go from the managed profile to the primary user.
                UserInfo parent = mUserManager.getProfileParent(callingUserId);
                if (parent == null) {
                    Slog.e(LOG_TAG, "Cannot call clearCrossProfileIntentFilter if there is no "
                            + "parent");
                    return;
                }
                // Removing those that go from the managed profile to the parent.
                pm.clearCrossProfileIntentFilters(callingUserId, who.getPackageName());
                // And those that go from the primary user to the managed profile.
                // And those that go from the parent to the managed profile.
                // If we want to support multiple managed profiles, we will have to only remove
                // those that have callingUserId as their target.
                pm.clearCrossProfileIntentFilters(UserHandle.USER_OWNER, who.getPackageName());
                pm.clearCrossProfileIntentFilters(parent.id, who.getPackageName());
            } catch (RemoteException re) {
                // Shouldn't happen
            } finally {