Merge "Send SUPL notification to the framework for E911 sessions only (older modems)"
This commit is contained in:
commit
4d6bb2da93
5 changed files with 54 additions and 3 deletions
|
@ -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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 ¬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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue