public void assertNoBroadcastListenersOfActionRegistered(ContextWrapper context, String action) { getShadowInstrumentation().assertNoBroadcastListenersOfActionRegistered(context, action); }
/** Binds to a service but ignores the given UserHandle. */ @Implementation(minSdk = LOLLIPOP) protected boolean bindServiceAsUser( Intent intent, final ServiceConnection serviceConnection, int i, UserHandle userHandle) { return getShadowInstrumentation().bindService(intent, serviceConnection, i); }
@Implementation protected int checkPermission(String permission, int pid, int uid) { return getShadowInstrumentation().checkPermission(permission, pid, uid); }
void sendOrderedBroadcastWithPermission( Intent intent, String receiverPermission, Context context) { List<Wrapper> wrappers = getAppropriateWrappers(intent, receiverPermission); // sort by the decrease of priorities sortByPriority(wrappers); postOrderedToWrappers(wrappers, intent, 0, null, null, context); }
/** * Broadcasts the {@code Intent} by iterating through the registered receivers, invoking their * filters including permissions, and calling {@code onReceive(Application, Intent)} as * appropriate. Does not enqueue the {@code Intent} for later inspection. * * @param context * @param intent the {@code Intent} to broadcast todo: enqueue the Intent for later inspection */ void sendBroadcastWithPermission(Intent intent, String receiverPermission, Context context) { List<Wrapper> wrappers = getAppropriateWrappers(intent, receiverPermission); postToWrappers(wrappers, intent, context); }
/** * Revoke the given permissions for the current process and user. * * Has no effect if permissions were not previously granted. */ public void denyPermissions(String... permissionNames) { getShadowInstrumentation().denyPermissions(permissionNames); }
@Implementation protected void execStartActivities( Context who, IBinder contextThread, IBinder token, Activity target, Intent[] intents, Bundle options) { for (Intent intent : intents) { execStartActivity(who, contextThread, token, target, intent, -1, options); } }
/** * Clears all {@code Intent} started by * {@link android.content.Context#startService(android.content.Intent)}. */ public void clearStartedServices() { getShadowInstrumentation().clearStartedServices(); }
/** * Clears all {@code Intent}s started by {@link * ContextWrapper#startActivity(android.content.Intent)}. */ public void clearNextStartedActivities() { getShadowInstrumentation().clearNextStartedActivities(); }
public void declareActionUnbindable(String action) { getShadowInstrumentation().declareActionUnbindable(action); }
/** * Set to true if you'd like Robolectric to strictly simulate the real Android behavior when * calling {@link Context#startActivity(android.content.Intent)}. Real Android throws a * {@link android.content.ActivityNotFoundException} if given * an {@link Intent} that is not known to the {@link android.content.pm.PackageManager} * * By default, this behavior is off (false). * * @param checkActivities True to validate activities. */ public void checkActivities(boolean checkActivities) { ActivityThread activityThread = (ActivityThread) RuntimeEnvironment.getActivityThread(); ShadowInstrumentation shadowInstrumentation = Shadow.extract(activityThread.getInstrumentation()); shadowInstrumentation.checkActivities(checkActivities); }
void sendOrderedBroadcast( Intent intent, String receiverPermission, BroadcastReceiver resultReceiver, Handler scheduler, int initialCode, String initialData, Bundle initialExtras, Context context) { List<Wrapper> receivers = getAppropriateWrappers(intent, receiverPermission); sortByPriority(receivers); receivers.add(new Wrapper(resultReceiver, null, context, null, scheduler)); postOrderedToWrappers(receivers, intent, initialCode, initialData, initialExtras, context); }
/** * Broadcasts the {@code Intent} by iterating through the registered receivers, invoking their * filters including permissions, and calling {@code onReceive(Application, Intent)} as * appropriate. Does not enqueue the {@code Intent} for later inspection. * * @param context * @param intent the {@code Intent} to broadcast todo: enqueue the Intent for later inspection */ void sendBroadcastWithPermission(Intent intent, String receiverPermission, Context context) { List<Wrapper> wrappers = getAppropriateWrappers(intent, receiverPermission); postToWrappers(wrappers, intent, context); }
/** Revoke the given permissions for the given process and user. */ public void denyPermissions(int pid, int uid, String... permissions) { getShadowInstrumentation().denyPermissions(pid, uid, permissions); }
if (isActivityIntent()) { for (Intent intentToSend : intentsToSend) { shadowInstrumentation.execStartActivity( context, (IBinder) null,
/** * Clears all {@code Intent} started by * {@link android.content.Context#startService(android.content.Intent)}. */ public void clearStartedServices() { getShadowInstrumentation().clearStartedServices(); }
/** * Clears all {@code Intent}s started by {@link * ContextWrapper#startActivity(android.content.Intent)}. */ public void clearNextStartedActivities() { getShadowInstrumentation().clearNextStartedActivities(); }
public void declareActionUnbindable(String action) { getShadowInstrumentation().declareActionUnbindable(action); }
/** * Set to true if you'd like Robolectric to strictly simulate the real Android behavior when * calling {@link Context#startActivity(android.content.Intent)}. Real Android throws a * {@link android.content.ActivityNotFoundException} if given * an {@link Intent} that is not known to the {@link android.content.pm.PackageManager} * * By default, this behavior is off (false). * * @param checkActivities True to validate activities. */ public void checkActivities(boolean checkActivities) { ActivityThread activityThread = (ActivityThread) RuntimeEnvironment.getActivityThread(); ShadowInstrumentation shadowInstrumentation = Shadow.extract(activityThread.getInstrumentation()); shadowInstrumentation.checkActivities(checkActivities); }
void sendOrderedBroadcastWithPermission( Intent intent, String receiverPermission, Context context) { List<Wrapper> wrappers = getAppropriateWrappers(intent, receiverPermission); // sort by the decrease of priorities sortByPriority(wrappers); postOrderedToWrappers(wrappers, intent, 0, null, null, context); }