Пример #1
0
 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();
     }
   }
 }
Пример #2
0
  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);
  }