Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 908c02f5 authored by Yi Jin's avatar Yi Jin
Browse files

Add kernel version to incident report

Bug: 110230810
Test: atest incidentd_test
Change-Id: I502b34f23d61a7346d79ff0dc378add8461d2d27
parent 6b1c5e92
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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();
    }
}

+16 −2
Original line number Diff line number Diff line
@@ -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);
}
@@ -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;
+6 −0
Original line number Diff line number Diff line
@@ -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,
+6 −8
Original line number Diff line number Diff line
@@ -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();
@@ -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);
@@ -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");