summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYingjie Wang <yingjiewang@codeaurora.org>2021-03-10 17:23:09 +0800
committeryingjiew <yingjiewang@codeaurora.org>2021-09-22 08:26:42 +0800
commit1d283c5863e4396e1aff94694c2d149336f48213 (patch)
treeb39bdcca286037f6d902713e089479c3abd11bb1
parentf0a78e2698fc4b7a4074bc19d8c8b6bcee48173f (diff)
downloadgps-1d283c5863e4396e1aff94694c2d149336f48213.tar.gz
Use QMI WDS API to query pdn for SUPL ATL
The IP type that from AFW is not the one corrsponding to apn, so use QMI WDS API to retrieve from modem profile by instead. Change-Id: I6bafa4cd0f6f106cb00b527bdd3e143b4eead523 CRs-fixed: 2897360
-rw-r--r--gnss/GnssAdapter.cpp69
-rw-r--r--gnss/GnssAdapter.h3
2 files changed, 62 insertions, 10 deletions
diff --git a/gnss/GnssAdapter.cpp b/gnss/GnssAdapter.cpp
index 29fbe95..f3ccd99 100644
--- a/gnss/GnssAdapter.cpp
+++ b/gnss/GnssAdapter.cpp
@@ -77,6 +77,8 @@ static void agpsCloseResultCb (bool isSuccess, AGpsExtType agpsType, void* userD
typedef const CdfwInterface* (*getCdfwInterface)();
+typedef void getPdnTypeFromWds(const std::string& apnName, std::function<void(int)> pdnCb);
+
inline bool GnssReportLoggerUtil::isLogEnabled() {
return (mLogLatency != nullptr);
}
@@ -5220,6 +5222,38 @@ bool GnssAdapter::releaseATL(int connHandle){
return true;
}
+void GnssAdapter::reportPdnTypeFromWds(int pdnType, AGpsExtType agpsType, std::string apnName,
+ AGpsBearerType bearerType) {
+ LOC_LOGd("pdnType from WDS QMI: %d, agpsType: %d, apnName: %s, bearerType: %d",
+ pdnType, agpsType, apnName.c_str(), bearerType);
+
+ struct MsgReportAtlPdn : public LocMsg {
+ GnssAdapter& mAdapter;
+ int mPdnType;
+ AgpsManager* mAgpsManager;
+ AGpsExtType mAgpsType;
+ string mApnName;
+ AGpsBearerType mBearerType;
+
+ inline MsgReportAtlPdn(GnssAdapter& adapter, int pdnType,
+ AgpsManager* agpsManager, AGpsExtType agpsType,
+ const string& apnName, AGpsBearerType bearerType) :
+ LocMsg(), mAgpsManager(agpsManager), mAgpsType(agpsType),
+ mApnName(apnName), mBearerType(bearerType),
+ mAdapter(adapter), mPdnType(pdnType) {}
+ inline virtual void proc() const {
+ mAgpsManager->reportAtlOpenSuccess(mAgpsType,
+ const_cast<char*>(mApnName.c_str()),
+ mApnName.length(), mPdnType<=0? mBearerType:mPdnType);
+ }
+ };
+
+ AGpsBearerType atlPdnType = (pdnType+1) & 3; // convert WDS QMI pdn type to AgpsBearerType
+ sendMsg(new MsgReportAtlPdn(*this, atlPdnType, &mAgpsManager,
+ agpsType, apnName, bearerType));
+}
+
+
void GnssAdapter::dataConnOpenCommand(
AGpsExtType agpsType,
const char* apnName, int apnLen, AGpsBearerType bearerType){
@@ -5227,17 +5261,16 @@ void GnssAdapter::dataConnOpenCommand(
LOC_LOGI("GnssAdapter::frameworkDataConnOpen");
struct AgpsMsgAtlOpenSuccess: public LocMsg {
-
+ GnssAdapter& mAdapter;
AgpsManager* mAgpsManager;
AGpsExtType mAgpsType;
char* mApnName;
- int mApnLen;
AGpsBearerType mBearerType;
- inline AgpsMsgAtlOpenSuccess(AgpsManager* agpsManager, AGpsExtType agpsType,
- const char* apnName, int apnLen, AGpsBearerType bearerType) :
+ inline AgpsMsgAtlOpenSuccess(GnssAdapter& adapter, AgpsManager* agpsManager,
+ AGpsExtType agpsType, const char* apnName, int apnLen, AGpsBearerType bearerType) :
LocMsg(), mAgpsManager(agpsManager), mAgpsType(agpsType), mApnName(
- new char[apnLen + 1]), mApnLen(apnLen), mBearerType(bearerType) {
+ new char[apnLen + 1]), mBearerType(bearerType), mAdapter(adapter) {
LOC_LOGV("AgpsMsgAtlOpenSuccess");
if (mApnName == nullptr) {
@@ -5255,9 +5288,27 @@ void GnssAdapter::dataConnOpenCommand(
}
inline virtual void proc() const {
-
- LOC_LOGV("AgpsMsgAtlOpenSuccess::proc()");
- mAgpsManager->reportAtlOpenSuccess(mAgpsType, mApnName, mApnLen, mBearerType);
+ LOC_LOGv("AgpsMsgAtlOpenSuccess::proc()");
+ string apn(mApnName);
+ //Use QMI WDS API to query IP Protocol from modem profile
+ void* libHandle = nullptr;
+ getPdnTypeFromWds* getPdnTypeFunc = (getPdnTypeFromWds*)dlGetSymFromLib(libHandle,
+ #ifdef USE_GLIB
+ "libloc_api_wds.so", "_Z10getPdnTypeRKNSt7__cxx1112basic_string"\
+ "IcSt11char_traitsIcESaIcEEESt8functionIFviEE");
+ #else
+ "libloc_api_wds.so", "_Z10getPdnTypeRKNSt3__112basic_stringIcNS_11char_traits"\
+ "IcEENS_9allocatorIcEEEENS_8functionIFviEEE");
+ #endif
+
+ std::function<void(int)> wdsPdnTypeCb = std::bind(&GnssAdapter::reportPdnTypeFromWds,
+ &mAdapter, std::placeholders::_1, mAgpsType, apn, mBearerType);
+ if (getPdnTypeFunc != nullptr) {
+ LOC_LOGv("dlGetSymFromLib success");
+ (*getPdnTypeFunc)(apn, wdsPdnTypeCb);
+ } else {
+ mAgpsManager->reportAtlOpenSuccess(mAgpsType, mApnName, apn.length(), mBearerType);
+ }
}
};
// Added inital length checks for apnlen check to avoid security issues
@@ -5266,7 +5317,7 @@ void GnssAdapter::dataConnOpenCommand(
LOC_LOGe("%s]: incorrect apnlen length or incorrect apnName", __func__);
mAgpsManager.reportAtlClosed(agpsType);
} else {
- sendMsg( new AgpsMsgAtlOpenSuccess(
+ sendMsg( new AgpsMsgAtlOpenSuccess(*this,
&mAgpsManager, agpsType, apnName, apnLen, bearerType));
}
}
diff --git a/gnss/GnssAdapter.h b/gnss/GnssAdapter.h
index 2cd4a5c..d7b4275 100644
--- a/gnss/GnssAdapter.h
+++ b/gnss/GnssAdapter.h
@@ -321,7 +321,6 @@ protected:
void logLatencyInfo();
public:
-
GnssAdapter();
virtual inline ~GnssAdapter() { }
@@ -527,6 +526,8 @@ public:
(
const std::unordered_map<LocationQwesFeatureType, bool> &featureMap
);
+ void reportPdnTypeFromWds(int pdnType, AGpsExtType agpsType, std::string apnName,
+ AGpsBearerType bearerType);
/* ======== UTILITIES ================================================================= */
bool needReportForGnssClient(const UlpLocation& ulpLocation,