类android.util.AndroidRuntimeException源码实例Demo

下面列出了怎么用android.util.AndroidRuntimeException的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: AndroidComponentPlugin   文件: ContextImpl.java
@Override
public void startActivity(Intent intent, Bundle options) {
    warnIfCallingFromSystemProcess();

    // Calling start activity from outside an activity without FLAG_ACTIVITY_NEW_TASK is
    // generally not allowed, except if the caller specifies the task id the activity should
    // be launched in.
    if ((intent.getFlags()&Intent.FLAG_ACTIVITY_NEW_TASK) == 0
            && options != null && ActivityOptions.fromBundle(options).getLaunchTaskId() == -1) {
        throw new AndroidRuntimeException(
                "Calling startActivity() from outside of an Activity "
                + " context requires the FLAG_ACTIVITY_NEW_TASK flag."
                + " Is this really what you want?");
    }
    mMainThread.getInstrumentation().execStartActivity(
            getOuterContext(), mMainThread.getApplicationThread(), null,
            (Activity) null, intent, -1, options);
}
 
源代码2 项目: AndroidComponentPlugin   文件: ContextImpl.java
@Override
public void startActivity(Intent intent, Bundle options) {
    warnIfCallingFromSystemProcess();

    // Calling start activity from outside an activity without FLAG_ACTIVITY_NEW_TASK is
    // generally not allowed, except if the caller specifies the task id the activity should
    // be launched in.
    if ((intent.getFlags()&Intent.FLAG_ACTIVITY_NEW_TASK) == 0
            && options != null && ActivityOptions.fromBundle(options).getLaunchTaskId() == -1) {
        throw new AndroidRuntimeException(
                "Calling startActivity() from outside of an Activity "
                + " context requires the FLAG_ACTIVITY_NEW_TASK flag."
                + " Is this really what you want?");
    }
    mMainThread.getInstrumentation().execStartActivity(
            getOuterContext(), mMainThread.getApplicationThread(), null,
            (Activity) null, intent, -1, options);
}
 
源代码3 项目: AndroidComponentPlugin   文件: ContextImpl.java
@Override
public void startActivity(Intent intent, Bundle options) {
    warnIfCallingFromSystemProcess();

    // Calling start activity from outside an activity without FLAG_ACTIVITY_NEW_TASK is
    // generally not allowed, except if the caller specifies the task id the activity should
    // be launched in. A bug was existed between N and O-MR1 which allowed this to work. We
    // maintain this for backwards compatibility.
    final int targetSdkVersion = getApplicationInfo().targetSdkVersion;

    if ((intent.getFlags() & Intent.FLAG_ACTIVITY_NEW_TASK) == 0
            && (targetSdkVersion < Build.VERSION_CODES.N
                    || targetSdkVersion >= Build.VERSION_CODES.P)
            && (options == null
                    || ActivityOptions.fromBundle(options).getLaunchTaskId() == -1)) {
        throw new AndroidRuntimeException(
                "Calling startActivity() from outside of an Activity "
                        + " context requires the FLAG_ACTIVITY_NEW_TASK flag."
                        + " Is this really what you want?");
    }
    mMainThread.getInstrumentation().execStartActivity(
            getOuterContext(), mMainThread.getApplicationThread(), null,
            (Activity) null, intent, -1, options);
}
 
源代码4 项目: AndroidComponentPlugin   文件: ContextImpl.java
@Override
public void startActivity(Intent intent, Bundle options) {
    warnIfCallingFromSystemProcess();

    // Calling start activity from outside an activity without FLAG_ACTIVITY_NEW_TASK is
    // generally not allowed, except if the caller specifies the task id the activity should
    // be launched in.
    if ((intent.getFlags()&Intent.FLAG_ACTIVITY_NEW_TASK) == 0
            && options != null && ActivityOptions.fromBundle(options).getLaunchTaskId() == -1) {
        throw new AndroidRuntimeException(
                "Calling startActivity() from outside of an Activity "
                + " context requires the FLAG_ACTIVITY_NEW_TASK flag."
                + " Is this really what you want?");
    }
    mMainThread.getInstrumentation().execStartActivity(
            getOuterContext(), mMainThread.getApplicationThread(), null,
            (Activity) null, intent, -1, options);
}
 
