diff options
author | ChengYou Ho <chengyouho@google.com> | 2019-10-22 09:08:26 -0700 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2019-10-22 09:08:26 -0700 |
commit | 2dcbb1efacb66e4ac019458a44640505b7b9b9c4 (patch) | |
tree | fdb69be10f885dbc28179682b55e7ea64a247459 /gnss | |
parent | 24eecb4e8eb4566f09551dcbd6f314bdcb158595 (diff) | |
parent | d4d1b630d1a60719098a6a798ecf5adb5e6329f9 (diff) | |
download | gps-2dcbb1efacb66e4ac019458a44640505b7b9b9c4.tar.gz |
Merge remote-tracking branch 'goog/qcom/release/LA.UM.8.1.R1.10.00.00.529.095' into qt-qpr1-dev am: b23301cfa5r_aml_301500702platform-tools-31.0.2platform-tools-31.0.1platform-tools-31.0.0platform-tools-30.0.5android-s-preview-1android-mainline-12.0.0_r55android-mainline-12.0.0_r112android-mainline-11.0.0_r9android-mainline-11.0.0_r8android-mainline-11.0.0_r7android-mainline-11.0.0_r6android-mainline-11.0.0_r5android-mainline-11.0.0_r45android-mainline-11.0.0_r44android-mainline-11.0.0_r43android-mainline-11.0.0_r42android-mainline-11.0.0_r41android-mainline-11.0.0_r40android-mainline-11.0.0_r4android-mainline-11.0.0_r39android-mainline-11.0.0_r38android-mainline-11.0.0_r37android-mainline-11.0.0_r36android-mainline-11.0.0_r35android-mainline-11.0.0_r34android-mainline-11.0.0_r33android-mainline-11.0.0_r32android-mainline-11.0.0_r31android-mainline-11.0.0_r30android-mainline-11.0.0_r3android-mainline-11.0.0_r29android-mainline-11.0.0_r28android-mainline-11.0.0_r27android-mainline-11.0.0_r26android-mainline-11.0.0_r25android-mainline-11.0.0_r24android-mainline-11.0.0_r23android-mainline-11.0.0_r22android-mainline-11.0.0_r21android-mainline-11.0.0_r20android-mainline-11.0.0_r2android-mainline-11.0.0_r19android-mainline-11.0.0_r18android-mainline-11.0.0_r17android-mainline-11.0.0_r16android-mainline-11.0.0_r15android-mainline-11.0.0_r14android-mainline-11.0.0_r13android-mainline-11.0.0_r12android-mainline-11.0.0_r10android-mainline-11.0.0_r1android-11.0.0_r9android-11.0.0_r8android-11.0.0_r7android-11.0.0_r48android-11.0.0_r47android-11.0.0_r46android-11.0.0_r45android-11.0.0_r44android-11.0.0_r43android-11.0.0_r42android-11.0.0_r41android-11.0.0_r40android-11.0.0_r39android-11.0.0_r38android-11.0.0_r37android-11.0.0_r36android-11.0.0_r35android-11.0.0_r34android-11.0.0_r33android-11.0.0_r32android-11.0.0_r31android-11.0.0_r30android-11.0.0_r29android-11.0.0_r28android-11.0.0_r27android-11.0.0_r26android-11.0.0_r24android-11.0.0_r23android-11.0.0_r22android-11.0.0_r21android-11.0.0_r20android-11.0.0_r19android-11.0.0_r18android-11.0.0_r16android-11.0.0_r15android-11.0.0_r14android-11.0.0_r13android-11.0.0_r12android-11.0.0_r11android-11.0.0_r10aml_tz2_305400500aml_tz2_305400300aml_tz2_305400100aml_tz2_304500300aml_tz2_303900110aml_tz2_303900102aml_tz2_303800002aml_tz2_303800001aml_tz2_303200001android12-mainline-tzdata2-releaseandroid11-qpr3-s1-releaseandroid11-qpr3-releaseandroid11-qpr2-releaseandroid11-qpr1-s2-releaseandroid11-qpr1-s1-releaseandroid11-qpr1-releaseandroid11-qpr1-d-s1-releaseandroid11-qpr1-d-releaseandroid11-qpr1-c-releaseandroid11-mainline-tethering-releaseandroid11-mainline-sparse-2021-jan-releaseandroid11-mainline-sparse-2020-dec-releaseandroid11-mainline-releaseandroid11-mainline-permission-releaseandroid11-mainline-os-statsd-releaseandroid11-mainline-networkstack-releaseandroid11-mainline-media-swcodec-releaseandroid11-mainline-media-releaseandroid11-mainline-extservices-releaseandroid11-mainline-documentsui-releaseandroid11-mainline-conscrypt-releaseandroid11-mainline-cellbroadcast-releaseandroid11-mainline-captiveportallogin-releaseandroid11-devandroid11-d2-releaseandroid11-d1-s7-releaseandroid11-d1-s6-releaseandroid11-d1-s5-releaseandroid11-d1-s1-releaseandroid11-d1-releaseandroid11-d1-b-releaseaml_tz2_305400100
am: d4d1b630d1
Change-Id: Ie515da7ba8355e467b0eb6aa14351ac02892403c
Diffstat (limited to 'gnss')
-rw-r--r-- | gnss/Agps.cpp | 16 | ||||
-rw-r--r-- | gnss/Agps.h | 15 | ||||
-rw-r--r-- | gnss/GnssAdapter.cpp | 171 | ||||
-rw-r--r-- | gnss/GnssAdapter.h | 7 |
4 files changed, 147 insertions, 62 deletions
diff --git a/gnss/Agps.cpp b/gnss/Agps.cpp index 7931d0c..9255f88 100644 --- a/gnss/Agps.cpp +++ b/gnss/Agps.cpp @@ -304,7 +304,7 @@ void AgpsStateMachine::requestOrReleaseDataConn(bool request){ nifRequest.status = LOC_GPS_RELEASE_AGPS_DATA_CONN; } - mAgpsManager->mFrameworkStatusV4Cb(nifRequest); + mFrameworkStatusV4Cb(nifRequest); } void AgpsStateMachine::notifyAllSubscribers( @@ -511,7 +511,7 @@ void AgpsStateMachine::dropAllSubscribers(){ /* CREATE AGPS STATE MACHINES * Must be invoked in Msg Handler context */ -void AgpsManager::createAgpsStateMachines() { +void AgpsManager::createAgpsStateMachines(const AgpsCbInfo& cbInfo) { LOC_LOGD("AgpsManager::createAgpsStateMachines"); @@ -519,13 +519,16 @@ void AgpsManager::createAgpsStateMachines() { ((loc_core::ContextBase::mGps_conf.CAPABILITIES & LOC_GPS_CAPABILITY_MSA) || (loc_core::ContextBase::mGps_conf.CAPABILITIES & LOC_GPS_CAPABILITY_MSB)); - if (NULL == mInternetNif) { + if (NULL == mInternetNif && (cbInfo.atlType & AGPS_ATL_TYPE_WWAN)) { mInternetNif = new AgpsStateMachine(this, LOC_AGPS_TYPE_WWAN_ANY); + mInternetNif->registerFrameworkStatusCallback((AgnssStatusIpV4Cb)cbInfo.statusV4Cb); LOC_LOGD("Internet NIF: %p", mInternetNif); } if (agpsCapable) { - if (NULL == mAgnssNif) { + if (NULL == mAgnssNif && (cbInfo.atlType & AGPS_ATL_TYPE_SUPL) && + (cbInfo.atlType & AGPS_ATL_TYPE_SUPL_ES)) { mAgnssNif = new AgpsStateMachine(this, LOC_AGPS_TYPE_SUPL); + mAgnssNif->registerFrameworkStatusCallback((AgnssStatusIpV4Cb)cbInfo.statusV4Cb); LOC_LOGD("AGNSS NIF: %p", mAgnssNif); } } @@ -544,6 +547,11 @@ AgpsStateMachine* AgpsManager::getAgpsStateMachine(AGpsExtType agpsType) { LOC_LOGE("NULL AGNSS NIF !"); } return mAgnssNif; + case LOC_AGPS_TYPE_WWAN_ANY: + if (mInternetNif == NULL) { + LOC_LOGE("NULL Internet NIF !"); + } + return mInternetNif; default: return mInternetNif; } diff --git a/gnss/Agps.h b/gnss/Agps.h index 829cbd5..d559377 100644 --- a/gnss/Agps.h +++ b/gnss/Agps.h @@ -137,6 +137,7 @@ protected: /* Current state for this state machine */ AgpsState mState; + AgnssStatusIpV4Cb mFrameworkStatusV4Cb; private: /* AGPS Type for this state machine LOC_AGPS_TYPE_ANY 0 @@ -154,6 +155,7 @@ private: public: /* CONSTRUCTOR */ AgpsStateMachine(AgpsManager* agpsManager, AGpsExtType agpsType): + mFrameworkStatusV4Cb(NULL), mAgpsManager(agpsManager), mSubscriberList(), mCurrentSubscriber(NULL), mState(AGPS_STATE_RELEASED), mAgpsType(agpsType), mAPN(NULL), mAPNLen(0), @@ -175,6 +177,10 @@ public: inline void setCurrentSubscriber(AgpsSubscriber* subscriber) { mCurrentSubscriber = subscriber; } + inline void registerFrameworkStatusCallback(AgnssStatusIpV4Cb frameworkStatusV4Cb) { + mFrameworkStatusV4Cb = frameworkStatusV4Cb; + } + /* Fetch subscriber with specified handle */ AgpsSubscriber* getSubscriber(int connHandle); @@ -234,7 +240,6 @@ class AgpsManager { public: /* CONSTRUCTOR */ AgpsManager(): - mFrameworkStatusV4Cb(NULL), mAtlOpenStatusCb(), mAtlCloseStatusCb(), mAgnssNif(NULL), mInternetNif(NULL)/*, mDsNif(NULL)*/ {} @@ -246,12 +251,11 @@ public: mAtlCloseStatusCb = atlCloseStatusCb; } - inline void registerFrameworkStatusCallback(AgnssStatusIpV4Cb frameworkStatusV4Cb) { - mFrameworkStatusV4Cb = frameworkStatusV4Cb; - } + /* Check if AGPS client is registered */ + inline bool isRegistered() { return nullptr != mAgnssNif || nullptr != mInternetNif; } /* Create all AGPS state machines */ - void createAgpsStateMachines(); + void createAgpsStateMachines(const AgpsCbInfo& cbInfo); /* Process incoming ATL requests */ void requestATL(int connHandle, AGpsExtType agpsType, LocApnTypeMask apnTypeMask); @@ -266,7 +270,6 @@ public: void handleModemSSR(); protected: - AgnssStatusIpV4Cb mFrameworkStatusV4Cb; AgpsAtlOpenStatusCb mAtlOpenStatusCb; AgpsAtlCloseStatusCb mAtlCloseStatusCb; diff --git a/gnss/GnssAdapter.cpp b/gnss/GnssAdapter.cpp index f3b459c..ad86606 100644 --- a/gnss/GnssAdapter.cpp +++ b/gnss/GnssAdapter.cpp @@ -80,7 +80,6 @@ GnssAdapter::GnssAdapter() : mGnssSvTypeConfigCb(nullptr), mNiData(), mAgpsManager(), - mAgpsCbInfo(), mOdcpiRequestCb(nullptr), mOdcpiRequestActive(false), mOdcpiTimer(this), @@ -485,6 +484,16 @@ GnssAdapter::convertLocationInfo(GnssLocationInfoNotification& out, out.flags |= GNSS_LOCATION_INFO_CALIBRATION_STATUS_BIT; out.calibrationStatus = locationExtended.calibrationStatus; } + + if (GPS_LOCATION_EXTENDED_HAS_OUTPUT_ENG_TYPE & locationExtended.flags) { + out.flags |= GNSS_LOCATION_INFO_OUTPUT_ENG_TYPE_BIT; + out.locOutputEngType = locationExtended.locOutputEngType; + } + + if (GPS_LOCATION_EXTENDED_HAS_OUTPUT_ENG_MASK & locationExtended.flags) { + out.flags |= GNSS_LOCATION_INFO_OUTPUT_ENG_MASK_BIT; + out.locOutputEngMask = locationExtended.locOutputEngMask; + } } @@ -722,8 +731,6 @@ GnssAdapter::setConfig() //cache the injected configuration with GnssConfigRequested struct GnssConfig gnssConfigRequested = {}; gnssConfigRequested.flags |= GNSS_CONFIG_FLAGS_GPS_LOCK_VALID_BIT | - GNSS_CONFIG_FLAGS_LPPE_CONTROL_PLANE_VALID_BIT | - GNSS_CONFIG_FLAGS_LPPE_USER_PLANE_VALID_BIT | GNSS_CONFIG_FLAGS_BLACKLISTED_SV_IDS_BIT; /* Here we process an SSR. We need to set the GPS_LOCK to the proper values, as follows: 1. Q behavior. This is identified by mSupportNfwControl being 1. In this case @@ -756,10 +763,17 @@ GnssAdapter::setConfig() gnssConfigRequested.aGlonassPositionProtocolMask = gpsConf.A_GLONASS_POS_PROTOCOL_SELECT; } - gnssConfigRequested.lppeControlPlaneMask = - mLocApi->convertLppeCp(gpsConf.LPPE_CP_TECHNOLOGY); - gnssConfigRequested.lppeUserPlaneMask = - mLocApi->convertLppeUp(gpsConf.LPPE_UP_TECHNOLOGY); + if (gpsConf.LPPE_CP_TECHNOLOGY) { + gnssConfigRequested.flags |= GNSS_CONFIG_FLAGS_LPPE_CONTROL_PLANE_VALID_BIT; + gnssConfigRequested.lppeControlPlaneMask = + mLocApi->convertLppeCp(gpsConf.LPPE_CP_TECHNOLOGY); + } + + if (gpsConf.LPPE_UP_TECHNOLOGY) { + gnssConfigRequested.flags |= GNSS_CONFIG_FLAGS_LPPE_USER_PLANE_VALID_BIT; + gnssConfigRequested.lppeUserPlaneMask = + mLocApi->convertLppeUp(gpsConf.LPPE_UP_TECHNOLOGY); + } gnssConfigRequested.blacklistedSvIds.assign(mBlacklistedSvIds.begin(), mBlacklistedSvIds.end()); mLocApi->sendMsg(new LocApiMsg( @@ -2079,10 +2093,9 @@ GnssAdapter::updateClientsEventMask() mask); } - if (mAgpsCbInfo.statusV4Cb != NULL) { + if (mAgpsManager.isRegistered()) { mask |= LOC_API_ADAPTER_BIT_LOCATION_SERVER_REQUEST; } - // Add ODCPI handling if (nullptr != mOdcpiRequestCb) { mask |= LOC_API_ADAPTER_BIT_REQUEST_WIFI; @@ -3052,32 +3065,23 @@ GnssAdapter::reportPositionEvent(const UlpLocation& ulpLocation, const GpsLocationExtended& locationExtended, enum loc_sess_status status, LocPosTechMask techMask, - bool fromEngineHub, GnssDataNotification* pDataNotify, int msInWeek) { - // if this event is called from QMI LOC API, then send report to engine hub + // this position is from QMI LOC API, then send report to engine hub // if sending is successful, we return as we will wait for final report from engine hub // if the position is called from engine hub, then send it out directly - if (!fromEngineHub) { - // report QMI position (both propagated and unpropagated) to engine hub, - // and engine hub will be distributing it to the registered plugins - mEngHubProxy->gnssReportPosition(ulpLocation, locationExtended, status); - if (true == ulpLocation.unpropagatedPosition) { - return; - } + if (true == initEngHubProxy()){ + mEngHubProxy->gnssReportPosition(ulpLocation, locationExtended, status); + return; + } - // engine hub is loaded, do not report qmi position to client as - // final position report should come from engine hub - if (true == initEngHubProxy()){ - return; - } + if (true == ulpLocation.unpropagatedPosition) { + return; } - // for all other cases: - // case 1: fix is from engine hub, queue the msg - // case 2: fix is not from engine hub, e.g. from QMI, and it is not an + // Fix is from QMI, and it is not an // unpropagated position and engine hub is not loaded, queue the msg // when message is queued, the position can be dispatched to requesting client struct MsgReportPosition : public LocMsg { @@ -3134,6 +3138,35 @@ GnssAdapter::reportPositionEvent(const UlpLocation& ulpLocation, pDataNotify, msInWeek)); } +void +GnssAdapter::reportEnginePositionsEvent(unsigned int count, + EngineLocationInfo* locationArr) +{ + struct MsgReportEnginePositions : public LocMsg { + GnssAdapter& mAdapter; + unsigned int mCount; + EngineLocationInfo mEngLocInfo[LOC_OUTPUT_ENGINE_COUNT]; + inline MsgReportEnginePositions(GnssAdapter& adapter, + unsigned int count, + EngineLocationInfo* locationArr) : + LocMsg(), + mAdapter(adapter), + mCount(count) { + if (mCount > LOC_OUTPUT_ENGINE_COUNT) { + mCount = LOC_OUTPUT_ENGINE_COUNT; + } + if (mCount > 0) { + memcpy(mEngLocInfo, locationArr, sizeof(EngineLocationInfo)*mCount); + } + } + inline virtual void proc() const { + mAdapter.reportEnginePositions(mCount, mEngLocInfo); + } + }; + + sendMsg(new MsgReportEnginePositions(*this, count, locationArr)); +} + bool GnssAdapter::needReportForGnssClient(const UlpLocation& ulpLocation, enum loc_sess_status status, @@ -3188,9 +3221,20 @@ GnssAdapter::reportPosition(const UlpLocation& ulpLocation, for (auto it=mClientData.begin(); it != mClientData.end(); ++it) { if ((reportToFlpClient && isFlpClient(it->second)) || - (reportToGnssClient && !isFlpClient(it->second))) { + (reportToGnssClient && !isFlpClient(it->second))) { if (nullptr != it->second.gnssLocationInfoCb) { it->second.gnssLocationInfoCb(locationInfo); + } else if ((nullptr != it->second.engineLocationsInfoCb) && + (false == initEngHubProxy())) { + // if engine hub is disabled, this is SPE fix from modem + // we need to mark one copy marked as fused and one copy marked as PPE + // and dispatch it to the engineLocationsInfoCb + GnssLocationInfoNotification engLocationsInfo[2]; + engLocationsInfo[0] = locationInfo; + engLocationsInfo[0].locOutputEngType = LOC_OUTPUT_ENGINE_FUSED; + engLocationsInfo[0].flags |= GNSS_LOCATION_INFO_OUTPUT_ENG_TYPE_BIT; + engLocationsInfo[1] = locationInfo; + it->second.engineLocationsInfoCb(2, engLocationsInfo); } else if (nullptr != it->second.trackingCb) { it->second.trackingCb(locationInfo.location); } @@ -3239,6 +3283,48 @@ GnssAdapter::reportPosition(const UlpLocation& ulpLocation, } void +GnssAdapter::reportEnginePositions(unsigned int count, + const EngineLocationInfo* locationArr) +{ + bool needReportEnginePositions = false; + for (auto it=mClientData.begin(); it != mClientData.end(); ++it) { + if (nullptr != it->second.engineLocationsInfoCb) { + needReportEnginePositions = true; + break; + } + } + + GnssLocationInfoNotification locationInfo[LOC_OUTPUT_ENGINE_COUNT] = {}; + for (unsigned int i = 0; i < count; i++) { + const EngineLocationInfo* engLocation = (locationArr+i); + // if it is fused/default location, call reportPosition maintain legacy behavior + if ((GPS_LOCATION_EXTENDED_HAS_OUTPUT_ENG_TYPE & engLocation->locationExtended.flags) && + (LOC_OUTPUT_ENGINE_FUSED == engLocation->locationExtended.locOutputEngType)) { + reportPosition(engLocation->location, + engLocation->locationExtended, + engLocation->sessionStatus, + engLocation->location.tech_mask); + } + + if (needReportEnginePositions) { + convertLocationInfo(locationInfo[i], engLocation->locationExtended); + convertLocation(locationInfo[i].location, + engLocation->location, + engLocation->locationExtended, + engLocation->location.tech_mask); + } + } + + if (needReportEnginePositions) { + for (auto it=mClientData.begin(); it != mClientData.end(); ++it) { + if (nullptr != it->second.engineLocationsInfoCb) { + it->second.engineLocationsInfoCb(count, locationInfo); + } + } + } +} + +void GnssAdapter::reportSvEvent(const GnssSvNotification& svNotify, bool fromEngineHub) { @@ -4112,27 +4198,17 @@ void GnssAdapter::initDefaultAgpsCommand() { /* INIT LOC AGPS MANAGER */ void GnssAdapter::initAgps(const AgpsCbInfo& cbInfo) { - LOC_LOGD("%s]: mAgpsCbInfo.cbPriority - %d; cbInfo.cbPriority - %d", - __func__, mAgpsCbInfo.cbPriority, cbInfo.cbPriority) + LOC_LOGD("%s]:cbInfo.atlType - %d", __func__, cbInfo.atlType); if (!((ContextBase::mGps_conf.CAPABILITIES & LOC_GPS_CAPABILITY_MSB) || (ContextBase::mGps_conf.CAPABILITIES & LOC_GPS_CAPABILITY_MSA))) { return; } - if (mAgpsCbInfo.cbPriority > cbInfo.cbPriority) { - return; - } else { - mAgpsCbInfo = cbInfo; - - mAgpsManager.registerFrameworkStatusCallback((AgnssStatusIpV4Cb)cbInfo.statusV4Cb); - - mAgpsManager.createAgpsStateMachines(); - - /* Register for AGPS event mask */ - updateEvtMask(LOC_API_ADAPTER_BIT_LOCATION_SERVER_REQUEST, - LOC_REGISTRATION_MASK_ENABLED); - } + mAgpsManager.createAgpsStateMachines(cbInfo); + /* Register for AGPS event mask */ + updateEvtMask(LOC_API_ADAPTER_BIT_LOCATION_SERVER_REQUEST, + LOC_REGISTRATION_MASK_ENABLED); } void GnssAdapter::initAgpsCommand(const AgpsCbInfo& cbInfo){ @@ -4921,15 +4997,10 @@ GnssAdapter::initEngHubProxy() { // prepare the callback functions // callback function for engine hub to report back position event - GnssAdapterReportPositionEventCb reportPositionEventCb = - [this](const UlpLocation& ulpLocation, - const GpsLocationExtended& locationExtended, - enum loc_sess_status status, - LocPosTechMask techMask, - bool fromEngineHub) { + GnssAdapterReportEnginePositionsEventCb reportPositionEventCb = + [this](int count, EngineLocationInfo* locationArr) { // report from engine hub on behalf of PPE will be treated as fromUlp - reportPositionEvent(ulpLocation, locationExtended, status, - techMask, fromEngineHub); + reportEnginePositionsEvent(count, locationArr); }; // callback function for engine hub to report back sv event diff --git a/gnss/GnssAdapter.h b/gnss/GnssAdapter.h index b84c365..3ccdd96 100644 --- a/gnss/GnssAdapter.h +++ b/gnss/GnssAdapter.h @@ -163,7 +163,6 @@ class GnssAdapter : public LocAdapterBase { /* ==== AGPS =========================================================================== */ // This must be initialized via initAgps() AgpsManager mAgpsManager; - AgpsCbInfo mAgpsCbInfo; void initAgps(const AgpsCbInfo& cbInfo); /* ==== NFW =========================================================================== */ @@ -351,9 +350,11 @@ public: const GpsLocationExtended& locationExtended, enum loc_sess_status status, LocPosTechMask techMask, - bool fromEngineHub = false, GnssDataNotification* pDataNotify = nullptr, int msInWeek = -1); + virtual void reportEnginePositionsEvent(unsigned int count, + EngineLocationInfo* locationArr); + virtual void reportSvEvent(const GnssSvNotification& svNotify, bool fromEngineHub=false); virtual void reportNmeaEvent(const char* nmea, size_t length); @@ -386,6 +387,8 @@ public: const GpsLocationExtended &locationExtended, enum loc_sess_status status, LocPosTechMask techMask); + void reportEnginePositions(unsigned int count, + const EngineLocationInfo* locationArr); void reportSv(GnssSvNotification& svNotify); void reportNmea(const char* nmea, size_t length); void reportData(GnssDataNotification& dataNotify); |