msm8974-common: gps: Assure event mask is set properly to get positions
The event mask can be retrieved in the context of client thread as zero and then queued up to go to msg task thread. By the time the msg is actually handled in msg task thread, the actual event mask at LOC API layer may have already changed, but this mask would then be overridden by zero. This can cause no modem events to ever come, including position reports. The fix is to not retrieve the event mask in the client thread, but instead wait for msg to be handled in msg task thread before retrieving it. Change-Id: I48562d028bbfa187732686c060b5cdd62c6d5a89 CRs-fixed: 2219519
This commit is contained in:
parent
23fc0afe5a
commit
e2e1b9d26a
@ -30,6 +30,7 @@
|
||||
#define LOG_TAG "LocSvc_LocApiBase"
|
||||
|
||||
#include <dlfcn.h>
|
||||
#include <inttypes.h>
|
||||
#include <LocApiBase.h>
|
||||
#include <LocAdapterBase.h>
|
||||
#include <log_util.h>
|
||||
@ -106,19 +107,16 @@ struct LocSsrMsg : public LocMsg {
|
||||
|
||||
struct LocOpenMsg : public LocMsg {
|
||||
LocApiBase* mLocApi;
|
||||
LOC_API_ADAPTER_EVENT_MASK_T mMask;
|
||||
inline LocOpenMsg(LocApiBase* locApi,
|
||||
LOC_API_ADAPTER_EVENT_MASK_T mask) :
|
||||
LocMsg(), mLocApi(locApi), mMask(mask)
|
||||
inline LocOpenMsg(LocApiBase* locApi) :
|
||||
LocMsg(), mLocApi(locApi)
|
||||
{
|
||||
locallog();
|
||||
}
|
||||
inline virtual void proc() const {
|
||||
mLocApi->open(mMask);
|
||||
mLocApi->open(mLocApi->getEvtMask());
|
||||
}
|
||||
inline void locallog() {
|
||||
LOC_LOGV("%s:%d]: LocOpen Mask: %x\n",
|
||||
__func__, __LINE__, mMask);
|
||||
LOC_LOGV("LocOpen Mask: %" PRIx32 "\n", mLocApi->getEvtMask());
|
||||
}
|
||||
inline virtual void log() {
|
||||
locallog();
|
||||
@ -161,8 +159,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,
|
||||
mMask | adapter->getEvtMask()));
|
||||
mMsgTask->sendMsg(new LocOpenMsg(this));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -198,7 +195,7 @@ void LocApiBase::removeAdapter(LocAdapterBase* adapter)
|
||||
close();
|
||||
} else {
|
||||
// else we need to remove the bit
|
||||
mMsgTask->sendMsg(new LocOpenMsg(this, getEvtMask()));
|
||||
mMsgTask->sendMsg(new LocOpenMsg(this));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -206,7 +203,7 @@ void LocApiBase::removeAdapter(LocAdapterBase* adapter)
|
||||
|
||||
void LocApiBase::updateEvtMask()
|
||||
{
|
||||
mMsgTask->sendMsg(new LocOpenMsg(this, getEvtMask()));
|
||||
mMsgTask->sendMsg(new LocOpenMsg(this));
|
||||
}
|
||||
|
||||
void LocApiBase::handleEngineUpEvent()
|
||||
|
Loading…
Reference in New Issue
Block a user