源代码5 项目: CircularReveal   文件: SpringAnimation.java
/**
 * Skips to the end of the animation. If the spring is undamped, an
 * {@link IllegalStateException} will be thrown, as the animation would never reach to an end.
 * It is recommended to check {@link #canSkipToEnd()} before calling this method. This method
 * should only be called on main thread. If animation is not running, no-op.
 *
 * @throws IllegalStateException if the spring is undamped (i.e. damping ratio = 0)
 * @throws AndroidRuntimeException if this method is not called on the main thread
 */
public void skipToEnd() {
  if (!canSkipToEnd()) {
    throw new UnsupportedOperationException("Spring animations can only come to an end"
        + " when there is damping");
  }
  if (Looper.myLooper() != Looper.getMainLooper()) {
    throw new AndroidRuntimeException("Animations may only be started on the main thread");
  }
  if (mRunning) {
    if (mPendingPosition != UNSET) {
      mSpring.setFinalPosition(mPendingPosition);
      mPendingPosition = UNSET;
    }
    mValue = mSpring.getFinalPosition();
    mVelocity = 0;
    cancel();
  }
}
 
@Override
public boolean requestFeature(int featureId) {
    if (ActionBarSherlock.DEBUG) Log.d(TAG, "[requestFeature] featureId: " + featureId);

    if (mContentParent != null) {
        throw new AndroidRuntimeException("requestFeature() must be called before adding content");
    }

    switch (featureId) {
        case Window.FEATURE_ACTION_BAR:
        case Window.FEATURE_ACTION_BAR_OVERLAY:
        case Window.FEATURE_ACTION_MODE_OVERLAY:
        case Window.FEATURE_INDETERMINATE_PROGRESS:
        case Window.FEATURE_NO_TITLE:
        case Window.FEATURE_PROGRESS:
            mFeatures |= (1 << featureId);
            return true;

        default:
            return false;
    }
}
 
源代码7 项目: zhangshangwuda   文件: ActionBarSherlockCompat.java
@Override
public boolean requestFeature(int featureId) {
    if (ActionBarSherlock.DEBUG) Log.d(TAG, "[requestFeature] featureId: " + featureId);

    if (mContentParent != null) {
        throw new AndroidRuntimeException("requestFeature() must be called before adding content");
    }

    switch (featureId) {
        case Window.FEATURE_ACTION_BAR:
        case Window.FEATURE_ACTION_BAR_OVERLAY:
        case Window.FEATURE_ACTION_MODE_OVERLAY:
        case Window.FEATURE_INDETERMINATE_PROGRESS:
        case Window.FEATURE_NO_TITLE:
        case Window.FEATURE_PROGRESS:
            mFeatures |= (1 << featureId);
            return true;

        default:
            return false;
    }
}
 
源代码8 项目: AndroidComponentPlugin   文件: ContextImpl.java
@Override
public void startActivity(Intent intent, Bundle options) {
    warnIfCallingFromSystemProcess();

    // Calling start activity from outside an activity without FLAG_ACTIVITY_NEW_TASK is
    // generally not allowed, except if the caller specifies the task id the activity should
    // be launched in.
    if ((intent.getFlags()&Intent.FLAG_ACTIVITY_NEW_TASK) == 0
            && options != null && ActivityOptions.fromBundle(options).getLaunchTaskId() == -1) {
        throw new AndroidRuntimeException(
                "Calling startActivity() from outside of an Activity "
                + " context requires the FLAG_ACTIVITY_NEW_TASK flag."
                + " Is this really what you want?");
    }
    mMainThread.getInstrumentation().execStartActivity(
            getOuterContext(), mMainThread.getApplicationThread(), null,
            (Activity) null, intent, -1, options);
}
 
