use of com.android.tools.idea.run.tasks.DismissKeyguardTask in project intellij by bazelbuild.
the class BlazeAndroidLaunchTasksProvider method getTasks.
@NotNull
@Override
public List<LaunchTask> getTasks(@NotNull IDevice device, @NotNull LaunchStatus launchStatus, @NotNull ConsolePrinter consolePrinter) throws ExecutionException {
final List<LaunchTask> launchTasks = Lists.newArrayList();
Integer userId = runContext.getUserId(device, consolePrinter);
launchOptionsBuilder.setPmInstallOptions(UserIdHelper.getFlagsFromUserId(userId));
LaunchOptions launchOptions = launchOptionsBuilder.build();
if (launchOptions.isClearLogcatBeforeStart()) {
launchTasks.add(new ClearLogcatTask(project));
}
launchTasks.add(new DismissKeyguardTask());
if (launchOptions.isDeploy()) {
ImmutableList<LaunchTask> deployTasks = runContext.getDeployTasks(device, launchOptions);
launchTasks.addAll(deployTasks);
}
if (launchStatus.isLaunchTerminated()) {
return launchTasks;
}
String packageName;
try {
packageName = applicationIdProvider.getPackageName();
ProcessHandlerLaunchStatus processHandlerLaunchStatus = (ProcessHandlerLaunchStatus) launchStatus;
LaunchTask appLaunchTask = runContext.getApplicationLaunchTask(launchOptions, userId, debuggerManager.getAndroidDebugger(), debuggerManager.getAndroidDebuggerState(project), processHandlerLaunchStatus);
if (appLaunchTask != null) {
launchTasks.add(appLaunchTask);
}
} catch (ApkProvisionException e) {
LOG.error(e);
launchStatus.terminateLaunch("Unable to determine application id: " + e);
return ImmutableList.of();
} catch (ExecutionException e) {
launchStatus.terminateLaunch(e.getMessage());
return ImmutableList.of();
}
if (!launchOptions.isDebug() && launchOptions.isOpenLogcatAutomatically()) {
launchTasks.add(new ShowLogcatTask(project, packageName));
}
return launchTasks;
}
Aggregations