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
diff --git a/cmds/dumpstate/dumpstate.cpp b/cmds/dumpstate/dumpstate.cpp
index d108e00..c8277fe 100644
--- a/cmds/dumpstate/dumpstate.cpp
+++ b/cmds/dumpstate/dumpstate.cpp
@@ -2688,6 +2688,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);
+    }
 }
 
 /*