@Override public boolean activitySupportsIntent(ComponentName component, Intent intent, String resolvedType) { synchronized (mPackages) { VPackage.ActivityComponent a = mActivities.mActivities.get(component); if (a == null) { return false; } for (int i = 0; i < a.intents.size(); i++) { if (a.intents.get(i).filter.match(intent.getAction(), resolvedType, intent.getScheme(), intent.getData(), intent.getCategories(), TAG) >= 0) { return true; } } return false; } }
public List<R> queryIntentFromList(Intent intent, String resolvedType, boolean defaultOnly, ArrayList<F[]> listCut, int userId) { ArrayList<R> resultList = new ArrayList<R>(); FastImmutableArraySet<String> categories = getFastIntentCategories(intent); final String scheme = intent.getScheme(); int N = listCut.size(); for (int i = 0; i < N; ++i) { buildResolveList(intent, categories, defaultOnly, resolvedType, scheme, listCut.get(i), resultList, userId); } sortResults(resultList); return resultList; }
private static int matchIntentFilter(Intent intent, IntentFilter intentFilter) { return intentFilter.match( intent.getAction(), intent.getType(), intent.getScheme(), intent.getData(), intent.getCategories(), TAG); }
/** Returns the BroadcaseReceivers wrappers, matching intent's action and permissions. */ private List<Wrapper> getAppropriateWrappers(Intent intent, String receiverPermission) { broadcastIntents.add(intent); List<Wrapper> result = new ArrayList<>(); List<Wrapper> copy = new ArrayList<>(); copy.addAll(registeredReceivers); for (Wrapper wrapper : copy) { if (hasMatchingPermission(wrapper.broadcastPermission, receiverPermission) && wrapper.intentFilter.matchAction(intent.getAction())) { final int match = wrapper.intentFilter.matchData(intent.getType(), intent.getScheme(), intent.getData()); if (match != IntentFilter.NO_MATCH_DATA && match != IntentFilter.NO_MATCH_TYPE) { result.add(wrapper); } } } return result; }
@Implementation protected boolean sendBroadcast(Intent intent) { boolean sent = false; sentBroadcastIntents.add(intent); List<Wrapper> copy = new ArrayList<>(); copy.addAll(registeredReceivers); for (Wrapper wrapper : copy) { if (wrapper.intentFilter.matchAction(intent.getAction())) { final int match = wrapper.intentFilter.matchData(intent.getType(), intent.getScheme(), intent.getData()); if (match != IntentFilter.NO_MATCH_DATA && match != IntentFilter.NO_MATCH_TYPE) { sent = true; final BroadcastReceiver receiver = wrapper.broadcastReceiver; final Intent broadcastIntent = intent; Robolectric.getForegroundThreadScheduler().post(new Runnable() { @Override public void run() { receiver.onReceive(RuntimeEnvironment.application, broadcastIntent); } }); } } } return sent; }
public List<R> queryIntent(Intent intent, String resolvedType, boolean defaultOnly, int userId) { String scheme = intent.getScheme();
final IntentFilter intentFilter = item.getValue(); final int matchRes = intentFilter.match(intent.getAction(), intent.getType(), intent.getScheme(), intent.getData(), intent.getCategories(), TAG); final boolean matches = (matchRes != IntentFilter.NO_MATCH_ACTION) && (matchRes != IntentFilter.NO_MATCH_CATEGORY)
final String action = intent.getAction(); final String type = intent.getType(); final String scheme = intent.getScheme();
@Test public void testGetScheme() throws Exception { Intent intent = new Intent(); Uri uri = Uri.parse("http://robolectric.org"); assertSame(intent, intent.setData(uri)); assertSame(uri, intent.getData()); assertEquals("http", intent.getScheme()); }
&& "package".equals(intent.getScheme())) { args[intentIndex - 1] = getHostPkg(); if (intent.getScheme() != null && intent.getScheme().equals(SCHEME_PACKAGE) && intent.getData() != null) { if (intent.getAction() != null && intent.getAction().startsWith("android.settings.")) { intent.setData(Uri.parse("package:" + getHostPkg()));
private static ArrayList<String> findClassNameByIntent(Intent intent, HashMap<String, ArrayList<PluginIntentFilter>> intentFilter) { if (intentFilter != null) { ArrayList<String> targetClassNameList = null; Iterator<Map.Entry<String, ArrayList<PluginIntentFilter>>> entry = intentFilter.entrySet().iterator(); while (entry.hasNext()) { Map.Entry<String, ArrayList<PluginIntentFilter>> item = entry.next(); Iterator<PluginIntentFilter> values = item.getValue().iterator(); while (values.hasNext()) { PluginIntentFilter filter = values.next(); int result = filter.match(intent.getAction(), intent.getType(), intent.getScheme(), intent.getData(), intent.getCategories()); if (result != PluginIntentFilter.NO_MATCH_ACTION && result != PluginIntentFilter.NO_MATCH_CATEGORY && result != PluginIntentFilter.NO_MATCH_DATA && result != PluginIntentFilter.NO_MATCH_TYPE) { if (targetClassNameList == null) { targetClassNameList = new ArrayList<String>(); } targetClassNameList.add(item.getKey()); } } } return targetClassNameList; } return null; }
private void handleRedirectIntent(Intent intent) { if (OAuth2Client.REDIRECT_URL.getScheme().equals(intent.getScheme())) { final String code = intent.getData().getQueryParameter("code"); final String error = intent.getData().getQueryParameter("error"); App.post(new BrowserAuthResult(code, error)); } finish(); } }
/** * Test whether this filter matches the given <var>intent</var>. * * @param intent The Intent to compare against. * @param resolve If true, the intent's type will be resolved by calling * Intent.resolveType(); otherwise a simple match against * Intent.type will be performed. * @param logTag Tag to use in debugging messages. * * @return Returns either a valid match constant (a combination of * {@link #MATCH_CATEGORY_MASK} and {@link #MATCH_ADJUSTMENT_MASK}), * or one of the error codes {@link #NO_MATCH_TYPE} if the type didn't match, * {@link #NO_MATCH_DATA} if the scheme/path didn't match, * {@link #NO_MATCH_ACTION if the action didn't match, or * {@link #NO_MATCH_CATEGORY} if one or more categories didn't match. * * @return How well the filter matches. Negative if it doesn't match, * zero or positive positive value if it does with a higher * value representing a better match. * * @see #match(String, String, String, android.net.Uri , Set, String) */ public final int match(ContentResolver resolver, Intent intent, boolean resolve, String logTag) { String type = resolve ? intent.resolveType(resolver) : intent.getType(); return match(intent.getAction(), type, intent.getScheme(), intent.getData(), intent.getCategories()); }
@Override protected void onNewIntent(final Intent intent) { ... if (intent.getScheme().equals(..)) { .. } }
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Intent deepLinkingIntent= getIntent(); deepLinkingIntent.getScheme(); deepLinkingIntent.getData().getPath(); }
Intent intent = getIntent(); String action = intent.getAction(); Uri data = intent.getData(); String link = intent.getScheme(); String linkData = intent.getDataString(); Log.d("TMS","action is: " + action); Log.d("TMS","link is: " + link); Log.d("TMS","linkData is: " + linkData);
@Override protected void onActivityResult(int requestCode, int resultCode, Intent i) { if (i!=null){ i.getPackage(); i.getExtras(); i.getData(); i.getScheme(); i.getType(); } }
public List<ResolveInfo> queryIntentFromList(Intent intent, String resolvedType, ArrayList<DynamicApkParser.ActivityIntentInfo[]> listCut) { ArrayList<ResolveInfo> resultList = new ArrayList(); FastImmutableArraySet<String> categories = getFastIntentCategories(intent); final String scheme = intent.getScheme(); int N = listCut.size(); for (int i = 0; i < N; ++i) { buildResolveList(intent, categories, resolvedType, scheme, listCut.get(i), resultList); } sortResults(resultList); return resultList; }
public List<R> queryIntentFromList(Intent intent, String resolvedType, boolean defaultOnly, ArrayList<F[]> listCut, int userId) { ArrayList<R> resultList = new ArrayList<R>(); FastImmutableArraySet<String> categories = getFastIntentCategories(intent); final String scheme = intent.getScheme(); int N = listCut.size(); for (int i = 0; i < N; ++i) { buildResolveList(intent, categories, defaultOnly, resolvedType, scheme, listCut.get(i), resultList, userId); } sortResults(resultList); return resultList; }
public List<R> queryIntentFromList(Intent intent, String resolvedType, boolean defaultOnly, ArrayList<F[]> listCut, int userId) { ArrayList<R> resultList = new ArrayList<R>(); FastImmutableArraySet<String> categories = getFastIntentCategories(intent); final String scheme = intent.getScheme(); int N = listCut.size(); for (int i = 0; i < N; ++i) { buildResolveList(intent, categories, defaultOnly, resolvedType, scheme, listCut.get(i), resultList, userId); } sortResults(resultList); return resultList; }