Merge "Update GNSS VTS 2.0 tests to address sub-HAL support requirements" into qt-dev
This commit is contained in:
commit
bb477b95ad
1 changed files with 44 additions and 55 deletions
|
@ -29,6 +29,7 @@ using IGnssMeasurement_2_0 = android::hardware::gnss::V2_0::IGnssMeasurement;
|
|||
using IGnssMeasurement_1_1 = android::hardware::gnss::V1_1::IGnssMeasurement;
|
||||
using IGnssMeasurement_1_0 = android::hardware::gnss::V1_0::IGnssMeasurement;
|
||||
using IAGnssRil_2_0 = android::hardware::gnss::V2_0::IAGnssRil;
|
||||
using IAGnssRil_1_0 = android::hardware::gnss::V1_0::IAGnssRil;
|
||||
using IAGnss_2_0 = android::hardware::gnss::V2_0::IAGnss;
|
||||
using IAGnss_1_0 = android::hardware::gnss::V1_0::IAGnss;
|
||||
using IAGnssCallback_2_0 = android::hardware::gnss::V2_0::IAGnssCallback;
|
||||
|
@ -125,16 +126,21 @@ TEST_F(GnssHalTest, TestGnssConfiguration_setGpsLock_Deprecation) {
|
|||
* TestAGnssRilExtension:
|
||||
* Gets the AGnssRilExtension and verifies that it returns an actual extension.
|
||||
*
|
||||
* The GNSS HAL 2.0 implementation must support @2.0::IAGnssRil interface due to the deprecation
|
||||
* of framework network API methods needed to support the @1.0::IAGnssRil interface.
|
||||
*
|
||||
* TODO (b/121287858): Enforce gnss@2.0 HAL package is supported on devices launched with Q or later
|
||||
* If IAGnssRil interface is supported, then the GNSS HAL 2.0 implementation must support
|
||||
* @2.0::IAGnssRil interface due to the deprecation of framework network API methods needed
|
||||
* to support the @1.0::IAGnssRil interface.
|
||||
*/
|
||||
TEST_F(GnssHalTest, TestAGnssRilExtension) {
|
||||
auto agnssRil = gnss_hal_->getExtensionAGnssRil_2_0();
|
||||
ASSERT_TRUE(agnssRil.isOk());
|
||||
sp<IAGnssRil_2_0> iAGnssRil = agnssRil;
|
||||
ASSERT_NE(iAGnssRil, nullptr);
|
||||
auto agnssRil_2_0 = gnss_hal_->getExtensionAGnssRil_2_0();
|
||||
ASSERT_TRUE(agnssRil_2_0.isOk());
|
||||
sp<IAGnssRil_2_0> iAGnssRil_2_0 = agnssRil_2_0;
|
||||
if (iAGnssRil_2_0 == nullptr) {
|
||||
// Verify IAGnssRil 1.0 is not supported.
|
||||
auto agnssRil_1_0 = gnss_hal_->getExtensionAGnssRil();
|
||||
ASSERT_TRUE(agnssRil_1_0.isOk());
|
||||
sp<IAGnssRil_1_0> iAGnssRil_1_0 = agnssRil_1_0;
|
||||
ASSERT_EQ(iAGnssRil_1_0, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -146,7 +152,9 @@ TEST_F(GnssHalTest, TestAGnssRil_UpdateNetworkState_2_0) {
|
|||
auto agnssRil = gnss_hal_->getExtensionAGnssRil_2_0();
|
||||
ASSERT_TRUE(agnssRil.isOk());
|
||||
sp<IAGnssRil_2_0> iAGnssRil = agnssRil;
|
||||
ASSERT_NE(iAGnssRil, nullptr);
|
||||
if (iAGnssRil == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Update GNSS HAL that a network has connected.
|
||||
IAGnssRil_2_0::NetworkAttributes networkAttributes = {
|
||||
|
@ -219,44 +227,35 @@ TEST_F(GnssHalTest, TestGnssMeasurementFields) {
|
|||
|
||||
/*
|
||||
* TestAGnssExtension:
|
||||
* Gets the AGnssExtension and verifies that it supports @2.0::IAGnss interface by invoking
|
||||
* a method.
|
||||
* Gets the AGnssExtension and verifies that it returns an actual extension.
|
||||
*
|
||||
* The GNSS HAL 2.0 implementation must support @2.0::IAGnss interface due to the deprecation
|
||||
* of framework network API methods needed to support the @1.0::IAGnss interface.
|
||||
*
|
||||
* TODO (b/121287858): Enforce gnss@2.0 HAL package is supported on devices launched with Q or later
|
||||
* If IAGnss interface is supported, then the GNSS HAL 2.0 implementation must support
|
||||
* @2.0::IAGnss interface due to the deprecation of framework network API methods needed
|
||||
* to support the @1.0::IAGnss interface.
|
||||
*/
|
||||
TEST_F(GnssHalTest, TestAGnssExtension) {
|
||||
// Verify IAGnss 2.0 is supported.
|
||||
auto agnss = gnss_hal_->getExtensionAGnss_2_0();
|
||||
ASSERT_TRUE(agnss.isOk());
|
||||
sp<IAGnss_2_0> iAGnss = agnss;
|
||||
ASSERT_NE(iAGnss, nullptr);
|
||||
auto agnss_2_0 = gnss_hal_->getExtensionAGnss_2_0();
|
||||
ASSERT_TRUE(agnss_2_0.isOk());
|
||||
sp<IAGnss_2_0> iAGnss_2_0 = agnss_2_0;
|
||||
if (iAGnss_2_0 == nullptr) {
|
||||
// Verify IAGnss 1.0 is not supported.
|
||||
auto agnss_1_0 = gnss_hal_->getExtensionAGnss();
|
||||
ASSERT_TRUE(agnss_1_0.isOk());
|
||||
sp<IAGnss_1_0> iAGnss_1_0 = agnss_1_0;
|
||||
ASSERT_EQ(iAGnss_1_0, nullptr);
|
||||
return;
|
||||
}
|
||||
|
||||
// Set SUPL server host/port
|
||||
auto result = iAGnss->setServer(IAGnssCallback_2_0::AGnssType::SUPL, "supl.google.com", 7275);
|
||||
auto result =
|
||||
iAGnss_2_0->setServer(IAGnssCallback_2_0::AGnssType::SUPL, "supl.google.com", 7275);
|
||||
ASSERT_TRUE(result.isOk());
|
||||
EXPECT_TRUE(result);
|
||||
}
|
||||
|
||||
/*
|
||||
* TestAGnssExtension_1_0_Deprecation:
|
||||
* Gets the @1.0::IAGnss extension and verifies that it is a nullptr.
|
||||
*
|
||||
* TODO (b/121287858): Enforce gnss@2.0 HAL package is supported on devices launched with Q or later
|
||||
*/
|
||||
TEST_F(GnssHalTest, TestAGnssExtension_1_0_Deprecation) {
|
||||
// Verify IAGnss 1.0 is not supported.
|
||||
auto agnss_1_0 = gnss_hal_->getExtensionAGnss();
|
||||
ASSERT_TRUE(!agnss_1_0.isOk() || ((sp<IAGnss_1_0>)agnss_1_0) == nullptr);
|
||||
}
|
||||
|
||||
/*
|
||||
* TestGnssNiExtension_Deprecation:
|
||||
* Gets the @1.0::IGnssNi extension and verifies that it is a nullptr.
|
||||
*
|
||||
* TODO (b/121287858): Enforce gnss@2.0 HAL package is supported on devices launched with Q or later
|
||||
*/
|
||||
TEST_F(GnssHalTest, TestGnssNiExtension_Deprecation) {
|
||||
// Verify IGnssNi 1.0 is not supported.
|
||||
|
@ -266,22 +265,19 @@ TEST_F(GnssHalTest, TestGnssNiExtension_Deprecation) {
|
|||
|
||||
/*
|
||||
* TestGnssVisibilityControlExtension:
|
||||
* Gets the GnssVisibilityControlExtension and verifies that it supports the
|
||||
* gnss.visibility_control@1.0::IGnssVisibilityControl interface by invoking a method.
|
||||
*
|
||||
* The GNSS HAL 2.0 implementation must support gnss.visibility_control@1.0::IGnssVisibilityControl.
|
||||
*
|
||||
* TODO (b/121287858): Enforce gnss@2.0 HAL package is supported on devices launched with Q or later
|
||||
* Gets the GnssVisibilityControlExtension and if it is not null, verifies that it supports
|
||||
* the gnss.visibility_control@1.0::IGnssVisibilityControl interface by invoking a method.
|
||||
*/
|
||||
TEST_F(GnssHalTest, TestGnssVisibilityControlExtension) {
|
||||
// Verify IGnssVisibilityControl is supported.
|
||||
auto gnssVisibilityControl = gnss_hal_->getExtensionVisibilityControl();
|
||||
ASSERT_TRUE(gnssVisibilityControl.isOk());
|
||||
sp<IGnssVisibilityControl> iGnssVisibilityControl = gnssVisibilityControl;
|
||||
ASSERT_NE(iGnssVisibilityControl, nullptr);
|
||||
if (iGnssVisibilityControl == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Set non-framework proxy apps.
|
||||
hidl_vec<hidl_string> proxyApps{"ims.example.com", "mdt.example.com"};
|
||||
hidl_vec<hidl_string> proxyApps{"com.example.ims", "com.example.mdt"};
|
||||
auto result = iGnssVisibilityControl->enableNfwLocationAccess(proxyApps);
|
||||
ASSERT_TRUE(result.isOk());
|
||||
EXPECT_TRUE(result);
|
||||
|
@ -408,17 +404,10 @@ TEST_F(GnssHalTest, TestInjectBestLocation_2_0) {
|
|||
|
||||
/*
|
||||
* TestGnssBatchingExtension:
|
||||
* Gets the GnssBatchingExtension and verifies that it supports either the @1.0::IGnssBatching
|
||||
* or @2.0::IGnssBatching extension.
|
||||
* Gets the @2.0::IGnssBatching extension and verifies that it doesn't return an error. Support
|
||||
* for this interface is optional.
|
||||
*/
|
||||
TEST_F(GnssHalTest, TestGnssBatchingExtension) {
|
||||
auto gnssBatching_V2_0 = gnss_hal_->getExtensionGnssBatching_2_0();
|
||||
ASSERT_TRUE(gnssBatching_V2_0.isOk());
|
||||
|
||||
auto gnssBatching_V1_0 = gnss_hal_->getExtensionGnssBatching();
|
||||
ASSERT_TRUE(gnssBatching_V1_0.isOk());
|
||||
|
||||
sp<IGnssBatching_V1_0> iGnssBatching_V1_0 = gnssBatching_V1_0;
|
||||
sp<IGnssBatching_V2_0> iGnssBatching_V2_0 = gnssBatching_V2_0;
|
||||
ASSERT_TRUE(iGnssBatching_V1_0 != nullptr || iGnssBatching_V2_0 != nullptr);
|
||||
auto gnssBatching_2_0 = gnss_hal_->getExtensionGnssBatching_2_0();
|
||||
ASSERT_TRUE(gnssBatching_2_0.isOk());
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue