diff options
author | Mike Cailean <mcailean@codeaurora.org> | 2019-04-24 11:33:20 -0700 |
---|---|---|
committer | Mike Cailean <mcailean@codeaurora.org> | 2019-04-30 09:27:41 -0700 |
commit | d6d55a4948301d76a8489a5a166acd1b1385e4a1 (patch) | |
tree | e52294314ee4a87d70bd7761178a120658f620ef | |
parent | 9b1ce8887233de61c476bff6d114be9b4ac9aa68 (diff) | |
download | gps-d6d55a4948301d76a8489a5a166acd1b1385e4a1.tar.gz |
Send SUPL notification to the framework for
E911 sessions only (older modems)
Change-Id: Icd317f6e4b042c31afc63011596689d5fb35135f
CRs-fixed: 2441292
-rw-r--r-- | android/visibility_control/1.0/GnssVisibilityControl.cpp | 24 | ||||
-rw-r--r-- | android/visibility_control/1.0/GnssVisibilityControl.h | 2 | ||||
-rw-r--r-- | gnss/GnssAdapter.cpp | 22 | ||||
-rw-r--r-- | gnss/GnssAdapter.h | 8 | ||||
-rw-r--r-- | utils/gps_extended_c.h | 1 |
5 files changed, 54 insertions, 3 deletions
diff --git a/android/visibility_control/1.0/GnssVisibilityControl.cpp b/android/visibility_control/1.0/GnssVisibilityControl.cpp index 82e465c..5a8c697 100644 --- a/android/visibility_control/1.0/GnssVisibilityControl.cpp +++ b/android/visibility_control/1.0/GnssVisibilityControl.cpp @@ -66,6 +66,13 @@ void GnssVisibilityControl::nfwStatusCb(GnssNfwNotification notification) { } } +bool GnssVisibilityControl::isInEmergencySession() { + if (nullptr != spGnssVisibilityControl) { + return spGnssVisibilityControl->isE911Session(); + } + return false; +} + static void convertGnssNfwNotification(GnssNfwNotification& in, IGnssVisibilityControlCallback::NfwNotification& out) { @@ -97,6 +104,22 @@ void GnssVisibilityControl::statusCb(GnssNfwNotification notification) { } } +bool GnssVisibilityControl::isE911Session() { + + if (mGnssVisibilityControlCbIface != nullptr) { + auto r = mGnssVisibilityControlCbIface->isInEmergencySession(); + if (!r.isOk()) { + LOC_LOGw("Error invoking NFW status cb %s", r.description().c_str()); + return false; + } else { + return (r); + } + } else { + LOC_LOGw("setCallback has not been called yet"); + return false; + } +} + // Methods from ::android::hardware::gnss::visibility_control::V1_0::IGnssVisibilityControl follow. Return<bool> GnssVisibilityControl::enableNfwLocationAccess(const hidl_vec<::android::hardware::hidl_string>& proxyApps) { @@ -131,6 +154,7 @@ Return<bool> GnssVisibilityControl::setCallback(const ::android::sp<::android::h NfwCbInfo cbInfo = {}; cbInfo.visibilityControlCb = (void*)nfwStatusCb; + cbInfo.isInEmergencySession = (void*)isInEmergencySession; mGnss->getGnssInterface()->nfwInit(cbInfo); diff --git a/android/visibility_control/1.0/GnssVisibilityControl.h b/android/visibility_control/1.0/GnssVisibilityControl.h index 4eaea51..9c26e38 100644 --- a/android/visibility_control/1.0/GnssVisibilityControl.h +++ b/android/visibility_control/1.0/GnssVisibilityControl.h @@ -68,9 +68,11 @@ struct GnssVisibilityControl : public IGnssVisibilityControl { Return<bool> setCallback(const ::android::sp<::android::hardware::gnss::visibility_control::V1_0::IGnssVisibilityControlCallback>& callback) override; void statusCb(GnssNfwNotification notification); + bool isE911Session(); /* Data call setup callback passed down to GNSS HAL implementation */ static void nfwStatusCb(GnssNfwNotification notification); + static bool isInEmergencySession(); private: Gnss* mGnss = nullptr; 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); diff --git a/utils/gps_extended_c.h b/utils/gps_extended_c.h index 279fa20..1851783 100644 --- a/utils/gps_extended_c.h +++ b/utils/gps_extended_c.h @@ -2115,6 +2115,7 @@ typedef void (*AgnssStatusIpV4Cb)(AGnssExtStatusIpV4 status); * Callback with NFW information. */ typedef void(*NfwStatusCb)(GnssNfwNotification notification); +typedef bool(*IsInEmergencySession)(void); /* * Callback with AGNSS(IpV6) status information. |