/** * Used to check whether there is a specialized handler for a given intent. * @param intent The intent to check with. * @return Whether there is a specialized handler for the given intent. */ private static boolean hasSpecializedHandlerIntents(Context context, Intent intent) { try { PackageManager pm = context.getPackageManager(); List<ResolveInfo> handlers = pm.queryIntentActivities( intent, PackageManager.GET_RESOLVED_FILTER); if (handlers == null || handlers.size() == 0) { return false; } for (ResolveInfo resolveInfo : handlers) { IntentFilter filter = resolveInfo.filter; if (filter == null) continue; if (filter.countDataAuthorities() == 0 || filter.countDataPaths() == 0) continue; if (resolveInfo.activityInfo == null) continue; return true; } } catch (RuntimeException e) { Log.e(TAG, "Runtime exception while getting specialized handlers"); } return false; }
/** * Used to check whether there is a specialized handler for a given intent. * @param intent The intent to check with. * @return Whether there is a specialized handler for the given intent. */ private static boolean hasSpecializedHandlerIntents(Context context, Intent intent) { try { PackageManager pm = context.getPackageManager(); List<ResolveInfo> handlers = pm.queryIntentActivities( intent, PackageManager.GET_RESOLVED_FILTER); if (handlers == null || handlers.size() == 0) { return false; } for (ResolveInfo resolveInfo : handlers) { IntentFilter filter = resolveInfo.filter; if (filter == null) continue; if (filter.countDataAuthorities() == 0 || filter.countDataPaths() == 0) continue; if (resolveInfo.activityInfo == null) continue; return true; } } catch (RuntimeException e) { Log.e(TAG, "Runtime exception while getting specialized handlers"); } return false; }
if (filter.countDataPaths() > 0) { buf.append(" : "); buf.append(filter.getDataPath(0)); if (filter.countDataPaths() > 1) { buf.append(" (other paths)");
return false; s1 = f1.countDataPaths(); s2 = f2.countDataPaths(); if (s1 != s2) { return false;
/** * Used to check whether there is a specialized handler for a given intent. * * @param intent The intent to check with. * @return Whether there is a specialized handler for the given intent. */ private static boolean hasSpecializedHandlerIntents(Context context, Intent intent) { try { PackageManager pm = context.getPackageManager(); List<ResolveInfo> handlers = pm.queryIntentActivities( intent, PackageManager.GET_RESOLVED_FILTER); if (handlers == null || handlers.size() == 0) { return false; } for (ResolveInfo resolveInfo : handlers) { IntentFilter filter = resolveInfo.filter; if (filter == null) continue; if (filter.countDataAuthorities() == 0 || filter.countDataPaths() == 0) continue; if (resolveInfo.activityInfo == null) continue; return true; } } catch (RuntimeException e) { Log.e(TAG, "Runtime exception while getting specialized handlers"); } return false; }
/** * Used to check whether there is a specialized handler for a given intent. * @param intent The intent to check with. * @return Whether there is a specialized handler for the given intent. */ private static boolean hasSpecializedHandlerIntents(Context context, Intent intent) { try { PackageManager pm = context.getPackageManager(); List<ResolveInfo> handlers = pm.queryIntentActivities( intent, PackageManager.GET_RESOLVED_FILTER); if (handlers == null || handlers.size() == 0) { return false; } for (ResolveInfo resolveInfo : handlers) { IntentFilter filter = resolveInfo.filter; if (filter == null) continue; if (filter.countDataAuthorities() == 0 || filter.countDataPaths() == 0) continue; if (resolveInfo.activityInfo == null) continue; return true; } } catch (RuntimeException e) { Log.e(TAG, "Runtime exception while getting specialized handlers"); } return false; } }
/** * Used to check whether there is a specialized handler for a given intent. * @param intent The intent to check with. * @return Whether there is a specialized handler for the given intent. */ private static boolean hasSpecializedHandlerIntents(Context context, Intent intent) { try { PackageManager pm = context.getPackageManager(); List<ResolveInfo> handlers = pm.queryIntentActivities( intent, PackageManager.GET_RESOLVED_FILTER); if (handlers == null || handlers.size() == 0) { return false; } for (ResolveInfo resolveInfo : handlers) { IntentFilter filter = resolveInfo.filter; if (filter == null) continue; if (filter.countDataAuthorities() == 0 || filter.countDataPaths() == 0) continue; if (resolveInfo.activityInfo == null) continue; return true; } } catch (RuntimeException e) { Log.e(TAG, "Runtime exception while getting specialized handlers"); } return false; }
/** * Used to check whether there is a specialized handler for a given intent. * @param intent The intent to check with. * @return Whether there is a specialized handler for the given intent. */ private static boolean hasSpecializedHandlerIntents(Context context, Intent intent) { try { PackageManager pm = context.getPackageManager(); List<ResolveInfo> handlers = pm.queryIntentActivities( intent, PackageManager.GET_RESOLVED_FILTER); if (handlers == null || handlers.size() == 0) { return false; } for (ResolveInfo resolveInfo : handlers) { IntentFilter filter = resolveInfo.filter; if (filter == null) continue; if (filter.countDataAuthorities() == 0 || filter.countDataPaths() == 0) continue; if (resolveInfo.activityInfo == null) continue; return true; } } catch (RuntimeException e) { Log.e(TAG, "Runtime exception while getting specialized handlers"); } return false; }
/** * Used to check whether there is a specialized handler for a given intent. * @param intent The intent to check with. * @return Whether there is a specialized handler for the given intent. */ private static boolean hasSpecializedHandlerIntents(Context context, Intent intent) { try { PackageManager pm = context.getPackageManager(); List<ResolveInfo> handlers = pm.queryIntentActivities( intent, PackageManager.GET_RESOLVED_FILTER); if (handlers == null || handlers.size() == 0) { return false; } for (ResolveInfo resolveInfo : handlers) { IntentFilter filter = resolveInfo.filter; if (filter == null) continue; if (filter.countDataAuthorities() == 0 || filter.countDataPaths() == 0) continue; if (resolveInfo.activityInfo == null) continue; return true; } } catch (RuntimeException e) { Log.e(TAG, "Runtime exception while getting specialized handlers"); } return false; } }
/** * Used to check whether there is a specialized handler for a given intent. * @param intent The intent to check with. * @return Whether there is a specialized handler for the given intent. */ private static boolean hasSpecializedHandlerIntents(Context context, Intent intent) { try { PackageManager pm = context.getPackageManager(); List<ResolveInfo> handlers = pm.queryIntentActivities( intent, PackageManager.GET_RESOLVED_FILTER); if (handlers == null || handlers.size() == 0) { return false; } for (ResolveInfo resolveInfo : handlers) { IntentFilter filter = resolveInfo.filter; if (filter == null) continue; if (filter.countDataAuthorities() == 0 || filter.countDataPaths() == 0) continue; if (resolveInfo.activityInfo == null) continue; return true; } } catch (RuntimeException e) { Log.e(TAG, "Runtime exception while getting specialized handlers"); } return false; }
/** * Used to check whether there is a specialized handler for a given intent. * @param intent The intent to check with. * @return Whether there is a specialized handler for the given intent. */ private static boolean hasSpecializedHandlerIntents(Context context, Intent intent) { try { PackageManager pm = context.getPackageManager(); List<ResolveInfo> handlers = pm.queryIntentActivities( intent, PackageManager.GET_RESOLVED_FILTER); if (handlers == null || handlers.size() == 0) { return false; } for (ResolveInfo resolveInfo : handlers) { IntentFilter filter = resolveInfo.filter; if (filter == null) continue; if (filter.countDataAuthorities() == 0 || filter.countDataPaths() == 0) continue; if (resolveInfo.activityInfo == null) continue; return true; } } catch (RuntimeException e) { Log.e(TAG, "Runtime exception while getting specialized handlers"); } return false; }
/** * Used to check whether there is a specialized handler for a given intent. * @param intent The intent to check with. * @return Whether there is a specialized handler for the given intent. */ private static boolean hasSpecializedHandlerIntents(Context context, Intent intent) { try { PackageManager pm = context.getPackageManager(); List<ResolveInfo> handlers = pm.queryIntentActivities( intent, PackageManager.GET_RESOLVED_FILTER); if (handlers == null || handlers.size() == 0) { return false; } for (ResolveInfo resolveInfo : handlers) { IntentFilter filter = resolveInfo.filter; if (filter == null) continue; if (filter.countDataAuthorities() == 0 || filter.countDataPaths() == 0) continue; if (resolveInfo.activityInfo == null) continue; return true; } } catch (RuntimeException e) { Log.e(TAG, "Runtime exception while getting specialized handlers"); } return false; }
/** * Used to check whether there is a specialized handler for a given intent. * * @param intent The intent to check with. * @return Whether there is a specialized handler for the given intent. */ private static boolean hasSpecializedHandlerIntents(Context context, Intent intent) { try { PackageManager pm = context.getPackageManager(); List<ResolveInfo> handlers = pm.queryIntentActivities( intent, PackageManager.GET_RESOLVED_FILTER); if (handlers == null || handlers.size() == 0) { return false; } for (ResolveInfo resolveInfo : handlers) { IntentFilter filter = resolveInfo.filter; if (filter == null) continue; if (filter.countDataAuthorities() == 0 || filter.countDataPaths() == 0) continue; if (resolveInfo.activityInfo == null) continue; return true; } } catch (RuntimeException e) { Timber.e("Runtime exception while getting specialized handlers"); } return false; }
@VisibleForTesting static ArrayList<String> getSpecializedHandlersWithFilter( List<ResolveInfo> infos, String filterPackageName) { ArrayList<String> result = new ArrayList<String>(); if (infos == null) { return result; } int count = 0; for (ResolveInfo info : infos) { IntentFilter filter = info.filter; if (filter == null) { // Error on the side of classifying ResolveInfo as generic. continue; } if (filter.countDataAuthorities() == 0 && filter.countDataPaths() == 0) { // Don't count generic handlers. continue; } if (!TextUtils.isEmpty(filterPackageName) && (info.activityInfo == null || !info.activityInfo.packageName.equals(filterPackageName))) { continue; } result.add(info.activityInfo != null ? info.activityInfo.packageName : ""); } return result; }
IntentFilter filter = resolveInfo.filter; if (filter == null) continue; if (filter.countDataAuthorities() == 0 || filter.countDataPaths() == 0) continue; if (resolveInfo.activityInfo == null) continue; return true;
dataAuthorities.add(dataAuthority.getHost() + ":" + dataAuthority.getPort()); for (int i = 0; i < filter.countDataPaths(); i++) { PatternMatcher dataPath = filter.getDataPath(i); dataPaths.add(dataPath.toString());
+ filter.getDataAuthority(j) + "\n"; for (int j = 0; j < filter.countDataPaths(); j++) { info += " data path: " + filter.getDataPath(j) + "\n";
return false; s1 = f1.countDataPaths(); s2 = f2.countDataPaths(); if (s1 != s2) { return false;
return false; s1 = f1.countDataPaths(); s2 = f2.countDataPaths(); if (s1 != s2) { return false;