mirror of
https://gitee.com/openharmony/base_location
synced 2024-11-27 00:51:30 +00:00
bugfix
Signed-off-by: 李文龙 <liwenlong22@huawei.com>
This commit is contained in:
parent
3ab31cd475
commit
99bd519e03
@ -57,6 +57,7 @@
|
||||
"ffrt",
|
||||
"form_fwk",
|
||||
"hdf_core",
|
||||
"hicollie",
|
||||
"hisysevent",
|
||||
"hiview",
|
||||
"hilog",
|
||||
|
@ -61,6 +61,7 @@ declare_args() {
|
||||
location_device_standby_enable = true
|
||||
time_service_enable = true
|
||||
net_manager_enable = true
|
||||
location_hicollie_enable = true
|
||||
|
||||
if (defined(global_parts_info) && !defined(global_parts_info.global_i18n)) {
|
||||
i18n_enable = false
|
||||
@ -159,4 +160,9 @@ declare_args() {
|
||||
!defined(global_parts_info.communication_netmanager_base)) {
|
||||
net_manager_enable = false
|
||||
}
|
||||
|
||||
if (defined(global_parts_info) &&
|
||||
!defined(global_parts_info.hiviewdfx_hicollie)) {
|
||||
location_hicollie_enable = false
|
||||
}
|
||||
}
|
||||
|
@ -69,6 +69,11 @@ if (location_feature_with_geocode) {
|
||||
"safwk:system_ability_fwk",
|
||||
]
|
||||
|
||||
if (location_hicollie_enable) {
|
||||
external_deps += [ "hicollie:libhicollie" ]
|
||||
defines += [ "LOCATION_HICOLLIE_ENABLE" ]
|
||||
}
|
||||
|
||||
# Used to control the export of dynamic library symbols.
|
||||
version_script = "liblbsservice_geocode_version_script.txt"
|
||||
|
||||
@ -121,6 +126,11 @@ if (location_feature_with_geocode) {
|
||||
"safwk:system_ability_fwk",
|
||||
]
|
||||
|
||||
if (location_hicollie_enable) {
|
||||
external_deps += [ "hicollie:libhicollie" ]
|
||||
defines += [ "LOCATION_HICOLLIE_ENABLE" ]
|
||||
}
|
||||
|
||||
part_name = "location"
|
||||
subsystem_name = "location"
|
||||
}
|
||||
|
@ -47,9 +47,16 @@ enum class ServiceConnectState {
|
||||
|
||||
class GeoConvertHandler : public AppExecFwk::EventHandler {
|
||||
public:
|
||||
using GeoConvertEventHandler = std::function<void(const AppExecFwk::InnerEvent::Pointer &)>;
|
||||
using GeoConvertEventHandleMap = std::map<int, GeoConvertEventHandler>;
|
||||
explicit GeoConvertHandler(const std::shared_ptr<AppExecFwk::EventRunner>& runner);
|
||||
~GeoConvertHandler() override;
|
||||
private:
|
||||
void ProcessEvent(const AppExecFwk::InnerEvent::Pointer& event) override;
|
||||
void InitGeoConvertHandlerEventMap();
|
||||
void SendGeocodeRequest(const AppExecFwk::InnerEvent::Pointer& event);
|
||||
|
||||
GeoConvertEventHandleMap geoConvertHandlerEventMap_;
|
||||
};
|
||||
|
||||
class GeoServiceDeathRecipient : public IRemoteObject::DeathRecipient {
|
||||
|
@ -26,6 +26,10 @@
|
||||
#include "location_dumper.h"
|
||||
#include "location_sa_load_manager.h"
|
||||
#include "system_ability_definition.h"
|
||||
#ifdef LOCATION_HICOLLIE_ENABLE
|
||||
#include "xcollie/xcollie.h"
|
||||
#include "xcollie/xcollie_define.h"
|
||||
#endif
|
||||
|
||||
namespace OHOS {
|
||||
namespace Location {
|
||||
@ -36,6 +40,8 @@ const char* UNLOAD_GEOCONVERT_TASK = "geoconvert_sa_unload";
|
||||
const int GEOCONVERT_CONNECT_TIME_OUT = 1;
|
||||
const uint32_t EVENT_INTERVAL_UNITE = 1000;
|
||||
const int UNLOAD_GEOCONVERT_DELAY_TIME = 5 * EVENT_INTERVAL_UNITE;
|
||||
const int TIMEOUT_WATCHDOG = 60; // s
|
||||
|
||||
GeoConvertService* GeoConvertService::GetInstance()
|
||||
{
|
||||
static GeoConvertService data;
|
||||
@ -471,37 +477,68 @@ void GeoServiceDeathRecipient::OnRemoteDied(const wptr<IRemoteObject> &remote)
|
||||
}
|
||||
}
|
||||
|
||||
GeoConvertHandler::GeoConvertHandler(const std::shared_ptr<AppExecFwk::EventRunner>& runner) : EventHandler(runner) {}
|
||||
GeoConvertHandler::GeoConvertHandler(const std::shared_ptr<AppExecFwk::EventRunner>& runner) : EventHandler(runner)
|
||||
{
|
||||
InitGeoConvertHandlerEventMap();
|
||||
}
|
||||
|
||||
GeoConvertHandler::~GeoConvertHandler() {}
|
||||
|
||||
void GeoConvertHandler::InitGeoConvertHandlerEventMap()
|
||||
{
|
||||
if (geoConvertHandlerEventMap_.size() != 0) {
|
||||
return;
|
||||
}
|
||||
geoConvertHandlerEventMap_[EVENT_SEND_GEOREQUEST] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer& event) { SendGeocodeRequest(event); };
|
||||
}
|
||||
|
||||
void GeoConvertHandler::ProcessEvent(const AppExecFwk::InnerEvent::Pointer& event)
|
||||
{
|
||||
auto geoConvertService = GeoConvertService::GetInstance();
|
||||
uint32_t eventId = event->GetInnerEventId();
|
||||
LBSLOGD(GEO_CONVERT, "ProcessEvent event:%{public}d", eventId);
|
||||
switch (eventId) {
|
||||
case EVENT_SEND_GEOREQUEST: {
|
||||
std::unique_ptr<GeoConvertRequest> geoConvertRequest = event->GetUniqueObject<GeoConvertRequest>();
|
||||
if (geoConvertRequest == nullptr) {
|
||||
return;
|
||||
}
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel replyParcel;
|
||||
MessageOption option;
|
||||
geoConvertRequest->Marshalling(dataParcel);
|
||||
bool ret = geoConvertService->SendGeocodeRequest(static_cast<int>(geoConvertRequest->GetRequestType()),
|
||||
dataParcel, replyParcel, option);
|
||||
if (!ret) {
|
||||
LBSLOGE(GEO_CONVERT, "SendGeocodeRequest failed errcode");
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
auto handleFunc = geoConvertHandlerEventMap_.find(eventId);
|
||||
if (handleFunc != geoConvertHandlerEventMap_.end() && handleFunc->second != nullptr) {
|
||||
auto memberFunc = handleFunc->second;
|
||||
#ifdef LOCATION_HICOLLIE_ENABLE
|
||||
int tid = gettid();
|
||||
std::string moduleName = "GeoConvertHandler";
|
||||
XCollieCallback callbackFunc = [moduleName, eventId, tid](void *) {
|
||||
LBSLOGE(GEO_CONVERT,
|
||||
"TimeoutCallback tid:%{public}d moduleName:%{public}s excute eventId:%{public}u timeout.",
|
||||
tid, moduleName.c_str(), eventId);
|
||||
};
|
||||
std::string dfxInfo = moduleName + "_" + std::to_string(eventId) + "_" + std::to_string(tid);
|
||||
int timerId = HiviewDFX::XCollie::GetInstance().SetTimer(dfxInfo, TIMEOUT_WATCHDOG, callbackFunc, nullptr,
|
||||
HiviewDFX::XCOLLIE_FLAG_LOG|HiviewDFX::XCOLLIE_FLAG_RECOVERY);
|
||||
memberFunc(event);
|
||||
HiviewDFX::XCollie::GetInstance().CancelTimer(timerId);
|
||||
#else
|
||||
memberFunc(event);
|
||||
#endif
|
||||
} else {
|
||||
LBSLOGE(GEO_CONVERT, "ProcessEvent event:%{public}d, unsupport service.", eventId);
|
||||
}
|
||||
}
|
||||
|
||||
void GeoConvertHandler::SendGeocodeRequest(const AppExecFwk::InnerEvent::Pointer& event)
|
||||
{
|
||||
std::unique_ptr<GeoConvertRequest> geoConvertRequest = event->GetUniqueObject<GeoConvertRequest>();
|
||||
if (geoConvertRequest == nullptr) {
|
||||
return;
|
||||
}
|
||||
auto geoConvertService = GeoConvertService::GetInstance();
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel replyParcel;
|
||||
MessageOption option;
|
||||
geoConvertRequest->Marshalling(dataParcel);
|
||||
bool ret = geoConvertService->SendGeocodeRequest(static_cast<int>(geoConvertRequest->GetRequestType()),
|
||||
dataParcel, replyParcel, option);
|
||||
if (!ret) {
|
||||
LBSLOGE(GEO_CONVERT, "SendGeocodeRequest failed errcode");
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Location
|
||||
} // namespace OHOS
|
||||
#endif
|
||||
|
@ -156,6 +156,11 @@ if (location_feature_with_gnss) {
|
||||
defines += [ "NET_MANAGER_ENABLE" ]
|
||||
}
|
||||
|
||||
if (location_hicollie_enable) {
|
||||
external_deps += [ "hicollie:libhicollie" ]
|
||||
defines += [ "LOCATION_HICOLLIE_ENABLE" ]
|
||||
}
|
||||
|
||||
# Used to control the export of dynamic library symbols.
|
||||
version_script = "liblbsservice_gnss_version_script.txt"
|
||||
|
||||
@ -271,6 +276,11 @@ if (location_feature_with_gnss) {
|
||||
defines += [ "NET_MANAGER_ENABLE" ]
|
||||
}
|
||||
|
||||
if (location_hicollie_enable) {
|
||||
external_deps += [ "hicollie:libhicollie" ]
|
||||
defines += [ "LOCATION_HICOLLIE_ENABLE" ]
|
||||
}
|
||||
|
||||
part_name = "location"
|
||||
subsystem_name = "location"
|
||||
}
|
||||
|
@ -56,6 +56,11 @@
|
||||
#include "ntp_time_check.h"
|
||||
#endif
|
||||
|
||||
#ifdef LOCATION_HICOLLIE_ENABLE
|
||||
#include "xcollie/xcollie.h"
|
||||
#include "xcollie/xcollie_define.h"
|
||||
#endif
|
||||
|
||||
namespace OHOS {
|
||||
namespace Location {
|
||||
namespace {
|
||||
@ -74,6 +79,7 @@ const uint32_t RETRY_INTERVAL_OF_UNLOAD_SA = 4 * 60 * EVENT_INTERVAL_UNITE;
|
||||
constexpr int32_t FENCE_MAX_ID = 1000000;
|
||||
constexpr int NLP_FIX_VALID_TIME = 2;
|
||||
const int64_t INVALID_TIME = 0;
|
||||
const int TIMEOUT_WATCHDOG = 60; // s
|
||||
}
|
||||
|
||||
const bool REGISTER_RESULT = SystemAbility::MakeAndRegisterAbility(
|
||||
@ -1630,7 +1636,21 @@ void GnssHandler::ProcessEvent(const AppExecFwk::InnerEvent::Pointer& event)
|
||||
auto handleFunc = gnssEventProcessMap_.find(eventId);
|
||||
if (handleFunc != gnssEventProcessMap_.end() && handleFunc->second != nullptr) {
|
||||
auto memberFunc = handleFunc->second;
|
||||
#ifdef LOCATION_HICOLLIE_ENABLE
|
||||
int tid = gettid();
|
||||
std::string moduleName = "GnssHandler";
|
||||
XCollieCallback callbackFunc = [moduleName, eventId, tid](void *) {
|
||||
LBSLOGE(GNSS, "TimeoutCallback tid:%{public}d moduleName:%{public}s excute eventId:%{public}u timeout.",
|
||||
tid, moduleName.c_str(), eventId);
|
||||
};
|
||||
std::string dfxInfo = moduleName + "_" + std::to_string(eventId) + "_" + std::to_string(tid);
|
||||
int timerId = HiviewDFX::XCollie::GetInstance().SetTimer(dfxInfo, TIMEOUT_WATCHDOG, callbackFunc, nullptr,
|
||||
HiviewDFX::XCOLLIE_FLAG_LOG|HiviewDFX::XCOLLIE_FLAG_RECOVERY);
|
||||
memberFunc(event);
|
||||
HiviewDFX::XCollie::GetInstance().CancelTimer(timerId);
|
||||
#else
|
||||
memberFunc(event);
|
||||
#endif
|
||||
}
|
||||
gnssAbility->UnloadGnssSystemAbility();
|
||||
}
|
||||
|
@ -160,6 +160,11 @@ ohos_shared_library("lbsservice_locator") {
|
||||
defines += [ "DEVICE_STANDBY_ENABLE" ]
|
||||
}
|
||||
|
||||
if (location_hicollie_enable) {
|
||||
external_deps += [ "hicollie:libhicollie" ]
|
||||
defines += [ "LOCATION_HICOLLIE_ENABLE" ]
|
||||
}
|
||||
|
||||
# Used to control the export of dynamic library symbols.
|
||||
version_script = "liblbsservice_locator_version_script.txt"
|
||||
|
||||
@ -267,6 +272,11 @@ ohos_static_library("lbsservice_locator_static") {
|
||||
defines += [ "DEVICE_STANDBY_ENABLE" ]
|
||||
}
|
||||
|
||||
if (location_hicollie_enable) {
|
||||
external_deps += [ "hicollie:libhicollie" ]
|
||||
defines += [ "LOCATION_HICOLLIE_ENABLE" ]
|
||||
}
|
||||
|
||||
part_name = "location"
|
||||
subsystem_name = "location"
|
||||
}
|
||||
|
@ -62,6 +62,10 @@
|
||||
#include "geo_convert_request.h"
|
||||
#include "parameter.h"
|
||||
#include "self_request_manager.h"
|
||||
#ifdef LOCATION_HICOLLIE_ENABLE
|
||||
#include "xcollie/xcollie.h"
|
||||
#include "xcollie/xcollie_define.h"
|
||||
#endif
|
||||
|
||||
namespace OHOS {
|
||||
namespace Location {
|
||||
@ -109,6 +113,7 @@ const uint32_t REQUEST_DEFAULT_TIMEOUT_SECOUND = 5 * 60;
|
||||
const int LOCATIONHUB_STATE_UNLOAD = 0;
|
||||
const int LOCATIONHUB_STATE_LOAD = 1;
|
||||
const int MAX_SIZE = 100;
|
||||
const int TIMEOUT_WATCHDOG = 60; // s
|
||||
|
||||
LocatorAbility* LocatorAbility::GetInstance()
|
||||
{
|
||||
@ -2144,7 +2149,21 @@ void LocatorHandler::ProcessEvent(const AppExecFwk::InnerEvent::Pointer& event)
|
||||
auto handleFunc = locatorHandlerEventMap_.find(eventId);
|
||||
if (handleFunc != locatorHandlerEventMap_.end() && handleFunc->second != nullptr) {
|
||||
auto memberFunc = handleFunc->second;
|
||||
#ifdef LOCATION_HICOLLIE_ENABLE
|
||||
int tid = gettid();
|
||||
std::string moduleName = "LocatorHandler";
|
||||
XCollieCallback callbackFunc = [moduleName, eventId, tid](void *) {
|
||||
LBSLOGE(LOCATOR, "TimeoutCallback tid:%{public}d moduleName:%{public}s excute eventId:%{public}u timeout.",
|
||||
tid, moduleName.c_str(), eventId);
|
||||
};
|
||||
std::string dfxInfo = moduleName + "_" + std::to_string(eventId) + "_" + std::to_string(tid);
|
||||
int timerId = HiviewDFX::XCollie::GetInstance().SetTimer(dfxInfo, TIMEOUT_WATCHDOG, callbackFunc, nullptr,
|
||||
HiviewDFX::XCOLLIE_FLAG_LOG|HiviewDFX::XCOLLIE_FLAG_RECOVERY);
|
||||
memberFunc(event);
|
||||
HiviewDFX::XCollie::GetInstance().CancelTimer(timerId);
|
||||
#else
|
||||
memberFunc(event);
|
||||
#endif
|
||||
} else {
|
||||
LBSLOGE(LOCATOR, "ProcessEvent event:%{public}d, unsupport service.", eventId);
|
||||
}
|
||||
|
@ -77,6 +77,11 @@ if (location_feature_with_network) {
|
||||
defines += [ "FEATURE_PASSIVE_SUPPORT" ]
|
||||
}
|
||||
|
||||
if (location_hicollie_enable) {
|
||||
external_deps += [ "hicollie:libhicollie" ]
|
||||
defines += [ "LOCATION_HICOLLIE_ENABLE" ]
|
||||
}
|
||||
|
||||
# Used to control the export of dynamic library symbols.
|
||||
version_script = "liblbsservice_network_version_script.txt"
|
||||
|
||||
@ -124,6 +129,11 @@ if (location_feature_with_network) {
|
||||
defines += [ "FEATURE_PASSIVE_SUPPORT" ]
|
||||
}
|
||||
|
||||
if (location_hicollie_enable) {
|
||||
external_deps += [ "hicollie:libhicollie" ]
|
||||
defines += [ "LOCATION_HICOLLIE_ENABLE" ]
|
||||
}
|
||||
|
||||
part_name = "location"
|
||||
subsystem_name = "location"
|
||||
}
|
||||
|
@ -37,9 +37,21 @@ static constexpr int REQUEST_NETWORK_LOCATION = 1;
|
||||
static constexpr int REMOVE_NETWORK_LOCATION = 2;
|
||||
class NetworkHandler : public AppExecFwk::EventHandler {
|
||||
public:
|
||||
using NetworkEventHandler = std::function<void(const AppExecFwk::InnerEvent::Pointer &)>;
|
||||
using NetworkEventHandleMap = std::map<int, NetworkEventHandler>;
|
||||
explicit NetworkHandler(const std::shared_ptr<AppExecFwk::EventRunner>& runner);
|
||||
~NetworkHandler() override;
|
||||
|
||||
private:
|
||||
void ProcessEvent(const AppExecFwk::InnerEvent::Pointer& event) override;
|
||||
void InitNetworkEventProcessMap();
|
||||
void HandleReportLocationMock(const AppExecFwk::InnerEvent::Pointer& event);
|
||||
void HandleRestartAllLocationRequests(const AppExecFwk::InnerEvent::Pointer& event);
|
||||
void HandleStopAllLocationRequests(const AppExecFwk::InnerEvent::Pointer& event);
|
||||
void HandleLocationRequest(const AppExecFwk::InnerEvent::Pointer& event);
|
||||
void HandleSetMocked(const AppExecFwk::InnerEvent::Pointer& event);
|
||||
|
||||
NetworkEventHandleMap networkEventProcessMap_;
|
||||
};
|
||||
|
||||
class NlpServiceDeathRecipient : public IRemoteObject::DeathRecipient {
|
||||
|
@ -35,6 +35,11 @@
|
||||
#include "common_hisysevent.h"
|
||||
#include "location_data_rdb_manager.h"
|
||||
|
||||
#ifdef LOCATION_HICOLLIE_ENABLE
|
||||
#include "xcollie/xcollie.h"
|
||||
#include "xcollie/xcollie_define.h"
|
||||
#endif
|
||||
|
||||
namespace OHOS {
|
||||
namespace Location {
|
||||
const uint32_t EVENT_REPORT_MOCK_LOCATION = 0x0100;
|
||||
@ -48,6 +53,7 @@ const int MAX_RETRY_COUNT = 5;
|
||||
const std::string UNLOAD_NETWORK_TASK = "network_sa_unload";
|
||||
const std::string DISCONNECT_NETWORK_TASK = "disconnect_network_ability";
|
||||
const uint32_t RETRY_INTERVAL_OF_UNLOAD_SA = 4 * 60 * EVENT_INTERVAL_UNITE;
|
||||
const int TIMEOUT_WATCHDOG = 60; // s
|
||||
const bool REGISTER_RESULT = NetworkAbility::MakeAndRegisterAbility(
|
||||
NetworkAbility::GetInstance());
|
||||
|
||||
@ -581,53 +587,99 @@ void NetworkAbility::ReportLocationError(int32_t errCode, std::string errMsg, st
|
||||
objectLocator->SendRequest(static_cast<int>(LocatorInterfaceCode::REPORT_LOCATION_ERROR), data, reply, option);
|
||||
}
|
||||
|
||||
NetworkHandler::NetworkHandler(const std::shared_ptr<AppExecFwk::EventRunner>& runner) : EventHandler(runner) {}
|
||||
NetworkHandler::NetworkHandler(const std::shared_ptr<AppExecFwk::EventRunner>& runner) : EventHandler(runner)
|
||||
{
|
||||
InitNetworkEventProcessMap();
|
||||
}
|
||||
|
||||
NetworkHandler::~NetworkHandler() {}
|
||||
|
||||
void NetworkHandler::InitNetworkEventProcessMap()
|
||||
{
|
||||
if (networkEventProcessMap_.size() != 0) {
|
||||
return;
|
||||
}
|
||||
networkEventProcessMap_[static_cast<uint32_t>(EVENT_REPORT_MOCK_LOCATION)] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer& event) { HandleReportLocationMock(event); };
|
||||
networkEventProcessMap_[static_cast<uint32_t>(EVENT_RESTART_ALL_LOCATION_REQUEST)] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer& event) { HandleRestartAllLocationRequests(event); };
|
||||
networkEventProcessMap_[static_cast<uint32_t>(EVENT_STOP_ALL_LOCATION_REQUEST)] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer& event) { HandleStopAllLocationRequests(event); };
|
||||
networkEventProcessMap_[static_cast<uint32_t>(NetworkInterfaceCode::SEND_LOCATION_REQUEST)] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer& event) { HandleLocationRequest(event); };
|
||||
networkEventProcessMap_[static_cast<uint32_t>(NetworkInterfaceCode::SET_MOCKED_LOCATIONS)] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer& event) { HandleSetMocked(event); };
|
||||
}
|
||||
|
||||
void NetworkHandler::ProcessEvent(const AppExecFwk::InnerEvent::Pointer& event)
|
||||
{
|
||||
auto networkAbility = NetworkAbility::GetInstance();
|
||||
uint32_t eventId = event->GetInnerEventId();
|
||||
LBSLOGD(NETWORK, "ProcessEvent event:%{public}d", eventId);
|
||||
switch (eventId) {
|
||||
case EVENT_REPORT_MOCK_LOCATION: {
|
||||
networkAbility->ProcessReportLocationMock();
|
||||
break;
|
||||
}
|
||||
case EVENT_RESTART_ALL_LOCATION_REQUEST: {
|
||||
networkAbility->RestartAllLocationRequests();
|
||||
break;
|
||||
}
|
||||
case EVENT_STOP_ALL_LOCATION_REQUEST: {
|
||||
networkAbility->StopAllLocationRequests();
|
||||
break;
|
||||
}
|
||||
case static_cast<uint32_t>(NetworkInterfaceCode::SEND_LOCATION_REQUEST): {
|
||||
std::unique_ptr<WorkRecord> workrecord = event->GetUniqueObject<WorkRecord>();
|
||||
if (workrecord != nullptr) {
|
||||
networkAbility->LocationRequest(*workrecord);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case static_cast<uint32_t>(NetworkInterfaceCode::SET_MOCKED_LOCATIONS): {
|
||||
int timeInterval = event->GetParam();
|
||||
auto vcLoc = event->GetSharedObject<std::vector<std::shared_ptr<Location>>>();
|
||||
if (vcLoc != nullptr) {
|
||||
std::vector<std::shared_ptr<Location>> mockLocations;
|
||||
for (auto it = vcLoc->begin(); it != vcLoc->end(); ++it) {
|
||||
mockLocations.push_back(*it);
|
||||
}
|
||||
networkAbility->SetMocked(timeInterval, mockLocations);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
|
||||
auto handleFunc = networkEventProcessMap_.find(eventId);
|
||||
if (handleFunc != networkEventProcessMap_.end() && handleFunc->second != nullptr) {
|
||||
auto memberFunc = handleFunc->second;
|
||||
#ifdef LOCATION_HICOLLIE_ENABLE
|
||||
int tid = gettid();
|
||||
std::string moduleName = "NetworkHandler";
|
||||
XCollieCallback callbackFunc = [moduleName, eventId, tid](void *) {
|
||||
LBSLOGE(NETWORK, "TimeoutCallback tid:%{public}d moduleName:%{public}s excute eventId:%{public}u timeout.",
|
||||
tid, moduleName.c_str(), eventId);
|
||||
};
|
||||
std::string dfxInfo = moduleName + "_" + std::to_string(eventId) + "_" + std::to_string(tid);
|
||||
int timerId = HiviewDFX::XCollie::GetInstance().SetTimer(dfxInfo, TIMEOUT_WATCHDOG, callbackFunc, nullptr,
|
||||
HiviewDFX::XCOLLIE_FLAG_LOG|HiviewDFX::XCOLLIE_FLAG_RECOVERY);
|
||||
memberFunc(event);
|
||||
HiviewDFX::XCollie::GetInstance().CancelTimer(timerId);
|
||||
#else
|
||||
memberFunc(event);
|
||||
#endif
|
||||
}
|
||||
auto networkAbility = NetworkAbility::GetInstance();
|
||||
networkAbility->UnloadNetworkSystemAbility();
|
||||
}
|
||||
|
||||
void NetworkHandler::HandleReportLocationMock(const AppExecFwk::InnerEvent::Pointer& event)
|
||||
{
|
||||
auto networkAbility = NetworkAbility::GetInstance();
|
||||
networkAbility->ProcessReportLocationMock();
|
||||
}
|
||||
|
||||
void NetworkHandler::HandleRestartAllLocationRequests(const AppExecFwk::InnerEvent::Pointer& event)
|
||||
{
|
||||
auto networkAbility = NetworkAbility::GetInstance();
|
||||
networkAbility->RestartAllLocationRequests();
|
||||
}
|
||||
|
||||
void NetworkHandler::HandleStopAllLocationRequests(const AppExecFwk::InnerEvent::Pointer& event)
|
||||
{
|
||||
auto networkAbility = NetworkAbility::GetInstance();
|
||||
networkAbility->StopAllLocationRequests();
|
||||
}
|
||||
|
||||
void NetworkHandler::HandleLocationRequest(const AppExecFwk::InnerEvent::Pointer& event)
|
||||
{
|
||||
std::unique_ptr<WorkRecord> workrecord = event->GetUniqueObject<WorkRecord>();
|
||||
if (workrecord != nullptr) {
|
||||
auto networkAbility = NetworkAbility::GetInstance();
|
||||
networkAbility->LocationRequest(*workrecord);
|
||||
}
|
||||
}
|
||||
|
||||
void NetworkHandler::HandleSetMocked(const AppExecFwk::InnerEvent::Pointer& event)
|
||||
{
|
||||
auto networkAbility = NetworkAbility::GetInstance();
|
||||
int timeInterval = event->GetParam();
|
||||
auto vcLoc = event->GetSharedObject<std::vector<std::shared_ptr<Location>>>();
|
||||
if (vcLoc != nullptr) {
|
||||
std::vector<std::shared_ptr<Location>> mockLocations;
|
||||
for (auto it = vcLoc->begin(); it != vcLoc->end(); ++it) {
|
||||
mockLocations.push_back(*it);
|
||||
}
|
||||
networkAbility->SetMocked(timeInterval, mockLocations);
|
||||
}
|
||||
}
|
||||
|
||||
NlpServiceDeathRecipient::NlpServiceDeathRecipient()
|
||||
{
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user