diff options
author | Saurabh Srivastava <ssrivast@codeaurora.org> | 2016-08-27 02:46:25 +0530 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2016-08-29 07:53:38 -0700 |
commit | 7424ac78edd73e3d564a0a561253ee7b1141928c (patch) | |
tree | 38a865931004d94da91970131759d2108a3e59eb /core/ContextBase.cpp | |
parent | 81d0cbb94d20bc446603d57658db9ecd1c80f42d (diff) | |
download | gps-7424ac78edd73e3d564a0a561253ee7b1141928c.tar.gz |
Adding TARGET_NO_GNSS check while creating LocApi
In case target is APQ no WGR, create a dummy LocApiBase
instance.
Change-Id: I621e99f5be5524a58f416ff2e1325d921c8d0546
CRs-Fixed: 1060111
Diffstat (limited to 'core/ContextBase.cpp')
-rw-r--r-- | core/ContextBase.cpp | 44 |
1 files changed, 24 insertions, 20 deletions
diff --git a/core/ContextBase.cpp b/core/ContextBase.cpp index d2f9070..1ae8482 100644 --- a/core/ContextBase.cpp +++ b/core/ContextBase.cpp @@ -88,31 +88,35 @@ LocApiBase* ContextBase::createLocApi(LOC_API_ADAPTER_EVENT_MASK_T exMask) { LocApiBase* locApi = NULL; - if (NULL == (locApi = mLBSProxy->getLocApi(mMsgTask, exMask, this))) { - void *handle = NULL; - //try to see if LocApiV02 is present - if ((handle = dlopen("libloc_api_v02.so", RTLD_NOW)) != NULL) { - LOC_LOGD("%s:%d]: libloc_api_v02.so is present", __func__, __LINE__); - getLocApi_t* getter = (getLocApi_t*) dlsym(handle, "getLocApi"); - if (getter != NULL) { - LOC_LOGD("%s:%d]: getter is not NULL for LocApiV02", __func__, - __LINE__); - locApi = (*getter)(mMsgTask, exMask, this); - } - } - // only RPC is the option now - else { - LOC_LOGD("%s:%d]: libloc_api_v02.so is NOT present. Trying RPC", - __func__, __LINE__); - handle = dlopen("libloc_api-rpc-qc.so", RTLD_NOW); - if (NULL != handle) { + // Check the target + if (TARGET_NO_GNSS != loc_get_target()){ + + if (NULL == (locApi = mLBSProxy->getLocApi(mMsgTask, exMask, this))) { + void *handle = NULL; + //try to see if LocApiV02 is present + if ((handle = dlopen("libloc_api_v02.so", RTLD_NOW)) != NULL) { + LOC_LOGD("%s:%d]: libloc_api_v02.so is present", __func__, __LINE__); getLocApi_t* getter = (getLocApi_t*) dlsym(handle, "getLocApi"); - if (NULL != getter) { - LOC_LOGD("%s:%d]: getter is not NULL in RPC", __func__, + if (getter != NULL) { + LOC_LOGD("%s:%d]: getter is not NULL for LocApiV02", __func__, __LINE__); locApi = (*getter)(mMsgTask, exMask, this); } } + // only RPC is the option now + else { + LOC_LOGD("%s:%d]: libloc_api_v02.so is NOT present. Trying RPC", + __func__, __LINE__); + handle = dlopen("libloc_api-rpc-qc.so", RTLD_NOW); + if (NULL != handle) { + getLocApi_t* getter = (getLocApi_t*) dlsym(handle, "getLocApi"); + if (NULL != getter) { + LOC_LOGD("%s:%d]: getter is not NULL in RPC", __func__, + __LINE__); + locApi = (*getter)(mMsgTask, exMask, this); + } + } + } } } |