Search in sources :

Example 96 with SystemApi

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));
}
Also used : ComponentName(android.content.ComponentName) SystemApi(android.annotation.SystemApi) RequiresPermission(android.annotation.RequiresPermission) Implementation(org.robolectric.annotation.Implementation)

Aggregations

SystemApi (android.annotation.SystemApi)96 Bundle (android.os.Bundle)36 RemoteException (android.os.RemoteException)33 INotificationManager (android.app.INotificationManager)10 RequiresPermission (android.annotation.RequiresPermission)6 ComponentName (android.content.ComponentName)6 NonNull (android.annotation.NonNull)5 Notification (android.app.Notification)5 AudioFormat (android.media.AudioFormat)5 AudioRecord (android.media.AudioRecord)5 AudioTrack (android.media.AudioTrack)5 Parcel (android.os.Parcel)5 TextPaint (android.text.TextPaint)5 FileWriter (java.io.FileWriter)5 IOException (java.io.IOException)5 ArrayList (java.util.ArrayList)5 ITelecomService (com.android.internal.telecom.ITelecomService)4 ICarrierConfigLoader (com.android.internal.telephony.ICarrierConfigLoader)4 ITelephony (com.android.internal.telephony.ITelephony)4 Implementation (org.robolectric.annotation.Implementation)3