Merge "XTWiFi: disable coarse position injection when XTWiFi NLP is in use"
This commit is contained in:
commit
353911d007
1 changed files with 26 additions and 1 deletions
27
loc_api/libloc_api_50001/loc.cpp
Normal file → Executable file
27
loc_api/libloc_api_50001/loc.cpp
Normal file → Executable file
|
@ -41,6 +41,8 @@
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
#include <cutils/properties.h>
|
||||||
|
|
||||||
//Globals defns
|
//Globals defns
|
||||||
static const ulpInterface * loc_eng_ulp_inf = NULL;
|
static const ulpInterface * loc_eng_ulp_inf = NULL;
|
||||||
static const ulpInterface * loc_eng_get_ulp_inf(void);
|
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 int loc_inject_location(double latitude, double longitude, float accuracy)
|
||||||
{
|
{
|
||||||
|
static bool initialized = false;
|
||||||
|
static bool enable_cpi = true;
|
||||||
ENTRY_LOG();
|
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);
|
EXIT_LOG(%d, ret_val);
|
||||||
return ret_val;
|
return ret_val;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue