Allow SUPL server NONE config

Clear SUPL server on Modem if configured
as NONE in HLOS config.

CRs-Fixed: 2164682
Change-Id: If104550fddaa64be43e446f8691cab60b1541013
This commit is contained in:
Saurabh Srivastava 2018-01-10 00:36:54 +05:30 committed by Kevin Tang
parent c98dcaa840
commit 02862b8577

View file

@ -584,21 +584,27 @@ GnssAdapter::setSuplHostServer(const char* server, int port)
LocationError locErr = LOCATION_ERROR_SUCCESS; LocationError locErr = LOCATION_ERROR_SUCCESS;
if (ContextBase::mGps_conf.AGPS_CONFIG_INJECT) { if (ContextBase::mGps_conf.AGPS_CONFIG_INJECT) {
char serverUrl[MAX_URL_LEN] = {}; char serverUrl[MAX_URL_LEN] = {};
int32_t length = 0; int32_t length = -1;
const char noHost[] = "NONE"; const char noHost[] = "NONE";
if ((NULL == server) || (server[0] == 0) || (port == 0) ||
locErr = LOCATION_ERROR_INVALID_PARAMETER;
if ((NULL == server) || (server[0] == 0) ||
(strncasecmp(noHost, server, sizeof(noHost)) == 0)) { (strncasecmp(noHost, server, sizeof(noHost)) == 0)) {
locErr = LOCATION_ERROR_INVALID_PARAMETER; serverUrl[0] = NULL;
} else { length = 0;
mServerUrl.clear();
} else if (port > 0) {
length = snprintf(serverUrl, sizeof(serverUrl), "%s:%u", server, port); length = snprintf(serverUrl, sizeof(serverUrl), "%s:%u", server, port);
if (length > 0 && strncasecmp(getServerUrl().c_str(), }
serverUrl, sizeof(serverUrl)) != 0) {
setServerUrl(serverUrl); if (length >= 0 && strncasecmp(getServerUrl().c_str(),
locErr = mLocApi->setServer(serverUrl, length); serverUrl, sizeof(serverUrl)) != 0) {
if (locErr != LOCATION_ERROR_SUCCESS) { setServerUrl(serverUrl);
LOC_LOGE("%s]:Error while setting SUPL_HOST server:%s", locErr = mLocApi->setServer(serverUrl, length);
__func__, serverUrl); if (locErr != LOCATION_ERROR_SUCCESS) {
} LOC_LOGE("%s]:Error while setting SUPL_HOST server:%s",
__func__, serverUrl);
} }
} }
} }