FP5: gps/location: Update to LA.UM.9.14.1.r1-11900-QCM6490.QSSI14.0
Change-Id: I40672365d0e0d64a6081d427c417d9101af0748f
diff --git a/gps/android/1.0/AGnss.cpp b/gps/android/1.0/AGnss.cpp
index 79f665c..64a44a8 100644
--- a/gps/android/1.0/AGnss.cpp
+++ b/gps/android/1.0/AGnss.cpp
@@ -83,8 +83,11 @@
}
st.ipV4Addr = status.ipV4Addr;
- if (mAGnssCbIface != nullptr) {
- auto r = mAGnssCbIface->agnssStatusIpV4Cb(st);
+ mMutex.lock();
+ auto aGnssCbIface = mAGnssCbIface;
+ mMutex.unlock();
+ if (aGnssCbIface != nullptr) {
+ auto r = aGnssCbIface->agnssStatusIpV4Cb(st);
if (!r.isOk()) {
LOC_LOGw("Error invoking AGNSS status cb %s", r.description().c_str());
}
@@ -101,7 +104,9 @@
}
// Save the interface
+ mMutex.lock();
mAGnssCbIface = callback;
+ mMutex.unlock();
AgpsCbInfo cbInfo = {};
cbInfo.statusV4Cb = (void*)agnssStatusIpV4Cb;
diff --git a/gps/android/1.0/AGnss.h b/gps/android/1.0/AGnss.h
index cdd5931..1d4c58b 100644
--- a/gps/android/1.0/AGnss.h
+++ b/gps/android/1.0/AGnss.h
@@ -21,6 +21,7 @@
#ifndef ANDROID_HARDWARE_GNSS_V1_0_AGNSS_H
#define ANDROID_HARDWARE_GNSS_V1_0_AGNSS_H
+#include <mutex>
#include <android/hardware/gnss/1.0/IAGnss.h>
#include <hidl/Status.h>
#include <gps_extended_c.h>
@@ -67,6 +68,7 @@
private:
Gnss* mGnss = nullptr;
+ std::mutex mMutex;
sp<IAGnssCallback> mAGnssCbIface = nullptr;
};
diff --git a/gps/android/1.0/AGnssRil.cpp b/gps/android/1.0/AGnssRil.cpp
index d7f30eb..e2d5948 100644
--- a/gps/android/1.0/AGnssRil.cpp
+++ b/gps/android/1.0/AGnssRil.cpp
@@ -29,7 +29,7 @@
#include <string>
#include "Gnss.h"
#include "AGnssRil.h"
-#include <DataItemConcreteTypesBase.h>
+#include <DataItemConcreteTypes.h>
typedef void* (getLocationInterface)();
@@ -58,29 +58,29 @@
// for XTRA
if (nullptr != mGnss && ( nullptr != mGnss->getGnssInterface() )) {
- int8_t typeout = loc_core::NetworkInfoDataItemBase::TYPE_UNKNOWN;
+ int8_t typeout = loc_core::TYPE_UNKNOWN;
switch(type)
{
case IAGnssRil::NetworkType::MOBILE:
- typeout = loc_core::NetworkInfoDataItemBase::TYPE_MOBILE;
+ typeout = loc_core::TYPE_MOBILE;
break;
case IAGnssRil::NetworkType::WIFI:
- typeout = loc_core::NetworkInfoDataItemBase::TYPE_WIFI;
+ typeout = loc_core::TYPE_WIFI;
break;
case IAGnssRil::NetworkType::MMS:
- typeout = loc_core::NetworkInfoDataItemBase::TYPE_MMS;
+ typeout = loc_core::TYPE_MMS;
break;
case IAGnssRil::NetworkType::SUPL:
- typeout = loc_core::NetworkInfoDataItemBase::TYPE_SUPL;
+ typeout = loc_core::TYPE_SUPL;
break;
case IAGnssRil::NetworkType::DUN:
- typeout = loc_core::NetworkInfoDataItemBase::TYPE_DUN;
+ typeout = loc_core::TYPE_DUN;
break;
case IAGnssRil::NetworkType::HIPRI:
- typeout = loc_core::NetworkInfoDataItemBase::TYPE_HIPRI;
+ typeout = loc_core::TYPE_HIPRI;
break;
case IAGnssRil::NetworkType::WIMAX:
- typeout = loc_core::NetworkInfoDataItemBase::TYPE_WIMAX;
+ typeout = loc_core::TYPE_WIMAX;
break;
default:
{
@@ -89,16 +89,16 @@
switch(networkType)
{
case NetworkType_BLUETOOTH:
- typeout = loc_core::NetworkInfoDataItemBase::TYPE_BLUETOOTH;
+ typeout = loc_core::TYPE_BLUETOOTH;
break;
case NetworkType_ETHERNET:
- typeout = loc_core::NetworkInfoDataItemBase::TYPE_ETHERNET;
+ typeout = loc_core::TYPE_ETHERNET;
break;
case NetworkType_PROXY:
- typeout = loc_core::NetworkInfoDataItemBase::TYPE_PROXY;
+ typeout = loc_core::TYPE_PROXY;
break;
default:
- typeout = loc_core::NetworkInfoDataItemBase::TYPE_UNKNOWN;
+ typeout = loc_core::TYPE_UNKNOWN;
}
}
break;
diff --git a/gps/android/1.0/Android.mk b/gps/android/1.0/Android.mk
index f63a948..0c60fd4 100644
--- a/gps/android/1.0/Android.mk
+++ b/gps/android/1.0/Android.mk
@@ -3,8 +3,6 @@
include $(CLEAR_VARS)
LOCAL_MODULE := android.hardware.gnss@1.0-impl-qti
-# activate the following line for debug purposes only, comment out for production
-#LOCAL_SANITIZE_DIAG += $(GNSS_SANITIZE_DIAG)
LOCAL_VENDOR_MODULE := true
LOCAL_MODULE_RELATIVE_PATH := hw
LOCAL_SRC_FILES := \
@@ -59,8 +57,6 @@
include $(CLEAR_VARS)
LOCAL_MODULE := android.hardware.gnss@1.0-service-qti
-# activate the following line for debug purposes only, comment out for production
-#LOCAL_SANITIZE_DIAG += $(GNSS_SANITIZE_DIAG)
LOCAL_VINTF_FRAGMENTS := android.hardware.gnss@1.0-service-qti.xml
LOCAL_VENDOR_MODULE := true
LOCAL_MODULE_RELATIVE_PATH := hw
diff --git a/gps/android/1.0/GnssMeasurement.cpp b/gps/android/1.0/GnssMeasurement.cpp
index 7af9e27..e24e1d2 100644
--- a/gps/android/1.0/GnssMeasurement.cpp
+++ b/gps/android/1.0/GnssMeasurement.cpp
@@ -18,11 +18,15 @@
* limitations under the License.
*/
+/* Changes from Qualcomm Innovation Center are provided under the following license:
+ * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
+ * SPDX-License-Identifier: BSD-3-Clause-Clear
+ */
+
#define LOG_TAG "LocSvc_GnssMeasurementInterface"
#include <log_util.h>
-#include <MeasurementAPIClient.h>
-#include "GnssMeasurement.h"
+#include <GnssMeasurement.h>
namespace android {
namespace hardware {
@@ -52,44 +56,47 @@
}
// Methods from ::android::hardware::gnss::V1_0::IGnssMeasurement follow.
-
-Return<IGnssMeasurement::GnssMeasurementStatus> GnssMeasurement::setCallback(
+Return<GnssMeasurement::GnssMeasurementStatus> GnssMeasurement::setCallback(
const sp<V1_0::IGnssMeasurementCallback>& callback) {
+ return setCallback(callback, mGnssMeasurementCbIface, GNSS_POWER_MODE_INVALID);
+}
- Return<IGnssMeasurement::GnssMeasurementStatus> ret =
- IGnssMeasurement::GnssMeasurementStatus::ERROR_GENERIC;
- if (mGnssMeasurementCbIface != nullptr) {
- LOC_LOGE("%s]: GnssMeasurementCallback is already set", __FUNCTION__);
- return IGnssMeasurement::GnssMeasurementStatus::ERROR_ALREADY_INIT;
- }
-
- if (callback == nullptr) {
- LOC_LOGE("%s]: callback is nullptr", __FUNCTION__);
- return ret;
- }
+template <typename T>
+Return<IGnssMeasurement::GnssMeasurementStatus> GnssMeasurement::setCallback(
+ const sp<T>& callback, sp<T>& myCallback, GnssPowerMode powerMode) {
+ Return<GnssMeasurement::GnssMeasurementStatus> ret =
+ IGnssMeasurement::GnssMeasurementStatus::ERROR_GENERIC;
if (mApi == nullptr) {
LOC_LOGE("%s]: mApi is nullptr", __FUNCTION__);
return ret;
}
+ if (myCallback != callback) {
+ if (nullptr == callback) {
+ LOC_LOGE("%s]: callback is nullptr", __FUNCTION__);
+ mApi->measurementSetCallback(callback);
+ close();
+ } else {
+ if (nullptr != myCallback) {
+ myCallback->unlinkToDeath(mGnssMeasurementDeathRecipient);
+ }
+ myCallback = callback;
+ myCallback->linkToDeath(mGnssMeasurementDeathRecipient, 0);
+ ret = mApi->measurementSetCallback(callback, powerMode);
+ }
+ }
- mGnssMeasurementCbIface = callback;
- mGnssMeasurementCbIface->linkToDeath(mGnssMeasurementDeathRecipient, 0);
-
- return mApi->measurementSetCallback(callback);
-
+ return ret;
}
Return<void> GnssMeasurement::close() {
- if (mApi == nullptr) {
- LOC_LOGE("%s]: mApi is nullptr", __FUNCTION__);
- return Void();
+ if (mApi != nullptr) {
+ mApi->measurementSetCallback<V1_0::IGnssMeasurementCallback>(nullptr);
}
if (mGnssMeasurementCbIface != nullptr) {
mGnssMeasurementCbIface->unlinkToDeath(mGnssMeasurementDeathRecipient);
mGnssMeasurementCbIface = nullptr;
}
- mApi->measurementClose();
return Void();
}
diff --git a/gps/android/1.0/GnssMeasurement.h b/gps/android/1.0/GnssMeasurement.h
index 4247dbf..245c697 100644
--- a/gps/android/1.0/GnssMeasurement.h
+++ b/gps/android/1.0/GnssMeasurement.h
@@ -18,12 +18,18 @@
* limitations under the License.
*/
+/* Changes from Qualcomm Innovation Center are provided under the following license:
+ * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
+ * SPDX-License-Identifier: BSD-3-Clause-Clear
+ */
+
#ifndef ANDROID_HARDWARE_GNSS_V1_0_GNSSMEASUREMENT_H
#define ANDROID_HARDWARE_GNSS_V1_0_GNSSMEASUREMENT_H
#include <android/hardware/gnss/1.0/IGnssMeasurement.h>
#include <hidl/MQDescriptor.h>
#include <hidl/Status.h>
+#include "MeasurementAPIClient.h"
namespace android {
namespace hardware {
@@ -62,7 +68,9 @@
sp<GnssMeasurement> mGnssMeasurement;
};
- private:
+ template <typename T>
+ Return<IGnssMeasurement::GnssMeasurementStatus> setCallback(
+ const sp<T>& callback, sp<T>& myCallback, GnssPowerMode powerMode);
sp<GnssMeasurementDeathRecipient> mGnssMeasurementDeathRecipient = nullptr;
sp<V1_0::IGnssMeasurementCallback> mGnssMeasurementCbIface = nullptr;
MeasurementAPIClient* mApi;
diff --git a/gps/android/1.0/location_api/MeasurementAPIClient.cpp b/gps/android/1.0/location_api/MeasurementAPIClient.cpp
index 9b23308..41ba582 100644
--- a/gps/android/1.0/location_api/MeasurementAPIClient.cpp
+++ b/gps/android/1.0/location_api/MeasurementAPIClient.cpp
@@ -63,19 +63,6 @@
LOC_LOGD("%s]: ()", __FUNCTION__);
}
-// for GpsInterface
-Return<IGnssMeasurement::GnssMeasurementStatus>
-MeasurementAPIClient::measurementSetCallback(const sp<V1_0::IGnssMeasurementCallback>& callback)
-{
- LOC_LOGD("%s]: (%p)", __FUNCTION__, &callback);
-
- mMutex.lock();
- mGnssMeasurementCbIface = callback;
- mMutex.unlock();
-
- return startTracking();
-}
-
Return<IGnssMeasurement::GnssMeasurementStatus>
MeasurementAPIClient::startTracking()
{
@@ -83,16 +70,6 @@
memset(&locationCallbacks, 0, sizeof(LocationCallbacks));
locationCallbacks.size = sizeof(LocationCallbacks);
- locationCallbacks.trackingCb = nullptr;
- locationCallbacks.batchingCb = nullptr;
- locationCallbacks.geofenceBreachCb = nullptr;
- locationCallbacks.geofenceStatusCb = nullptr;
- locationCallbacks.gnssLocationInfoCb = nullptr;
- locationCallbacks.gnssNiCb = nullptr;
- locationCallbacks.gnssSvCb = nullptr;
- locationCallbacks.gnssNmeaCb = nullptr;
-
- locationCallbacks.gnssMeasurementsCb = nullptr;
if (mGnssMeasurementCbIface != nullptr) {
locationCallbacks.gnssMeasurementsCb =
[this](GnssMeasurementsNotification gnssMeasurementsNotification) {
@@ -109,7 +86,7 @@
options.mode = GNSS_SUPL_MODE_STANDALONE;
mTracking = true;
- LOC_LOGD("%s]: start tracking session", __FUNCTION__);
+ LOC_LOGd();
locAPIStartTracking(options);
return IGnssMeasurement::GnssMeasurementStatus::SUCCESS;
}
diff --git a/gps/android/1.0/location_api/MeasurementAPIClient.h b/gps/android/1.0/location_api/MeasurementAPIClient.h
index 225deac..1c86882 100644
--- a/gps/android/1.0/location_api/MeasurementAPIClient.h
+++ b/gps/android/1.0/location_api/MeasurementAPIClient.h
@@ -53,8 +53,15 @@
MeasurementAPIClient& operator=(const MeasurementAPIClient&) = delete;
// for GpsMeasurementInterface
- Return<V1_0::IGnssMeasurement::GnssMeasurementStatus> measurementSetCallback(
- const sp<V1_0::IGnssMeasurementCallback>& callback);
+ template <typename T>
+ Return<IGnssMeasurement::GnssMeasurementStatus> measurementSetCallback(
+ const sp<T>& callback, GnssPowerMode powerMode = GNSS_POWER_MODE_INVALID) {
+ mMutex.lock();
+ setCallbackLocked(callback);
+ mMutex.unlock();
+
+ return startTracking();
+ }
void measurementClose();
Return<IGnssMeasurement::GnssMeasurementStatus> startTracking();
@@ -62,6 +69,9 @@
void onGnssMeasurementsCb(GnssMeasurementsNotification gnssMeasurementsNotification) final;
private:
+ inline void setCallbackLocked(const sp<V1_0::IGnssMeasurementCallback>& callback) {
+ mGnssMeasurementCbIface = callback;
+ }
virtual ~MeasurementAPIClient();
std::mutex mMutex;