diff --git a/frameworks/location_common/common/BUILD.gn b/frameworks/location_common/common/BUILD.gn index 1b96e044..1b43cfa6 100644 --- a/frameworks/location_common/common/BUILD.gn +++ b/frameworks/location_common/common/BUILD.gn @@ -33,6 +33,7 @@ local_base_sources = [ "$LOCATION_COMMON_DIR/source/request.cpp", "$LOCATION_COMMON_DIR/source/sa_load_with_statistic.cpp", "$LOCATION_COMMON_DIR/source/ui_extension_ability_connection.cpp", + "$LOCATION_COMMON_DIR/source/work_record_statistic.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", diff --git a/frameworks/location_common/common/liblbsservice_common_version_script.txt b/frameworks/location_common/common/liblbsservice_common_version_script.txt index c8a2fa03..da938287 100644 --- a/frameworks/location_common/common/liblbsservice_common_version_script.txt +++ b/frameworks/location_common/common/liblbsservice_common_version_script.txt @@ -23,7 +23,7 @@ "*Location*WriteAppLocatingStateEvent*"; "*ExecuteHookWhenAddWorkRecord*"; "*LOCATOR_SA_LOCATION_PERMISSION_CHECK*"; - + "*WorkRecordStatistic*"; local: *; }; \ No newline at end of file diff --git a/services/location_locator/locator/source/work_record_statistic.cpp b/frameworks/location_common/common/source/work_record_statistic.cpp similarity index 100% rename from services/location_locator/locator/source/work_record_statistic.cpp rename to frameworks/location_common/common/source/work_record_statistic.cpp diff --git a/services/location_locator/locator/include/work_record_statistic.h b/interfaces/inner_api/include/work_record_statistic.h similarity index 100% rename from services/location_locator/locator/include/work_record_statistic.h rename to interfaces/inner_api/include/work_record_statistic.h diff --git a/services/location_gnss/gnss/BUILD.gn b/services/location_gnss/gnss/BUILD.gn index 88b67d24..202f0ae7 100644 --- a/services/location_gnss/gnss/BUILD.gn +++ b/services/location_gnss/gnss/BUILD.gn @@ -33,7 +33,6 @@ if (location_feature_with_gnss) { "$LOCATION_LOCATOR_ROOT/source/location_config_manager.cpp", "$LOCATION_LOCATOR_ROOT/source/subability_common.cpp", "$LOCATION_LOCATOR_ROOT/source/work_record.cpp", - "$LOCATION_LOCATOR_ROOT/source/work_record_statistic.cpp", ] ohos_shared_library("lbsservice_gnss") { diff --git a/services/location_locator/locator/BUILD.gn b/services/location_locator/locator/BUILD.gn index 14eb76bd..f4fed904 100644 --- a/services/location_locator/locator/BUILD.gn +++ b/services/location_locator/locator/BUILD.gn @@ -42,7 +42,6 @@ local_base_sources = [ "$SUBSYSTEM_DIR/location_locator/locator/source/request_manager.cpp", "$SUBSYSTEM_DIR/location_locator/locator/source/subability_common.cpp", "$SUBSYSTEM_DIR/location_locator/locator/source/work_record.cpp", - "$SUBSYSTEM_DIR/location_locator/locator/source/work_record_statistic.cpp", ] ohos_shared_library("lbsservice_locator") { diff --git a/services/location_locator/locator/source/locator_ability.cpp b/services/location_locator/locator/source/locator_ability.cpp index 0ce6864e..574e2162 100644 --- a/services/location_locator/locator/source/locator_ability.cpp +++ b/services/location_locator/locator/source/locator_ability.cpp @@ -1030,19 +1030,12 @@ bool LocatorAbility::NeedReportCacheLocation(const std::shared_ptr& req } callback->OnLocationReport(cacheLocation); PrivacyKit::StopUsingPermission(request->GetTokenId(), ACCESS_APPROXIMATELY_LOCATION); - if (locatorHandler_ != nullptr && - locatorHandler_->SendHighPriorityEvent(EVENT_UPDATE_LASTLOCATION_REQUESTNUM, 0, 1)) { - LBSLOGD(LOCATOR, "%{public}s: EVENT_UPDATE_LASTLOCATION_REQUESTNUM Send Success", __func__); - } + UpdateLastLocationRequestNum(); return true; } } else if (!IsSingleRequest(request->GetRequestConfig()) && IsCacheVaildScenario(request->GetRequestConfig())) { auto cacheLocation = reportManager_->GetCacheLocation(request); if (cacheLocation != nullptr && callback != nullptr) { - auto workRecordStatistic = WorkRecordStatistic::GetInstance(); - if (!workRecordStatistic->Update("CacheLocation", 1)) { - LBSLOGE(LOCATOR, "%{public}s line:%{public}d workRecordStatistic::Update failed", __func__, __LINE__); - } // add location permission using record int ret = UpdatePermissionUsedRecord(request->GetTokenId(), ACCESS_APPROXIMATELY_LOCATION, request->GetPermUsedType(), 1, 0); @@ -1096,10 +1089,6 @@ LocationErrCode LocatorAbility::GetCacheLocation(std::unique_ptr& loc, return ERRCODE_SERVICE_UNAVAILABLE; } auto lastLocation = reportManager_->GetLastLocation(); - if (locatorHandler_ != nullptr && - locatorHandler_->SendHighPriorityEvent(EVENT_UPDATE_LASTLOCATION_REQUESTNUM, 0, 1)) { - LBSLOGD(LOCATOR, "%{public}s: EVENT_UPDATE_LASTLOCATION_REQUESTNUM Send Success", __func__); - } std::unique_ptr requestConfig = std::make_unique(); sptr callback; std::shared_ptr request = std::make_shared(requestConfig, callback, identity); @@ -1839,12 +1828,10 @@ void LocatorHandler::GetCachedLocationSuccess(const AppExecFwk::InnerEvent::Poin Security::AccessToken::AccessTokenKit::GetPermissionUsedType(tokenId, ACCESS_APPROXIMATELY_LOCATION); auto locatorAbility = LocatorAbility::GetInstance(); int ret; - if (locatorAbility != nullptr) { - locatorAbility->UpdateLastLocationRequestNum(); - ret = locatorAbility->UpdatePermissionUsedRecord(tokenId, ACCESS_APPROXIMATELY_LOCATION, - static_cast(type), 1, 0); - LBSLOGD(LOCATOR, "UpdatePermissionUsedRecord, ret=%{public}d", ret); - } + locatorAbility->UpdateLastLocationRequestNum(); + ret = locatorAbility->UpdatePermissionUsedRecord(tokenId, ACCESS_APPROXIMATELY_LOCATION, + static_cast(type), 1, 0); + LBSLOGD(LOCATOR, "UpdatePermissionUsedRecord, ret=%{public}d", ret); ret = PrivacyKit::StopUsingPermission(tokenId, ACCESS_APPROXIMATELY_LOCATION); LBSLOGD(LOCATOR, "StopUsingPermission, ret=%{public}d", ret); } @@ -1860,12 +1847,10 @@ void LocatorHandler::GetCachedLocationFailed(const AppExecFwk::InnerEvent::Point Security::AccessToken::AccessTokenKit::GetPermissionUsedType(tokenId, ACCESS_APPROXIMATELY_LOCATION); auto locatorAbility = LocatorAbility::GetInstance(); int ret; - if (locatorAbility != nullptr) { - locatorAbility->UpdateLastLocationRequestNum(); - ret = locatorAbility->UpdatePermissionUsedRecord(tokenId, ACCESS_APPROXIMATELY_LOCATION, - static_cast(type), 0, 1); - LBSLOGD(LOCATOR, "UpdatePermissionUsedRecord, ret=%{public}d", ret); - } + locatorAbility->UpdateLastLocationRequestNum(); + ret = locatorAbility->UpdatePermissionUsedRecord(tokenId, ACCESS_APPROXIMATELY_LOCATION, + static_cast(type), 0, 1); + LBSLOGD(LOCATOR, "UpdatePermissionUsedRecord, ret=%{public}d", ret); ret = PrivacyKit::StopUsingPermission(tokenId, ACCESS_APPROXIMATELY_LOCATION); LBSLOGD(LOCATOR, "StopUsingPermission, ret=%{public}d", ret); } diff --git a/services/location_network/network/BUILD.gn b/services/location_network/network/BUILD.gn index dd5855a2..695172b8 100644 --- a/services/location_network/network/BUILD.gn +++ b/services/location_network/network/BUILD.gn @@ -18,7 +18,6 @@ local_base_sources = [ "$LOCATION_LOCATOR_ROOT/source/location_config_manager.cpp", "$LOCATION_LOCATOR_ROOT/source/subability_common.cpp", "$LOCATION_LOCATOR_ROOT/source/work_record.cpp", - "$LOCATION_LOCATOR_ROOT/source/work_record_statistic.cpp", "$LOCATION_NETWORK_ROOT/source/network_ability.cpp", "$LOCATION_NETWORK_ROOT/source/network_ability_skeleton.cpp", "$LOCATION_NETWORK_ROOT/source/network_callback_host.cpp", diff --git a/services/location_passive/passive/BUILD.gn b/services/location_passive/passive/BUILD.gn index 9f7343b8..ec4fa390 100644 --- a/services/location_passive/passive/BUILD.gn +++ b/services/location_passive/passive/BUILD.gn @@ -17,7 +17,6 @@ import("//build/ohos.gni") local_base_sources = [ "$LOCATION_LOCATOR_ROOT/source/subability_common.cpp", "$LOCATION_LOCATOR_ROOT/source/work_record.cpp", - "$LOCATION_LOCATOR_ROOT/source/work_record_statistic.cpp", "$LOCATION_PASSIVE_ROOT/source/passive_ability.cpp", "$LOCATION_PASSIVE_ROOT/source/passive_ability_skeleton.cpp", ]