From 5667a6890a98cd4e4b83f1787ea272ca2968d8c9 Mon Sep 17 00:00:00 2001 From: Alexandra Gherghina Date: Tue, 29 Jul 2014 14:55:56 +0100 Subject: [PATCH] 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 --- src/com/android/settings/ManagedProfileSetup.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/com/android/settings/ManagedProfileSetup.java b/src/com/android/settings/ManagedProfileSetup.java index 86772194b55..1b3c83876cd 100644 --- a/src/com/android/settings/ManagedProfileSetup.java +++ b/src/com/android/settings/ManagedProfileSetup.java @@ -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 resolvedIntents = pm.queryIntentActivities(intent, GET_ACTIVITIES | GET_META_DATA | GET_RESOLVED_FILTER);