Adding new target APQ-NoWGR handling

Adding handling for new ro.baseband value provided by target team
If the target does not have WGR (GPS Receiver), we return NULL
GPS and FLP interfaces.

CRs-Fixed: 1033674
Change-Id: I1561518c4f4b0c52ab934feb2fa43e9078c91d86
This commit is contained in:
Saurabh Srivastava 2016-07-19 02:26:58 +05:30
parent 7124f9f705
commit c01fcd784c
3 changed files with 37 additions and 30 deletions

View file

@ -88,30 +88,29 @@ LocApiBase* ContextBase::createLocApi(LOC_API_ADAPTER_EVENT_MASK_T exMask)
{ {
LocApiBase* locApi = NULL; LocApiBase* locApi = NULL;
// first if can not be MPQ if (NULL == (locApi = mLBSProxy->getLocApi(mMsgTask, exMask, this))) {
if (TARGET_MPQ != loc_get_target()) { void *handle = NULL;
if (NULL == (locApi = mLBSProxy->getLocApi(mMsgTask, exMask, this))) { //try to see if LocApiV02 is present
void *handle = NULL; if ((handle = dlopen("libloc_api_v02.so", RTLD_NOW)) != NULL) {
//try to see if LocApiV02 is present LOC_LOGD("%s:%d]: libloc_api_v02.so is present", __func__, __LINE__);
if((handle = dlopen("libloc_api_v02.so", RTLD_NOW)) != NULL) { getLocApi_t* getter = (getLocApi_t*) dlsym(handle, "getLocApi");
LOC_LOGD("%s:%d]: libloc_api_v02.so is present", __func__, __LINE__); if (getter != NULL) {
getLocApi_t* getter = (getLocApi_t*)dlsym(handle, "getLocApi"); LOC_LOGD("%s:%d]: getter is not NULL for LocApiV02", __func__,
if(getter != NULL) { __LINE__);
LOC_LOGD("%s:%d]: getter is not NULL for LocApiV02", __func__, __LINE__); locApi = (*getter)(mMsgTask, exMask, this);
locApi = (*getter)(mMsgTask, exMask, this);
}
} }
// only RPC is the option now }
else { // only RPC is the option now
LOC_LOGD("%s:%d]: libloc_api_v02.so is NOT present. Trying RPC", else {
__func__, __LINE__); LOC_LOGD("%s:%d]: libloc_api_v02.so is NOT present. Trying RPC",
handle = dlopen("libloc_api-rpc-qc.so", RTLD_NOW); __func__, __LINE__);
if (NULL != handle) { handle = dlopen("libloc_api-rpc-qc.so", RTLD_NOW);
getLocApi_t* getter = (getLocApi_t*)dlsym(handle, "getLocApi"); if (NULL != handle) {
if (NULL != getter) { getLocApi_t* getter = (getLocApi_t*) dlsym(handle, "getLocApi");
LOC_LOGD("%s:%d]: getter is not NULL in RPC", __func__, __LINE__); if (NULL != getter) {
locApi = (*getter)(mMsgTask, exMask, this); LOC_LOGD("%s:%d]: getter is not NULL in RPC", __func__,
} __LINE__);
locApi = (*getter)(mMsgTask, exMask, this);
} }
} }
} }

View file

@ -49,11 +49,12 @@
#define APQ8074_ID_1 "184" #define APQ8074_ID_1 "184"
#define LINE_LEN 100 #define LINE_LEN 100
#define STR_LIQUID "Liquid" #define STR_LIQUID "Liquid"
#define STR_SURF "Surf" #define STR_SURF "Surf"
#define STR_MTP "MTP" #define STR_MTP "MTP"
#define STR_APQ "apq" #define STR_APQ "apq"
#define STR_AUTO "auto" #define STR_APQ_NO_WGR "baseband_apq_nowgr"
#define STR_AUTO "auto"
#define IS_STR_END(c) ((c) == '\0' || (c) == '\n' || (c) == '\r') #define IS_STR_END(c) ((c) == '\0' || (c) == '\n' || (c) == '\r')
#define LENGTH(s) (sizeof(s) - 1) #define LENGTH(s) (sizeof(s) - 1)
#define GPS_CHECK_NO_ERROR 0 #define GPS_CHECK_NO_ERROR 0
@ -231,11 +232,18 @@ unsigned int loc_get_target(void)
gTarget = TARGET_AUTO; gTarget = TARGET_AUTO;
goto detected; goto detected;
} }
if( !memcmp(baseband, STR_APQ_NO_WGR, LENGTH(STR_APQ_NO_WGR)) ){
gTarget = TARGET_NO_GNSS;
goto detected;
}
if( !memcmp(baseband, STR_APQ, LENGTH(STR_APQ)) ){ if( !memcmp(baseband, STR_APQ, LENGTH(STR_APQ)) ){
if( !memcmp(rd_id, MPQ8064_ID_1, LENGTH(MPQ8064_ID_1)) if( !memcmp(rd_id, MPQ8064_ID_1, LENGTH(MPQ8064_ID_1))
&& IS_STR_END(rd_id[LENGTH(MPQ8064_ID_1)]) ) && IS_STR_END(rd_id[LENGTH(MPQ8064_ID_1)]) )
gTarget = TARGET_MPQ; gTarget = TARGET_NO_GNSS;
else else
gTarget = TARGET_APQ_SA; gTarget = TARGET_APQ_SA;
} }

View file

@ -32,7 +32,7 @@
#define TARGET_DEFAULT TARGET_SET(GNSS_MSM, HAS_SSC) #define TARGET_DEFAULT TARGET_SET(GNSS_MSM, HAS_SSC)
#define TARGET_MDM TARGET_SET(GNSS_MDM, HAS_SSC) #define TARGET_MDM TARGET_SET(GNSS_MDM, HAS_SSC)
#define TARGET_APQ_SA TARGET_SET(GNSS_GSS, NO_SSC) #define TARGET_APQ_SA TARGET_SET(GNSS_GSS, NO_SSC)
#define TARGET_MPQ TARGET_SET(GNSS_NONE,NO_SSC) #define TARGET_NO_GNSS TARGET_SET(GNSS_NONE, NO_SSC)
#define TARGET_MSM_NO_SSC TARGET_SET(GNSS_MSM, NO_SSC) #define TARGET_MSM_NO_SSC TARGET_SET(GNSS_MSM, NO_SSC)
#define TARGET_QCA1530 TARGET_SET(GNSS_QCA1530, NO_SSC) #define TARGET_QCA1530 TARGET_SET(GNSS_QCA1530, NO_SSC)
#define TARGET_AUTO TARGET_SET(GNSS_AUTO, NO_SSC) #define TARGET_AUTO TARGET_SET(GNSS_AUTO, NO_SSC)