コード例 #1
0
  /**
   * Reloads the SDK content (targets).
   *
   * <p>This also reloads the AVDs in case their status changed.
   *
   * <p>This does not notify the listeners ({@link ISdkChangeListener}).
   */
  public void reloadSdk() {
    // reload SDK
    mSdkManager.reloadSdk(mSdkLog);

    // reload AVDs
    if (mAvdManager != null) {
      try {
        mAvdManager.reloadAvds(mSdkLog);
      } catch (AndroidLocationException e) {
        // FIXME
      }
    }

    mLocalSdkParser.clearPackages();

    // notify listeners
    broadcastOnSdkReload();
  }
コード例 #2
0
  /**
   * Initializes the {@link SdkManager} and the {@link AvdManager}. Extracted so that we can
   * override this in unit tests.
   */
  @VisibleForTesting(visibility = Visibility.PRIVATE)
  protected void initSdk() {
    setSdkManager(SdkManager.createManager(mOsSdkRoot, mSdkLog));
    try {
      mAvdManager = null;
      mAvdManager = AvdManager.getInstance(mSdkManager, mSdkLog);
    } catch (AndroidLocationException e) {
      mSdkLog.error(e, "Unable to read AVDs: " + e.getMessage()); // $NON-NLS-1$

      // Note: we used to continue here, but the thing is that
      // mAvdManager==null so nothing is really going to work as
      // expected. Let's just display an error later in checkIfInitFailed()
      // and abort right there. This step is just too early in the SWT
      // setup process to display a message box yet.

      mAvdManagerInitError = e;
    }

    // notify listeners.
    broadcastOnSdkReload();
  }