From ce2125e647a03e27abd16d4098f7acdfe328c1b4 Mon Sep 17 00:00:00 2001 From: Martin Fietz Date: Fri, 10 Jun 2016 19:57:38 +0200 Subject: [PATCH] Check if there is an exported activity for the intent --- .../de/danoeh/antennapod/core/util/IntentUtils.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/IntentUtils.java b/core/src/main/java/de/danoeh/antennapod/core/util/IntentUtils.java index 2d5a6e5a1..1571b71c2 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/IntentUtils.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/IntentUtils.java @@ -9,10 +9,18 @@ import java.util.List; public class IntentUtils { + /* + * Checks if there is at least one exported activity that can be performed for the intent + */ public static boolean isCallable(final Context context, final Intent intent) { List list = context.getPackageManager().queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY); - return list.size() > 0; + for(ResolveInfo info : list) { + if(info.activityInfo.exported) { + return true; + } + } + return false; } }