源代码9 项目: AndroidComponentPlugin   文件: ContextImpl.java
@Override
public void startActivity(Intent intent, Bundle options) {
    warnIfCallingFromSystemProcess();

    // Calling start activity from outside an activity without FLAG_ACTIVITY_NEW_TASK is
    // generally not allowed, except if the caller specifies the task id the activity should
    // be launched in. A bug was existed between N and O-MR1 which allowed this to work. We
    // maintain this for backwards compatibility.
    final int targetSdkVersion = getApplicationInfo().targetSdkVersion;

    if ((intent.getFlags() & Intent.FLAG_ACTIVITY_NEW_TASK) == 0
            && (targetSdkVersion < Build.VERSION_CODES.N
                    || targetSdkVersion >= Build.VERSION_CODES.P)
            && (options == null
                    || ActivityOptions.fromBundle(options).getLaunchTaskId() == -1)) {
        throw new AndroidRuntimeException(
                "Calling startActivity() from outside of an Activity "
                        + " context requires the FLAG_ACTIVITY_NEW_TASK flag."
                        + " Is this really what you want?");
    }
    mMainThread.getInstrumentation().execStartActivity(
            getOuterContext(), mMainThread.getApplicationThread(), null,
            (Activity) null, intent, -1, options);
}
 
源代码10 项目: sdl_java_suite   文件: SdlBroadcastReceiver.java
/**
 * This method will set a new UncaughtExceptionHandler for the current thread. The only
 * purpose of the custom UncaughtExceptionHandler is to catch the rare occurrence that the
 * SdlRouterService can't be started fast enough by the system after calling
 * startForegroundService so the onCreate method doesn't get called before the foreground promise
 * timer expires. The new UncaughtExceptionHandler will catch that specific exception and tell the
 * main looper to continue forward. This still leaves the SdlRouterService killed, but prevents
 * an ANR to the app that makes the startForegroundService call.
 */
static protected void setForegroundExceptionHandler() {
	final Thread.UncaughtExceptionHandler defaultUncaughtExceptionHandler = Thread.getDefaultUncaughtExceptionHandler();
	if(defaultUncaughtExceptionHandler != foregroundExceptionHandler){
		foregroundExceptionHandler = new Thread.UncaughtExceptionHandler() {
			@Override
			public void uncaughtException(Thread t, Throwable e) {
				if (e != null
						&& e instanceof AndroidRuntimeException
						&& "android.app.RemoteServiceException".equals(e.getClass().getName())  //android.app.RemoteServiceException is a private class
						&& e.getMessage().contains("SdlRouterService")) {

					Log.i(TAG, "Handling failed startForegroundService call");
					Looper.loop();
				} else if (defaultUncaughtExceptionHandler != null) { //No other exception should be handled
					defaultUncaughtExceptionHandler.uncaughtException(t, e);
				}
			}
		};
		Thread.setDefaultUncaughtExceptionHandler(foregroundExceptionHandler);
	}
}
 
源代码11 项目: android_9.0.0_r45   文件: AnimatorSet.java
/**
 * {@inheritDoc}
 *
 * <p>Note that canceling a <code>AnimatorSet</code> also cancels all of the animations that it
 * is responsible for.</p>
 */
@SuppressWarnings("unchecked")
@Override
public void cancel() {
    if (Looper.myLooper() == null) {
        throw new AndroidRuntimeException("Animators may only be run on Looper threads");
    }
    if (isStarted()) {
        ArrayList<AnimatorListener> tmpListeners = null;
        if (mListeners != null) {
            tmpListeners = (ArrayList<AnimatorListener>) mListeners.clone();
            int size = tmpListeners.size();
            for (int i = 0; i < size; i++) {
                tmpListeners.get(i).onAnimationCancel(this);
            }
        }
        ArrayList<Node> playingSet = new ArrayList<>(mPlayingSet);
        int setSize = playingSet.size();
        for (int i = 0; i < setSize; i++) {
            playingSet.get(i).mAnimation.cancel();
        }
        mPlayingSet.clear();
        endAnimation();
    }
}
 
