summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYu-Han Yang2018-05-30 11:17:04 -0500
committerAndroid (Google) Code Review2018-05-30 11:17:04 -0500
commita7b7111f30be226b89810b7f27b9c3b68ff74c84 (patch)
tree5455699031d10c781f89c65a464507c74fb9aa36
parent4f0635a2a9578cb2fb90d345346c4711b69ff139 (diff)
parentca63cbf6e280c10614ae5bfa1f08cc32a3c9a59e (diff)
downloadplatform-hardware-interfaces-a7b7111f30be226b89810b7f27b9c3b68ff74c84.tar.gz
platform-hardware-interfaces-a7b7111f30be226b89810b7f27b9c3b68ff74c84.tar.xz
platform-hardware-interfaces-a7b7111f30be226b89810b7f27b9c3b68ff74c84.zip
Merge "Update VTS test to blacklist only non-GPS satellites" into pi-dev
-rw-r--r--gnss/1.1/default/Gnss.cpp4
-rw-r--r--gnss/1.1/vts/functional/gnss_hal_test_cases.cpp17
2 files changed, 14 insertions, 7 deletions
diff --git a/gnss/1.1/default/Gnss.cpp b/gnss/1.1/default/Gnss.cpp
index bbc4940c..bbf1cd31 100644
--- a/gnss/1.1/default/Gnss.cpp
+++ b/gnss/1.1/default/Gnss.cpp
@@ -227,7 +227,9 @@ Return<GnssSvStatus> Gnss::getMockSvStatus() const {
227 getSvInfo(5, GnssConstellationType::GPS, 27.0, 29.0, 56.5), 227 getSvInfo(5, GnssConstellationType::GPS, 27.0, 29.0, 56.5),
228 getSvInfo(17, GnssConstellationType::GPS, 30.5, 71.0, 77.0), 228 getSvInfo(17, GnssConstellationType::GPS, 30.5, 71.0, 77.0),
229 getSvInfo(26, GnssConstellationType::GPS, 24.1, 28.0, 253.0), 229 getSvInfo(26, GnssConstellationType::GPS, 24.1, 28.0, 253.0),
230 getSvInfo(30, GnssConstellationType::GPS, 20.5, 11.5, 116.0), 230 getSvInfo(5, GnssConstellationType::GLONASS, 20.5, 11.5, 116.0),
231 getSvInfo(17, GnssConstellationType::GLONASS, 21.5, 28.5, 186.0),
232 getSvInfo(18, GnssConstellationType::GLONASS, 28.3, 38.8, 69.0),
231 getSvInfo(10, GnssConstellationType::GLONASS, 25.0, 66.0, 247.0)}; 233 getSvInfo(10, GnssConstellationType::GLONASS, 25.0, 66.0, 247.0)};
232 234
233 GnssSvStatus svStatus = {.numSvs = sizeof(mockGnssSvInfoList) / sizeof(GnssSvInfo)}; 235 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 8f4691e1..cce46f18 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 @@ TEST_F(GnssHalTest, GetLocationLowPower) {
84} 84}
85 85
86/* 86/*
87 * FindStrongFrequentSource: 87 * FindStrongFrequentNonGpsSource:
88 * 88 *
89 * Search through a GnssSvStatus list for the strongest satellite observed enough times 89 * Search through a GnssSvStatus list for the strongest non-GPS satellite observed enough times
90 * 90 *
91 * returns the strongest source, 91 * returns the strongest source,
92 * or a source with constellation == UNKNOWN if none are found sufficient times 92 * or a source with constellation == UNKNOWN if none are found sufficient times
93 */ 93 */
94 94
95IGnssConfiguration::BlacklistedSource FindStrongFrequentSource( 95IGnssConfiguration::BlacklistedSource FindStrongFrequentNonGpsSource(
96 const list<IGnssCallback::GnssSvStatus> list_gnss_sv_status, const int min_observations) { 96 const list<IGnssCallback::GnssSvStatus> list_gnss_sv_status, const int min_observations) {
97 struct ComparableBlacklistedSource { 97 struct ComparableBlacklistedSource {
98 IGnssConfiguration::BlacklistedSource id; 98 IGnssConfiguration::BlacklistedSource id;
@@ -113,7 +113,8 @@ IGnssConfiguration::BlacklistedSource FindStrongFrequentSource(
113 for (const auto& gnss_sv_status : list_gnss_sv_status) { 113 for (const auto& gnss_sv_status : list_gnss_sv_status) {
114 for (uint32_t iSv = 0; iSv < gnss_sv_status.numSvs; iSv++) { 114 for (uint32_t iSv = 0; iSv < gnss_sv_status.numSvs; iSv++) {
115 const auto& gnss_sv = gnss_sv_status.gnssSvList[iSv]; 115 const auto& gnss_sv = gnss_sv_status.gnssSvList[iSv];
116 if (gnss_sv.svFlag & IGnssCallback::GnssSvFlags::USED_IN_FIX) { 116 if ((gnss_sv.svFlag & IGnssCallback::GnssSvFlags::USED_IN_FIX) &&
117 (gnss_sv.constellation != GnssConstellationType::GPS)) {
117 ComparableBlacklistedSource source; 118 ComparableBlacklistedSource source;
118 source.id.svid = gnss_sv.svid; 119 source.id.svid = gnss_sv.svid;
119 source.id.constellation = gnss_sv.constellation; 120 source.id.constellation = gnss_sv.constellation;
@@ -187,8 +188,12 @@ TEST_F(GnssHalTest, BlacklistIndividualSatellites) {
187 */ 188 */
188 189
189 IGnssConfiguration::BlacklistedSource source_to_blacklist = 190 IGnssConfiguration::BlacklistedSource source_to_blacklist =
190 FindStrongFrequentSource(list_gnss_sv_status_, kLocationsToAwait - 1); 191 FindStrongFrequentNonGpsSource(list_gnss_sv_status_, kLocationsToAwait - 1);
191 EXPECT_NE(source_to_blacklist.constellation, GnssConstellationType::UNKNOWN); 192
193 if (source_to_blacklist.constellation == GnssConstellationType::UNKNOWN) {
194 // Cannot find a non-GPS satellite. Let the test pass.
195 return;
196 }
192 197
193 // Stop locations, blacklist the common SV 198 // Stop locations, blacklist the common SV
194 StopAndClearLocations(); 199 StopAndClearLocations();