Update VTS test to blacklist only non-GPS satellites
Bug: 79481978
Change-Id: Ieef04d816448d37ae54c61375db4955d4d3a24d7
Fixes: 79481978
Test: make vts
diff --git a/gnss/1.1/default/Gnss.cpp b/gnss/1.1/default/Gnss.cpp
index bbc4940..bbf1cd3 100644
--- a/gnss/1.1/default/Gnss.cpp
+++ b/gnss/1.1/default/Gnss.cpp
@@ -227,7 +227,9 @@
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)};
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 8f4691e..cce46f1 100644
--- a/gnss/1.1/vts/functional/gnss_hal_test_cases.cpp
+++ b/gnss/1.1/vts/functional/gnss_hal_test_cases.cpp
@@ -84,15 +84,15 @@
}
/*
- * 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 @@
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 @@
*/
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();