diff options
| author | 2020-10-21 12:04:43 +0000 | |
|---|---|---|
| committer | 2020-10-21 12:04:43 +0000 | |
| commit | a6b7489ded4da69dbbcb158ecbf083151c8420c3 (patch) | |
| tree | a966dc76849964485ca9ebdc66dacc52d5b42f31 | |
| parent | f865665653d8f73f86ac43f8118733d16fd958f2 (diff) | |
| parent | e96bcd52a008a25139acf07050a6dc3a5d153009 (diff) | |
Deletes temporary files from thread pool when report is cancel am: e96bcd52a0
Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/1441349
Change-Id: Ida43557b432609c164f0a977b0b986d3a45eb8f1
| -rw-r--r-- | cmds/dumpstate/DumpPool.cpp | 4 | ||||
| -rw-r--r-- | cmds/dumpstate/DumpPool.h | 5 | ||||
| -rw-r--r-- | cmds/dumpstate/dumpstate.cpp | 9 |
3 files changed, 18 insertions, 0 deletions
diff --git a/cmds/dumpstate/DumpPool.cpp b/cmds/dumpstate/DumpPool.cpp index e174c8eff3..e15ac3fe82 100644 --- a/cmds/dumpstate/DumpPool.cpp +++ b/cmds/dumpstate/DumpPool.cpp @@ -100,6 +100,10 @@ void DumpPool::waitForTask(const std::string& task_name, const std::string& titl } } +void DumpPool::deleteTempFiles() { + deleteTempFiles(tmp_root_); +} + void DumpPool::setLogDuration(bool log_duration) { log_duration_ = log_duration; } diff --git a/cmds/dumpstate/DumpPool.h b/cmds/dumpstate/DumpPool.h index a4ea875541..0c3c2cc0d7 100644 --- a/cmds/dumpstate/DumpPool.h +++ b/cmds/dumpstate/DumpPool.h @@ -134,6 +134,11 @@ class DumpPool { */ void waitForTask(const std::string& task_name, const std::string& title, int out_fd); + /* + * Deletes temporary files created by DumpPool. + */ + void deleteTempFiles(); + static const std::string PREFIX_TMPFILE_NAME; private: diff --git a/cmds/dumpstate/dumpstate.cpp b/cmds/dumpstate/dumpstate.cpp index 0fba40e2e7..eefc84f0f1 100644 --- a/cmds/dumpstate/dumpstate.cpp +++ b/cmds/dumpstate/dumpstate.cpp @@ -2689,6 +2689,15 @@ void Dumpstate::Cancel() { } tombstone_data_.clear(); anr_data_.clear(); + + // Instead of shutdown the pool, we delete temporary files directly since + // shutdown blocking the call. + if (dump_pool_) { + dump_pool_->deleteTempFiles(); + } + if (zip_entry_tasks_) { + zip_entry_tasks_->run(/*do_cancel =*/ true); + } } /* |