Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 789d7a58 authored by Gavin Corkery's avatar Gavin Corkery
Browse files

Store ANR traces in internal directory

By storing ANR traces in /bugreports/dumptrace_XXXXXX,
dumpstate may unlink the ANR traces successfully to
avoid a storage leak.

Test: adb bugreport, ensure ANR traces are in the bugreport
      and that the temporary ANR traces file has been
      unlinked
Bug: 122292569
Bug: 179812900
Change-Id: I50e62d5dea1cb7d2aea316553eec310fb579e52d
parent 94be650e
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -2059,7 +2059,7 @@ static void DumpstateWifiOnly() {
}

Dumpstate::RunStatus Dumpstate::DumpTraces(const char** path) {
    const std::string temp_file_pattern = "/data/anr/dumptrace_XXXXXX";
    const std::string temp_file_pattern = ds.bugreport_internal_dir_ + "/dumptrace_XXXXXX";
    const size_t buf_size = temp_file_pattern.length() + 1;
    std::unique_ptr<char[]> file_name_buf(new char[buf_size]);
    memcpy(file_name_buf.get(), temp_file_pattern.c_str(), buf_size);
@@ -3066,6 +3066,9 @@ void Dumpstate::CleanupTmpFiles() {
    android::os::UnlinkAndLogOnError(tmp_path_);
    android::os::UnlinkAndLogOnError(screenshot_path_);
    android::os::UnlinkAndLogOnError(path_);
    if (dump_traces_path != nullptr) {
        android::os::UnlinkAndLogOnError(dump_traces_path);
    }
}

void Dumpstate::EnableParallelRunIfNeeded() {