Skip GnssMeasurement VTS for Android Automotive OS.

According to the Q CDD, an Android Automotive OS device is not required
to support GnssMeasurements.

Change-Id: Iea0e56054edc5831168cec2d757abceebf7ab86c
Bug: 161549048
Test: atest VtsHalGnssV1_0TargetTest:GnssHalTest#MeasurementCapabilites VtsHalGnssV2_0TargetTest:GnssHalTest#TestGnssMeasurementExtension
This commit is contained in:
Tyler Trephan
2020-08-10 10:48:00 -07:00
parent a9b08c3aa1
commit 01f5a6042a
5 changed files with 26 additions and 5 deletions

View File

@@ -38,6 +38,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, "");
@@ -479,7 +483,7 @@ TEST_F(GnssHalTest, GetAllExtensions) {
* Verifies that modern hardware supports measurement capabilities.
*/
TEST_F(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);
}
}

View File

@@ -35,9 +35,9 @@ using android::hardware::gnss::V1_1::IGnssConfiguration;
using android::hardware::gnss::V1_1::IGnssMeasurement;
static bool IsAutomotiveDevice() {
char buffer[PROPERTY_VALUE_MAX] = {0};
property_get("ro.hardware.type", buffer, "");
return strncmp(buffer, "automotive", PROPERTY_VALUE_MAX) == 0;
char buffer[PROPERTY_VALUE_MAX] = {0};
property_get("ro.hardware.type", buffer, "");
return strncmp(buffer, "automotive", PROPERTY_VALUE_MAX) == 0;
}
/*

View File

@@ -61,6 +61,13 @@ TEST_F(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()) {
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;
@@ -850,4 +857,4 @@ TEST_F(GnssHalTest, BlacklistConstellationWithLocationOn) {
result = gnss_configuration_hal->setBlacklist(sources);
ASSERT_TRUE(result.isOk());
EXPECT_TRUE(result);
}
}

View File

@@ -17,6 +17,8 @@
#include <Utils.h>
#include "gtest/gtest.h"
#include <cutils/properties.h>
namespace android {
namespace hardware {
namespace gnss {
@@ -164,6 +166,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

View File

@@ -37,6 +37,8 @@ struct Utils {
static const MeasurementCorrections getMockMeasurementCorrections();
static GnssConstellationType_1_0 mapConstellationType(GnssConstellationType_2_0 constellation);
static bool isAutomotiveDevice();
};
} // namespace common