summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/ContextBase.cpp2
-rw-r--r--core/LocAdapterBase.cpp5
-rw-r--r--core/LocAdapterBase.h18
-rw-r--r--core/LocApiBase.cpp16
-rw-r--r--core/LocApiBase.h7
-rw-r--r--etc/gps.conf4
-rw-r--r--gnss/GnssAdapter.cpp7
7 files changed, 39 insertions, 20 deletions
diff --git a/core/ContextBase.cpp b/core/ContextBase.cpp
index 5695544..2c7f04c 100644
--- a/core/ContextBase.cpp
+++ b/core/ContextBase.cpp
@@ -104,7 +104,7 @@ void ContextBase::readConfig()
mGps_conf.INTERMEDIATE_POS = 0;
mGps_conf.ACCURACY_THRES = 0;
mGps_conf.NMEA_PROVIDER = 0;
- mGps_conf.GPS_LOCK = 0;
+ mGps_conf.GPS_LOCK = 0x03;
mGps_conf.SUPL_VER = 0x10000;
mGps_conf.SUPL_MODE = 0x1;
mGps_conf.SUPL_ES = 0;
diff --git a/core/LocAdapterBase.cpp b/core/LocAdapterBase.cpp
index f7443f8..8301ee8 100644
--- a/core/LocAdapterBase.cpp
+++ b/core/LocAdapterBase.cpp
@@ -42,8 +42,9 @@ namespace loc_core {
// But if getLocApi(targetEnumType target) is overriden,
// the right locApi should get created.
LocAdapterBase::LocAdapterBase(const LOC_API_ADAPTER_EVENT_MASK_T mask,
- ContextBase* context, LocAdapterProxyBase *adapterProxyBase) :
- mEvtMask(mask), mContext(context),
+ ContextBase* context, bool isMaster,
+ LocAdapterProxyBase *adapterProxyBase) :
+ mIsMaster(isMaster), mEvtMask(mask), mContext(context),
mLocApi(context->getLocApi()), mLocAdapterProxyBase(adapterProxyBase),
mMsgTask(context->getMsgTask())
{
diff --git a/core/LocAdapterBase.h b/core/LocAdapterBase.h
index a187a8d..e3502b2 100644
--- a/core/LocAdapterBase.h
+++ b/core/LocAdapterBase.h
@@ -59,6 +59,7 @@ class LocAdapterProxyBase;
class LocAdapterBase {
private:
static uint32_t mSessionIdCounter;
+ const bool mIsMaster;
protected:
LOC_API_ADAPTER_EVENT_MASK_T mEvtMask;
ContextBase* mContext;
@@ -66,12 +67,18 @@ protected:
LocAdapterProxyBase* mLocAdapterProxyBase;
const MsgTask* mMsgTask;
inline LocAdapterBase(const MsgTask* msgTask) :
- mEvtMask(0), mContext(NULL), mLocApi(NULL),
+ mIsMaster(false), mEvtMask(0), mContext(NULL), mLocApi(NULL),
mLocAdapterProxyBase(NULL), mMsgTask(msgTask) {}
+ LocAdapterBase(const LOC_API_ADAPTER_EVENT_MASK_T mask,
+ ContextBase* context, bool isMaster,
+ LocAdapterProxyBase *adapterProxyBase = NULL);
public:
inline virtual ~LocAdapterBase() { mLocApi->removeAdapter(this); }
- LocAdapterBase(const LOC_API_ADAPTER_EVENT_MASK_T mask,
- ContextBase* context, LocAdapterProxyBase *adapterProxyBase = NULL);
+ inline LocAdapterBase(const LOC_API_ADAPTER_EVENT_MASK_T mask,
+ ContextBase* context,
+ LocAdapterProxyBase *adapterProxyBase = NULL) :
+ LocAdapterBase(mask, context, false, adapterProxyBase) {}
+
inline LOC_API_ADAPTER_EVENT_MASK_T
checkMask(LOC_API_ADAPTER_EVENT_MASK_T mask) const {
return mEvtMask & mask;
@@ -111,6 +118,11 @@ public:
}
uint32_t generateSessionId();
+
+ inline bool isAdapterMaster() {
+ return mIsMaster;
+ }
+
virtual void handleEngineUpEvent();
virtual void handleEngineDownEvent();
inline virtual void setPositionModeCommand(LocPosMode& posMode) {
diff --git a/core/LocApiBase.cpp b/core/LocApiBase.cpp
index 4a1c8fc..650de92 100644
--- a/core/LocApiBase.cpp
+++ b/core/LocApiBase.cpp
@@ -163,6 +163,18 @@ LOC_API_ADAPTER_EVENT_MASK_T LocApiBase::getEvtMask()
return mask & ~mExcludedMask;
}
+bool LocApiBase::isMaster()
+{
+ bool isMaster = false;
+
+ for (int i = 0;
+ !isMaster && i < MAX_ADAPTERS && NULL != mLocAdapters[i];
+ i++) {
+ isMaster |= mLocAdapters[i]->isAdapterMaster();
+ }
+ return isMaster;
+}
+
bool LocApiBase::isInSession()
{
bool inSession = false;
@@ -578,10 +590,6 @@ void LocApiBase::
uint32_t /*slotBitMask*/)
DEFAULT_IMPL()
-int LocApiBase::
- getGpsLock()
-DEFAULT_IMPL(-1)
-
LocationError LocApiBase::
setXtraVersionCheckSync(uint32_t /*check*/)
DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
diff --git a/core/LocApiBase.h b/core/LocApiBase.h
index a96c019..8c516fd 100644
--- a/core/LocApiBase.h
+++ b/core/LocApiBase.h
@@ -121,6 +121,7 @@ protected:
inline virtual ~LocApiBase() { close(); }
bool isInSession();
const LOC_API_ADAPTER_EVENT_MASK_T mExcludedMask;
+ bool isMaster();
public:
inline void sendMsg(const LocMsg* msg) const {
@@ -247,12 +248,6 @@ public:
void updateEvtMask();
virtual LocationError setGpsLockSync(GnssConfigGpsLock lock);
- /*
- Returns
- Current value of GPS Lock on success
- -1 on failure
- */
- virtual int getGpsLock(void);
virtual LocationError setXtraVersionCheckSync(uint32_t check);
diff --git a/etc/gps.conf b/etc/gps.conf
index 51c0b96..3f2ee2f 100644
--- a/etc/gps.conf
+++ b/etc/gps.conf
@@ -34,8 +34,8 @@ INTERMEDIATE_POS=0
# should be locked when user turns off GPS on Settings
# Set bit 0x1 if MO GPS functionalities are to be locked
# Set bit 0x2 if NI GPS functionalities are to be locked
-# default - non is locked for backward compatibility
-#GPS_LOCK = 0
+# default – both MO and NI locked for maximal privacy
+#GPS_LOCK = 3
# supl version 1.0
SUPL_VER=0x10000
diff --git a/gnss/GnssAdapter.cpp b/gnss/GnssAdapter.cpp
index 9a79c61..dbfbb74 100644
--- a/gnss/GnssAdapter.cpp
+++ b/gnss/GnssAdapter.cpp
@@ -65,7 +65,7 @@ GnssAdapter::GnssAdapter() :
LocDualContext::getLocFgContext(NULL,
NULL,
LocDualContext::mLocationHalName,
- false)),
+ false), true, nullptr),
mEngHubProxy(new EngineHubProxyBase()),
mLocPositionMode(),
mGnssSvIdUsedInPosition(),
@@ -755,6 +755,9 @@ GnssAdapter::gnssUpdateConfigCommand(GnssConfig config)
index++;
uint32_t newGpsLock = mAdapter.convertGpsLock(gnssConfigRequested.gpsLock);
ContextBase::mGps_conf.GPS_LOCK = newGpsLock;
+ if (0 == ContextBase::mGps_conf.GPS_LOCK) {
+ ContextBase::mGps_conf.GPS_LOCK = 3;
+ }
if (0 != mAdapter.getPowerVoteId()) {
gnssConfigNeedEngineUpdate.flags &= ~(GNSS_CONFIG_FLAGS_GPS_LOCK_VALID_BIT);
}
@@ -1744,7 +1747,7 @@ GnssAdapter::updateClientsEventMask()
mask |= LOC_API_ADAPTER_BIT_GNSS_SV_POLYNOMIAL_REPORT;
mask |= LOC_API_ADAPTER_BIT_PARSED_UNPROPAGATED_POSITION_REPORT;
- LOC_LOGD("%s]: Auto usecase, Enable MEAS/POLY - mask 0x%" PRIu64 "", __func__, mask);
+ LOC_LOGD("%s]: Auto usecase, Enable MEAS/POLY - mask 0x%" PRIx64 "", __func__, mask);
}
if (mAgpsCbInfo.statusV4Cb != NULL) {