use of com.android.tools.idea.sdk.install.patch.PatchInstallingRestarter in project android by JetBrains.
the class AndroidSdkInitializer method run.
@Override
public void run() {
if (!isAndroidSdkManagerEnabled()) {
return;
}
// If running in a GUI test we don't want the "Select SDK" dialog to show up when running GUI tests.
if (isGuiTestingMode()) {
// This is good enough. Later on in the GUI test we'll validate the given SDK path.
return;
}
IdeSdks ideSdks = IdeSdks.getInstance();
File androidSdkPath = ideSdks.getAndroidSdkPath();
if (androidSdkPath == null) {
try {
// Setup JDK and Android SDK if necessary
setUpSdks();
androidSdkPath = ideSdks.getAndroidSdkPath();
} catch (Exception e) {
LOG.error("Unexpected error while setting up SDKs: ", e);
}
}
if (androidSdkPath != null) {
AndroidSdkHandler handler = AndroidSdkHandler.getInstance(androidSdkPath);
new PatchInstallingRestarter(handler, FileOpUtils.create()).restartAndInstallIfNecessary();
// We need to start the system info monitoring even in case when user never
// runs a single emulator instance: e.g., incompatible hypervisor might be
// the reason why emulator is never run, and that's exactly the data
// SystemInfoStatsMonitor collects
new SystemInfoStatsMonitor().start();
}
}
Aggregations