memory optimize for location agent

Signed-off-by: zhangfeng <hw.zhangfeng@huawei.com>
This commit is contained in:
zhangfeng 2024-08-10 22:07:07 +08:00
parent 07402fce0b
commit ee80f60f74
26 changed files with 244 additions and 104 deletions

View File

@ -83,7 +83,8 @@
"build": {
"group_type": {
"base_group": [
"//base/location/services/utils:lbsresources"
"//base/location/services/utils:lbsresources",
"//base/location/frameworks/base_module:lbsbase_module"
],
"fwk_group": [
"//base/location/frameworks/native/locator_sdk:locator_sdk",

View File

@ -0,0 +1,66 @@
# Copyright (C) 2024 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//base/location/config.gni")
import("//build/ohos.gni")
config("lbs_base_module_config") {
visibility = [ ":*" ]
include_dirs = [
"$LOCATION_ROOT_DIR/interfaces/inner_api/native/include",
"$LOCATION_ROOT_DIR/interfaces/inner_api/include",
]
}
ohos_shared_library("lbsbase_module") {
public_configs = [ ":lbs_base_module_config" ]
sources = [
"$LOCATION_ROOT_DIR/frameworks/base_module/source/location.cpp",
"$LOCATION_ROOT_DIR/frameworks/base_module/source/location_sa_load_manager.cpp",
"$LOCATION_ROOT_DIR/frameworks/base_module/source/request_config.cpp",
"$LOCATION_ROOT_DIR/frameworks/base_module/source/satellite_status.cpp",
]
sanitize = {
cfi = true
cfi_cross_dso = true
debug = false
}
branch_protector_ret = "pac_ret"
deps = []
external_deps = [
"c_utils:utils",
"hilog:libhilog",
"ipc:ipc_single",
"samgr:samgr_proxy",
]
ldflags = [
"-Wl,--as-needed",
"-Wl,--gc-sections",
]
cflags_cc = [
"-ffunction-sections",
"-fdata-sections",
]
defines = []
part_name = "location"
subsystem_name = "location"
}

View File

@ -130,16 +130,11 @@ bool LocationSaLoadManager::InitLocationSa(int32_t systemAbilityId)
LBSLOGD(COMMON_UTILS, "sa has been loaded");
return true;
}
bool ret = true;
auto startTime = CommonUtils::GetCurrentTimeStamp();
auto instance = LocationSaLoadManager::GetInstance();
if (instance == nullptr || instance->LoadLocationSa(systemAbilityId) != ERRCODE_SUCCESS) {
LBSLOGE(LOCATOR, "sa load failed.");
ret = false;
return false;
}
auto endTime = CommonUtils::GetCurrentTimeStamp();
WriteLocationInnerEvent(SA_LOAD, {"saId", std::to_string(systemAbilityId), "type", "load",
"ret", std::to_string(ret), "startTime", std::to_string(startTime), "endTime", std::to_string(endTime)});
return true;
}
@ -149,16 +144,11 @@ bool LocationSaLoadManager::UnInitLocationSa(int32_t systemAbilityId)
LBSLOGD(LOCATOR, "sa has been unloaded");
return true;
}
bool ret = true;
auto startTime = CommonUtils::GetCurrentTimeStamp();
auto instance = LocationSaLoadManager::GetInstance();
if (instance == nullptr || instance->UnloadLocationSa(systemAbilityId) != ERRCODE_SUCCESS) {
LBSLOGE(LOCATOR, "sa unload failed.");
ret = false;
return false;
}
auto endTime = CommonUtils::GetCurrentTimeStamp();
WriteLocationInnerEvent(SA_LOAD, {"saId", std::to_string(systemAbilityId), "type", "unload",
"ret", std::to_string(ret), "startTime", std::to_string(startTime), "endTime", std::to_string(endTime)});
return true;
}

View File

