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
This commit is contained in:
Anil Admal
2019-07-15 18:52:00 -07:00
parent f829d25956
commit 03bc98e028
2 changed files with 72 additions and 0 deletions

View File

@@ -59,6 +59,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;

View File

@@ -415,6 +415,70 @@ TEST_F(GnssHalTest, TestGnssBatchingExtension) {
ASSERT_TRUE(gnssBatching_2_0.isOk());
}
/*
* 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
@@ -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;
}