diff options
author | Anil Admal <aadmal@google.com> | 2019-07-15 18:52:00 -0700 |
---|---|---|
committer | Yu-Han Yang <yuhany@google.com> | 2019-08-12 17:11:31 -0700 |
commit | 02376b9e1117cda33b7c383c98dca260f9f9365f (patch) | |
tree | b8af9c4afdd55e16a46bac8dfa337695402c4123 /gnss | |
parent | ad9f6b17a37668fc80e525051ca9cc57d56d681a (diff) | |
download | android_hardware_interfaces-02376b9e1117cda33b7c383c98dca260f9f9365f.tar.gz android_hardware_interfaces-02376b9e1117cda33b7c383c98dca260f9f9365f.tar.bz2 android_hardware_interfaces-02376b9e1117cda33b7c383c98dca260f9f9365f.zip |
Add GetLocationLowPower VTS 2.0 test
- Run test only if LOW_POWER_MODE capability is supported.
- Modify the corresponding VTS 1.1 test to run only if the GNSS
HAL version is 1.1.
Fixes: 127434062
Test: atest VtsHalGnssV2_0Target
Change-Id: Icbd18d80468e9e5a542f2eace5bfbe45af08ca47
Merged-In: Icbd18d80468e9e5a542f2eace5bfbe45af08ca47
(cherry picked from commit 03bc98e028d3ebe4ab2d657deb0cb24ed76e3e45)
Diffstat (limited to 'gnss')
-rw-r--r-- | gnss/1.1/vts/functional/gnss_hal_test_cases.cpp | 5 | ||||
-rw-r--r-- | gnss/2.0/vts/functional/gnss_hal_test_cases.cpp | 69 |
2 files changed, 73 insertions, 1 deletions
diff --git a/gnss/1.1/vts/functional/gnss_hal_test_cases.cpp b/gnss/1.1/vts/functional/gnss_hal_test_cases.cpp index 6106a678f..ee236ba5d 100644 --- a/gnss/1.1/vts/functional/gnss_hal_test_cases.cpp +++ b/gnss/1.1/vts/functional/gnss_hal_test_cases.cpp @@ -66,6 +66,11 @@ TEST_F(GnssHalTest, TestGnssMeasurementCallback) { * each received location. */ TEST_F(GnssHalTest, GetLocationLowPower) { + if (!IsGnssHalVersion_1_1()) { + ALOGI("Test GetLocationLowPower skipped. GNSS HAL version is greater than 1.1."); + return; + } + const int kMinIntervalMsec = 5000; const int kLocationTimeoutSubsequentSec = (kMinIntervalMsec / 1000) * 2; const int kNoLocationPeriodSec = (kMinIntervalMsec / 1000) / 2; 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 6e0887fd9..e2fe3f96a 100644 --- a/gnss/2.0/vts/functional/gnss_hal_test_cases.cpp +++ b/gnss/2.0/vts/functional/gnss_hal_test_cases.cpp @@ -416,6 +416,70 @@ TEST_F(GnssHalTest, TestGnssBatchingExtension) { } /* + * GetLocationLowPower: + * Turns on location, waits for at least 5 locations allowing max of LOCATION_TIMEOUT_SUBSEQUENT_SEC + * between one location and the next. Also ensure that MIN_INTERVAL_MSEC is respected by waiting + * NO_LOCATION_PERIOD_SEC and verfiy that no location is received. Also perform validity checks on + * each received location. + */ +TEST_F(GnssHalTest, GetLocationLowPower) { + if (!(gnss_cb_->last_capabilities_ & IGnssCallback::Capabilities::LOW_POWER_MODE)) { + ALOGI("Test GetLocationLowPower skipped. LOW_POWER_MODE capability not supported."); + return; + } + + const int kMinIntervalMsec = 5000; + const int kLocationTimeoutSubsequentSec = (kMinIntervalMsec / 1000) * 2; + const int kNoLocationPeriodSec = (kMinIntervalMsec / 1000) / 2; + const int kLocationsToCheck = 5; + const bool kLowPowerMode = true; + + // Warmup period - VTS doesn't have AGPS access via GnssLocationProvider + gnss_cb_->location_cbq_.reset(); + StartAndCheckLocations(kLocationsToCheck); + StopAndClearLocations(); + gnss_cb_->location_cbq_.reset(); + + // Start of Low Power Mode test + SetPositionMode(kMinIntervalMsec, kLowPowerMode); + + // Don't expect true - as without AGPS access + if (!StartAndCheckFirstLocation()) { + ALOGW("GetLocationLowPower test - no first low power location received."); + } + + for (int i = 1; i < kLocationsToCheck; i++) { + // Verify that kMinIntervalMsec is respected by waiting kNoLocationPeriodSec and + // ensure that no location is received yet + + gnss_cb_->location_cbq_.retrieve(gnss_cb_->last_location_, kNoLocationPeriodSec); + const int locationCalledCount = gnss_cb_->location_cbq_.calledCount(); + + // Tolerate (ignore) one extra location right after the first one + // to handle startup edge case scheduling limitations in some implementations + if ((i == 1) && (locationCalledCount == 2)) { + CheckLocation(gnss_cb_->last_location_, true); + continue; // restart the quiet wait period after this too-fast location + } + EXPECT_LE(locationCalledCount, i); + if (locationCalledCount != i) { + ALOGW("GetLocationLowPower test - not enough locations received. %d vs. %d expected ", + locationCalledCount, i); + } + + if (!gnss_cb_->location_cbq_.retrieve( + gnss_cb_->last_location_, + kLocationTimeoutSubsequentSec - kNoLocationPeriodSec)) { + ALOGW("GetLocationLowPower test - timeout awaiting location %d", i); + } else { + CheckLocation(gnss_cb_->last_location_, true); + } + } + + StopAndClearLocations(); +} + +/* * MapConstellationType: * Given a GnssConstellationType_2_0 type constellation, maps to its equivalent * GnssConstellationType_1_0 type constellation. For constellations that do not have @@ -537,6 +601,8 @@ IGnssConfiguration_1_1::BlacklistedSource FindStrongFrequentNonGpsSource( */ TEST_F(GnssHalTest, BlacklistIndividualSatellites) { if (!(gnss_cb_->last_capabilities_ & IGnssCallback::Capabilities::SATELLITE_BLACKLIST)) { + ALOGI("Test BlacklistIndividualSatellites skipped. SATELLITE_BLACKLIST capability" + " not supported."); return; } @@ -680,6 +746,7 @@ TEST_F(GnssHalTest, BlacklistIndividualSatellites) { */ TEST_F(GnssHalTest, BlacklistConstellation) { if (!(gnss_cb_->last_capabilities_ & IGnssCallback::Capabilities::SATELLITE_BLACKLIST)) { + ALOGI("Test BlacklistConstellation skipped. SATELLITE_BLACKLIST capability not supported."); return; } @@ -766,4 +833,4 @@ TEST_F(GnssHalTest, BlacklistConstellation) { result = gnss_configuration_hal->setBlacklist(sources); ASSERT_TRUE(result.isOk()); EXPECT_TRUE(result); -}
\ No newline at end of file +} |