use of com.android.tools.idea.run.AndroidProcessHandler in project android by JetBrains.
the class AndroidConnectDebuggerAction method terminateRunSessions.
// Disconnect any active run sessions to the same client
private static void terminateRunSessions(@NotNull Project project, @NotNull Client selectedClient) {
int pid = selectedClient.getClientData().getPid();
// find if there are any active run sessions to the same client, and terminate them if so
for (ProcessHandler handler : ExecutionManager.getInstance(project).getRunningProcesses()) {
if (handler instanceof AndroidProcessHandler) {
Client client = ((AndroidProcessHandler) handler).getClient(selectedClient.getDevice());
if (client != null && client.getClientData().getPid() == pid) {
((AndroidProcessHandler) handler).setNoKill();
handler.detachProcess();
handler.notifyTextAvailable("Disconnecting run session: a new debug session will be established.\n", ProcessOutputTypes.STDOUT);
break;
}
}
}
}
Aggregations