源代码12 项目: Transitions-Everywhere   文件: TransitionSet.java
/**
 * Sets the play order of this set's child transitions.
 *
 * @param ordering {@link #ORDERING_TOGETHER} to play this set's child
 *                 transitions together, {@link #ORDERING_SEQUENTIAL} to play the child
 *                 transitions in sequence.
 * @return This transitionSet object.
 */
@NonNull
public TransitionSet setOrdering(int ordering) {
    switch (ordering) {
        case ORDERING_SEQUENTIAL:
            mPlayTogether = false;
            break;
        case ORDERING_TOGETHER:
            mPlayTogether = true;
            break;
        default:
            throw new AndroidRuntimeException("Invalid parameter for TransitionSet " +
                    "ordering: " + ordering);
    }
    return this;
}
 
源代码13 项目: android_9.0.0_r45   文件: ContextImpl.java
@Override
public void startActivity(Intent intent, Bundle options) {
    warnIfCallingFromSystemProcess();

    // Calling start activity from outside an activity without FLAG_ACTIVITY_NEW_TASK is
    // generally not allowed, except if the caller specifies the task id the activity should
    // be launched in. A bug was existed between N and O-MR1 which allowed this to work. We
    // maintain this for backwards compatibility.
    final int targetSdkVersion = getApplicationInfo().targetSdkVersion;

    if ((intent.getFlags() & Intent.FLAG_ACTIVITY_NEW_TASK) == 0
            && (targetSdkVersion < Build.VERSION_CODES.N
                    || targetSdkVersion >= Build.VERSION_CODES.P)
            && (options == null
                    || ActivityOptions.fromBundle(options).getLaunchTaskId() == -1)) {
        throw new AndroidRuntimeException(
                "Calling startActivity() from outside of an Activity "
                        + " context requires the FLAG_ACTIVITY_NEW_TASK flag."
                        + " Is this really what you want?");
    }
    mMainThread.getInstrumentation().execStartActivity(
            getOuterContext(), mMainThread.getApplicationThread(), null,
            (Activity) null, intent, -1, options);
}
 
源代码14 项目: zen4android   文件: ActionBarSherlockCompat.java
@Override
public boolean requestFeature(int featureId) {
    if (ActionBarSherlock.DEBUG) Log.d(TAG, "[requestFeature] featureId: " + featureId);

    if (mContentParent != null) {
        throw new AndroidRuntimeException("requestFeature() must be called before adding content");
    }

    switch (featureId) {
        case Window.FEATURE_ACTION_BAR:
        case Window.FEATURE_ACTION_BAR_OVERLAY:
        case Window.FEATURE_ACTION_MODE_OVERLAY:
        case Window.FEATURE_INDETERMINATE_PROGRESS:
        case Window.FEATURE_NO_TITLE:
        case Window.FEATURE_PROGRESS:
            mFeatures |= (1 << featureId);
            return true;

        default:
            return false;
    }
}
 
源代码15 项目: CSipSimple   文件: ActionBarSherlockCompat.java
@Override
public boolean requestFeature(int featureId) {
    if (ActionBarSherlock.DEBUG) Log.d(TAG, "[requestFeature] featureId: " + featureId);

    if (mContentParent != null) {
        throw new AndroidRuntimeException("requestFeature() must be called before adding content");
    }

    switch (featureId) {
        case Window.FEATURE_ACTION_BAR:
        case Window.FEATURE_ACTION_BAR_OVERLAY:
        case Window.FEATURE_ACTION_MODE_OVERLAY:
        case Window.FEATURE_INDETERMINATE_PROGRESS:
        case Window.FEATURE_NO_TITLE:
        case Window.FEATURE_PROGRESS:
            mFeatures |= (1 << featureId);
            return true;

        default:
            return false;
    }
}
 
