summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorqctecmdr <qctecmdr@localhost>2019-05-01 11:37:59 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2019-05-01 11:37:59 -0700
commit4d6bb2da93570f07d874e2a76519518c6d4b163f (patch)
tree119993bb7f31f06c8d2cfbbdec5eba9b687f7e8e
parent3e62412eb0233619684ecdbc39b19cbc8ebbdc93 (diff)
parentd6d55a4948301d76a8489a5a166acd1b1385e4a1 (diff)
downloadgps-4d6bb2da93570f07d874e2a76519518c6d4b163f.tar.gz
Merge "Send SUPL notification to the framework for E911 sessions only (older modems)"
-rw-r--r--android/visibility_control/1.0/GnssVisibilityControl.cpp24
-rw-r--r--android/visibility_control/1.0/GnssVisibilityControl.h2
-rw-r--r--gnss/GnssAdapter.cpp22
-rw-r--r--gnss/GnssAdapter.h8
-rw-r--r--utils/gps_extended_c.h1
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 436681a..e1143fd 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;
@@ -3394,21 +3395,36 @@ GnssAdapter::requestNiNotifyEvent(const GnssNiNotification &notify, 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 ae5f5f1..6f652e6 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.