Loading gnss/1.1/IGnss.hal +13 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package android.hardware.gnss@1.1; import @1.0::IGnss; import @1.0::GnssLocation; import IGnssCallback; import IGnssConfiguration; Loading Loading @@ -78,4 +79,16 @@ interface IGnss extends @1.0::IGnss { * @return gnssMeasurementIface Handle to the IGnssMeasurement interface. */ getExtensionGnssMeasurement_1_1() generates (IGnssMeasurement gnssMeasurementIface); /** * Injects current location from the best available location provider. * * Unlike injectLocation, this method may inject a recent GNSS location from the HAL * implementation, if that is the best available location known to the framework. * * @param location Location information from the best available location provider. * * @return success Returns true if successful. */ injectBestLocation(GnssLocation location) generates (bool success); }; No newline at end of file gnss/1.1/IGnssCallback.hal +13 −0 Original line number Diff line number Diff line Loading @@ -35,4 +35,17 @@ interface IGnssCallback extends @1.0::IGnssCallback { * @param name String providing the name of the GNSS HAL implementation */ gnssNameCb(string name); /** * Callback for requesting Location. * * HAL implementation shall call this when it wants the framework to provide location to assist * with GNSS HAL operation. For example, to assist with time to first fix, and/or error * recovery, it may ask for a location that is independent from GNSS (e.g. from the "network" * LocationProvier), or to provide a Device-Based-Hybrid location to supplement A-GPS/GNSS * emergency call flows managed by the GNSS HAL. * * @param independentFromGnss True if requesting a location that is independent from GNSS. */ gnssRequestLocationCb(bool independentFromGnss); }; No newline at end of file gnss/1.1/vts/functional/gnss_hal_test.h +3 −0 Original line number Diff line number Diff line Loading @@ -74,6 +74,9 @@ class GnssHalTest : public ::testing::VtsHalHidlTargetTestBase { } Return<void> gnssAcquireWakelockCb() override { return Void(); } Return<void> gnssReleaseWakelockCb() override { return Void(); } Return<void> gnssRequestLocationCb(bool /* independentFromGnss */) override { return Void(); } Return<void> gnssRequestTimeCb() override { return Void(); } // Actual (test) callback handlers Return<void> gnssNameCb(const android::hardware::hidl_string& name) override; Loading gnss/1.1/vts/functional/gnss_hal_test_cases.cpp +33 −1 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ using android::hardware::hidl_vec; using android::hardware::gnss::V1_0::GnssConstellationType; using android::hardware::gnss::V1_0::GnssLocation; using android::hardware::gnss::V1_1::IGnssConfiguration; using android::hardware::gnss::V1_1::IGnssMeasurement; Loading Loading @@ -364,3 +365,34 @@ TEST_F(GnssHalTest, BlacklistConstellation) { ASSERT_TRUE(result.isOk()); EXPECT_TRUE(result); } /* * InjectBestLocation * * Ensure successfully injecting a location. */ TEST_F(GnssHalTest, InjectBestLocation) { GnssLocation gnssLocation = {.gnssLocationFlags = 0, // set below .latitudeDegrees = 43.0, .longitudeDegrees = -180, .altitudeMeters = 1000, .speedMetersPerSec = 0, .bearingDegrees = 0, .horizontalAccuracyMeters = 0.1, .verticalAccuracyMeters = 0.1, .speedAccuracyMetersPerSecond = 0.1, .bearingAccuracyDegrees = 0.1, .timestamp = 1534567890123L}; gnssLocation.gnssLocationFlags |= GnssLocationFlags::HAS_LAT_LONG | GnssLocationFlags::HAS_ALTITUDE | GnssLocationFlags::HAS_SPEED | GnssLocationFlags::HAS_HORIZONTAL_ACCURACY | GnssLocationFlags::HAS_VERTICAL_ACCURACY | GnssLocationFlags::HAS_SPEED_ACCURACY | GnssLocationFlags::HAS_BEARING | GnssLocationFlags::HAS_BEARING_ACCURACY; CheckLocation(gnssLocation, true); auto result = gnss_hal_->injectBestLocation(gnssLocation); ASSERT_TRUE(result.isOk()); EXPECT_TRUE(result); } Loading
gnss/1.1/IGnss.hal +13 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package android.hardware.gnss@1.1; import @1.0::IGnss; import @1.0::GnssLocation; import IGnssCallback; import IGnssConfiguration; Loading Loading @@ -78,4 +79,16 @@ interface IGnss extends @1.0::IGnss { * @return gnssMeasurementIface Handle to the IGnssMeasurement interface. */ getExtensionGnssMeasurement_1_1() generates (IGnssMeasurement gnssMeasurementIface); /** * Injects current location from the best available location provider. * * Unlike injectLocation, this method may inject a recent GNSS location from the HAL * implementation, if that is the best available location known to the framework. * * @param location Location information from the best available location provider. * * @return success Returns true if successful. */ injectBestLocation(GnssLocation location) generates (bool success); }; No newline at end of file
gnss/1.1/IGnssCallback.hal +13 −0 Original line number Diff line number Diff line Loading @@ -35,4 +35,17 @@ interface IGnssCallback extends @1.0::IGnssCallback { * @param name String providing the name of the GNSS HAL implementation */ gnssNameCb(string name); /** * Callback for requesting Location. * * HAL implementation shall call this when it wants the framework to provide location to assist * with GNSS HAL operation. For example, to assist with time to first fix, and/or error * recovery, it may ask for a location that is independent from GNSS (e.g. from the "network" * LocationProvier), or to provide a Device-Based-Hybrid location to supplement A-GPS/GNSS * emergency call flows managed by the GNSS HAL. * * @param independentFromGnss True if requesting a location that is independent from GNSS. */ gnssRequestLocationCb(bool independentFromGnss); }; No newline at end of file
gnss/1.1/vts/functional/gnss_hal_test.h +3 −0 Original line number Diff line number Diff line Loading @@ -74,6 +74,9 @@ class GnssHalTest : public ::testing::VtsHalHidlTargetTestBase { } Return<void> gnssAcquireWakelockCb() override { return Void(); } Return<void> gnssReleaseWakelockCb() override { return Void(); } Return<void> gnssRequestLocationCb(bool /* independentFromGnss */) override { return Void(); } Return<void> gnssRequestTimeCb() override { return Void(); } // Actual (test) callback handlers Return<void> gnssNameCb(const android::hardware::hidl_string& name) override; Loading
gnss/1.1/vts/functional/gnss_hal_test_cases.cpp +33 −1 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ using android::hardware::hidl_vec; using android::hardware::gnss::V1_0::GnssConstellationType; using android::hardware::gnss::V1_0::GnssLocation; using android::hardware::gnss::V1_1::IGnssConfiguration; using android::hardware::gnss::V1_1::IGnssMeasurement; Loading Loading @@ -364,3 +365,34 @@ TEST_F(GnssHalTest, BlacklistConstellation) { ASSERT_TRUE(result.isOk()); EXPECT_TRUE(result); } /* * InjectBestLocation * * Ensure successfully injecting a location. */ TEST_F(GnssHalTest, InjectBestLocation) { GnssLocation gnssLocation = {.gnssLocationFlags = 0, // set below .latitudeDegrees = 43.0, .longitudeDegrees = -180, .altitudeMeters = 1000, .speedMetersPerSec = 0, .bearingDegrees = 0, .horizontalAccuracyMeters = 0.1, .verticalAccuracyMeters = 0.1, .speedAccuracyMetersPerSecond = 0.1, .bearingAccuracyDegrees = 0.1, .timestamp = 1534567890123L}; gnssLocation.gnssLocationFlags |= GnssLocationFlags::HAS_LAT_LONG | GnssLocationFlags::HAS_ALTITUDE | GnssLocationFlags::HAS_SPEED | GnssLocationFlags::HAS_HORIZONTAL_ACCURACY | GnssLocationFlags::HAS_VERTICAL_ACCURACY | GnssLocationFlags::HAS_SPEED_ACCURACY | GnssLocationFlags::HAS_BEARING | GnssLocationFlags::HAS_BEARING_ACCURACY; CheckLocation(gnssLocation, true); auto result = gnss_hal_->injectBestLocation(gnssLocation); ASSERT_TRUE(result.isOk()); EXPECT_TRUE(result); }