Returning failure on GPS blacklisting
Returning false for HIDL Set Blacklist API when a GPS constellation SV is passed in for blacklisting. Change-Id: I4fdaf226111d9db365af11c0e5bb6fa043c0b6fb CRs-Fixed: 2234230
This commit is contained in:
parent
4819ca816f
commit
f7e3cd59e3
4 changed files with 41 additions and 9 deletions
|
@ -233,6 +233,11 @@ Return<bool> GnssConfiguration::setBlacklist(
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// blValid is true if blacklist is empty, i.e. clearing the BL;
|
||||||
|
// if blacklist is not empty, blValid is initialied to false, and later
|
||||||
|
// updated in the for loop to become true only if there is at least
|
||||||
|
// one {constellation, svid} in the list that is valid.
|
||||||
|
bool blValid = (0 == blacklist.size());
|
||||||
GnssConfig config;
|
GnssConfig config;
|
||||||
memset(&config, 0, sizeof(GnssConfig));
|
memset(&config, 0, sizeof(GnssConfig));
|
||||||
config.size = sizeof(GnssConfig);
|
config.size = sizeof(GnssConfig);
|
||||||
|
@ -241,25 +246,33 @@ Return<bool> GnssConfiguration::setBlacklist(
|
||||||
|
|
||||||
GnssSvIdSource source = {};
|
GnssSvIdSource source = {};
|
||||||
for (int idx = 0; idx < (int)blacklist.size(); idx++) {
|
for (int idx = 0; idx < (int)blacklist.size(); idx++) {
|
||||||
setBlacklistedSource(source, blacklist[idx]);
|
// Set blValid true if any one source is valid
|
||||||
|
blValid = setBlacklistedSource(source, blacklist[idx]) || blValid;
|
||||||
config.blacklistedSvIds.push_back(source);
|
config.blacklistedSvIds.push_back(source);
|
||||||
}
|
}
|
||||||
|
|
||||||
return mGnss->updateConfiguration(config);
|
// Update configuration only if blValid is true
|
||||||
|
// i.e. only if atleast one source is valid for blacklisting
|
||||||
|
return (blValid && mGnss->updateConfiguration(config));
|
||||||
}
|
}
|
||||||
|
|
||||||
void GnssConfiguration::setBlacklistedSource(
|
bool GnssConfiguration::setBlacklistedSource(
|
||||||
GnssSvIdSource& copyToSource,
|
GnssSvIdSource& copyToSource,
|
||||||
const GnssConfiguration::BlacklistedSource& copyFromSource) {
|
const GnssConfiguration::BlacklistedSource& copyFromSource) {
|
||||||
|
|
||||||
|
bool retVal = true;
|
||||||
copyToSource.size = sizeof(GnssSvIdSource);
|
copyToSource.size = sizeof(GnssSvIdSource);
|
||||||
|
|
||||||
switch(copyFromSource.constellation) {
|
switch(copyFromSource.constellation) {
|
||||||
case GnssConstellationType::GPS:
|
case GnssConstellationType::GPS:
|
||||||
copyToSource.constellation = GNSS_SV_TYPE_GPS;
|
copyToSource.constellation = GNSS_SV_TYPE_GPS;
|
||||||
|
LOC_LOGe("GPS SVs can't be blacklisted.");
|
||||||
|
retVal = false;
|
||||||
break;
|
break;
|
||||||
case GnssConstellationType::SBAS:
|
case GnssConstellationType::SBAS:
|
||||||
copyToSource.constellation = GNSS_SV_TYPE_SBAS;
|
copyToSource.constellation = GNSS_SV_TYPE_SBAS;
|
||||||
|
LOC_LOGe("SBAS SVs can't be blacklisted.");
|
||||||
|
retVal = false;
|
||||||
break;
|
break;
|
||||||
case GnssConstellationType::GLONASS:
|
case GnssConstellationType::GLONASS:
|
||||||
copyToSource.constellation = GNSS_SV_TYPE_GLONASS;
|
copyToSource.constellation = GNSS_SV_TYPE_GLONASS;
|
||||||
|
@ -275,10 +288,13 @@ void GnssConfiguration::setBlacklistedSource(
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
copyToSource.constellation = GNSS_SV_TYPE_UNKNOWN;
|
copyToSource.constellation = GNSS_SV_TYPE_UNKNOWN;
|
||||||
|
LOC_LOGe("Invalid constellation %d", copyFromSource.constellation);
|
||||||
|
retVal = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
copyToSource.svId = copyFromSource.svid;
|
copyToSource.svId = copyFromSource.svid;
|
||||||
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace implementation
|
} // namespace implementation
|
||||||
|
|
|
@ -64,7 +64,7 @@ struct GnssConfiguration : public IGnssConfiguration {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Gnss* mGnss = nullptr;
|
Gnss* mGnss = nullptr;
|
||||||
void setBlacklistedSource(
|
bool setBlacklistedSource(
|
||||||
GnssSvIdSource& copyToSource,
|
GnssSvIdSource& copyToSource,
|
||||||
const GnssConfiguration::BlacklistedSource& copyFromSource);
|
const GnssConfiguration::BlacklistedSource& copyFromSource);
|
||||||
};
|
};
|
||||||
|
|
|
@ -1101,10 +1101,14 @@ GnssAdapter::gnssSvIdConfigUpdate(const std::vector<GnssSvIdSource>& blacklisted
|
||||||
memset(&mGnssSvIdConfig, 0, sizeof(GnssSvIdConfig));
|
memset(&mGnssSvIdConfig, 0, sizeof(GnssSvIdConfig));
|
||||||
|
|
||||||
// Convert the sv id lists to masks
|
// Convert the sv id lists to masks
|
||||||
convertToGnssSvIdConfig(blacklistedSvIds, mGnssSvIdConfig);
|
bool convertSuccess = convertToGnssSvIdConfig(blacklistedSvIds, mGnssSvIdConfig);
|
||||||
|
|
||||||
// Now send to Modem
|
// Now send to Modem if conversion successful
|
||||||
gnssSvIdConfigUpdate();
|
if (convertSuccess) {
|
||||||
|
gnssSvIdConfigUpdate();
|
||||||
|
} else {
|
||||||
|
LOC_LOGe("convertToGnssSvIdConfig failed");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1288,10 +1292,11 @@ GnssAdapter::gnssGetConfigCommand(GnssConfigFlagsMask configMask) {
|
||||||
return ids;
|
return ids;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
bool
|
||||||
GnssAdapter::convertToGnssSvIdConfig(
|
GnssAdapter::convertToGnssSvIdConfig(
|
||||||
const std::vector<GnssSvIdSource>& blacklistedSvIds, GnssSvIdConfig& config)
|
const std::vector<GnssSvIdSource>& blacklistedSvIds, GnssSvIdConfig& config)
|
||||||
{
|
{
|
||||||
|
bool retVal = false;
|
||||||
config.size = sizeof(GnssSvIdConfig);
|
config.size = sizeof(GnssSvIdConfig);
|
||||||
|
|
||||||
// Empty vector => Clear any previous blacklisted SVs
|
// Empty vector => Clear any previous blacklisted SVs
|
||||||
|
@ -1300,6 +1305,7 @@ GnssAdapter::convertToGnssSvIdConfig(
|
||||||
config.bdsBlacklistSvMask = 0;
|
config.bdsBlacklistSvMask = 0;
|
||||||
config.qzssBlacklistSvMask = 0;
|
config.qzssBlacklistSvMask = 0;
|
||||||
config.galBlacklistSvMask = 0;
|
config.galBlacklistSvMask = 0;
|
||||||
|
retVal = true;
|
||||||
} else {
|
} else {
|
||||||
// Parse the vector and convert SV IDs to mask values
|
// Parse the vector and convert SV IDs to mask values
|
||||||
for (GnssSvIdSource source : blacklistedSvIds) {
|
for (GnssSvIdSource source : blacklistedSvIds) {
|
||||||
|
@ -1340,7 +1346,17 @@ GnssAdapter::convertToGnssSvIdConfig(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Return true if any one source is valid
|
||||||
|
if (0 != config.gloBlacklistSvMask ||
|
||||||
|
0 != config.bdsBlacklistSvMask ||
|
||||||
|
0 != config.galBlacklistSvMask ||
|
||||||
|
0 != config.qzssBlacklistSvMask) {
|
||||||
|
retVal = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GnssAdapter::convertFromGnssSvIdConfig(
|
void GnssAdapter::convertFromGnssSvIdConfig(
|
||||||
|
|
|
@ -327,7 +327,7 @@ public:
|
||||||
static void convertSatelliteInfo(std::vector<GnssDebugSatelliteInfo>& out,
|
static void convertSatelliteInfo(std::vector<GnssDebugSatelliteInfo>& out,
|
||||||
const GnssSvType& in_constellation,
|
const GnssSvType& in_constellation,
|
||||||
const SystemStatusReports& in);
|
const SystemStatusReports& in);
|
||||||
static void convertToGnssSvIdConfig(
|
static bool convertToGnssSvIdConfig(
|
||||||
const std::vector<GnssSvIdSource>& blacklistedSvIds, GnssSvIdConfig& config);
|
const std::vector<GnssSvIdSource>& blacklistedSvIds, GnssSvIdConfig& config);
|
||||||
static void convertFromGnssSvIdConfig(
|
static void convertFromGnssSvIdConfig(
|
||||||
const GnssSvIdConfig& svConfig, GnssConfig& config);
|
const GnssSvIdConfig& svConfig, GnssConfig& config);
|
||||||
|
|
Loading…
Reference in a new issue