summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorChengYou Ho <chengyouho@google.com>2019-10-22 08:32:31 -0700
committerandroid-build-merger <android-build-merger@google.com>2019-10-22 08:32:31 -0700
commitd4d1b630d1a60719098a6a798ecf5adb5e6329f9 (patch)
tree0c6d30454dde48174f79a1add95a9e4271b4d0a3 /core
parent81467e9585cdfef796e8d8eaacfa28a48b5ff9d3 (diff)
parentb23301cfa55db2898ff8da5997adab6ee23e874a (diff)
downloadgps-d4d1b630d1a60719098a6a798ecf5adb5e6329f9.tar.gz
Merge remote-tracking branch 'goog/qcom/release/LA.UM.8.1.R1.10.00.00.529.095' into qt-qpr1-dev
am: b23301cfa5 Change-Id: Ib6fa9f365b785a5b9da7fa20e9e79f8e0a513f58
Diffstat (limited to 'core')
-rw-r--r--core/ContextBase.cpp26
-rw-r--r--core/ContextBase.h1
-rw-r--r--core/EngineHubProxyBase.h19
-rw-r--r--core/LocAdapterBase.cpp1
-rw-r--r--core/LocAdapterBase.h6
-rw-r--r--core/LocApiBase.cpp15
-rw-r--r--core/LocApiBase.h9
-rw-r--r--core/SystemStatusOsObserver.cpp2
-rw-r--r--core/SystemStatusOsObserver.h8
-rw-r--r--core/observer/IFrameworkActionReq.h2
10 files changed, 56 insertions, 33 deletions
diff --git a/core/ContextBase.cpp b/core/ContextBase.cpp
index 084b6bf..d5c3108 100644
--- a/core/ContextBase.cpp
+++ b/core/ContextBase.cpp
@@ -40,6 +40,10 @@
namespace loc_core {
+#define SLL_LOC_API_LIB_NAME "libsynergy_loc_api.so"
+#define LOC_APIV2_0_LIB_NAME "libloc_api_v02.so"
+#define IS_SS5_HW_ENABLED 1
+
loc_gps_cfg_s_type ContextBase::mGps_conf {};
loc_sap_cfg_s_type ContextBase::mSap_conf {};
bool ContextBase::sIsEngineCapabilitiesKnown = false;
@@ -80,6 +84,7 @@ const loc_param_s_type ContextBase::mGps_conf_table[] =
{"POSITION_ASSISTED_CLOCK_ESTIMATOR_ENABLED", &mGps_conf.POSITION_ASSISTED_CLOCK_ESTIMATOR_ENABLED, NULL, 'n'},
{"PROXY_APP_PACKAGE_NAME", &mGps_conf.PROXY_APP_PACKAGE_NAME, NULL, 's' },
{"CP_MTLR_ES", &mGps_conf.CP_MTLR_ES, NULL, 'n' },
+ {"GNSS_DEPLOYMENT", &mGps_conf.GNSS_DEPLOYMENT, NULL, 'n'},
};
const loc_param_s_type ContextBase::mSap_conf_table[] =
@@ -171,10 +176,16 @@ void ContextBase::readConfig()
mGps_conf.CONSTRAINED_TIME_UNCERTAINTY_ENERGY_BUDGET = 0;
/* default configuration value of position assisted clock estimator mode */
mGps_conf.POSITION_ASSISTED_CLOCK_ESTIMATOR_ENABLED = 0;
+ /* default configuration QTI GNSS H/W */
+ mGps_conf.GNSS_DEPLOYMENT = 0;
UTIL_READ_CONF(LOC_PATH_GPS_CONF, mGps_conf_table);
UTIL_READ_CONF(LOC_PATH_SAP_CONF, mSap_conf_table);
+ LOC_LOGI("%s] GNSS Deployment: %s", __FUNCTION__,
+ ((mGps_conf.GNSS_DEPLOYMENT == 1) ? "SS5" :
+ ((mGps_conf.GNSS_DEPLOYMENT == 2) ? "QFUSION" : "QGNSS")));
+
switch (getTargetGnssType(loc_get_target())) {
case GNSS_GSS:
case GNSS_AUTO:
@@ -231,19 +242,24 @@ LBSProxyBase* ContextBase::getLBSProxy(const char* libName)
LocApiBase* ContextBase::createLocApi(LOC_API_ADAPTER_EVENT_MASK_T exMask)
{
LocApiBase* locApi = NULL;
+ const char* libname = LOC_APIV2_0_LIB_NAME;
// Check the target
if (TARGET_NO_GNSS != loc_get_target()){
if (NULL == (locApi = mLBSProxy->getLocApi(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__);
+
+ if (IS_SS5_HW_ENABLED == mGps_conf.GNSS_DEPLOYMENT) {
+ libname = SLL_LOC_API_LIB_NAME;
+ }
+
+ if ((handle = dlopen(libname, RTLD_NOW)) != NULL) {
+ LOC_LOGD("%s:%d]: %s is present", __func__, __LINE__, libname);
getLocApi_t* getter = (getLocApi_t*) dlsym(handle, "getLocApi");
if (getter != NULL) {
- LOC_LOGD("%s:%d]: getter is not NULL for LocApiV02", __func__,
- __LINE__);
+ LOC_LOGD("%s:%d]: getter is not NULL of %s", __func__,
+ __LINE__, libname);
locApi = (*getter)(exMask, this);
}
}
diff --git a/core/ContextBase.h b/core/ContextBase.h
index ab61a08..5da76e2 100644
--- a/core/ContextBase.h
+++ b/core/ContextBase.h
@@ -73,6 +73,7 @@ typedef struct loc_gps_cfg_s
uint32_t POSITION_ASSISTED_CLOCK_ESTIMATOR_ENABLED;
char PROXY_APP_PACKAGE_NAME[LOC_MAX_PARAM_STRING];
uint32_t CP_MTLR_ES;
+ uint32_t GNSS_DEPLOYMENT;
} loc_gps_cfg_s_type;
/* NOTE: the implementaiton of the parser casts number
diff --git a/core/EngineHubProxyBase.h b/core/EngineHubProxyBase.h
index 4239a50..ec881f6 100644
--- a/core/EngineHubProxyBase.h
+++ b/core/EngineHubProxyBase.h
@@ -103,12 +103,8 @@ public:
}
};
-typedef std::function<void(const UlpLocation& ulpLocation,
- const GpsLocationExtended& locationExtended,
- enum loc_sess_status status,
- LocPosTechMask techMask,
- bool fromEngineHub)>
- GnssAdapterReportPositionEventCb;
+typedef std::function<void(int count, EngineLocationInfo* locationArr)>
+ GnssAdapterReportEnginePositionsEventCb;
typedef std::function<void(const GnssSvNotification& svNotify,
bool fromEngineHub)>
@@ -119,11 +115,12 @@ typedef std::function<void(const GnssAidingDataSvMask& svDataMask)>
// potential parameters: message queue: MsgTask * msgTask;
// callback function to report back dr and ppe position and sv report
-typedef EngineHubProxyBase* (getEngHubProxyFn)(const MsgTask * msgTask,
- IOsObserver* osObserver,
- GnssAdapterReportPositionEventCb positionEventCb,
- GnssAdapterReportSvEventCb svEventCb,
- GnssAdapterReqAidingDataCb reqAidingDataCb);
+typedef EngineHubProxyBase* (getEngHubProxyFn)(
+ const MsgTask * msgTask,
+ IOsObserver* osObserver,
+ GnssAdapterReportEnginePositionsEventCb positionEventCb,
+ GnssAdapterReportSvEventCb svEventCb,
+ GnssAdapterReqAidingDataCb reqAidingDataCb);
} // namespace loc_core
diff --git a/core/LocAdapterBase.cpp b/core/LocAdapterBase.cpp
index ffd3d5a..1b844e5 100644
--- a/core/LocAdapterBase.cpp
+++ b/core/LocAdapterBase.cpp
@@ -81,7 +81,6 @@ void LocAdapterBase::
const GpsLocationExtended& locationExtended,
enum loc_sess_status status,
LocPosTechMask loc_technology_mask,
- bool /*fromEngineHub*/,
GnssDataNotification* pDataNotify,
int msInWeek)
{
diff --git a/core/LocAdapterBase.h b/core/LocAdapterBase.h
index b9b1f1e..909b6fe 100644
--- a/core/LocAdapterBase.h
+++ b/core/LocAdapterBase.h
@@ -151,9 +151,13 @@ public:
const GpsLocationExtended& locationExtended,
enum loc_sess_status status,
LocPosTechMask loc_technology_mask,
- bool fromEngineHub = false,
GnssDataNotification* pDataNotify = nullptr,
int msInWeek = -1);
+ virtual void reportEnginePositionsEvent(unsigned int count,
+ EngineLocationInfo* locationArr) {
+ (void)count;
+ (void)locationArr;
+ }
virtual void reportSvEvent(const GnssSvNotification& svNotify,
bool fromEngineHub=false);
virtual void reportDataEvent(const GnssDataNotification& dataNotify, int msInWeek);
diff --git a/core/LocApiBase.cpp b/core/LocApiBase.cpp
index ef204ec..8c79cf7 100644
--- a/core/LocApiBase.cpp
+++ b/core/LocApiBase.cpp
@@ -148,7 +148,8 @@ struct LocCloseMsg : public LocMsg {
}
};
-MsgTask* LocApiBase::mMsgTask;
+MsgTask* LocApiBase::mMsgTask = nullptr;
+volatile int32_t LocApiBase::mMsgTaskRefCount = 0;
LocApiBase::LocApiBase(LOC_API_ADAPTER_EVENT_MASK_T excludedMask,
ContextBase* context) :
@@ -157,6 +158,7 @@ LocApiBase::LocApiBase(LOC_API_ADAPTER_EVENT_MASK_T excludedMask,
{
memset(mLocAdapters, 0, sizeof(mLocAdapters));
+ android_atomic_inc(&mMsgTaskRefCount);
if (nullptr == mMsgTask) {
mMsgTask = new MsgTask("LocApiMsgTask", false);
}
@@ -230,7 +232,7 @@ void LocApiBase::addAdapter(LocAdapterBase* adapter)
for (int i = 0; i < MAX_ADAPTERS && mLocAdapters[i] != adapter; i++) {
if (mLocAdapters[i] == NULL) {
mLocAdapters[i] = adapter;
- mMsgTask->sendMsg(new LocOpenMsg(this, adapter));
+ sendMsg(new LocOpenMsg(this, adapter));
break;
}
}
@@ -263,10 +265,10 @@ void LocApiBase::removeAdapter(LocAdapterBase* adapter)
// if we have an empty list of adapters
if (0 == i) {
- mMsgTask->sendMsg(new LocCloseMsg(this));
+ sendMsg(new LocCloseMsg(this));
} else {
// else we need to remove the bit
- mMsgTask->sendMsg(new LocOpenMsg(this));
+ sendMsg(new LocOpenMsg(this));
}
}
}
@@ -274,7 +276,7 @@ void LocApiBase::removeAdapter(LocAdapterBase* adapter)
void LocApiBase::updateEvtMask()
{
- mMsgTask->sendMsg(new LocOpenMsg(this));
+ sendMsg(new LocOpenMsg(this));
}
void LocApiBase::updateNmeaMask(uint32_t mask)
@@ -298,7 +300,7 @@ void LocApiBase::updateNmeaMask(uint32_t mask)
}
};
- mMsgTask->sendMsg(new LocSetNmeaMsg(this, mask));
+ sendMsg(new LocSetNmeaMsg(this, mask));
}
void LocApiBase::handleEngineUpEvent()
@@ -343,7 +345,6 @@ void LocApiBase::reportPosition(UlpLocation& location,
TO_ALL_LOCADAPTERS(
mLocAdapters[i]->reportPositionEvent(location, locationExtended,
status, loc_technology_mask,
- false,
pDataNotify, msInWeek)
);
}
diff --git a/core/LocApiBase.h b/core/LocApiBase.h
index 8c885f7..6dac585 100644
--- a/core/LocApiBase.h
+++ b/core/LocApiBase.h
@@ -34,6 +34,7 @@
#include <gps_extended.h>
#include <LocationAPI.h>
#include <MsgTask.h>
+#include <LocSharedLock.h>
#include <log_util.h>
namespace loc_core {
@@ -107,6 +108,7 @@ class LocApiBase {
friend struct LocKillMsg;
friend class ContextBase;
static MsgTask* mMsgTask;
+ static volatile int32_t mMsgTaskRefCount;
LocAdapterBase* mLocAdapters[MAX_ADAPTERS];
protected:
@@ -121,7 +123,8 @@ protected:
LocApiBase(LOC_API_ADAPTER_EVENT_MASK_T excludedMask,
ContextBase* context = NULL);
inline virtual ~LocApiBase() {
- if (nullptr != mMsgTask) {
+ android_atomic_dec(&mMsgTaskRefCount);
+ if (nullptr != mMsgTask && 0 == mMsgTaskRefCount) {
mMsgTask->destroy();
mMsgTask = nullptr;
}
@@ -132,7 +135,9 @@ protected:
public:
inline void sendMsg(const LocMsg* msg) const {
- mMsgTask->sendMsg(msg);
+ if (nullptr != mMsgTask) {
+ mMsgTask->sendMsg(msg);
+ }
}
inline void destroy() {
close();
diff --git a/core/SystemStatusOsObserver.cpp b/core/SystemStatusOsObserver.cpp
index 3fdb513..0427380 100644
--- a/core/SystemStatusOsObserver.cpp
+++ b/core/SystemStatusOsObserver.cpp
@@ -448,7 +448,7 @@ void SystemStatusOsObserver::turnOff(DataItemId dit)
}
}
-#ifdef USE_QCMAP
+#ifdef USE_GLIB
bool SystemStatusOsObserver::connectBackhaul()
{
bool result = false;
diff --git a/core/SystemStatusOsObserver.h b/core/SystemStatusOsObserver.h
index 8710976..fd60606 100644
--- a/core/SystemStatusOsObserver.h
+++ b/core/SystemStatusOsObserver.h
@@ -84,7 +84,7 @@ public:
mSystemStatus(systemstatus), mContext(msgTask, this),
mAddress("SystemStatusOsObserver"),
mClientToDataItems(MAX_DATA_ITEM_ID), mDataItemToClients(MAX_DATA_ITEM_ID)
-#ifdef USE_QCMAP
+#ifdef USE_GLIB
, mBackHaulConnectReqCount(0)
#endif
{
@@ -106,7 +106,7 @@ public:
// To set the framework action request object
inline void setFrameworkActionReqObj(IFrameworkActionReq* frameworkActionReqObj) {
mContext.mFrameworkActionReqObj = frameworkActionReqObj;
-#ifdef USE_QCMAP
+#ifdef USE_GLIB
if (mBackHaulConnectReqCount > 0) {
connectBackhaul();
mBackHaulConnectReqCount = 0;
@@ -134,7 +134,7 @@ public:
// IFrameworkActionReq Overrides
virtual void turnOn(DataItemId dit, int timeOut = 0) override;
virtual void turnOff(DataItemId dit) override;
-#ifdef USE_QCMAP
+#ifdef USE_GLIB
virtual bool connectBackhaul() override;
virtual bool disconnectBackhaul();
#endif
@@ -151,7 +151,7 @@ private:
// Cache the subscribe and requestData till subscription obj is obtained
void cacheObserverRequest(ObserverReqCache& reqCache,
const list<DataItemId>& l, IDataItemObserver* client);
-#ifdef USE_QCMAP
+#ifdef USE_GLIB
// Cache the framework action request for connect/disconnect
int mBackHaulConnectReqCount;
#endif
diff --git a/core/observer/IFrameworkActionReq.h b/core/observer/IFrameworkActionReq.h
index a4ccad8..4be947f 100644
--- a/core/observer/IFrameworkActionReq.h
+++ b/core/observer/IFrameworkActionReq.h
@@ -70,7 +70,7 @@ public:
*/
virtual void turnOff (DataItemId dit) = 0;
-#ifdef USE_QCMAP
+#ifdef USE_GLIB
/**
* @brief Setup WWAN backhaul
* @details Setup WWAN backhaul