summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Ryan Savitski <rsavitski@google.com> 2019-06-03 23:57:09 +0100
committer Ryan Savitski <rsavitski@google.com> 2019-06-07 18:13:56 +0100
commitcc7d9973c6a22f2bc1393641ce396933ac8744c1 (patch)
tree3af838fbc6abda5413fa97c7a0a0c8b71b9ca22e
parentd4d9b233b2dd7d6059a293bb638ee97287de81b7 (diff)
userdebug: support perfetto traces as a section in incident reports
This set of patches adds a way for the perfetto command line client to save a trace to a hardcoded location, /data/misc/perfetto-traces/incident-trace, and call into incidentd to start a report, which will include said trace in a new section. This is not a long-term solution, and is structured to minimize changes to perfetto and incidentd. The latter is currently architected in a way where it can only pull pre-defined information out of the system, so we're resorting to persisting the intermediate results in a hardcoded location. This will introduce at most two more linked files at the same time. Bug: 130543265 Tested: manually on crosshatch-userdebug Merged-In: Iaaa312d2d9da73ca329807211227a8c7a049102c Change-Id: Iaaa312d2d9da73ca329807211227a8c7a049102c (cherry picked from commit 09a847902fa428f97841c3689b9f11243cc60460)
-rw-r--r--cmds/incident_helper/src/main.cpp2
-rw-r--r--cmds/incidentd/src/Section.cpp2
-rw-r--r--core/proto/android/os/incident.proto8
-rw-r--r--tools/incident_section_gen/main.cpp7
4 files changed, 16 insertions, 3 deletions
diff --git a/cmds/incident_helper/src/main.cpp b/cmds/incident_helper/src/main.cpp
index 809a77163fb4..ff5fd86cf11e 100644
--- a/cmds/incident_helper/src/main.cpp
+++ b/cmds/incident_helper/src/main.cpp
@@ -72,6 +72,8 @@ static TextParserBase* selectParser(int section) {
return new PsParser();
case 2006:
return new BatteryTypeParser();
+ case 3026: // system_trace is already a serialized protobuf
+ return new NoopParser();
default:
// Return no op parser when no specific ones are implemented.
return new NoopParser();
diff --git a/cmds/incidentd/src/Section.cpp b/cmds/incidentd/src/Section.cpp
index 85c5a20174c3..1572114c639f 100644
--- a/cmds/incidentd/src/Section.cpp
+++ b/cmds/incidentd/src/Section.cpp
@@ -67,6 +67,8 @@ bool section_requires_specific_mention(int sectionId) {
switch (sectionId) {
case 3025: // restricted_images
return true;
+ case 3026: // system_trace
+ return true;
default:
return false;
}
diff --git a/core/proto/android/os/incident.proto b/core/proto/android/os/incident.proto
index 9a9c9d14154b..7d0629ee6fba 100644
--- a/core/proto/android/os/incident.proto
+++ b/core/proto/android/os/incident.proto
@@ -321,6 +321,14 @@ message IncidentProto {
(section).args = "incidentcompanion --restricted_image"
];
+ // System trace as a serialized protobuf.
+ optional bytes system_trace = 3026 [
+ (section).type = SECTION_FILE,
+ (section).args = "/data/misc/perfetto-traces/incident-trace",
+ (privacy).dest = DEST_AUTOMATIC,
+ (section).userdebug_and_eng_only = true
+ ];
+
// Reserved for OEMs.
extensions 50000 to 100000;
}
diff --git a/tools/incident_section_gen/main.cpp b/tools/incident_section_gen/main.cpp
index c9c0edc59585..91f875ed9918 100644
--- a/tools/incident_section_gen/main.cpp
+++ b/tools/incident_section_gen/main.cpp
@@ -408,9 +408,10 @@ static bool generateSectionListCpp(Descriptor const* descriptor) {
for (int i=0; i<descriptor->field_count(); i++) {
const FieldDescriptor* field = descriptor->field(i);
- if (field->type() != FieldDescriptor::TYPE_MESSAGE
- && field->type() != FieldDescriptor::TYPE_STRING) {
- continue;
+ if (field->type() != FieldDescriptor::TYPE_MESSAGE &&
+ field->type() != FieldDescriptor::TYPE_STRING &&
+ field->type() != FieldDescriptor::TYPE_BYTES) {
+ continue;
}
const SectionFlags s = getSectionFlags(field);