Resolve merge conflicts of cb56fbeb9d to master

Bug: None
Test: cd hardware/interfaces/gnss && mm, check artifacts built
        successfully.

Change-Id: I32038aaf40b1d427b838242b7197581b7cde4efd
This commit is contained in:
Patrick Berny 2020-01-31 18:29:05 -08:00
commit 40dcf01215
2 changed files with 20 additions and 4 deletions

View file

@ -26,6 +26,8 @@
#include <condition_variable>
#include <mutex>
#include <cutils/properties.h>
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> iGnssDebug = gnssDebug;
EXPECT_NE(iGnssDebug, nullptr);
if (!IsAutomotiveDevice() && info_called_count_ > 0 && last_info_.yearOfHw >= 2017) {
sp<IGnssDebug> iGnssDebug = gnssDebug;
EXPECT_NE(iGnssDebug, nullptr);
}
}

View file

@ -19,6 +19,7 @@
#include <gnss_hal_test.h>
#include <android/hardware/gnss/1.1/IGnssConfiguration.h>
#include <cutils/properties.h>
#include <gtest/gtest.h>
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> iGnssDebug = gnssDebug;
EXPECT_NE(iGnssDebug, nullptr);