Loading cmds/incident_helper/src/main.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -73,7 +73,8 @@ static TextParserBase* selectParser(int section) { case 2006: return new BatteryTypeParser(); default: return NULL; // Return no op parser when no specific ones are implemented. return new NoopParser(); } } Loading cmds/incidentd/src/IncidentService.cpp +16 −2 Original line number Diff line number Diff line Loading @@ -314,6 +314,19 @@ status_t IncidentService::command(FILE* in, FILE* out, FILE* err, Vector<String8 mThrottler->dump(out); return NO_ERROR; } if (!args[0].compare(String8("section"))) { int id = atoi(args[1]); int idx = 0; while (SECTION_LIST[idx] != NULL) { const Section* section = SECTION_LIST[idx]; if (section->id == id) { fprintf(out, "Section[%d] %s\n", id, section->name.string()); break; } idx++; } return NO_ERROR; } } return cmd_help(out); } Loading @@ -321,8 +334,9 @@ status_t IncidentService::command(FILE* in, FILE* out, FILE* err, Vector<String8 status_t IncidentService::cmd_help(FILE* out) { fprintf(out, "usage: adb shell cmd incident privacy print <section_id>\n"); fprintf(out, "usage: adb shell cmd incident privacy parse <section_id> < proto.txt\n"); fprintf(out, " Prints/parses for the section id.\n"); fprintf(out, "\n"); fprintf(out, " Prints/parses for the section id.\n\n"); fprintf(out, "usage: adb shell cmd incident section <section_id>\n"); fprintf(out, " Prints section id and its name.\n\n"); fprintf(out, "usage: adb shell cmd incident throttler\n"); fprintf(out, " Prints the current throttler state\n"); return NO_ERROR; Loading core/proto/android/os/incident.proto +6 −0 Original line number Diff line number Diff line Loading @@ -71,6 +71,12 @@ message IncidentProto { (section).args = "getprop" ]; optional string kernel_version = 1002 [ (section).type = SECTION_FILE, (section).args = "/proc/version", (privacy).dest = DEST_AUTOMATIC ]; // Device Logs optional android.util.EventLogTagMapProto event_log_tag_map = 1100 [ (section).type = SECTION_FILE, Loading tools/incident_section_gen/main.cpp +6 −8 Original line number Diff line number Diff line Loading @@ -110,10 +110,8 @@ static bool generateIncidentSectionsCpp(Descriptor const* descriptor) N = descriptor->field_count(); for (int i=0; i<N; i++) { const FieldDescriptor* field = descriptor->field(i); if (field->type() == FieldDescriptor::TYPE_MESSAGE) { sections[field->name()] = field; } } printf("IncidentSection const INCIDENT_SECTIONS[] = {\n"); N = sections.size(); Loading Loading @@ -404,7 +402,7 @@ 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) { if (field->type() != FieldDescriptor::TYPE_MESSAGE && field->type() != FieldDescriptor::TYPE_STRING) { continue; } const SectionFlags s = getSectionFlags(field); Loading Loading @@ -456,13 +454,13 @@ static bool generateSectionListCpp(Descriptor const* descriptor) { const FieldDescriptor* field = fieldsInOrder[i]; const string fieldName = getFieldName(field); const Destination fieldDest = getFieldDest(field); const string fieldMessageName = getMessageName(field->message_type(), fieldDest); skip[i] = true; if (field->type() != FieldDescriptor::TYPE_MESSAGE) { printPrivacy(fieldName, field, "NULL", fieldDest, "NULL"); continue; } skip[i] = true; const string fieldMessageName = getMessageName(field->message_type(), fieldDest); // generate privacy flags for each section. if (generatePrivacyFlags(field->message_type(), fieldDest, variableNames, &parents)) { printPrivacy(fieldName, field, fieldMessageName, fieldDest, "NULL"); Loading Loading
cmds/incident_helper/src/main.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -73,7 +73,8 @@ static TextParserBase* selectParser(int section) { case 2006: return new BatteryTypeParser(); default: return NULL; // Return no op parser when no specific ones are implemented. return new NoopParser(); } } Loading
cmds/incidentd/src/IncidentService.cpp +16 −2 Original line number Diff line number Diff line Loading @@ -314,6 +314,19 @@ status_t IncidentService::command(FILE* in, FILE* out, FILE* err, Vector<String8 mThrottler->dump(out); return NO_ERROR; } if (!args[0].compare(String8("section"))) { int id = atoi(args[1]); int idx = 0; while (SECTION_LIST[idx] != NULL) { const Section* section = SECTION_LIST[idx]; if (section->id == id) { fprintf(out, "Section[%d] %s\n", id, section->name.string()); break; } idx++; } return NO_ERROR; } } return cmd_help(out); } Loading @@ -321,8 +334,9 @@ status_t IncidentService::command(FILE* in, FILE* out, FILE* err, Vector<String8 status_t IncidentService::cmd_help(FILE* out) { fprintf(out, "usage: adb shell cmd incident privacy print <section_id>\n"); fprintf(out, "usage: adb shell cmd incident privacy parse <section_id> < proto.txt\n"); fprintf(out, " Prints/parses for the section id.\n"); fprintf(out, "\n"); fprintf(out, " Prints/parses for the section id.\n\n"); fprintf(out, "usage: adb shell cmd incident section <section_id>\n"); fprintf(out, " Prints section id and its name.\n\n"); fprintf(out, "usage: adb shell cmd incident throttler\n"); fprintf(out, " Prints the current throttler state\n"); return NO_ERROR; Loading
core/proto/android/os/incident.proto +6 −0 Original line number Diff line number Diff line Loading @@ -71,6 +71,12 @@ message IncidentProto { (section).args = "getprop" ]; optional string kernel_version = 1002 [ (section).type = SECTION_FILE, (section).args = "/proc/version", (privacy).dest = DEST_AUTOMATIC ]; // Device Logs optional android.util.EventLogTagMapProto event_log_tag_map = 1100 [ (section).type = SECTION_FILE, Loading
tools/incident_section_gen/main.cpp +6 −8 Original line number Diff line number Diff line Loading @@ -110,10 +110,8 @@ static bool generateIncidentSectionsCpp(Descriptor const* descriptor) N = descriptor->field_count(); for (int i=0; i<N; i++) { const FieldDescriptor* field = descriptor->field(i); if (field->type() == FieldDescriptor::TYPE_MESSAGE) { sections[field->name()] = field; } } printf("IncidentSection const INCIDENT_SECTIONS[] = {\n"); N = sections.size(); Loading Loading @@ -404,7 +402,7 @@ 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) { if (field->type() != FieldDescriptor::TYPE_MESSAGE && field->type() != FieldDescriptor::TYPE_STRING) { continue; } const SectionFlags s = getSectionFlags(field); Loading Loading @@ -456,13 +454,13 @@ static bool generateSectionListCpp(Descriptor const* descriptor) { const FieldDescriptor* field = fieldsInOrder[i]; const string fieldName = getFieldName(field); const Destination fieldDest = getFieldDest(field); const string fieldMessageName = getMessageName(field->message_type(), fieldDest); skip[i] = true; if (field->type() != FieldDescriptor::TYPE_MESSAGE) { printPrivacy(fieldName, field, "NULL", fieldDest, "NULL"); continue; } skip[i] = true; const string fieldMessageName = getMessageName(field->message_type(), fieldDest); // generate privacy flags for each section. if (generatePrivacyFlags(field->message_type(), fieldDest, variableNames, &parents)) { printPrivacy(fieldName, field, fieldMessageName, fieldDest, "NULL"); Loading