Merge "Split bugreport identifier into id and pid." into nyc-dev
diff --git a/cmds/dumpstate/dumpstate.cpp b/cmds/dumpstate/dumpstate.cpp
index b183289..462cf7d 100644
--- a/cmds/dumpstate/dumpstate.cpp
+++ b/cmds/dumpstate/dumpstate.cpp
@@ -56,6 +56,7 @@
static const char *dump_traces_path = NULL;
// TODO: should be part of dumpstate object
+static unsigned long id;
static char build_type[PROPERTY_VALUE_MAX];
static time_t now;
static std::unique_ptr<ZipWriter> zip_writer;
@@ -477,6 +478,7 @@
dump_file(NULL, "/proc/version");
printf("Command line: %s\n", strtok(cmdline_buf, "\n"));
printf("Bugreport format version: %s\n", version.c_str());
+ printf("Dumpstate info: id=%lu pid=%d\n", id, getpid());
printf("\n");
}
@@ -1040,6 +1042,14 @@
MYLOGI("begin\n");
+ /* gets the sequential id */
+ char last_id[PROPERTY_VALUE_MAX];
+ property_get("dumpstate.last_id", last_id, "0");
+ id = strtoul(last_id, NULL, 10) + 1;
+ sprintf(last_id, "%lu", id);
+ property_set("dumpstate.last_id", last_id);
+ MYLOGI("dumpstate id: %lu\n", id);
+
/* clear SIGPIPE handler */
memset(&sigact, 0, sizeof(sigact));
sigact.sa_handler = sigpipe_handler;
@@ -1180,6 +1190,7 @@
std::vector<std::string> am_args = {
"--receiver-permission", "android.permission.DUMP", "--receiver-foreground",
"--es", "android.intent.extra.NAME", suffix,
+ "--ei", "android.intent.extra.ID", std::to_string(id),
"--ei", "android.intent.extra.PID", std::to_string(getpid()),
"--ei", "android.intent.extra.MAX", std::to_string(WEIGHT_TOTAL),
};
@@ -1330,6 +1341,7 @@
MYLOGI("Final bugreport path: %s\n", path.c_str());
std::vector<std::string> am_args = {
"--receiver-permission", "android.permission.DUMP", "--receiver-foreground",
+ "--ei", "android.intent.extra.ID", std::to_string(id),
"--ei", "android.intent.extra.PID", std::to_string(getpid()),
"--es", "android.intent.extra.BUGREPORT", path,
"--es", "android.intent.extra.DUMPSTATE_LOG", log_path