源代码16 项目: android-wallet-app   文件: AboutFragment.java
@OnClick(R.id.about_licenses)
public void onAboutLicensesClick() {
    try {
        new LicensesDialog.Builder(getActivity())
                .setNotices(R.raw.licenses)
                .setTitle(R.string.about_licenses)
                .setIncludeOwnLicense(true)
                .setCloseText(R.string.buttons_ok)
                .build()
                .showAppCompat();
    } catch (AndroidRuntimeException e) {
        View contentView = getActivity().getWindow().getDecorView();
        Snackbar snackbar = Snackbar.make(contentView,
                R.string.message_open_licenses_error, Snackbar.LENGTH_LONG);
        snackbar.setAction(R.string.message_install_web_view, v -> openPlayStore());
        snackbar.show();
    }
}
 
源代码17 项目: android-apps   文件: ActionBarSherlockCompat.java
@Override
public boolean requestFeature(int featureId) {
    if (DEBUG) Log.d(TAG, "[requestFeature] featureId: " + featureId);

    if (mContentParent != null) {
        throw new AndroidRuntimeException("requestFeature() must be called before adding content");
    }

    switch (featureId) {
        case Window.FEATURE_ACTION_BAR:
        case Window.FEATURE_ACTION_BAR_OVERLAY:
        case Window.FEATURE_ACTION_MODE_OVERLAY:
        case Window.FEATURE_INDETERMINATE_PROGRESS:
        case Window.FEATURE_NO_TITLE:
        case Window.FEATURE_PROGRESS:
            mFeatures |= (1 << featureId);
            return true;

        default:
            return false;
    }
}
 
源代码18 项目: AndroidComponentPlugin   文件: ContextImpl.java
/** @hide */
@Override
public void startActivitiesAsUser(Intent[] intents, Bundle options, UserHandle userHandle) {
    if ((intents[0].getFlags()&Intent.FLAG_ACTIVITY_NEW_TASK) == 0) {
        throw new AndroidRuntimeException(
                "Calling startActivities() from outside of an Activity "
                + " context requires the FLAG_ACTIVITY_NEW_TASK flag on first Intent."
                + " Is this really what you want?");
    }
    mMainThread.getInstrumentation().execStartActivitiesAsUser(
            getOuterContext(), mMainThread.getApplicationThread(), null,
            (Activity) null, intents, options, userHandle.getIdentifier());
}
 
源代码19 项目: AndroidComponentPlugin   文件: ContextImpl.java
@Override
public void startActivities(Intent[] intents, Bundle options) {
    warnIfCallingFromSystemProcess();
    if ((intents[0].getFlags()&Intent.FLAG_ACTIVITY_NEW_TASK) == 0) {
        throw new AndroidRuntimeException(
                "Calling startActivities() from outside of an Activity "
                + " context requires the FLAG_ACTIVITY_NEW_TASK flag on first Intent."
                + " Is this really what you want?");
    }
    mMainThread.getInstrumentation().execStartActivities(
            getOuterContext(), mMainThread.getApplicationThread(), null,
            (Activity) null, intents, options);
}
 
源代码20 项目: AndroidComponentPlugin   文件: ContextImpl.java
/** @hide */
@Override
public void startActivitiesAsUser(Intent[] intents, Bundle options, UserHandle userHandle) {
    if ((intents[0].getFlags()&Intent.FLAG_ACTIVITY_NEW_TASK) == 0) {
        throw new AndroidRuntimeException(
                "Calling startActivities() from outside of an Activity "
                + " context requires the FLAG_ACTIVITY_NEW_TASK flag on first Intent."
                + " Is this really what you want?");
    }
    mMainThread.getInstrumentation().execStartActivitiesAsUser(
            getOuterContext(), mMainThread.getApplicationThread(), null,
            (Activity) null, intents, options, userHandle.getIdentifier());
}
 
