msmcobalt: Update to 07.00.00.253.032
am: 5bea9589b6

Change-Id: Ice2244dfb2f453bb5a0a637e524be10018df4242
diff --git a/Android.mk b/Android.mk
index bd42fc3..46e9a1e 100644
--- a/Android.mk
+++ b/Android.mk
@@ -27,7 +27,7 @@
       endif #TARGET_BOARD_PLATFORM
 
     else
-      ifneq ($(filter msm8909 ,$(TARGET_BOARD_PLATFORM)),)
+      ifneq ($(filter msm8909 msm8226 ,$(TARGET_BOARD_PLATFORM)),)
         #For msm8909 target
         GPS_DIRS=msm8909/core msm8909/utils msm8909/loc_api msm8909/etc
         include $(call all-named-subdir-makefiles,$(GPS_DIRS))
diff --git a/msm8909/core/ContextBase.cpp b/msm8909/core/ContextBase.cpp
index 9f6c4aa..f8a6122 100644
--- a/msm8909/core/ContextBase.cpp
+++ b/msm8909/core/ContextBase.cpp
@@ -63,8 +63,9 @@
 {
     LocApiBase* locApi = NULL;
 
-    // first if can not be MPQ
-    if (TARGET_MPQ != loc_get_target()) {
+    // Check the target
+    if (TARGET_NO_GNSS != loc_get_target()){
+
         if (NULL == (locApi = mLBSProxy->getLocApi(mMsgTask, exMask, this))) {
             void *handle = NULL;
             //try to see if LocApiV02 is present
diff --git a/msm8909/core/ContextBase.h b/msm8909/core/ContextBase.h
index fe0b860..7ad7c8a 100644
--- a/msm8909/core/ContextBase.h
+++ b/msm8909/core/ContextBase.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2015, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011-2016, The Linux Foundation. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -58,14 +58,12 @@
     inline LocApiProxyBase* getLocApiProxy() { return mLocApiProxy; }
     inline bool hasAgpsExtendedCapabilities() { return mLBSProxy->hasAgpsExtendedCapabilities(); }
     inline bool hasCPIExtendedCapabilities() { return mLBSProxy->hasCPIExtendedCapabilities(); }
+    inline bool hasNativeXtraClient() { return mLBSProxy->hasNativeXtraClient(); }
     inline void modemPowerVote(bool power) const { return mLBSProxy->modemPowerVote(power); }
     inline void requestUlp(LocAdapterBase* adapter,
                            unsigned long capabilities) {
         mLBSProxy->requestUlp(adapter, capabilities);
     }
-    inline IzatDevId_t getIzatDevId() const {
-        return mLBSProxy->getIzatDevId();
-    }
     inline void sendMsg(const LocMsg *msg) { getMsgTask()->sendMsg(msg); }
 };
 
diff --git a/msm8909/core/LBSProxyBase.h b/msm8909/core/LBSProxyBase.h
index eda1b05..fa4e707 100644
--- a/msm8909/core/LBSProxyBase.h
+++ b/msm8909/core/LBSProxyBase.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2013-2016, The Linux Foundation. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -55,7 +55,7 @@
     inline virtual bool hasCPIExtendedCapabilities() const { return false; }
     inline virtual void modemPowerVote(bool power) const {}
     virtual void injectFeatureConfig(ContextBase* /* context */) const {}
-    inline virtual IzatDevId_t getIzatDevId() const { return 0; }
+    inline virtual bool hasNativeXtraClient() const { return false; }
 };
 
 typedef LBSProxyBase* (getLBSProxy_t)();
diff --git a/msm8909/core/LocAdapterBase.cpp b/msm8909/core/LocAdapterBase.cpp
index 4f6b9c5..0c81910 100644
--- a/msm8909/core/LocAdapterBase.cpp
+++ b/msm8909/core/LocAdapterBase.cpp
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011-2014,2016, The Linux Foundation. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -80,7 +80,7 @@
 }
 
 void LocAdapterBase::
-    reportSv(QtiGnssSvStatus &svStatus,
+    reportSv(GnssSvStatus &svStatus,
              GpsLocationExtended &locationExtended,
              void* svExt)
 DEFAULT_IMPL()
@@ -137,6 +137,6 @@
 DEFAULT_IMPL(false)
 
 void LocAdapterBase::
-    reportGpsMeasurementData(GpsData &gpsMeasurementData)
+    reportGnssMeasurementData(GnssData &gnssMeasurementData)
 DEFAULT_IMPL()
 } // namespace loc_core
diff --git a/msm8909/core/LocAdapterBase.h b/msm8909/core/LocAdapterBase.h
index 32e1408..226f9e1 100644
--- a/msm8909/core/LocAdapterBase.h
+++ b/msm8909/core/LocAdapterBase.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011-2014,2016, The Linux Foundation. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -92,7 +92,7 @@
                                 void* locationExt,
                                 enum loc_sess_status status,
                                 LocPosTechMask loc_technology_mask);
-    virtual void reportSv(QtiGnssSvStatus &svStatus,
+    virtual void reportSv(GnssSvStatus &svStatus,
                           GpsLocationExtended &locationExtended,
                           void* svExt);
     virtual void reportStatus(GpsStatusValue status);
@@ -111,7 +111,7 @@
                                  const void* data);
     inline virtual bool isInSession() { return false; }
     ContextBase* getContext() const { return mContext; }
-    virtual void reportGpsMeasurementData(GpsData &gpsMeasurementData);
+    virtual void reportGnssMeasurementData(GnssData &gnssMeasurementData);
 };
 
 } // namespace loc_core
diff --git a/msm8909/core/LocApiBase.cpp b/msm8909/core/LocApiBase.cpp
index c09439e..01aba47 100644
--- a/msm8909/core/LocApiBase.cpp
+++ b/msm8909/core/LocApiBase.cpp
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011-2014,2016, The Linux Foundation. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -253,24 +253,23 @@
     );
 }
 
