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

Commit 01f5a604 authored by Tyler Trephan's avatar Tyler Trephan
Browse files

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
parent a9b08c3a
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -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);
  }
}
+8 −1
Original line number Diff line number Diff line
@@ -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;
+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 {
@@ -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
+2 −0
Original line number Diff line number Diff line
@@ -37,6 +37,8 @@ struct Utils {
    static const MeasurementCorrections getMockMeasurementCorrections();

    static GnssConstellationType_1_0 mapConstellationType(GnssConstellationType_2_0 constellation);

    static bool isAutomotiveDevice();
};

}  // namespace common
+3 −3

File changed.

Contains only whitespace changes.