Non-framework location access visibility and control (HAL)
Define IGnssVisibilityControl(Callback).hal interfaces to tell
the GNSS HAL implementation for which non-framework non-user
initiated emergency use cases, the framework user has granted
permission to the HAL implementation to provide GNSS location
information and to notify the framework user of these GNSS location
information deliveries.
Bug: 119560261
Test: Partial testing with cuttlefish
Change-Id: Ife704eb9fa4e6113196729b002bc9dc08bb47bc3
diff --git a/gnss/2.0/vts/functional/Android.bp b/gnss/2.0/vts/functional/Android.bp
index 894716d..684b381 100644
--- a/gnss/2.0/vts/functional/Android.bp
+++ b/gnss/2.0/vts/functional/Android.bp
@@ -24,6 +24,7 @@
],
static_libs: [
"android.hardware.gnss.measurement_corrections@1.0",
+ "android.hardware.gnss.visibility_control@1.0",
"android.hardware.gnss@1.0",
"android.hardware.gnss@1.1",
"android.hardware.gnss@2.0",
diff --git a/gnss/2.0/vts/functional/gnss_hal_test_cases.cpp b/gnss/2.0/vts/functional/gnss_hal_test_cases.cpp
index cef06a2..552cf1b 100644
--- a/gnss/2.0/vts/functional/gnss_hal_test_cases.cpp
+++ b/gnss/2.0/vts/functional/gnss_hal_test_cases.cpp
@@ -19,6 +19,7 @@
#include <VtsHalHidlTargetTestBase.h>
#include <gnss_hal_test.h>
+using android::hardware::hidl_string;
using android::hardware::hidl_vec;
using IGnssConfiguration_2_0 = android::hardware::gnss::V2_0::IGnssConfiguration;
@@ -30,6 +31,8 @@
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;
+using android::hardware::gnss::V1_0::IGnssNi;
+using android::hardware::gnss::visibility_control::V1_0::IGnssVisibilityControl;
/*
* SetupTeardownCreateCleanup:
@@ -117,7 +120,7 @@
* 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 launced with Q or later.
+ * TODO (b/121287858): Enforce gnss@2.0 HAL package is supported on devices launched with Q or later
*/
TEST_F(GnssHalTest, TestAGnssRilExtension) {
auto agnssRil = gnss_hal_->getExtensionAGnssRil_2_0();
@@ -199,7 +202,7 @@
* 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 launced with Q or later.
+ * TODO (b/121287858): Enforce gnss@2.0 HAL package is supported on devices launched with Q or later
*/
TEST_F(GnssHalTest, TestAGnssExtension) {
// Verify IAGnss 2.0 is supported.
@@ -218,10 +221,45 @@
* 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 launced with Q or later.
+ * 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.
+ auto gnssNi = gnss_hal_->getExtensionGnssNi();
+ ASSERT_TRUE(!gnssNi.isOk() || ((sp<IGnssNi>)gnssNi) == nullptr);
+}
+
+/*
+ * 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
+ */
+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);
+
+ // Set non-framework proxy apps.
+ hidl_vec<hidl_string> proxyApps{"ims.example.com", "mdt.example.com"};
+ auto result = iGnssVisibilityControl->enableNfwLocationAccess(proxyApps);
+ ASSERT_TRUE(result.isOk());
+ EXPECT_TRUE(result);
+}