summaryrefslogtreecommitdiff
path: root/android/2.1/AGnss.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'android/2.1/AGnss.cpp')
-rw-r--r--android/2.1/AGnss.cpp21
1 files changed, 13 insertions, 8 deletions
diff --git a/android/2.1/AGnss.cpp b/android/2.1/AGnss.cpp
index c759492..ce7b3aa 100644
--- a/android/2.1/AGnss.cpp
+++ b/android/2.1/AGnss.cpp
@@ -32,7 +32,7 @@ namespace implementation {
static AGnss* spAGnss = nullptr;
-AGnss::AGnss(Gnss* gnss) : mGnss(gnss) {
+AGnss::AGnss(Gnss* gnss) : mGnss(gnss), mType(LOC_AGPS_TYPE_INVALID) {
spAGnss = this;
}
@@ -51,6 +51,9 @@ void AGnss::statusCb(AGpsExtType type, LocAGpsStatusValue status) {
V2_0::IAGnssCallback::AGnssType aType;
IAGnssCallback::AGnssStatusValue aStatus;
+ // cache the AGps Type
+ mType = type;
+
switch (type) {
case LOC_AGPS_TYPE_SUPL:
aType = IAGnssCallback::AGnssType::SUPL;
@@ -138,18 +141,20 @@ Return<bool> AGnss::dataConnFailed() {
Return<bool> AGnss::dataConnOpen(uint64_t /*networkHandle*/, const hidl_string& apn,
V2_0::IAGnss::ApnIpType apnIpType) {
- if(mGnss == nullptr || mGnss->getGnssInterface() == nullptr){
+ if (mGnss == nullptr || mGnss->getGnssInterface() == nullptr){
LOC_LOGE("Null GNSS interface");
return false;
}
- /* Validate */
- if(apn.empty()){
- LOC_LOGE("Invalid APN");
- return false;
+ std::string apnString(apn.c_str());
+ // During Emergency SUPL, an apn name of "sos" means that no
+ // apn was found, like in the simless case, so apn is cleared
+ if (LOC_AGPS_TYPE_SUPL_ES == mType && "sos" == apnString) {
+ LOC_LOGD("dataConnOpen APN name = [sos] cleared");
+ apnString.clear();
}
- LOC_LOGD("dataConnOpen APN name = [%s]", apn.c_str());
+ LOC_LOGD("dataConnOpen APN name = [%s]", apnString.c_str());
AGpsBearerType bearerType;
switch (apnIpType) {
@@ -168,7 +173,7 @@ Return<bool> AGnss::dataConnOpen(uint64_t /*networkHandle*/, const hidl_string&
}
mGnss->getGnssInterface()->agpsDataConnOpen(
- LOC_AGPS_TYPE_SUPL, apn.c_str(), apn.size(), (int)bearerType);
+ LOC_AGPS_TYPE_SUPL, apnString.c_str(), apnString.size(), (int)bearerType);
return true;
}