Эх сурвалжийг харах

sm8450-common: gps: Update to LA.VENDOR.1.0.r1-21900-WAIPIO.0

Change-Id: Ib431364a902ecd9b068e672978f5e24ecbf42160
Arian 1 жил өмнө
parent
commit
f518e7ef8f

+ 23 - 0
gps/Android.bp

@@ -10,6 +10,29 @@ GNSS_CFLAGS = [
     "-Wno-undefined-bool-conversion",
 ]
 
+soong_config_module_type {
+    name: "qtilocation_cc_defaults",
+    module_type: "cc_defaults",
+    config_namespace: "qtilocation",
+    bool_variables: [
+        "feature_nhz",
+    ],
+    properties: [
+        "cflags",
+    ],
+}
+
+qtilocation_cc_defaults {
+    name: "qtilocation_common_defaults",
+    cflags: GNSS_CFLAGS,
+    soong_config_variables: {
+        feature_nhz: {
+            cflags: ["-DFEATURE_NHZ_ENABLED"],
+        },
+    },
+}
+
+
 /* Activate the following for debug purposes only,
    comment out for production */
 GNSS_SANITIZE_DIAG = {

+ 4 - 0
gps/Android.mk

@@ -28,6 +28,10 @@ ifneq (,$(filter $(GNSS_HIDL_LEGACY_MEASURMENTS_TARGET_LIST),$(TARGET_BOARD_PLAT
 GNSS_HIDL_LEGACY_MEASURMENTS := true
 endif
 
+# Enable NHz location feature. Default is false.
+# Set this flag to true to enable the NHz location feature.
+FEATURE_NHZ_ENABLED := false
+
 LOCAL_PATH := $(call my-dir)
 include $(call all-makefiles-under,$(LOCAL_PATH))
 

+ 41 - 0
gps/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

+ 41 - 0
gps/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

+ 41 - 0
gps/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

+ 41 - 0
gps/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

+ 41 - 0
gps/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();
 }
 

+ 37 - 9
gps/core/ContextBase.cpp

@@ -26,6 +26,43 @@
  * 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_NDEBUG 0
 #define LOG_TAG "LocSvc_CtxBase"
 
@@ -95,7 +132,6 @@ const loc_param_s_type ContextBase::mGps_conf_table[] =
   {"NMEA_TAG_BLOCK_GROUPING_ENABLED", &mGps_conf.NMEA_TAG_BLOCK_GROUPING_ENABLED, NULL, 'n'},
   {"NI_SUPL_DENY_ON_NFW_LOCKED",  &mGps_conf.NI_SUPL_DENY_ON_NFW_LOCKED, NULL, 'n'},
   {"ENABLE_NMEA_PRINT",  &mGps_conf.ENABLE_NMEA_PRINT, NULL, 'n'},
-  {"ROBUST_LOCATION_ENABLED", &mGps_conf.ROBUST_LOCATION_ENABLED, NULL, 'n'},
 };
 
 const loc_param_s_type ContextBase::mSap_conf_table[] =
@@ -200,14 +236,6 @@ void ContextBase::readConfig()
         /* By default NMEA Printing is disabled */
         mGps_conf.ENABLE_NMEA_PRINT = 0;
 
-#ifdef USE_GLIB
-        // For LE target, disable by default
-        mGps_conf.ROBUST_LOCATION_ENABLED = 0x0;
-#else
-        // enable robust location and robust location on E911
-        mGps_conf.ROBUST_LOCATION_ENABLED = 0x11;
-#endif
-
         UTIL_READ_CONF(LOC_PATH_GPS_CONF, mGps_conf_table);
         UTIL_READ_CONF(LOC_PATH_SAP_CONF, mSap_conf_table);
 

+ 37 - 1
gps/core/ContextBase.h

@@ -26,6 +26,43 @@
  * 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.
+*/
+
 #ifndef __LOC_CONTEXT_BASE__
 #define __LOC_CONTEXT_BASE__
 
@@ -84,7 +121,6 @@ typedef struct loc_gps_cfg_s
     uint32_t       NI_SUPL_DENY_ON_NFW_LOCKED;
     uint32_t       ENABLE_NMEA_PRINT;
     uint32_t       NMEA_TAG_BLOCK_GROUPING_ENABLED;
-    uint32_t       ROBUST_LOCATION_ENABLED;
 } loc_gps_cfg_s_type;
 
 /* NOTE: the implementation of the parser casts number

+ 40 - 0
gps/core/LocAdapterBase.cpp

@@ -26,6 +26,43 @@
  * 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_NDEBUG 0
 #define LOG_TAG "LocSvc_LocAdapterBase"
 
@@ -439,4 +476,7 @@ bool LocAdapterBase::
     reportQwesCapabilities(const std::unordered_map<LocationQwesFeatureType, bool> &/*featureMap*/)
 DEFAULT_IMPL(false)
 
+void LocAdapterBase::reportEngDebugDataInfoEvent(GnssEngineDebugDataInfo& gnssEngineDebugDataInfo)
+DEFAULT_IMPL()
+
 } // namespace loc_core

+ 38 - 0
gps/core/LocAdapterBase.h

@@ -26,6 +26,43 @@
  * 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.
+*/
+
 #ifndef LOC_API_ADAPTER_BASE_H
 #define LOC_API_ADAPTER_BASE_H
 
@@ -235,6 +272,7 @@ public:
     void requestCapabilitiesCommand(LocationAPI* client);
 
     virtual void reportLatencyInfoEvent(const GnssLatencyInfo& gnssLatencyInfo);
+    virtual void reportEngDebugDataInfoEvent(GnssEngineDebugDataInfo& gnssEngineDebugDataInfo);
     virtual bool reportQwesCapabilities(
             const std::unordered_map<LocationQwesFeatureType, bool> &featureMap);
 };

+ 48 - 18
gps/core/LocApiBase.cpp

