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

Commit d8a767a8 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Skip GnssMeasurement VTS for Android Automotive OS."

parents 4433d35a 0d9206aa
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -39,6 +39,10 @@ using android::hardware::gnss::V1_0::IGnssDebug;
using android::hardware::gnss::V1_0::IGnssMeasurement;
using android::sp;

/*
 * Since Utils.cpp depends on Gnss Hal 2.0, the tests for Gnss Hal 1.0 will use
 * there own version of IsAutomotiveDevice() instead of the common version.
 */
static bool IsAutomotiveDevice() {
    char buffer[PROPERTY_VALUE_MAX] = {0};
    property_get("ro.hardware.type", buffer, "");
@@ -492,7 +496,7 @@ TEST_P(GnssHalTest, GetAllExtensions) {
 * Verifies that modern hardware supports measurement capabilities.
 */
TEST_P(GnssHalTest, MeasurementCapabilites) {
  if (info_called_count_ > 0 && last_info_.yearOfHw >= 2016) {
    if (!IsAutomotiveDevice() && info_called_count_ > 0 && last_info_.yearOfHw >= 2016) {
        EXPECT_TRUE(last_capabilities_ & IGnssCallback::Capabilities::MEASUREMENTS);
    }
}
+9 −0
Original line number Diff line number Diff line
@@ -62,6 +62,15 @@ TEST_P(GnssHalTest, TestGnssMeasurementExtension) {
    auto gnssMeasurement_1_0 = gnss_hal_->getExtensionGnssMeasurement();
    ASSERT_TRUE(gnssMeasurement_2_0.isOk() && gnssMeasurement_1_1.isOk() &&
                gnssMeasurement_1_0.isOk());

    // CDD does not require Android Automotive OS devices to support
    // GnssMeasurements.
    if (Utils::isAutomotiveDevice()) {
        ALOGI("Test GnssMeasurementExtension skipped. Android Automotive OS deice is not required "
              "to support GNSS measurements.");
        return;
    }

    sp<IGnssMeasurement_2_0> iGnssMeas_2_0 = gnssMeasurement_2_0;
    sp<IGnssMeasurement_1_1> iGnssMeas_1_1 = gnssMeasurement_1_1;
    sp<IGnssMeasurement_1_0> iGnssMeas_1_0 = gnssMeasurement_1_0;
+9 −0
Original line number Diff line number Diff line
@@ -63,6 +63,15 @@ TEST_P(GnssHalTest, TestGnssMeasurementExtension) {
    auto gnssMeasurement_1_0 = gnss_hal_->getExtensionGnssMeasurement();
    ASSERT_TRUE(gnssMeasurement_2_1.isOk() && gnssMeasurement_2_0.isOk() &&
                gnssMeasurement_1_1.isOk() && gnssMeasurement_1_0.isOk());

    // CDD does not require Android Automotive OS devices to support
    // GnssMeasurements.
    if (Utils::isAutomotiveDevice()) {
        ALOGI("Test GnssMeasurementExtension skipped. Android Automotive OS de  ice is not "
              "required to support GNSS measurements.");
        return;
    }

    sp<IGnssMeasurement_2_1> iGnssMeas_2_1 = gnssMeasurement_2_1;
    sp<IGnssMeasurement_2_0> iGnssMeas_2_0 = gnssMeasurement_2_0;
    sp<IGnssMeasurement_1_1> iGnssMeas_1_1 = gnssMeasurement_1_1;
+8 −0
Original line number Diff line number Diff line
@@ -17,6 +17,8 @@
#include <Utils.h>
#include "gtest/gtest.h"

#include <cutils/properties.h>

namespace android {
namespace hardware {
namespace gnss {
@@ -194,6 +196,12 @@ GnssConstellationType_1_0 Utils::mapConstellationType(GnssConstellationType_2_0
    }
}

bool Utils::isAutomotiveDevice() {
    char buffer[PROPERTY_VALUE_MAX] = {0};
    property_get("ro.hardware.type", buffer, "");
    return strncmp(buffer, "automotive", PROPERTY_VALUE_MAX) == 0;
}

}  // namespace common
}  // namespace gnss
}  // namespace hardware
+2 −0
Original line number Diff line number Diff line
@@ -49,6 +49,8 @@ struct Utils {
    static const MeasurementCorrections_1_1 getMockMeasurementCorrections_1_1();

    static GnssConstellationType_1_0 mapConstellationType(GnssConstellationType_2_0 constellation);

    static bool isAutomotiveDevice();
};

}  // namespace common