private File writeLogcat(List<String> elidedLogcat) throws IOException {
   CrashFileManager fileManager = new CrashFileManager(mContext.getCacheDir());
   File logcatFile = fileManager.createNewTempFile("logcat.txt");
   PrintWriter pWriter = null;
   try {
     pWriter = new PrintWriter(new FileWriter(logcatFile));
     for (String ln : elidedLogcat) {
       pWriter.println(ln);
     }
     return logcatFile;
   } finally {
     if (pWriter != null) {
       pWriter.close();
     }
   }
 }
  private void processMinidump(
      File logcatFile, String name, CrashFileManager manager, boolean isLast) throws IOException {
    String toPath = MINIDUMP_EXTENSION.matcher(name).replaceAll(LOGCAT_EXTENSION);
    File toFile = manager.createNewTempFile(toPath);

    // For the last file, we don't need to make extra copies. We'll use the original
    // logcat file but we would pass down the redirect intent so it can be triggered
    // upon completion.
    Intent intent = null;
    if (isLast) {
      move(logcatFile, toFile);
      intent =
          MinidumpPreparationService.createMinidumpPreparationIntent(
              mContext, manager.getCrashFile(name), toFile, mRedirectIntent);
    } else {
      copy(logcatFile, toFile);
      intent =
          MinidumpPreparationService.createMinidumpPreparationIntent(
              mContext, manager.getCrashFile(name), toFile, null);
    }
    mContext.startService(intent);
  }
  @Override
  public Boolean call() {
    Log.i(TAG, "Trying to extract logcat for minidump");
    try {
      // Step 1: Extract a single logcat file.
      File logcatFile = getElidedLogcat();

      // Step 2: Make copies of logcat file for each  minidump then invoke
      // MinidumpPreparationService on each file pair.
      int len = mMinidumpFilenames.length;
      CrashFileManager fileManager = new CrashFileManager(mContext.getCacheDir());
      for (int i = 0; i < len; i++) {
        // Output crash dump file path to logcat so non-browser crashes appear too.
        Log.i(TAG, "Output crash dump:");
        Log.i(TAG, fileManager.getCrashFile(mMinidumpFilenames[i]).getAbsolutePath());
        processMinidump(logcatFile, mMinidumpFilenames[i], fileManager, i == len - 1);
      }
      return true;
    } catch (IOException | InterruptedException e) {
      Log.w(TAG, e.toString());
      return false;
    }
  }