use of android.annotation.SystemApi in project robolectric by robolectric.
the class ShadowCrossProfileApps method startActivity.
/**
* Simulates starting the activity specified in the specified profile, performing the same
* security checks done by the real {@link CrossProfileApps}.
*
* <p>The most recent main activity started can be queried by {@link #peekNextStartedActivity()}.
*/
@Implementation(minSdk = R)
@SystemApi
@RequiresPermission(permission.INTERACT_ACROSS_PROFILES)
protected void startActivity(Intent intent, UserHandle targetUser, @Nullable Activity activity, @Nullable Bundle options) {
ComponentName componentName = intent.getComponent();
if (componentName == null) {
throw new IllegalArgumentException("Must set ComponentName on Intent");
}
verifyCanAccessUser(targetUser);
verifyHasInteractAcrossProfilesPermission();
startedActivities.add(new StartedActivity(componentName, targetUser, intent, activity, options));
}
Aggregations