diff options
author | Gavin Corkery <gavincorkery@google.com> | 2021-02-24 23:52:35 +0000 |
---|---|---|
committer | Gavin Corkery <gavincorkery@google.com> | 2021-02-24 23:52:35 +0000 |
commit | 789d7a5882cba2074e8a389e75ddbc29ef4c3cf7 (patch) | |
tree | 7e7bf556068f71c91787dd93bc83c4735c8b1c2d | |
parent | 94be650e36d8573f442b6f90f699f344a266c351 (diff) | |
download | native-789d7a5882cba2074e8a389e75ddbc29ef4c3cf7.tar.gz |
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
-rw-r--r-- | cmds/dumpstate/dumpstate.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/cmds/dumpstate/dumpstate.cpp b/cmds/dumpstate/dumpstate.cpp index 9e73dcc4d5..70ba806176 100644 --- a/cmds/dumpstate/dumpstate.cpp +++ b/cmds/dumpstate/dumpstate.cpp @@ -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() { |