use of com.android.tools.idea.run.editor.AndroidDebuggerContext in project android by JetBrains.
the class AndroidLaunchTasksProvider method getConnectDebuggerTask.
@Nullable
@Override
public DebugConnectorTask getConnectDebuggerTask(@NotNull LaunchStatus launchStatus, @Nullable AndroidVersion version) {
if (!myLaunchOptions.isDebug()) {
return null;
}
Logger logger = Logger.getInstance(AndroidLaunchTasksProvider.class);
Set<String> packageIds = Sets.newHashSet();
try {
String packageName = myApplicationIdProvider.getPackageName();
packageIds.add(packageName);
} catch (ApkProvisionException e) {
logger.error(e);
}
try {
String packageName = myApplicationIdProvider.getTestPackageName();
if (packageName != null) {
packageIds.add(packageName);
}
} catch (ApkProvisionException e) {
// not as severe as failing to obtain package id for main application
logger.warn("Unable to obtain test package name, will not connect debugger if tests don't instantiate main application");
}
AndroidDebuggerContext androidDebuggerContext = myRunConfig.getAndroidDebuggerContext();
AndroidDebugger debugger = androidDebuggerContext.getAndroidDebugger();
if (debugger == null) {
logger.warn("Unable to determine debugger to use for this launch");
return null;
}
logger.info("Using debugger: " + debugger.getId());
AndroidDebuggerState androidDebuggerState = androidDebuggerContext.getAndroidDebuggerState();
if (androidDebuggerState != null) {
//noinspection unchecked
return debugger.getConnectDebuggerTask(myEnv, version, packageIds, myFacet, androidDebuggerState, myRunConfig.getType().getId(), monitorRemoteProcess());
}
return null;
}
Aggregations