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

Commit 23004819 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix warning in Vehicle HAL"

parents 57108a0d 308515f6
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -15,9 +15,9 @@
 */

#define LOG_TAG "DefaultVehicleHal"
#include <android/log.h>

#include <algorithm>
#include <android/log.h>
#include <netinet/in.h>
#include <sys/socket.h>

+8 −8
Original line number Diff line number Diff line
@@ -50,7 +50,7 @@ TEST_F(AccessControlConfigParserTest, basicParsing) {

    ASSERT_TRUE(parser->parseFromStream(&file, &aclMap));

    ASSERT_EQ(1, aclMap.size());
    ASSERT_EQ(1u, aclMap.size());
    auto it = aclMap.find(toInt(VehicleProperty::HVAC_FAN_SPEED));
    ASSERT_NE(aclMap.end(), it);
    ASSERT_EQ(VehiclePropertyAccess::READ_WRITE, it->second.access);
@@ -74,7 +74,7 @@ TEST_F(AccessControlConfigParserTest, multipleUids) {
    for (auto it = range.first; it != range.second; ++it) {
        auto& acl = it->second;

        ASSERT_EQ(1, expectedUids.count(acl.uid))
        ASSERT_EQ(1u, expectedUids.count(acl.uid))
                << " uid: " << std::hex << acl.uid;

        if (acl.uid == 0xbeef) {
@@ -93,12 +93,12 @@ TEST_F(AccessControlConfigParserTest, fileContainsJunk) {

    ASSERT_FALSE(parser->parseFromStream(&file, &aclMap));

    ASSERT_EQ(1, aclMap.size());
    ASSERT_EQ(1u, aclMap.size());
    auto it = aclMap.find(toInt(VehicleProperty::HVAC_FAN_SPEED));
    ASSERT_NE(aclMap.end(), it);
    ASSERT_EQ(VehiclePropertyAccess::READ, it->second.access);
    ASSERT_EQ(toInt(VehicleProperty::HVAC_FAN_SPEED), it->second.propId);
    ASSERT_EQ(0xbeef, it->second.uid);
    ASSERT_EQ(0xBEEFu, it->second.uid);
}

TEST_F(AccessControlConfigParserTest, badIntegerFormat) {
@@ -106,7 +106,7 @@ TEST_F(AccessControlConfigParserTest, badIntegerFormat) {
    file << "S:0x0500 A12 RW " << std::endl;

    ASSERT_FALSE(parser->parseFromStream(&file, &aclMap));
    ASSERT_EQ(0, aclMap.size());
    ASSERT_EQ(0u, aclMap.size());
}

TEST_F(AccessControlConfigParserTest, ignoreNotSupportedProperties) {
@@ -114,7 +114,7 @@ TEST_F(AccessControlConfigParserTest, ignoreNotSupportedProperties) {
    file << "S:0x0666 1000 RW " << std::endl;

    ASSERT_FALSE(parser->parseFromStream(&file, &aclMap));
    ASSERT_EQ(0, aclMap.size());
    ASSERT_EQ(0u, aclMap.size());
}

TEST_F(AccessControlConfigParserTest, multipleCalls) {
@@ -122,12 +122,12 @@ TEST_F(AccessControlConfigParserTest, multipleCalls) {
    configFile << "S:0x0500 1000 RW" << std::endl;

    ASSERT_TRUE(parser->parseFromStream(&configFile, &aclMap));
    ASSERT_EQ(1, aclMap.size());
    ASSERT_EQ(1u, aclMap.size());

    std::stringstream configFile2;
    configFile2 << "S:0x0501 1004 RW" << std::endl;
    ASSERT_TRUE(parser->parseFromStream(&configFile2, &aclMap));
    ASSERT_EQ(2, aclMap.size());
    ASSERT_EQ(2u, aclMap.size());

    auto it = aclMap.find(toInt(VehicleProperty::HVAC_FAN_SPEED));
    ASSERT_NE(aclMap.end(), it);
+8 −8
Original line number Diff line number Diff line
@@ -103,13 +103,13 @@ public:
        return StatusCode::OK;
    }

    StatusCode subscribe(int32_t property,
                         int32_t areas,
                         float sampleRate) override {
    StatusCode subscribe(int32_t /* property */,
                         int32_t /* areas */,
                         float /* sampleRate */) override {
        return StatusCode::OK;
    }

    StatusCode unsubscribe(int32_t property) override {
    StatusCode unsubscribe(int32_t /* property */) override {
        return StatusCode::OK;
    }

@@ -323,20 +323,20 @@ TEST_F(VehicleHalManagerTest, get_Complex) {
    ASSERT_EQ(StatusCode::OK, actualStatusCode);
    ASSERT_EQ(toInt(VehicleProperty::VEHICLE_MAP_SERVICE), actualValue.prop);

    ASSERT_EQ(3, actualValue.value.bytes.size());
    ASSERT_EQ(3u, actualValue.value.bytes.size());
    ASSERT_EQ(1, actualValue.value.bytes[0]);
    ASSERT_EQ(2, actualValue.value.bytes[1]);
    ASSERT_EQ(3, actualValue.value.bytes[2]);

    ASSERT_EQ(2, actualValue.value.int32Values.size());
    ASSERT_EQ(2u, actualValue.value.int32Values.size());
    ASSERT_EQ(10, actualValue.value.int32Values[0]);
    ASSERT_EQ(20, actualValue.value.int32Values[1]);

    ASSERT_EQ(2, actualValue.value.floatValues.size());
    ASSERT_EQ(2u, actualValue.value.floatValues.size());
    ASSERT_FLOAT_EQ(1.1, actualValue.value.floatValues[0]);
    ASSERT_FLOAT_EQ(2.2, actualValue.value.floatValues[1]);

    ASSERT_EQ(2, actualValue.value.int64Values.size());
    ASSERT_EQ(2u, actualValue.value.int64Values.size());
    ASSERT_FLOAT_EQ(30, actualValue.value.int64Values[0]);
    ASSERT_FLOAT_EQ(40, actualValue.value.int64Values[1]);

+4 −4
Original line number Diff line number Diff line
@@ -131,12 +131,12 @@ public:
        mEventCond.notify_one();
        return Return<void>();
    }
    Return<void> onPropertySet(const VehiclePropValue& value) override {
    Return<void> onPropertySet(const VehiclePropValue& /* value */) override {
        return Return<void>();
    }
    Return<void> onPropertySetError(StatusCode errorCode,
                                    int32_t propId,
                                    int32_t areaId) override {
    Return<void> onPropertySetError(StatusCode /* errorCode */,
                                    int32_t /* propId */,
                                    int32_t /* areaId */) override {
        return Return<void>();
    }

+6 −6
Original line number Diff line number Diff line
@@ -85,9 +85,9 @@ TEST_F(VehicleObjectPoolTest, valuePoolMultithreadedBenchmark) {
    // In this test we have T threads that concurrently in C cycles
    // obtain and release O VehiclePropValue objects of FLOAT / INT32 types.

    const auto T = 2;
    const auto C  = 500;
    const auto O = 100;
    const int T = 2;
    const int C = 500;
    const int O = 100;

    auto poolPtr = valuePool.get();

@@ -112,10 +112,10 @@ TEST_F(VehicleObjectPoolTest, valuePoolMultithreadedBenchmark) {
    }
    auto finish = elapsedRealtimeNano();

    ASSERT_EQ(T * C * O, stats->Obtained);
    ASSERT_EQ(T * C * O, stats->Recycled);
    ASSERT_EQ(static_cast<uint32_t>(T * C * O), stats->Obtained);
    ASSERT_EQ(static_cast<uint32_t>(T * C * O), stats->Recycled);
    // Created less than obtained.
    ASSERT_GE(T * O, stats->Created);
    ASSERT_GE(static_cast<uint32_t>(T * O), stats->Created);

    auto elapsedMs = (finish - start) / 1000000;
    ASSERT_GE(1000, elapsedMs);  // Less a second to access 100K objects.
Loading