-void LocApiBase::reportSv(QtiGnssSvStatus &svStatus,
+void LocApiBase::reportSv(GnssSvStatus &svStatus,
                   GpsLocationExtended &locationExtended,
                   void* svExt)
 {
     // print the SV info before delivering
-    LOC_LOGV("num sv: %d\n  ephemeris mask: %dxn  almanac mask: %x\n  gps/glo/bds in use"
-             " mask: %x/%x/%x\n      sv: prn         snr       elevation      azimuth",
-             svStatus.num_svs, svStatus.ephemeris_mask,
-             svStatus.almanac_mask, svStatus.gps_used_in_fix_mask,
-             svStatus.glo_used_in_fix_mask, svStatus.bds_used_in_fix_mask);
-    for (int i = 0; i < svStatus.num_svs && i < GPS_MAX_SVS; i++) {
-        LOC_LOGV("   %d:   %d    %f    %f    %f",
+    LOC_LOGV("num sv: %d", svStatus.num_svs);
+    for (int i = 0; i < svStatus.num_svs && i < GNSS_MAX_SVS; i++) {
+        LOC_LOGV("   %03d:   %02d    %d    %f    %f    %f   0x%02X",
                  i,
-                 svStatus.sv_list[i].prn,
-                 svStatus.sv_list[i].snr,
-                 svStatus.sv_list[i].elevation,
-                 svStatus.sv_list[i].azimuth);
+                svStatus.gnss_sv_list[i].svid,
+                svStatus.gnss_sv_list[i].constellation,
+                svStatus.gnss_sv_list[i].c_n0_dbhz,
+                svStatus.gnss_sv_list[i].elevation,
+                svStatus.gnss_sv_list[i].azimuth,
+                svStatus.gnss_sv_list[i].flags);
     }
+
     // loop through adapters, and deliver to all adapters.
     TO_ALL_LOCADAPTERS(
         mLocAdapters[i]->reportSv(svStatus,
@@ -364,10 +363,10 @@
 LocApiProxyBase* LocApiBase :: getLocApiProxy()
     DEFAULT_IMPL(NULL)
 
-void LocApiBase::reportGpsMeasurementData(GpsData &gpsMeasurementData)
+void LocApiBase::reportGnssMeasurementData(GnssData &gnssMeasurementData)
 {
     // loop through adapters, and deliver to all adapters.
-    TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportGpsMeasurementData(gpsMeasurementData));
+    TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportGnssMeasurementData(gnssMeasurementData));
 }
 
 enum loc_api_adapter_err LocApiBase::
diff --git a/msm8909/core/LocApiBase.h b/msm8909/core/LocApiBase.h
index d309d9f..adfbf3b 100644
--- a/msm8909/core/LocApiBase.h
+++ b/msm8909/core/LocApiBase.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011-2014,2016, The Linux Foundation. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -113,7 +113,7 @@
                         enum loc_sess_status status,
                         LocPosTechMask loc_technology_mask =
                                   LOC_POS_TECH_MASK_DEFAULT);
-    void reportSv(QtiGnssSvStatus &svStatus,
+    void reportSv(GnssSvStatus &svStatus,
                   GpsLocationExtended &locationExtended,
                   void* svExt);
     void reportStatus(GpsStatusValue status);
@@ -130,7 +130,7 @@
     void reportDataCallClosed();
     void requestNiNotify(GpsNiNotification &notify, const void* data);
     void saveSupportedMsgList(uint64_t supportedMsgList);
-    void reportGpsMeasurementData(GpsData &gpsMeasurementData);
+    void reportGnssMeasurementData(GnssData &gnssMeasurementData);
 
     // downward calls
     // All below functions are to be defined by adapter specific modules:
diff --git a/msm8909/core/UlpProxyBase.h b/msm8909/core/UlpProxyBase.h
index 46e9a00..e728d80 100644
--- a/msm8909/core/UlpProxyBase.h
+++ b/msm8909/core/UlpProxyBase.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2013-2016, The Linux Foundation. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -59,7 +59,7 @@
                                        LocPosTechMask /* loc_technology_mask */) {
         return false;
     }
-    inline virtual bool reportSv(QtiGnssSvStatus& /* svStatus */,
+    inline virtual bool reportSv(GnssSvStatus& /* svStatus */,
                                  GpsLocationExtended& /* locationExtended */,
                                  void* /* svExt */) {
         return false;
diff --git a/msm8909/core/gps_extended_c.h b/msm8909/core/gps_extended_c.h
index 054f645..9944db3 100644
--- a/msm8909/core/gps_extended_c.h
+++ b/msm8909/core/gps_extended_c.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2013-2016, The Linux Foundation. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -254,47 +254,6 @@
     LocReliability  vertical_reliability;
 } GpsLocationExtended;
 
-/** Represents SV status. */
-typedef struct {
-    /** set to sizeof(QtiGnssSvStatus) */
-    size_t          size;
-
-    /** Number of SVs currently visible. */
-    int         num_svs;
-
-    /** Contains an array of SV information. */
-    GpsSvInfo   sv_list[GPS_MAX_SVS];
-
-    /** Represents a bit mask indicating which SVs
-     * have ephemeris data.
-     */
-    uint32_t    ephemeris_mask;
-
-    /** Represents a bit mask indicating which SVs
-     * have almanac data.
-     */
-    uint32_t    almanac_mask;
-
-    /**
-     * Represents a bit mask indicating which GPS SVs
-     * were used for computing the most recent position fix.
-     */
-    uint32_t    gps_used_in_fix_mask;
-
-    /**
-     * Represents a bit mask indicating which GLONASS SVs
-     * were used for computing the most recent position fix.
-     */
-    uint32_t    glo_used_in_fix_mask;
-
-    /**
-     * Represents a bit mask indicating which BDS SVs
-     * were used for computing the most recent position fix.
-     */
-    uint64_t    bds_used_in_fix_mask;
-
-} QtiGnssSvStatus;
-
 enum loc_sess_status {
     LOC_SESS_SUCCESS,
     LOC_SESS_INTERMEDIATE,
@@ -423,8 +382,6 @@
     LOC_API_ADAPTER_MESSAGE_MAX
 } LocCheckingMessagesID;
 
-typedef int IzatDevId_t;
-
 typedef uint32_t LOC_GPS_LOCK_MASK;
 #define isGpsLockNone(lock) ((lock) == 0)
 #define isGpsLockMO(lock) ((lock) & ((LOC_GPS_LOCK_MASK)1))
diff --git a/msm8909/etc/gps.conf b/msm8909/etc/gps.conf
index 7eabb78..b52ea11 100644
--- a/msm8909/etc/gps.conf
+++ b/msm8909/etc/gps.conf
@@ -16,14 +16,8 @@
 # _CLEAR = 0
 ERR_ESTIMATE=0
 
-#Test
-NTP_SERVER=time.gpsonextra.net
-#Asia
-# NTP_SERVER=asia.pool.ntp.org
-#Europe
-# NTP_SERVER=europe.pool.ntp.org
-#North America
-# NTP_SERVER=north-america.pool.ntp.org
+#NTP server
+NTP_SERVER=time.izatcloud.net
 
 # DEBUG LEVELS: 0 - none, 1 - Error, 2 - Warning, 3 - Info
 #               4 - Debug, 5 - Verbose
diff --git a/msm8909/loc_api/libloc_api_50001/Android.mk b/msm8909/loc_api/libloc_api_50001/Android.mk
index 8f7fca8..17f80db 100644
--- a/msm8909/loc_api/libloc_api_50001/Android.mk
+++ b/msm8909/loc_api/libloc_api_50001/Android.mk
@@ -89,6 +89,10 @@
     -fno-short-enums \
     -D_ANDROID_ \
 
+ifeq ($(TARGET_BUILD_VARIANT),user)
+   LOCAL_CFLAGS += -DTARGET_BUILD_VARIANT_USER
+endif
+
 ifeq ($(TARGET_USES_QCOM_BSP), true)
 LOCAL_CFLAGS += -DTARGET_USES_QCOM_BSP
 endif
diff --git a/msm8909/loc_api/libloc_api_50001/LocEngAdapter.cpp b/msm8909/loc_api/libloc_api_50001/LocEngAdapter.cpp
index aaa2c7b..49d467a 100644
--- a/msm8909/loc_api/libloc_api_50001/LocEngAdapter.cpp
+++ b/msm8909/loc_api/libloc_api_50001/LocEngAdapter.cpp
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2015, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011-2016, The Linux Foundation. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -29,17 +29,11 @@
 #define LOG_NDDEBUG 0
 #define LOG_TAG "LocSvc_EngAdapter"
 
-#include <sys/stat.h>
-#include <errno.h>
-#include <ctype.h>
 #include <cutils/properties.h>
 #include <LocEngAdapter.h>
 #include "loc_eng_msg.h"
 #include "loc_log.h"
 
-#define CHIPSET_SERIAL_NUMBER_MAX_LEN 16
-#define USER_AGENT_MAX_LEN 512
-
 using namespace loc_core;
 
 LocInternalAdapter::LocInternalAdapter(LocEngAdapter* adapter) :
@@ -91,173 +85,6 @@
     LOC_LOGV("LocEngAdapter deleted");
 }
 
-void LocEngAdapter::setXtraUserAgent() {
-    struct LocSetXtraUserAgent : public LocMsg {
-        const ContextBase* const mContext;
-        inline LocSetXtraUserAgent(ContextBase* context) :
-            LocMsg(), mContext(context) {
-        }
-        virtual void proc() const {
-            char release[PROPERTY_VALUE_MAX];
-            char manufacture[PROPERTY_VALUE_MAX];
-            char model[PROPERTY_VALUE_MAX];
-            char board[PROPERTY_VALUE_MAX];
-            char brand[PROPERTY_VALUE_MAX];
-            char chipsetsn[CHIPSET_SERIAL_NUMBER_MAX_LEN];
-            char userAgent[USER_AGENT_MAX_LEN];
-            const char defVal[] = "-";
-
-            property_get("ro.build.version.release", release,     defVal);
-            property_get("ro.product.manufacturer",  manufacture, defVal);
-            property_get("ro.product.model", model,   defVal);
-            property_get("ro.product.board", board,   defVal);
-            property_get("ro.product.brand", brand,   defVal);
-            getChipsetSerialNo(chipsetsn, sizeof(chipsetsn), defVal);
-
-            encodeInPlace(release, PROPERTY_VALUE_MAX);
-            encodeInPlace(manufacture, PROPERTY_VALUE_MAX);
-            encodeInPlace(model, PROPERTY_VALUE_MAX);
-            encodeInPlace(board, PROPERTY_VALUE_MAX);
-            encodeInPlace(brand, PROPERTY_VALUE_MAX);
-
-            snprintf(userAgent, sizeof(userAgent), "A/%s/%s/%s/%s/-/QCX3/s%u/-/%s/-/%s/-/-/-",
-                     release, manufacture, model, board,
-                     mContext->getIzatDevId(), chipsetsn, brand);
-
-            for (int i = 0; i < sizeof(userAgent) && userAgent[i]; i++) {
-                if (' ' == userAgent[i]) userAgent[i] = '#';
-            }
-
-            saveUserAgentString(userAgent, strlen(userAgent));
-            LOC_LOGV("%s] UserAgent %s", __func__, userAgent);
-        }
-
-        void saveUserAgentString(const char* data, const int len) const {
-            const char XTRA_FOLDER[] = "/data/misc/location/xtra";
-            const char USER_AGENT_FILE[] = "/data/misc/location/xtra/useragent.txt";
-
-            if (data == NULL || len < 1) {
-                LOC_LOGE("%s:%d]: invalid input data = %p len = %d", __func__, __LINE__, data, len);
-                return;
-            }
-
-            struct stat s;
-            int err = stat(XTRA_FOLDER, &s);
-            if (err < 0) {
-                if (ENOENT == errno) {
-                    if (mkdir(XTRA_FOLDER, 0700) < 0) {
-                        LOC_LOGE("%s:%d]: make XTRA_FOLDER failed", __func__, __LINE__);
-                        return;
-                    }
-                } else {
-                    LOC_LOGE("%s:%d]: XTRA_FOLDER invalid", __func__, __LINE__);
-                    return;
-                }
-            }
-
-            FILE* file = fopen(USER_AGENT_FILE, "wt");
-            if (file == NULL) {
-                LOC_LOGE("%s:%d]: open USER_AGENT_FILE failed", __func__, __LINE__);
-                return;
-            }
-
-            size_t written = fwrite(data, 1, len, file);
-            fclose(file);
-            file = NULL;
-
-            // set file permission
-            chmod(USER_AGENT_FILE, 0600);
-
-            if (written != len) {
-                LOC_LOGE("%s:%d]: write USER_AGENT_FILE failed", __func__, __LINE__);
-            }
-        }
-
-        void getChipsetSerialNo(char buf[], int buflen, const char def[]) const {
-            const char SOC_SERIAL_NUMBER[] = "/sys/devices/soc0/serial_number";
-
-            FILE* file = fopen(SOC_SERIAL_NUMBER, "rt");
-            if (file == NULL) {
-                // use default upon unreadable file
-                strlcpy(buf, def, buflen);
-
-            } else {
-                size_t size = fread(buf, 1, buflen - 1, file);
-                if (size == 0) {
-                   // use default upon empty file
-                   strlcpy(buf, def, buflen);
-
-                } else {
-                   buf[size] = '\0';
-                }
-
-                fclose(file);
-
-                // remove trailing spaces
-                int len = strlen(buf);
-                while (--len >= 0 && isspace(buf[len])) {
-                    buf[len] = '\0';
-                }
-            }
-
-            return;
-        }
-
-        /**
-         *  encode the given string value such that all separator characters ('/','+','|','%')
-         *  in the string are repaced by their corresponding encodings (%2F","%2B","%7C", "%25")
-         */
-        static void encodeInPlace(char value[], const int size) {
-            char buffer[size];
-
-            struct ENCODE {
-                const char ch;
-                const char *code;
-            };
-
-            const ENCODE encodings[] = { {'/', "%2F"}, {'+', "%2B"}, {'|', "%7C",}, {'%', "%25"} };
-            const int nencodings = (int)sizeof(encodings) / sizeof(encodings[0]);
-
-            int inpos = 0, outpos = 0;
-            while(value[inpos] != '\0' && outpos < size - 1) {
-                // check if escaped character
-                int escchar = 0;
-                while(escchar < nencodings && encodings[escchar].ch != value[inpos]) {
-                    escchar++;
-                }
-
-                if (escchar == nencodings) {
-                    // non escaped character
-                    buffer[outpos++] = value[inpos++];
-                    continue;
-                }
-
-                // escaped character
-                int codepos = 0;
-                #define NUM_CHARS_IN_CODE 3
-
-                if (outpos + NUM_CHARS_IN_CODE >= size) {
-                    // skip last character if there is insufficient space
-                    break;
-                }
-
-                while(outpos < size - 1 && codepos < NUM_CHARS_IN_CODE) {
-                    buffer[outpos++] = encodings[escchar].code[codepos++];
-                }
-                inpos++;
-            }
-
-            // copy to ouput
-            value[outpos] = '\0';
-            while(--outpos >= 0) {
-                value[outpos] = buffer[outpos];
-            }
-        }
-    };
-
-    sendMsg(new LocSetXtraUserAgent(mContext));
-}
-
 void LocInternalAdapter::setUlpProxy(UlpProxyBase* ulp) {
     struct LocSetUlpProxy : public LocMsg {
         LocAdapterBase* mAdapter;
@@ -375,14 +202,14 @@
     }
 }
 
-void LocInternalAdapter::reportSv(QtiGnssSvStatus &svStatus,
+void LocInternalAdapter::reportSv(GnssSvStatus &svStatus,
                                   GpsLocationExtended &locationExtended,
                                   void* svExt){
     sendMsg(new LocEngReportSv(mLocEngAdapter, svStatus,
                                locationExtended, svExt));
 }
 
-void LocEngAdapter::reportSv(QtiGnssSvStatus &svStatus,
+void LocEngAdapter::reportSv(GnssSvStatus &svStatus,
                              GpsLocationExtended &locationExtended,
                              void* svExt)
 {
@@ -532,8 +359,6 @@
     if (mSupportsTimeInjection) {
         LOC_LOGD("%s:%d]: Injecting time", __func__, __LINE__);
         result = mLocApi->setTime(time, timeReference, uncertainty);
-    } else {
-        mSupportsTimeInjection = true;
     }
     return result;
 }
@@ -564,10 +389,10 @@
     return ret;
 }
 
-void LocEngAdapter::reportGpsMeasurementData(GpsData &gpsMeasurementData)
+void LocEngAdapter::reportGnssMeasurementData(GnssData &gnssMeasurementData)
 {
-    sendMsg(new LocEngReportGpsMeasurement(mOwner,
-                                           gpsMeasurementData));
+    sendMsg(new LocEngReportGnssMeasurement(mOwner,
+                                           gnssMeasurementData));
 }
 
 /*
diff --git a/msm8909/loc_api/libloc_api_50001/LocEngAdapter.h b/msm8909/loc_api/libloc_api_50001/LocEngAdapter.h
index d6295d1..6666860 100644
--- a/msm8909/loc_api/libloc_api_50001/LocEngAdapter.h
+++ b/msm8909/loc_api/libloc_api_50001/LocEngAdapter.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2015, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011-2016, The Linux Foundation. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -55,7 +55,7 @@
                                 void* locationExt,
                                 enum loc_sess_status status,
                                 LocPosTechMask loc_technology_mask);
-    virtual void reportSv(QtiGnssSvStatus &svStatus,
+    virtual void reportSv(GnssSvStatus &svStatus,
                           GpsLocationExtended &locationExtended,
                           void* svExt);
     virtual void reportStatus(GpsStatusValue status);
@@ -85,6 +85,7 @@
     bool mSupportsAgpsRequests;
     bool mSupportsPositionInjection;
     bool mSupportsTimeInjection;
+    GnssSystemInfo mGnssInfo;
 
     LocEngAdapter(LOC_API_ADAPTER_EVENT_MASK_T mask,
                   void* owner, ContextBase* context,
@@ -105,6 +106,9 @@
     inline bool hasCPIExtendedCapabilities() {
         return mContext->hasCPIExtendedCapabilities();
     }
+    inline bool hasNativeXtraClient() {
+        return mContext->hasNativeXtraClient();
+    }
     inline const MsgTask* getMsgTask() { return mMsgTask; }
 
     inline enum loc_api_adapter_err
@@ -269,7 +273,7 @@
                                 void* locationExt,
                                 enum loc_sess_status status,
                                 LocPosTechMask loc_technology_mask);
-    virtual void reportSv(QtiGnssSvStatus &svStatus,
+    virtual void reportSv(GnssSvStatus &svStatus,
                           GpsLocationExtended &locationExtended,
                           void* svExt);
     virtual void reportStatus(GpsStatusValue status);
@@ -284,7 +288,7 @@
     virtual bool requestSuplES(int connHandle);
     virtual bool reportDataCallOpened();
     virtual bool reportDataCallClosed();
-    virtual void reportGpsMeasurementData(GpsData &gpsMeasurementData);
+    virtual void reportGnssMeasurementData(GnssData &gnssMeasurementData);
 
     inline const LocPosMode& getPositionMode() const
     {return mFixCriteria;}
diff --git a/msm8909/loc_api/libloc_api_50001/loc.cpp b/msm8909/loc_api/libloc_api_50001/loc.cpp
index b9ef3fc..6252097 100644
--- a/msm8909/loc_api/libloc_api_50001/loc.cpp
+++ b/msm8909/loc_api/libloc_api_50001/loc.cpp
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2015, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011-2016, The Linux Foundation. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -285,6 +285,7 @@
     }
 
     event = LOC_API_ADAPTER_BIT_PARSED_POSITION_REPORT |
+            LOC_API_ADAPTER_BIT_GNSS_MEASUREMENT |
             LOC_API_ADAPTER_BIT_SATELLITE_REPORT |
             LOC_API_ADAPTER_BIT_LOCATION_SERVER_REQUEST |
             LOC_API_ADAPTER_BIT_ASSISTANCE_DATA_REQUEST |
@@ -304,6 +305,8 @@
                                     NULL, /* location_ext_parser */
                                     NULL, /* sv_ext_parser */
                                     callbacks->request_utc_time_cb, /* request_utc_time_cb */
+                                    callbacks->set_system_info_cb, /* set_system_info_cb */
+                                    callbacks->gnss_sv_status_cb, /* gnss_sv_status_cb */
                                     };
 
     gps_loc_cb = callbacks->location_cb;
@@ -312,10 +315,10 @@
     retVal = loc_eng_init(loc_afw_data, &clientCallbacks, event, NULL);
     loc_afw_data.adapter->mSupportsAgpsRequests = !loc_afw_data.adapter->hasAgpsExtendedCapabilities();
     loc_afw_data.adapter->mSupportsPositionInjection = !loc_afw_data.adapter->hasCPIExtendedCapabilities();
-    loc_afw_data.adapter->mSupportsTimeInjection = !loc_afw_data.adapter->hasCPIExtendedCapabilities();
+    loc_afw_data.adapter->mSupportsTimeInjection = !loc_afw_data.adapter->hasCPIExtendedCapabilities()
+                                                   && !loc_afw_data.adapter->hasNativeXtraClient();
     loc_afw_data.adapter->setGpsLockMsg(0);
     loc_afw_data.adapter->requestUlp(getCarrierCapabilities());
-    loc_afw_data.adapter->setXtraUserAgent();
 
     if(retVal) {
         LOC_LOGE("loc_eng_init() fail!");
@@ -538,7 +541,10 @@
 static void loc_delete_aiding_data(GpsAidingData f)
 {
     ENTRY_LOG();
+
+#ifndef TARGET_BUILD_VARIANT_USER
     loc_eng_delete_aiding_data(loc_afw_data, f);
+#endif
 
     EXIT_LOG(%s, VOID_RET);
 }
diff --git a/msm8909/loc_api/libloc_api_50001/loc.h b/msm8909/loc_api/libloc_api_50001/loc.h
index e56fdcf..04a7b61 100644
--- a/msm8909/loc_api/libloc_api_50001/loc.h
+++ b/msm8909/loc_api/libloc_api_50001/loc.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011,2014 The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011,2014,2016 The Linux Foundation. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -57,6 +57,8 @@
     loc_ext_parser location_ext_parser;
     loc_ext_parser sv_ext_parser;
     gps_request_utc_time request_utc_time_cb;
+    gnss_set_system_info set_system_info_cb;
+    gnss_sv_status_callback gnss_sv_status_cb;
 } LocCallbacks;
 
 #ifdef __cplusplus
diff --git a/msm8909/loc_api/libloc_api_50001/loc_eng.cpp b/msm8909/loc_api/libloc_api_50001/loc_eng.cpp
index f44dd72..60f56a1 100644
--- a/msm8909/loc_api/libloc_api_50001/loc_eng.cpp
+++ b/msm8909/loc_api/libloc_api_50001/loc_eng.cpp
@@ -1,4 +1,4 @@
-/* Copyright (c) 2009-2015, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2009-2016, The Linux Foundation. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -828,7 +828,7 @@
 
 //        case LOC_ENG_MSG_REPORT_SV:
 LocEngReportSv::LocEngReportSv(LocAdapterBase* adapter,
-                               QtiGnssSvStatus &sv,
+                               GnssSvStatus &sv,
                                GpsLocationExtended &locExtended,
                                void* svExt) :
     LocMsg(), mAdapter(adapter), mSvStatus(sv),
@@ -845,9 +845,9 @@
 
     if (locEng->mute_session_state != LOC_MUTE_SESS_IN_SESSION)
     {
-        if (locEng->sv_status_cb != NULL) {
-            locEng->sv_status_cb((GpsSvStatus*)&(mSvStatus),
-                                 (void*)mSvExt);
+        if (locEng->gnss_sv_status_cb != NULL) {
+            LOC_LOGE("Calling gnss_sv_status_cb");
+            locEng->gnss_sv_status_cb((GnssSvStatus*)&(mSvStatus));
         }
 
         if (locEng->generateNmea)
@@ -1376,6 +1376,33 @@
     }
 };
 
+struct LocEngSetSystemInfo : public LocMsg {
+    loc_eng_data_s_type* mLocEng;
+    inline LocEngSetSystemInfo(loc_eng_data_s_type* locEng) :
+        LocMsg(), mLocEng(locEng)
+    {
+        locallog();
+    }
+    inline virtual void proc() const {
+        if (NULL != mLocEng->set_capabilities_cb) {
+            LOC_LOGV("calling set_system_info_cb 0x%x",
+                mLocEng->adapter->mGnssInfo.year_of_hw);
+            mLocEng->set_system_info_cb(&(mLocEng->adapter->mGnssInfo));
+        }
+        else {
+            LOC_LOGV("set_system_info_cb is NULL.\n");
+        }
+    }
+    inline void locallog() const
+    {
+        LOC_LOGV("LocEngSetSystemInfo");
+    }
+    inline virtual void log() const
+    {
+        locallog();
+    }
+};
+
 //        case LOC_ENG_MSG_LOC_INIT:
 struct LocEngInit : public LocMsg {
     loc_eng_data_s_type* mLocEng;
@@ -1388,6 +1415,7 @@
         loc_eng_reinit(*mLocEng);
         // set the capabilities
         mLocEng->adapter->sendMsg(new LocEngSetCapabilities(mLocEng));
+        mLocEng->adapter->sendMsg(new LocEngSetSystemInfo(mLocEng));
     }
     inline void locallog() const
     {
@@ -1607,10 +1635,13 @@
         locallog();
     }
     inline virtual void proc() const {
+        mAdapter->mGnssInfo.size = sizeof(GnssSystemInfo);
         if (mAdapter->gnssConstellationConfig()) {
             LOC_LOGV("Modem supports GNSS measurements\n");
             gps_conf.CAPABILITIES |= GPS_CAPABILITY_MEASUREMENTS;
+            mAdapter->mGnssInfo.year_of_hw = 2016;
         } else {
+            mAdapter->mGnssInfo.year_of_hw = 2015;
             LOC_LOGV("Modem does not support GNSS measurements\n");
         }
     }
@@ -1623,50 +1654,61 @@
 };
 
 //        case LOC_ENG_MSG_REPORT_GNSS_MEASUREMENT:
-LocEngReportGpsMeasurement::LocEngReportGpsMeasurement(void* locEng,
-                                                       GpsData &gpsData) :
-    LocMsg(), mLocEng(locEng), mGpsData(gpsData)
+LocEngReportGnssMeasurement::LocEngReportGnssMeasurement(void* locEng,
+                                                       GnssData &gnssData) :
+    LocMsg(), mLocEng(locEng), mGnssData(gnssData)
 {
     locallog();
 }
-void LocEngReportGpsMeasurement::proc() const {
+void LocEngReportGnssMeasurement::proc() const {
     loc_eng_data_s_type* locEng = (loc_eng_data_s_type*) mLocEng;
     if (locEng->mute_session_state != LOC_MUTE_SESS_IN_SESSION)
     {
-        if (locEng->gps_measurement_cb != NULL) {
-            locEng->gps_measurement_cb((GpsData*)&(mGpsData));
+        if (locEng->gnss_measurement_cb != NULL) {
+            LOC_LOGV("Calling gnss_measurement_cb");
+            locEng->gnss_measurement_cb((GnssData*)&(mGnssData));
         }
     }
 }
-void LocEngReportGpsMeasurement::locallog() const {
+
+void LocEngReportGnssMeasurement::locallog() const {
     IF_LOC_LOGV {
         LOC_LOGV("%s:%d]: Received in GPS HAL."
                  "GNSS Measurements count: %d \n",
-                 __func__, __LINE__, mGpsData.measurement_count);
-        for (int i =0; i< mGpsData.measurement_count && i < GPS_MAX_SVS; i++) {
+                 __func__, __LINE__, mGnssData.measurement_count);
+        for (int i =0; i< mGnssData.measurement_count && i < GNSS_MAX_SVS; i++) {
                 LOC_LOGV(" GNSS measurement data in GPS HAL: \n"
-                         " GPS_HAL => Measurement ID | prn | time_offset_ns | state |"
-                         " received_gps_tow_ns| c_n0_dbhz | pseudorange_rate_mps |"
+                         " GPS_HAL => Measurement ID | svid | time_offset_ns | state |"
+                         " c_n0_dbhz | pseudorange_rate_mps |"
                          " pseudorange_rate_uncertainty_mps |"
                          " accumulated_delta_range_state | flags \n"
-                         " GPS_HAL => %d | %d | %f | %d | %lld | %f | %f | %f | %d | %d \n",
+                         " GPS_HAL => %d | %d | %f | %d | %f | %f | %f | %d | %d \n",
                          i,
-                         mGpsData.measurements[i].prn,
-                         mGpsData.measurements[i].time_offset_ns,
-                         mGpsData.measurements[i].state,
-                         mGpsData.measurements[i].received_gps_tow_ns,
-                         mGpsData.measurements[i].c_n0_dbhz,
-                         mGpsData.measurements[i].pseudorange_rate_mps,
-                         mGpsData.measurements[i].pseudorange_rate_uncertainty_mps,
-                         mGpsData.measurements[i].accumulated_delta_range_state,
-                         mGpsData.measurements[i].flags);
+                         mGnssData.measurements[i].svid,
+                         mGnssData.measurements[i].time_offset_ns,
+                         mGnssData.measurements[i].state,
+                         mGnssData.measurements[i].c_n0_dbhz,
+                         mGnssData.measurements[i].pseudorange_rate_mps,
+                         mGnssData.measurements[i].pseudorange_rate_uncertainty_mps,
+                         mGnssData.measurements[i].accumulated_delta_range_state,
+                         mGnssData.measurements[i].flags);
         }
-        LOC_LOGV(" GPS_HAL => Clocks Info: type | time_ns \n"
-                 " GPS_HAL => Clocks Info: %d | %lld", mGpsData.clock.type,
-                 mGpsData.clock.time_ns);
+        LOC_LOGV(" GPS_HAL => Clocks Info: \n"
+                 " time_ns | full_bias_ns | bias_ns | bias_uncertainty_ns | "
+                 " drift_nsps | drift_uncertainty_nsps | hw_clock_discontinuity_count | flags"
+                 " GPS_HAL => Clocks Info: %lld | %lld | %g | %g | %g | %g | %d | 0x%04x\n",
+            mGnssData.clock.time_ns,
+            mGnssData.clock.full_bias_ns,
+            mGnssData.clock.bias_ns,
+            mGnssData.clock.bias_uncertainty_ns,
+            mGnssData.clock.drift_nsps,
+            mGnssData.clock.drift_uncertainty_nsps,
+            mGnssData.clock.hw_clock_discontinuity_count,
+            mGnssData.clock.flags);
     }
 }
-inline void LocEngReportGpsMeasurement::log() const {
+
+inline void LocEngReportGnssMeasurement::log() const {
     locallog();
 }
 
@@ -1746,6 +1788,8 @@
     loc_eng_data.acquire_wakelock_cb = callbacks->acquire_wakelock_cb;
     loc_eng_data.release_wakelock_cb = callbacks->release_wakelock_cb;
     loc_eng_data.request_utc_time_cb = callbacks->request_utc_time_cb;
+    loc_eng_data.set_system_info_cb = callbacks->set_system_info_cb;
+    loc_eng_data.gnss_sv_status_cb = callbacks->gnss_sv_status_cb;
     loc_eng_data.location_ext_parser = callbacks->location_ext_parser ?
         callbacks->location_ext_parser : noProc;
     loc_eng_data.sv_ext_parser = callbacks->sv_ext_parser ?
@@ -1770,6 +1814,8 @@
         new LocEngAdapter(event, &loc_eng_data, context,
                           (LocThread::tCreate)callbacks->create_thread_cb);
 
+    loc_eng_data.adapter->mGnssInfo.size = sizeof(GnssSystemInfo);
+    loc_eng_data.adapter->mGnssInfo.year_of_hw = 2015;
     LOC_LOGD("loc_eng_init created client, id = %p\n",
              loc_eng_data.adapter);
     loc_eng_data.adapter->sendMsg(new LocEngInit(&loc_eng_data));
@@ -2941,8 +2987,8 @@
 {
     ENTRY_LOG_CALLFLOW();
 
-    STATE_CHECK((NULL == loc_eng_data.gps_measurement_cb),
-                "gps measurement already initialized",
+    STATE_CHECK((NULL == loc_eng_data.gnss_measurement_cb),
+                "gnss measurement already initialized",
                 return GPS_MEASUREMENT_ERROR_ALREADY_INIT);
     STATE_CHECK((callbacks != NULL),
                 "callbacks can not be NULL",
@@ -2958,7 +3004,7 @@
                                                         event,
                                                         LOC_REGISTRATION_MASK_ENABLED));
     // set up the callback
-    loc_eng_data.gps_measurement_cb = callbacks->measurement_callback;
+    loc_eng_data.gnss_measurement_cb = callbacks->gnss_measurement_callback;
     LOC_LOGD ("%s, event masks updated successfully", __func__);
 
     return GPS_MEASUREMENT_OPERATION_SUCCESS;
@@ -2993,6 +3039,6 @@
                                                           event,
                                                           LOC_REGISTRATION_MASK_DISABLED));
     // set up the callback
-    loc_eng_data.gps_measurement_cb = NULL;
+    loc_eng_data.gnss_measurement_cb = NULL;
     EXIT_LOG(%d, 0);
 }
diff --git a/msm8909/loc_api/libloc_api_50001/loc_eng.h b/msm8909/loc_api/libloc_api_50001/loc_eng.h
index a203e6b..6502c5d 100644
--- a/msm8909/loc_api/libloc_api_50001/loc_eng.h
+++ b/msm8909/loc_api/libloc_api_50001/loc_eng.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2009-2014, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2009-2014,2016, The Linux Foundation. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -94,7 +94,9 @@
     gps_acquire_wakelock           acquire_wakelock_cb;
     gps_release_wakelock           release_wakelock_cb;
     gps_request_utc_time           request_utc_time_cb;
-    gps_measurement_callback       gps_measurement_cb;
+    gnss_set_system_info           set_system_info_cb;
+    gnss_sv_status_callback        gnss_sv_status_cb;
+    gnss_measurement_callback      gnss_measurement_cb;
     boolean                        intermediateFix;
     AGpsStatusValue                agps_status;
     loc_eng_xtra_data_s_type       xtra_module_data;
diff --git a/msm8909/loc_api/libloc_api_50001/loc_eng_msg.h b/msm8909/loc_api/libloc_api_50001/loc_eng_msg.h
index 31cf950..00ed48e 100644
--- a/msm8909/loc_api/libloc_api_50001/loc_eng_msg.h
+++ b/msm8909/loc_api/libloc_api_50001/loc_eng_msg.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011-2013,2016, The Linux Foundation. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -105,11 +105,11 @@
 
 struct LocEngReportSv : public LocMsg {
     LocAdapterBase* mAdapter;
-    const QtiGnssSvStatus mSvStatus;
+    const GnssSvStatus mSvStatus;
     const GpsLocationExtended mLocationExtended;
     const void* mSvExt;
     LocEngReportSv(LocAdapterBase* adapter,
-                   QtiGnssSvStatus &sv,
+                   GnssSvStatus &sv,
                    GpsLocationExtended &locExtended,
                    void* svExtended);
     virtual void proc() const;
@@ -289,11 +289,11 @@
     void send() const;
 };
 
-struct LocEngReportGpsMeasurement : public LocMsg {
+struct LocEngReportGnssMeasurement : public LocMsg {
     void* mLocEng;
-    const GpsData mGpsData;
-    LocEngReportGpsMeasurement(void* locEng,
-                               GpsData &gpsData);
+    const GnssData mGnssData;
+    LocEngReportGnssMeasurement(void* locEng,
+                               GnssData &gnssData);
     virtual void proc() const;
     void locallog() const;
     virtual void log() const;
diff --git a/msm8909/loc_api/libloc_api_50001/loc_eng_nmea.cpp b/msm8909/loc_api/libloc_api_50001/loc_eng_nmea.cpp
index 9ed0053..700f325 100644
--- a/msm8909/loc_api/libloc_api_50001/loc_eng_nmea.cpp
+++ b/msm8909/loc_api/libloc_api_50001/loc_eng_nmea.cpp
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2012,2016, The Linux Foundation. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -29,10 +29,6 @@
 
 #define LOG_NDDEBUG 0
 #define LOG_TAG "LocSvc_eng_nmea"
-#define GPS_PRN_START 1
-#define GPS_PRN_END   32
-#define GLONASS_PRN_START 65
-#define GLONASS_PRN_END   96
 #include <loc_eng.h>
 #include <loc_eng_nmea.h>
 #include <math.h>
@@ -603,7 +599,7 @@
 
 ===========================================================================*/
 void loc_eng_nmea_generate_sv(loc_eng_data_s_type *loc_eng_data_p,
-                              const QtiGnssSvStatus &svStatus, const GpsLocationExtended &locationExtended)
+                              const GnssSvStatus &svStatus, const GpsLocationExtended &locationExtended)
 {
     ENTRY_LOG();
 
@@ -619,15 +615,19 @@
     int glnCount = 0;
 
     //Count GPS SVs for saparating GPS from GLONASS and throw others
-
+    loc_eng_data_p->sv_used_mask = 0;
     for(svNumber=1; svNumber <= svCount; svNumber++) {
-        if( (svStatus.sv_list[svNumber-1].prn >= GPS_PRN_START)&&
-            (svStatus.sv_list[svNumber-1].prn <= GPS_PRN_END) )
+        if (GNSS_CONSTELLATION_GPS == svStatus.gnss_sv_list[svNumber - 1].constellation)
         {
+            // cache the used in fix mask, as it will be needed to send $GPGSA
+            // during the position report
+            if (GNSS_SV_FLAGS_USED_IN_FIX == (svStatus.gnss_sv_list[svNumber - 1].flags & GNSS_SV_FLAGS_USED_IN_FIX))
+            {
+                loc_eng_data_p->sv_used_mask |= (1 << (svStatus.gnss_sv_list[svNumber - 1].svid - 1));
+            }
             gpsCount++;
         }
-        else if( (svStatus.sv_list[svNumber-1].prn >= GLONASS_PRN_START) &&
-                 (svStatus.sv_list[svNumber-1].prn <= GLONASS_PRN_END) )
+        else if (GNSS_CONSTELLATION_GLONASS == svStatus.gnss_sv_list[svNumber - 1].constellation)
         {
             glnCount++;
         }
@@ -668,13 +668,12 @@
 
             for (int i=0; (svNumber <= svCount) && (i < 4);  svNumber++)
             {
-                if( (svStatus.sv_list[svNumber-1].prn >= GPS_PRN_START) &&
-                    (svStatus.sv_list[svNumber-1].prn <= GPS_PRN_END) )
+                if (GNSS_CONSTELLATION_GPS == svStatus.gnss_sv_list[svNumber - 1].constellation)
                 {
                     length = snprintf(pMarker, lengthRemaining,",%02d,%02d,%03d,",
-                                  svStatus.sv_list[svNumber-1].prn,
-                                  (int)(0.5 + svStatus.sv_list[svNumber-1].elevation), //float to int
-                                  (int)(0.5 + svStatus.sv_list[svNumber-1].azimuth)); //float to int
+                                      svStatus.gnss_sv_list[svNumber-1].svid,
+                                      (int)(0.5 + svStatus.gnss_sv_list[svNumber-1].elevation), //float to int
+                                      (int)(0.5 + svStatus.gnss_sv_list[svNumber-1].azimuth)); //float to int
 
                     if (length < 0 || length >= lengthRemaining)
                     {
@@ -684,10 +683,10 @@
                     pMarker += length;
                     lengthRemaining -= length;
 
-                    if (svStatus.sv_list[svNumber-1].snr > 0)
+                    if (svStatus.gnss_sv_list[svNumber-1].c_n0_dbhz > 0)
                     {
                         length = snprintf(pMarker, lengthRemaining,"%02d",
-                                         (int)(0.5 + svStatus.sv_list[svNumber-1].snr)); //float to int
+                                         (int)(0.5 + svStatus.gnss_sv_list[svNumber-1].c_n0_dbhz)); //float to int
 
                         if (length < 0 || length >= lengthRemaining)
                         {
@@ -746,13 +745,13 @@
 
             for (int i=0; (svNumber <= svCount) && (i < 4);  svNumber++)
             {
-                if( (svStatus.sv_list[svNumber-1].prn >= GLONASS_PRN_START) &&
-                    (svStatus.sv_list[svNumber-1].prn <= GLONASS_PRN_END) )      {
+                if (GNSS_CONSTELLATION_GLONASS == svStatus.gnss_sv_list[svNumber - 1].constellation)
+                {
 
                     length = snprintf(pMarker, lengthRemaining,",%02d,%02d,%03d,",
-                                  svStatus.sv_list[svNumber-1].prn,
-                                  (int)(0.5 + svStatus.sv_list[svNumber-1].elevation), //float to int
-                                  (int)(0.5 + svStatus.sv_list[svNumber-1].azimuth)); //float to int
+                        svStatus.gnss_sv_list[svNumber - 1].svid,
+                        (int)(0.5 + svStatus.gnss_sv_list[svNumber - 1].elevation), //float to int
+                        (int)(0.5 + svStatus.gnss_sv_list[svNumber - 1].azimuth)); //float to int
 
                     if (length < 0 || length >= lengthRemaining)
                     {
@@ -762,10 +761,10 @@
                     pMarker += length;
                     lengthRemaining -= length;
 
-                    if (svStatus.sv_list[svNumber-1].snr > 0)
+                    if (svStatus.gnss_sv_list[svNumber - 1].c_n0_dbhz > 0)
                     {
                         length = snprintf(pMarker, lengthRemaining,"%02d",
-                                         (int)(0.5 + svStatus.sv_list[svNumber-1].snr)); //float to int
+                            (int)(0.5 + svStatus.gnss_sv_list[svNumber - 1].c_n0_dbhz)); //float to int
 
                         if (length < 0 || length >= lengthRemaining)
                         {
@@ -789,10 +788,6 @@
 
     }//if
 
-    // cache the used in fix mask, as it will be needed to send $GPGSA
-    // during the position report
-    loc_eng_data_p->sv_used_mask = svStatus.gps_used_in_fix_mask;
-
     // For RPC, the DOP are sent during sv report, so cache them
     // now to be sent during position report.
     // For QMI, the DOP will be in position report.
diff --git a/msm8909/loc_api/libloc_api_50001/loc_eng_nmea.h b/msm8909/loc_api/libloc_api_50001/loc_eng_nmea.h
index f7ef7fb..86dc439 100644
--- a/msm8909/loc_api/libloc_api_50001/loc_eng_nmea.h
+++ b/msm8909/loc_api/libloc_api_50001/loc_eng_nmea.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2012,2016, The Linux Foundation. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -37,7 +37,7 @@
 
 void loc_eng_nmea_send(char *pNmea, int length, loc_eng_data_s_type *loc_eng_data_p);
 int loc_eng_nmea_put_checksum(char *pNmea, int maxSize);
-void loc_eng_nmea_generate_sv(loc_eng_data_s_type *loc_eng_data_p, const QtiGnssSvStatus &svStatus, const GpsLocationExtended &locationExtended);
+void loc_eng_nmea_generate_sv(loc_eng_data_s_type *loc_eng_data_p, const GnssSvStatus &svStatus, const GpsLocationExtended &locationExtended);
 void loc_eng_nmea_generate_pos(loc_eng_data_s_type *loc_eng_data_p, const UlpLocation &location, const GpsLocationExtended &locationExtended, unsigned char generate_nmea);
 
 #endif // LOC_ENG_NMEA_H
diff --git a/msm8909/loc_api/libloc_api_50001/loc_eng_xtra.cpp b/msm8909/loc_api/libloc_api_50001/loc_eng_xtra.cpp
index 7bb8083..b2f0e9b 100644
--- a/msm8909/loc_api/libloc_api_50001/loc_eng_xtra.cpp
+++ b/msm8909/loc_api/libloc_api_50001/loc_eng_xtra.cpp
@@ -1,4 +1,4 @@
-/* Copyright (c) 2009-2013, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2009-2013,2016, The Linux Foundation. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -124,6 +124,13 @@
     loc_eng_xtra_data_s_type *xtra_module_data_ptr;
     ENTRY_LOG();
 
+    if(!loc_eng_data.adapter->mSupportsTimeInjection
+       || loc_eng_data.adapter->hasNativeXtraClient()) {
+        LOC_LOGD("XTRA is already supported. disable it here.\n");
+        EXIT_LOG(%d, 1); // return 1 denote failure
+        return 1;
+    }
+
     if(callbacks == NULL) {
         LOC_LOGE("loc_eng_xtra_init: failed, cb is NULL");
     } else {
diff --git a/msm8909/utils/loc_target.cpp b/msm8909/utils/loc_target.cpp
index faaedf6..b5ec639 100644
--- a/msm8909/utils/loc_target.cpp
+++ b/msm8909/utils/loc_target.cpp
@@ -49,11 +49,12 @@
 #define APQ8074_ID_1 "184"
 
 #define LINE_LEN 100
-#define STR_LIQUID    "Liquid"
-#define STR_SURF      "Surf"
-#define STR_MTP       "MTP"
-#define STR_APQ       "apq"
-#define STR_AUTO      "auto"
+#define STR_LIQUID      "Liquid"
+#define STR_SURF        "Surf"
+#define STR_MTP         "MTP"
+#define STR_APQ         "apq"
+#define STR_APQ_NO_WGR  "baseband_apq_nowgr"
+#define STR_AUTO        "auto"
 #define IS_STR_END(c) ((c) == '\0' || (c) == '\n' || (c) == '\r')
 #define LENGTH(s) (sizeof(s) - 1)
 #define GPS_CHECK_NO_ERROR 0
@@ -213,11 +214,18 @@
           gTarget = TARGET_AUTO;
           goto detected;
     }
+
+    if( !memcmp(baseband, STR_APQ_NO_WGR, LENGTH(STR_APQ_NO_WGR)) ){
+
+        gTarget = TARGET_NO_GNSS;
+        goto detected;
+    }
+
     if( !memcmp(baseband, STR_APQ, LENGTH(STR_APQ)) ){
 
         if( !memcmp(rd_id, MPQ8064_ID_1, LENGTH(MPQ8064_ID_1))
             && IS_STR_END(rd_id[LENGTH(MPQ8064_ID_1)]) )
-            gTarget = TARGET_MPQ;
+            gTarget = TARGET_NO_GNSS;
         else
             gTarget = TARGET_APQ_SA;
     }
diff --git a/msm8909/utils/loc_target.h b/msm8909/utils/loc_target.h
index 3bb3b5e..4ad0678 100644
--- a/msm8909/utils/loc_target.h
+++ b/msm8909/utils/loc_target.h
@@ -32,7 +32,7 @@
 #define TARGET_DEFAULT       TARGET_SET(GNSS_MSM, HAS_SSC)
 #define TARGET_MDM           TARGET_SET(GNSS_MDM, HAS_SSC)
 #define TARGET_APQ_SA        TARGET_SET(GNSS_GSS, NO_SSC)
-#define TARGET_MPQ           TARGET_SET(GNSS_NONE,NO_SSC)
+#define TARGET_NO_GNSS       TARGET_SET(GNSS_NONE, NO_SSC)
 #define TARGET_MSM_NO_SSC    TARGET_SET(GNSS_MSM, NO_SSC)
 #define TARGET_QCA1530       TARGET_SET(GNSS_QCA1530, NO_SSC)
 #define TARGET_AUTO          TARGET_SET(GNSS_AUTO, NO_SSC)
diff --git a/msm8909/utils/log_util.h b/msm8909/utils/log_util.h
index ffd5ca9..2a89241 100644
--- a/msm8909/utils/log_util.h
+++ b/msm8909/utils/log_util.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2014 The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011-2016 The Linux Foundation. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -159,6 +159,12 @@
         }                                                                     \
     } while(0)
 
+#define LOC_LOG_HEAD(tag,fmt) "%s:%d][" tag "] " fmt "\n"
+#define LOC_LOGv(tag,fmt,...) LOC_LOGV(LOC_LOG_HEAD(tag,fmt), __func__, __LINE__, ##__VA_ARGS__)
+#define LOC_LOGw(tag,fmt,...) LOC_LOGW(LOC_LOG_HEAD(tag,fmt), __func__, __LINE__, ##__VA_ARGS__)
+#define LOC_LOGd(tag,fmt,...) LOC_LOGD(LOC_LOG_HEAD(tag,fmt), __func__, __LINE__, ##__VA_ARGS__)
+#define LOC_LOGe(tag,fmt,...) LOC_LOGE(LOC_LOG_HEAD(tag,fmt), __func__, __LINE__, ##__VA_ARGS__)
+
 #define LOG_I(ID, WHAT, SPEC, VAL) LOG_(LOC_LOGI, ID, WHAT, SPEC, VAL)
 #define LOG_V(ID, WHAT, SPEC, VAL) LOG_(LOC_LOGV, ID, WHAT, SPEC, VAL)
 #define LOG_E(ID, WHAT, SPEC, VAL) LOG_(LOC_LOGE, ID, WHAT, SPEC, VAL)