@ -70,6 +70,7 @@ ohos_shared_library("geolocation") {
sources = local_base_sources
deps = [
"$LOCATION_ROOT_DIR/frameworks/base_module:lbsbase_module",
"$LOCATION_ROOT_DIR/frameworks/location_common/common:lbsservice_common",
"$LOCATION_ROOT_DIR/frameworks/native/geofence_sdk:geofence_sdk",
"$LOCATION_ROOT_DIR/frameworks/native/locator_sdk:locator_sdk",
@ -115,6 +116,7 @@ ohos_static_library("geolocation_static") {
sources = local_base_sources
deps = [
"$LOCATION_ROOT_DIR/frameworks/base_module:lbsbase_module",
"$LOCATION_ROOT_DIR/frameworks/location_common/common:lbsservice_common",
"$LOCATION_ROOT_DIR/frameworks/native/geofence_sdk:geofence_sdk",
"$LOCATION_ROOT_DIR/frameworks/native/locator_sdk:locator_sdk",
@ -154,6 +156,7 @@ ohos_shared_library("geolocationmanager") {
sources = local_base_sources
deps = [
"$LOCATION_ROOT_DIR/frameworks/base_module:lbsbase_module",
"$LOCATION_ROOT_DIR/frameworks/location_common/common:lbsservice_common",
"$LOCATION_ROOT_DIR/frameworks/native/geofence_sdk:geofence_sdk",
"$LOCATION_ROOT_DIR/frameworks/native/locator_sdk:locator_sdk",

View File

@ -26,16 +26,16 @@ local_base_sources = [
"$LOCATION_COMMON_DIR/source/geo_address.cpp",
"$LOCATION_COMMON_DIR/source/geo_coding_mock_info.cpp",
"$LOCATION_COMMON_DIR/source/hook_utils.cpp",
"$LOCATION_COMMON_DIR/source/location.cpp",
"$LOCATION_COMMON_DIR/source/location_data_rdb_helper.cpp",
"$LOCATION_COMMON_DIR/source/location_data_rdb_manager.cpp",
"$LOCATION_COMMON_DIR/source/location_dumper.cpp",
"$LOCATION_COMMON_DIR/source/location_sa_load_manager.cpp",
"$LOCATION_COMMON_DIR/source/permission_manager.cpp",
"$LOCATION_COMMON_DIR/source/request.cpp",
"$LOCATION_COMMON_DIR/source/request_config.cpp",
"$LOCATION_COMMON_DIR/source/satellite_status.cpp",
"$LOCATION_COMMON_DIR/source/sa_load_with_statistic.cpp",
"$LOCATION_COMMON_DIR/source/ui_extension_ability_connection.cpp",
"$LOCATION_ROOT_DIR/frameworks/base_module/source/location.cpp",
"$LOCATION_ROOT_DIR/frameworks/base_module/source/request_config.cpp",
"$LOCATION_ROOT_DIR/frameworks/base_module/source/satellite_status.cpp",
]
ohos_shared_library("lbsservice_common") {
@ -50,7 +50,7 @@ ohos_shared_library("lbsservice_common") {
sources = local_base_sources
deps = []
deps = [ "$LOCATION_ROOT_DIR/frameworks/base_module:lbsbase_module" ]
public_external_deps = [
"ability_base:zuri",
@ -58,8 +58,6 @@ ohos_shared_library("lbsservice_common") {
"ability_runtime:wantagent_innerkits",
"access_token:libaccesstoken_sdk",
"access_token:libtokenid_sdk",
"bundle_framework:appexecfwk_base",
"bundle_framework:appexecfwk_core",
"c_utils:utils",
"data_share:datashare_consumer",
"hilog:libhilog",
@ -108,7 +106,7 @@ ohos_static_library("lbsservice_common_static") {
sources = local_base_sources
deps = []
deps = [ "$LOCATION_ROOT_DIR/frameworks/base_module:lbsbase_module" ]
public_external_deps = [
"ability_base:zuri",
@ -116,8 +114,6 @@ ohos_static_library("lbsservice_common_static") {
"ability_runtime:wantagent_innerkits",
"access_token:libaccesstoken_sdk",
"access_token:libtokenid_sdk",
"bundle_framework:appexecfwk_base",
"bundle_framework:appexecfwk_core",
"c_utils:utils",
"data_share:datashare_consumer",
"hilog:libhilog",

View File

@ -0,0 +1,53 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "location_sa_load_manager.h"
#include "common_utils.h"
#include "common_hisysevent.h"
#include "location_log_event_ids.h"
namespace OHOS {
namespace Location {
SaLoadWithStatistic::SaLoadWithStatistic()
{
}
SaLoadWithStatistic::~SaLoadWithStatistic()
{
}
bool SaLoadWithStatistic::InitLocationSa(int32_t systemAbilityId)
{
auto startTime = CommonUtils::GetCurrentTimeStamp();
bool ret = LocationSaLoadManager::InitLocationSa(systemAbilityId);
auto endTime = CommonUtils::GetCurrentTimeStamp();
WriteLocationInnerEvent(SA_LOAD, {"saId", std::to_string(systemAbilityId), "type", "load",
"ret", std::to_string(ret), "startTime", std::to_string(startTime), "endTime", std::to_string(endTime)});
return ret;
}
bool SaLoadWithStatistic::UnInitLocationSa(int32_t systemAbilityId)
{
auto startTime = CommonUtils::GetCurrentTimeStamp();
bool ret = LocationSaLoadManager::UnInitLocationSa(systemAbilityId);
auto endTime = CommonUtils::GetCurrentTimeStamp();
WriteLocationInnerEvent(SA_LOAD, {"saId", std::to_string(systemAbilityId), "type", "unload",
"ret", std::to_string(ret), "startTime", std::to_string(startTime), "endTime", std::to_string(endTime)});
return ret;
}
}; // namespace Location
}; // namespace OHOS

View File

@ -42,7 +42,10 @@ ohos_shared_library("geofence_sdk") {
sources = local_base_sources
deps = [ "$LOCATION_COMMON_DIR:lbsservice_common" ]
deps = [
"$LOCATION_COMMON_DIR:lbsservice_common",
"$LOCATION_ROOT_DIR/frameworks/base_module:lbsbase_module",
]
public_external_deps = [
"hilog:libhilog",
@ -97,7 +100,10 @@ ohos_static_library("geofence_sdk_static") {
sources = local_base_sources
deps = [ "$LOCATION_COMMON_DIR:lbsservice_common" ]
deps = [
"$LOCATION_COMMON_DIR:lbsservice_common",
"$LOCATION_ROOT_DIR/frameworks/base_module:lbsbase_module",
]
public_external_deps = [
"hilog:libhilog",

View File

@ -81,7 +81,7 @@ sptr<GeofenceSdk> GeofenceManager::GetProxy()
LocationErrCode GeofenceManager::AddFenceV9(std::shared_ptr<GeofenceRequest> &request)
{
if (!LocationSaLoadManager::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
if (!SaLoadWithStatistic::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
return ERRCODE_SERVICE_UNAVAILABLE;
}
LBSLOGD(GEOFENCE_SDK, "GeofenceManager::AddFenceV9()");
@ -96,7 +96,7 @@ LocationErrCode GeofenceManager::AddFenceV9(std::shared_ptr<GeofenceRequest> &re
LocationErrCode GeofenceManager::RemoveFenceV9(std::shared_ptr<GeofenceRequest> &request)
{
if (!LocationSaLoadManager::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
if (!SaLoadWithStatistic::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
return ERRCODE_SERVICE_UNAVAILABLE;
}
LBSLOGD(GEOFENCE_SDK, "GeofenceManager::RemoveFenceV9()");
@ -111,7 +111,7 @@ LocationErrCode GeofenceManager::RemoveFenceV9(std::shared_ptr<GeofenceRequest>
LocationErrCode GeofenceManager::AddGnssGeofence(std::shared_ptr<GeofenceRequest>& request)
{
if (!LocationSaLoadManager::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
if (!SaLoadWithStatistic::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
return ERRCODE_SERVICE_UNAVAILABLE;
}
sptr<GeofenceSdk> proxy = GetProxy();
@ -125,7 +125,7 @@ LocationErrCode GeofenceManager::AddGnssGeofence(std::shared_ptr<GeofenceRequest
LocationErrCode GeofenceManager::RemoveGnssGeofence(std::shared_ptr<GeofenceRequest>& request)
{
if (!LocationSaLoadManager::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
if (!SaLoadWithStatistic::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
return ERRCODE_SERVICE_UNAVAILABLE;
}
LBSLOGD(GEOFENCE_SDK, "GeofenceManager::RemoveGnssGeofence()");
@ -141,7 +141,7 @@ LocationErrCode GeofenceManager::RemoveGnssGeofence(std::shared_ptr<GeofenceRequ
LocationErrCode GeofenceManager::GetGeofenceSupportedCoordTypes(
std::vector<CoordinateSystemType>& coordinateSystemTypes)
{
if (!LocationSaLoadManager::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
if (!SaLoadWithStatistic::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
return ERRCODE_SERVICE_UNAVAILABLE;
}
LBSLOGD(GEOFENCE_SDK, "GeofenceManager::%{public}s", __func__);

View File

@ -20,6 +20,7 @@ config("locator_agent_config") {
"$LOCATION_ROOT_DIR/interfaces/inner_api/native/include",
"$LOCATION_ROOT_DIR/interfaces/inner_api/include",
"$LOCATION_ROOT_DIR/frameworks/native/locator_agent/include",
"$LOCATION_ROOT_DIR/frameworks/base_module/include",
]
}
@ -41,9 +42,10 @@ ohos_shared_library("locator_agent") {
branch_protector_ret = "pac_ret"
deps = [ "$LOCATION_COMMON_DIR:lbsservice_common" ]
deps = [ "$LOCATION_ROOT_DIR/frameworks/base_module:lbsbase_module" ]
external_deps = [
"c_utils:utils",
"hilog:libhilog",
"ipc:ipc_single",
"samgr:samgr_proxy",

View File

@ -58,15 +58,16 @@ ohos_shared_library("locator_sdk") {
sources = local_base_sources
deps = [ "$LOCATION_COMMON_DIR:lbsservice_common" ]
deps = [
"$LOCATION_COMMON_DIR:lbsservice_common",
"$LOCATION_ROOT_DIR/frameworks/base_module:lbsbase_module",
]
public_external_deps = [
"ability_runtime:dataobs_manager",
"data_share:datashare_consumer",
"hilog:libhilog",
"init:libbeget_proxy",
"ipc:ipc_single",
"samgr:samgr_proxy",
]
defines = []
@ -126,7 +127,10 @@ ohos_static_library("locator_sdk_static") {
sources = local_base_sources
deps = [ "$LOCATION_COMMON_DIR:lbsservice_common" ]
deps = [
"$LOCATION_COMMON_DIR:lbsservice_common",
"$LOCATION_ROOT_DIR/frameworks/base_module:lbsbase_module",
]
public_external_deps = [
"ability_runtime:dataobs_manager",

View File

@ -70,7 +70,7 @@ LocatorImpl::~LocatorImpl()
bool LocatorImpl::IsLocationEnabled()
{
LBSLOGD(LOCATION_NAPI, "IsLocationEnabled");
if (!LocationSaLoadManager::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
if (!SaLoadWithStatistic::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
return ERRCODE_SERVICE_UNAVAILABLE;
}
sptr<LocatorProxy> proxy = GetProxy();
@ -100,7 +100,7 @@ void LocatorImpl::RequestEnableLocation()
void LocatorImpl::EnableAbility(bool enable)
{
if (!LocationSaLoadManager::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
if (!SaLoadWithStatistic::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
return;
}
LocationErrCode errorCode = CheckEdmPolicy(enable);
@ -121,7 +121,7 @@ void LocatorImpl::EnableAbility(bool enable)
void LocatorImpl::StartLocating(std::unique_ptr<RequestConfig>& requestConfig,
sptr<ILocatorCallback>& callback)
{
if (!LocationSaLoadManager::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
if (!SaLoadWithStatistic::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
return;
}
sptr<LocatorProxy> proxy = GetProxy();
@ -142,7 +142,7 @@ void LocatorImpl::StartLocating(std::unique_ptr<RequestConfig>& requestConfig,
void LocatorImpl::StopLocating(sptr<ILocatorCallback>& callback)
{
if (!LocationSaLoadManager::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
if (!SaLoadWithStatistic::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
return;
}
sptr<LocatorProxy> proxy = GetProxy();
@ -160,7 +160,7 @@ void LocatorImpl::StopLocating(sptr<ILocatorCallback>& callback)
std::unique_ptr<Location> LocatorImpl::GetCachedLocation()
{
if (!LocationSaLoadManager::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
if (!SaLoadWithStatistic::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
return nullptr;
}
sptr<LocatorProxy> proxy = GetProxy();
@ -201,7 +201,7 @@ bool LocatorImpl::UnregisterSwitchCallback(const sptr<IRemoteObject>& callback)
bool LocatorImpl::RegisterGnssStatusCallback(const sptr<IRemoteObject>& callback, pid_t uid)
{
if (!LocationSaLoadManager::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
if (!SaLoadWithStatistic::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
return false;
}
sptr<LocatorProxy> proxy = GetProxy();
@ -220,7 +220,7 @@ bool LocatorImpl::RegisterGnssStatusCallback(const sptr<IRemoteObject>& callback
bool LocatorImpl::UnregisterGnssStatusCallback(const sptr<IRemoteObject>& callback)
{
if (!LocationSaLoadManager::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
if (!SaLoadWithStatistic::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
return false;
}
sptr<LocatorProxy> proxy = GetProxy();
@ -235,7 +235,7 @@ bool LocatorImpl::UnregisterGnssStatusCallback(const sptr<IRemoteObject>& callba
bool LocatorImpl::RegisterNmeaMessageCallback(const sptr<IRemoteObject>& callback, pid_t uid)
{
if (!LocationSaLoadManager::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
if (!SaLoadWithStatistic::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
return false;
}
sptr<LocatorProxy> proxy = GetProxy();
@ -254,7 +254,7 @@ bool LocatorImpl::RegisterNmeaMessageCallback(const sptr<IRemoteObject>& callbac
bool LocatorImpl::UnregisterNmeaMessageCallback(const sptr<IRemoteObject>& callback)
{
if (!LocationSaLoadManager::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
if (!SaLoadWithStatistic::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
return false;
}
sptr<LocatorProxy> proxy = GetProxy();
@ -292,7 +292,7 @@ bool LocatorImpl::UnregisterCountryCodeCallback(const sptr<IRemoteObject>& callb
void LocatorImpl::RegisterCachedLocationCallback(std::unique_ptr<CachedGnssLocationsRequest>& request,
sptr<ICachedLocationsCallback>& callback)
{
if (!LocationSaLoadManager::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
if (!SaLoadWithStatistic::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
return;
}
sptr<LocatorProxy> proxy = GetProxy();
@ -305,7 +305,7 @@ void LocatorImpl::RegisterCachedLocationCallback(std::unique_ptr<CachedGnssLocat
void LocatorImpl::UnregisterCachedLocationCallback(sptr<ICachedLocationsCallback>& callback)
{
if (!LocationSaLoadManager::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
if (!SaLoadWithStatistic::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
return;
}
sptr<LocatorProxy> proxy = GetProxy();
@ -318,7 +318,7 @@ void LocatorImpl::UnregisterCachedLocationCallback(sptr<ICachedLocationsCallback
bool LocatorImpl::IsGeoServiceAvailable()
{
if (!LocationSaLoadManager::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
if (!SaLoadWithStatistic::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
return false;
}
bool result = false;
@ -342,7 +342,7 @@ bool LocatorImpl::IsGeoServiceAvailable()
void LocatorImpl::GetAddressByCoordinate(MessageParcel &data, std::list<std::shared_ptr<GeoAddress>>& replyList)
{
if (!LocationSaLoadManager::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
if (!SaLoadWithStatistic::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
return;
}
sptr<LocatorProxy> proxy = GetProxy();
@ -369,7 +369,7 @@ void LocatorImpl::GetAddressByCoordinate(MessageParcel &data, std::list<std::sha
void LocatorImpl::GetAddressByLocationName(MessageParcel &data, std::list<std::shared_ptr<GeoAddress>>& replyList)
{
if (!LocationSaLoadManager::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
if (!SaLoadWithStatistic::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
return;
}
sptr<LocatorProxy> proxy = GetProxy();
@ -397,7 +397,7 @@ void LocatorImpl::GetAddressByLocationName(MessageParcel &data, std::list<std::s
bool LocatorImpl::IsLocationPrivacyConfirmed(const int type)
{
if (!LocationSaLoadManager::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
if (!SaLoadWithStatistic::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
return false;
}
LBSLOGD(LOCATOR_STANDARD, "LocatorImpl::IsLocationPrivacyConfirmed()");
@ -412,7 +412,7 @@ bool LocatorImpl::IsLocationPrivacyConfirmed(const int type)
int LocatorImpl::SetLocationPrivacyConfirmStatus(const int type, bool isConfirmed)
{
if (!LocationSaLoadManager::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
if (!SaLoadWithStatistic::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
return false;
}
LBSLOGD(LOCATOR_STANDARD, "LocatorImpl::SetLocationPrivacyConfirmStatus()");
@ -427,7 +427,7 @@ int LocatorImpl::SetLocationPrivacyConfirmStatus(const int type, bool isConfirme
int LocatorImpl::GetCachedGnssLocationsSize()
{
if (!LocationSaLoadManager::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
if (!SaLoadWithStatistic::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
return -1;
}
LBSLOGD(LOCATOR_STANDARD, "LocatorImpl::GetCachedGnssLocationsSize()");
@ -442,7 +442,7 @@ int LocatorImpl::GetCachedGnssLocationsSize()
int LocatorImpl::FlushCachedGnssLocations()
{
if (!LocationSaLoadManager::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
if (!SaLoadWithStatistic::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
return -1;
}
LBSLOGD(LOCATOR_STANDARD, "LocatorImpl::FlushCachedGnssLocations()");
@ -457,7 +457,7 @@ int LocatorImpl::FlushCachedGnssLocations()
bool LocatorImpl::SendCommand(std::unique_ptr<LocationCommand>& commands)
{
if (!LocationSaLoadManager::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
if (!SaLoadWithStatistic::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
return false;
}
LBSLOGD(LOCATOR_STANDARD, "LocatorImpl::SendCommand()");
@ -483,7 +483,7 @@ std::shared_ptr<CountryCode> LocatorImpl::GetIsoCountryCode()
bool LocatorImpl::EnableLocationMock()
{
if (!LocationSaLoadManager::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
if (!SaLoadWithStatistic::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
return false;
}
LBSLOGD(LOCATOR_STANDARD, "LocatorImpl::EnableLocationMock()");
@ -498,7 +498,7 @@ bool LocatorImpl::EnableLocationMock()
bool LocatorImpl::DisableLocationMock()
{
if (!LocationSaLoadManager::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
if (!SaLoadWithStatistic::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
return false;
}
LBSLOGD(LOCATOR_STANDARD, "LocatorImpl::DisableLocationMock()");
@ -514,7 +514,7 @@ bool LocatorImpl::DisableLocationMock()
bool LocatorImpl::SetMockedLocations(
const int timeInterval, const std::vector<std::shared_ptr<Location>> &location)
{
if (!LocationSaLoadManager::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
if (!SaLoadWithStatistic::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
return false;
}
LBSLOGD(LOCATOR_STANDARD, "LocatorImpl::SetMockedLocations()");
@ -529,7 +529,7 @@ bool LocatorImpl::SetMockedLocations(
bool LocatorImpl::EnableReverseGeocodingMock()
{
if (!LocationSaLoadManager::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
if (!SaLoadWithStatistic::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
return false;
}
LBSLOGD(LOCATOR_STANDARD, "LocatorImpl::EnableReverseGeocodingMock()");
@ -544,7 +544,7 @@ bool LocatorImpl::EnableReverseGeocodingMock()
bool LocatorImpl::DisableReverseGeocodingMock()
{
if (!LocationSaLoadManager::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
if (!SaLoadWithStatistic::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
return false;
}
LBSLOGD(LOCATOR_STANDARD, "LocatorImpl::DisableReverseGeocodingMock()");
@ -559,7 +559,7 @@ bool LocatorImpl::DisableReverseGeocodingMock()
bool LocatorImpl::SetReverseGeocodingMockInfo(std::vector<std::shared_ptr<GeocodingMockInfo>>& mockInfo)
{
if (!LocationSaLoadManager::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
if (!SaLoadWithStatistic::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
return false;
}
LBSLOGD(LOCATOR_STANDARD, "LocatorImpl::SetReverseGeocodingMockInfo()");
@ -575,7 +575,7 @@ bool LocatorImpl::SetReverseGeocodingMockInfo(std::vector<std::shared_ptr<Geocod
LocationErrCode LocatorImpl::IsLocationEnabledV9(bool &isEnabled)
{
LBSLOGD(LOCATOR_STANDARD, "LocatorImpl::IsLocationEnabledV9()");
if (!LocationSaLoadManager::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
if (!SaLoadWithStatistic::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
return ERRCODE_SERVICE_UNAVAILABLE;
}
sptr<LocatorProxy> proxy = GetProxy();
@ -610,7 +610,7 @@ LocationErrCode LocatorImpl::CheckEdmPolicy(bool enable)
LocationErrCode LocatorImpl::EnableAbilityV9(bool enable)
{
if (!LocationSaLoadManager::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
if (!SaLoadWithStatistic::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
return ERRCODE_SERVICE_UNAVAILABLE;
}
LocationErrCode errorCode = CheckEdmPolicy(enable);
@ -630,7 +630,7 @@ LocationErrCode LocatorImpl::EnableAbilityV9(bool enable)
LocationErrCode LocatorImpl::StartLocatingV9(std::unique_ptr<RequestConfig>& requestConfig,
sptr<ILocatorCallback>& callback)
{
if (!LocationSaLoadManager::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
if (!SaLoadWithStatistic::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
return ERRCODE_SERVICE_UNAVAILABLE;
}
LBSLOGD(LOCATOR_STANDARD, "LocatorImpl::StartLocatingV9()");
@ -653,7 +653,7 @@ LocationErrCode LocatorImpl::StartLocatingV9(std::unique_ptr<RequestConfig>& req
LocationErrCode LocatorImpl::StopLocatingV9(sptr<ILocatorCallback>& callback)
{
if (!LocationSaLoadManager::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
if (!SaLoadWithStatistic::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
return ERRCODE_SERVICE_UNAVAILABLE;
}
LBSLOGD(LOCATOR_STANDARD, "LocatorImpl::StopLocatingV9()");
@ -669,7 +669,7 @@ LocationErrCode LocatorImpl::StopLocatingV9(sptr<ILocatorCallback>& callback)
LocationErrCode LocatorImpl::GetCachedLocationV9(std::unique_ptr<Location> &loc)
{
if (!LocationSaLoadManager::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
if (!SaLoadWithStatistic::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
return ERRCODE_SERVICE_UNAVAILABLE;
}
LBSLOGD(LOCATOR_STANDARD, "LocatorImpl::GetCachedLocationV9()");
@ -701,7 +701,7 @@ LocationErrCode LocatorImpl::UnregisterSwitchCallbackV9(const sptr<IRemoteObject
LocationErrCode LocatorImpl::RegisterGnssStatusCallbackV9(const sptr<IRemoteObject>& callback)
{
if (!LocationSaLoadManager::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
if (!SaLoadWithStatistic::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
return ERRCODE_SERVICE_UNAVAILABLE;
}
LBSLOGD(LOCATOR_STANDARD, "LocatorImpl::RegisterGnssStatusCallbackV9()");
@ -724,7 +724,7 @@ LocationErrCode LocatorImpl::RegisterGnssStatusCallbackV9(const sptr<IRemoteObje
LocationErrCode LocatorImpl::UnregisterGnssStatusCallbackV9(const sptr<IRemoteObject>& callback)
{
if (!LocationSaLoadManager::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
if (!SaLoadWithStatistic::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
return ERRCODE_SERVICE_UNAVAILABLE;
}
LBSLOGD(LOCATOR_STANDARD, "LocatorImpl::UnregisterGnssStatusCallbackV9()");
@ -740,7 +740,7 @@ LocationErrCode LocatorImpl::UnregisterGnssStatusCallbackV9(const sptr<IRemoteOb
LocationErrCode LocatorImpl::RegisterNmeaMessageCallbackV9(const sptr<IRemoteObject>& callback)
{
if (!LocationSaLoadManager::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
if (!SaLoadWithStatistic::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
return ERRCODE_SERVICE_UNAVAILABLE;
}
LBSLOGD(LOCATOR_STANDARD, "LocatorImpl::RegisterNmeaMessageCallbackV9()");
@ -763,7 +763,7 @@ LocationErrCode LocatorImpl::RegisterNmeaMessageCallbackV9(const sptr<IRemoteObj
LocationErrCode LocatorImpl::UnregisterNmeaMessageCallbackV9(const sptr<IRemoteObject>& callback)
{
if (!LocationSaLoadManager::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
if (!SaLoadWithStatistic::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
return ERRCODE_SERVICE_UNAVAILABLE;
}
LBSLOGD(LOCATOR_STANDARD, "LocatorImpl::UnregisterNmeaMessageCallbackV9()");
@ -804,7 +804,7 @@ LocationErrCode LocatorImpl::UnregisterCountryCodeCallbackV9(const sptr<IRemoteO
LocationErrCode LocatorImpl::RegisterCachedLocationCallbackV9(std::unique_ptr<CachedGnssLocationsRequest>& request,
sptr<ICachedLocationsCallback>& callback)
{
if (!LocationSaLoadManager::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
if (!SaLoadWithStatistic::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
return ERRCODE_SERVICE_UNAVAILABLE;
}
LBSLOGD(LOCATOR_STANDARD, "LocatorImpl::RegisterCachedLocationCallbackV9()");
@ -819,7 +819,7 @@ LocationErrCode LocatorImpl::RegisterCachedLocationCallbackV9(std::unique_ptr<Ca
LocationErrCode LocatorImpl::UnregisterCachedLocationCallbackV9(sptr<ICachedLocationsCallback>& callback)
{
if (!LocationSaLoadManager::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
if (!SaLoadWithStatistic::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
return ERRCODE_SERVICE_UNAVAILABLE;
}
LBSLOGD(LOCATOR_STANDARD, "LocatorImpl::UnregisterCachedLocationCallbackV9()");
@ -834,7 +834,7 @@ LocationErrCode LocatorImpl::UnregisterCachedLocationCallbackV9(sptr<ICachedLoca
LocationErrCode LocatorImpl::IsGeoServiceAvailableV9(bool &isAvailable)
{
if (!LocationSaLoadManager::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
if (!SaLoadWithStatistic::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
return ERRCODE_SERVICE_UNAVAILABLE;
}
LBSLOGD(LOCATOR_STANDARD, "LocatorImpl::IsGeoServiceAvailableV9()");
@ -850,7 +850,7 @@ LocationErrCode LocatorImpl::IsGeoServiceAvailableV9(bool &isAvailable)
LocationErrCode LocatorImpl::GetAddressByCoordinateV9(MessageParcel &data,
std::list<std::shared_ptr<GeoAddress>>& replyList)
{
if (!LocationSaLoadManager::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
if (!SaLoadWithStatistic::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
return ERRCODE_SERVICE_UNAVAILABLE;
}
LBSLOGD(LOCATOR_STANDARD, "LocatorImpl::GetAddressByCoordinateV9()");
@ -876,7 +876,7 @@ LocationErrCode LocatorImpl::GetAddressByCoordinateV9(MessageParcel &data,
LocationErrCode LocatorImpl::GetAddressByLocationNameV9(MessageParcel &data,
std::list<std::shared_ptr<GeoAddress>>& replyList)
{
if (!LocationSaLoadManager::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
if (!SaLoadWithStatistic::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
return ERRCODE_SERVICE_UNAVAILABLE;
}
LBSLOGD(LOCATOR_STANDARD, "LocatorImpl::GetAddressByLocationNameV9()");
@ -903,7 +903,7 @@ LocationErrCode LocatorImpl::GetAddressByLocationNameV9(MessageParcel &data,
LocationErrCode LocatorImpl::IsLocationPrivacyConfirmedV9(const int type, bool &isConfirmed)
{
if (!LocationSaLoadManager::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
if (!SaLoadWithStatistic::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
return ERRCODE_SERVICE_UNAVAILABLE;
}
LBSLOGD(LOCATOR_STANDARD, "LocatorImpl::IsLocationPrivacyConfirmedV9()");
@ -918,7 +918,7 @@ LocationErrCode LocatorImpl::IsLocationPrivacyConfirmedV9(const int type, bool &
LocationErrCode LocatorImpl::SetLocationPrivacyConfirmStatusV9(const int type, bool isConfirmed)
{
if (!LocationSaLoadManager::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
if (!SaLoadWithStatistic::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
return ERRCODE_SERVICE_UNAVAILABLE;
}
LBSLOGD(LOCATOR_STANDARD, "LocatorImpl::SetLocationPrivacyConfirmStatusV9()");
@ -933,7 +933,7 @@ LocationErrCode LocatorImpl::SetLocationPrivacyConfirmStatusV9(const int type, b
LocationErrCode LocatorImpl::GetCachedGnssLocationsSizeV9(int &size)
{
if (!LocationSaLoadManager::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
if (!SaLoadWithStatistic::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
return ERRCODE_SERVICE_UNAVAILABLE;
}
LBSLOGD(LOCATOR_STANDARD, "LocatorImpl::GetCachedGnssLocationsSizeV9()");
@ -948,7 +948,7 @@ LocationErrCode LocatorImpl::GetCachedGnssLocationsSizeV9(int &size)
LocationErrCode LocatorImpl::FlushCachedGnssLocationsV9()
{
if (!LocationSaLoadManager::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
if (!SaLoadWithStatistic::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
return ERRCODE_SERVICE_UNAVAILABLE;
}
LBSLOGD(LOCATOR_STANDARD, "LocatorImpl::FlushCachedGnssLocationsV9()");
@ -963,7 +963,7 @@ LocationErrCode LocatorImpl::FlushCachedGnssLocationsV9()
LocationErrCode LocatorImpl::SendCommandV9(std::unique_ptr<LocationCommand>& commands)
{
if (!LocationSaLoadManager::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
if (!SaLoadWithStatistic::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
return ERRCODE_SERVICE_UNAVAILABLE;
}
LBSLOGD(LOCATOR_STANDARD, "LocatorImpl::SendCommandV9()");
@ -990,7 +990,7 @@ LocationErrCode LocatorImpl::GetIsoCountryCodeV9(std::shared_ptr<CountryCode>& c
LocationErrCode LocatorImpl::EnableLocationMockV9()
{
if (!LocationSaLoadManager::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
if (!SaLoadWithStatistic::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
return ERRCODE_SERVICE_UNAVAILABLE;
}
LBSLOGD(LOCATOR_STANDARD, "LocatorImpl::EnableLocationMockV9()");
@ -1005,7 +1005,7 @@ LocationErrCode LocatorImpl::EnableLocationMockV9()
LocationErrCode LocatorImpl::DisableLocationMockV9()
{
if (!LocationSaLoadManager::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
if (!SaLoadWithStatistic::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
return ERRCODE_SERVICE_UNAVAILABLE;
}
LBSLOGD(LOCATOR_STANDARD, "LocatorImpl::DisableLocationMockV9()");
@ -1021,7 +1021,7 @@ LocationErrCode LocatorImpl::DisableLocationMockV9()
LocationErrCode LocatorImpl::SetMockedLocationsV9(
const int timeInterval, const std::vector<std::shared_ptr<Location>> &location)
{
if (!LocationSaLoadManager::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
if (!SaLoadWithStatistic::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
return ERRCODE_SERVICE_UNAVAILABLE;
}
LBSLOGD(LOCATOR_STANDARD, "LocatorImpl::SetMockedLocationsV9()");
@ -1036,7 +1036,7 @@ LocationErrCode LocatorImpl::SetMockedLocationsV9(
LocationErrCode LocatorImpl::EnableReverseGeocodingMockV9()
{
if (!LocationSaLoadManager::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
if (!SaLoadWithStatistic::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
return ERRCODE_SERVICE_UNAVAILABLE;
}
LBSLOGD(LOCATOR_STANDARD, "LocatorImpl::EnableReverseGeocodingMockV9()");
@ -1051,7 +1051,7 @@ LocationErrCode LocatorImpl::EnableReverseGeocodingMockV9()
LocationErrCode LocatorImpl::DisableReverseGeocodingMockV9()
{
if (!LocationSaLoadManager::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
if (!SaLoadWithStatistic::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
return ERRCODE_SERVICE_UNAVAILABLE;
}
LBSLOGD(LOCATOR_STANDARD, "LocatorImpl::DisableReverseGeocodingMockV9()");
@ -1066,7 +1066,7 @@ LocationErrCode LocatorImpl::DisableReverseGeocodingMockV9()
LocationErrCode LocatorImpl::SetReverseGeocodingMockInfoV9(std::vector<std::shared_ptr<GeocodingMockInfo>>& mockInfo)
{
if (!LocationSaLoadManager::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
if (!SaLoadWithStatistic::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
return ERRCODE_SERVICE_UNAVAILABLE;
}
LBSLOGD(LOCATOR_STANDARD, "LocatorImpl::SetReverseGeocodingMockInfoV9()");
@ -1086,7 +1086,7 @@ LocationErrCode LocatorImpl::ProxyForFreeze(std::set<int> pidList, bool isProxy)
isServerExist_ = false;
return ERRCODE_SUCCESS;
}
if (!LocationSaLoadManager::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
if (!SaLoadWithStatistic::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
LBSLOGE(LOCATOR_STANDARD, "%{public}s init locator sa failed", __func__);
isServerExist_ = false;
return ERRCODE_SERVICE_UNAVAILABLE;
@ -1108,7 +1108,7 @@ LocationErrCode LocatorImpl::ResetAllProxy()
isServerExist_ = false;
return ERRCODE_SUCCESS;
}
if (!LocationSaLoadManager::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
if (!SaLoadWithStatistic::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
isServerExist_ = false;
return ERRCODE_SERVICE_UNAVAILABLE;
}
@ -1125,7 +1125,7 @@ LocationErrCode LocatorImpl::ResetAllProxy()
LocationErrCode LocatorImpl::RegisterLocatingRequiredDataCallback(
std::unique_ptr<LocatingRequiredDataConfig>& dataConfig, sptr<ILocatingRequiredDataCallback>& callback)
{
if (!LocationSaLoadManager::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
if (!SaLoadWithStatistic::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
return ERRCODE_SERVICE_UNAVAILABLE;
}
LBSLOGD(LOCATOR_STANDARD, "LocatorImpl::%{public}s", __func__);
@ -1139,7 +1139,7 @@ LocationErrCode LocatorImpl::RegisterLocatingRequiredDataCallback(
LocationErrCode LocatorImpl::UnRegisterLocatingRequiredDataCallback(sptr<ILocatingRequiredDataCallback>& callback)
{
if (!LocationSaLoadManager::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
if (!SaLoadWithStatistic::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
return ERRCODE_SERVICE_UNAVAILABLE;
}
LBSLOGD(LOCATOR_STANDARD, "LocatorImpl::%{public}s", __func__);
@ -1153,7 +1153,7 @@ LocationErrCode LocatorImpl::UnRegisterLocatingRequiredDataCallback(sptr<ILocati
LocationErrCode LocatorImpl::SubscribeLocationError(sptr<ILocatorCallback>& callback)
{
if (!LocationSaLoadManager::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
if (!SaLoadWithStatistic::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
return ERRCODE_SERVICE_UNAVAILABLE;
}
LBSLOGD(LOCATOR_STANDARD, "LocatorImpl::StartLocatingV9()");
@ -1171,7 +1171,7 @@ LocationErrCode LocatorImpl::SubscribeLocationError(sptr<ILocatorCallback>& call
LocationErrCode LocatorImpl::UnSubscribeLocationError(sptr<ILocatorCallback>& callback)
{
if (!LocationSaLoadManager::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
if (!SaLoadWithStatistic::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
return ERRCODE_SERVICE_UNAVAILABLE;
}
LBSLOGD(LOCATOR_STANDARD, "LocatorImpl::StopLocatingV9()");
@ -1206,7 +1206,7 @@ void LocatorImpl::ResetLocatorProxy(const wptr<IRemoteObject> &remote)
UpdateCallbackResumingState(true);
// wait for remote died finished
std::this_thread::sleep_for(std::chrono::milliseconds(WAIT_MS));
if (HasGnssNetworkRequest() && LocationSaLoadManager::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
if (HasGnssNetworkRequest() && SaLoadWithStatistic::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
g_callbackResumer->ResumeCallback();
}
UpdateCallbackResumingState(false);

View File

@ -51,6 +51,15 @@ private:
std::mutex locatorMutex_;
bool state_ = false;
};
class SaLoadWithStatistic {
public:
SaLoadWithStatistic();
~SaLoadWithStatistic();
static bool InitLocationSa(int32_t systemAbilityId);
static bool UnInitLocationSa(int32_t systemAbilityId);
};
} // namespace Location
} // namespace OHOS
#endif // OHOS_LOCATION_SA_LOAD_MANAGER_H

View File

@ -39,6 +39,7 @@ if (location_feature_with_geocode) {
branch_protector_ret = "pac_ret"
deps = [
"$LOCATION_ROOT_DIR/frameworks/base_module:lbsbase_module",
"$LOCATION_ROOT_DIR/frameworks/location_common/common:lbsservice_common",
]
@ -92,6 +93,7 @@ if (location_feature_with_geocode) {
branch_protector_ret = "pac_ret"
deps = [
"$LOCATION_ROOT_DIR/frameworks/base_module:lbsbase_module",
"$LOCATION_ROOT_DIR/frameworks/location_common/common:lbsservice_common",
]

View File

@ -336,7 +336,7 @@ void GeoConvertService::UnloadGeoConvertSystemAbility()
return;
}
auto task = [this]() {
LocationSaLoadManager::UnInitLocationSa(LOCATION_GEO_CONVERT_SA_ID);
SaLoadWithStatistic::UnInitLocationSa(LOCATION_GEO_CONVERT_SA_ID);
GeoConvertService::GetInstance()->DisconnectAbilityConnect();
};
geoConvertHandler_->PostTask(task, UNLOAD_GEOCONVERT_TASK, UNLOAD_GEOCONVERT_DELAY_TIME);

View File

@ -54,6 +54,7 @@ if (location_feature_with_gnss) {
branch_protector_ret = "pac_ret"
deps = [
"$LOCATION_ROOT_DIR/frameworks/base_module:lbsbase_module",
"$LOCATION_ROOT_DIR/frameworks/location_common/common:lbsservice_common",
"$LOCATION_ROOT_DIR/frameworks/native/geofence_sdk:geofence_sdk",
]
@ -180,6 +181,7 @@ if (location_feature_with_gnss) {
branch_protector_ret = "pac_ret"
deps = [
"$LOCATION_ROOT_DIR/frameworks/base_module:lbsbase_module",
"$LOCATION_ROOT_DIR/frameworks/location_common/common:lbsservice_common",
"$LOCATION_ROOT_DIR/frameworks/native/geofence_sdk:geofence_sdk",
]

View File

@ -215,7 +215,7 @@ void GnssAbility::UnloadGnssSystemAbility()
return;
}
auto task = [this]() {
LocationSaLoadManager::UnInitLocationSa(LOCATION_GNSS_SA_ID);
SaLoadWithStatistic::UnInitLocationSa(LOCATION_GNSS_SA_ID);
};
if (gnssHandler_ != nullptr) {
gnssHandler_->PostTask(task, UNLOAD_GNSS_TASK, RETRY_INTERVAL_OF_UNLOAD_SA);

View File

@ -67,6 +67,7 @@ ohos_shared_library("lbsservice_locator") {
deps = [
"$LOCATION_COMMON_DIR:lbsservice_common",
"$LOCATION_ROOT_DIR/frameworks/base_module:lbsbase_module",
"$LOCATION_ROOT_DIR/frameworks/native/geofence_sdk:geofence_sdk",
]
@ -187,6 +188,7 @@ ohos_static_library("lbsservice_locator_static") {
deps = [
"$LOCATION_COMMON_DIR:lbsservice_common",
"$LOCATION_ROOT_DIR/frameworks/base_module:lbsbase_module",
"$LOCATION_ROOT_DIR/frameworks/native/geofence_sdk:geofence_sdk",
]

View File

@ -409,7 +409,7 @@ void LocatorAbility::PostUnloadTask(uint32_t code)
return;
}
auto task = [this]() {
LocationSaLoadManager::UnInitLocationSa(LOCATION_LOCATOR_SA_ID);
SaLoadWithStatistic::UnInitLocationSa(LOCATION_LOCATOR_SA_ID);
};
if (locatorHandler_ != nullptr) {
locatorHandler_->PostTask(task, UNLOAD_TASK, RETRY_INTERVAL_OF_UNLOAD_SA);
@ -516,7 +516,7 @@ LocationErrCode LocatorAbility::UnregisterSwitchCallback(const sptr<IRemoteObjec
#ifdef FEATURE_GNSS_SUPPORT
LocationErrCode LocatorAbility::SendGnssRequest(int type, MessageParcel &data, MessageParcel &reply)
{
if (!LocationSaLoadManager::InitLocationSa(LOCATION_GNSS_SA_ID)) {
if (!SaLoadWithStatistic::InitLocationSa(LOCATION_GNSS_SA_ID)) {
return ERRCODE_SERVICE_UNAVAILABLE;
}
sptr<IRemoteObject> objectGnss =
@ -835,7 +835,7 @@ void LocatorAbility::UpdateProxyMap()
std::unique_lock<std::mutex> lock(proxyMapMutex_);
#ifdef FEATURE_GNSS_SUPPORT
// init gnss ability sa
if (!LocationSaLoadManager::InitLocationSa(LOCATION_GNSS_SA_ID)) {
if (!SaLoadWithStatistic::InitLocationSa(LOCATION_GNSS_SA_ID)) {
return;
}
sptr<IRemoteObject> objectGnss = CommonUtils::GetRemoteObject(LOCATION_GNSS_SA_ID, CommonUtils::InitDeviceId());
@ -847,7 +847,7 @@ void LocatorAbility::UpdateProxyMap()
#endif
#ifdef FEATURE_NETWORK_SUPPORT
// init network ability sa
if (!LocationSaLoadManager::InitLocationSa(LOCATION_NETWORK_LOCATING_SA_ID)) {
if (!SaLoadWithStatistic::InitLocationSa(LOCATION_NETWORK_LOCATING_SA_ID)) {
return;
}
sptr<IRemoteObject> objectNetwork = CommonUtils::GetRemoteObject(LOCATION_NETWORK_LOCATING_SA_ID,
@ -860,7 +860,7 @@ void LocatorAbility::UpdateProxyMap()
#endif
#ifdef FEATURE_PASSIVE_SUPPORT
// init passive ability sa
if (!LocationSaLoadManager::InitLocationSa(LOCATION_NOPOWER_LOCATING_SA_ID)) {
if (!SaLoadWithStatistic::InitLocationSa(LOCATION_NOPOWER_LOCATING_SA_ID)) {
return;
}
sptr<IRemoteObject> objectPassive = CommonUtils::GetRemoteObject(LOCATION_NOPOWER_LOCATING_SA_ID,
@ -1305,7 +1305,7 @@ void LocatorAbility::GetAddressByLocationName(MessageParcel &data, MessageParcel
#ifdef FEATURE_GEOCODE_SUPPORT
LocationErrCode LocatorAbility::SendGeoRequest(int type, MessageParcel &data, MessageParcel &reply)
{
if (!LocationSaLoadManager::InitLocationSa(LOCATION_GEO_CONVERT_SA_ID)) {
if (!SaLoadWithStatistic::InitLocationSa(LOCATION_GEO_CONVERT_SA_ID)) {
reply.WriteInt32(ERRCODE_SERVICE_UNAVAILABLE);
return ERRCODE_SERVICE_UNAVAILABLE;
}
@ -1901,7 +1901,7 @@ void LocatorHandler::SendSwitchStateToHifenceEvent(const AppExecFwk::InnerEvent:
auto locatorAbility = LocatorAbility::GetInstance();
if (locatorAbility != nullptr) {
int state = event->GetParam();
if (!LocationSaLoadManager::InitLocationSa(COMMON_SA_ID)) {
if (!SaLoadWithStatistic::InitLocationSa(COMMON_SA_ID)) {
return;
}
MessageParcel data;

View File

@ -515,7 +515,7 @@ bool RequestManager::AddRequestToWorkRecord(std::string abilityName, std::shared
void RequestManager::ProxySendLocationRequest(std::string abilityName, WorkRecord& workRecord)
{
int systemAbilityId = CommonUtils::AbilityConvertToId(abilityName);
if (!LocationSaLoadManager::InitLocationSa(systemAbilityId)) {
if (!SaLoadWithStatistic::InitLocationSa(systemAbilityId)) {
return ;
}
sptr<IRemoteObject> remoteObject = CommonUtils::GetRemoteObject(systemAbilityId, CommonUtils::InitDeviceId());

View File

@ -42,6 +42,7 @@ if (location_feature_with_network) {
branch_protector_ret = "pac_ret"
deps = [
"$LOCATION_ROOT_DIR/frameworks/base_module:lbsbase_module",
"$LOCATION_ROOT_DIR/frameworks/location_common/common:lbsservice_common",
]
@ -100,6 +101,7 @@ if (location_feature_with_network) {
branch_protector_ret = "pac_ret"
deps = [
"$LOCATION_ROOT_DIR/frameworks/base_module:lbsbase_module",
"$LOCATION_ROOT_DIR/frameworks/location_common/common:lbsservice_common",
]

View File

@ -243,7 +243,7 @@ void NetworkAbility::UnloadNetworkSystemAbility()
return;
}
auto task = [this]() {
LocationSaLoadManager::UnInitLocationSa(LOCATION_NETWORK_LOCATING_SA_ID);
SaLoadWithStatistic::UnInitLocationSa(LOCATION_NETWORK_LOCATING_SA_ID);
};
if (networkHandler_ != nullptr) {
networkHandler_->PostTask(task, UNLOAD_NETWORK_TASK, RETRY_INTERVAL_OF_UNLOAD_SA);

View File

@ -40,6 +40,7 @@ if (location_feature_with_passive) {
branch_protector_ret = "pac_ret"
deps = [
"$LOCATION_ROOT_DIR/frameworks/base_module:lbsbase_module",
"$LOCATION_ROOT_DIR/frameworks/location_common/common:lbsservice_common",
]
@ -90,6 +91,7 @@ if (location_feature_with_passive) {
branch_protector_ret = "pac_ret"
deps = [
"$LOCATION_ROOT_DIR/frameworks/base_module:lbsbase_module",
"$LOCATION_ROOT_DIR/frameworks/location_common/common:lbsservice_common",
]

View File

@ -122,7 +122,7 @@ void PassiveAbility::UnloadPassiveSystemAbility()
return;
}
auto task = [this]() {
LocationSaLoadManager::UnInitLocationSa(LOCATION_NOPOWER_LOCATING_SA_ID);
SaLoadWithStatistic::UnInitLocationSa(LOCATION_NOPOWER_LOCATING_SA_ID);
};
if (passiveHandler_ != nullptr) {
passiveHandler_->PostTask(task, UNLOAD_PASSIVE_TASK, RETRY_INTERVAL_OF_UNLOAD_SA);