summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2022-04-19 03:14:06 -0700
committerLinux Build Service Account <lnxbuild@localhost>2022-04-19 03:14:06 -0700
commit1d4b267d062fb949824bef20c01115815336a69d (patch)
tree2f8d4c9178121dcfb3d23cf92d19c276900d7ae7
parent3a8b9deb82e7068f0c21c6cde3aa1329bbf88c1b (diff)
parent7ca3a83b2d1c047326a6d5e4047a881e18aab5a0 (diff)
Merge 7ca3a83b2d1c047326a6d5e4047a881e18aab5a0 on remote branch
Change-Id: Id74c20795d48db6b4f355c04a9d2aba597c35766
-rw-r--r--android/1.0/location_api/MeasurementAPIClient.cpp41
-rw-r--r--android/1.1/location_api/MeasurementAPIClient.cpp41
-rw-r--r--android/2.0/location_api/MeasurementAPIClient.cpp41
-rw-r--r--android/2.1/location_api/MeasurementAPIClient.cpp41
-rw-r--r--android/aidl-impl/GnssMeasurementInterface.cpp41
-rw-r--r--core/LocApiBase.cpp20
-rw-r--r--gnss/GnssAdapter.cpp3
-rw-r--r--gnss/XtraSystemStatusObserver.cpp36
-rw-r--r--location/LocationAPI.cpp12
9 files changed, 265 insertions, 11 deletions
diff --git a/android/1.0/location_api/MeasurementAPIClient.cpp b/android/1.0/location_api/MeasurementAPIClient.cpp
index 9b23308..4bf455d 100644
--- a/android/1.0/location_api/MeasurementAPIClient.cpp
+++ b/android/1.0/location_api/MeasurementAPIClient.cpp
@@ -27,6 +27,41 @@
*
*/
+/*
+Changes from Qualcomm Innovation Center are provided under the following license:
+
+Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted (subject to the limitations in the
+disclaimer below) provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+
+ * Neither the name of Qualcomm Innovation Center, Inc. nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
+HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
#define LOG_NDEBUG 0
#define LOG_TAG "LocSvc_MeasurementAPIClient"
@@ -119,6 +154,12 @@ void MeasurementAPIClient::measurementClose() {
LOC_LOGD("%s]: ()", __FUNCTION__);
mTracking = false;
locAPIStopTracking();
+
+ // Clear measurement callback
+ LocationCallbacks locationCallbacks;
+ memset(&locationCallbacks, 0, sizeof(LocationCallbacks));
+ locationCallbacks.size = sizeof(LocationCallbacks);
+ locAPISetCallbacks(locationCallbacks);
}
// callbacks
diff --git a/android/1.1/location_api/MeasurementAPIClient.cpp b/android/1.1/location_api/MeasurementAPIClient.cpp
index a87ae6d..3f3bb2a 100644
--- a/android/1.1/location_api/MeasurementAPIClient.cpp
+++ b/android/1.1/location_api/MeasurementAPIClient.cpp
@@ -27,6 +27,41 @@
*
*/
+/*
+Changes from Qualcomm Innovation Center are provided under the following license:
+
+Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted (subject to the limitations in the
+disclaimer below) provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+
+ * Neither the name of Qualcomm Innovation Center, Inc. nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
+HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
#define LOG_NDEBUG 0
#define LOG_TAG "LocSvc_MeasurementAPIClient"
@@ -142,6 +177,12 @@ void MeasurementAPIClient::measurementClose() {
LOC_LOGD("%s]: ()", __FUNCTION__);
mTracking = false;
locAPIStopTracking();
+
+ // Clear measurement callback
+ LocationCallbacks locationCallbacks;
+ memset(&locationCallbacks, 0, sizeof(LocationCallbacks));
+ locationCallbacks.size = sizeof(LocationCallbacks);
+ locAPISetCallbacks(locationCallbacks);
}
// callbacks
diff --git a/android/2.0/location_api/MeasurementAPIClient.cpp b/android/2.0/location_api/MeasurementAPIClient.cpp
index 425415f..bb19269 100644
--- a/android/2.0/location_api/MeasurementAPIClient.cpp
+++ b/android/2.0/location_api/MeasurementAPIClient.cpp
@@ -27,6 +27,41 @@
*
*/
+/*
+Changes from Qualcomm Innovation Center are provided under the following license:
+
+Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted (subject to the limitations in the
+disclaimer below) provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+
+ * Neither the name of Qualcomm Innovation Center, Inc. nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
+HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
#define LOG_NDEBUG 0
#define LOG_TAG "LocSvc_MeasurementAPIClient"
@@ -178,6 +213,12 @@ void MeasurementAPIClient::measurementClose() {
LOC_LOGD("%s]: ()", __FUNCTION__);
mTracking = false;
locAPIStopTracking();
+
+ // Clear measurement callback
+ LocationCallbacks locationCallbacks;
+ memset(&locationCallbacks, 0, sizeof(LocationCallbacks));
+ locationCallbacks.size = sizeof(LocationCallbacks);
+ locAPISetCallbacks(locationCallbacks);
}
// callbacks
diff --git a/android/2.1/location_api/MeasurementAPIClient.cpp b/android/2.1/location_api/MeasurementAPIClient.cpp
index e16858d..53ab056 100644
--- a/android/2.1/location_api/MeasurementAPIClient.cpp
+++ b/android/2.1/location_api/MeasurementAPIClient.cpp
@@ -27,6 +27,41 @@
*
*/
+/*
+Changes from Qualcomm Innovation Center are provided under the following license:
+
+Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted (subject to the limitations in the
+disclaimer below) provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+
+ * Neither the name of Qualcomm Innovation Center, Inc. nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
+HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
#define LOG_NDEBUG 0
#define LOG_TAG "LocSvc_MeasurementAPIClient"
@@ -205,6 +240,12 @@ void MeasurementAPIClient::measurementClose() {
LOC_LOGD("%s]: ()", __FUNCTION__);
mTracking = false;
locAPIStopTracking();
+
+ // Clear measurement callback
+ LocationCallbacks locationCallbacks;
+ memset(&locationCallbacks, 0, sizeof(LocationCallbacks));
+ locationCallbacks.size = sizeof(LocationCallbacks);
+ locAPISetCallbacks(locationCallbacks);
}
// callbacks
diff --git a/android/aidl-impl/GnssMeasurementInterface.cpp b/android/aidl-impl/GnssMeasurementInterface.cpp
index c3379b8..9fe86a1 100644
--- a/android/aidl-impl/GnssMeasurementInterface.cpp
+++ b/android/aidl-impl/GnssMeasurementInterface.cpp
@@ -18,6 +18,41 @@
* limitations under the License.
*/
+/*
+Changes from Qualcomm Innovation Center are provided under the following license:
+
+Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted (subject to the limitations in the
+disclaimer below) provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+
+ * Neither the name of Qualcomm Innovation Center, Inc. nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
+HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
#define LOG_TAG "GnssMeasurementInterfaceAidl"
#include <log_util.h>
@@ -80,6 +115,12 @@ GnssMeasurementInterface::GnssMeasurementInterface() :
lock.unlock();
locAPIStopTracking();
+ // Clear measurement callback
+ LocationCallbacks locationCallbacks;
+ memset(&locationCallbacks, 0, sizeof(LocationCallbacks));
+ locationCallbacks.size = sizeof(LocationCallbacks);
+ locAPISetCallbacks(locationCallbacks);
+
return ndk::ScopedAStatus::ok();
}
diff --git a/core/LocApiBase.cpp b/core/LocApiBase.cpp
index 1931b7b..f21e66c 100644
--- a/core/LocApiBase.cpp
+++ b/core/LocApiBase.cpp
@@ -40,6 +40,9 @@
namespace loc_core {
+#define MSEC_IN_ONE_WEEK 604800000LL
+#define REAL_TIME_ESTIMATOR_TIME_UNC_THRESHOLD_MSEC 20.0f
+
#define TO_ALL_LOCADAPTERS(call) TO_ALL_ADAPTERS(mLocAdapters, (call))
#define TO_1ST_HANDLING_LOCADAPTERS(call) TO_1ST_HANDLING_ADAPTER(mLocAdapters, (call))
@@ -1041,6 +1044,8 @@ void ElapsedRealtimeEstimator::saveGpsTimeAndQtimerPairInPvtReport(
// Use GPS timestamp and qtimer tick for 1Hz PVT report for association
if ((locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_GPS_TIME) &&
(locationExtended.gpsTime.gpsTimeOfWeekMs % 1000 == 0) &&
+ (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_TIME_UNC) &&
+ (locationExtended.timeUncMs < REAL_TIME_ESTIMATOR_TIME_UNC_THRESHOLD_MSEC) &&
(locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_SYSTEM_TICK) &&
(locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_SYSTEM_TICK_UNC)) {
mTimePairPVTReport.gpsTime.gpsWeek = locationExtended.gpsTime.gpsWeek;
@@ -1062,16 +1067,18 @@ void ElapsedRealtimeEstimator::saveGpsTimeAndQtimerPairInMeasReport(
// Use 1Hz measurement report timestamp and qtimer tick for association
if ((svMeasurementSet.isNhz == false) &&
(svMeasSetHeader.gpsSystemTime.validityMask & GNSS_SYSTEM_TIME_WEEK_VALID) &&
- (svMeasSetHeader.gpsSystemTime.validityMask & GNSS_SYSTEM_TIME_WEEK_MS_VALID)) {
+ (svMeasSetHeader.gpsSystemTime.validityMask & GNSS_SYSTEM_TIME_WEEK_MS_VALID) &&
+ (svMeasSetHeader.gpsSystemTime.validityMask & GNSS_SYSTEM_CLK_TIME_BIAS_UNC_VALID) &&
+ (svMeasSetHeader.gpsSystemTime.systemClkTimeUncMs <
+ REAL_TIME_ESTIMATOR_TIME_UNC_THRESHOLD_MSEC)) {
LOC_LOGv("gps time %d %d, meas unc %f, ref cnt tick %" PRIi64 ","
- "system rtc ms %" PRIi64 ", systemClkTimeUncMs %f",
+ "system rtc ms %" PRIi64 "",
svMeasurementSet.svMeasSetHeader.gpsSystemTime.systemWeek,
svMeasurementSet.svMeasSetHeader.gpsSystemTime.systemMsec,
svMeasurementSet.svMeasSetHeader.gpsSystemTime.systemClkTimeUncMs,
svMeasurementSet.svMeasSetHeader.refCountTicks,
- svMeasurementSet.svMeasSetHeader.gpsSystemTimeExt.systemRtcMs,
- svMeasurementSet.svMeasSetHeader.gpsSystemTime.systemClkTimeUncMs);
+ svMeasurementSet.svMeasSetHeader.gpsSystemTimeExt.systemRtcMs);
if ((svMeasSetHeader.flags & GNSS_SV_MEAS_HEADER_HAS_REF_COUNT_TICKS) &&
(svMeasSetHeader.flags & GNSS_SV_MEAS_HEADER_HAS_REF_COUNT_TICKS_UNC)) {
mTimePairMeasReport.gpsTime.gpsWeek = svMeasSetHeader.gpsSystemTime.systemWeek;
@@ -1079,14 +1086,9 @@ void ElapsedRealtimeEstimator::saveGpsTimeAndQtimerPairInMeasReport(
mTimePairMeasReport.qtimerTick = svMeasurementSet.svMeasSetHeader.refCountTicks;
mTimePairMeasReport.timeUncMsec = svMeasurementSet.svMeasSetHeader.refCountTicksUnc;
}
-
- LOC_LOGv("gps time (%d, %d), qtimer tick %" PRIi64 ", unc %f",
- mTimePairMeasReport.gpsTime.gpsWeek, mTimePairMeasReport.gpsTime.gpsTimeOfWeekMs,
- mTimePairMeasReport.qtimerTick, mTimePairMeasReport.timeUncMsec);
}
}
-#define MSEC_IN_ONE_WEEK 604800000LL
bool ElapsedRealtimeEstimator::getElapsedRealtimeForGpsTime(
const GPSTimeStruct& gpsTimeAtOrigin, int64_t &bootTimeNsAtOrigin, float & bootTimeUnc) {
struct timespec curBootTime = {};
diff --git a/gnss/GnssAdapter.cpp b/gnss/GnssAdapter.cpp
index d07f5d9..a39d0b3 100644
--- a/gnss/GnssAdapter.cpp
+++ b/gnss/GnssAdapter.cpp
@@ -5356,8 +5356,7 @@ GnssAdapter::invokeGnssEnergyConsumedCallback(uint64_t energyConsumedSinceFirstB
mBootReferenceEnergy,
gnssPowerStatistics.totalEnergyMilliJoule);
- gnssPowerStatistics.elapsedRealTime =
- mPowerElapsedRealTimeCal.getElapsedRealtimeEstimateNanos(0, 0, 0);
+ gnssPowerStatistics.elapsedRealTime = elapsedRealtime();
gnssPowerStatistics.elapsedRealTimeUnc =
mPowerElapsedRealTimeCal.getElapsedRealtimeUncNanos();
mPowerIndicationCb(gnssPowerStatistics);
diff --git a/gnss/XtraSystemStatusObserver.cpp b/gnss/XtraSystemStatusObserver.cpp
index 78fa231..19676cf 100644
--- a/gnss/XtraSystemStatusObserver.cpp
+++ b/gnss/XtraSystemStatusObserver.cpp
@@ -26,6 +26,42 @@
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
+
+/*
+Changes from Qualcomm Innovation Center are provided under the following license:
+
+Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted (subject to the limitations in the
+disclaimer below) provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+
+ * Neither the name of Qualcomm Innovation Center, Inc. nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
+HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
#define LOG_TAG "LocSvc_XtraSystemStatusObs"
#include <sys/stat.h>
diff --git a/location/LocationAPI.cpp b/location/LocationAPI.cpp
index ca51182..95c4c31 100644
--- a/location/LocationAPI.cpp
+++ b/location/LocationAPI.cpp
@@ -360,12 +360,20 @@ LocationAPI::updateCallbacks(LocationCallbacks& locationCallbacks)
pthread_mutex_lock(&gDataMutex);
+ LocationCallbacks currentCallbacks = {};
+ auto it = gData.clientData.find(this);
+ if (it != gData.clientData.end()) {
+ currentCallbacks = gData.clientData[this];
+ }
+
if (isGnssClient(locationCallbacks)) {
loadLibGnss();
if (NULL != gData.gnssInterface) {
// either adds new Client or updates existing Client
gData.gnssInterface->addClient(this, locationCallbacks);
}
+ } else if (NULL != gData.gnssInterface && isGnssClient(currentCallbacks)) {
+ gData.gnssInterface->removeClient(this, nullptr);
}
if (isBatchingClient(locationCallbacks)) {
@@ -374,6 +382,8 @@ LocationAPI::updateCallbacks(LocationCallbacks& locationCallbacks)
// either adds new Client or updates existing Client
gData.batchingInterface->addClient(this, locationCallbacks);
}
+ } else if (NULL != gData.batchingInterface && isBatchingClient(currentCallbacks)) {
+ gData.batchingInterface->removeClient(this, nullptr);
}
if (isGeofenceClient(locationCallbacks)) {
@@ -382,6 +392,8 @@ LocationAPI::updateCallbacks(LocationCallbacks& locationCallbacks)
// either adds new Client or updates existing Client
gData.geofenceInterface->addClient(this, locationCallbacks);
}
+ } else if (NULL != gData.geofenceInterface && isGeofenceClient(currentCallbacks)) {
+ gData.geofenceInterface->removeClient(this, nullptr);
}
gData.clientData[this] = locationCallbacks;