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

Commit 5667a689 authored by Alexandra Gherghina's avatar Alexandra Gherghina
Browse files

Clears previously added cross-profile-intents

Clears the old cross-profile intent filters added by the Settings app.
This makes sure we do not have duplicates and also that there are no
outdated intents being forwarded (intents that do not exist any more).

Bug: 16647771
Change-Id: Ief4f7341e3f984b9435a9757bf469e53227ce2bf
parent a6145a65
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -47,12 +47,15 @@ public class ManagedProfileSetup extends BroadcastReceiver {
            return;
        }

        final PackageManager pm  = context.getPackageManager();
        // Clear any previous intent forwarding we set up
        pm.clearCrossProfileIntentFilters(UserHandle.myUserId());

        // Set up intent forwarding for implicit intents
        Intent intent = new Intent();
        intent.addCategory(Intent.CATEGORY_DEFAULT);
        intent.setPackage(context.getPackageName());

        final PackageManager pm  = context.getPackageManager();
        // Resolves activities for the managed profile (which we're running as)
        List<ResolveInfo> resolvedIntents = pm.queryIntentActivities(intent,
                GET_ACTIVITIES | GET_META_DATA | GET_RESOLVED_FILTER);