Java Code Examples for android.content.IntentFilter#AuthorityEntry
The following examples show how to use
android.content.IntentFilter#AuthorityEntry .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IntentFilters.java From deagle with Apache License 2.0 | 5 votes |
private static boolean equal_authorities(final Iterator<IntentFilter.AuthorityEntry> a, final Iterator<IntentFilter.AuthorityEntry> b) { if (a == b) return true; if (a == null || b == null) return false; while (a.hasNext()) { if (! b.hasNext()) return false; final IntentFilter.AuthorityEntry o1 = a.next(); final IntentFilter.AuthorityEntry o2 = b.next(); if (! equal(o1, o2)) return false; } return ! b.hasNext(); }
Example 2
Source File: ComponentResolver.java From AndroidComponentPlugin with Apache License 2.0 | 4 votes |
@Override public Iterator<IntentFilter.AuthorityEntry> generate(ActivityIntentInfo info) { return info.authoritiesIterator(); }
Example 3
Source File: InstantAppResolver.java From android_9.0.0_r45 with Apache License 2.0 | 4 votes |
/** * Returns one of three states: <p/> * <ul> * <li>{@code null} if there are no matches will not be; resolution is unnecessary.</li> * <li>An empty list signifying that a 2nd phase of resolution is required.</li> * <li>A populated list meaning that matches were found and should be sent directly to the * installer</li> * </ul> * */ private static List<AuxiliaryResolveInfo.AuxiliaryFilter> computeResolveFilters( Intent origIntent, String resolvedType, int userId, String packageName, String token, InstantAppResolveInfo instantAppInfo) { if (instantAppInfo.shouldLetInstallerDecide()) { return Collections.singletonList( new AuxiliaryResolveInfo.AuxiliaryFilter( instantAppInfo, null /* splitName */, instantAppInfo.getExtras())); } if (packageName != null && !packageName.equals(instantAppInfo.getPackageName())) { return null; } final List<InstantAppIntentFilter> instantAppFilters = instantAppInfo.getIntentFilters(); if (instantAppFilters == null || instantAppFilters.isEmpty()) { // No filters on web intent; no matches, 2nd phase unnecessary. if (origIntent.isWebIntent()) { return null; } // No filters; we need to start phase two if (DEBUG_INSTANT) { Log.d(TAG, "No app filters; go to phase 2"); } return Collections.emptyList(); } final PackageManagerService.InstantAppIntentResolver instantAppResolver = new PackageManagerService.InstantAppIntentResolver(); for (int j = instantAppFilters.size() - 1; j >= 0; --j) { final InstantAppIntentFilter instantAppFilter = instantAppFilters.get(j); final List<IntentFilter> splitFilters = instantAppFilter.getFilters(); if (splitFilters == null || splitFilters.isEmpty()) { continue; } for (int k = splitFilters.size() - 1; k >= 0; --k) { IntentFilter filter = splitFilters.get(k); Iterator<IntentFilter.AuthorityEntry> authorities = filter.authoritiesIterator(); // ignore http/s-only filters. if ((authorities == null || !authorities.hasNext()) && (filter.hasDataScheme("http") || filter.hasDataScheme("https")) && filter.hasAction(Intent.ACTION_VIEW) && filter.hasCategory(Intent.CATEGORY_BROWSABLE)) { continue; } instantAppResolver.addFilter( new AuxiliaryResolveInfo.AuxiliaryFilter( filter, instantAppInfo, instantAppFilter.getSplitName(), instantAppInfo.getExtras() )); } } List<AuxiliaryResolveInfo.AuxiliaryFilter> matchedResolveInfoList = instantAppResolver.queryIntent( origIntent, resolvedType, false /*defaultOnly*/, userId); if (!matchedResolveInfoList.isEmpty()) { if (DEBUG_INSTANT) { Log.d(TAG, "[" + token + "] Found match(es); " + matchedResolveInfoList); } return matchedResolveInfoList; } else if (DEBUG_INSTANT) { Log.d(TAG, "[" + token + "] No matches found" + " package: " + instantAppInfo.getPackageName() + ", versionCode: " + instantAppInfo.getVersionCode()); } return null; }
Example 4
Source File: IntentFilters.java From deagle with Apache License 2.0 | 4 votes |
private static boolean equal(final IntentFilter.AuthorityEntry a, final IntentFilter.AuthorityEntry b) { return a == b || (a != null && b != null && equal(a.getHost(), b.getHost()) && a.getPort() == b.getPort()); }