Merge "Send SUPL notification to the framework for E911 sessions only (older modems)"

This commit is contained in:
qctecmdr 2019-05-01 11:37:59 -07:00 committed by Gerrit - the friendly Code Review server
commit 4d6bb2da93
5 changed files with 54 additions and 3 deletions

View file

@ -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, static void convertGnssNfwNotification(GnssNfwNotification& in,
IGnssVisibilityControlCallback::NfwNotification& out) 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. // Methods from ::android::hardware::gnss::visibility_control::V1_0::IGnssVisibilityControl follow.
Return<bool> GnssVisibilityControl::enableNfwLocationAccess(const hidl_vec<::android::hardware::hidl_string>& proxyApps) { 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 = {}; NfwCbInfo cbInfo = {};
cbInfo.visibilityControlCb = (void*)nfwStatusCb; cbInfo.visibilityControlCb = (void*)nfwStatusCb;
cbInfo.isInEmergencySession = (void*)isInEmergencySession;
mGnss->getGnssInterface()->nfwInit(cbInfo); mGnss->getGnssInterface()->nfwInit(cbInfo);

View file

@ -68,9 +68,11 @@ struct GnssVisibilityControl : public IGnssVisibilityControl {
Return<bool> setCallback(const ::android::sp<::android::hardware::gnss::visibility_control::V1_0::IGnssVisibilityControlCallback>& callback) override; Return<bool> setCallback(const ::android::sp<::android::hardware::gnss::visibility_control::V1_0::IGnssVisibilityControlCallback>& callback) override;
void statusCb(GnssNfwNotification notification); void statusCb(GnssNfwNotification notification);
bool isE911Session();
/* Data call setup callback passed down to GNSS HAL implementation */ /* Data call setup callback passed down to GNSS HAL implementation */
static void nfwStatusCb(GnssNfwNotification notification); static void nfwStatusCb(GnssNfwNotification notification);
static bool isInEmergencySession();
private: private:
Gnss* mGnss = nullptr; Gnss* mGnss = nullptr;

View file

@ -94,7 +94,8 @@ GnssAdapter::GnssAdapter() :
mPowerOn(false), mPowerOn(false),
mAllowFlpNetworkFixes(0), mAllowFlpNetworkFixes(0),
mGnssEnergyConsumedCb(nullptr), mGnssEnergyConsumedCb(nullptr),
mPowerStateCb(nullptr) mPowerStateCb(nullptr),
mIsE911Session(NULL)
{ {
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;
@ -3394,21 +3395,36 @@ GnssAdapter::requestNiNotifyEvent(const GnssNiNotification &notify, const void*
struct MsgReportNiNotify : public LocMsg { struct MsgReportNiNotify : public LocMsg {
GnssAdapter& mAdapter; GnssAdapter& mAdapter;
LocApiBase& mApi;
const GnssNiNotification mNotify; const GnssNiNotification mNotify;
const void* mData; const void* mData;
inline MsgReportNiNotify(GnssAdapter& adapter, inline MsgReportNiNotify(GnssAdapter& adapter,
LocApiBase& api,
const GnssNiNotification& notify, const GnssNiNotification& notify,
const void* data) : const void* data) :
LocMsg(), LocMsg(),
mAdapter(adapter), mAdapter(adapter),
mApi(api),
mNotify(notify), mNotify(notify),
mData(data) {} mData(data) {}
inline virtual void proc() const { inline virtual void proc() const {
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); mAdapter.requestNiNotify(mNotify, mData);
} }
}
}; };
sendMsg(new MsgReportNiNotify(*this, notify, data)); sendMsg(new MsgReportNiNotify(*this, *mLocApi, notify, data));
return true; return true;
} }

View file

@ -165,8 +165,10 @@ class GnssAdapter : public LocAdapterBase {
/* ==== NFW =========================================================================== */ /* ==== NFW =========================================================================== */
NfwStatusCb mNfwCb; NfwStatusCb mNfwCb;
IsInEmergencySession mIsE911Session;
inline void initNfw(const NfwCbInfo& cbInfo) { inline void initNfw(const NfwCbInfo& cbInfo) {
mNfwCb = (NfwStatusCb)cbInfo.visibilityControlCb; mNfwCb = (NfwStatusCb)cbInfo.visibilityControlCb;
mIsE911Session = (IsInEmergencySession)cbInfo.isInEmergencySession;
} }
/* ==== ODCPI ========================================================================== */ /* ==== ODCPI ========================================================================== */
@ -396,6 +398,12 @@ public:
mNfwCb(notification); mNfwCb(notification);
} }
} }
inline bool getE911State(void) {
if (NULL != mIsE911Session) {
return mIsE911Session();
}
return false;
}
/*======== GNSSDEBUG ================================================================*/ /*======== GNSSDEBUG ================================================================*/
bool getDebugReport(GnssDebugReport& report); bool getDebugReport(GnssDebugReport& report);

View file

@ -2115,6 +2115,7 @@ typedef void (*AgnssStatusIpV4Cb)(AGnssExtStatusIpV4 status);
* Callback with NFW information. * Callback with NFW information.
*/ */
typedef void(*NfwStatusCb)(GnssNfwNotification notification); typedef void(*NfwStatusCb)(GnssNfwNotification notification);
typedef bool(*IsInEmergencySession)(void);
/* /*
* Callback with AGNSS(IpV6) status information. * Callback with AGNSS(IpV6) status information.