Merge f6586f43a3
on remote branch
Change-Id: Ib310eabd737d8d1ec29d07f98fce4dd18e19a221
This commit is contained in:
commit
7ed7c8d65b
5 changed files with 106 additions and 28 deletions
|
@ -23,6 +23,7 @@
|
||||||
#include <log_util.h>
|
#include <log_util.h>
|
||||||
#include "Gnss.h"
|
#include "Gnss.h"
|
||||||
#include "GnssConfiguration.h"
|
#include "GnssConfiguration.h"
|
||||||
|
#include "ContextBase.h"
|
||||||
#include <android/hardware/gnss/1.0/types.h>
|
#include <android/hardware/gnss/1.0/types.h>
|
||||||
|
|
||||||
namespace android {
|
namespace android {
|
||||||
|
@ -32,6 +33,7 @@ namespace V2_0 {
|
||||||
namespace implementation {
|
namespace implementation {
|
||||||
|
|
||||||
using ::android::hardware::gnss::V1_0::GnssConstellationType;
|
using ::android::hardware::gnss::V1_0::GnssConstellationType;
|
||||||
|
using namespace loc_core;
|
||||||
|
|
||||||
GnssConfiguration::GnssConfiguration(Gnss* gnss) : mGnss(gnss) {
|
GnssConfiguration::GnssConfiguration(Gnss* gnss) : mGnss(gnss) {
|
||||||
}
|
}
|
||||||
|
@ -109,8 +111,7 @@ Return<bool> GnssConfiguration::setLppProfile(uint8_t lppProfile) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
GnssConfig config;
|
GnssConfig config = {};
|
||||||
memset(&config, 0, sizeof(GnssConfig));
|
|
||||||
config.size = sizeof(GnssConfig);
|
config.size = sizeof(GnssConfig);
|
||||||
config.flags = GNSS_CONFIG_FLAGS_LPP_PROFILE_VALID_BIT;
|
config.flags = GNSS_CONFIG_FLAGS_LPP_PROFILE_VALID_BIT;
|
||||||
switch (lppProfile) {
|
switch (lppProfile) {
|
||||||
|
@ -162,8 +163,37 @@ Return<bool> GnssConfiguration::setGlonassPositioningProtocol(uint8_t protocol)
|
||||||
return mGnss->updateConfiguration(config);
|
return mGnss->updateConfiguration(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
Return<bool> GnssConfiguration::setGpsLock(uint8_t /*lock*/) {
|
Return<bool> GnssConfiguration::setGpsLock(uint8_t lock) {
|
||||||
// deprecated function. Must return false to pass VTS
|
|
||||||
|
if (mGnss == nullptr) {
|
||||||
|
LOC_LOGE("%s]: mGnss is nullptr", __FUNCTION__);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
GnssConfig config = {};
|
||||||
|
config.size = sizeof(GnssConfig);
|
||||||
|
config.flags = GNSS_CONFIG_FLAGS_GPS_LOCK_VALID_BIT;
|
||||||
|
switch (lock) {
|
||||||
|
case 0:
|
||||||
|
config.gpsLock = GNSS_CONFIG_GPS_LOCK_NONE;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
config.gpsLock = GNSS_CONFIG_GPS_LOCK_MO;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
config.gpsLock = GNSS_CONFIG_GPS_LOCK_NI;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
config.gpsLock = GNSS_CONFIG_GPS_LOCK_MO_AND_NI;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
LOC_LOGE("%s]: invalid lock: %d.", __FUNCTION__, lock);
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
mGnss->updateConfiguration(config);
|
||||||
|
// Must return false to pass VTS
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,7 @@ GNSS_HIDL_2_0_TARGET_LIST += $(TRINKET)
|
||||||
GNSS_HIDL_2_0_TARGET_LIST += kona
|
GNSS_HIDL_2_0_TARGET_LIST += kona
|
||||||
GNSS_HIDL_2_0_TARGET_LIST += atoll
|
GNSS_HIDL_2_0_TARGET_LIST += atoll
|
||||||
GNSS_HIDL_2_0_TARGET_LIST += lito
|
GNSS_HIDL_2_0_TARGET_LIST += lito
|
||||||
|
GNSS_HIDL_2_0_TARGET_LIST += bengal
|
||||||
|
|
||||||
ifneq (,$(filter $(GNSS_HIDL_2_0_TARGET_LIST),$(TARGET_BOARD_PLATFORM)))
|
ifneq (,$(filter $(GNSS_HIDL_2_0_TARGET_LIST),$(TARGET_BOARD_PLATFORM)))
|
||||||
GNSS_HIDL_VERSION = 2.0
|
GNSS_HIDL_VERSION = 2.0
|
||||||
|
|
|
@ -401,7 +401,7 @@ void LocApiBase::sendNfwNotification(GnssNfwNotification& notification)
|
||||||
void LocApiBase::reportSv(GnssSvNotification& svNotify)
|
void LocApiBase::reportSv(GnssSvNotification& svNotify)
|
||||||
{
|
{
|
||||||
const char* constellationString[] = { "Unknown", "GPS", "SBAS", "GLONASS",
|
const char* constellationString[] = { "Unknown", "GPS", "SBAS", "GLONASS",
|
||||||
"QZSS", "BEIDOU", "GALILEO" };
|
"QZSS", "BEIDOU", "GALILEO", "NAVIC" };
|
||||||
|
|
||||||
// print the SV info before delivering
|
// print the SV info before delivering
|
||||||
LOC_LOGV("num sv: %u\n"
|
LOC_LOGV("num sv: %u\n"
|
||||||
|
|
|
@ -73,7 +73,7 @@ GnssAdapter::GnssAdapter() :
|
||||||
mGnssSvIdUsedInPosition(),
|
mGnssSvIdUsedInPosition(),
|
||||||
mGnssSvIdUsedInPosAvail(false),
|
mGnssSvIdUsedInPosAvail(false),
|
||||||
mControlCallbacks(),
|
mControlCallbacks(),
|
||||||
mPowerVoteId(0),
|
mAfwControlId(0),
|
||||||
mNmeaMask(0),
|
mNmeaMask(0),
|
||||||
mGnssSvIdConfig(),
|
mGnssSvIdConfig(),
|
||||||
mGnssSvTypeConfig(),
|
mGnssSvTypeConfig(),
|
||||||
|
@ -97,7 +97,8 @@ GnssAdapter::GnssAdapter() :
|
||||||
mPowerStateCb(nullptr),
|
mPowerStateCb(nullptr),
|
||||||
mIsE911Session(NULL),
|
mIsE911Session(NULL),
|
||||||
mGnssMbSvIdUsedInPosition{},
|
mGnssMbSvIdUsedInPosition{},
|
||||||
mGnssMbSvIdUsedInPosAvail(false)
|
mGnssMbSvIdUsedInPosAvail(false),
|
||||||
|
mSupportNfwControl(true)
|
||||||
{
|
{
|
||||||
LOC_LOGD("%s]: Constructor %p", __func__, this);
|
LOC_LOGD("%s]: Constructor %p", __func__, this);
|
||||||
mLocPositionMode.mode = LOC_POSITION_MODE_INVALID;
|
mLocPositionMode.mode = LOC_POSITION_MODE_INVALID;
|
||||||
|
@ -724,7 +725,24 @@ GnssAdapter::setConfig()
|
||||||
GNSS_CONFIG_FLAGS_LPPE_CONTROL_PLANE_VALID_BIT |
|
GNSS_CONFIG_FLAGS_LPPE_CONTROL_PLANE_VALID_BIT |
|
||||||
GNSS_CONFIG_FLAGS_LPPE_USER_PLANE_VALID_BIT |
|
GNSS_CONFIG_FLAGS_LPPE_USER_PLANE_VALID_BIT |
|
||||||
GNSS_CONFIG_FLAGS_BLACKLISTED_SV_IDS_BIT;
|
GNSS_CONFIG_FLAGS_BLACKLISTED_SV_IDS_BIT;
|
||||||
|
/* Here we process an SSR. We need to set the GPS_LOCK to the proper values, as follows:
|
||||||
|
1. Q behavior. This is identified by mSupportNfwControl being 1. In this case
|
||||||
|
ContextBase::mGps_conf.GPS_LOCK is a "state", meaning it should reflect the
|
||||||
|
NV value. Therefore we will set the NV to ContextBase::mGps_conf.GPS_LOCK
|
||||||
|
2. P behavior. This is identified by mSupportNfwControl being 0. In this case
|
||||||
|
ContextBase::mGps_conf.GPS_LOCK is a "configuration", meaning it should hold
|
||||||
|
the "mask" for NI. There are two subcases:
|
||||||
|
a. Location enabled in GUI (1 == getAfwControlId()). We need to set
|
||||||
|
the NV to GNSS_CONFIG_GPS_LOCK_NONE (both MO and NI enabled)
|
||||||
|
b. Location disabled in GUI (0 == getAfwControlId()). We need to set
|
||||||
|
the NV to ContextBase::mGps_conf.GPS_LOCK (the "mask", which is SIM-card
|
||||||
|
specific)
|
||||||
|
*/
|
||||||
|
if (mSupportNfwControl || (0 == getAfwControlId())) {
|
||||||
gnssConfigRequested.gpsLock = gpsConf.GPS_LOCK;
|
gnssConfigRequested.gpsLock = gpsConf.GPS_LOCK;
|
||||||
|
} else {
|
||||||
|
gnssConfigRequested.gpsLock = GNSS_CONFIG_GPS_LOCK_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
if (gpsConf.AGPS_CONFIG_INJECT) {
|
if (gpsConf.AGPS_CONFIG_INJECT) {
|
||||||
gnssConfigRequested.flags |= GNSS_CONFIG_FLAGS_SET_ASSISTANCE_DATA_VALID_BIT |
|
gnssConfigRequested.flags |= GNSS_CONFIG_FLAGS_SET_ASSISTANCE_DATA_VALID_BIT |
|
||||||
|
@ -1067,8 +1085,31 @@ GnssAdapter::gnssUpdateConfigCommand(GnssConfig config)
|
||||||
if (GNSS_CONFIG_GPS_LOCK_NONE == newGpsLock) {
|
if (GNSS_CONFIG_GPS_LOCK_NONE == newGpsLock) {
|
||||||
newGpsLock = GNSS_CONFIG_GPS_LOCK_MO;
|
newGpsLock = GNSS_CONFIG_GPS_LOCK_MO;
|
||||||
}
|
}
|
||||||
gnssConfigNeedEngineUpdate.flags &= ~(GNSS_CONFIG_FLAGS_GPS_LOCK_VALID_BIT);
|
|
||||||
ContextBase::mGps_conf.GPS_LOCK = newGpsLock;
|
ContextBase::mGps_conf.GPS_LOCK = newGpsLock;
|
||||||
|
/* If we get here it means that the changes in the framework to request for
|
||||||
|
'P' behavior were made, and therefore we need to "behave" as in 'P'
|
||||||
|
However, we need to determine if enableCommand function has already been
|
||||||
|
called, since it could get called before this function.*/
|
||||||
|
if (0 != mAdapter.getAfwControlId()) {
|
||||||
|
/* enableCommand function has already been called since getAfwControlId
|
||||||
|
returns non zero. Now there are two possible cases:
|
||||||
|
1. This is the first time this function is called
|
||||||
|
(mSupportNfwControl is true). We need to behave as in 'P', but
|
||||||
|
for the first time, meaning MO was enabled, but NI was not, so
|
||||||
|
we need to unlock NI
|
||||||
|
2. This is not the first time this function is called, meaning we
|
||||||
|
are already behaving as in 'P'. No need to update the configuration
|
||||||
|
in this case (return to 'P' code) */
|
||||||
|
if (mAdapter.mSupportNfwControl) {
|
||||||
|
// case 1 above
|
||||||
|
newGpsLock &= ~GNSS_CONFIG_GPS_LOCK_NI;
|
||||||
|
} else {
|
||||||
|
// case 2 above
|
||||||
|
gnssConfigNeedEngineUpdate.flags &= ~(GNSS_CONFIG_FLAGS_GPS_LOCK_VALID_BIT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
gnssConfigRequested.gpsLock = newGpsLock;
|
||||||
|
mAdapter.mSupportNfwControl = false;
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
if (gnssConfigRequested.flags & GNSS_CONFIG_FLAGS_SUPL_VERSION_VALID_BIT) {
|
if (gnssConfigRequested.flags & GNSS_CONFIG_FLAGS_SUPL_VERSION_VALID_BIT) {
|
||||||
|
@ -2926,18 +2967,20 @@ GnssAdapter::enableCommand(LocationTechnologyType techType)
|
||||||
mTechType(techType) {}
|
mTechType(techType) {}
|
||||||
inline virtual void proc() const {
|
inline virtual void proc() const {
|
||||||
LocationError err = LOCATION_ERROR_SUCCESS;
|
LocationError err = LOCATION_ERROR_SUCCESS;
|
||||||
uint32_t powerVoteId = mAdapter.getAfwControlId();
|
uint32_t afwControlId = mAdapter.getAfwControlId();
|
||||||
if (mTechType != LOCATION_TECHNOLOGY_TYPE_GNSS) {
|
if (mTechType != LOCATION_TECHNOLOGY_TYPE_GNSS) {
|
||||||
err = LOCATION_ERROR_INVALID_PARAMETER;
|
err = LOCATION_ERROR_INVALID_PARAMETER;
|
||||||
} else if (powerVoteId > 0) {
|
} else if (afwControlId > 0) {
|
||||||
err = LOCATION_ERROR_ALREADY_STARTED;
|
err = LOCATION_ERROR_ALREADY_STARTED;
|
||||||
} else {
|
} else {
|
||||||
mContext.modemPowerVote(true);
|
mContext.modemPowerVote(true);
|
||||||
mAdapter.setAfwControlId(mSessionId);
|
mAdapter.setAfwControlId(mSessionId);
|
||||||
|
|
||||||
GnssConfigGpsLock gpsLock = GNSS_CONFIG_GPS_LOCK_NONE;
|
GnssConfigGpsLock gpsLock = GNSS_CONFIG_GPS_LOCK_NONE;
|
||||||
|
if (mAdapter.mSupportNfwControl) {
|
||||||
ContextBase::mGps_conf.GPS_LOCK &= GNSS_CONFIG_GPS_LOCK_NI;
|
ContextBase::mGps_conf.GPS_LOCK &= GNSS_CONFIG_GPS_LOCK_NI;
|
||||||
gpsLock = ContextBase::mGps_conf.GPS_LOCK;
|
gpsLock = ContextBase::mGps_conf.GPS_LOCK;
|
||||||
|
}
|
||||||
mApi.sendMsg(new LocApiMsg([&mApi = mApi, gpsLock]() {
|
mApi.sendMsg(new LocApiMsg([&mApi = mApi, gpsLock]() {
|
||||||
mApi.setGpsLockSync(gpsLock);
|
mApi.setGpsLockSync(gpsLock);
|
||||||
}));
|
}));
|
||||||
|
@ -2977,21 +3020,22 @@ GnssAdapter::disableCommand(uint32_t id)
|
||||||
mSessionId(sessionId) {}
|
mSessionId(sessionId) {}
|
||||||
inline virtual void proc() const {
|
inline virtual void proc() const {
|
||||||
LocationError err = LOCATION_ERROR_SUCCESS;
|
LocationError err = LOCATION_ERROR_SUCCESS;
|
||||||
uint32_t powerVoteId = mAdapter.getAfwControlId();
|
uint32_t afwControlId = mAdapter.getAfwControlId();
|
||||||
if (powerVoteId != mSessionId) {
|
if (afwControlId != mSessionId) {
|
||||||
err = LOCATION_ERROR_ID_UNKNOWN;
|
err = LOCATION_ERROR_ID_UNKNOWN;
|
||||||
} else {
|
} else {
|
||||||
mContext.modemPowerVote(false);
|
mContext.modemPowerVote(false);
|
||||||
mAdapter.setAfwControlId(0);
|
mAdapter.setAfwControlId(0);
|
||||||
|
|
||||||
|
if (mAdapter.mSupportNfwControl) {
|
||||||
/* We need to disable MO (AFW) */
|
/* We need to disable MO (AFW) */
|
||||||
ContextBase::mGps_conf.GPS_LOCK |= GNSS_CONFIG_GPS_LOCK_MO;
|
ContextBase::mGps_conf.GPS_LOCK |= GNSS_CONFIG_GPS_LOCK_MO;
|
||||||
|
}
|
||||||
GnssConfigGpsLock gpsLock = ContextBase::mGps_conf.GPS_LOCK;
|
GnssConfigGpsLock gpsLock = ContextBase::mGps_conf.GPS_LOCK;
|
||||||
mApi.sendMsg(new LocApiMsg([&mApi = mApi,gpsLock] () {
|
mApi.sendMsg(new LocApiMsg([&mApi = mApi, gpsLock]() {
|
||||||
mApi.setGpsLockSync(gpsLock);
|
mApi.setGpsLockSync(gpsLock);
|
||||||
}));
|
}));
|
||||||
mAdapter.mXtraObserver.updateLockStatus(
|
mAdapter.mXtraObserver.updateLockStatus(gpsLock);
|
||||||
ContextBase::mGps_conf.GPS_LOCK);
|
|
||||||
}
|
}
|
||||||
mAdapter.reportResponse(err, mSessionId);
|
mAdapter.reportResponse(err, mSessionId);
|
||||||
}
|
}
|
||||||
|
@ -4775,11 +4819,11 @@ GnssAdapter::getGnssEnergyConsumedCommand(GnssEnergyConsumedCallback energyConsu
|
||||||
|
|
||||||
void
|
void
|
||||||
GnssAdapter::nfwControlCommand(bool enable) {
|
GnssAdapter::nfwControlCommand(bool enable) {
|
||||||
struct MsgenableNfwLocationAccess : public LocMsg {
|
struct MsgControlNfwLocationAccess : public LocMsg {
|
||||||
GnssAdapter& mAdapter;
|
GnssAdapter& mAdapter;
|
||||||
LocApiBase& mApi;
|
LocApiBase& mApi;
|
||||||
bool mEnable;
|
bool mEnable;
|
||||||
inline MsgenableNfwLocationAccess(GnssAdapter& adapter, LocApiBase& api,
|
inline MsgControlNfwLocationAccess(GnssAdapter& adapter, LocApiBase& api,
|
||||||
bool enable) :
|
bool enable) :
|
||||||
LocMsg(),
|
LocMsg(),
|
||||||
mAdapter(adapter),
|
mAdapter(adapter),
|
||||||
|
@ -4801,7 +4845,11 @@ GnssAdapter::nfwControlCommand(bool enable) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
sendMsg(new MsgenableNfwLocationAccess(*this, *mLocApi, enable));
|
if (mSupportNfwControl) {
|
||||||
|
sendMsg(new MsgControlNfwLocationAccess(*this, *mLocApi, enable));
|
||||||
|
} else {
|
||||||
|
LOC_LOGw("NFW control is not supported, do not use this for NFW");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ==== Eng Hub Proxy ================================================================= */
|
/* ==== Eng Hub Proxy ================================================================= */
|
||||||
|
|
|
@ -150,11 +150,12 @@ class GnssAdapter : public LocAdapterBase {
|
||||||
|
|
||||||
/* ==== CONTROL ======================================================================== */
|
/* ==== CONTROL ======================================================================== */
|
||||||
LocationControlCallbacks mControlCallbacks;
|
LocationControlCallbacks mControlCallbacks;
|
||||||
uint32_t mPowerVoteId;
|
uint32_t mAfwControlId;
|
||||||
uint32_t mNmeaMask;
|
uint32_t mNmeaMask;
|
||||||
GnssSvIdConfig mGnssSvIdConfig;
|
GnssSvIdConfig mGnssSvIdConfig;
|
||||||
GnssSvTypeConfig mGnssSvTypeConfig;
|
GnssSvTypeConfig mGnssSvTypeConfig;
|
||||||
GnssSvTypeConfigCallback mGnssSvTypeConfigCb;
|
GnssSvTypeConfigCallback mGnssSvTypeConfigCb;
|
||||||
|
bool mSupportNfwControl;
|
||||||
|
|
||||||
/* ==== NI ============================================================================= */
|
/* ==== NI ============================================================================= */
|
||||||
NiData mNiData;
|
NiData mNiData;
|
||||||
|
@ -337,10 +338,8 @@ public:
|
||||||
LocationControlCallbacks& getControlCallbacks() { return mControlCallbacks; }
|
LocationControlCallbacks& getControlCallbacks() { return mControlCallbacks; }
|
||||||
void setControlCallbacks(const LocationControlCallbacks& controlCallbacks)
|
void setControlCallbacks(const LocationControlCallbacks& controlCallbacks)
|
||||||
{ mControlCallbacks = controlCallbacks; }
|
{ mControlCallbacks = controlCallbacks; }
|
||||||
void setAfwControlId(uint32_t id) { mPowerVoteId = id; }
|
void setAfwControlId(uint32_t id) { mAfwControlId = id; }
|
||||||
uint32_t getAfwControlId() { return mPowerVoteId; }
|
uint32_t getAfwControlId() { return mAfwControlId; }
|
||||||
void setPowerVoteId(uint32_t id) { mPowerVoteId = id; }
|
|
||||||
uint32_t getPowerVoteId() { return mPowerVoteId; }
|
|
||||||
virtual bool isInSession() { return !mTimeBasedTrackingSessions.empty(); }
|
virtual bool isInSession() { return !mTimeBasedTrackingSessions.empty(); }
|
||||||
void initDefaultAgps();
|
void initDefaultAgps();
|
||||||
bool initEngHubProxy();
|
bool initEngHubProxy();
|
||||||
|
|
Loading…
Reference in a new issue