Ignore the first time inject if it is form Afw.
The first time injection is ignored from an adapter that doesn't support CPI Extended Capabilities to prevent time from being injected twice on startup. CRs-fixed: 720540 Change-Id: If786cf2c750906093f21272aae928e4d9fc4dea8
This commit is contained in:
parent
19e8bc2155
commit
fab550522a
3 changed files with 26 additions and 6 deletions
|
@ -70,7 +70,9 @@ LocEngAdapter::LocEngAdapter(LOC_API_ADAPTER_EVENT_MASK_T mask,
|
|||
mOwner(owner), mInternalAdapter(new LocInternalAdapter(this)),
|
||||
mUlp(new UlpProxyBase()), mNavigating(false),
|
||||
mSupportsAgpsRequests(false),
|
||||
mSupportsPositionInjection(false), mPowerVote(0)
|
||||
mSupportsPositionInjection(false),
|
||||
mSupportsTimeInjection(false),
|
||||
mPowerVote(0)
|
||||
{
|
||||
memset(&mFixCriteria, 0, sizeof(mFixCriteria));
|
||||
mFixCriteria.mode = LOC_POSITION_MODE_INVALID;
|
||||
|
@ -341,6 +343,24 @@ void LocEngAdapter::handleEngineUpEvent()
|
|||
sendMsg(new LocEngUp(mOwner));
|
||||
}
|
||||
|
||||
enum loc_api_adapter_err LocEngAdapter::setTime(GpsUtcTime time,
|
||||
int64_t timeReference,
|
||||
int uncertainty)
|
||||
{
|
||||
loc_api_adapter_err result = LOC_API_ADAPTER_ERR_SUCCESS;
|
||||
|
||||
LOC_LOGD("%s:%d]: mSupportsTimeInjection is %d",
|
||||
__func__, __LINE__, mSupportsTimeInjection);
|
||||
|
||||
if (mSupportsTimeInjection) {
|
||||
LOC_LOGD("%s:%d]: Injecting time", __func__, __LINE__);
|
||||
result = mLocApi->setTime(time, timeReference, uncertainty);
|
||||
} else {
|
||||
mSupportsTimeInjection = true;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
enum loc_api_adapter_err LocEngAdapter::setXtraVersionCheck(int check)
|
||||
{
|
||||
enum loc_api_adapter_err ret;
|
||||
|
|
|
@ -85,6 +85,7 @@ class LocEngAdapter : public LocAdapterBase {
|
|||
public:
|
||||
bool mSupportsAgpsRequests;
|
||||
bool mSupportsPositionInjection;
|
||||
bool mSupportsTimeInjection;
|
||||
|
||||
LocEngAdapter(LOC_API_ADAPTER_EVENT_MASK_T mask,
|
||||
void* owner, ContextBase* context,
|
||||
|
@ -136,11 +137,6 @@ public:
|
|||
{
|
||||
return mLocApi->injectPosition(latitude, longitude, accuracy);
|
||||
}
|
||||
inline enum loc_api_adapter_err
|
||||
setTime(GpsUtcTime time, int64_t timeReference, int uncertainty)
|
||||
{
|
||||
return mLocApi->setTime(time, timeReference, uncertainty);
|
||||
}
|
||||
inline enum loc_api_adapter_err
|
||||
setXtraData(char* data, int length)
|
||||
{
|
||||
|
@ -256,6 +252,9 @@ public:
|
|||
{
|
||||
return mLocApi->getBestAvailableZppFix(zppLoc, tech_mask);
|
||||
}
|
||||
enum loc_api_adapter_err setTime(GpsUtcTime time,
|
||||
int64_t timeReference,
|
||||
int uncertainty);
|
||||
enum loc_api_adapter_err setXtraVersionCheck(int check);
|
||||
virtual void handleEngineDownEvent();
|
||||
virtual void handleEngineUpEvent();
|
||||
|
|
|
@ -289,6 +289,7 @@ static int loc_init(GpsCallbacks* callbacks)
|
|||
loc_afw_data.adapter->requestUlp(gps_conf.CAPABILITIES);
|
||||
loc_afw_data.adapter->mSupportsAgpsRequests = !loc_afw_data.adapter->hasAgpsExtendedCapabilities();
|
||||
loc_afw_data.adapter->mSupportsPositionInjection = !loc_afw_data.adapter->hasCPIExtendedCapabilities();
|
||||
loc_afw_data.adapter->mSupportsTimeInjection = !loc_afw_data.adapter->hasCPIExtendedCapabilities();
|
||||
|
||||
if(retVal) {
|
||||
LOC_LOGE("loc_eng_init() fail!");
|
||||
|
|
Loading…
Reference in a new issue