summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2021-08-27 00:02:09 -0700
committerLinux Build Service Account <lnxbuild@localhost>2021-08-27 00:02:09 -0700
commitd2b836dabe785059e614d492463a1c3d801565e5 (patch)
tree222eb775a6f165430969eb5d0eee7230f3f4d44f
parent7195c406547cbc34f9b28ff95e0cc325e1f5646a (diff)
parent01269f41e61e3f1b5322e930aca65aa152358ba8 (diff)
Merge 01269f41e61e3f1b5322e930aca65aa152358ba8 on remote branch
Change-Id: I9993d7430269f6998e866fddfbed5e81a8b77d39
-rw-r--r--android/2.1/AGnss.cpp21
-rw-r--r--android/2.1/AGnss.h2
-rw-r--r--gnss/Agps.cpp2
-rw-r--r--gnss/Agps.h2
-rw-r--r--gnss/GnssAdapter.cpp9
-rw-r--r--gnss/location_gnss.cpp2
-rw-r--r--gps_vendor_product.mk4
7 files changed, 27 insertions, 15 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;
}
diff --git a/android/2.1/AGnss.h b/android/2.1/AGnss.h
index f6ea997..cf9c8a7 100644
--- a/android/2.1/AGnss.h
+++ b/android/2.1/AGnss.h
@@ -67,6 +67,8 @@ struct AGnss : public V2_0::IAGnss {
private:
Gnss* mGnss = nullptr;
sp<V2_0::IAGnssCallback> mAGnssCbIface = nullptr;
+
+ AGpsExtType mType;
};
} // namespace implementation
diff --git a/gnss/Agps.cpp b/gnss/Agps.cpp
index 9255f88..4344a6f 100644
--- a/gnss/Agps.cpp
+++ b/gnss/Agps.cpp
@@ -448,7 +448,7 @@ void AgpsStateMachine::setAPN(char* apn, unsigned int len){
mAPN = NULL;
}
- if (NULL == apn || len <= 0 || len > MAX_APN_LEN || strlen(apn) != len) {
+ if (NULL == apn || len > MAX_APN_LEN || strlen(apn) != len) {
LOC_LOGD("Invalid apn len (%d) or null apn", len);
mAPN = NULL;
mAPNLen = 0;
diff --git a/gnss/Agps.h b/gnss/Agps.h
index 6b43bf5..8a27cd9 100644
--- a/gnss/Agps.h
+++ b/gnss/Agps.h
@@ -167,7 +167,7 @@ public:
/* Getter/Setter methods */
void setAPN(char* apn, unsigned int len);
- inline char* getAPN() const { return (char*)mAPN; }
+ inline char* getAPN() const { return mAPN; }
inline uint32_t getAPNLen() const { return mAPNLen; }
inline void setBearer(AGpsBearerType bearer) { mBearer = bearer; }
inline LocApnTypeMask getApnTypeMask() const { return mApnTypeMask; }
diff --git a/gnss/GnssAdapter.cpp b/gnss/GnssAdapter.cpp
index 6312f9b..1938782 100644
--- a/gnss/GnssAdapter.cpp
+++ b/gnss/GnssAdapter.cpp
@@ -1,4 +1,4 @@
-/* Copyright (c) 2017-2020 The Linux Foundation. All rights reserved.
+/* Copyright (c) 2017-2021 The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -5256,8 +5256,7 @@ void GnssAdapter::dataConnOpenCommand(
};
// Added inital length checks for apnlen check to avoid security issues
// In case of failure reporting the same
- if (NULL == apnName || apnLen <= 0 || apnLen > MAX_APN_LEN ||
- (strlen(apnName) != (unsigned)apnLen)) {
+ if (NULL == apnName || apnLen > MAX_APN_LEN || (strlen(apnName) != apnLen)) {
LOC_LOGe("%s]: incorrect apnlen length or incorrect apnName", __func__);
mAgpsManager.reportAtlClosed(agpsType);
} else {
@@ -6731,7 +6730,9 @@ GnssAdapter::reportGnssAntennaInformation(const antennaInfoCb antennaInfoCallbac
}
gnssAntennaInformations.push_back(std::move(gnssAntennaInfo));
}
- antennaInfoCallback(gnssAntennaInformations);
+ if (antennaInfoVectorSize > 0) {
+ antennaInfoCallback(gnssAntennaInformations);
+ }
}
/* ==== DGnss Usable Reporter ========================================================= */
diff --git a/gnss/location_gnss.cpp b/gnss/location_gnss.cpp
index 0454a13..8f67369 100644
--- a/gnss/location_gnss.cpp
+++ b/gnss/location_gnss.cpp
@@ -519,7 +519,7 @@ static uint32_t antennaInfoInit(const antennaInfoCb antennaInfoCallback) {
static void antennaInfoClose() {
if (NULL != gGnssAdapter) {
return gGnssAdapter->antennaInfoCloseCommand();
- }
+ }
}
static uint32_t configRobustLocation(bool enable, bool enableForE911){
diff --git a/gps_vendor_product.mk b/gps_vendor_product.mk
index 0e578e8..cd35684 100644
--- a/gps_vendor_product.mk
+++ b/gps_vendor_product.mk
@@ -27,6 +27,10 @@ ifneq (,$(filter $(LOC_BOARD_PLATFORM_LIST),$(TARGET_BOARD_PLATFORM)))
PRODUCT_PACKAGES += gps.conf
PRODUCT_PACKAGES += flp.conf
PRODUCT_PACKAGES += gnss_antenna_info.conf
+PRODUCT_PACKAGES += gnss@2.0-base.policy
+PRODUCT_PACKAGES += gnss@2.0-xtra-daemon.policy
+PRODUCT_PACKAGES += gnss@2.0-xtwifi-client.policy
+PRODUCT_PACKAGES += gnss@2.0-xtwifi-inet-agent.policy
PRODUCT_PACKAGES += libloc_pla_headers
PRODUCT_PACKAGES += liblocation_api_headers
PRODUCT_PACKAGES += libgps.utils_headers