Add metadata and headers to incident reports.
+ Remove the spawned thread inside the ReportFile for filter_and_write_report
because it leads to accessing freed memory
Instead, let the caller of ReportFile::startFileteringData create the thread.
ReportFile class shouldn't care about whether it's writing to a pipe for IPC
or regular file.
+ Add uri building in incidentd
+ Add metadata and headers to incident reports
Test: existing passed tests in incidentd_test still pass.
Manually tested with statsd
Change-Id: I5fef900d31f5d181275814f1e1c8c98443f201a7
diff --git a/cmds/incidentd/src/proto_util.cpp b/cmds/incidentd/src/proto_util.cpp
index be2f24f..4e8ff71 100644
--- a/cmds/incidentd/src/proto_util.cpp
+++ b/cmds/incidentd/src/proto_util.cpp
@@ -33,11 +33,10 @@
// special section ids
const int FIELD_ID_INCIDENT_HEADER = 1;
-status_t write_header_section(int fd, const vector<uint8_t>& buf) {
+status_t write_header_section(int fd, const uint8_t* buf, size_t bufSize) {
status_t err;
- const size_t bufSize = buf.size();
- if (buf.empty()) {
+ if (bufSize == 0) {
return NO_ERROR;
}
@@ -46,7 +45,7 @@
return err;
}
- err = WriteFully(fd, (uint8_t const*)buf.data(), bufSize);
+ err = WriteFully(fd, buf, bufSize);
if (err != NO_ERROR) {
return err;
}