Deletes temporary files from thread pool when report is cancel

Bug: 163027506
Test: atest dumpstate_test
Test: atest dumpstate_smoke_test
Test: Manual cancel the bureport from notification.
Change-Id: Ic4ab0531e0f598c2d2b820293cd2e6444bbf1abb
Merged-In: Ic4ab0531e0f598c2d2b820293cd2e6444bbf1abb
(cherry picked from commit 0daac91e7b4b2b9a108be1f57dd77c9813abb90f)
diff --git a/cmds/dumpstate/dumpstate.cpp b/cmds/dumpstate/dumpstate.cpp
index 0fba40e..eefc84f 100644
--- a/cmds/dumpstate/dumpstate.cpp
+++ b/cmds/dumpstate/dumpstate.cpp
@@ -2689,6 +2689,15 @@
     }
     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);
+    }
 }
 
 /*