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

Commit eea4e0b4 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 5674532 from 76397246 to qt-c2f2-release

Change-Id: Ic7dd487350f78b544c86dd095d565ea7eba3d510
parents 30c4aad3 76397246
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -60,6 +60,8 @@ struct VmsLayer {
};

struct VmsLayerAndPublisher {
    VmsLayerAndPublisher(VmsLayer layer, int publisher_id)
        : layer(layer), publisher_id(publisher_id) {}
    VmsLayer layer;
    int publisher_id;
};
@@ -162,12 +164,16 @@ std::unique_ptr<VehiclePropValue> createAvailabilityRequest();
std::unique_ptr<VehiclePropValue> createSubscriptionsRequest();

// Creates a VehiclePropValue containing a message of type VmsMessageType.DATA.
// Returns a nullptr if the byte string in bytes is empty.
// Returns a nullptr if the vms_packet string in bytes is empty or if the layer_publisher
// information in VmsLayerAndPublisher format is missing the later or publisher
// information.
//
// For example, to build a VehiclePropValue message containing a proto, the caller
// should convert the proto to a byte string using the SerializeToString proto
// API, then use this inteface to build the VehicleProperty.
std::unique_ptr<VehiclePropValue> createDataMessage(const std::string& bytes);
// should first convert the proto to a byte string (vms_packet) using the
// SerializeToString proto API. Then, it use this interface to build the VehicleProperty
// by passing publisher and layer information (layer_publisher) and the vms_packet.
std::unique_ptr<VehiclePropValue> CreateDataMessageWithLayerPublisherInfo(
        const VmsLayerAndPublisher& layer_publisher, const std::string& vms_packet);

// Creates a VehiclePropValue containing a message of type
// VmsMessageType.PUBLISHER_ID_REQUEST with the given publisher information.
+7 −4
Original line number Diff line number Diff line
@@ -126,10 +126,13 @@ std::unique_ptr<VehiclePropValue> createSubscriptionsRequest() {
    return result;
}

std::unique_ptr<VehiclePropValue> createDataMessage(const std::string& bytes) {
    auto result = createBaseVmsMessage(kMessageTypeSize);
    result->value.int32Values = hidl_vec<int32_t>{toInt(VmsMessageType::DATA)};
    result->value.bytes = std::vector<uint8_t>(bytes.begin(), bytes.end());
std::unique_ptr<VehiclePropValue> CreateDataMessageWithLayerPublisherInfo(
        const VmsLayerAndPublisher& layer_publisher, const std::string& vms_packet) {
    auto result = createBaseVmsMessage(kMessageTypeSize + kLayerAndPublisherSize);
    result->value.int32Values = hidl_vec<int32_t>{
            toInt(VmsMessageType::DATA), layer_publisher.layer.type, layer_publisher.layer.subtype,
            layer_publisher.layer.version, layer_publisher.publisher_id};
    result->value.bytes = std::vector<uint8_t>(vms_packet.begin(), vms_packet.end());
    return result;
}

+17 −5
Original line number Diff line number Diff line
@@ -139,12 +139,23 @@ TEST(VmsUtilsTest, subscriptionsMessage) {
}

TEST(VmsUtilsTest, dataMessage) {
    std::string bytes = "aaa";
    auto message = createDataMessage(bytes);
    const std::string bytes = "aaa";
    const VmsLayerAndPublisher layer_and_publisher(VmsLayer(2, 0, 1), 123);
    auto message = CreateDataMessageWithLayerPublisherInfo(layer_and_publisher, bytes);
    ASSERT_NE(message, nullptr);
    EXPECT_TRUE(isValidVmsMessage(*message));
    EXPECT_EQ(message->prop, toInt(VehicleProperty::VEHICLE_MAP_SERVICE));
    EXPECT_EQ(message->value.int32Values.size(), 0x1ul);
    EXPECT_EQ(message->value.int32Values.size(), 0x5ul);
    EXPECT_EQ(message->value.int32Values[0], toInt(VmsMessageType::DATA));

    // Layer
    EXPECT_EQ(message->value.int32Values[1], 2);
    EXPECT_EQ(message->value.int32Values[2], 0);
    EXPECT_EQ(message->value.int32Values[3], 1);

    // Publisher ID
    EXPECT_EQ(message->value.int32Values[4], 123);

    EXPECT_EQ(parseMessageType(*message), VmsMessageType::DATA);
    EXPECT_EQ(message->value.bytes.size(), bytes.size());
    EXPECT_EQ(memcmp(message->value.bytes.data(), bytes.data(), bytes.size()), 0);
@@ -164,8 +175,9 @@ TEST(VmsUtilsTest, invalidMessageType) {
}

TEST(VmsUtilsTest, parseDataMessage) {
    std::string bytes = "aaa";
    auto message = createDataMessage(bytes);
    const std::string bytes = "aaa";
    const VmsLayerAndPublisher layer_and_publisher(VmsLayer(1, 0, 1), 123);
    auto message = CreateDataMessageWithLayerPublisherInfo(layer_and_publisher, bytes);
    auto data_str = parseData(*message);
    ASSERT_FALSE(data_str.empty());
    EXPECT_EQ(data_str, bytes);
+8 −1
Original line number Diff line number Diff line
@@ -1233,7 +1233,14 @@ bool CameraHidlTest::DeviceCb::processCaptureResultLocked(const CaptureResult& r
    }

    if (mUseHalBufManager) {
        returnStreamBuffers(results.outputBuffers);
        // Don't return buffers of bufId 0 (empty buffer)
        std::vector<StreamBuffer> buffers;
        for (const auto& sb : results.outputBuffers) {
            if (sb.bufferId != 0) {
                buffers.push_back(sb);
            }
        }
        returnStreamBuffers(buffers);
    }
    return notify;
}
+1 −0
Original line number Diff line number Diff line
@@ -546,6 +546,7 @@ d8e7717e8187dd7453d4142f8f331e7c325e7a6f9e8d44ac0d52b3be502bfe83 android.hardwar
08d439c463e4044fa78874037d8e8379aa3cabecde32f08a775897eea5a538af android.hardware.secure_element@1.1::ISecureElement
b53ac9d61c24efb16a2d63a861cef20680f6d57adb244a03b9778c675550628b android.hardware.secure_element@1.1::ISecureElementHalCallback
3702b1c52c0bb3427244618e9e7975c05228bf4ceb8720da7a93603a71cb0368 android.hardware.sensors@2.0::ISensors
c36670945ea09d92ae90a557147352ed9bd5223f957d347b367c2acb6f94870f android.hardware.sensors@2.0::ISensors # b/135216821
ae5faa38538a9f50eb71eb7f9b998271124d2c64b761cb11c4d820c7732b4ddc android.hardware.sensors@2.0::ISensorsCallback
3a98242a57d0820dacaca0f7db52bec433eae1f21c498763c6f1ece611c3967b android.hardware.sensors@2.0::types
ce4b98211959449361146d4b1e5554dc841ceb4d4577154d7b2fb6d1eb504f76 android.hardware.soundtrigger@2.2::ISoundTriggerHw
Loading