diff options
author | Joe Onorato <joeo@google.com> | 2019-03-24 20:57:16 -0700 |
---|---|---|
committer | Joe Onorato <joeo@google.com> | 2019-03-27 00:23:20 -0700 |
commit | fe7bbf410cf1e753fb0f66777c2f2b43bb3ddbf8 (patch) | |
tree | be98f187726b6413039e8f91716fb962bb7361f8 /tools/incident_section_gen | |
parent | ceece4851870405fb75dc915f2293a985bd3a294 (diff) |
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
Diffstat (limited to 'tools/incident_section_gen')
-rw-r--r-- | tools/incident_section_gen/main.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/tools/incident_section_gen/main.cpp b/tools/incident_section_gen/main.cpp index f6c9c0e86fe4..3b3fe196736d 100644 --- a/tools/incident_section_gen/main.cpp +++ b/tools/incident_section_gen/main.cpp @@ -408,10 +408,16 @@ 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) { + 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 @@ static bool generateSectionListCpp(Descriptor const* descriptor) { 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 @@ static bool generateSectionListCpp(Descriptor const* descriptor) { 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"); |