源代码21 项目: AndroidComponentPlugin   文件: ContextImpl.java
@Override
public void startActivities(Intent[] intents, Bundle options) {
    warnIfCallingFromSystemProcess();
    if ((intents[0].getFlags()&Intent.FLAG_ACTIVITY_NEW_TASK) == 0) {
        throw new AndroidRuntimeException(
                "Calling startActivities() from outside of an Activity "
                + " context requires the FLAG_ACTIVITY_NEW_TASK flag on first Intent."
                + " Is this really what you want?");
    }
    mMainThread.getInstrumentation().execStartActivities(
            getOuterContext(), mMainThread.getApplicationThread(), null,
            (Activity) null, intents, options);
}
 
源代码22 项目: AndroidComponentPlugin   文件: ContextImpl.java
@Override
public void startActivity(Intent intent, Bundle options) {
    warnIfCallingFromSystemProcess();
    if ((intent.getFlags()&Intent.FLAG_ACTIVITY_NEW_TASK) == 0) {
        throw new AndroidRuntimeException(
                "Calling startActivity() from outside of an Activity "
                + " context requires the FLAG_ACTIVITY_NEW_TASK flag."
                + " Is this really what you want?");
    }
    mMainThread.getInstrumentation().execStartActivity(
            getOuterContext(), mMainThread.getApplicationThread(), null,
            (Activity) null, intent, -1, options);
}
 
源代码23 项目: AndroidComponentPlugin   文件: ContextImpl.java
/** @hide */
@Override
public void startActivitiesAsUser(Intent[] intents, Bundle options, UserHandle userHandle) {
    if ((intents[0].getFlags()&Intent.FLAG_ACTIVITY_NEW_TASK) == 0) {
        throw new AndroidRuntimeException(
                "Calling startActivities() from outside of an Activity "
                + " context requires the FLAG_ACTIVITY_NEW_TASK flag on first Intent."
                + " Is this really what you want?");
    }
    mMainThread.getInstrumentation().execStartActivitiesAsUser(
            getOuterContext(), mMainThread.getApplicationThread(), null,
            (Activity) null, intents, options, userHandle.getIdentifier());
}
 
源代码24 项目: AndroidComponentPlugin   文件: ContextImpl.java
@Override
public void startActivities(Intent[] intents, Bundle options) {
    warnIfCallingFromSystemProcess();
    if ((intents[0].getFlags()&Intent.FLAG_ACTIVITY_NEW_TASK) == 0) {
        throw new AndroidRuntimeException(
                "Calling startActivities() from outside of an Activity "
                + " context requires the FLAG_ACTIVITY_NEW_TASK flag on first Intent."
                + " Is this really what you want?");
    }
    mMainThread.getInstrumentation().execStartActivities(
            getOuterContext(), mMainThread.getApplicationThread(), null,
            (Activity) null, intents, options);
}
 
源代码25 项目: AndroidComponentPlugin   文件: ContextImpl.java
/** @hide */
@Override
public int startActivitiesAsUser(Intent[] intents, Bundle options, UserHandle userHandle) {
    if ((intents[0].getFlags()&Intent.FLAG_ACTIVITY_NEW_TASK) == 0) {
        throw new AndroidRuntimeException(
                "Calling startActivities() from outside of an Activity "
                + " context requires the FLAG_ACTIVITY_NEW_TASK flag on first Intent."
                + " Is this really what you want?");
    }
    return mMainThread.getInstrumentation().execStartActivitiesAsUser(
            getOuterContext(), mMainThread.getApplicationThread(), null,
            (Activity) null, intents, options, userHandle.getIdentifier());
}
 
