sdm660-common: Update GPS HAL from LA.UM.10.2.1.r1-03400-sdm660.0

Signed-off-by: clarencelol <clarencekuiek@icloud.com>
Signed-off-by: pix106 <sbordenave@gmail.com>
This commit is contained in:
clarencelol 2022-03-12 18:10:39 +08:00 committed by pix106
parent 65cedbd35b
commit 859532ea4a
47 changed files with 479 additions and 241 deletions

View file

@ -16,18 +16,6 @@ GNSS_CFLAGS = [
"-Wno-error=date-time",
]
/* Activate the following for regression testing */
GNSS_SANITIZE = {
/* address: true,*/
cfi: true,
misc_undefined: [
"bounds",
"null",
"unreachable",
"integer",
],
}
/* Activate the following for debug purposes only,
comment out for production */
GNSS_SANITIZE_DIAG = {

View file

@ -36,9 +36,6 @@ endif
LOCAL_PATH := $(call my-dir)
include $(call all-makefiles-under,$(LOCAL_PATH))
GNSS_SANITIZE := cfi bounds null unreachable integer
# Activate the following two lines for regression testing
#GNSS_SANITIZE += address
#GNSS_SANITIZE_DIAG := $(GNSS_SANITIZE)
GNSS_SANITIZE_DIAG := cfi bounds null unreachable integer address
endif # ifneq ($(BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE),)

View file

@ -2,7 +2,7 @@ LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := android.hardware.gnss@1.0-impl-qti
LOCAL_SANITIZE += $(GNSS_SANITIZE)
# activate the following line for debug purposes only, comment out for production
#LOCAL_SANITIZE_DIAG += $(GNSS_SANITIZE_DIAG)
LOCAL_VENDOR_MODULE := true
@ -58,7 +58,7 @@ include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := android.hardware.gnss@1.0-service-qti
LOCAL_SANITIZE += $(GNSS_SANITIZE)
# activate the following line for debug purposes only, comment out for production
#LOCAL_SANITIZE_DIAG += $(GNSS_SANITIZE_DIAG)
LOCAL_VINTF_FRAGMENTS := android.hardware.gnss@1.0-service-qti.xml

View file

@ -2,7 +2,7 @@ LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := android.hardware.gnss@1.1-impl-qti
LOCAL_SANITIZE += $(GNSS_SANITIZE)
# activate the following line for debug purposes only, comment out for production
#LOCAL_SANITIZE_DIAG += $(GNSS_SANITIZE_DIAG)
LOCAL_VENDOR_MODULE := true
@ -59,7 +59,7 @@ include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := android.hardware.gnss@1.1-service-qti
LOCAL_SANITIZE += $(GNSS_SANITIZE)
# activate the following line for debug purposes only, comment out for production
#LOCAL_SANITIZE_DIAG += $(GNSS_SANITIZE_DIAG)
LOCAL_VINTF_FRAGMENTS := android.hardware.gnss@1.1-service-qti.xml

View file

@ -2,7 +2,7 @@ LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := android.hardware.gnss@2.0-impl-qti
LOCAL_SANITIZE += $(GNSS_SANITIZE)
# activate the following line for debug purposes only, comment out for production
#LOCAL_SANITIZE_DIAG += $(GNSS_SANITIZE_DIAG)
LOCAL_VENDOR_MODULE := true
@ -71,7 +71,7 @@ include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := android.hardware.gnss@2.0-service-qti
LOCAL_SANITIZE += $(GNSS_SANITIZE)
# activate the following line for debug purposes only, comment out for production
#LOCAL_SANITIZE_DIAG += $(GNSS_SANITIZE_DIAG)
LOCAL_VINTF_FRAGMENTS := android.hardware.gnss@2.0-service-qti.xml

View file

@ -39,7 +39,7 @@ GnssConfiguration::GnssConfiguration(Gnss* gnss) : mGnss(gnss) {
}
// Methods from ::android::hardware::gps::V1_0::IGnssConfiguration follow.
Return<bool> GnssConfiguration::setSuplEs(bool enabled) {
Return<bool> GnssConfiguration::setSuplEs(bool /*enabled*/) {
// deprecated function. Must return false to pass VTS
return false;
}

View file

@ -32,7 +32,7 @@ namespace implementation {
static AGnss* spAGnss = nullptr;
AGnss::AGnss(Gnss* gnss) : mGnss(gnss) {
AGnss::AGnss(Gnss* gnss) : mGnss(gnss), mType(LOC_AGPS_TYPE_INVALID) {
spAGnss = this;
}
@ -51,6 +51,9 @@ void AGnss::statusCb(AGpsExtType type, LocAGpsStatusValue status) {
V2_0::IAGnssCallback::AGnssType aType;
IAGnssCallback::AGnssStatusValue aStatus;
// cache the AGps Type
mType = type;
switch (type) {
case LOC_AGPS_TYPE_SUPL:
aType = IAGnssCallback::AGnssType::SUPL;
@ -138,18 +141,20 @@ Return<bool> AGnss::dataConnFailed() {
Return<bool> AGnss::dataConnOpen(uint64_t /*networkHandle*/, const hidl_string& apn,
V2_0::IAGnss::ApnIpType apnIpType) {
if(mGnss == nullptr || mGnss->getGnssInterface() == nullptr){
if (mGnss == nullptr || mGnss->getGnssInterface() == nullptr){
LOC_LOGE("Null GNSS interface");
return false;
}
/* Validate */
if(apn.empty()){
LOC_LOGE("Invalid APN");
return false;
std::string apnString(apn.c_str());
// During Emergency SUPL, an apn name of "sos" means that no
// apn was found, like in the simless case, so apn is cleared
if (LOC_AGPS_TYPE_SUPL_ES == mType && "sos" == apnString) {
LOC_LOGD("dataConnOpen APN name = [sos] cleared");
apnString.clear();
}
LOC_LOGD("dataConnOpen APN name = [%s]", apn.c_str());
LOC_LOGD("dataConnOpen APN name = [%s]", apnString.c_str());
AGpsBearerType bearerType;
switch (apnIpType) {
@ -168,7 +173,7 @@ Return<bool> AGnss::dataConnOpen(uint64_t /*networkHandle*/, const hidl_string&
}
mGnss->getGnssInterface()->agpsDataConnOpen(
LOC_AGPS_TYPE_SUPL, apn.c_str(), apn.size(), (int)bearerType);
LOC_AGPS_TYPE_SUPL, apnString.c_str(), apnString.size(), (int)bearerType);
return true;
}

View file

@ -67,6 +67,8 @@ struct AGnss : public V2_0::IAGnss {
private:
Gnss* mGnss = nullptr;
sp<V2_0::IAGnssCallback> mAGnssCbIface = nullptr;
AGpsExtType mType;
};
} // namespace implementation

View file

@ -2,7 +2,6 @@ LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := android.hardware.gnss@2.1-impl-qti
LOCAL_SANITIZE += $(GNSS_SANITIZE)
# activate the following line for debug purposes only, comment out for production
#LOCAL_SANITIZE_DIAG += $(GNSS_SANITIZE_DIAG)
LOCAL_VENDOR_MODULE := true
@ -74,7 +73,7 @@ include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := android.hardware.gnss@2.1-service-qti
LOCAL_SANITIZE += $(GNSS_SANITIZE)
# activate the following line for debug purposes only, comment out for production
#LOCAL_SANITIZE_DIAG += $(GNSS_SANITIZE_DIAG)
LOCAL_VINTF_FRAGMENTS := android.hardware.gnss@2.1-service-qti.xml

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
/* Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@ -33,7 +33,7 @@
#include <inttypes.h>
#include <log_util.h>
#include <loc_cfg.h>
#include <thread>
#include "LocationUtil.h"
#include "BatchingAPIClient.h"
@ -82,10 +82,10 @@ BatchingAPIClient::~BatchingAPIClient()
LOC_LOGD("%s]: ()", __FUNCTION__);
}
int BatchingAPIClient::getBatchSize()
{
LOC_LOGD("%s]: ()", __FUNCTION__);
return locAPIGetBatchSize();
int BatchingAPIClient::getBatchSize() {
int batchSize = locAPIGetBatchSize();
LOC_LOGd("batchSize: %d", batchSize);
return batchSize;
}
void BatchingAPIClient::setCallbacks()
@ -133,8 +133,10 @@ void BatchingAPIClient::gnssUpdateCallbacks_2_0(const sp<V2_0::IGnssBatchingCall
}
}
int BatchingAPIClient::startSession(const IGnssBatching::Options& opts)
{
int BatchingAPIClient::startSession(const IGnssBatching::Options& opts) {
mMutex.lock();
mState = STARTED;
mMutex.unlock();
LOC_LOGD("%s]: (%lld %d)", __FUNCTION__,
static_cast<long long>(opts.periodNanos), static_cast<uint8_t>(opts.flags));
int retVal = -1;
@ -168,10 +170,13 @@ int BatchingAPIClient::updateSessionOptions(const IGnssBatching::Options& opts)
return retVal;
}
int BatchingAPIClient::stopSession()
{
int BatchingAPIClient::stopSession() {
mMutex.lock();
mState = STOPPING;
mMutex.unlock();
LOC_LOGD("%s]: ", __FUNCTION__);
int retVal = -1;
locAPIGetBatchedLocations(mDefaultId, SIZE_MAX);
if (locAPIStopSession(mDefaultId) == LOCATION_ERROR_SUCCESS) {
retVal = 1;
}
@ -184,10 +189,15 @@ void BatchingAPIClient::getBatchedLocation(int last_n_locations)
locAPIGetBatchedLocations(mDefaultId, last_n_locations);
}
void BatchingAPIClient::flushBatchedLocations()
{
void BatchingAPIClient::flushBatchedLocations() {
LOC_LOGD("%s]: ()", __FUNCTION__);
locAPIGetBatchedLocations(mDefaultId, SIZE_MAX);
uint32_t retVal = locAPIGetBatchedLocations(mDefaultId, SIZE_MAX);
// when flush a stopped session or one doesn't exist, just report an empty batch.
if (LOCATION_ERROR_ID_UNKNOWN == retVal) {
BatchingOptions opt = {};
::std::thread thd(&BatchingAPIClient::onBatchingCb, this, 0, nullptr, opt);
thd.detach();
}
}
void BatchingAPIClient::onCapabilitiesCb(LocationCapabilitiesMask capabilitiesMask)
@ -197,30 +207,58 @@ void BatchingAPIClient::onCapabilitiesCb(LocationCapabilitiesMask capabilitiesMa
}
void BatchingAPIClient::onBatchingCb(size_t count, Location* location,
BatchingOptions /*batchOptions*/)
{
BatchingOptions /*batchOptions*/) {
bool processReport = false;
LOC_LOGd("(count: %zu)", count);
mMutex.lock();
// back to back stop() and flush() could bring twice onBatchingCb(). Each one might come first.
// Combine them both (the first goes to cache, the second in location*) before report to FW
switch (mState) {
case STOPPING:
mState = STOPPED;
for (size_t i = 0; i < count; i++) {
mBatchedLocationInCache.push_back(location[i]);
}
break;
case STARTED:
case STOPPED: // flush() always trigger report, even on a stopped session
processReport = true;
break;
default:
break;
}
// report location batch when in STARTED state or flush(), combined with cache in last stop()
if (processReport) {
auto gnssBatchingCbIface(mGnssBatchingCbIface);
auto gnssBatchingCbIface_2_0(mGnssBatchingCbIface_2_0);
mMutex.unlock();
LOC_LOGD("%s]: (count: %zu)", __FUNCTION__, count);
if (gnssBatchingCbIface_2_0 != nullptr && count > 0) {
size_t batchCacheCnt = mBatchedLocationInCache.size();
LOC_LOGd("(batchCacheCnt: %zu)", batchCacheCnt);
if (gnssBatchingCbIface_2_0 != nullptr) {
hidl_vec<V2_0::GnssLocation> locationVec;
locationVec.resize(count);
if (count+batchCacheCnt > 0) {
locationVec.resize(count+batchCacheCnt);
for (size_t i = 0; i < batchCacheCnt; ++i) {
convertGnssLocation(mBatchedLocationInCache[i], locationVec[i]);
}
for (size_t i = 0; i < count; i++) {
convertGnssLocation(location[i], locationVec[i]);
convertGnssLocation(location[i], locationVec[i+batchCacheCnt]);
}
}
auto r = gnssBatchingCbIface_2_0->gnssLocationBatchCb(locationVec);
if (!r.isOk()) {
LOC_LOGE("%s] Error from gnssLocationBatchCb 2_0 description=%s",
__func__, r.description().c_str());
}
} else if (gnssBatchingCbIface != nullptr && count > 0) {
} else if (gnssBatchingCbIface != nullptr) {
hidl_vec<V1_0::GnssLocation> locationVec;
locationVec.resize(count);
if (count+batchCacheCnt > 0) {
locationVec.resize(count+batchCacheCnt);
for (size_t i = 0; i < batchCacheCnt; ++i) {
convertGnssLocation(mBatchedLocationInCache[i], locationVec[i]);
}
for (size_t i = 0; i < count; i++) {
convertGnssLocation(location[i], locationVec[i]);
convertGnssLocation(location[i], locationVec[i+batchCacheCnt]);
}
}
auto r = gnssBatchingCbIface->gnssLocationBatchCb(locationVec);
if (!r.isOk()) {
@ -228,6 +266,9 @@ void BatchingAPIClient::onBatchingCb(size_t count, Location* location,
__func__, r.description().c_str());
}
}
mBatchedLocationInCache.clear();
}
mMutex.unlock();
}
static void convertBatchOption(const IGnssBatching::Options& in, LocationOptions& out,

View file

@ -43,6 +43,9 @@ namespace gnss {
namespace V2_1 {
namespace implementation {
enum BATCHING_STATE { STARTED, STOPPING, STOPPED };
class BatchingAPIClient : public LocationAPIClientBase
{
public:
@ -72,6 +75,9 @@ private:
uint32_t mDefaultId;
LocationCapabilitiesMask mLocationCapabilitiesMask;
sp<V2_0::IGnssBatchingCallback> mGnssBatchingCbIface_2_0;
volatile BATCHING_STATE mState = STOPPED;
std::vector<Location> mBatchedLocationInCache;
};
} // namespace implementation

View file

@ -3,7 +3,7 @@ cc_library_static {
name: "liblocbatterylistener",
vendor: true,
sanitize: GNSS_SANITIZE,
cflags: GNSS_CFLAGS + ["-DBATTERY_LISTENER_ENABLED"],
local_include_dirs: ["."],

View file

@ -4,7 +4,7 @@ cc_library_shared {
name: "libbatching",
vendor: true,
sanitize: GNSS_SANITIZE,
shared_libs: [
"libutils",

View file

@ -37,7 +37,9 @@
using namespace loc_core;
BatchingAdapter::BatchingAdapter() :
LocAdapterBase(0, LocContext::getLocContext(LocContext::mLocationHalName)),
LocAdapterBase(0,
LocContext::getLocContext(LocContext::mLocationHalName),
false, nullptr, true),
mOngoingTripDistance(0),
mOngoingTripTBFInterval(0),
mTripWithOngoingTBFDropped(false),
@ -50,6 +52,10 @@ BatchingAdapter::BatchingAdapter() :
LOC_LOGD("%s]: Constructor", __func__);
readConfigCommand();
setConfigCommand();
// at last step, let us inform adapater base that we are done
// with initialization, e.g.: ready to process handleEngineUpEvent
doneInit();
}
void

View file

@ -4,7 +4,7 @@ cc_library_shared {
name: "libloc_core",
vendor: true,
sanitize: GNSS_SANITIZE,
shared_libs: [
"liblog",

View file

@ -93,6 +93,7 @@ const loc_param_s_type ContextBase::mGps_conf_table[] =
{"GNSS_DEPLOYMENT", &mGps_conf.GNSS_DEPLOYMENT, NULL, 'n'},
{"CUSTOM_NMEA_GGA_FIX_QUALITY_ENABLED",
&mGps_conf.CUSTOM_NMEA_GGA_FIX_QUALITY_ENABLED, NULL, 'n'},
{"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'}
};
@ -192,6 +193,8 @@ void ContextBase::readConfig()
/* default configuration QTI GNSS H/W */
mGps_conf.GNSS_DEPLOYMENT = 0;
mGps_conf.CUSTOM_NMEA_GGA_FIX_QUALITY_ENABLED = 0;
/* default NMEA Tag Block Grouping is disabled */
mGps_conf.NMEA_TAG_BLOCK_GROUPING_ENABLED = 0;
/* default configuration for NI_SUPL_DENY_ON_NFW_LOCKED */
mGps_conf.NI_SUPL_DENY_ON_NFW_LOCKED = 1;
/* By default NMEA Printing is disabled */

View file

@ -82,6 +82,7 @@ typedef struct loc_gps_cfg_s
uint32_t CUSTOM_NMEA_GGA_FIX_QUALITY_ENABLED;
uint32_t NI_SUPL_DENY_ON_NFW_LOCKED;
uint32_t ENABLE_NMEA_PRINT;
uint32_t NMEA_TAG_BLOCK_GROUPING_ENABLED;
} loc_gps_cfg_s_type;
/* NOTE: the implementation of the parser casts number

View file

@ -88,8 +88,8 @@ void LocAdapterBase::
const GpsLocationExtended& locationExtended,
enum loc_sess_status status,
LocPosTechMask loc_technology_mask,
GnssDataNotification* pDataNotify,
int msInWeek)
GnssDataNotification* /*pDataNotify*/,
int /*msInWeek*/)
{
if (mLocAdapterProxyBase != NULL) {
mLocAdapterProxyBase->reportPositionEvent((UlpLocation&)location,
@ -162,7 +162,7 @@ DEFAULT_IMPL(false)
bool LocAdapterBase::
requestNiNotifyEvent(const GnssNiNotification &/*notify*/,
const void* /*data*/,
const LocInEmergency emergencyState)
const LocInEmergency /*emergencyState*/)
DEFAULT_IMPL(false)
void LocAdapterBase::
@ -344,7 +344,7 @@ LocAdapterBase::updateClientsEventMask()
DEFAULT_IMPL()
void
LocAdapterBase::stopClientSessions(LocationAPI* client)
LocAdapterBase::stopClientSessions(LocationAPI* /*client*/)
DEFAULT_IMPL()
void

View file

@ -1034,7 +1034,7 @@ bool ElapsedRealtimeEstimator::getCurrentTime(
struct timespec sinceBootTime;
struct timespec sinceBootTimeTest;
bool clockGetTimeSuccess = false;
const uint32_t MAX_TIME_DELTA_VALUE_NANOS = 10000;
const uint32_t MAX_TIME_DELTA_VALUE_NANOS = 15000;
const uint32_t MAX_GET_TIME_COUNT = 20;
/* Attempt to get CLOCK_REALTIME and CLOCK_BOOTIME in succession without an interruption
or context switch (for up to MAX_GET_TIME_COUNT times) to avoid errors in the calculation */

View file

@ -101,6 +101,7 @@ public:
inline virtual void* getSibling2() { return NULL; }
inline virtual double getGloRfLoss(uint32_t left,
uint32_t center, uint32_t right, uint8_t gloFrequency) { return 0.0; }
inline virtual float getGeoidalSeparation(double latitude, double longitude) { return 0.0; }
};
class LocApiBase {

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
/* Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@ -1586,6 +1586,7 @@ bool SystemStatus::eventDataItemNotify(IDataItemCore* dataitem)
break;
}
pthread_mutex_unlock(&mMutexSystemStatus);
LOC_LOGv("DataItemId: %d, whether to record dateitem in cache: %d", dataitem->getId(), ret);
return ret;
}

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
/* Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@ -509,9 +509,11 @@ public:
for (uint8_t i = 0; rtv && i < MAX_NETWORK_HANDLES; ++i) {
rtv &= (mAllNetworkHandles[i] == peer.mAllNetworkHandles[i]);
}
return peer.mApn.compare(mApn);
return rtv && !peer.mApn.compare(mApn);
}
inline virtual SystemStatusItemBase& collate(SystemStatusItemBase& curInfo) {
LOC_LOGv("NetworkInfo: mAllTypes=%" PRIx64 " connected=%u mType=%x mApn=%s",
mAllTypes, mConnected, mType, mApn.c_str());
uint64_t allTypes = (static_cast<SystemStatusNetworkInfo&>(curInfo)).mAllTypes;
string& apn = (static_cast<SystemStatusNetworkInfo&>(curInfo)).mApn;
// Replace current with cached table for now and then update

View file

@ -12,7 +12,7 @@
# of batched locations that can be allocated,
# which is limited by memory. The default
# batch size defined as 20 as below.
BATCH_SIZE=20
BATCH_SIZE=40
###################################
# FLP OUTDOOR TRIP BATCH SIZE

View file

@ -80,7 +80,8 @@
# NUMBER_OF_ROWS_SGC_ and NUMBER_OF_COLUMNS_SGC_ represent the number of
# rows/columns for signal gain corrections
ANTENNA_INFO_VECTOR_SIZE = 2
# ANTENNA_INFO_VECTOR_SIZE must be non zero if antenna corrections are sent
# ANTENNA_INFO_VECTOR_SIZE = 2
CARRIER_FREQUENCY_0 = 1575.42

View file

@ -4,7 +4,7 @@
ERR_ESTIMATE=0
#NTP server
NTP_SERVER=time.xtracloud.net
NTP_SERVER=1.android.pool.ntp.org
NTP_SERVER_2=asia.pool.ntp.org
NTP_SERVER_3=0.cn.pool.ntp.org
@ -14,28 +14,28 @@ XTRA_CA_PATH=/usr/lib/ssl-1.1/certs
# DEBUG LEVELS: 0 - none, 1 - Error, 2 - Warning, 3 - Info
# 4 - Debug, 5 - Verbose
# If DEBUG_LEVEL is commented, Android's logging levels will be used
DEBUG_LEVEL = 3
DEBUG_LEVEL = 2
# Intermediate position report, 1=enable, 0=disable
INTERMEDIATE_POS=0
# supl version 1.0
SUPL_VER=0x20000
SUPL_VER=0x10000
# Emergency SUPL, 1=enable, 0=disable
SUPL_ES=0
#SUPL_ES=1
#Choose PDN for Emergency SUPL
#1 - Use emergency PDN
#0 - Use regular SUPL PDN for Emergency SUPL
USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL=0
#USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL=0
#SUPL_MODE is a bit mask set in config.xml per carrier by default.
#If it is uncommented here, this value will overwrite the value from
#config.xml.
#MSA=0X2
#MSB=0X1
SUPL_MODE=3
#SUPL_MODE=
# GPS Capabilities bit mask
# SCHEDULING = 0x01
@ -47,7 +47,7 @@ CAPABILITIES=0x17
# Accuracy threshold for intermediate positions
# less accurate positions are ignored, 0 for passing all positions
ACCURACY_THRES=70
# ACCURACY_THRES=5000
################################
##### AGPS server settings #####
@ -78,10 +78,11 @@ ACCURACY_THRES=70
####################################
# LPP_PROFILE is a bit mask
# 0: Enable RRLP on LTE(Default)
# 1: Enable LPP_User_Plane on LTE
# 2: Enable LPP_Control_Plane
# 3: Enable both LPP_User_Plane and LPP_Control_Plane
LPP_PROFILE = 3
# 0x1: LPP User Plane
# 0x2: LPP Control Plane
# 0x4: LPP User Plane for NR5G
# 0x8: LPP Control Plane for NR5G
LPP_PROFILE = 2
####################################
#Datum Type
@ -96,6 +97,15 @@ DATUM_TYPE = 0
# NMEA provider (1=Modem Processor, 0=Application Processor)
NMEA_PROVIDER=0
################################
# NMEA TAG BLOCK GROUPING
################################
# NMEA tag block grouping is only applicable to GSA
# Default is disabled
# 0 - disabled
# 1 - enabled
NMEA_TAG_BLOCK_GROUPING_ENABLED = 0
# Customized NMEA GGA fix quality that can be used to tell
# whether SENSOR contributed to the fix.
#
@ -138,7 +148,7 @@ SGLTE_TARGET=0
# 0x1: RRC CPlane
# 0x2: RRLP UPlane
# 0x4: LLP Uplane
A_GLONASS_POS_PROTOCOL_SELECT = 0xf
A_GLONASS_POS_PROTOCOL_SELECT = 0
##################################################
# Select technology for LPPe Control Plane
@ -291,7 +301,7 @@ MODEM_TYPE = 1
# 1 : enabled
# This setting enables GPS engine to estimate clock
# bias and drift when the signal from at least 1
# SV is available and the UEs position is known by
# SV is available and the UEs position is known by
# other position engines.
#POSITION_ASSISTED_CLOCK_ESTIMATOR_ENABLED = 0
@ -300,7 +310,7 @@ MODEM_TYPE = 1
#####################################
# This is a string that is sent to the framework
# in nfwNotifyCb callback
PROXY_APP_PACKAGE_NAME = com.lbe.security.miui
PROXY_APP_PACKAGE_NAME = com.google.android.carrierlocation
#####################################
# CP_MTLR_ES
@ -339,13 +349,6 @@ D_LEVEL_MAX_CAPACITY = 300
V_LEVEL_TIME_DEPTH = 200
V_LEVEL_MAX_CAPACITY = 400
# Xiaomi add for breaking xtra download limitation
XTRA_TEST_ENABLED = 1
XTRA_THROTTLE_ENABLED = 0
XTRA_SYSTEM_TIME_INJECT = 1
# Mechanism to handle the gnss assistance data download
# in very bad network situations
XTRA_SOCK_KEEPALIVE=1
##################################################
# Allow buffer diag log packets when diag memory allocation
# fails during boot up time.

View file

@ -22,6 +22,6 @@
# Log level
# EL_LOG_OFF = 0, EL_ERROR = 1, EL_WARNING = 2, EL_INFO = 3, EL_DEBUG = 4, EL_VERBOSE = 5, EL_LOG_ALL = 100
LOWI_LOG_LEVEL = 3
LOWI_LOG_LEVEL = 2
LOWI_USE_LOWI_LP = 0

View file

@ -93,3 +93,27 @@ sendmsg: 1
sendto: 1
recvfrom: 1
getsockname: 1
nanosleep: 1
clone: 1
setsockopt: 1
getsockopt: 1
madvise: 1
getitimer: 1
setitimer: 1
getpid: 1
bind: 1
listen: 1
getpeername: 1
socketpair: 1
wait4: 1
chown: 1
fchown: 1
lchown: 1
umask: 1
mmap2: 1
fstat64: 1
fstatat64: 1
_llseek: 1
geteuid: 1

View file

@ -32,7 +32,7 @@
fdatasync: 1
getdents64: 1
gettimeofday: 1
#ioctl: arg1 == _IOC(_IOC_NONE || arg1 == _IOC(_IOC_READ || arg1 == VSOC_MAYBE_SEND_INTERRUPT_TO_HOST
ioctl: 1
lseek: 1
madvise: 1
mkdirat: 1
@ -43,3 +43,31 @@ timerfd_settime: 1
epoll_create1: 1
epoll_pwait: 1
epoll_ctl: 1
sched_getaffinity: 1
gettid: 1
fchown: 1
fchmod: 1
fchmodat: 1
getsockopt: 1
fchownat: 1
fstat: 1
fstatfs: 1
newfstatat: 1
sendmsg: 1
recvmsg: 1
gettimeofday: 1
setsockopt: 1
rt_tgsigqueueinfo: 1
ioctl: 1
mmap: 1
getuid32: 1
getuid: 1
fstat64: 1
fstatat64: 1
mkdir: 1
rmdir: 1
creat: 1
chmod: 1
lseek: 1
geteuid32: 1

View file

@ -31,3 +31,13 @@
unlinkat: 1
sched_getaffinity: 1
newfstatat: 1
fchmodat: 1
madvise: 1
mmap: 1
getuid: 1
getuid32: 1
fstat64: 1
fstatat64: 1
gettimeofday: 1
getdents64: 1

View file

@ -5,7 +5,7 @@ cc_library_shared {
name: "libgeofencing",
vendor: true,
sanitize: GNSS_SANITIZE,
srcs: [
"GeofenceAdapter.cpp",

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2013-2020, The Linux Foundation. All rights reserved.
/* Copyright (c) 2013-2021, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@ -38,9 +38,13 @@ using namespace loc_core;
GeofenceAdapter::GeofenceAdapter() :
LocAdapterBase(0,
LocContext::getLocContext(LocContext::mLocationHalName),
true /*isMaster*/)
true /*isMaster*/, nullptr, true)
{
LOC_LOGD("%s]: Constructor", __func__);
// at last step, let us inform adapater base that we are done
// with initialization, e.g.: ready to process handleEngineUpEvent
doneInit();
}
void
@ -163,7 +167,7 @@ GeofenceAdapter::restartGeofences()
if (LOCATION_ERROR_SUCCESS == err) {
if (true == object.paused) {
mLocApi->pauseGeofence(data.hwId, object.key.id,
new LocApiResponse(*getContext(), [] (LocationError err ) {}));
new LocApiResponse(*getContext(), [] (LocationError /*err*/) {}));
}
saveGeofenceItem(object.key.client, object.key.id, data.hwId, options, info);
}
@ -241,7 +245,7 @@ GeofenceAdapter::addGeofencesCommand(LocationAPI* client, size_t count, Geofence
mApi.addToCallQueue(new LocApiResponse(*mAdapter.getContext(),
[&mAdapter = mAdapter, mCount = mCount, mClient = mClient,
mOptions = mOptions, mInfos = mInfos, mIds = mIds, &mApi = mApi,
errs, i] (LocationError err ) {
errs, i] (LocationError /*err*/) {
mApi.addGeofence(mIds[i], mOptions[i], mInfos[i],
new LocApiResponseData<LocApiGeofenceData>(*mAdapter.getContext(),
[&mAdapter = mAdapter, mOptions = mOptions, mClient = mClient,
@ -342,7 +346,7 @@ GeofenceAdapter::removeGeofencesCommand(LocationAPI* client, size_t count, uint3
for (size_t i=0; i < mCount; ++i) {
mApi.addToCallQueue(new LocApiResponse(*mAdapter.getContext(),
[&mAdapter = mAdapter, mCount = mCount, mClient = mClient, mIds = mIds,
&mApi = mApi, errs, i] (LocationError err ) {
&mApi = mApi, errs, i] (LocationError /*err*/) {
uint32_t hwId = 0;
errs[i] = mAdapter.getHwIdFromClient(mClient, mIds[i], hwId);
if (LOCATION_ERROR_SUCCESS == errs[i]) {
@ -418,7 +422,7 @@ GeofenceAdapter::pauseGeofencesCommand(LocationAPI* client, size_t count, uint32
for (size_t i=0; i < mCount; ++i) {
mApi.addToCallQueue(new LocApiResponse(*mAdapter.getContext(),
[&mAdapter = mAdapter, mCount = mCount, mClient = mClient, mIds = mIds,
&mApi = mApi, errs, i] (LocationError err ) {
&mApi = mApi, errs, i] (LocationError /*err*/) {
uint32_t hwId = 0;
errs[i] = mAdapter.getHwIdFromClient(mClient, mIds[i], hwId);
if (LOCATION_ERROR_SUCCESS == errs[i]) {
@ -493,7 +497,7 @@ GeofenceAdapter::resumeGeofencesCommand(LocationAPI* client, size_t count, uint3
for (size_t i=0; i < mCount; ++i) {
mApi.addToCallQueue(new LocApiResponse(*mAdapter.getContext(),
[&mAdapter = mAdapter, mCount = mCount, mClient = mClient, mIds = mIds,
&mApi = mApi, errs, i] (LocationError err ) {
&mApi = mApi, errs, i] (LocationError /*err*/) {
uint32_t hwId = 0;
errs[i] = mAdapter.getHwIdFromClient(mClient, mIds[i], hwId);
if (LOCATION_ERROR_SUCCESS == errs[i]) {
@ -576,7 +580,7 @@ GeofenceAdapter::modifyGeofencesCommand(LocationAPI* client, size_t count, uint3
} else {
mApi.addToCallQueue(new LocApiResponse(*mAdapter.getContext(),
[&mAdapter = mAdapter, mCount = mCount, mClient = mClient, mIds = mIds,
&mApi = mApi, mOptions = mOptions, errs, i] (LocationError err ) {
&mApi = mApi, mOptions = mOptions, errs, i] (LocationError /*err*/) {
uint32_t hwId = 0;
errs[i] = mAdapter.getHwIdFromClient(mClient, mIds[i], hwId);
if (LOCATION_ERROR_SUCCESS == errs[i]) {

View file

@ -448,7 +448,7 @@ void AgpsStateMachine::setAPN(char* apn, unsigned int len){
mAPN = NULL;
}
if (NULL == apn || len <= 0 || len > MAX_APN_LEN || strlen(apn) != len) {
if (NULL == apn || len > MAX_APN_LEN || strlen(apn) != len) {
LOC_LOGD("Invalid apn len (%d) or null apn", len);
mAPN = NULL;
mAPNLen = 0;
@ -590,7 +590,7 @@ void AgpsManager::requestATL(int connHandle, AGpsExtType agpsType,
sm->setApnTypeMask(apnTypeMask);
/* Invoke AGPS SM processing */
AgpsSubscriber subscriber(connHandle, false, false, apnTypeMask);
AgpsSubscriber subscriber(connHandle, true, false, apnTypeMask);
sm->setCurrentSubscriber(&subscriber);
/* Send subscriber event */
sm->processAgpsEvent(AGPS_EVENT_SUBSCRIBE);

View file

@ -167,7 +167,7 @@ public:
/* Getter/Setter methods */
void setAPN(char* apn, unsigned int len);
inline char* getAPN() const { return (char*)mAPN; }
inline char* getAPN() const { return mAPN; }
inline uint32_t getAPNLen() const { return mAPNLen; }
inline void setBearer(AGpsBearerType bearer) { mBearer = bearer; }
inline LocApnTypeMask getApnTypeMask() const { return mApnTypeMask; }

View file

@ -5,7 +5,7 @@ cc_library_shared {
name: "libgnss",
vendor: true,
sanitize: GNSS_SANITIZE,
shared_libs: [
"libutils",

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017-2020 The Linux Foundation. All rights reserved.
/* Copyright (c) 2017-2021 The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@ -77,6 +77,8 @@ static void agpsCloseResultCb (bool isSuccess, AGpsExtType agpsType, void* userD
typedef const CdfwInterface* (*getCdfwInterface)();
typedef void getPdnTypeFromWds(const std::string& apnName, std::function<void(int)> pdnCb);
inline bool GnssReportLoggerUtil::isLogEnabled() {
return (mLogLatency != nullptr);
}
@ -861,6 +863,9 @@ GnssAdapter::setConfig()
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;
@ -886,6 +891,8 @@ GnssAdapter::setConfig()
ContextBase::mGps_conf.MO_SUPL_PORT,
LOC_AGPS_MO_SUPL_SERVER);
std::string moServerUrl = getMoServerUrl();
std::string serverUrl = getServerUrl();
// inject the configurations into modem
loc_gps_cfg_s gpsConf = ContextBase::mGps_conf;
loc_sap_cfg_s_type sapConf = ContextBase::mSap_conf;
@ -933,13 +940,18 @@ GnssAdapter::setConfig()
gnssConfigRequested.blacklistedSvIds.assign(mBlacklistedSvIds.begin(),
mBlacklistedSvIds.end());
mLocApi->sendMsg(new LocApiMsg(
[this, gpsConf, sapConf, oldMoServerUrl, gnssConfigRequested] () mutable {
gnssUpdateConfig(oldMoServerUrl, gnssConfigRequested, gnssConfigRequested);
[this, gpsConf, sapConf, oldMoServerUrl, moServerUrl,
serverUrl, gnssConfigRequested] () mutable {
gnssUpdateConfig(oldMoServerUrl, moServerUrl, serverUrl,
gnssConfigRequested, gnssConfigRequested);
// 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_DEBUG_NMEA_V02)) {
mask |= LOC_NMEA_MASK_DEBUG_V02;
@ -1019,6 +1031,7 @@ GnssAdapter::setConfig()
}
std::vector<LocationError> GnssAdapter::gnssUpdateConfig(const std::string& oldMoServerUrl,
const std::string& moServerUrl, const std::string& serverUrl,
GnssConfig& gnssConfigRequested, GnssConfig& gnssConfigNeedEngineUpdate, size_t count) {
loc_gps_cfg_s gpsConf = ContextBase::mGps_conf;
size_t index = 0;
@ -1028,9 +1041,6 @@ std::vector<LocationError> GnssAdapter::gnssUpdateConfig(const std::string& oldM
errsList.insert(errsList.begin(), count, LOCATION_ERROR_SUCCESS);
}
std::string serverUrl = getServerUrl();
std::string moServerUrl = getMoServerUrl();
int serverUrlLen = serverUrl.length();
int moServerUrlLen = moServerUrl.length();
@ -1418,10 +1428,14 @@ GnssAdapter::gnssUpdateConfigCommand(const GnssConfig& config)
adapter.reportResponse(countOfConfigs, errs.data(), ids.data());
});
std::string moServerUrl = adapter.getMoServerUrl();
std::string serverUrl = adapter.getServerUrl();
mApi.sendMsg(new LocApiMsg(
[&adapter, gnssConfigRequested, gnssConfigNeedEngineUpdate,
countOfConfigs, configCollectiveResponse, errs] () mutable {
moServerUrl, serverUrl, countOfConfigs, configCollectiveResponse,
errs] () mutable {
std::vector<LocationError> errsList = adapter.gnssUpdateConfig("",
moServerUrl, serverUrl,
gnssConfigRequested, gnssConfigNeedEngineUpdate, countOfConfigs);
configCollectiveResponse->returnToSender(errsList);
@ -4018,10 +4032,12 @@ GnssAdapter::reportPosition(const UlpLocation& ulpLocation,
(LOC_RELIABILITY_NOT_SET == locationExtended.horizontal_reliability));
uint8_t generate_nmea = (reportToGnssClient && status != LOC_SESS_FAILURE && !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);
std::vector<std::string> nmeaArraystr;
int indexOfGGA = -1;
loc_nmea_generate_pos(ulpLocation, locationExtended, mLocSystemInfo,
generate_nmea, custom_nmea_gga, nmeaArraystr, indexOfGGA);
loc_nmea_generate_pos(ulpLocation, locationExtended, mLocSystemInfo, generate_nmea,
custom_nmea_gga, nmeaArraystr, indexOfGGA, isTagBlockGroupingEnabled);
stringstream ss;
for (auto itor = nmeaArraystr.begin(); itor != nmeaArraystr.end(); ++itor) {
ss << *itor;
@ -5206,6 +5222,38 @@ bool GnssAdapter::releaseATL(int connHandle){
return true;
}
void GnssAdapter::reportPdnTypeFromWds(int pdnType, AGpsExtType agpsType, std::string apnName,
AGpsBearerType bearerType) {
LOC_LOGd("pdnType from WDS QMI: %d, agpsType: %d, apnName: %s, bearerType: %d",
pdnType, agpsType, apnName.c_str(), bearerType);
struct MsgReportAtlPdn : public LocMsg {
GnssAdapter& mAdapter;
int mPdnType;
AgpsManager* mAgpsManager;
AGpsExtType mAgpsType;
string mApnName;
AGpsBearerType mBearerType;
inline MsgReportAtlPdn(GnssAdapter& adapter, int pdnType,
AgpsManager* agpsManager, AGpsExtType agpsType,
const string& apnName, AGpsBearerType bearerType) :
LocMsg(), mAgpsManager(agpsManager), mAgpsType(agpsType),
mApnName(apnName), mBearerType(bearerType),
mAdapter(adapter), mPdnType(pdnType) {}
inline virtual void proc() const {
mAgpsManager->reportAtlOpenSuccess(mAgpsType,
const_cast<char*>(mApnName.c_str()),
mApnName.length(), mPdnType<=0? mBearerType:mPdnType);
}
};
AGpsBearerType atlPdnType = (pdnType+1) & 3; // convert WDS QMI pdn type to AgpsBearerType
sendMsg(new MsgReportAtlPdn(*this, atlPdnType, &mAgpsManager,
agpsType, apnName, bearerType));
}
void GnssAdapter::dataConnOpenCommand(
AGpsExtType agpsType,
const char* apnName, int apnLen, AGpsBearerType bearerType){
@ -5213,17 +5261,16 @@ void GnssAdapter::dataConnOpenCommand(
LOC_LOGI("GnssAdapter::frameworkDataConnOpen");
struct AgpsMsgAtlOpenSuccess: public LocMsg {
GnssAdapter& mAdapter;
AgpsManager* mAgpsManager;
AGpsExtType mAgpsType;
char* mApnName;
int mApnLen;
AGpsBearerType mBearerType;
inline AgpsMsgAtlOpenSuccess(AgpsManager* agpsManager, AGpsExtType agpsType,
const char* apnName, int apnLen, AGpsBearerType bearerType) :
inline AgpsMsgAtlOpenSuccess(GnssAdapter& adapter, AgpsManager* agpsManager,
AGpsExtType agpsType, const char* apnName, int apnLen, AGpsBearerType bearerType) :
LocMsg(), mAgpsManager(agpsManager), mAgpsType(agpsType), mApnName(
new char[apnLen + 1]), mApnLen(apnLen), mBearerType(bearerType) {
new char[apnLen + 1]), mBearerType(bearerType), mAdapter(adapter) {
LOC_LOGV("AgpsMsgAtlOpenSuccess");
if (mApnName == nullptr) {
@ -5241,19 +5288,36 @@ void GnssAdapter::dataConnOpenCommand(
}
inline virtual void proc() const {
LOC_LOGv("AgpsMsgAtlOpenSuccess::proc()");
string apn(mApnName);
//Use QMI WDS API to query IP Protocol from modem profile
void* libHandle = nullptr;
getPdnTypeFromWds* getPdnTypeFunc = (getPdnTypeFromWds*)dlGetSymFromLib(libHandle,
#ifdef USE_GLIB
"libloc_api_wds.so", "_Z10getPdnTypeRKNSt7__cxx1112basic_string"\
"IcSt11char_traitsIcESaIcEEESt8functionIFviEE");
#else
"libloc_api_wds.so", "_Z10getPdnTypeRKNSt3__112basic_stringIcNS_11char_traits"\
"IcEENS_9allocatorIcEEEENS_8functionIFviEEE");
#endif
LOC_LOGV("AgpsMsgAtlOpenSuccess::proc()");
mAgpsManager->reportAtlOpenSuccess(mAgpsType, mApnName, mApnLen, mBearerType);
std::function<void(int)> wdsPdnTypeCb = std::bind(&GnssAdapter::reportPdnTypeFromWds,
&mAdapter, std::placeholders::_1, mAgpsType, apn, mBearerType);
if (getPdnTypeFunc != nullptr) {
LOC_LOGv("dlGetSymFromLib success");
(*getPdnTypeFunc)(apn, wdsPdnTypeCb);
} else {
mAgpsManager->reportAtlOpenSuccess(mAgpsType, mApnName, apn.length(), mBearerType);
}
}
};
// Added inital length checks for apnlen check to avoid security issues
// In case of failure reporting the same
if (NULL == apnName || apnLen <= 0 || apnLen > MAX_APN_LEN ||
(strlen(apnName) != (unsigned)apnLen)) {
if (NULL == apnName || apnLen > MAX_APN_LEN || (strlen(apnName) != apnLen)) {
LOC_LOGe("%s]: incorrect apnlen length or incorrect apnName", __func__);
mAgpsManager.reportAtlClosed(agpsType);
} else {
sendMsg( new AgpsMsgAtlOpenSuccess(
sendMsg( new AgpsMsgAtlOpenSuccess(*this,
&mAgpsManager, agpsType, apnName, apnLen, bearerType));
}
}
@ -6723,7 +6787,9 @@ GnssAdapter::reportGnssAntennaInformation(const antennaInfoCb antennaInfoCallbac
}
gnssAntennaInformations.push_back(std::move(gnssAntennaInfo));
}
if (antennaInfoVectorSize > 0) {
antennaInfoCallback(gnssAntennaInformations);
}
}
/* ==== DGnss Usable Reporter ========================================================= */
@ -6760,10 +6826,15 @@ void GnssAdapter::enablePPENtripStreamCommand(const GnssNtripConnectionParams& p
bool enableRTKEngine) {
(void)enableRTKEngine; //future parameter, not used
if (0 == params.size || params.hostNameOrIp.empty() || params.mountPoint.empty() ||
params.username.empty() || params.password.empty()) {
LOC_LOGe("Ntrip parameters are invalid!");
return;
}
struct enableNtripMsg : public LocMsg {
GnssAdapter& mAdapter;
const GnssNtripConnectionParams& mParams;
const GnssNtripConnectionParams mParams;
inline enableNtripMsg(GnssAdapter& adapter,
const GnssNtripConnectionParams& params) :

View file

@ -321,7 +321,6 @@ protected:
void logLatencyInfo();
public:
GnssAdapter();
virtual inline ~GnssAdapter() { }
@ -409,6 +408,8 @@ public:
void deleteAidingData(const GnssAidingData &data, uint32_t sessionId);
void gnssUpdateXtraThrottleCommand(const bool enabled);
std::vector<LocationError> gnssUpdateConfig(const std::string& oldMoServerUrl,
const std::string& moServerUrl,
const std::string& serverUrl,
GnssConfig& gnssConfigRequested,
GnssConfig& gnssConfigNeedEngineUpdate, size_t count = 0);
@ -525,6 +526,8 @@ public:
(
const std::unordered_map<LocationQwesFeatureType, bool> &featureMap
);
void reportPdnTypeFromWds(int pdnType, AGpsExtType agpsType, std::string apnName,
AGpsBearerType bearerType);
/* ======== UTILITIES ================================================================= */
bool needReportForGnssClient(const UlpLocation& ulpLocation,

View file

@ -65,8 +65,8 @@ public:
inline XtraIpcListener(IOsObserver* observer, const MsgTask* msgTask,
XtraSystemStatusObserver& xsso) :
mSystemStatusObsrvr(observer), mMsgTask(msgTask), mXSSO(xsso) {}
virtual void onReceive(const char* data, uint32_t length,
const LocIpcRecver* recver) override {
virtual void onReceive(const char* data, uint32_t /*length*/,
const LocIpcRecver* /*recver*/) override {
#define STRNCMP(str, constStr) strncmp(str, constStr, sizeof(constStr)-1)
if (!STRNCMP(data, "ping")) {
LOC_LOGd("ping received");

View file

@ -27,6 +27,10 @@ ifneq (,$(filter $(LOC_BOARD_PLATFORM_LIST),$(TARGET_BOARD_PLATFORM)))
PRODUCT_PACKAGES += gps.conf
PRODUCT_PACKAGES += flp.conf
PRODUCT_PACKAGES += gnss_antenna_info.conf
PRODUCT_PACKAGES += gnss@2.0-base.policy
PRODUCT_PACKAGES += gnss@2.0-xtra-daemon.policy
PRODUCT_PACKAGES += gnss@2.0-xtwifi-client.policy
PRODUCT_PACKAGES += gnss@2.0-xtwifi-inet-agent.policy
PRODUCT_PACKAGES += libloc_pla_headers
PRODUCT_PACKAGES += liblocation_api_headers
PRODUCT_PACKAGES += libgps.utils_headers

View file

@ -4,7 +4,7 @@ cc_library_shared {
name: "liblocation_api",
vendor: true,
sanitize: GNSS_SANITIZE,
shared_libs: [
"libutils",

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017, 2020 The Linux Foundation. All rights reserved.
/* Copyright (c) 2017, 2020-2021 The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@ -634,7 +634,7 @@ uint32_t LocationAPIClientBase::locAPIGetBatchedLocations(uint32_t id, size_t co
}
} else {
retVal = LOCATION_ERROR_ID_UNKNOWN;
LOC_LOGE("%s:%d] invalid session: %d.", __FUNCTION__, __LINE__, id);
LOC_LOGd("unknown session id: %d, might flush() a stopped session", id);
}
}
pthread_mutex_unlock(&mMutex);

View file

@ -4,7 +4,7 @@ cc_library_shared {
name: "libgps.utils",
vendor: true,
sanitize: GNSS_SANITIZE,
//# Libs
shared_libs: [

View file

@ -166,7 +166,7 @@ public:
inline bool sendData(const uint8_t data[], uint32_t length, int32_t msgId) const {
return isSendable() && (send(data, length, msgId) > 0);
}
virtual unique_ptr<LocIpcRecver> getRecver(const shared_ptr<ILocIpcListener>& listener) {
virtual unique_ptr<LocIpcRecver> getRecver(const shared_ptr<ILocIpcListener>& /*listener*/) {
return nullptr;
}
inline virtual void copyDestAddrFrom(const LocIpcSender& otherSender) {}

View file

@ -921,6 +921,7 @@ typedef uint32_t NmeaSentenceTypesMask;
#define LOC_NMEA_MASK_GQGSV_V02 ((NmeaSentenceTypesMask)0x10000000) /**< Enable GQGSV type */
#define LOC_NMEA_MASK_GIGSV_V02 ((NmeaSentenceTypesMask)0x20000000) /**< Enable GIGSV type */
#define LOC_NMEA_MASK_GNDTM_V02 ((NmeaSentenceTypesMask)0x40000000) /**< Enable GNDTM type */
#define LOC_NMEA_MASK_TAGBLOCK_V02 ((NmeaSentenceTypesMask)0x80000000) /**< Enable TAGBLOCK type */
// all bitmasks of general supported NMEA sentenses - debug is not part of this

View file

@ -45,6 +45,7 @@
#define MAX_SATELLITES_IN_USE 12
#define MSEC_IN_ONE_WEEK 604800000ULL
#define UTC_GPS_OFFSET_MSECS 315964800000ULL
#define MAX_TAG_BLOCK_GROUP_CODE (99999)
// GNSS system id according to NMEA spec
#define SYSTEM_ID_GPS 1
@ -566,23 +567,28 @@ SIDE EFFECTS
N/A
===========================================================================*/
static int loc_nmea_put_checksum(char *pNmea, int maxSize)
static int loc_nmea_put_checksum(char *pNmea, int maxSize, bool isTagBlock)
{
uint8_t checksum = 0;
int length = 0;
int checksumLength = 0;
if(NULL == pNmea)
return 0;
pNmea++; //skip the $
pNmea++; //skip the $ or / for Tag Block
while (*pNmea != '\0')
{
checksum ^= *pNmea++;
length++;
}
if (isTagBlock) {
// length now contains tag block sentence string length not including / sign.
checksumLength = snprintf(pNmea, (maxSize-length-1), "*%02X\\", checksum);
} else {
// length now contains nmea sentence string length not including $ sign.
int checksumLength = snprintf(pNmea,(maxSize-length-1),"*%02X\r\n", checksum);
checksumLength = snprintf(pNmea, (maxSize-length-1), "*%02X\r\n", checksum);
}
// total length of nmea sentence is length of nmea sentence inc $ sign plus
// length of checksum (+1 is to cover the $ character in the length).
return (length + checksumLength + 1);
@ -613,7 +619,8 @@ static uint32_t loc_nmea_generate_GSA(const GpsLocationExtended &locationExtende
char* sentence,
int bufSize,
loc_nmea_sv_meta* sv_meta_p,
std::vector<std::string> &nmeaArraystr)
std::vector<std::string> &nmeaArraystr,
bool isTagBlockGroupingEnabled)
{
if (!sentence || bufSize <= 0 || !sv_meta_p)
{
@ -624,9 +631,14 @@ static uint32_t loc_nmea_generate_GSA(const GpsLocationExtended &locationExtende
char* pMarker = sentence;
int lengthRemaining = bufSize;
int length = 0;
int lengthTagBlock = 0;
uint32_t svUsedCount = 0;
uint32_t svUsedList[64] = {0};
uint32_t sentenceCount = 0;
uint32_t sentenceNumber = 1;
size_t svNumber = 1;
static uint32_t code = 1;
char fixType = '\0';
@ -645,9 +657,26 @@ static uint32_t loc_nmea_generate_GSA(const GpsLocationExtended &locationExtende
mask = mask >> 1;
}
if (svUsedCount == 0)
if (svUsedCount == 0) {
return 0;
} else {
sentenceNumber = 1;
sentenceCount = svUsedCount / 12 + (svUsedCount % 12 != 0);
svNumber = 1;
}
while (sentenceNumber <= sentenceCount) {
pMarker = sentence;
lengthRemaining = bufSize;
if (svUsedCount > 12 && isTagBlockGroupingEnabled) {
lengthTagBlock = snprintf(pMarker, lengthRemaining, "\\g:%d-%d-%d", sentenceNumber,
sentenceCount, code);
if (MAX_TAG_BLOCK_GROUP_CODE == code) {
code = 1;
}
lengthTagBlock = loc_nmea_put_checksum(sentence, bufSize, true);
pMarker += lengthTagBlock;
lengthRemaining -= lengthTagBlock;
}
if (sv_meta_p->totalSvUsedCount == 0)
fixType = '1'; // no fix
else if (sv_meta_p->totalSvUsedCount <= 3)
@ -666,25 +695,22 @@ static uint32_t loc_nmea_generate_GSA(const GpsLocationExtended &locationExtende
// s : GNSS System Id
// cc : Checksum value
length = snprintf(pMarker, lengthRemaining, "$%sGSA,A,%c,", talker, fixType);
if (length < 0 || length >= lengthRemaining)
{
if (length < 0 || length >= lengthRemaining) {
LOC_LOGE("NMEA Error in string formatting");
return 0;
}
pMarker += length;
lengthRemaining -= length;
// Add first 12 satellite IDs
for (uint8_t i = 0; i < 12; i++)
// Add 12 satellite IDs
for (uint8_t i = 0; i < 12; i++, svNumber++)
{
if (i < svUsedCount)
length = snprintf(pMarker, lengthRemaining, "%02d,", svUsedList[i]);
if (svNumber <= svUsedCount)
length = snprintf(pMarker, lengthRemaining, "%02d,", svUsedList[svNumber - 1]);
else
length = snprintf(pMarker, lengthRemaining, ",");
if (length < 0 || length >= lengthRemaining)
{
if (length < 0 || length >= lengthRemaining) {
LOC_LOGE("NMEA Error in string formatting");
return 0;
}
@ -713,9 +739,16 @@ static uint32_t loc_nmea_generate_GSA(const GpsLocationExtended &locationExtende
lengthRemaining -= length;
/* Sentence is ready, add checksum and broadcast */
length = loc_nmea_put_checksum(sentence, bufSize);
length = loc_nmea_put_checksum(sentence + lengthTagBlock, bufSize - lengthTagBlock, false);
nmeaArraystr.push_back(sentence);
sentenceNumber++;
if (!isTagBlockGroupingEnabled) {
break;
}
}
if (svUsedCount > 12 && isTagBlockGroupingEnabled) {
code++;
}
return svUsedCount;
}
@ -874,7 +907,7 @@ static void loc_nmea_generate_GSV(const GnssSvNotification &svNotify,
pMarker += length;
lengthRemaining -= length;
length = loc_nmea_put_checksum(sentence, bufSize);
length = loc_nmea_put_checksum(sentence, bufSize, false);
nmeaArraystr.push_back(sentence);
sentenceNumber++;
@ -983,7 +1016,7 @@ static void loc_nmea_generate_DTM(const LocLla &ref_lla,
pMarker += length;
lengthRemaining -= length;
length = loc_nmea_put_checksum(sentence, bufSize);
length = loc_nmea_put_checksum(sentence, bufSize, false);
}
/*===========================================================================
@ -1299,7 +1332,8 @@ void loc_nmea_generate_pos(const UlpLocation &location,
unsigned char generate_nmea,
bool custom_gga_fix_quality,
std::vector<std::string> &nmeaArraystr,
int& indexOfGGA)
int& indexOfGGA,
bool isTagBlockGroupingEnabled)
{
ENTRY_LOG();
@ -1380,7 +1414,7 @@ void loc_nmea_generate_pos(const UlpLocation &location,
count = loc_nmea_generate_GSA(locationExtended, sentence, sizeof(sentence),
loc_nmea_sv_meta_init(sv_meta, sv_cache_info, GNSS_SV_TYPE_GPS,
GNSS_SIGNAL_GPS_L1CA, true), nmeaArraystr);
GNSS_SIGNAL_GPS_L1CA, true), nmeaArraystr, isTagBlockGroupingEnabled);
if (count > 0)
{
svUsedCount += count;
@ -1394,7 +1428,7 @@ void loc_nmea_generate_pos(const UlpLocation &location,
count = loc_nmea_generate_GSA(locationExtended, sentence, sizeof(sentence),
loc_nmea_sv_meta_init(sv_meta, sv_cache_info, GNSS_SV_TYPE_GLONASS,
GNSS_SIGNAL_GLONASS_G1, true), nmeaArraystr);
GNSS_SIGNAL_GLONASS_G1, true), nmeaArraystr, isTagBlockGroupingEnabled);
if (count > 0)
{
svUsedCount += count;
@ -1408,7 +1442,7 @@ void loc_nmea_generate_pos(const UlpLocation &location,
count = loc_nmea_generate_GSA(locationExtended, sentence, sizeof(sentence),
loc_nmea_sv_meta_init(sv_meta, sv_cache_info, GNSS_SV_TYPE_GALILEO,
GNSS_SIGNAL_GALILEO_E1, true), nmeaArraystr);
GNSS_SIGNAL_GALILEO_E1, true), nmeaArraystr, isTagBlockGroupingEnabled);
if (count > 0)
{
svUsedCount += count;
@ -1421,7 +1455,7 @@ void loc_nmea_generate_pos(const UlpLocation &location,
// ----------------------------
count = loc_nmea_generate_GSA(locationExtended, sentence, sizeof(sentence),
loc_nmea_sv_meta_init(sv_meta, sv_cache_info, GNSS_SV_TYPE_BEIDOU,
GNSS_SIGNAL_BEIDOU_B1I, true), nmeaArraystr);
GNSS_SIGNAL_BEIDOU_B1I, true), nmeaArraystr, isTagBlockGroupingEnabled);
if (count > 0)
{
svUsedCount += count;
@ -1435,7 +1469,7 @@ void loc_nmea_generate_pos(const UlpLocation &location,
count = loc_nmea_generate_GSA(locationExtended, sentence, sizeof(sentence),
loc_nmea_sv_meta_init(sv_meta, sv_cache_info, GNSS_SV_TYPE_QZSS,
GNSS_SIGNAL_QZSS_L1CA, true), nmeaArraystr);
GNSS_SIGNAL_QZSS_L1CA, true), nmeaArraystr, isTagBlockGroupingEnabled);
if (count > 0)
{
svUsedCount += count;
@ -1447,7 +1481,7 @@ void loc_nmea_generate_pos(const UlpLocation &location,
// in this case, generate an empty GSA sentence
if (svUsedCount == 0) {
strlcpy(sentence, "$GPGSA,A,1,,,,,,,,,,,,,,,,", sizeof(sentence));
length = loc_nmea_put_checksum(sentence, sizeof(sentence));
length = loc_nmea_put_checksum(sentence, sizeof(sentence), false);
nmeaArraystr.push_back(sentence);
}
@ -1514,7 +1548,7 @@ void loc_nmea_generate_pos(const UlpLocation &location,
length = snprintf(pMarker, lengthRemaining, "%c", vtgModeIndicator);
length = loc_nmea_put_checksum(sentence, sizeof(sentence));
length = loc_nmea_put_checksum(sentence, sizeof(sentence), false);
nmeaArraystr.push_back(sentence);
memset(&ecef_w84, 0, sizeof(ecef_w84));
@ -1718,7 +1752,7 @@ void loc_nmea_generate_pos(const UlpLocation &location,
// hardcode Navigation Status field to 'V'
length = snprintf(pMarker, lengthRemaining, ",%c", 'V');
length = loc_nmea_put_checksum(sentence_RMC, sizeof(sentence_RMC));
length = loc_nmea_put_checksum(sentence_RMC, sizeof(sentence_RMC), false);
// -------------------
// ------$--GNS-------
@ -1880,7 +1914,7 @@ void loc_nmea_generate_pos(const UlpLocation &location,
pMarker += length;
lengthRemaining -= length;
length = loc_nmea_put_checksum(sentence_GNS, sizeof(sentence_GNS));
length = loc_nmea_put_checksum(sentence_GNS, sizeof(sentence_GNS), false);
// -------------------
// ------$--GGA-------
@ -2037,7 +2071,7 @@ void loc_nmea_generate_pos(const UlpLocation &location,
lengthRemaining -= length;
}
length = loc_nmea_put_checksum(sentence_GGA, sizeof(sentence_GGA));
length = loc_nmea_put_checksum(sentence_GGA, sizeof(sentence_GGA), false);
// ------$--DTM-------
nmeaArraystr.push_back(sentence_DTM);
@ -2060,27 +2094,27 @@ void loc_nmea_generate_pos(const UlpLocation &location,
//Send blank NMEA reports for non-final fixes
else {
strlcpy(sentence, "$GPGSA,A,1,,,,,,,,,,,,,,,,", sizeof(sentence));
length = loc_nmea_put_checksum(sentence, sizeof(sentence));
length = loc_nmea_put_checksum(sentence, sizeof(sentence), false);
nmeaArraystr.push_back(sentence);
strlcpy(sentence, "$GPVTG,,T,,M,,N,,K,N", sizeof(sentence));
length = loc_nmea_put_checksum(sentence, sizeof(sentence));
length = loc_nmea_put_checksum(sentence, sizeof(sentence), false);
nmeaArraystr.push_back(sentence);
strlcpy(sentence, "$GPDTM,,,,,,,,", sizeof(sentence));
length = loc_nmea_put_checksum(sentence, sizeof(sentence));
length = loc_nmea_put_checksum(sentence, sizeof(sentence), false);
nmeaArraystr.push_back(sentence);
strlcpy(sentence, "$GPRMC,,V,,,,,,,,,,N,V", sizeof(sentence));
length = loc_nmea_put_checksum(sentence, sizeof(sentence));
length = loc_nmea_put_checksum(sentence, sizeof(sentence), false);
nmeaArraystr.push_back(sentence);
strlcpy(sentence, "$GPGNS,,,,,,N,,,,,,,V", sizeof(sentence));
length = loc_nmea_put_checksum(sentence, sizeof(sentence));
length = loc_nmea_put_checksum(sentence, sizeof(sentence), false);
nmeaArraystr.push_back(sentence);
strlcpy(sentence, "$GPGGA,,,,,,0,,,,,,,,", sizeof(sentence));
length = loc_nmea_put_checksum(sentence, sizeof(sentence));
length = loc_nmea_put_checksum(sentence, sizeof(sentence), false);
nmeaArraystr.push_back(sentence);
}

View file

@ -81,7 +81,8 @@ void loc_nmea_generate_pos(const UlpLocation &location,
unsigned char generate_nmea,
bool custom_gga_fix_quality,
std::vector<std::string> &nmeaArraystr,
int& indexOfGGA);
int& indexOfGGA,
bool isTagBlockGroupingEnabled);
#define DEBUG_NMEA_MINSIZE 6
#define DEBUG_NMEA_MAXSIZE 4096

View file

@ -222,6 +222,8 @@ PRODUCT_GMS_CLIENTID_BASE := android-xiaomi
PRODUCT_PACKAGES += \
android.hardware.gnss@2.1-impl-qti \
android.hardware.gnss@2.1-service-qti \
android.hardware.gnss.measurement_corrections@1.1.vendor \
android.hardware.gnss.visibility_control@1.0.vendor \
libbatching \
libgeofencing \
libgnss \