Search in sources :

Example 1 with SystemInfoStatsMonitor

use of com.android.tools.idea.sdk.SystemInfoStatsMonitor 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();
    }
}
Also used : IdeSdks(com.android.tools.idea.sdk.IdeSdks) PatchInstallingRestarter(com.android.tools.idea.sdk.install.patch.PatchInstallingRestarter) SystemInfoStatsMonitor(com.android.tools.idea.sdk.SystemInfoStatsMonitor) AndroidSdkHandler(com.android.sdklib.repository.AndroidSdkHandler) File(java.io.File) IOException(java.io.IOException)

Aggregations

AndroidSdkHandler (com.android.sdklib.repository.AndroidSdkHandler)1 IdeSdks (com.android.tools.idea.sdk.IdeSdks)1 SystemInfoStatsMonitor (com.android.tools.idea.sdk.SystemInfoStatsMonitor)1 PatchInstallingRestarter (com.android.tools.idea.sdk.install.patch.PatchInstallingRestarter)1 File (java.io.File)1 IOException (java.io.IOException)1