@@ -40,6 +40,10 @@
 
 namespace loc_core {
 
+#define MSEC_IN_ONE_WEEK 604800000LL
+#define REAL_TIME_ESTIMATOR_TIME_UNC_THRESHOLD_MSEC 20.0f
+#define UNKNOWN_GPS_WEEK_NUM 65535
+
 #define TO_ALL_LOCADAPTERS(call) TO_ALL_ADAPTERS(mLocAdapters, (call))
 #define TO_1ST_HANDLING_LOCADAPTERS(call) TO_1ST_HANDLING_ADAPTER(mLocAdapters, (call))
 
@@ -330,7 +334,7 @@ void LocApiBase::reportPosition(UlpLocation& location,
     LOC_LOGD("flags: %d\n  source: %d\n  latitude: %f\n  longitude: %f\n  "
              "altitude: %f\n  speed: %f\n  bearing: %f\n  accuracy: %f\n  "
              "timestamp: %" PRId64 "\n"
-             "Session status: %d\n Technology mask: %u\n "
+             "Session status: %d\n Technology mask: %u\n, time bias unc %f msec\n "
              "SV used in fix (gps/glo/bds/gal/qzss) : \
              (0x%" PRIx64 "/0x%" PRIx64 "/0x%" PRIx64 "/0x%" PRIx64 "/0x%" PRIx64 "/0x%" PRIx64 ")",
              location.gpsLocation.flags, location.position_source,
@@ -338,6 +342,7 @@ void LocApiBase::reportPosition(UlpLocation& location,
              location.gpsLocation.altitude, location.gpsLocation.speed,
              location.gpsLocation.bearing, location.gpsLocation.accuracy,
              location.gpsLocation.timestamp, status, loc_technology_mask,
+             locationExtended.gnssSystemTime.u.gpsSystemTime.systemClkTimeUncMs,
              locationExtended.gnss_sv_used_ids.gps_sv_used_ids_mask,
              locationExtended.gnss_sv_used_ids.glo_sv_used_ids_mask,
              locationExtended.gnss_sv_used_ids.bds_sv_used_ids_mask,
@@ -616,6 +621,10 @@ void LocApiBase::reportLatencyInfo(GnssLatencyInfo& gnssLatencyInfo)
     TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportLatencyInfoEvent(gnssLatencyInfo));
 }
 
+void LocApiBase::reportEngDebugDataInfo(GnssEngineDebugDataInfo& gnssEngineDebugDataInfo) {
+    TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportEngDebugDataInfoEvent(gnssEngineDebugDataInfo));
+}
+
 enum loc_api_adapter_err LocApiBase::
    open(LOC_API_ADAPTER_EVENT_MASK_T /*mask*/)
 DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
@@ -624,12 +633,6 @@ enum loc_api_adapter_err LocApiBase::
     close()
 DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
 
-void LocApiBase::startFix(const LocPosMode& /*posMode*/, LocApiResponse* /*adapterResponse*/)
-DEFAULT_IMPL()
-
-void LocApiBase::stopFix(LocApiResponse* /*adapterResponse*/)
-DEFAULT_IMPL()
-
 void LocApiBase::
     deleteAidingData(const GnssAidingData& /*data*/, LocApiResponse* /*adapterResponse*/)
 DEFAULT_IMPL()
@@ -1040,7 +1043,13 @@ void ElapsedRealtimeEstimator::saveGpsTimeAndQtimerPairInPvtReport(
 
     // Use GPS timestamp and qtimer tick for 1Hz PVT report for association
     if ((locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_GPS_TIME) &&
+            // 65535 GPS week from modem means unknown
+            (locationExtended.gpsTime.gpsWeek != UNKNOWN_GPS_WEEK_NUM) &&
             (locationExtended.gpsTime.gpsTimeOfWeekMs % 1000 == 0) &&
+            (locationExtended.gnssSystemTime.u.gpsSystemTime.validityMask &
+                    GNSS_SYSTEM_CLK_TIME_BIAS_UNC_VALID) &&
+            (locationExtended.gnssSystemTime.u.gpsSystemTime.systemClkTimeUncMs <
+                    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,13 +1071,17 @@ 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)) {
-
-        LOC_LOGv("gps time %d %d, meas unc %f, ref cnt tick %" PRIi64 ","
+            // 65535 GPS week from modem means unknown
+            (svMeasurementSet.svMeasSetHeader.gpsSystemTime.systemWeek != UNKNOWN_GPS_WEEK_NUM) &&
+            (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, ref cnt tick %" PRIi64 ","
                  "system rtc ms %" PRIi64 ", systemClkTimeUncMs %f",
                  svMeasurementSet.svMeasSetHeader.gpsSystemTime.systemWeek,
                  svMeasurementSet.svMeasSetHeader.gpsSystemTime.systemMsec,
-                 svMeasurementSet.svMeasSetHeader.gpsSystemTime.systemClkTimeUncMs,
                  svMeasurementSet.svMeasSetHeader.refCountTicks,
                  svMeasurementSet.svMeasSetHeader.gpsSystemTimeExt.systemRtcMs,
                  svMeasurementSet.svMeasSetHeader.gpsSystemTime.systemClkTimeUncMs);
@@ -1079,16 +1092,12 @@ 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) {
+        const GpsLocationExtended& locationExtended,
+        int64_t &bootTimeNsAtOrigin, float & bootTimeUnc) {
     struct timespec curBootTime = {};
     int64_t curBootTimeNs = 0;
     int64_t curQTimerNSec = 0;
@@ -1107,6 +1116,23 @@ bool ElapsedRealtimeEstimator::getElapsedRealtimeForGpsTime(
         return false;
     }
 
+
+    if (((locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_GPS_TIME) == 0) ||
+            // 65535 GPS week from modem means unknown
+            (locationExtended.gpsTime.gpsWeek == UNKNOWN_GPS_WEEK_NUM) ||
+            ((locationExtended.gnssSystemTime.u.gpsSystemTime.validityMask &
+                    GNSS_SYSTEM_CLK_TIME_BIAS_UNC_VALID) == 0) ||
+            ((locationExtended.gnssSystemTime.u.gpsSystemTime.systemClkTimeUncMs >=
+                    REAL_TIME_ESTIMATOR_TIME_UNC_THRESHOLD_MSEC))) {
+        LOC_LOGd("report has invalid gps time, or no time bias unc or large time bias unc, "
+                 "gps week %d, gps system time mask 0x%x, clk bias unc %f",
+                 locationExtended.gpsTime.gpsWeek,
+                 locationExtended.gnssSystemTime.u.gpsSystemTime.validityMask,
+                 locationExtended.gnssSystemTime.u.gpsSystemTime.systemClkTimeUncMs);
+        return false;
+    }
+
+    const GPSTimeStruct& gpsTimeAtOrigin = locationExtended.gpsTime;
     int64_t originMsec = (int64_t)gpsTimeAtOrigin.gpsWeek * (int64_t)MSEC_IN_ONE_WEEK +
                          (int64_t)gpsTimeAtOrigin.gpsTimeOfWeekMs;
     int64_t timePairMsec = (int64_t)timePair.gpsTime.gpsWeek * (int64_t)MSEC_IN_ONE_WEEK +
@@ -1131,7 +1157,11 @@ bool ElapsedRealtimeEstimator::getElapsedRealtimeForGpsTime(
              timePair.qtimerTick * 100000 / 192,
              curQTimerNSec, qtimerNsecAtOrigin, curBootTimeNs, bootTimeNsAtOrigin, bootTimeUnc);
 
-    return true;
+    if (bootTimeNsAtOrigin > 0) {
+        return true;
+    } else {
+        return false;
+    }
 }
 
 

+ 3 - 4
gps/core/LocApiBase.h

@@ -209,6 +209,7 @@ public:
     void sendNfwNotification(GnssNfwNotification& notification);
     void reportGnssConfig(uint32_t sessionId, const GnssConfig& gnssConfig);
     void reportLatencyInfo(GnssLatencyInfo& gnssLatencyInfo);
+    void reportEngDebugDataInfo(GnssEngineDebugDataInfo& gnssEngineDebugDataInfo);
     void reportQwesCapabilities
     (
         const std::unordered_map<LocationQwesFeatureType, bool> &featureMap
@@ -228,8 +229,6 @@ public:
     // downward calls
     virtual void* getSibling();
     virtual LocApiProxyBase* getLocApiProxy();
-    virtual void startFix(const LocPosMode& fixCriteria, LocApiResponse* adapterResponse);
-    virtual void stopFix(LocApiResponse* adapterResponse);
     virtual void deleteAidingData(const GnssAidingData& data, LocApiResponse* adapterResponse);
     virtual void injectPosition(double latitude, double longitude, float accuracy,
             bool onDemandCpi);
@@ -385,8 +384,8 @@ public:
     inline int64_t getElapsedRealtimeUncNanos() { return 5000000;}
     void reset();
     static int64_t getElapsedRealtimeQtimer(int64_t qtimerTicksAtOrigin);
-    bool getElapsedRealtimeForGpsTime(const GPSTimeStruct& gpsTimeAtOrigin,
-                            int64_t &elapsedTime, float & elpasedTimeUnc);
+    bool getElapsedRealtimeForGpsTime(const GpsLocationExtended& locationExtended,
+                                      int64_t &elapsedTime, float & elpasedTimeUnc);
     void saveGpsTimeAndQtimerPairInPvtReport(const GpsLocationExtended& locationExtended);
     void saveGpsTimeAndQtimerPairInMeasReport(const GnssSvMeasurementSet& svMeasurementSet);
     static bool getCurrentTime(struct timespec& currentTime, int64_t& sinceBootTimeNanos);

+ 254 - 16
gps/core/SystemStatus.cpp

@@ -26,6 +26,43 @@
  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
  */
+
+/*
+Changes from Qualcomm Innovation Center are provided under the following license:
+
+Copyright (c) 2022-2023 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_SystemStatus"
 
 #include <inttypes.h>
@@ -93,6 +130,7 @@ public:
 /******************************************************************************
  SystemStatusPQWM1
 ******************************************************************************/
+
 class SystemStatusPQWM1
 {
 public:
@@ -114,10 +152,10 @@ public:
     uint32_t mJammerBds;  // x10
     uint32_t mJammerGal;  // x11
     uint32_t mRecErrorRecovery; // x12
-    double   mAgcGps;     // x13
-    double   mAgcGlo;     // x14
-    double   mAgcBds;     // x15
-    double   mAgcGal;     // x16
+    uint32_t   mAgcGps;     // x13
+    uint32_t   mAgcGlo;     // x14
+    uint32_t   mAgcBds;     // x15
+    uint32_t   mAgcGal;     // x16
     int32_t  mLeapSeconds;// x17
     int32_t  mLeapSecUnc; // x18
     uint32_t mGloBpAmpI;  // x19
@@ -127,8 +165,39 @@ public:
     uint32_t mGalBpAmpI;  // x1D
     uint32_t mGalBpAmpQ;  // x1E
     uint64_t mTimeUncNs;  // x1F
+    uint32_t mJammedSignalsMask;
+    std::vector<GnssJammerData> mJammerData;
+    SystemStatusPQWM1(const GnssEngineDebugDataInfo& info);
+    SystemStatusPQWM1() = default;
 };
 
+SystemStatusPQWM1::SystemStatusPQWM1(const GnssEngineDebugDataInfo& info) {
+    mGpsWeek = info.gpsWeek;
+    mGpsTowMs = info.gpsTowMs;
+    mTimeValid = info.timeValid;
+    mTimeSource = info.sourceOfTime;
+    mTimeUnc = info.clkTimeUnc;
+    mClockFreqBias = info.clkFreqBias;
+    mClockFreqBiasUnc = info.clkFreqUnc;
+    mXoState = info.xoState;
+    mRecErrorRecovery = info.rcvrErrRecovery;
+    if (info.jammerData.size() > 0) {
+        mJammerGps = info.jammerData[GNSS_LOC_SIGNAL_TYPE_GPS_L1CA].jammerInd;
+        mJammerGlo = info.jammerData[GNSS_LOC_SIGNAL_TYPE_GLONASS_G1].jammerInd;
+        mJammerBds = info.jammerData[GNSS_LOC_SIGNAL_TYPE_BEIDOU_B1_I].jammerInd;
+        mJammerGal = info.jammerData[GNSS_LOC_SIGNAL_TYPE_GALILEO_E1_C].jammerInd;
+        mAgcGps = info.jammerData[GNSS_LOC_SIGNAL_TYPE_GPS_L1CA].agc;
+        mAgcGlo = info.jammerData[GNSS_LOC_SIGNAL_TYPE_GLONASS_G1].agc;
+        mAgcBds = info.jammerData[GNSS_LOC_SIGNAL_TYPE_BEIDOU_B1_I].agc;
+        mAgcGal = info.jammerData[GNSS_LOC_SIGNAL_TYPE_GALILEO_E1_C].agc;
+    }
+    mLeapSeconds = info.leapSecondInfo.leapSec;
+    mLeapSecUnc = info.leapSecondInfo.leapSecUnc;
+    mTimeUncNs = info.clkTimeUnc * 1000000LL;
+    mJammedSignalsMask = info.jammedSignalsMask;
+    mJammerData = std::move(info.jammerData);
+}
+
 // parser
 class SystemStatusPQWM1parser : public SystemStatusNmeaBase
 {
@@ -232,10 +301,11 @@ public:
         mM1.mJammerBds = atoi(mField[eJammerBds].c_str());
         mM1.mJammerGal = atoi(mField[eJammerGal].c_str());
         mM1.mRecErrorRecovery = atoi(mField[eRecErrorRecovery].c_str());
-        mM1.mAgcGps = atof(mField[eAgcGps].c_str());
-        mM1.mAgcGlo = atof(mField[eAgcGlo].c_str());
-        mM1.mAgcBds = atof(mField[eAgcBds].c_str());
-        mM1.mAgcGal = atof(mField[eAgcGal].c_str());
+        // convert agc db scale to 0.01 db
+        mM1.mAgcGps = (uint32_t)(atof(mField[eAgcGps].c_str()) * 100);
+        mM1.mAgcGlo = (uint32_t)(atof(mField[eAgcGlo].c_str()) * 100);
+        mM1.mAgcBds = (uint32_t)(atof(mField[eAgcBds].c_str()) * 100);
+        mM1.mAgcGal = (uint32_t)(atof(mField[eAgcGal].c_str()) * 100);
         if (mField.size() > eLeapSecUnc) {
             mM1.mLeapSeconds = atoi(mField[eLeapSeconds].c_str());
             mM1.mLeapSecUnc = atoi(mField[eLeapSecUnc].c_str());
@@ -269,8 +339,20 @@ public:
     float    mEpiHepe;   // x8
     float    mEpiAltUnc; // x9
     uint8_t  mEpiSrc;    // x10
+    SystemStatusPQWP1() = default;
+    SystemStatusPQWP1(const GnssEngineDebugDataInfo& info);
 };
 
+SystemStatusPQWP1::SystemStatusPQWP1(const GnssEngineDebugDataInfo& info) {
+    mEpiValidity = info.epiValidity;
+    mEpiLat = info.epiLat;
+    mEpiLon = info.epiLon;
+    mEpiAlt = info.epiAlt;
+    mEpiHepe = info.epiHepe;
+    mEpiAltUnc = info.epiAltUnc;
+    mEpiSrc = info.epiSrc;
+}
+
 class SystemStatusPQWP1parser : public SystemStatusNmeaBase
 {
 private:
@@ -328,8 +410,19 @@ public:
     float    mBestAlt;   // x6
     float    mBestHepe;  // x7
     float    mBestAltUnc; // x8
+    SystemStatusPQWP2() = default;
+    SystemStatusPQWP2(const GnssEngineDebugDataInfo& info);
 };
 
+SystemStatusPQWP2::SystemStatusPQWP2(const GnssEngineDebugDataInfo& info){
+    mBestLat = info.bestPosLat;
+    mBestLon = info.bestPosLon;
+    mBestAlt = info.bestPosAlt;
+    mBestHepe = info.bestPosHepe;
+    mBestAltUnc = info.bestPosAltUnc;
+}
+
+
 class SystemStatusPQWP2parser : public SystemStatusNmeaBase
 {
 private:
@@ -389,8 +482,26 @@ public:
     uint64_t  mGalXtraValid;
     uint8_t   mQzssXtraValid;
     uint32_t  mNavicXtraValid;
+    SystemStatusPQWP3() = default;
+    SystemStatusPQWP3(const GnssEngineDebugDataInfo& info);
 };
 
+SystemStatusPQWP3::SystemStatusPQWP3(const GnssEngineDebugDataInfo& info){
+    mXtraValidMask = info.xtraValidMask;
+    mGpsXtraAge = info.gpsXtraAge;
+    mGloXtraAge = info.gloXtraAge;
+    mBdsXtraAge = info.bdsXtraAge;
+    mGalXtraAge = info.galXtraAge;
+    mQzssXtraAge = info.qzssXtraAge;
+    mNavicXtraAge = info.navicXtraAge;
+    mGpsXtraValid = info.gpsXtraMask;
+    mGloXtraValid = info.gloXtraMask;
+    mBdsXtraValid = info.gloXtraMask;
+    mGalXtraValid = info.galXtraMask;
+    mQzssXtraValid = info.qzssXtraMask;
+    mNavicXtraValid = info.navicXtraMask;
+}
+
 class SystemStatusPQWP3parser : public SystemStatusNmeaBase
 {
 private:
@@ -464,8 +575,18 @@ public:
     uint64_t  mBdsEpheValid;
     uint64_t  mGalEpheValid;
     uint8_t   mQzssEpheValid;
+    SystemStatusPQWP4() = default;
+    SystemStatusPQWP4(const GnssEngineDebugDataInfo& info);
 };
 
+SystemStatusPQWP4::SystemStatusPQWP4(const GnssEngineDebugDataInfo& info) {
+    mGpsEpheValid = info.gpsEphMask;
+    mGloEpheValid = info.gloEphMask;
+    mBdsEpheValid = info.bdsEphMask;
+    mGalEpheValid = info.galEphMask;
+    mQzssEpheValid = info.qzssEphMask;
+}
+
 class SystemStatusPQWP4parser : public SystemStatusNmeaBase
 {
 private:
@@ -530,8 +651,32 @@ public:
     uint64_t  mGalBadMask;
     uint8_t   mQzssBadMask;
     uint32_t  mNavicBadMask;
+    SystemStatusPQWP5() = default;
+    SystemStatusPQWP5(const GnssEngineDebugDataInfo& info);
 };
 
+
+SystemStatusPQWP5::SystemStatusPQWP5(const GnssEngineDebugDataInfo& info){
+    mGpsUnknownMask = info.gpsHealthUnknownMask;
+    mGloUnknownMask = info.gloHealthUnknownMask;
+    mBdsUnknownMask = info.bdsHealthUnknownMask;
+    mGalUnknownMask = info.galHealthUnknownMask;
+    mQzssUnknownMask = info.qzssHealthUnknownMask;
+    mNavicUnknownMask = info.navicHealthUnknownMask;
+    mGpsGoodMask = info.gpsHealthGoodMask;
+    mGloGoodMask = info.gloHealthGoodMask;
+    mBdsGoodMask = info.bdsHealthGoodMask;
+    mGalGoodMask = info.galHealthGoodMask;
+    mQzssGoodMask = info.qzssHealthGoodMask;
+    mNavicGoodMask = info.navicHealthGoodMask;
+    mGpsBadMask = info.gpsHealthBadMask;
+    mGloBadMask = info.gloHealthBadMask;
+    mBdsBadMask = info.bdsHealthBadMask;
+    mGalBadMask = info.galHealthBadMask;
+    mQzssBadMask = info.qzssHealthBadMask;
+    mNavicBadMask = info.navicHealthBadMask;
+}
+
 class SystemStatusPQWP5parser : public SystemStatusNmeaBase
 {
 private:
@@ -614,6 +759,10 @@ class SystemStatusPQWP6
 {
 public:
     uint32_t  mFixInfoMask;
+    SystemStatusPQWP6() = default;
+    inline SystemStatusPQWP6(const GnssEngineDebugDataInfo& info) {
+        mFixInfoMask = info.fixInfoMask;
+    }
 };
 
 class SystemStatusPQWP6parser : public SystemStatusNmeaBase
@@ -651,8 +800,47 @@ class SystemStatusPQWP7
 {
 public:
     SystemStatusNav mNav[SV_ALL_NUM];
+    SystemStatusPQWP7() = default;
+    SystemStatusPQWP7(const GnssEngineDebugDataInfo& gnssEngineDebugDataInfo);
 };
 
+SystemStatusPQWP7::SystemStatusPQWP7(const GnssEngineDebugDataInfo& gnssEngineDebugDataInfo) {
+    memset(mNav, 0, SV_ALL_NUM_MIN * sizeof(SystemStatusNav));
+    for (int i = 0; i < GNSS_MAX_SV_INFO_LIST_SIZE; i++) {
+        GnssNavDataInfo navInfo  = gnssEngineDebugDataInfo.navData[i];
+        int offset = 0;
+        if (0 == navInfo.gnssSvId) continue;
+        // GPS
+        if (navInfo.gnssSvId >= GPS_MIN && navInfo.gnssSvId < (GPS_MIN + GPS_NUM)) {
+            offset = navInfo.gnssSvId - GPS_MIN;
+        }
+        // GLO
+        if (navInfo.gnssSvId >= GLO_MIN && navInfo.gnssSvId < (GLO_MIN + GLO_NUM)) {
+            offset = GPS_NUM + navInfo.gnssSvId - GLO_MIN;
+        }
+        // BDS
+        if (navInfo.gnssSvId >= BDS_MIN && navInfo.gnssSvId < (BDS_MIN + BDS_NUM)) {
+            offset = GPS_NUM + GLO_NUM + navInfo.gnssSvId - BDS_MIN;
+        }
+        // GAL
+        if (navInfo.gnssSvId >= GAL_MIN && navInfo.gnssSvId < (GAL_MIN + GAL_NUM)) {
+            offset = GPS_NUM + GLO_NUM + BDS_NUM + navInfo.gnssSvId - GAL_MIN;
+        }
+        // QZSS
+        if (navInfo.gnssSvId >= QZSS_MIN && navInfo.gnssSvId < (QZSS_MIN + QZSS_NUM)) {
+            offset = GPS_NUM + GLO_NUM + BDS_NUM + GAL_NUM + navInfo.gnssSvId - QZSS_MIN;
+        }
+        //Navic
+        if (navInfo.gnssSvId >= NAVIC_MIN && navInfo.gnssSvId < (NAVIC_MIN + NAVIC_NUM)) {
+            offset = GPS_NUM + GLO_NUM + BDS_NUM + GAL_NUM + QZSS_NUM +
+                navInfo.gnssSvId - NAVIC_MIN;
+        }
+        mNav[offset].mType   = GnssEphemerisType(navInfo.type);
+        mNav[offset].mSource = GnssEphemerisSource(navInfo.src);
+        mNav[offset].mAgeSec = navInfo.age;
+    }
+}
+
 class SystemStatusPQWP7parser : public SystemStatusNmeaBase
 {
 private:
@@ -698,6 +886,11 @@ class SystemStatusPQWS1
 public:
     uint32_t  mFixInfoMask;
     uint32_t  mHepeLimit;
+    SystemStatusPQWS1() = default;
+    inline SystemStatusPQWS1(const GnssEngineDebugDataInfo& info) {
+        mFixInfoMask = info.fixStatusMask;
+        mHepeLimit = info.fixHepeLimit;
+    }
 };
 
 class SystemStatusPQWS1parser : public SystemStatusNmeaBase
@@ -826,9 +1019,9 @@ SystemStatusRfAndParams::SystemStatusRfAndParams(const SystemStatusPQWM1& nmea)
     mBdsBpAmpI(nmea.mBdsBpAmpI),
     mBdsBpAmpQ(nmea.mBdsBpAmpQ),
     mGalBpAmpI(nmea.mGalBpAmpI),
-    mGalBpAmpQ(nmea.mGalBpAmpQ)
-{
-}
+    mGalBpAmpQ(nmea.mGalBpAmpQ),
+    mJammedSignalsMask(nmea.mJammedSignalsMask),
+    mJammerData(std::move(nmea.mJammerData)) {}
 
 bool SystemStatusRfAndParams::equals(const SystemStatusItemBase& peer) {
     if ((mPgaGain != ((const SystemStatusRfAndParams&)peer).mPgaGain) ||
@@ -849,7 +1042,8 @@ bool SystemStatusRfAndParams::equals(const SystemStatusItemBase& peer) {
         (mBdsBpAmpI != ((const SystemStatusRfAndParams&)peer).mBdsBpAmpI) ||
         (mBdsBpAmpQ != ((const SystemStatusRfAndParams&)peer).mBdsBpAmpQ) ||
         (mGalBpAmpI != ((const SystemStatusRfAndParams&)peer).mGalBpAmpI) ||
-        (mGalBpAmpQ != ((const SystemStatusRfAndParams&)peer).mGalBpAmpQ)) {
+        (mGalBpAmpQ != ((const SystemStatusRfAndParams&)peer).mGalBpAmpQ) ||
+        (mJammedSignalsMask != ((const SystemStatusRfAndParams&)peer).mJammedSignalsMask)) {
         return false;
     }
     return true;
@@ -859,7 +1053,7 @@ void SystemStatusRfAndParams::dump()
 {
     LOC_LOGV("RfAndParams: u=%ld:%ld p=%d bi=%d bq=%d ai=%d aq=%d "
              "jgp=%d jgl=%d jbd=%d jga=%d "
-             "agp=%lf agl=%lf abd=%lf aga=%lf",
+             "agp=%d agl=%d abd=%d aga=%d",
              mUtcTime.tv_sec, mUtcTime.tv_nsec,
              mPgaGain,
              mGpsBpAmpI,
@@ -1448,6 +1642,35 @@ bool SystemStatus::setNmeaString(const char *data, uint32_t len)
     return true;
 }
 
+
+void SystemStatus::setEngineDebugDataInfo(const GnssEngineDebugDataInfo& gnssEngineDebugDataInfo) {
+    pthread_mutex_lock(&mMutexSystemStatus);
+    LOC_LOGd("setEngine data");
+    SystemStatusPQWM1 s(gnssEngineDebugDataInfo);
+    setIteminReport(mCache.mTimeAndClock, SystemStatusTimeAndClock(s));
+    setIteminReport(mCache.mXoState, SystemStatusXoState(s));
+    setIteminReport(mCache.mRfAndParams, SystemStatusRfAndParams(s));
+    setIteminReport(mCache.mErrRecovery, SystemStatusErrRecovery(s));
+    setIteminReport(mCache.mInjectedPosition,
+            SystemStatusInjectedPosition(SystemStatusPQWP1(gnssEngineDebugDataInfo)));
+    setIteminReport(mCache.mBestPosition,
+            SystemStatusBestPosition(SystemStatusPQWP2(gnssEngineDebugDataInfo)));
+    setIteminReport(mCache.mXtra,
+            SystemStatusXtra(SystemStatusPQWP3(gnssEngineDebugDataInfo)));
+    setIteminReport(mCache.mEphemeris,
+            SystemStatusEphemeris(SystemStatusPQWP4(gnssEngineDebugDataInfo)));
+    setIteminReport(mCache.mSvHealth,
+            SystemStatusSvHealth(SystemStatusPQWP5(gnssEngineDebugDataInfo)));
+    setIteminReport(mCache.mPdr,
+            SystemStatusPdr(SystemStatusPQWP6(gnssEngineDebugDataInfo)));
+    setIteminReport(mCache.mNavData,
+            SystemStatusNavData(SystemStatusPQWP7(gnssEngineDebugDataInfo)));
+    setIteminReport(mCache.mPositionFailure,
+            SystemStatusPositionFailure(SystemStatusPQWS1(gnssEngineDebugDataInfo)));
+    pthread_mutex_unlock(&mMutexSystemStatus);
+}
+
+
 /******************************************************************************
 @brief      API to set report position data into internal buffer
 
@@ -1602,9 +1825,10 @@ bool SystemStatus::eventDataItemNotify(IDataItemCore* dataitem)
 
 @return     true when successfully done
 ******************************************************************************/
-bool SystemStatus::getReport(SystemStatusReports& report, bool isLatestOnly) const {
+bool SystemStatus::getReport(SystemStatusReports& report, bool isLatestOnly,
+        bool inSessionOnly) const {
     pthread_mutex_lock(&mMutexSystemStatus);
-    if (!mTracking) {
+    if (inSessionOnly && !mTracking) {
         pthread_mutex_unlock(&mMutexSystemStatus);
         return true;
     }
@@ -1773,7 +1997,21 @@ bool SystemStatus::updatePowerConnectState(bool charging)
 ******************************************************************************/
 bool SystemStatus::eventOptInStatus(bool userConsent)
 {
-    SystemStatusENH s(userConsent);
+    SystemStatusENH s(userConsent, ENHDataItem::FIELD_CONSENT);
+    mSysStatusObsvr.notify({&s.mDataItem});
+    return true;
+}
+
+/******************************************************************************
+@brief      API to update Region
+
+@param[In]  region
+
+@return     true when successfully done
+******************************************************************************/
+bool SystemStatus::eventRegionStatus(bool region)
+{
+    SystemStatusENH s(region, ENHDataItem::FIELD_REGION);
     mSysStatusObsvr.notify({&s.mDataItem});
     return true;
 }

+ 57 - 8
gps/core/SystemStatus.h

@@ -26,6 +26,43 @@
  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
  */
+
+/*
+Changes from Qualcomm Innovation Center are provided under the following license:
+
+Copyright (c) 2022-2023 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.
+*/
+
 #ifndef __SYSTEM_STATUS__
 #define __SYSTEM_STATUS__
 
@@ -161,16 +198,18 @@ public:
     uint32_t mJammerGlo;
     uint32_t mJammerBds;
     uint32_t mJammerGal;
-    double   mAgcGps;
-    double   mAgcGlo;
-    double   mAgcBds;
-    double   mAgcGal;
+    uint32_t   mAgcGps;
+    uint32_t   mAgcGlo;
+    uint32_t   mAgcBds;
+    uint32_t   mAgcGal;
     uint32_t mGloBpAmpI;
     uint32_t mGloBpAmpQ;
     uint32_t mBdsBpAmpI;
     uint32_t mBdsBpAmpQ;
     uint32_t mGalBpAmpI;
     uint32_t mGalBpAmpQ;
+    uint32_t mJammedSignalsMask;
+    std::vector<GnssJammerData> mJammerData;
     inline SystemStatusRfAndParams() :
         mPgaGain(0),
         mGpsBpAmpI(0),
@@ -190,7 +229,8 @@ public:
         mBdsBpAmpI(0),
         mBdsBpAmpQ(0),
         mGalBpAmpI(0),
-        mGalBpAmpQ(0) {}
+        mGalBpAmpQ(0),
+        mJammedSignalsMask(0) {}
     inline SystemStatusRfAndParams(const SystemStatusPQWM1& nmea);
     bool equals(const SystemStatusItemBase& peer) override;
     void dump(void) override;
@@ -423,10 +463,16 @@ public:
 class SystemStatusENH : public SystemStatusItemBase {
 public:
     ENHDataItem mDataItem;
-    inline SystemStatusENH(bool enabled=false): mDataItem(enabled) {}
+    inline SystemStatusENH(bool enabled, ENHDataItem::Fields updateBit = ENHDataItem::FIELD_MAX):
+            mDataItem(enabled, updateBit) {}
     inline SystemStatusENH(const ENHDataItem& itemBase): mDataItem(itemBase) {}
+    inline virtual SystemStatusItemBase& collate(SystemStatusItemBase& peer) {
+        mDataItem.mEnhFields = ((const SystemStatusENH&)peer).mDataItem.mEnhFields;
+        mDataItem.updateFields();
+        return *this;
+    }
     inline bool equals(const SystemStatusItemBase& peer) override {
-        return mDataItem.mEnabled == ((const SystemStatusENH&)peer).mDataItem.mEnabled;
+        return mDataItem.mEnhFields == ((const SystemStatusENH&)peer).mDataItem.mEnhFields;
     }
 };
 
@@ -887,13 +933,16 @@ public:
     bool eventPosition(const UlpLocation& location,const GpsLocationExtended& locationEx);
     bool eventDataItemNotify(IDataItemCore* dataitem);
     bool setNmeaString(const char *data, uint32_t len);
-    bool getReport(SystemStatusReports& reports, bool isLatestonly = false) const;
+    bool getReport(SystemStatusReports& reports, bool isLatestonly = false,
+            bool inSessionOnly = true) const;
+    void setEngineDebugDataInfo(const GnssEngineDebugDataInfo& gnssEngineDebugDataInfo);
     bool setDefaultGnssEngineStates(void);
     bool eventConnectionStatus(bool connected, int8_t type,
                                bool roaming, NetworkHandle networkHandle, string& apn);
     bool updatePowerConnectState(bool charging);
     void resetNetworkInfo();
     bool eventOptInStatus(bool userConsent);
+    bool eventRegionStatus(bool region);
     bool eventInEmergencyCall(bool isEmergency);
     void setTracking(bool tracking);
 };

+ 37 - 4
gps/core/data-items/DataItemConcreteTypes.cpp

@@ -27,6 +27,12 @@
  *
  */
 
+/*
+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
+*/
+
 #include "DataItemConcreteTypes.h"
 #include <inttypes.h>
 #include <log_util.h>
@@ -146,8 +152,26 @@ void ENHDataItem::stringify(string& valueStr) {
         STRINGIFY_ERROR_CHECK_AND_DOWN_CAST(ENHDataItem, ENH_DATA_ITEM_ID);
         valueStr.clear ();
         valueStr = ENH_FIELD_ENABLED;
-        valueStr += ": ";
-        valueStr += (d->mEnabled) ? ("true") : ("false");
+        if (!d->isEnabled()) {
+            Fields field = FIELD_MAX;
+            switch (mFieldUpdate) {
+                case FIELD_CONSENT:
+                    valueStr += "_FIELD_CONSENT";
+                    field = FIELD_CONSENT;
+                    break;
+                case FIELD_REGION:
+                    valueStr += "_FIELD_REGION";
+                    field = FIELD_REGION;
+                    break;
+                default:
+                    break;
+            }
+            valueStr += ": ";
+            valueStr += (((1 << field) & d->mEnhFields) != 0) ? "true" : "false";
+        } else {
+            valueStr += ": ";
+            valueStr += "true";
+        }
     } while (0);
     EXIT_LOG_WITH_ERROR("%d", result);
 }
@@ -582,8 +606,17 @@ int32_t ENHDataItem::copyFrom(IDataItemCore* src) {
     ENTRY_LOG();
     do {
         COPIER_ERROR_CHECK_AND_DOWN_CAST(ENHDataItem,  ENH_DATA_ITEM_ID);
-        if (s->mEnabled == d->mEnabled) { result = true; break; }
-        s->mEnabled = d->mEnabled;
+        if (s->mEnhFields == d->mEnhFields) { result = true; break; }
+        switch (d->mAction) {
+            case SET:
+                s->mEnhFields |= (1 << d->mFieldUpdate);
+                break;
+            case CLEAR:
+                s->mEnhFields &= ~(1 << d->mFieldUpdate);
+                break;
+            default:
+                break;
+        }
         result = 0;
     } while (0);
     EXIT_LOG_WITH_ERROR("%d", result);

+ 43 - 4
gps/core/data-items/DataItemConcreteTypes.h

@@ -27,6 +27,12 @@
  *
  */
 
+/*
+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 DATAITEM_CONCRETETYPES_H
 #define DATAITEM_CONCRETETYPES_H
 
@@ -143,13 +149,46 @@ public:
 
 class ENHDataItem: public IDataItemCore {
 public:
-    ENHDataItem(bool enabled = false) :
-        mEnabled(enabled) {mId = ENH_DATA_ITEM_ID;}
+    enum Fields { FIELD_CONSENT, FIELD_REGION, FIELD_MAX };
+    enum Actions { NO_OP, SET, CLEAR };
+    ENHDataItem(bool enabled = false, Fields updateBit = FIELD_MAX) :
+            mEnhFields(0), mFieldUpdate(updateBit) {
+        mId = ENH_DATA_ITEM_ID;
+        setAction(enabled ? SET : CLEAR);
+    }
     virtual ~ENHDataItem() {}
     virtual void stringify(string& /*valueStr*/) override;
     virtual int32_t copyFrom(IDataItemCore* /*src*/) override;
-// Data members
-    bool mEnabled;
+    inline bool isEnabled() const {
+        uint8_t combinedBits = (1 << FIELD_MAX) - 1;
+        return (combinedBits == (mEnhFields & combinedBits));
+    }
+    void setAction(Actions action = NO_OP) {
+        mAction = action;
+        if (NO_OP != mAction) {
+            updateFields();
+        }
+    }
+    void updateFields() {
+        if (FIELD_MAX > mFieldUpdate) {
+            switch (mAction) {
+                case SET:
+                    mEnhFields |= (1 << mFieldUpdate);
+                    break;
+                case CLEAR:
+                    mEnhFields &= ~(1 << mFieldUpdate);
+                    break;
+                case NO_OP:
+                default:
+                    break;
+            }
+        }
+    }
+    // Data members
+    uint32_t mEnhFields;
+private:
+    Actions mAction;
+    Fields mFieldUpdate;
 };
 
 class GPSStateDataItem: public IDataItemCore {

+ 0 - 11
gps/etc/gps.conf

@@ -323,17 +323,6 @@ MODEM_TYPE = 1
 # other position engines.
 #POSITION_ASSISTED_CLOCK_ESTIMATOR_ENABLED = 0
 
-##################################################
-# ROBUST LOCATION MODE
-##################################################
-# This setting enables or disables robust location
-# 2.x feature used by the GNSS standard position engine.
-# 0th bit: set to 1 to enable robust location
-# 1th bit: set to 1 to enable robust location on E911
-#          this bit is ignored if 0th bit is not set.
-# All other bits will be ignored.
-#ROBUST_LOCATION_ENABLED = 0
-
 #####################################
 # package names and NFW entities they control
 #####################################

+ 1 - 2
gps/gnss/Android.bp

@@ -3,10 +3,9 @@
 cc_library_shared {
 
     name: "libgnss",
+    defaults: ["qtilocation_common_defaults"],
     vendor: true,
 
-
-
     shared_libs: [
         "libutils",
         "libcutils",

+ 163 - 83
gps/gnss/GnssAdapter.cpp

@@ -26,6 +26,43 @@
  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
  */
+
+/*
+Changes from Qualcomm Innovation Center are provided under the following license:
+
+Copyright (c) 2022-2023 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_GnssAdapter"
 
@@ -53,7 +90,7 @@
 #define RAD2DEG    (180.0 / M_PI)
 #define DEG2RAD    (M_PI / 180.0)
 #define PROCESS_NAME_ENGINE_SERVICE "engine-service"
-#ifdef FEATURE_AUTOMOTIVE
+#if defined (FEATURE_AUTOMOTIVE) || defined (FEATURE_NHZ_ENABLED)
 #define MIN_TRACKING_INTERVAL (100) // 100 msec
 #else
 #define MIN_TRACKING_INTERVAL (1000) // 1 sec
@@ -140,7 +177,6 @@ GnssAdapter::GnssAdapter() :
     mBootReferenceEnergy(0),
     mPowerElapsedRealTimeCal(30000000),
     mIsMeasCorrInterfaceOpen(false),
-    mIsAntennaInfoInterfaceOpened(false),
     mQDgnssListenerHDL(nullptr),
     mCdfwInterface(nullptr),
     mDGnssNeedReport(false),
@@ -383,7 +419,7 @@ void GnssAdapter::fillElapsedRealTime(const GpsLocationExtended& locationExtende
         int64_t elapsedTimeNs = 0;
         float elapsedTimeUncMsec = 0.0;
         if (mPositionElapsedRealTimeCal.getElapsedRealtimeForGpsTime(
-                locationExtended.gpsTime, elapsedTimeNs, elapsedTimeUncMsec)) {
+                locationExtended, elapsedTimeNs, elapsedTimeUncMsec)) {
             out.flags |= LOCATION_HAS_ELAPSED_REAL_TIME_BIT;
             out.elapsedRealTime = elapsedTimeNs;
             out.elapsedRealTimeUnc = (int64_t) (elapsedTimeUncMsec * 1000000);
@@ -976,28 +1012,37 @@ GnssAdapter::setConfig()
 {
     LOC_LOGD("%s]: ", __func__);
 
-    // set nmea mask type
-    uint32_t mask = 0;
-    if (NMEA_PROVIDER_MP == ContextBase::mGps_conf.NMEA_PROVIDER) {
-        mask |= LOC_NMEA_ALL_GENERAL_SUPPORTED_MASK;
-        if (ContextBase::mGps_conf.NMEA_TAG_BLOCK_GROUPING_ENABLED) {
-            mask |= LOC_NMEA_MASK_TAGBLOCK_V02;
+    if (!ContextBase::isFeatureSupported(LOC_SUPPORTED_FEATURE_ENGINE_DEBUG_DATA)) {
+        // set nmea mask type
+        uint32_t mask = 0;
+        if (NMEA_PROVIDER_MP == ContextBase::mGps_conf.NMEA_PROVIDER) {
+            mask |= LOC_NMEA_ALL_GENERAL_SUPPORTED_MASK;
+            if (ContextBase::mGps_conf.NMEA_TAG_BLOCK_GROUPING_ENABLED) {
+                mask |= LOC_NMEA_MASK_TAGBLOCK_V02;
+            }
         }
-    }
-    if (ContextBase::isFeatureSupported(LOC_SUPPORTED_FEATURE_DEBUG_NMEA_V02)) {
-        mask |= LOC_NMEA_MASK_DEBUG_V02;
-    }
-    if (mNmeaMask != mask) {
-        mNmeaMask = mask;
-        if (mNmeaMask) {
-            for (auto it=mClientData.begin(); it != mClientData.end(); ++it) {
-                if ((it->second.gnssNmeaCb != nullptr)) {
-                    updateEvtMask(LOC_API_ADAPTER_BIT_NMEA_1HZ_REPORT,
-                                  LOC_REGISTRATION_MASK_ENABLED);
-                    break;
+
+        if (ContextBase::isFeatureSupported(LOC_SUPPORTED_FEATURE_DEBUG_NMEA_V02)) {
+            mask |= LOC_NMEA_MASK_DEBUG_V02;
+        }
+
+        if (mNmeaMask != mask) {
+            mNmeaMask = mask;
+            if (mNmeaMask) {
+                for (auto it=mClientData.begin(); it != mClientData.end(); ++it) {
+                    if ((it->second.gnssNmeaCb != nullptr)) {
+                        updateEvtMask(LOC_API_ADAPTER_BIT_NMEA_1HZ_REPORT,
+                                LOC_REGISTRATION_MASK_ENABLED);
+                        break;
+                    }
                 }
             }
         }
+    } else {
+        // Modem does not provide noraml NMEA if ENGINE_DEBUG_DATA feature is available
+        // ensuring AP to nmea generation in this case
+        ContextBase::mGps_conf.NMEA_PROVIDER =  NMEA_PROVIDER_AP;
+        updateEvtMask(LOC_API_ADAPTER_BIT_ENGINE_DEBUG_DATA_REPORT, LOC_REGISTRATION_MASK_ENABLED);
     }
 
     std::string oldMoServerUrl = getMoServerUrl();
@@ -1064,20 +1109,23 @@ GnssAdapter::setConfig()
 
         // set nmea mask type
         uint32_t mask = 0;
-        if (NMEA_PROVIDER_MP == gpsConf.NMEA_PROVIDER) {
-            mask |= LOC_NMEA_ALL_GENERAL_SUPPORTED_MASK;
-            if (gpsConf.NMEA_TAG_BLOCK_GROUPING_ENABLED) {
-                mask |= LOC_NMEA_MASK_TAGBLOCK_V02;
+        if (ContextBase::isFeatureSupported(LOC_SUPPORTED_FEATURE_ENGINE_DEBUG_DATA)) {
+            mask |= LOC_API_ADAPTER_BIT_ENGINE_DEBUG_DATA_REPORT;
+        } else {
+            if (NMEA_PROVIDER_MP == gpsConf.NMEA_PROVIDER) {
+                mask |= LOC_NMEA_ALL_GENERAL_SUPPORTED_MASK;
+                if (gpsConf.NMEA_TAG_BLOCK_GROUPING_ENABLED) {
+                    mask |= LOC_NMEA_MASK_TAGBLOCK_V02;
+                }
+            }
+            if (ContextBase::isFeatureSupported(LOC_SUPPORTED_FEATURE_DEBUG_NMEA_V02)) {
+                mask |= LOC_NMEA_MASK_DEBUG_V02;
             }
-        }
-        if (ContextBase::isFeatureSupported(LOC_SUPPORTED_FEATURE_DEBUG_NMEA_V02)) {
-            mask |= LOC_NMEA_MASK_DEBUG_V02;
-        }
 
-        if (mask != 0) {
-            mLocApi->setNMEATypesSync(mask);
+            if (mask != 0) {
+                mLocApi->setNMEATypesSync(mask);
+            }
         }
-
         // load tunc configuration from config file on first boot-up,
         // e.g.: adapter.mLocConfigInfo.tuncConfigInfo.isValid is false
         if (mLocConfigInfo.tuncConfigInfo.isValid == false) {
@@ -1105,15 +1153,11 @@ GnssAdapter::setConfig()
         mLocApi->setPositionAssistedClockEstimatorMode(
                 mLocConfigInfo.paceConfigInfo.enable);
 
-        // load robust location configuration from config file on first boot-up,
-        // e.g.: adapter.mLocConfigInfo.robustLocationConfigInfo.isValid is false
+        // robust location to be disabled on bootup by default
         if (mLocConfigInfo.robustLocationConfigInfo.isValid == false) {
             mLocConfigInfo.robustLocationConfigInfo.isValid = true;
-            bool robustLocationEnabled = (gpsConf.ROBUST_LOCATION_ENABLED & 0x01);
-            bool robustLocationE911Enabled = robustLocationEnabled ?
-                    ((gpsConf.ROBUST_LOCATION_ENABLED & 0x02) != 0) : false;
-            mLocConfigInfo.robustLocationConfigInfo.enable = robustLocationEnabled;
-            mLocConfigInfo.robustLocationConfigInfo.enableFor911 = robustLocationE911Enabled;
+            mLocConfigInfo.robustLocationConfigInfo.enable = false;
+            mLocConfigInfo.robustLocationConfigInfo.enableFor911 = false;
         }
         mLocApi->configRobustLocation(
                 mLocConfigInfo.robustLocationConfigInfo.enable,
@@ -2656,7 +2700,8 @@ GnssAdapter::updateClientsEventMask()
     // need to register for leap second info
     // for proper nmea generation
     LOC_API_ADAPTER_EVENT_MASK_T mask = LOC_API_ADAPTER_BIT_LOC_SYSTEM_INFO |
-            LOC_API_ADAPTER_BIT_EVENT_REPORT_INFO;
+            LOC_API_ADAPTER_BIT_EVENT_REPORT_INFO |
+            LOC_API_ADAPTER_BIT_FEATURE_STATUS_UPDATE;
     for (auto it=mClientData.begin(); it != mClientData.end(); ++it) {
         if (it->second.trackingCb != nullptr ||
             it->second.gnssLocationInfoCb != nullptr ||
@@ -2666,8 +2711,12 @@ GnssAdapter::updateClientsEventMask()
         if (it->second.gnssSvCb != nullptr) {
             mask |= LOC_API_ADAPTER_BIT_SATELLITE_REPORT;
         }
-        if ((it->second.gnssNmeaCb != nullptr) && (mNmeaMask)) {
-            mask |= LOC_API_ADAPTER_BIT_NMEA_1HZ_REPORT;
+        if (ContextBase::isFeatureSupported(LOC_SUPPORTED_FEATURE_ENGINE_DEBUG_DATA)) {
+            mask |= LOC_API_ADAPTER_BIT_ENGINE_DEBUG_DATA_REPORT;
+        } else {
+            if ((it->second.gnssNmeaCb != nullptr) && (mNmeaMask)) {
+                mask |= LOC_API_ADAPTER_BIT_NMEA_1HZ_REPORT;
+            }
         }
         if (it->second.gnssMeasurementsCb != nullptr) {
             mask |= LOC_API_ADAPTER_BIT_GNSS_MEASUREMENT;
@@ -2685,8 +2734,12 @@ GnssAdapter::updateClientsEventMask()
         }
         if (it->second.gnssDataCb != nullptr) {
             mask |= LOC_API_ADAPTER_BIT_PARSED_POSITION_REPORT;
-            mask |= LOC_API_ADAPTER_BIT_NMEA_1HZ_REPORT;
-            updateNmeaMask(mNmeaMask | LOC_NMEA_MASK_DEBUG_V02);
+            if (ContextBase::isFeatureSupported(LOC_SUPPORTED_FEATURE_ENGINE_DEBUG_DATA)) {
+                mask |= LOC_API_ADAPTER_BIT_ENGINE_DEBUG_DATA_REPORT;
+            } else {
+                mask |= LOC_API_ADAPTER_BIT_NMEA_1HZ_REPORT;
+                updateNmeaMask(mNmeaMask | LOC_NMEA_MASK_DEBUG_V02);
+            }
         }
     }
 
@@ -2821,7 +2874,7 @@ GnssAdapter::suspendSessions()
     if (!mTimeBasedTrackingSessions.empty()) {
         // inform engine hub that GNSS session has stopped
         mEngHubProxy->gnssStopFix();
-        mLocApi->stopFix(nullptr);
+        mLocApi->stopTimeBasedTracking(nullptr);
         if (isDgnssNmeaRequired()) {
             mDgnssState &= ~DGNSS_STATE_NO_NMEA_PENDING;
         }
@@ -2902,6 +2955,9 @@ GnssAdapter::getCapabilities()
     if (ContextBase::isFeatureSupported(LOC_SUPPORTED_FEATURE_AGPM_V02)) {
         mask |= LOCATION_CAPABILITIES_AGPM_BIT;
     }
+    if (ContextBase::isFeatureSupported(LOC_SUPPORTED_FEATURE_ENGINE_DEBUG_DATA)) {
+        mask |= LOCATION_CAPABILITIES_ENGINE_DEBUG_DATA_BIT;
+    }
     //Get QWES feature status mask
     mask |= ContextBase::getQwesFeatureStatus();
     return mask;
@@ -2970,13 +3026,6 @@ GnssAdapter::hasCallbacksToStartTracking(LocationAPI* client)
     return allowed;
 }
 
-bool
-GnssAdapter::isTrackingSession(LocationAPI* client, uint32_t sessionId)
-{
-    LocationSessionKey key(client, sessionId);
-    return (mTimeBasedTrackingSessions.find(key) != mTimeBasedTrackingSessions.end());
-}
-
 void
 GnssAdapter::reportPowerStateIfChanged()
 {
@@ -3026,6 +3075,7 @@ GnssAdapter::saveTrackingSession(LocationAPI* client, uint32_t sessionId,
     reportPowerStateIfChanged();
     // notify SystemStatus the engine tracking status
     getSystemStatus()->setTracking(isInSession());
+    mXtraObserver.notifySessionStart();
 }
 
 void
@@ -3212,6 +3262,10 @@ GnssAdapter::startTimeBasedTrackingMultiplex(LocationAPI* client, uint32_t sessi
                 it->second.powerMode < multiplexedPowerMode) {
                 multiplexedPowerMode = it->second.powerMode;
             }
+            //if not set or there is a new higher qualityLevelAccepted, then set the higher one
+            if (it->second.qualityLevelAccepted > multiplexedOptions.qualityLevelAccepted) {
+                multiplexedOptions.qualityLevelAccepted = it->second.qualityLevelAccepted;
+            }
         }
         bool updateOptions = false;
         // if session we are starting has smaller interval then next smallest
@@ -3225,6 +3279,11 @@ GnssAdapter::startTimeBasedTrackingMultiplex(LocationAPI* client, uint32_t sessi
             multiplexedOptions.powerMode = options.powerMode;
             updateOptions = true;
         }
+        // if session we are starting has higher qualityLevelAccepted then next highest
+        if (options.qualityLevelAccepted > multiplexedOptions.qualityLevelAccepted) {
+            multiplexedOptions.qualityLevelAccepted = options.qualityLevelAccepted;
+            updateOptions = true;
+        }
         if (updateOptions) {
             // restart time based tracking with the newly updated options
 
@@ -3599,8 +3658,11 @@ GnssAdapter::stopTracking(LocationAPI* client, uint32_t id)
     // inform engine hub that GNSS session has stopped
     mEngHubProxy->gnssStopFix();
 
-    mLocApi->stopFix(new LocApiResponse(*getContext(),
-                     [this, client, id] (LocationError err) {
+    // client is nullptr when we want to stop any tracking session,
+    // e.g. when suspend.
+    mLocApi->stopTimeBasedTracking((nullptr == client) ? nullptr :
+            new LocApiResponse(*getContext(),
+                               [this, client, id] (LocationError err) {
         reportResponse(client, err, id);
     }));
 
@@ -4216,7 +4278,7 @@ GnssAdapter::reportPosition(const UlpLocation& ulpLocation,
         bool blank_fix = ((0 == ulpLocation.gpsLocation.latitude) &&
                           (0 == ulpLocation.gpsLocation.longitude) &&
                           (LOC_RELIABILITY_NOT_SET == locationExtended.horizontal_reliability));
-        uint8_t generate_nmea = (reportToAllClients && status != LOC_SESS_FAILURE && !blank_fix);
+        uint8_t generate_nmea = (reportToAllClients && LOC_SESS_SUCCESS == status  && !blank_fix);
         bool custom_nmea_gga = (1 == ContextBase::mGps_conf.CUSTOM_NMEA_GGA_FIX_QUALITY_ENABLED);
         bool isTagBlockGroupingEnabled =
                 (1 == ContextBase::mGps_conf.NMEA_TAG_BLOCK_GROUPING_ENABLED);
@@ -4242,6 +4304,30 @@ GnssAdapter::reportPosition(const UlpLocation& ulpLocation,
     }
 }
 
+void GnssAdapter::reportEngDebugDataInfo(const GnssEngineDebugDataInfo& gnssEngineDebugDataInfo) {
+    if (ContextBase::isFeatureSupported(LOC_SUPPORTED_FEATURE_ENGINE_DEBUG_DATA)) {
+        LOC_LOGd("Recived Engine debug data info");
+        SystemStatus* s = getSystemStatus();
+        if (nullptr != s) {
+            s->setEngineDebugDataInfo(gnssEngineDebugDataInfo);
+        }
+    }
+}
+
+void GnssAdapter::reportEngDebugDataInfoEvent(GnssEngineDebugDataInfo& gnssEngineDebugDataInfo) {
+    struct MsgReportEngDebugDataInfo : public LocMsg {
+        GnssAdapter& mAdapter;
+        const GnssEngineDebugDataInfo mGnssEngineDebugDataInfo;
+        inline MsgReportEngDebugDataInfo(GnssAdapter& adapter, GnssEngineDebugDataInfo&
+            gnssEngineDebugDataInfo) : mGnssEngineDebugDataInfo(gnssEngineDebugDataInfo),
+                mAdapter(adapter) {}
+        inline virtual void proc() const {
+            mAdapter.reportEngDebugDataInfo(mGnssEngineDebugDataInfo);
+        }
+    };
+    sendMsg(new MsgReportEngDebugDataInfo(*this, gnssEngineDebugDataInfo));
+}
+
 void
 GnssAdapter::reportLatencyInfoEvent(const GnssLatencyInfo& gnssLatencyInfo)
 {
@@ -5355,8 +5441,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);
@@ -5875,7 +5960,7 @@ bool GnssAdapter::getDebugReport(GnssDebugReport& r)
     }
 
     SystemStatusReports reports;
-    systemstatus->getReport(reports, true);
+    systemstatus->getReport(reports, true, false);
 
     r.size = sizeof(r);
 
@@ -5982,7 +6067,7 @@ GnssAdapter::getAgcInformation(GnssMeasurementsNotification& measurements, int m
 
     if (nullptr != systemstatus) {
         SystemStatusReports reports = {};
-        systemstatus->getReport(reports, true);
+        systemstatus->getReport(reports, true, false);
 
         if ((!reports.mRfAndParams.empty()) && (!reports.mTimeAndClock.empty()) &&
             (abs(msInWeek - (int)reports.mTimeAndClock.back().mGpsTowMs) < 2000)) {
@@ -5992,28 +6077,28 @@ GnssAdapter::getAgcInformation(GnssMeasurementsNotification& measurements, int m
                 case GNSS_SV_TYPE_GPS:
                 case GNSS_SV_TYPE_QZSS:
                     measurements.measurements[i].agcLevelDb =
-                            -(double)reports.mRfAndParams.back().mJammerGps;
+                            -((double)reports.mRfAndParams.back().mJammerGps / 100.0);
                     measurements.measurements[i].flags |=
                             GNSS_MEASUREMENTS_DATA_AUTOMATIC_GAIN_CONTROL_BIT;
                     break;
 
                 case GNSS_SV_TYPE_GALILEO:
                     measurements.measurements[i].agcLevelDb =
-                            -(double)reports.mRfAndParams.back().mJammerGal;
+                            -((double)reports.mRfAndParams.back().mJammerGal / 100.0);
                     measurements.measurements[i].flags |=
                             GNSS_MEASUREMENTS_DATA_AUTOMATIC_GAIN_CONTROL_BIT;
                     break;
 
                 case GNSS_SV_TYPE_GLONASS:
                     measurements.measurements[i].agcLevelDb =
-                            -(double)reports.mRfAndParams.back().mJammerGlo;
+                            -((double)reports.mRfAndParams.back().mJammerGlo / 100.0);
                     measurements.measurements[i].flags |=
                             GNSS_MEASUREMENTS_DATA_AUTOMATIC_GAIN_CONTROL_BIT;
                     break;
 
                 case GNSS_SV_TYPE_BEIDOU:
                     measurements.measurements[i].agcLevelDb =
-                            -(double)reports.mRfAndParams.back().mJammerBds;
+                            -((double)reports.mRfAndParams.back().mJammerBds / 100.0);
                     measurements.measurements[i].flags |=
                             GNSS_MEASUREMENTS_DATA_AUTOMATIC_GAIN_CONTROL_BIT;
                     break;
@@ -6037,7 +6122,7 @@ GnssAdapter::getDataInformation(GnssDataNotification& data, int msInWeek)
     LOC_LOGV("%s]: msInWeek=%d", __func__, msInWeek);
     if (nullptr != systemstatus) {
         SystemStatusReports reports = {};
-        systemstatus->getReport(reports, true);
+        systemstatus->getReport(reports, true, false);
 
         if ((!reports.mRfAndParams.empty()) && (!reports.mTimeAndClock.empty()) &&
             (abs(msInWeek - (int)reports.mTimeAndClock.back().mGpsTowMs) < 2000)) {
@@ -6052,45 +6137,45 @@ GnssAdapter::getDataInformation(GnssDataNotification& data, int msInWeek)
                 data.gnssDataMask[GNSS_LOC_SIGNAL_TYPE_GPS_L1CA] |=
                         GNSS_LOC_DATA_AGC_BIT | GNSS_LOC_DATA_JAMMER_IND_BIT;
                 data.agc[GNSS_LOC_SIGNAL_TYPE_GPS_L1CA] =
-                        -(double)reports.mRfAndParams.back().mJammerGps;
+                        -((double)reports.mRfAndParams.back().mJammerGps / 100.0);
                 data.jammerInd[GNSS_LOC_SIGNAL_TYPE_GPS_L1CA] =
-                        (double)reports.mRfAndParams.back().mJammerGps;
+                        ((double)reports.mRfAndParams.back().mJammerGps / 100.0);
                 data.gnssDataMask[GNSS_LOC_SIGNAL_TYPE_QZSS_L1CA] |=
                         GNSS_LOC_DATA_AGC_BIT | GNSS_LOC_DATA_JAMMER_IND_BIT;
                 data.agc[GNSS_LOC_SIGNAL_TYPE_QZSS_L1CA] =
-                        -(double)reports.mRfAndParams.back().mJammerGps;
+                        -((double)reports.mRfAndParams.back().mJammerGps / 100.0);
                 data.jammerInd[GNSS_LOC_SIGNAL_TYPE_QZSS_L1CA] =
-                        (double)reports.mRfAndParams.back().mJammerGps;
+                        ((double)reports.mRfAndParams.back().mJammerGps / 100.0);
                 data.gnssDataMask[GNSS_LOC_SIGNAL_TYPE_SBAS_L1_CA] |=
                         GNSS_LOC_DATA_AGC_BIT | GNSS_LOC_DATA_JAMMER_IND_BIT;
                 data.agc[GNSS_LOC_SIGNAL_TYPE_SBAS_L1_CA] =
-                        -(double)reports.mRfAndParams.back().mJammerGps;
+                        -((double)reports.mRfAndParams.back().mJammerGps / 100.0);
                 data.jammerInd[GNSS_LOC_SIGNAL_TYPE_SBAS_L1_CA] =
-                        (double)reports.mRfAndParams.back().mJammerGps;
+                        ((double)reports.mRfAndParams.back().mJammerGps / 100.0);
             }
             if (GNSS_INVALID_JAMMER_IND != reports.mRfAndParams.back().mJammerGlo) {
                 data.gnssDataMask[GNSS_LOC_SIGNAL_TYPE_GLONASS_G1] |=
                         GNSS_LOC_DATA_AGC_BIT | GNSS_LOC_DATA_JAMMER_IND_BIT;
                 data.agc[GNSS_LOC_SIGNAL_TYPE_GLONASS_G1] =
-                        -(double)reports.mRfAndParams.back().mJammerGlo;
+                        -((double)reports.mRfAndParams.back().mJammerGlo / 100.0);
                 data.jammerInd[GNSS_LOC_SIGNAL_TYPE_GLONASS_G1] =
-                        (double)reports.mRfAndParams.back().mJammerGlo;
+                        ((double)reports.mRfAndParams.back().mJammerGlo / 100.0);
             }
             if (GNSS_INVALID_JAMMER_IND != reports.mRfAndParams.back().mJammerBds) {
                 data.gnssDataMask[GNSS_LOC_SIGNAL_TYPE_BEIDOU_B1_I] |=
                         GNSS_LOC_DATA_AGC_BIT | GNSS_LOC_DATA_JAMMER_IND_BIT;
                 data.agc[GNSS_LOC_SIGNAL_TYPE_BEIDOU_B1_I] =
-                        -(double)reports.mRfAndParams.back().mJammerBds;
+                        -((double)reports.mRfAndParams.back().mJammerBds / 100.0);
                 data.jammerInd[GNSS_LOC_SIGNAL_TYPE_BEIDOU_B1_I] =
-                        (double)reports.mRfAndParams.back().mJammerBds;
+                        ((double)reports.mRfAndParams.back().mJammerBds / 100.0);
             }
             if (GNSS_INVALID_JAMMER_IND != reports.mRfAndParams.back().mJammerGal) {
                 data.gnssDataMask[GNSS_LOC_SIGNAL_TYPE_GALILEO_E1_C] |=
                         GNSS_LOC_DATA_AGC_BIT | GNSS_LOC_DATA_JAMMER_IND_BIT;
                 data.agc[GNSS_LOC_SIGNAL_TYPE_GALILEO_E1_C] =
-                        -(double)reports.mRfAndParams.back().mJammerGal;
+                        -((double)reports.mRfAndParams.back().mJammerGal / 100.0);
                 data.jammerInd[GNSS_LOC_SIGNAL_TYPE_GALILEO_E1_C] =
-                        (double)reports.mRfAndParams.back().mJammerGal;
+                        ((double)reports.mRfAndParams.back().mJammerGal / 100.0);
             }
         }
     }
@@ -6644,13 +6729,8 @@ uint32_t GnssAdapter::antennaInfoInitCommand(const antennaInfoCb antennaInfoCall
             mAdapter.reportGnssAntennaInformation(mAntennaInfoCb);
         }
     };
-    if (mIsAntennaInfoInterfaceOpened) {
-        return ANTENNA_INFO_ERROR_ALREADY_INIT;
-    } else {
-        mIsAntennaInfoInterfaceOpened = true;
-        sendMsg(new MsgInitAi(antennaInfoCallback, *this));
-        return ANTENNA_INFO_SUCCESS;
-    }
+    sendMsg(new MsgInitAi(antennaInfoCallback, *this));
+    return ANTENNA_INFO_SUCCESS;
 }
 
 void

+ 41 - 4
gps/gnss/GnssAdapter.h

@@ -26,6 +26,43 @@
  * 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.
+*/
+
 #ifndef GNSS_ADAPTER_H
 #define GNSS_ADAPTER_H
 
@@ -246,7 +283,6 @@ class GnssAdapter : public LocAdapterBase {
     bool mIsMeasCorrInterfaceOpen;
     measCorrSetCapabilitiesCb mMeasCorrSetCapabilitiesCb;
     bool initMeasCorr(bool bSendCbWhenNotSupported);
-    bool mIsAntennaInfoInterfaceOpened;
 
     /* ==== DGNSS Data Usable Report======================================================== */
     QDgnssListenerHDL mQDgnssListenerHDL;
@@ -364,7 +400,6 @@ public:
     bool isTimeBasedTrackingSession(LocationAPI* client, uint32_t sessionId);
     bool isDistanceBasedTrackingSession(LocationAPI* client, uint32_t sessionId);
     bool hasCallbacksToStartTracking(LocationAPI* client);
-    bool isTrackingSession(LocationAPI* client, uint32_t sessionId);
     void saveTrackingSession(LocationAPI* client, uint32_t sessionId,
                              const TrackingOptions& trackingOptions);
     void eraseTrackingSession(LocationAPI* client, uint32_t sessionId);
@@ -477,7 +512,7 @@ public:
     bool measCorrSetCorrectionsCommand(const GnssMeasurementCorrections gnssMeasCorr);
     inline void closeMeasCorrCommand() { mIsMeasCorrInterfaceOpen = false; }
     uint32_t antennaInfoInitCommand(const antennaInfoCb antennaInfoCallback);
-    inline void antennaInfoCloseCommand() { mIsAntennaInfoInterfaceOpened = false; }
+    inline void antennaInfoCloseCommand() {}
     uint32_t configMinGpsWeekCommand(uint16_t minGpsWeek);
     uint32_t configDeadReckoningEngineParamsCommand(const DeadReckoningEngineConfig& dreConfig);
     uint32_t configEngineRunStateCommand(PositioningEngineMask engType,
@@ -546,6 +581,8 @@ public:
             GnssAdditionalSystemInfo& additionalSystemInfo);
     virtual void reportNfwNotificationEvent(GnssNfwNotification& notification);
     virtual void reportLatencyInfoEvent(const GnssLatencyInfo& gnssLatencyInfo);
+    virtual void reportEngDebugDataInfoEvent(GnssEngineDebugDataInfo&
+            gnssEngineDebugDataInfo) override;
     virtual bool reportQwesCapabilities
     (
         const std::unordered_map<LocationQwesFeatureType, bool> &featureMap
@@ -618,7 +655,7 @@ public:
     void getAgcInformation(GnssMeasurementsNotification& measurements, int msInWeek);
     /* get Data information from system status and fill it */
     void getDataInformation(GnssDataNotification& data, int msInWeek);
-
+    void reportEngDebugDataInfo(const GnssEngineDebugDataInfo& gnssEngineDebugDataInfo);
     /*==== SYSTEM STATUS ================================================================*/
     inline SystemStatus* getSystemStatus(void) { return mSystemStatus; }
     std::string& getServerUrl(void) { return mServerUrl; }

+ 45 - 1
gps/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>
@@ -226,6 +262,15 @@ bool XtraSystemStatusObserver::updateXtraThrottle(const bool enabled) {
     return ( LocIpc::send(*mXtraSender, (const uint8_t*)s.data(), s.size()) );
 }
 
+bool XtraSystemStatusObserver::notifySessionStart() {
+    if (!mReqStatusReceived) {
+        return true;
+    }
+
+    string s = "sessionstart";
+    return ( LocIpc::send(*mXtraSender, (const uint8_t*)s.data(), s.size()) );
+}
+
 inline bool XtraSystemStatusObserver::onStatusRequested(int32_t statusUpdated) {
     mReqStatusReceived = true;
 
@@ -313,7 +358,6 @@ void XtraSystemStatusObserver::subscribe(bool yes)
 
     if (yes) {
         mSystemStatusObsrvr->subscribe(subItemIdSet, this);
-
         unordered_set<DataItemId> reqItemIdSet;
         reqItemIdSet.insert(TAC_DATA_ITEM_ID);
 

+ 8 - 0
gps/gnss/XtraSystemStatusObserver.h

@@ -26,6 +26,13 @@
  * 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.
+SPDX-License-Identifier: BSD-3-Clause-Clear
+*/
+
 #ifndef XTRA_SYSTEM_STATUS_OBS_H
 #define XTRA_SYSTEM_STATUS_OBS_H
 
@@ -78,6 +85,7 @@ public :
     bool updateXtraThrottle(const bool enabled);
     inline const MsgTask* getMsgTask() { return mMsgTask; }
     void subscribe(bool yes);
+    bool notifySessionStart();
     bool onStatusRequested(int32_t xtraStatusUpdated);
     void startDgnssSource(const StartDgnssNtripParams& params);
     void restartDgnssSource();

+ 19 - 0
gps/gps_vendor_product.mk

@@ -26,4 +26,23 @@ PRODUCT_PACKAGES += [email protected]
 PRODUCT_PACKAGES += android.hardware.gnss-aidl-impl-qti
 PRODUCT_PACKAGES += android.hardware.gnss-aidl-service-qti
 
+## Feature flags - self contained FR in gps module
+# Enable NHz location feature. Default is false.
+# Set this flag to true to enable the NHz location feature.
+FEATURE_LOCATION_NHZ := false
+
+# Soong Namespace
+SOONG_CONFIG_NAMESPACES += qtilocation
+
+# Soong Keys
+SOONG_CONFIG_qtilocation := feature_nhz
+
+# Soong Values
+SOONG_CONFIG_qtilocation_feature_nhz := false
+
+# Enable NHz location feature
+ifeq ($(FEATURE_LOCATION_NHZ),true)
+    SOONG_CONFIG_qtilocation_feature_nhz := true
+endif
+
 endif # ifneq ($(BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE),)

+ 12 - 0
gps/location/LocationAPI.cpp

@@ -349,12 +349,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)) {
@@ -363,6 +371,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)) {
@@ -371,6 +381,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;

+ 5 - 1
gps/location/LocationDataTypes.h

@@ -354,6 +354,8 @@ typedef enum {
     LOCATION_CAPABILITIES_QWES_QDR3                         = (1<<26),
     // This mask indicates DGNSS license bundle is enabled.
     LOCATION_CAPABILITIES_QWES_DGNSS                        = (1<<27),
+    // This mask indicates engine debug data enabled.
+    LOCATION_CAPABILITIES_ENGINE_DEBUG_DATA_BIT             = (1<<28)
 } LocationCapabilitiesBits;
 
 typedef uint8_t LocationQwesFeatureType;
@@ -881,7 +883,9 @@ typedef enum {
     GNSS_LOC_SIGNAL_TYPE_SBAS_L1_CA = 17,       /**<  SBAS L1_CA RF Band  */
     GNSS_LOC_SIGNAL_TYPE_NAVIC_L5 = 18,         /**<  NAVIC L5 RF Band */
     GNSS_LOC_SIGNAL_TYPE_BEIDOU_B2A_Q = 19,     /**<  BEIDOU B2A_Q RF Band  */
-    GNSS_LOC_MAX_NUMBER_OF_SIGNAL_TYPES = 20    /**<  Maximum number of signal types */
+    GNSS_LOC_SIGNAL_TYPE_BEIDOU_B2B_I = 20,     /**<  BeiDou B2B_I RF band (data) */
+    GNSS_LOC_SIGNAL_TYPE_BEIDOU_B2B_Q = 21,     /**< BeiDou B2B_Q RF band (Pilot)*/
+    GNSS_LOC_MAX_NUMBER_OF_SIGNAL_TYPES = 22    /**<  Maximum number of signal types */
 } Gnss_LocSignalEnumType;
 
 typedef uint32_t PositioningEngineMask;

+ 367 - 0
gps/utils/gps_extended.h

@@ -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.
+*/
+
 #ifndef GPS_EXTENDED_H
 #define GPS_EXTENDED_H
 
@@ -39,6 +75,7 @@
 #include <string.h>
 #endif
 #include <string>
+#include <vector>
 
 #ifdef __cplusplus
 extern "C" {
@@ -117,6 +154,336 @@ struct BackhaulContext {
     uint16_t prefIpType;
 };
 
+/* Engine Debug data Information */
+
+#define GNSS_MAX_SV_INFO_LIST_SIZE 176
+
+typedef struct {
+    int32_t jammerInd;
+    // Jammer Indication
+    int32_t agc;
+    // Automatic gain control
+} GnssJammerData;
+
+
+typedef struct {
+    uint16_t gnssSvId;
+    /**<   GNSS SV ID. Range:
+      - GPS --     1 to 32
+      - GLONASS -- 65 to 96
+      - SBAS --    120 to 158 and 183 to 191
+      - QZSS --    193 to 197
+      - BDS --     201 to 263
+      - Galileo -- 301 to 336
+      - NavIC --   401 to 414 */
+
+    uint8_t type;
+    /**<   Navigation data type */
+
+    uint8_t src;
+    /**<   Navigation data source.*/
+    int32_t age;
+    /**<   Age of navigation data.
+      - Units: Seconds */
+} GnssNavDataInfo;
+
+
+typedef struct {
+    uint32_t hours;
+    /**<   Hours of timestamp */
+
+    uint32_t mins;
+    /**<   Minutes of timestamp */
+
+    float secs;
+    /**<   Seconds of timestamp */
+} GnssTimeInfo;
+
+typedef enum {
+    GPS_XTRA_VALID_BIT     = 1 << 0,
+    GLONASS_XTRA_VALID_BIT = 1 << 1,
+    BDS_XTRA_VALID_BIT     = 1 << 2,
+    GAL_XTRA_VALID_BIT     = 1 << 3,
+    QZSS_XTRA_VALID_BIT    = 1 << 4,
+    NAVIC_XTRA_VALID_BIT   = 1 << 5
+} GnssXtraValidMaskBits;
+
+typedef struct {
+
+    uint8_t timeValid;
+    /**<Time validity >*/
+
+    uint16_t gpsWeek;
+    /**<   Full GPS week */
+
+    uint32_t gpsTowMs;
+    /**<   GPS time of week.
+      - Units: milliseconds  */
+
+    uint8_t sourceOfTime;
+    /**<   Source of the time information*/
+
+    float clkTimeUnc;
+    /**<   Single-sided maximum time bias uncertainty.
+      - Units: milliseconds */
+
+    float clkFreqBias;
+    /**<   Receiver clock frequency bias. \n
+      - Units -- ppb */
+
+    float clkFreqUnc;
+    /**<   Receiver clock frequency uncertainty. \n
+      - Units -- ppb */
+
+    uint8_t xoState;
+    /**<   XO calibration. */
+
+    uint32_t rcvrErrRecovery;
+    /**<   Error recovery reason. */
+
+    Gnss_LeapSecondInfoStructType leapSecondInfo;
+    /**<   Leap second information. */
+
+    std::vector<GnssJammerData> jammerData;
+    /**<   Jammer indicator of each signal. */
+
+    uint64_t jammedSignalsMask;
+    /* Jammer Signal Mask */
+
+    GnssTimeInfo epiTime;
+    /**<   UTC Time associated with EPI. */
+
+    uint8_t epiValidity;
+    /**<   Epi validity >*/
+
+    float epiLat;
+    /**<   EPI Latitude. - Units: Radians
+        valid if 0th bit set in epiValidity*/
+
+    float epiLon;
+    /**<   EPI Longitude. - Units: Radians
+        valid if 0th bit set in epiValidity*/
+
+    float epiAlt;
+    /**<   EPI Altitude. - Units: Meters
+        valid if 1st bit set in epiValidity*/
+
+    float epiHepe;
+    /**<   EPI Horizontal Estimated Position Error.
+      - Units: Meters
+        valid if 0th bit set in epiValidity*/
+
+    float epiAltUnc;
+    /**<   EPI Altitude Uncertainty.
+      - Units: Meters
+        valid if 1st bit set in epiValidity*/
+
+    uint8_t epiSrc;
+    /**<   EPI Source
+        valid if 2nd bit set in epiValidity*/
+
+    GnssTimeInfo bestPosTime;
+    /**<   UTC Time associated with Best Position. */
+
+    float bestPosLat;
+    /**<   Best Position Latitude.
+      - Units: Radians */
+
+    float bestPosLon;
+    /**<   Best Position Longitude.
+      - Units: Radians */
+
+    float bestPosAlt;
+    /**<   Best Position Altitude.
+      - Units: Meters */
+
+    float bestPosHepe;
+    /**<   Best Position Horizontal Estimated Position Error.
+      - Units: Meters */
+
+    float bestPosAltUnc;
+    /**<   Best Position Altitude Uncertainty.
+      - Units: Meters */
+
+    GnssTimeInfo xtraInfoTime;
+    /**<   UTC time when XTRA debug information was generated. */
+
+    uint8_t xtraValidMask;
+    /**<xtra valid mask>*/
+
+    uint32_t gpsXtraAge;
+    /**<   Age of GPS XTRA data.
+      - Units: Seconds */
+
+    uint32_t gloXtraAge;
+    /**<   Age of GLONASS XTRA data.
+      - Units: Seconds */
+
+    uint32_t bdsXtraAge;
+    /**<   Age of BDS XTRA data.
+      - Units: Seconds */
+
+    uint32_t galXtraAge;
+    /**<   Age of GAL XTRA data.
+      - Units: Seconds */
+
+    uint32_t qzssXtraAge;
+    /**<   Age of QZSS XTRA data.
+      - Units: Seconds */
+
+    uint32_t navicXtraAge;
+    /**<   Age of NAVIC XTRA data.
+      - Units: Seconds */
+
+    uint32_t gpsXtraMask;
+    /**<   Specifies the GPS SV mask.
+      - SV ID mapping: SV 1 maps to bit 0. */
+
+    uint32_t gloXtraMask;
+    /**<   Specifies the GLONASS SV mask.
+      - SV ID mapping: SV 65 maps to bit 0. */
+
+    uint64_t bdsXtraMask;
+    /**<   Specifies the BDS SV mask.
+      - SV ID mapping: SV 201 maps to bit 0. */
+
+    uint64_t galXtraMask;
+    /**<   Specifies the Galileo SV mask.
+      - SV ID mapping: SV 301 maps to bit 0. */
+
+    uint8_t qzssXtraMask;
+    /**<   Specifies the QZSS SV mask.
+      - SV ID mapping: SV 193 maps to bit 0 */
+
+    uint32_t navicXtraMask;
+    /**<   Specifies the NAVIC SV mask.
+      - SV ID mapping: SV 401 maps to bits 0. */
+
+    GnssTimeInfo ephInfoTime;
+    /**<   UTC time when ephemeris debug information was generated. */
+
+    uint32_t gpsEphMask;
+    /**<   Specifies the GPS SV mask.
+      - SV ID mapping: SV 1 maps to bit 0. */
+
+    uint32_t gloEphMask;
+    /**<   Specifies the GLONASS SV mask.
+      - SV ID mapping: SV 65 maps to bit 0. */
+
+    uint64_t bdsEphMask;
+    /**<   Specifies the BDS SV mask.
+      - SV ID mapping: SV 201 maps to bit 0. */
+
+    uint64_t galEphMask;
+    /**<   Specifies the Galileo SV mask.
+      - SV ID mapping: SV 301 maps to bit 0. */
+
+    uint8_t qzssEphMask;
+    /**<   Specifies the QZSS SV mask.
+      - SV ID mapping: SV 193 maps to bit 0 */
+
+    uint32_t navicEphMask;
+    /**<   Specifies the NAVIC SV mask.
+      - SV ID mapping: SV 401 maps to bits 0. */
+
+    GnssTimeInfo healthInfoTime;
+    /**<   UTC time when SV health information was generated. */
+
+    uint32_t gpsHealthUnknownMask;
+    /**<   Specifies the GPS SV mask.
+      - SV ID mapping: SV 1 maps to bit 0. */
+
+    uint32_t gloHealthUnknownMask;
+    /**<   Specifies the GLONASS SV mask.
+      - SV ID mapping: SV 65 maps to bit 0. */
+
+    uint64_t bdsHealthUnknownMask;
+    /**<   Specifies the BDS SV mask.
+      - SV ID mapping: SV 201 maps to bit 0. */
+
+    uint64_t galHealthUnknownMask;
+    /**<   Specifies the Galileo SV mask.
+      - SV ID mapping: SV 301 maps to bit 0. */
+
+    uint8_t qzssHealthUnknownMask;
+    /**<   Specifies the QZSS SV mask.
+      - SV ID mapping: SV 193 maps to bit 0 */
+
+    uint32_t navicHealthUnknownMask;
+    /**<   Specifies the NAVIC SV mask.
+      - SV ID mapping: SV 401 maps to bits 0. */
+
+    uint32_t gpsHealthGoodMask;
+    /**<   Specifies the GPS SV mask.
+      - SV ID mapping: SV 1 maps to bit 0. */
+
+    uint32_t gloHealthGoodMask;
+    /**<   Specifies the GLONASS SV mask.
+      - SV ID mapping: SV 65 maps to bit 0. */
+
+    uint64_t bdsHealthGoodMask;
+    /**<   Specifies the BDS SV mask.
+      - SV ID mapping: SV 201 maps to bit 0. */
+
+    uint64_t galHealthGoodMask;
+    /**<   Specifies the Galileo SV mask.
+      - SV ID mapping: SV 301 maps to bit 0. */
+
+    uint8_t qzssHealthGoodMask;
+    /**<   Specifies the QZSS SV mask.
+      - SV ID mapping: SV 193 maps to bit 0 */
+
+    uint32_t navicHealthGoodMask;
+    /**<   Specifies the NAVIC SV mask.
+      - SV ID mapping: SV 401 maps to bits 0. */
+
+    uint32_t gpsHealthBadMask;
+    /**<   Specifies the GPS SV mask.
+      - SV ID mapping: SV 1 maps to bit 0. */
+
+    uint32_t gloHealthBadMask;
+    /**<   Specifies the GLONASS SV mask.
+      - SV ID mapping: SV 65 maps to bit 0. */
+
+    uint64_t bdsHealthBadMask;
+    /**<   Specifies the BDS SV mask.
+      - SV ID mapping: SV 201 maps to bit 0. */
+
+    uint64_t galHealthBadMask;
+    /**<   Specifies the Galileo SV mask.
+      - SV ID mapping: SV 301 maps to bit 0. */
+
+    uint8_t qzssHealthBadMask;
+    /**<   Specifies the QZSS SV mask.
+      - SV ID mapping: SV 193 maps to bit 0 */
+
+    uint32_t navicHealthBadMask;
+    /**<   Specifies the NAVIC SV mask.
+      - SV ID mapping: SV 401 maps to bits 0. */
+
+    GnssTimeInfo fixInfoTime;
+    /**<   UTC time when fix information was generated. */
+
+    uint32_t fixInfoMask;
+    /**<   Fix Information Mask*/
+
+    GnssTimeInfo navDataTime;
+    /**<   UTC time when navigation data was generated. */
+
+    GnssNavDataInfo navData[GNSS_MAX_SV_INFO_LIST_SIZE];
+    /**<   Satellite navigation data. */
+
+    GnssTimeInfo fixStatusTime;
+    /**<   UTC time when fix status was generated. */
+
+    uint32_t fixStatusMask;
+    /**<   Fix Status Mask */
+
+    uint32_t fixHepeLimit;
+    /**<   Session HEPE Limit.
+      - Units: Meters */
+} GnssEngineDebugDataInfo;
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */

+ 12 - 2
gps/utils/gps_extended_c.h

@@ -183,7 +183,12 @@ typedef enum {
     LOC_SUPPORTED_FEATURE_DSDA_CONFIGURATION,
     /**<  Support the Multiple Attribution Apps(UTH clients Lock control) feature   */
     LOC_SUPPORTED_FEATURE_MULTIPLE_ATTRIBUTION_APPS,
-    LOC_SUPPORTED_FEATURE_QMI_FLP_NLP_SOURCE, /**< Support the FLP, NLP Z-Source provider feature */
+    /**< Support the FLP, NLP Z-Source provider feature */
+    LOC_SUPPORTED_FEATURE_QMI_FLP_NLP_SOURCE,
+    /**< Support the feature to report engine debug data */
+    LOC_SUPPORTED_FEATURE_ENGINE_DEBUG_DATA,
+    /**< Support the feature to report feature update in QMI_LOC_EVENT_REPORT_IND */
+    LOC_SUPPORTED_FEATURE_DYNAMIC_FEATURE_STATUS
 } loc_supported_feature_enum;
 
 typedef struct {
@@ -1053,7 +1058,9 @@ enum loc_api_adapter_event_index {
     LOC_API_ADAPTER_LOC_SYSTEM_INFO,                   // Location system info event
     LOC_API_ADAPTER_GNSS_NHZ_MEASUREMENT_REPORT,       // GNSS SV nHz measurement report
     LOC_API_ADAPTER_EVENT_REPORT_INFO,                 // Event report info
-    LOC_API_ADAPTER_LATENCY_INFORMATION_REPORT,       // Latency information report
+    LOC_API_ADAPTER_LATENCY_INFORMATION_REPORT,        // Latency information report
+    LOC_API_ADAPTER_FEATURE_STATUS_UPDATE,             // Dynamic feature status update
+    LOC_API_ADAPTER_ENGINE_DEBUG_DATA_REPORT,         // Engine Debug data report
     LOC_API_ADAPTER_EVENT_MAX
 };
 
@@ -1097,6 +1104,9 @@ enum loc_api_adapter_event_index {
 #define LOC_API_ADAPTER_BIT_GNSS_NHZ_MEASUREMENT             (1ULL<<LOC_API_ADAPTER_GNSS_NHZ_MEASUREMENT_REPORT)
 #define LOC_API_ADAPTER_BIT_EVENT_REPORT_INFO                (1ULL<<LOC_API_ADAPTER_EVENT_REPORT_INFO)
 #define LOC_API_ADAPTER_BIT_LATENCY_INFORMATION              (1ULL<<LOC_API_ADAPTER_LATENCY_INFORMATION_REPORT)
+#define LOC_API_ADAPTER_BIT_FEATURE_STATUS_UPDATE            (1ULL<<LOC_API_ADAPTER_FEATURE_STATUS_UPDATE)
+#define LOC_API_ADAPTER_BIT_ENGINE_DEBUG_DATA_REPORT         (1ULL<<LOC_API_ADAPTER_ENGINE_DEBUG_DATA_REPORT)
+
 
 typedef uint64_t LOC_API_ADAPTER_EVENT_MASK_T;
 

+ 1 - 0
gps/utils/loc_nmea.cpp

@@ -865,6 +865,7 @@ static void loc_nmea_generate_GSV(const GnssSvNotification &svNotify,
             if ((sv_meta_p->svTypeMask & (1 << svNotify.gnssSvs[svNumber - 1].type)) &&
                     sv_meta_p->signalId == convert_signalType_to_signalId(signalType))
             {
+                svIdOffset = sv_meta_p->svIdOffset;
                 if (GNSS_SV_TYPE_SBAS == svNotify.gnssSvs[svNumber - 1].type) {
                     svIdOffset = SBAS_SV_ID_OFFSET;
                 }