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

Commit 0daac91e authored by Rhed Jao's avatar Rhed Jao
Browse files

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
parent 25f50e00
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -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) {
void DumpPool::setLogDuration(bool log_duration) {
    log_duration_ = log_duration;
    log_duration_ = log_duration;
}
}
+5 −0
Original line number Original line Diff line number Diff line
@@ -134,6 +134,11 @@ class DumpPool {
     */
     */
    void waitForTask(const std::string& task_name, const std::string& title, int out_fd);
    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;
    static const std::string PREFIX_TMPFILE_NAME;


  private:
  private:
+9 −0
Original line number Original line Diff line number Diff line
@@ -2688,6 +2688,15 @@ void Dumpstate::Cancel() {
    }
    }
    tombstone_data_.clear();
    tombstone_data_.clear();
    anr_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);
    }
}
}


/*
/*