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

Commit ad3e6e5d authored by Yi Jin's avatar Yi Jin
Browse files

This cl tries to fix cts tests IncidentdTest

1. Disable BatteryType section which is device-specific
2. Make timeout longer since meminfo section timedout in test
3. make some negative values sint
4. varint can be 64 bits, there is a bug implicitly convert it to 32
which loses values.
5. Found another bug which failed to read 64 bits varint, create a
native test to make sure it works.

Bug: 77291057
Test: atest CtsIncidentHostTestCases:com.android.server.cts.IncidentdTest
Change-Id: I04cc730741f7901f37ac57a11af7777d57118a23
parent 3275d9a0
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -34,7 +34,7 @@ namespace incidentd {
void PrivacyBuffer::writeFieldOrSkip(uint32_t fieldTag, bool skip) {
void PrivacyBuffer::writeFieldOrSkip(uint32_t fieldTag, bool skip) {
    uint8_t wireType = read_wire_type(fieldTag);
    uint8_t wireType = read_wire_type(fieldTag);
    size_t bytesToWrite = 0;
    size_t bytesToWrite = 0;
    uint32_t varint = 0;
    uint64_t varint = 0;


    switch (wireType) {
    switch (wireType) {
        case WIRE_TYPE_VARINT:
        case WIRE_TYPE_VARINT:
+1 −1
Original line number Original line Diff line number Diff line
@@ -31,7 +31,7 @@ namespace android {
namespace os {
namespace os {
namespace incidentd {
namespace incidentd {


const int64_t REMOTE_CALL_TIMEOUT_MS = 10 * 1000;  // 10 seconds
const int64_t REMOTE_CALL_TIMEOUT_MS = 30 * 1000;  // 30 seconds


/**
/**
 * Base class for sections
 * Base class for sections
+1 −1
Original line number Original line Diff line number Diff line
@@ -170,7 +170,7 @@ message IncidentProto {
    ];
    ];


    optional BatteryTypeProto battery_type = 2006 [
    optional BatteryTypeProto battery_type = 2006 [
        (section).type = SECTION_FILE,
        (section).type = SECTION_NONE, // disabled since the path is device specific!
        (section).args = "/sys/class/power_supply/bms/battery_type"
        (section).args = "/sys/class/power_supply/bms/battery_type"
    ];
    ];


+3 −3
Original line number Original line Diff line number Diff line
@@ -65,7 +65,7 @@ message NotificationRecordProto {
    optional bool can_vibrate = 7;
    optional bool can_vibrate = 7;
    optional bool can_show_light = 8;
    optional bool can_show_light = 8;
    optional string group_key = 9 [ (.android.privacy).dest = DEST_EXPLICIT ];
    optional string group_key = 9 [ (.android.privacy).dest = DEST_EXPLICIT ];
    optional int32 importance = 10;
    optional sint32 importance = 10;
}
}


message ListenersDisablingEffectsProto {
message ListenersDisablingEffectsProto {
@@ -122,11 +122,11 @@ message RankingHelperProto {
        // Default value is UNKNOWN_UID = USER_NULL = -10000.
        // Default value is UNKNOWN_UID = USER_NULL = -10000.
        optional int32 uid = 2;
        optional int32 uid = 2;
        // Default is IMPORTANCE_UNSPECIFIED (-1000).
        // Default is IMPORTANCE_UNSPECIFIED (-1000).
        optional int32 importance = 3;
        optional sint32 importance = 3;
        // Default is PRIORITY_DEFAULT (0).
        // Default is PRIORITY_DEFAULT (0).
        optional int32 priority = 4;
        optional int32 priority = 4;
        // Default is VISIBILITY_NO_OVERRIDE (-1000).
        // Default is VISIBILITY_NO_OVERRIDE (-1000).
        optional int32 visibility = 5;
        optional sint32 visibility = 5;
        // Default is true.
        // Default is true.
        optional bool show_badge = 6;
        optional bool show_badge = 6;
        repeated android.app.NotificationChannelProto channels = 7;
        repeated android.app.NotificationChannelProto channels = 7;
+17 −0
Original line number Original line Diff line number Diff line
@@ -37,3 +37,20 @@ cc_library {
        "liblog",
        "liblog",
    ],
    ],
}
}

cc_test {
    name: "libprotoutil_test",

    srcs: [
        "tests/EncodedBuffer_test.cpp",
    ],

    shared_libs: [
        "libcutils",
        "libprotoutil",
    ],

    static_libs: [
        "libgmock",
    ],
}
Loading