源代码26 项目: AndroidComponentPlugin   文件: ContextImpl.java
@Override
public void startActivities(Intent[] intents, Bundle options) {
    warnIfCallingFromSystemProcess();
    if ((intents[0].getFlags()&Intent.FLAG_ACTIVITY_NEW_TASK) == 0) {
        throw new AndroidRuntimeException(
                "Calling startActivities() from outside of an Activity "
                + " context requires the FLAG_ACTIVITY_NEW_TASK flag on first Intent."
                + " Is this really what you want?");
    }
    mMainThread.getInstrumentation().execStartActivities(
            getOuterContext(), mMainThread.getApplicationThread(), null,
            (Activity) null, intents, options);
}
 
源代码27 项目: AndroidComponentPlugin   文件: ContextImpl.java
@Override
public void startActivities(Intent[] intents, Bundle options) {
    warnIfCallingFromSystemProcess();
    if ((intents[0].getFlags()&Intent.FLAG_ACTIVITY_NEW_TASK) == 0) {
        throw new AndroidRuntimeException(
                "Calling startActivities() from outside of an Activity "
                + " context requires the FLAG_ACTIVITY_NEW_TASK flag on first Intent."
                + " Is this really what you want?");
    }
    mMainThread.getInstrumentation().execStartActivities(
            getOuterContext(), mMainThread.getApplicationThread(), null,
            (Activity) null, intents, options);
}
 
源代码28 项目: AndroidComponentPlugin   文件: ContextImpl.java
@Override
public void startActivity(Intent intent, Bundle options) {
    if ((intent.getFlags()&Intent.FLAG_ACTIVITY_NEW_TASK) == 0) {
        throw new AndroidRuntimeException(
                "Calling startActivity() from outside of an Activity "
                + " context requires the FLAG_ACTIVITY_NEW_TASK flag."
                + " Is this really what you want?");
    }
    mMainThread.getInstrumentation().execStartActivity(
        getOuterContext(), mMainThread.getApplicationThread(), null,
        (Activity)null, intent, -1, options);
}
 
源代码29 项目: AndroidComponentPlugin   文件: ContextImpl.java
@Override
public void startActivities(Intent[] intents, Bundle options) {
    if ((intents[0].getFlags()&Intent.FLAG_ACTIVITY_NEW_TASK) == 0) {
        throw new AndroidRuntimeException(
                "Calling startActivities() from outside of an Activity "
                + " context requires the FLAG_ACTIVITY_NEW_TASK flag on first Intent."
                + " Is this really what you want?");
    }
    mMainThread.getInstrumentation().execStartActivities(
        getOuterContext(), mMainThread.getApplicationThread(), null,
        (Activity)null, intents, options);
}
 
源代码30 项目: AndroidComponentPlugin   文件: Instrumentation.java
static void checkStartActivityResult(int res, Object intent) {
    if (res >= IActivityManager.START_SUCCESS) {
        return;
    }
    
    switch (res) {
        case IActivityManager.START_INTENT_NOT_RESOLVED:
        case IActivityManager.START_CLASS_NOT_FOUND:
            if (intent instanceof Intent && ((Intent)intent).getComponent() != null)
                throw new ActivityNotFoundException(
                        "Unable to find explicit activity class "
                        + ((Intent)intent).getComponent().toShortString()
                        + "; have you declared this activity in your AndroidManifest.xml?");
            throw new ActivityNotFoundException(
                    "No Activity found to handle " + intent);
        case IActivityManager.START_PERMISSION_DENIED:
            throw new SecurityException("Not allowed to start activity "
                    + intent);
        case IActivityManager.START_FORWARD_AND_REQUEST_CONFLICT:
            throw new AndroidRuntimeException(
                    "FORWARD_RESULT_FLAG used while also requesting a result");
        case IActivityManager.START_NOT_ACTIVITY:
            throw new IllegalArgumentException(
                    "PendingIntent is not an activity");
        default:
            throw new AndroidRuntimeException("Unknown error code "
                    + res + " when starting " + intent);
    }
}