Esempio n. 1
0
  public void DD() throws FailedExecuteCommand, IOException, InterruptedException {
    String Command = "";
    if (isJobFlash() || isJobRestore()) {
      if (mDevice.getName().startsWith("g2") && Build.MANUFACTURER.equals("lge") && isJobFlash()) {
        File aboot = new File("/dev/block/platform/msm_sdcc.1/by-name/aboot");
        File extracted_aboot = new File(mContext.getFilesDir(), "aboot.img");
        File patched_CustomIMG = new File(mContext.getFilesDir(), CustomIMG.getName() + ".lok");
        File loki_patch = new File(mContext.getFilesDir(), "loki_patch");
        File loki_flash = new File(mContext.getFilesDir(), "loki_flash");
        mShell.execCommand(
            "dd if=" + aboot.getAbsolutePath() + " of=" + extracted_aboot.getAbsolutePath(), true);
        mShell.execCommand(
            loki_patch.getAbsolutePath()
                + " recovery "
                + CustomIMG.getAbsolutePath()
                + " "
                + patched_CustomIMG.getAbsolutePath()
                + "  || exit 1",
            true);
        Command =
            loki_flash.getAbsolutePath()
                + " recovery "
                + patched_CustomIMG.getAbsolutePath()
                + " || exit 1";
      } else {
        Log.i(TAG, "Flash started!");
        Common.copyFile(CustomIMG, tmpFile);
        Command =
            busybox.getAbsolutePath()
                + " dd if=\""
                + tmpFile.getAbsolutePath()
                + "\" "
                + "of=\""
                + CurrentPartition.getAbsolutePath()
                + "\"";
      }
    } else if (isJobBackup()) {
      Log.i(TAG, "Backup started!");

      Command =
          busybox.getAbsolutePath()
              + " dd if=\""
              + CurrentPartition.getAbsolutePath()
              + "\" "
              + "of=\""
              + tmpFile.getAbsolutePath()
              + "\"";
    }
    mShell.execCommand(Command, true);
    if (isJobBackup()) placeImgBack();
  }
Esempio n. 2
0
 public void copy(File source, File destination) throws Exception {
   mShell.execCommand(
       busybox.getAbsolutePath()
           + " cp "
           + source.getAbsolutePath()
           + " "
           + destination.getAbsolutePath());
 }
Esempio n. 3
0
 public void MTD() throws FailedExecuteCommand, IOException, InterruptedException {
   String Command = "";
   if (isJobRecovery()) {
     Command = " recovery ";
   } else if (isJobKernel()) {
     Command = " boot ";
   }
   if (isJobFlash() || isJobRestore()) {
     Log.i(TAG, "Flash started!");
     Command = flash_image.getAbsolutePath() + Command + "\"" + tmpFile.getAbsolutePath() + "\"";
   } else if (isJobBackup()) {
     Log.i(TAG, "Backup started!");
     Command = dump_image.getAbsolutePath() + Command + "\"" + tmpFile.getAbsolutePath() + "\"";
   }
   mShell.execCommand(Command, true);
   if (isJobBackup()) placeImgBack();
 }
Esempio n. 4
0
  public void SONY() throws FailedExecuteCommand, IOException, InterruptedException {

    String Command = "";
    if (mDevice.getName().equals("yuga")
        || mDevice.getName().equals("c6602")
        || mDevice.getName().equals("montblanc")) {
      if (isJobFlash() || isJobRestore()) {
        File charger = new File(Rashr.PathToUtils, "charger");
        File chargermon = new File(Rashr.PathToUtils, "chargermon");
        File ric = new File(Rashr.PathToUtils, "ric");
        mToolbox.remount(CurrentPartition, "RW");
        try {
          mToolbox.copyFile(charger, CurrentPartition.getParentFile(), true, false);
          mToolbox.copyFile(chargermon, CurrentPartition.getParentFile(), true, false);
          if (mDevice.getName().equals("yuga") || mDevice.getName().equals("c6602")) {
            mToolbox.copyFile(ric, CurrentPartition.getParentFile(), true, false);
            mToolbox.setFilePermissions(ric, "755");
          }
        } catch (Exception e) {
          e.printStackTrace();
          ERRORS.add(e.toString());
        }
        mToolbox.setFilePermissions(charger, "755");
        mToolbox.setFilePermissions(chargermon, "755");
        mToolbox.setFilePermissions(CustomIMG, "644");
        mToolbox.remount(CurrentPartition, "RO");
        Log.i(TAG, "Flash started!");
        Command =
            "cat " + CustomIMG.getAbsolutePath() + " >> " + CurrentPartition.getAbsolutePath();
      } else if (isJobBackup()) {
        Log.i(TAG, "Backup started!");
        Command =
            "cat " + CurrentPartition.getAbsolutePath() + " >> " + CustomIMG.getAbsolutePath();
      }
    }
    mShell.execCommand(Command, true);
    if (isJobBackup()) placeImgBack();
  }