From d6d55a4948301d76a8489a5a166acd1b1385e4a1 Mon Sep 17 00:00:00 2001 From: Mike Cailean Date: Wed, 24 Apr 2019 11:33:20 -0700 Subject: Send SUPL notification to the framework for E911 sessions only (older modems) Change-Id: Icd317f6e4b042c31afc63011596689d5fb35135f CRs-fixed: 2441292 --- gnss/GnssAdapter.cpp | 22 +++++++++++++++++++--- gnss/GnssAdapter.h | 8 ++++++++ 2 files changed, 27 insertions(+), 3 deletions(-) (limited to 'gnss') diff --git a/gnss/GnssAdapter.cpp b/gnss/GnssAdapter.cpp index 2039465..fe0fc9b 100644 --- a/gnss/GnssAdapter.cpp +++ b/gnss/GnssAdapter.cpp @@ -94,7 +94,8 @@ GnssAdapter::GnssAdapter() : mPowerOn(false), mAllowFlpNetworkFixes(0), mGnssEnergyConsumedCb(nullptr), - mPowerStateCb(nullptr) + mPowerStateCb(nullptr), + mIsE911Session(NULL) { LOC_LOGD("%s]: Constructor %p", __func__, this); mLocPositionMode.mode = LOC_POSITION_MODE_INVALID; @@ -3367,21 +3368,36 @@ GnssAdapter::requestNiNotifyEvent(const GnssNiNotification ¬ify, const void* struct MsgReportNiNotify : public LocMsg { GnssAdapter& mAdapter; + LocApiBase& mApi; const GnssNiNotification mNotify; const void* mData; inline MsgReportNiNotify(GnssAdapter& adapter, + LocApiBase& api, const GnssNiNotification& notify, const void* data) : LocMsg(), mAdapter(adapter), + mApi(api), mNotify(notify), mData(data) {} inline virtual void proc() const { - mAdapter.requestNiNotify(mNotify, mData); + if (GNSS_NI_TYPE_EMERGENCY_SUPL == mNotify.type || + GNSS_NI_TYPE_CONTROL_PLANE == mNotify.type) { + if (mAdapter.getE911State() || + ((GNSS_CONFIG_SUPL_EMERGENCY_SERVICES_NO == ContextBase::mGps_conf.SUPL_ES) && + (GNSS_NI_TYPE_EMERGENCY_SUPL == mNotify.type))) { + mApi.informNiResponse(GNSS_NI_RESPONSE_ACCEPT, mData); + } + else { + mApi.informNiResponse(GNSS_NI_RESPONSE_DENY, mData); + } + } else { + mAdapter.requestNiNotify(mNotify, mData); + } } }; - sendMsg(new MsgReportNiNotify(*this, notify, data)); + sendMsg(new MsgReportNiNotify(*this, *mLocApi, notify, data)); return true; } diff --git a/gnss/GnssAdapter.h b/gnss/GnssAdapter.h index 9720ba4..7b73ec1 100644 --- a/gnss/GnssAdapter.h +++ b/gnss/GnssAdapter.h @@ -165,8 +165,10 @@ class GnssAdapter : public LocAdapterBase { /* ==== NFW =========================================================================== */ NfwStatusCb mNfwCb; + IsInEmergencySession mIsE911Session; inline void initNfw(const NfwCbInfo& cbInfo) { mNfwCb = (NfwStatusCb)cbInfo.visibilityControlCb; + mIsE911Session = (IsInEmergencySession)cbInfo.isInEmergencySession; } /* ==== ODCPI ========================================================================== */ @@ -396,6 +398,12 @@ public: mNfwCb(notification); } } + inline bool getE911State(void) { + if (NULL != mIsE911Session) { + return mIsE911Session(); + } + return false; + } /*======== GNSSDEBUG ================================================================*/ bool getDebugReport(GnssDebugReport& report); -- cgit v1.2.3