Merge "Ignore the first time inject if it is form Afw."

This commit is contained in:
Linux Build Service Account 2014-09-20 17:17:07 -07:00 committed by Gerrit - the friendly Code Review server
commit f5f74198b5
3 changed files with 26 additions and 6 deletions

View file

@ -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;

View file

@ -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);
inline virtual void installAGpsCert(const DerEncodedCertificate* pData,
size_t length,

View file

@ -326,6 +326,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!");