Update VTS test to blacklist only non-GPS satellites
Bug: 79481978 Change-Id: Ieef04d816448d37ae54c61375db4955d4d3a24d7 Fixes: 79481978 Test: make vts
This commit is contained in:
parent
318d3c4ff6
commit
ca63cbf6e2
2 changed files with 14 additions and 7 deletions
|
@ -227,7 +227,9 @@ Return<GnssSvStatus> Gnss::getMockSvStatus() const {
|
|||
getSvInfo(5, GnssConstellationType::GPS, 27.0, 29.0, 56.5),
|
||||
getSvInfo(17, GnssConstellationType::GPS, 30.5, 71.0, 77.0),
|
||||
getSvInfo(26, GnssConstellationType::GPS, 24.1, 28.0, 253.0),
|
||||
getSvInfo(30, GnssConstellationType::GPS, 20.5, 11.5, 116.0),
|
||||
getSvInfo(5, GnssConstellationType::GLONASS, 20.5, 11.5, 116.0),
|
||||
getSvInfo(17, GnssConstellationType::GLONASS, 21.5, 28.5, 186.0),
|
||||
getSvInfo(18, GnssConstellationType::GLONASS, 28.3, 38.8, 69.0),
|
||||
getSvInfo(10, GnssConstellationType::GLONASS, 25.0, 66.0, 247.0)};
|
||||
|
||||
GnssSvStatus svStatus = {.numSvs = sizeof(mockGnssSvInfoList) / sizeof(GnssSvInfo)};
|
||||
|
|
|
@ -84,15 +84,15 @@ TEST_F(GnssHalTest, GetLocationLowPower) {
|
|||
}
|
||||
|
||||
/*
|
||||
* FindStrongFrequentSource:
|
||||
* FindStrongFrequentNonGpsSource:
|
||||
*
|
||||
* Search through a GnssSvStatus list for the strongest satellite observed enough times
|
||||
* Search through a GnssSvStatus list for the strongest non-GPS satellite observed enough times
|
||||
*
|
||||
* returns the strongest source,
|
||||
* or a source with constellation == UNKNOWN if none are found sufficient times
|
||||
*/
|
||||
|
||||
IGnssConfiguration::BlacklistedSource FindStrongFrequentSource(
|
||||
IGnssConfiguration::BlacklistedSource FindStrongFrequentNonGpsSource(
|
||||
const list<IGnssCallback::GnssSvStatus> list_gnss_sv_status, const int min_observations) {
|
||||
struct ComparableBlacklistedSource {
|
||||
IGnssConfiguration::BlacklistedSource id;
|
||||
|
@ -113,7 +113,8 @@ IGnssConfiguration::BlacklistedSource FindStrongFrequentSource(
|
|||
for (const auto& gnss_sv_status : list_gnss_sv_status) {
|
||||
for (uint32_t iSv = 0; iSv < gnss_sv_status.numSvs; iSv++) {
|
||||
const auto& gnss_sv = gnss_sv_status.gnssSvList[iSv];
|
||||
if (gnss_sv.svFlag & IGnssCallback::GnssSvFlags::USED_IN_FIX) {
|
||||
if ((gnss_sv.svFlag & IGnssCallback::GnssSvFlags::USED_IN_FIX) &&
|
||||
(gnss_sv.constellation != GnssConstellationType::GPS)) {
|
||||
ComparableBlacklistedSource source;
|
||||
source.id.svid = gnss_sv.svid;
|
||||
source.id.constellation = gnss_sv.constellation;
|
||||
|
@ -187,8 +188,12 @@ TEST_F(GnssHalTest, BlacklistIndividualSatellites) {
|
|||
*/
|
||||
|
||||
IGnssConfiguration::BlacklistedSource source_to_blacklist =
|
||||
FindStrongFrequentSource(list_gnss_sv_status_, kLocationsToAwait - 1);
|
||||
EXPECT_NE(source_to_blacklist.constellation, GnssConstellationType::UNKNOWN);
|
||||
FindStrongFrequentNonGpsSource(list_gnss_sv_status_, kLocationsToAwait - 1);
|
||||
|
||||
if (source_to_blacklist.constellation == GnssConstellationType::UNKNOWN) {
|
||||
// Cannot find a non-GPS satellite. Let the test pass.
|
||||
return;
|
||||
}
|
||||
|
||||
// Stop locations, blacklist the common SV
|
||||
StopAndClearLocations();
|
||||
|
|
Loading…
Reference in a new issue