diff --git a/gnss/1.0/vts/functional/VtsHalGnssV1_0TargetTest.cpp b/gnss/1.0/vts/functional/VtsHalGnssV1_0TargetTest.cpp index 6183a1ae28..c04b4d0df2 100644 --- a/gnss/1.0/vts/functional/VtsHalGnssV1_0TargetTest.cpp +++ b/gnss/1.0/vts/functional/VtsHalGnssV1_0TargetTest.cpp @@ -26,6 +26,8 @@ #include #include +#include + using android::hardware::Return; using android::hardware::Void; @@ -37,6 +39,12 @@ using android::hardware::gnss::V1_0::IGnssDebug; using android::hardware::gnss::V1_0::IGnssMeasurement; using android::sp; +static bool IsAutomotiveDevice() { + char buffer[PROPERTY_VALUE_MAX] = {0}; + property_get("ro.hardware.type", buffer, ""); + return strncmp(buffer, "automotive", PROPERTY_VALUE_MAX) == 0; +} + #define TIMEOUT_SEC 2 // for basic commands/responses // for command line argument on how strictly to run the test @@ -473,9 +481,9 @@ TEST_P(GnssHalTest, GetAllExtensions) { auto gnssDebug = gnss_hal_->getExtensionGnssDebug(); ASSERT_TRUE(gnssDebug.isOk()); - if (info_called_count_ > 0 && last_info_.yearOfHw >= 2017) { - sp iGnssDebug = gnssDebug; - EXPECT_NE(iGnssDebug, nullptr); + if (!IsAutomotiveDevice() && info_called_count_ > 0 && last_info_.yearOfHw >= 2017) { + sp iGnssDebug = gnssDebug; + EXPECT_NE(iGnssDebug, nullptr); } } diff --git a/gnss/1.1/vts/functional/gnss_hal_test_cases.cpp b/gnss/1.1/vts/functional/gnss_hal_test_cases.cpp index e0d8b54525..8530ffb08e 100644 --- a/gnss/1.1/vts/functional/gnss_hal_test_cases.cpp +++ b/gnss/1.1/vts/functional/gnss_hal_test_cases.cpp @@ -19,6 +19,7 @@ #include #include +#include #include using android::hardware::hidl_vec; @@ -32,6 +33,12 @@ using android::hardware::gnss::V1_0::IGnssDebug; 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; +} + /* * SetupTeardownCreateCleanup: * Requests the gnss HAL then calls cleanup @@ -524,7 +531,8 @@ TEST_P(GnssHalTest, InjectBestLocation) { TEST_P(GnssHalTest, GnssDebugValuesSanityTest) { auto gnssDebug = gnss_hal_->getExtensionGnssDebug(); ASSERT_TRUE(gnssDebug.isOk()); - if (gnss_cb_->info_cbq_.calledCount() > 0 && gnss_cb_->last_info_.yearOfHw >= 2017) { + if (!IsAutomotiveDevice() && gnss_cb_->info_cbq_.calledCount() > 0 && + gnss_cb_->last_info_.yearOfHw >= 2017) { sp iGnssDebug = gnssDebug; EXPECT_NE(iGnssDebug, nullptr);