Search in sources :

Example 1 with DefaultActivityLaunchTask

use of com.android.tools.idea.run.tasks.DefaultActivityLaunchTask in project intellij by bazelbuild.

the class BlazeAndroidBinaryApplicationLaunchTaskProvider method getApplicationLaunchTask.

public static LaunchTask getApplicationLaunchTask(Project project, ApplicationIdProvider applicationIdProvider, File mergedManifestFile, BlazeAndroidBinaryRunConfigurationState configState, StartActivityFlagsProvider startActivityFlagsProvider, ProcessHandlerLaunchStatus processHandlerLaunchStatus) {
    try {
        String applicationId = applicationIdProvider.getPackageName();
        final LaunchTask launchTask;
        switch(configState.getMode()) {
            case BlazeAndroidBinaryRunConfigurationState.DO_NOTHING:
                launchTask = null;
                break;
            case BlazeAndroidBinaryRunConfigurationState.LAUNCH_DEFAULT_ACTIVITY:
                BlazeDefaultActivityLocator activityLocator = new BlazeDefaultActivityLocator(project, mergedManifestFile);
                launchTask = new DefaultActivityLaunchTask(applicationId, activityLocator, startActivityFlagsProvider);
                break;
            case BlazeAndroidBinaryRunConfigurationState.LAUNCH_SPECIFIC_ACTIVITY:
                launchTask = new SpecificActivityLaunchTask(applicationId, configState.getActivityClass(), startActivityFlagsProvider);
                break;
            case BlazeAndroidBinaryRunConfigurationState.LAUNCH_DEEP_LINK:
                launchTask = new AndroidDeepLinkLaunchTask(configState.getDeepLink(), startActivityFlagsProvider);
                break;
            default:
                launchTask = null;
                break;
        }
        return launchTask;
    } catch (ApkProvisionException e) {
        LOG.error(e);
        processHandlerLaunchStatus.terminateLaunch("Unable to identify application id");
        return null;
    }
}
Also used : SpecificActivityLaunchTask(com.android.tools.idea.run.tasks.SpecificActivityLaunchTask) DefaultActivityLaunchTask(com.android.tools.idea.run.tasks.DefaultActivityLaunchTask) ApkProvisionException(com.android.tools.idea.run.ApkProvisionException) SpecificActivityLaunchTask(com.android.tools.idea.run.tasks.SpecificActivityLaunchTask) LaunchTask(com.android.tools.idea.run.tasks.LaunchTask) DefaultActivityLaunchTask(com.android.tools.idea.run.tasks.DefaultActivityLaunchTask) AndroidDeepLinkLaunchTask(com.android.tools.idea.run.tasks.AndroidDeepLinkLaunchTask) AndroidDeepLinkLaunchTask(com.android.tools.idea.run.tasks.AndroidDeepLinkLaunchTask)

Aggregations

ApkProvisionException (com.android.tools.idea.run.ApkProvisionException)1 AndroidDeepLinkLaunchTask (com.android.tools.idea.run.tasks.AndroidDeepLinkLaunchTask)1 DefaultActivityLaunchTask (com.android.tools.idea.run.tasks.DefaultActivityLaunchTask)1 LaunchTask (com.android.tools.idea.run.tasks.LaunchTask)1 SpecificActivityLaunchTask (com.android.tools.idea.run.tasks.SpecificActivityLaunchTask)1