incidentd sections for userdebug and eng are compiled out
Previously, the decision to include or not include them was
done at runtime. This changes them to be behind a compile
time flag. It's just safer, because the code just isn't there
instead of being dependent on a system property.
Test: bit GtsIncidentManagerTestCases:*
Bug: 123543706
Change-Id: If4e611914a7b0acd399ae27e55af8f718aee3ec8
diff --git a/tools/incident_section_gen/main.cpp b/tools/incident_section_gen/main.cpp
index f6c9c0e..3b3fe19 100644
--- a/tools/incident_section_gen/main.cpp
+++ b/tools/incident_section_gen/main.cpp
@@ -408,10 +408,16 @@
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) {
+ if (field->type() != FieldDescriptor::TYPE_MESSAGE
+ && field->type() != FieldDescriptor::TYPE_STRING) {
continue;
}
+
const SectionFlags s = getSectionFlags(field);
+ if (s.userdebug_and_eng_only()) {
+ printf("#if ALLOW_RESTRICTED_SECTIONS\n");
+ }
+
switch (s.type()) {
case SECTION_NONE:
continue;
@@ -424,8 +430,7 @@
printf(" NULL),\n");
break;
case SECTION_DUMPSYS:
- printf(" new DumpsysSection(%d, %s,", field->number(),
- s.userdebug_and_eng_only() ? "true" : "false");
+ printf(" new DumpsysSection(%d, ", field->number());
splitAndPrint(s.args());
printf(" NULL),\n");
break;
@@ -438,9 +443,13 @@
printf(" NULL),\n");
break;
case SECTION_TOMBSTONE:
- printf(" new TombstoneSection(%d, \"%s\"),\n", field->number(), s.args().c_str());
+ printf(" new TombstoneSection(%d, \"%s\"),\n", field->number(),
+ s.args().c_str());
break;
}
+ if (s.userdebug_and_eng_only()) {
+ printf("#endif\n");
+ }
}
printf(" NULL };\n");