XTWiFi: disable coarse position injection when XTWiFi NLP is in use

Disable coarse position injection from GPS HAL when XTWiFi
Network Location Provider is in use. This is needed to avoid self
learning loop inside modem.

Change-Id: I0526317221d3490c41d0d8d901fbfa4d93e9a0b0
CRs-Fixed: 409409
This commit is contained in:
Kevin Tang 2012-10-17 14:49:56 -07:00
parent f86ec94d37
commit 0529b2b9bb

27
loc_api/libloc_api_50001/loc.cpp Normal file → Executable file
View file

@ -41,6 +41,8 @@
#include <fcntl.h>
#include <errno.h>
#include <cutils/properties.h>
//Globals defns
static const ulpInterface * loc_eng_ulp_inf = NULL;
static const ulpInterface * loc_eng_get_ulp_inf(void);
@ -523,9 +525,32 @@ SIDE EFFECTS
===========================================================================*/
static int loc_inject_location(double latitude, double longitude, float accuracy)
{
static bool initialized = false;
static bool enable_cpi = true;
ENTRY_LOG();
int ret_val = loc_eng_inject_location(loc_afw_data, latitude, longitude, accuracy);
if(!initialized)
{
char value[PROPERTY_VALUE_MAX];
memset(value, 0, sizeof(value));
(void)property_get("persist.gps.qc_nlp_in_use", value, "0");
if(0 == strcmp(value, "1"))
{
enable_cpi = false;
LOC_LOGI("GPS HAL coarse position injection disabled");
}
else
{
LOC_LOGI("GPS HAL coarse position injection enabled");
}
initialized = true;
}
int ret_val = 0;
if(enable_cpi)
{
ret_val = loc_eng_inject_location(loc_afw_data, latitude, longitude, accuracy);
}
EXIT_LOG(%d, ret_val);
return ret_val;
}