public void doReboot(boolean force) {
   if (!force) {
     Device d = StatusAsyncTask.instance().getDevice();
     Utils.deployOpenRecoveryScript(d.getCacheDev());
   }
   Utils.reboot("recovery");
 }
  private void startInstallation() {
    if (m_installInfo == null || !StatusAsyncTask.initialized()) {
      Log.e(TAG, "No installation info!");
      m_term.append("No installation info!");
      return;
    }

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M
        && checkSelfPermission(android.Manifest.permission.WRITE_EXTERNAL_STORAGE)
            != PackageManager.PERMISSION_GRANTED) {
      requestPermissions(
          new String[] {android.Manifest.permission.WRITE_EXTERNAL_STORAGE},
          WRITE_EXTERNAL_PERM_REQUEST);
      return;
    }

    final String type = m_installInfo.getString("installation_type");
    if ("multirom".equals(type)) {
      boolean multirom = m_installInfo.getBoolean("install_multirom", false);
      boolean recovery = m_installInfo.getBoolean("install_recovery", false);
      boolean kernel = m_installInfo.getBoolean("install_kernel", false);
      String kernel_name = m_installInfo.getString("kernel_name");

      Manifest man = StatusAsyncTask.instance().getManifest();
      Device dev = StatusAsyncTask.instance().getDevice();

      m_service.startMultiROMInstallation(man, dev, multirom, recovery, kernel, kernel_name);
    } else if ("uninstall_multirom".equals(type)) {
      Manifest man = StatusAsyncTask.instance().getManifest();
      Device dev = StatusAsyncTask.instance().getDevice();
      m_service.startMultiROMUninstallation(man, dev);
    } else if ("ubuntu".equals(type)) {
      m_service.startUbuntuInstallation(
          UbuntuManifestAsyncTask.instance().getInstallInfo(),
          StatusAsyncTask.instance().getMultiROM(),
          StatusAsyncTask.instance().getDevice());
    } else {
      Log.e(TAG, "Unknown installation type: " + type);
      return;
    }

    m_term.setText("");
    m_isCancelEnabled = true;
    setButtonState(BTN_STATE_CANCEL);

    setResult(RESULT_CANCELED);
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
  }