Merge "Skip GnssMeasurement VTS for Android Automotive OS."
This commit is contained in:
commit
d8a767a847
5 changed files with 36 additions and 4 deletions
|
@ -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,9 +496,9 @@ TEST_P(GnssHalTest, GetAllExtensions) {
|
|||
* Verifies that modern hardware supports measurement capabilities.
|
||||
*/
|
||||
TEST_P(GnssHalTest, MeasurementCapabilites) {
|
||||
if (info_called_count_ > 0 && last_info_.yearOfHw >= 2016) {
|
||||
EXPECT_TRUE(last_capabilities_ & IGnssCallback::Capabilities::MEASUREMENTS);
|
||||
}
|
||||
if (!IsAutomotiveDevice() && info_called_count_ > 0 && last_info_.yearOfHw >= 2016) {
|
||||
EXPECT_TRUE(last_capabilities_ & IGnssCallback::Capabilities::MEASUREMENTS);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -529,4 +533,4 @@ int main(int argc, char** argv) {
|
|||
}
|
||||
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue