public ArrayList<F> findFilters(IntentFilter matching) { if (matching.countDataSchemes() == 1) { // Fast case. return collectFilters(mSchemeToFilter.get(matching.getDataScheme(0)), matching); } else if (matching.countDataTypes() != 0 && matching.countActions() == 1) { // Another fast case. return collectFilters(mTypedActionToFilter.get(matching.getAction(0)), matching); } else if (matching.countDataTypes() == 0 && matching.countDataSchemes() == 0 && matching.countActions() == 1) { // Last fast case. return collectFilters(mActionToFilter.get(matching.getAction(0)), matching); } else { ArrayList<F> res = null; for (F cur : mFilters) { if (filterEquals(cur.filter, matching)) { if (res == null) { res = new ArrayList<>(); } res.add(cur); } } return res; } }
@Test public void testQueryBroadcastReceiverSucceeds() { Intent intent = new Intent("org.robolectric.ACTION_RECEIVER_PERMISSION_PACKAGE"); intent.setPackage(ApplicationProvider.getApplicationContext().getPackageName()); List<ResolveInfo> receiverInfos = packageManager.queryBroadcastReceivers(intent, PackageManager.GET_RESOLVED_FILTER); assertThat(receiverInfos).isNotEmpty(); assertThat(receiverInfos.get(0).activityInfo.name) .isEqualTo("org.robolectric.ConfigTestReceiverPermissionsAndActions"); assertThat(receiverInfos.get(0).activityInfo.permission) .isEqualTo("org.robolectric.CUSTOM_PERM"); assertThat(receiverInfos.get(0).filter.getAction(0)) .isEqualTo("org.robolectric.ACTION_RECEIVER_PERMISSION_PACKAGE"); }
@Test public void getIntentFiltersForComponent() throws Exception { List<IntentFilter> intentFilters = shadowPackageManager.getIntentFiltersForActivity( new ComponentName( ApplicationProvider.getApplicationContext(), ActivityWithFilters.class)); assertThat(intentFilters).hasSize(1); IntentFilter intentFilter = intentFilters.get(0); assertThat(intentFilter.getCategory(0)).isEqualTo(Intent.CATEGORY_DEFAULT); assertThat(intentFilter.getAction(0)).isEqualTo(Intent.ACTION_VIEW); assertThat(intentFilter.getDataPath(0).getPath()).isEqualTo("/testPath/test.jpeg"); }
protected void beforeHookedMethod(MethodHookParam param) throws Throwable { IntentFilter intentFilter = (IntentFilter) param.args[1]; StringBuffer sb = new StringBuffer(); sb.append("Actions: "); for(int i=0; i<intentFilter.countActions(); i++){ sb.append(intentFilter.getAction(i)+","); } if(!sb.toString().contains("mobi.acpm.inspeckage")) { XposedBridge.log(TAG + "registerReceiver: " + sb.toString().substring(0, sb.length() - 1)); } } });
protected void beforeHookedMethod(MethodHookParam param) throws Throwable { IntentFilter intentFilter = (IntentFilter) param.args[1]; StringBuffer sb = new StringBuffer(); sb.append("Actions: "); for(int i=0; i<intentFilter.countActions(); i++){ sb.append(intentFilter.getAction(i)+","); } if(param.args[2] != null){ sb.append(" Permissions: "+param.args[2]); } if(!sb.toString().contains("mobi.acpm.inspeckage")) { XposedBridge.log(TAG + "registerReceiver: " + sb.toString().substring(0, sb.length() - 1)); } } });
if (!f2.hasAction(f1.getAction(i))) { return false;
public void onReceive(final Context context, final Intent intent) { Log.d(TAG, "Received broadcast: " + intent.getAction()); if (intent.getAction() == mCalendarUpdateFilter.getAction(0)) onExternalCalendarChanged(); } };
private Intent getStickyIntent(IntentFilter filter) { for (Intent stickyIntent : stickyIntents.values()) { String action = null; for (int i = 0; i < filter.countActions(); i++) { action = filter.getAction(i); if (stickyIntent.getAction().equals(action)) { return stickyIntent; } } } return null; }
/** * Register a receive for any local broadcasts that match the given IntentFilter. * * @param receiver The BroadcastReceiver to handle the broadcast. * @param filter Selects the Intent broadcasts to be received. * * @see #unregisterReceiver */ public void registerReceiver(BroadcastReceiver receiver, IntentFilter filter) { synchronized (mReceivers) { ReceiverRecord entry = new ReceiverRecord(filter, receiver); ArrayList<IntentFilter> filters = mReceivers.get(receiver); if (filters == null) { filters = new ArrayList<IntentFilter>(1); mReceivers.put(receiver, filters); } filters.add(filter); for (int i=0; i<filter.countActions(); i++) { String action = filter.getAction(i); ArrayList<ReceiverRecord> entries = mActions.get(action); if (entries == null) { entries = new ArrayList<ReceiverRecord>(1); mActions.put(action, entries); } entries.add(entry); } } }
IntentFilter filter = filters.get(i); for (int j=0; j<filter.countActions(); j++) { String action = filter.getAction(j); ArrayList<ReceiverRecord> receivers = mActions.get(action); if (receivers != null) {
IntentFilter filter = filters.get(i); for (int j=0; j<filter.countActions(); j++) { String action = filter.getAction(j); ArrayList<ReceiverRecord> receivers = mActions.get(action); if (receivers != null) {
IntentFilter filter = filters.get(i); for (int j=0; j<filter.countActions(); j++) { String action = filter.getAction(j); ArrayList<ReceiverRecord> receivers = mActions.get(action); if (receivers != null) {
/** * Register a receive for any local broadcasts that match the given IntentFilter. * * @param receiver The BroadcastReceiver to handle the broadcast. * @param filter Selects the Intent broadcasts to be received. * * @see #unregisterReceiver */ public void registerReceiver(BroadcastReceiver receiver, IntentFilter filter) { synchronized (mReceivers) { ReceiverRecord entry = new ReceiverRecord(filter, receiver); ArrayList<IntentFilter> filters = mReceivers.get(receiver); if (filters == null) { filters = new ArrayList<IntentFilter>(1); mReceivers.put(receiver, filters); } filters.add(filter); for (int i=0; i<filter.countActions(); i++) { String action = filter.getAction(i); ArrayList<ReceiverRecord> entries = mActions.get(action); if (entries == null) { entries = new ArrayList<ReceiverRecord>(1); mActions.put(action, entries); } entries.add(entry); } } }
/** * Register a receive for any local broadcasts that match the given IntentFilter. * * @param receiver The BroadcastReceiver to handle the broadcast. * @param filter Selects the Intent broadcasts to be received. * * @see #unregisterReceiver */ public void registerReceiver(BroadcastReceiver receiver, IntentFilter filter) { synchronized (mReceivers) { ReceiverRecord entry = new ReceiverRecord(filter, receiver); ArrayList<IntentFilter> filters = mReceivers.get(receiver); if (filters == null) { filters = new ArrayList<IntentFilter>(1); mReceivers.put(receiver, filters); } filters.add(filter); for (int i=0; i<filter.countActions(); i++) { String action = filter.getAction(i); ArrayList<ReceiverRecord> entries = mActions.get(action); if (entries == null) { entries = new ArrayList<ReceiverRecord>(1); mActions.put(action, entries); } entries.add(entry); } } }
public ArrayList<F> findFilters(IntentFilter matching) { if (matching.countDataSchemes() == 1) { // Fast case. return collectFilters(mSchemeToFilter.get(matching.getDataScheme(0)), matching); } else if (matching.countDataTypes() != 0 && matching.countActions() == 1) { // Another fast case. return collectFilters(mTypedActionToFilter.get(matching.getAction(0)), matching); } else if (matching.countDataTypes() == 0 && matching.countDataSchemes() == 0 && matching.countActions() == 1) { // Last fast case. return collectFilters(mActionToFilter.get(matching.getAction(0)), matching); } else { ArrayList<F> res = null; for (F cur : mFilters) { if (filterEquals(cur.filter, matching)) { if (res == null) { res = new ArrayList<>(); } res.add(cur); } } return res; } }
public ArrayList<F> findFilters(IntentFilter matching) { if (matching.countDataSchemes() == 1) { // Fast case. return collectFilters(mSchemeToFilter.get(matching.getDataScheme(0)), matching); } else if (matching.countDataTypes() != 0 && matching.countActions() == 1) { // Another fast case. return collectFilters(mTypedActionToFilter.get(matching.getAction(0)), matching); } else if (matching.countDataTypes() == 0 && matching.countDataSchemes() == 0 && matching.countActions() == 1) { // Last fast case. return collectFilters(mActionToFilter.get(matching.getAction(0)), matching); } else { ArrayList<F> res = null; for (F cur : mFilters) { if (filterEquals(cur.filter, matching)) { if (res == null) { res = new ArrayList<>(); } res.add(cur); } } return res; } }
actions.add(filter.getAction(i));
info += "IntentFilter:\n"; for (int j = 0; j < filter.countActions(); j++) { info += " action: " + filter.getAction(j) + "\n";
if (!f2.hasAction(f1.getAction(i))) { return false;
if (!f2.hasAction(f1.getAction(i))) { return false;