diff --git a/services/abilitymgr/include/app_exit_reason_data_manager.h b/services/abilitymgr/include/app_exit_reason_data_manager.h index dd12043f6eabbf22b4a40d5cc60f3989ff2207df..0783a97f873cead91f07fa7b8151489c13884fb8 100644 --- a/services/abilitymgr/include/app_exit_reason_data_manager.h +++ b/services/abilitymgr/include/app_exit_reason_data_manager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2023-2025 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 @@ -104,6 +104,7 @@ private: DistributedKv::Key GetSessionIdKey(const int32_t sessionId); DistributedKv::Value ConvertAccessTokenIdToValue(uint32_t accessTokenId); DistributedKv::Status RestoreKvStore(DistributedKv::Status status); + static void PutAsync(const DistributedKv::Key &key, const DistributedKv::Value &value); const DistributedKv::AppId appId_ { "app_exit_reason_storage" }; const DistributedKv::StoreId storeId_ { "app_exit_reason_infos" }; diff --git a/services/abilitymgr/src/ability_manager_service.cpp b/services/abilitymgr/src/ability_manager_service.cpp index d013717be00e8c617acc7b5de1e7877f6a570a4d..57e0212db6096394a4ab35089b651f6c99b7d463 100644 --- a/services/abilitymgr/src/ability_manager_service.cpp +++ b/services/abilitymgr/src/ability_manager_service.cpp @@ -11862,7 +11862,8 @@ int32_t AbilityManagerService::KillProcessWithReason(int32_t pid, const ExitReas eventInfo.exitMsg = reason.exitMsg; eventInfo.shouldKillForeground = reason.shouldKillForeground; auto ret = KillProcessWithReasonInner(pid, reason); - TAG_LOGI(AAFwkTag::ABILITYMGR, "KillProcessWithReason ret: %{public}d", ret); + TAG_LOGE(AAFwkTag::ABILITYMGR, "KillProcessWithReason ret: %{public}d, reason: %{public}s", ret, + reason.exitMsg.c_str()); if (reason.reason == Reason::REASON_RESOURCE_CONTROL && reason.exitMsg == GlobalConstant::LOW_MEMORY_KILL) { eventHelper_.SendKillProcessWithReasonEvent(ret, "KillProcessWithReason", eventInfo); } diff --git a/services/abilitymgr/src/app_exit_reason_data_manager.cpp b/services/abilitymgr/src/app_exit_reason_data_manager.cpp index e359ae084fb7434b6684b9a84daf795b89f0cc8e..95574623ed8300d0467a297dc7972b410d1ac90b 100644 --- a/services/abilitymgr/src/app_exit_reason_data_manager.cpp +++ b/services/abilitymgr/src/app_exit_reason_data_manager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023-2024 Huawei Device Co., Ltd. + * Copyright (c) 2023-2025 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 @@ -20,8 +20,10 @@ #include "ability_manager_errors.h" #include "accesstoken_kit.h" #include "exit_info_data_manager.h" +#include "ffrt.h" #include "hitrace_meter.h" #include "os_account_manager_wrapper.h" +#include "record_cost_time_util.h" namespace OHOS { namespace AbilityRuntime { @@ -48,6 +50,7 @@ const std::string JSON_KEY_PROCESS_NAME = "process_name"; const std::string JSON_KEY_PSS_VALUE = "pss_value"; const std::string JSON_KEY_RSS_VALUE = "rss_value"; const std::string JSON_KEY_PROSESS_STATE = "process_state"; +constexpr const char* PUT_TASK_NAME = "kvStorePtr_->Put"; } // namespace AppExitReasonDataManager::AppExitReasonDataManager() {} @@ -81,6 +84,7 @@ DistributedKv::Status AppExitReasonDataManager::GetKvStore() bool AppExitReasonDataManager::CheckKvStore() { HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); + AAFwk::RecordCostTimeUtil timeRecord("CheckKvStore"); TAG_LOGD(AAFwkTag::ABILITYMGR, "AppExitReasonDataManager::CheckKvStore start"); if (kvStorePtr_ != nullptr) { return true; @@ -91,7 +95,7 @@ bool AppExitReasonDataManager::CheckKvStore() if (status == DistributedKv::Status::SUCCESS && kvStorePtr_ != nullptr) { return true; } - TAG_LOGD(AAFwkTag::ABILITYMGR, "try times: %{public}d", tryTimes); + TAG_LOGW(AAFwkTag::ABILITYMGR, "try times: %{public}d", tryTimes); usleep(CHECK_INTERVAL); tryTimes--; } @@ -103,6 +107,7 @@ int32_t AppExitReasonDataManager::SetAppExitReason(const std::string &bundleName const AppExecFwk::RunningProcessInfo &processInfo, bool withKillMsg) { HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); + AAFwk::RecordCostTimeUtil timeRecord("SetAppExitReason"); if (bundleName.empty() || accessTokenId == Security::AccessToken::INVALID_TOKENID) { TAG_LOGW(AAFwkTag::ABILITYMGR, "invalid value"); return ERR_INVALID_VALUE; @@ -119,17 +124,7 @@ int32_t AppExitReasonDataManager::SetAppExitReason(const std::string &bundleName DistributedKv::Key key(keyStr); DistributedKv::Value value = ConvertAppExitReasonInfoToValue(abilityList, exitReason, processInfo, withKillMsg); - DistributedKv::Status status; - { - HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, "kvStorePtr_->Put"); - std::lock_guard lock(kvStorePtrMutex_); - status = kvStorePtr_->Put(key, value); - } - - if (status != DistributedKv::Status::SUCCESS) { - TAG_LOGE(AAFwkTag::ABILITYMGR, "insert data err: %{public}d", status); - return ERR_INVALID_OPERATION; - } + PutAsync(key, value); TAG_LOGI(AAFwkTag::ABILITYMGR, "set reason info: %{public}s", value.ToString().c_str()); return ERR_OK; } @@ -681,6 +676,7 @@ int32_t AppExitReasonDataManager::SetUIExtensionAbilityExitReason( const AppExecFwk::RunningProcessInfo &processInfo, bool withKillMsg) { HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); + AAFwk::RecordCostTimeUtil timeRecord("SetUIExtensionAbilityExitReason"); TAG_LOGD(AAFwkTag::ABILITYMGR, "called"); if (bundleName.empty()) { TAG_LOGW(AAFwkTag::ABILITYMGR, "invalid bundle name"); @@ -700,16 +696,7 @@ int32_t AppExitReasonDataManager::SetUIExtensionAbilityExitReason( DistributedKv::Key key(keyEx); DistributedKv::Value value = ConvertAppExitReasonInfoToValueOfExtensionName(extension, exitReason, processInfo, withKillMsg); - DistributedKv::Status status; - { - HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, "kvStorePtr_->Put"); - std::lock_guard lock(kvStorePtrMutex_); - status = kvStorePtr_->Put(key, value); - } - - if (status != DistributedKv::Status::SUCCESS) { - TAG_LOGW(AAFwkTag::ABILITYMGR, "error: %{public}d", status); - } + PutAsync(key, value); } return ERR_OK; @@ -1002,5 +989,19 @@ int32_t AppExitReasonDataManager::GetRecordAppAbilityNames(const uint32_t access return ERR_OK; } + +void AppExitReasonDataManager::PutAsync(const DistributedKv::Key &key, const DistributedKv::Value &value) +{ + ffrt::submit([key, value]() { + auto pThis = DelayedSingleton::GetInstance(); + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, PUT_TASK_NAME); + AAFwk::RecordCostTimeUtil timeRecord(PUT_TASK_NAME); + std::lock_guard lock(pThis->kvStorePtrMutex_); + auto status = pThis->kvStorePtr_->Put(key, value); + if (status != DistributedKv::Status::SUCCESS) { + TAG_LOGW(AAFwkTag::ABILITYMGR, "insert error: %{public}d", status); + } + }, ffrt::task_attr().name(PUT_TASK_NAME)); +} } // namespace AbilityRuntime } // namespace OHOS diff --git a/services/appmgr/BUILD.gn b/services/appmgr/BUILD.gn index 81f2ddcdac9ad40f2bd2ad30be8a98b388c027d4..b9d6640df6bd381647646dd476c29e9e337b77c4 100644 --- a/services/appmgr/BUILD.gn +++ b/services/appmgr/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2024 Huawei Device Co., Ltd. +# Copyright (c) 2021-2025 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 @@ -114,6 +114,7 @@ ohos_shared_library("libappms") { "${ability_runtime_services_path}/common:app_util", "${ability_runtime_services_path}/common:event_report", "${ability_runtime_services_path}/common:perm_verification", + "${ability_runtime_services_path}/common:record_cost_time_util", "${ability_runtime_services_path}/common:res_sched_util", "${ability_runtime_services_path}/common:task_handler_wrap", ] diff --git a/services/appmgr/include/app_mgr_service_inner.h b/services/appmgr/include/app_mgr_service_inner.h index d3f8f0b72645b75166dc462e2d995731badbab68..ba2fd4ab26e37f1d4f00171efa8563e2dd6fd26e 100644 --- a/services/appmgr/include/app_mgr_service_inner.h +++ b/services/appmgr/include/app_mgr_service_inner.h @@ -2075,6 +2075,7 @@ private: std::vector &instanceKeys, int32_t userId); int32_t KillProcessByPidInner(const pid_t pid, const std::string& reason, const std::string& killReason, std::shared_ptr appRecord); + void SetKilledEventInfo(std::shared_ptr appRecord, AAFwk::EventInfo &eventInfo); void AddToKillProcessMap(const std::string &processName); bool IsAllowedNWebPreload(const std::string &processName); void ParseInfoToAppfreeze(const FaultData &faultData, int32_t pid, int32_t uid, const std::string &bundleName, diff --git a/services/appmgr/src/app_mgr_service_inner.cpp b/services/appmgr/src/app_mgr_service_inner.cpp index 425ab4d6b594ddd6c2301096a4851b0dca129893..66dd689fce1e3226ccbe2392337726b7c7786a5a 100644 --- a/services/appmgr/src/app_mgr_service_inner.cpp +++ b/services/appmgr/src/app_mgr_service_inner.cpp @@ -77,6 +77,7 @@ #include "perf_profile.h" #include "permission_constants.h" #include "permission_verification.h" +#include "record_cost_time_util.h" #include "render_state_observer_manager.h" #include "res_sched_util.h" #include "startup_util.h" @@ -2984,6 +2985,7 @@ int32_t AppMgrServiceInner::KillProcessByPidInner(const pid_t pid, const std::st const std::string& killReason, std::shared_ptr appRecord) { HITRACE_METER_NAME(HITRACE_TAG_APP, __PRETTY_FUNCTION__); + AAFwk::RecordCostTimeUtil timeRecord("KillProcessByPidInner"); int32_t ret = -1; if (pid > 0) { if (CheckIsThreadInFoundation(pid)) { @@ -3004,21 +3006,12 @@ int32_t AppMgrServiceInner::KillProcessByPidInner(const pid_t pid, const std::st } CHECK_POINTER_AND_RETURN_VALUE(appRecord, ret); AAFwk::EventInfo eventInfo; + SetKilledEventInfo(appRecord, eventInfo); appRecord->SetKillReason(reason); - auto applicationInfo = appRecord->GetApplicationInfo(); - if (!applicationInfo) { - TAG_LOGE(AAFwkTag::APPMGR, "appInfo null"); - } else { - eventInfo.bundleName = applicationInfo->name; - eventInfo.versionName = applicationInfo->versionName; - eventInfo.versionCode = applicationInfo->versionCode; - } if (ret >= 0) { AddToKillProcessMap(appRecord->GetProcessName()); } DelayedSingleton::GetInstance()->OnProcessKilled(appRecord); - eventInfo.pid = appRecord->GetPid(); - eventInfo.processName = appRecord->GetProcessName(); std::string newReason = appRecord->GetKillReason().empty() ? killReason : appRecord->GetKillReason(); bool foreground = appRecord->GetState() == ApplicationState::APP_STATE_FOREGROUND || appRecord->GetState() == ApplicationState::APP_STATE_FOCUS; @@ -3033,6 +3026,21 @@ int32_t AppMgrServiceInner::KillProcessByPidInner(const pid_t pid, const std::st return ret; } +void AppMgrServiceInner::SetKilledEventInfo(std::shared_ptr appRecord, AAFwk::EventInfo &eventInfo) +{ + CHECK_POINTER_AND_RETURN_LOG(appRecord, "appRecord is null"); + auto applicationInfo = appRecord->GetApplicationInfo(); + if (!applicationInfo) { + TAG_LOGE(AAFwkTag::APPMGR, "appInfo null"); + } else { + eventInfo.bundleName = applicationInfo->name; + eventInfo.versionName = applicationInfo->versionName; + eventInfo.versionCode = applicationInfo->versionCode; + } + eventInfo.pid = appRecord->GetPid(); + eventInfo.processName = appRecord->GetProcessName(); +} + void AppMgrServiceInner::AddToKillProcessMap(const std::string &processName) { std::lock_guard lock(killedProcessMapLock_); diff --git a/services/appmgr/src/cache_process_manager.cpp b/services/appmgr/src/cache_process_manager.cpp index 018e3f0f5a5b3a3c9b5149e272fa73eed3dfa718..a9ff065a1fe0a0e82a8dee91e64884faafb52201 100644 --- a/services/appmgr/src/cache_process_manager.cpp +++ b/services/appmgr/src/cache_process_manager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2024-2025 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 @@ -23,6 +23,7 @@ #include "app_utils.h" #include "cache_process_manager.h" #include "hisysevent.h" +#include "record_cost_time_util.h" #include "res_sched_util.h" #include "ui_extension_utils.h" @@ -208,6 +209,7 @@ bool CacheProcessManager::IsCachedProcess(const std::shared_ptr &appRecord) { HITRACE_METER_NAME(HITRACE_TAG_APP, __PRETTY_FUNCTION__); + AAFwk::RecordCostTimeUtil timeRecord("OnProcessKilled"); if (!QueryEnableProcessCache()) { return; } diff --git a/services/common/BUILD.gn b/services/common/BUILD.gn index 99a2194892bec0f560f1963597145df59db1a3ff..fdae4bd1e9cfcf34d3f664eaaf9264bbc9faadd9 100644 --- a/services/common/BUILD.gn +++ b/services/common/BUILD.gn @@ -62,6 +62,10 @@ ohos_shared_library("perm_verification") { sources = [ "src/permission_verification.cpp" ] + deps = [ + ":record_cost_time_util", + ] + external_deps = [ "ability_base:want", "access_token:libaccesstoken_sdk", @@ -95,6 +99,10 @@ ohos_shared_library("event_report") { sources = [ "src/event_report.cpp" ] + deps = [ + ":record_cost_time_util", + ] + external_deps = [ "c_utils:utils", "hilog:libhilog", diff --git a/services/common/src/event_report.cpp b/services/common/src/event_report.cpp index b7c11857f6d66313737531801fd1432e7c713578..2ea04fd823e246ecc3a77f401aba197ae067971b 100644 --- a/services/common/src/event_report.cpp +++ b/services/common/src/event_report.cpp @@ -16,6 +16,7 @@ #include "event_report.h" #include "hilog_tag_wrapper.h" #include "hitrace_meter.h" +#include "record_cost_time_util.h" namespace OHOS { namespace AAFwk { @@ -81,6 +82,7 @@ constexpr const int32_t DEFAULT_EXTENSION_TYPE = -1; void EventReport::SendAppEvent(const EventName &eventName, HiSysEventType type, const EventInfo &eventInfo) { HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); + RecordCostTimeUtil timeRecord("SendAppEvent"); std::string name = ConvertEventName(eventName); if (name == INVALID_EVENT_NAME) { TAG_LOGE(AAFwkTag::DEFAULT, "invalid eventName"); diff --git a/services/common/src/permission_verification.cpp b/services/common/src/permission_verification.cpp index 03d30118d9558745c28eee3d97c31ae9cbfa723a..ef809e79ca6712d141be9f3db9294cc36af98d77 100644 --- a/services/common/src/permission_verification.cpp +++ b/services/common/src/permission_verification.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2025 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 @@ -24,6 +24,7 @@ #include "tokenid_kit.h" #include "hitrace_meter.h" #include "hilog_tag_wrapper.h" +#include "record_cost_time_util.h" namespace OHOS { namespace AAFwk { @@ -54,6 +55,7 @@ bool PermissionVerification::VerifyCallingPermission( const std::string &permissionName, const uint32_t specifyTokenId) const { HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); + RecordCostTimeUtil timeRecord("VerifyCallingPermission"); TAG_LOGD(AAFwkTag::DEFAULT, "permission %{public}s, specifyTokenId: %{public}u", permissionName.c_str(), specifyTokenId); auto callerToken = specifyTokenId == 0 ? GetCallingTokenID() : specifyTokenId; diff --git a/test/fuzztest/abilityappmgrevent_fuzzer/BUILD.gn b/test/fuzztest/abilityappmgrevent_fuzzer/BUILD.gn index 2d77f0c5f385f66e947160d3ad6430e180f26efa..91b7629f1a4e2f15f3b1ed1983b3bb5cf9dc3429 100644 --- a/test/fuzztest/abilityappmgrevent_fuzzer/BUILD.gn +++ b/test/fuzztest/abilityappmgrevent_fuzzer/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2024 Huawei Device Co., Ltd. +# Copyright (c) 2024-2025 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 @@ -39,7 +39,10 @@ ohos_fuzztest("AbilityAppMgrEventFuzzTest") { configs = [ "${ability_runtime_services_path}/appmgr:appmgr_config" ] - deps = [ "${ability_runtime_services_path}/appmgr:libappms" ] + deps = [ + "${ability_runtime_services_path}/appmgr:libappms", + "${ability_runtime_services_path}/common:record_cost_time_util", + ] external_deps = [ "ability_base:configuration", diff --git a/test/fuzztest/abilityappmgreventfirst_fuzzer/BUILD.gn b/test/fuzztest/abilityappmgreventfirst_fuzzer/BUILD.gn index d03bc67d3e41b8f9d33cf27ea3c08fe2640aac8c..4bf94474fa3db8148f038fd7bcf8ac8708c277be 100644 --- a/test/fuzztest/abilityappmgreventfirst_fuzzer/BUILD.gn +++ b/test/fuzztest/abilityappmgreventfirst_fuzzer/BUILD.gn @@ -39,7 +39,10 @@ ohos_fuzztest("AbilityAppMgrEventFirstFuzzTest") { configs = [ "${ability_runtime_services_path}/appmgr:appmgr_config" ] - deps = [ "${ability_runtime_services_path}/appmgr:libappms" ] + deps = [ + "${ability_runtime_services_path}/appmgr:libappms", + "${ability_runtime_services_path}/common:record_cost_time_util", + ] external_deps = [ "ability_base:configuration", diff --git a/test/fuzztest/abilityfirstframestateobservermanager_fuzzer/BUILD.gn b/test/fuzztest/abilityfirstframestateobservermanager_fuzzer/BUILD.gn index 42c0c1b4bb338653e8cb8a2d35990ec5a09ce9d8..ecafbd30b60968daf90c56d507449609ad900467 100644 --- a/test/fuzztest/abilityfirstframestateobservermanager_fuzzer/BUILD.gn +++ b/test/fuzztest/abilityfirstframestateobservermanager_fuzzer/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2024 Huawei Device Co., Ltd. +# Copyright (c) 2024-2025 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 @@ -51,6 +51,7 @@ ohos_fuzztest("AbilityFirstFrameStateObserverManagerFuzzTest") { "${ability_runtime_innerkits_path}/ability_manager:ability_start_options", "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_services_path}/abilitymgr:abilityms", + "${ability_runtime_services_path}/common:record_cost_time_util", ] external_deps = [ diff --git a/test/fuzztest/abilitykeepalivedatamanager_fuzzer/BUILD.gn b/test/fuzztest/abilitykeepalivedatamanager_fuzzer/BUILD.gn index b79c8c338ddc6f24f6cf546220473d310af89888..f9948ac813b609088f19bc23932b361555c5a294 100644 --- a/test/fuzztest/abilitykeepalivedatamanager_fuzzer/BUILD.gn +++ b/test/fuzztest/abilitykeepalivedatamanager_fuzzer/BUILD.gn @@ -66,6 +66,7 @@ ohos_fuzztest("AbilityKeepAliveDataManagerFuzzTest") { "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_path}/utils/server/startup:startup_util", "${ability_runtime_services_path}/abilitymgr:abilityms", + "${ability_runtime_services_path}/common:record_cost_time_util", ] external_deps = [ diff --git a/test/fuzztest/abilitymgrappexitreasonhelper_fuzzer/BUILD.gn b/test/fuzztest/abilitymgrappexitreasonhelper_fuzzer/BUILD.gn index ac51cfe0da4525fa9d0af785bf49eac6411d0074..3380a300f89f174e09a7362bed18c4b6e87b1d11 100644 --- a/test/fuzztest/abilitymgrappexitreasonhelper_fuzzer/BUILD.gn +++ b/test/fuzztest/abilitymgrappexitreasonhelper_fuzzer/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2024 Huawei Device Co., Ltd. +# Copyright (c) 2024-2025 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 @@ -76,6 +76,7 @@ ohos_fuzztest("AbilityMgrAppExitReasonHelperFuzzTest") { "${ability_runtime_services_path}/common:app_util", "${ability_runtime_services_path}/common:event_report", "${ability_runtime_services_path}/common:perm_verification", + "${ability_runtime_services_path}/common:record_cost_time_util", "${ability_runtime_services_path}/common:task_handler_wrap", ] diff --git a/test/fuzztest/cacheprocessmanagera_fuzzer/BUILD.gn b/test/fuzztest/cacheprocessmanagera_fuzzer/BUILD.gn index 6e1fdd154d24a46430fd0673424786bd5b33fa82..4ae2a07e9306ae0468d99c58a49e0cc586d407be 100755 --- a/test/fuzztest/cacheprocessmanagera_fuzzer/BUILD.gn +++ b/test/fuzztest/cacheprocessmanagera_fuzzer/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2024 Huawei Device Co., Ltd. +# Copyright (c) 2024-2025 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 @@ -55,6 +55,7 @@ ohos_fuzztest("CacheProcessManageraFuzzTest") { "${ability_runtime_services_path}/abilitymgr:abilityms", "${ability_runtime_services_path}/appmgr:libappms", "${ability_runtime_services_path}/common:app_util", + "${ability_runtime_services_path}/common:record_cost_time_util", "${ability_runtime_services_path}/common:res_sched_util", ] diff --git a/test/fuzztest/cacheprocessmanagerb_fuzzer/BUILD.gn b/test/fuzztest/cacheprocessmanagerb_fuzzer/BUILD.gn index 75f838f7e99cacbf355d36a1fb59b7188544775a..14f7982daf15a0a08ab0a79792b298062a55b27d 100755 --- a/test/fuzztest/cacheprocessmanagerb_fuzzer/BUILD.gn +++ b/test/fuzztest/cacheprocessmanagerb_fuzzer/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2024 Huawei Device Co., Ltd. +# Copyright (c) 2024-2025 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 @@ -55,6 +55,7 @@ ohos_fuzztest("CacheProcessManagerbFuzzTest") { "${ability_runtime_services_path}/abilitymgr:abilityms", "${ability_runtime_services_path}/appmgr:libappms", "${ability_runtime_services_path}/common:app_util", + "${ability_runtime_services_path}/common:record_cost_time_util", "${ability_runtime_services_path}/common:res_sched_util", ] diff --git a/test/fuzztest/keepaliveprocessmanagereighteenth_fuzzer/BUILD.gn b/test/fuzztest/keepaliveprocessmanagereighteenth_fuzzer/BUILD.gn index e61fe921cecafde0778e7677b937084800328dfd..b9515b6872dcdc63eec8bd54034e54a96abfb386 100644 --- a/test/fuzztest/keepaliveprocessmanagereighteenth_fuzzer/BUILD.gn +++ b/test/fuzztest/keepaliveprocessmanagereighteenth_fuzzer/BUILD.gn @@ -65,6 +65,7 @@ ohos_fuzztest("KeepAliveProcessManagerEighteenthFuzzTest") { "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_path}/utils/server/startup:startup_util", "${ability_runtime_services_path}/abilitymgr:abilityms", + "${ability_runtime_services_path}/common:record_cost_time_util", ] external_deps = [ diff --git a/test/fuzztest/keepaliveprocessmanagereighth_fuzzer/BUILD.gn b/test/fuzztest/keepaliveprocessmanagereighth_fuzzer/BUILD.gn index 4a5f9149a7cb7583cffbddaf3735b28396b0896d..cb815bf317c08e6b1856483dc0732699b0c9acf9 100644 --- a/test/fuzztest/keepaliveprocessmanagereighth_fuzzer/BUILD.gn +++ b/test/fuzztest/keepaliveprocessmanagereighth_fuzzer/BUILD.gn @@ -66,6 +66,7 @@ ohos_fuzztest("KeepAliveProcessManagerEighthFuzzTest") { "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_path}/utils/server/startup:startup_util", "${ability_runtime_services_path}/abilitymgr:abilityms", + "${ability_runtime_services_path}/common:record_cost_time_util", ] external_deps = [ diff --git a/test/fuzztest/keepaliveprocessmanagereleventh_fuzzer/BUILD.gn b/test/fuzztest/keepaliveprocessmanagereleventh_fuzzer/BUILD.gn index fd944ac29d17cc0c8dc546f0b927a435730f0d29..32bf75cdd8142e7aa97b2b34102414583dc7a930 100644 --- a/test/fuzztest/keepaliveprocessmanagereleventh_fuzzer/BUILD.gn +++ b/test/fuzztest/keepaliveprocessmanagereleventh_fuzzer/BUILD.gn @@ -66,6 +66,7 @@ ohos_fuzztest("KeepAliveProcessManagerEleventhFuzzTest") { "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_path}/utils/server/startup:startup_util", "${ability_runtime_services_path}/abilitymgr:abilityms", + "${ability_runtime_services_path}/common:record_cost_time_util", ] external_deps = [ diff --git a/test/fuzztest/keepaliveprocessmanagerfifteenth_fuzzer/BUILD.gn b/test/fuzztest/keepaliveprocessmanagerfifteenth_fuzzer/BUILD.gn index b2f75552c7ec18f5eaeafed965d0bacd0758b6ba..65582f901a0267bba6fc6a577ab3981385891604 100644 --- a/test/fuzztest/keepaliveprocessmanagerfifteenth_fuzzer/BUILD.gn +++ b/test/fuzztest/keepaliveprocessmanagerfifteenth_fuzzer/BUILD.gn @@ -66,6 +66,7 @@ ohos_fuzztest("KeepAliveProcessManagerFifteenthFuzzTest") { "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_path}/utils/server/startup:startup_util", "${ability_runtime_services_path}/abilitymgr:abilityms", + "${ability_runtime_services_path}/common:record_cost_time_util", ] external_deps = [ diff --git a/test/fuzztest/keepaliveprocessmanagerfifth_fuzzer/BUILD.gn b/test/fuzztest/keepaliveprocessmanagerfifth_fuzzer/BUILD.gn index 4f4698b146730c3ffff7adbd2065a1b6732e89ee..e2e99632a7ae0e63eb819fa58ecdab4b03602b3c 100644 --- a/test/fuzztest/keepaliveprocessmanagerfifth_fuzzer/BUILD.gn +++ b/test/fuzztest/keepaliveprocessmanagerfifth_fuzzer/BUILD.gn @@ -65,6 +65,7 @@ ohos_fuzztest("KeepAliveProcessManagerFifthFuzzTest") { "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_path}/utils/server/startup:startup_util", "${ability_runtime_services_path}/abilitymgr:abilityms", + "${ability_runtime_services_path}/common:record_cost_time_util", ] external_deps = [ diff --git a/test/fuzztest/keepaliveprocessmanagerfirst_fuzzer/BUILD.gn b/test/fuzztest/keepaliveprocessmanagerfirst_fuzzer/BUILD.gn index c2b42dd14e271ce9b73a7ee7bbc6bf6f2169e09a..24974375c8faf08feaee40907b11303df08dad8a 100644 --- a/test/fuzztest/keepaliveprocessmanagerfirst_fuzzer/BUILD.gn +++ b/test/fuzztest/keepaliveprocessmanagerfirst_fuzzer/BUILD.gn @@ -66,6 +66,7 @@ ohos_fuzztest("KeepAliveProcessManagerFirstFuzzTest") { "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_path}/utils/server/startup:startup_util", "${ability_runtime_services_path}/abilitymgr:abilityms", + "${ability_runtime_services_path}/common:record_cost_time_util", ] external_deps = [ diff --git a/test/fuzztest/keepaliveprocessmanagerfourteenth_fuzzer/BUILD.gn b/test/fuzztest/keepaliveprocessmanagerfourteenth_fuzzer/BUILD.gn index ea5819bb1b563fb72475623e1b4731547296d6af..63f9807a935a2de52885760d4ce643ca351c153f 100644 --- a/test/fuzztest/keepaliveprocessmanagerfourteenth_fuzzer/BUILD.gn +++ b/test/fuzztest/keepaliveprocessmanagerfourteenth_fuzzer/BUILD.gn @@ -66,6 +66,7 @@ ohos_fuzztest("KeepAliveProcessManagerFourteenthFuzzTest") { "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_path}/utils/server/startup:startup_util", "${ability_runtime_services_path}/abilitymgr:abilityms", + "${ability_runtime_services_path}/common:record_cost_time_util", ] external_deps = [ diff --git a/test/fuzztest/keepaliveprocessmanagerfourth_fuzzer/BUILD.gn b/test/fuzztest/keepaliveprocessmanagerfourth_fuzzer/BUILD.gn index 3f8f0f34754cb13d3244e523e9da8552a4045d69..52e0e169eaad7ff2fa3e3b135b96fa9b22315a64 100644 --- a/test/fuzztest/keepaliveprocessmanagerfourth_fuzzer/BUILD.gn +++ b/test/fuzztest/keepaliveprocessmanagerfourth_fuzzer/BUILD.gn @@ -65,6 +65,7 @@ ohos_fuzztest("KeepAliveProcessManagerFourthFuzzTest") { "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_path}/utils/server/startup:startup_util", "${ability_runtime_services_path}/abilitymgr:abilityms", + "${ability_runtime_services_path}/common:record_cost_time_util", ] external_deps = [ diff --git a/test/fuzztest/keepaliveprocessmanagerninteenth_fuzzer/BUILD.gn b/test/fuzztest/keepaliveprocessmanagerninteenth_fuzzer/BUILD.gn index 387da7002d0b92e21bbc38ee17b9b3c39c4130e0..64d20fa7d020a34a9a08955ba8516c21ed590668 100644 --- a/test/fuzztest/keepaliveprocessmanagerninteenth_fuzzer/BUILD.gn +++ b/test/fuzztest/keepaliveprocessmanagerninteenth_fuzzer/BUILD.gn @@ -65,6 +65,7 @@ ohos_fuzztest("KeepAliveProcessManagerNinteenthFuzzTest") { "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_path}/utils/server/startup:startup_util", "${ability_runtime_services_path}/abilitymgr:abilityms", + "${ability_runtime_services_path}/common:record_cost_time_util", ] external_deps = [ diff --git a/test/fuzztest/keepaliveprocessmanagerninth_fuzzer/BUILD.gn b/test/fuzztest/keepaliveprocessmanagerninth_fuzzer/BUILD.gn index 5a275f3dfc1cc9519a8983f1641a5ed38a8df825..39fdca3deac74fe1a7c5ad0267fbeebe536cc77a 100644 --- a/test/fuzztest/keepaliveprocessmanagerninth_fuzzer/BUILD.gn +++ b/test/fuzztest/keepaliveprocessmanagerninth_fuzzer/BUILD.gn @@ -65,6 +65,7 @@ ohos_fuzztest("KeepAliveProcessManagerNinthFuzzTest") { "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_path}/utils/server/startup:startup_util", "${ability_runtime_services_path}/abilitymgr:abilityms", + "${ability_runtime_services_path}/common:record_cost_time_util", ] external_deps = [ diff --git a/test/fuzztest/keepaliveprocessmanagersecond_fuzzer/BUILD.gn b/test/fuzztest/keepaliveprocessmanagersecond_fuzzer/BUILD.gn index 06a4a959d9f4304148cb2d7d5519b6b816d3be45..2b2d2d882a1c644cd893c1bda7337113d8a067a6 100644 --- a/test/fuzztest/keepaliveprocessmanagersecond_fuzzer/BUILD.gn +++ b/test/fuzztest/keepaliveprocessmanagersecond_fuzzer/BUILD.gn @@ -66,6 +66,7 @@ ohos_fuzztest("KeepAliveProcessManagerSecondFuzzTest") { "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_path}/utils/server/startup:startup_util", "${ability_runtime_services_path}/abilitymgr:abilityms", + "${ability_runtime_services_path}/common:record_cost_time_util", ] external_deps = [ diff --git a/test/fuzztest/keepaliveprocessmanagerseventeenth_fuzzer/BUILD.gn b/test/fuzztest/keepaliveprocessmanagerseventeenth_fuzzer/BUILD.gn index 181525c6ce5e5b0505bb6fd990c19efba2ff2c7d..59b08590d335e5aa2b136cde8ee9336b6e51e676 100644 --- a/test/fuzztest/keepaliveprocessmanagerseventeenth_fuzzer/BUILD.gn +++ b/test/fuzztest/keepaliveprocessmanagerseventeenth_fuzzer/BUILD.gn @@ -65,6 +65,7 @@ ohos_fuzztest("KeepAliveProcessManagerSeventeenthFuzzTest") { "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_path}/utils/server/startup:startup_util", "${ability_runtime_services_path}/abilitymgr:abilityms", + "${ability_runtime_services_path}/common:record_cost_time_util", ] external_deps = [ diff --git a/test/fuzztest/keepaliveprocessmanagerseventh_fuzzer/BUILD.gn b/test/fuzztest/keepaliveprocessmanagerseventh_fuzzer/BUILD.gn index e734c3e63a6f39b5b667451a913336424be2dc99..a90f941ce083976df89de502aa2dad9c42ad6305 100644 --- a/test/fuzztest/keepaliveprocessmanagerseventh_fuzzer/BUILD.gn +++ b/test/fuzztest/keepaliveprocessmanagerseventh_fuzzer/BUILD.gn @@ -66,6 +66,7 @@ ohos_fuzztest("KeepAliveProcessManagerSeventhFuzzTest") { "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_path}/utils/server/startup:startup_util", "${ability_runtime_services_path}/abilitymgr:abilityms", + "${ability_runtime_services_path}/common:record_cost_time_util", ] external_deps = [ diff --git a/test/fuzztest/keepaliveprocessmanagersixteenth_fuzzer/BUILD.gn b/test/fuzztest/keepaliveprocessmanagersixteenth_fuzzer/BUILD.gn index 80e5a2060a5a2c2ace0f92712f729f92f620f120..f4ec5bf813b6dfbe6075bd856a8153a69e7ec01b 100644 --- a/test/fuzztest/keepaliveprocessmanagersixteenth_fuzzer/BUILD.gn +++ b/test/fuzztest/keepaliveprocessmanagersixteenth_fuzzer/BUILD.gn @@ -66,6 +66,7 @@ ohos_fuzztest("KeepAliveProcessManagerSixteenthFuzzTest") { "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_path}/utils/server/startup:startup_util", "${ability_runtime_services_path}/abilitymgr:abilityms", + "${ability_runtime_services_path}/common:record_cost_time_util", ] external_deps = [ diff --git a/test/fuzztest/keepaliveprocessmanagersixth_fuzzer/BUILD.gn b/test/fuzztest/keepaliveprocessmanagersixth_fuzzer/BUILD.gn index ebdfc7905bf49984910e604b6aaa8aebbc2aca5c..48c3944b2778d46992cbb1d5f79374703787f3d2 100644 --- a/test/fuzztest/keepaliveprocessmanagersixth_fuzzer/BUILD.gn +++ b/test/fuzztest/keepaliveprocessmanagersixth_fuzzer/BUILD.gn @@ -65,6 +65,7 @@ ohos_fuzztest("KeepAliveProcessManagerSixthFuzzTest") { "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_path}/utils/server/startup:startup_util", "${ability_runtime_services_path}/abilitymgr:abilityms", + "${ability_runtime_services_path}/common:record_cost_time_util", ] external_deps = [ diff --git a/test/fuzztest/keepaliveprocessmanagertenth_fuzzer/BUILD.gn b/test/fuzztest/keepaliveprocessmanagertenth_fuzzer/BUILD.gn index 83199dd197da7fe21100a481c22726807dcf3f49..97b82a07142f29e4087a2eeb7792a3320e264392 100644 --- a/test/fuzztest/keepaliveprocessmanagertenth_fuzzer/BUILD.gn +++ b/test/fuzztest/keepaliveprocessmanagertenth_fuzzer/BUILD.gn @@ -66,6 +66,7 @@ ohos_fuzztest("KeepAliveProcessManagerTenthFuzzTest") { "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_path}/utils/server/startup:startup_util", "${ability_runtime_services_path}/abilitymgr:abilityms", + "${ability_runtime_services_path}/common:record_cost_time_util", ] external_deps = [ diff --git a/test/fuzztest/keepaliveprocessmanagerthird_fuzzer/BUILD.gn b/test/fuzztest/keepaliveprocessmanagerthird_fuzzer/BUILD.gn index 38321088a32d3ab2bef224972cf5c815d1adef0d..7196e59e83a7ace5b5e95782c1bb2393357b861f 100644 --- a/test/fuzztest/keepaliveprocessmanagerthird_fuzzer/BUILD.gn +++ b/test/fuzztest/keepaliveprocessmanagerthird_fuzzer/BUILD.gn @@ -66,6 +66,7 @@ ohos_fuzztest("KeepAliveProcessManagerThirdFuzzTest") { "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_path}/utils/server/startup:startup_util", "${ability_runtime_services_path}/abilitymgr:abilityms", + "${ability_runtime_services_path}/common:record_cost_time_util", ] external_deps = [ diff --git a/test/fuzztest/keepaliveprocessmanagerthirteenth_fuzzer/BUILD.gn b/test/fuzztest/keepaliveprocessmanagerthirteenth_fuzzer/BUILD.gn index f3a81aae382e88086e8b1a8c612190ac4cf88acf..0bccb3b546e3fa09ad7016ae75e62025581196f7 100644 --- a/test/fuzztest/keepaliveprocessmanagerthirteenth_fuzzer/BUILD.gn +++ b/test/fuzztest/keepaliveprocessmanagerthirteenth_fuzzer/BUILD.gn @@ -66,6 +66,7 @@ ohos_fuzztest("KeepAliveProcessManagerThirteenthFuzzTest") { "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_path}/utils/server/startup:startup_util", "${ability_runtime_services_path}/abilitymgr:abilityms", + "${ability_runtime_services_path}/common:record_cost_time_util", ] external_deps = [ diff --git a/test/fuzztest/keepaliveprocessmanagertwelfth_fuzzer/BUILD.gn b/test/fuzztest/keepaliveprocessmanagertwelfth_fuzzer/BUILD.gn index 6dddef100904b72edc0a604af6586bba5b496605..759511eb962f3d0cf25e10b0622f1ba166846bc3 100644 --- a/test/fuzztest/keepaliveprocessmanagertwelfth_fuzzer/BUILD.gn +++ b/test/fuzztest/keepaliveprocessmanagertwelfth_fuzzer/BUILD.gn @@ -65,6 +65,7 @@ ohos_fuzztest("KeepAliveProcessManagerTwelfthFuzzTest") { "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_path}/utils/server/startup:startup_util", "${ability_runtime_services_path}/abilitymgr:abilityms", + "${ability_runtime_services_path}/common:record_cost_time_util", ] external_deps = [ diff --git a/test/fuzztest/uriutils_fuzzer/BUILD.gn b/test/fuzztest/uriutils_fuzzer/BUILD.gn index 741264a18b7fa1bc1a63d169d5756ef35a1f4410..992ba12030a3e01ecf779aa1d58f03104dc5870f 100644 --- a/test/fuzztest/uriutils_fuzzer/BUILD.gn +++ b/test/fuzztest/uriutils_fuzzer/BUILD.gn @@ -58,6 +58,7 @@ ohos_fuzztest("UriUtilsFuzzTest") { "${ability_runtime_services_path}/abilitymgr:abilityms", "${ability_runtime_services_path}/common:app_util", "${ability_runtime_services_path}/common:perm_verification", + "${ability_runtime_services_path}/common:record_cost_time_util", ] external_deps = [ diff --git a/test/moduletest/ability_timeout_module_test/BUILD.gn b/test/moduletest/ability_timeout_module_test/BUILD.gn index 47f8e38a9de534ebe98195b04a24ba50cf97b5fa..24d5bf9a3ec70ee5d16648abf13f66c5e88e326c 100644 --- a/test/moduletest/ability_timeout_module_test/BUILD.gn +++ b/test/moduletest/ability_timeout_module_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2024 Huawei Device Co., Ltd. +# Copyright (c) 2022-2025 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 @@ -68,6 +68,7 @@ ohos_moduletest("ability_timeout_module_test") { "${ability_runtime_services_path}/common:app_util", "${ability_runtime_services_path}/common:event_report", "${ability_runtime_services_path}/common:perm_verification", + "${ability_runtime_services_path}/common:record_cost_time_util", "${ability_runtime_services_path}/common:task_handler_wrap", ] diff --git a/test/moduletest/common/ams/ability_running_record_test/BUILD.gn b/test/moduletest/common/ams/ability_running_record_test/BUILD.gn index c2f04fb65e7aa5da0350237d26a01855710b2c6a..60e8956a96764dcb14f918c93c90bda1fb361297 100644 --- a/test/moduletest/common/ams/ability_running_record_test/BUILD.gn +++ b/test/moduletest/common/ams/ability_running_record_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2024 Huawei Device Co., Ltd. +# Copyright (c) 2021-2025 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 @@ -31,6 +31,7 @@ ohos_moduletest("AmsAbilityRunningRecordModuleTest") { "${ability_runtime_native_path}/appkit:appkit_manager_helper", "${ability_runtime_services_path}/common:app_util", "${ability_runtime_services_path}/common:perm_verification", + "${ability_runtime_services_path}/common:record_cost_time_util", "${ability_runtime_services_path}/common:res_sched_util", "${ability_runtime_test_path}/moduletest/common/ams:appmgr_mst_source", ] diff --git a/test/moduletest/common/ams/app_mgr_service_test/BUILD.gn b/test/moduletest/common/ams/app_mgr_service_test/BUILD.gn index 1a31bba8cac2c4bd375b3183af72411797cc2a09..245d98c4f01a3da300b8bb9f24525061e733bd44 100644 --- a/test/moduletest/common/ams/app_mgr_service_test/BUILD.gn +++ b/test/moduletest/common/ams/app_mgr_service_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2024 Huawei Device Co., Ltd. +# Copyright (c) 2021-2025 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 @@ -41,6 +41,7 @@ ohos_moduletest("AmsAppMgrServiceModuleTest") { "${ability_runtime_native_path}/appkit:appkit_manager_helper", "${ability_runtime_services_path}/common:app_util", "${ability_runtime_services_path}/common:perm_verification", + "${ability_runtime_services_path}/common:record_cost_time_util", "${ability_runtime_services_path}/common:res_sched_util", "${ability_runtime_test_path}/moduletest/common/ams:appmgr_mst_source", ] diff --git a/test/moduletest/common/ams/app_recent_list_test/BUILD.gn b/test/moduletest/common/ams/app_recent_list_test/BUILD.gn index 19bbcedcf5138641fd9a216282d3f435dcac9568..d1fbca3d6f0673e7959e68b7a23c42e914eac62d 100644 --- a/test/moduletest/common/ams/app_recent_list_test/BUILD.gn +++ b/test/moduletest/common/ams/app_recent_list_test/BUILD.gn @@ -32,6 +32,7 @@ ohos_moduletest("AmsAppRecentListModuleTest") { "${ability_runtime_native_path}/appkit:appkit_manager_helper", "${ability_runtime_services_path}/common:app_util", "${ability_runtime_services_path}/common:perm_verification", + "${ability_runtime_services_path}/common:record_cost_time_util", "${ability_runtime_services_path}/common:res_sched_util", "${ability_runtime_services_path}/common:task_handler_wrap", "${ability_runtime_test_path}/moduletest/common/ams:appmgr_mst_source", diff --git a/test/moduletest/common/ams/app_service_flow_test/BUILD.gn b/test/moduletest/common/ams/app_service_flow_test/BUILD.gn index e7ffc1cc1585e24b9e970ae54cf6bb34de7ba2b6..9a41ae9d754efba4dbb591d1947e5989afbfd2ed 100644 --- a/test/moduletest/common/ams/app_service_flow_test/BUILD.gn +++ b/test/moduletest/common/ams/app_service_flow_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2024 Huawei Device Co., Ltd. +# Copyright (c) 2021-2025 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 @@ -35,6 +35,7 @@ ohos_moduletest("AmsAppServiceFlowModuleTest") { "${ability_runtime_path}/utils/server/startup:startup_util", "${ability_runtime_services_path}/common:app_util", "${ability_runtime_services_path}/common:perm_verification", + "${ability_runtime_services_path}/common:record_cost_time_util", "${ability_runtime_services_path}/common:res_sched_util", "${ability_runtime_services_path}/common:task_handler_wrap", "${ability_runtime_test_path}/moduletest/common/ams:appmgr_mst_source", diff --git a/test/moduletest/common/ams/ipc_ams_mgr_test/BUILD.gn b/test/moduletest/common/ams/ipc_ams_mgr_test/BUILD.gn index ec213b07e27455c9e6c8b5dfda017ddab0308aab..effd5e6d6f74f418b0f2c0fb2486a8dae20d365f 100644 --- a/test/moduletest/common/ams/ipc_ams_mgr_test/BUILD.gn +++ b/test/moduletest/common/ams/ipc_ams_mgr_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2024 Huawei Device Co., Ltd. +# Copyright (c) 2021-2025 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 @@ -41,6 +41,7 @@ ohos_moduletest("AmsIpcAmsmgrModuleTest") { "${ability_runtime_native_path}/appkit:appkit_manager_helper", "${ability_runtime_services_path}/common:app_util", "${ability_runtime_services_path}/common:perm_verification", + "${ability_runtime_services_path}/common:record_cost_time_util", "${ability_runtime_services_path}/common:res_sched_util", "${ability_runtime_services_path}/common:task_handler_wrap", "${ability_runtime_test_path}/moduletest/common/ams:appmgr_mst_source", diff --git a/test/moduletest/common/ams/ipc_app_mgr_test/BUILD.gn b/test/moduletest/common/ams/ipc_app_mgr_test/BUILD.gn index 6288715037226ff485031404b05ed84494653afd..9689d74f1b51e057bcf9901c1a73c784eaa08071 100644 --- a/test/moduletest/common/ams/ipc_app_mgr_test/BUILD.gn +++ b/test/moduletest/common/ams/ipc_app_mgr_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2022 Huawei Device Co., Ltd. +# Copyright (c) 2021-2025 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 @@ -33,6 +33,7 @@ ohos_moduletest("AmsIpcAppmgrModuleTest") { "${ability_runtime_native_path}/appkit:appkit_manager_helper", "${ability_runtime_services_path}/common:app_util", "${ability_runtime_services_path}/common:perm_verification", + "${ability_runtime_services_path}/common:record_cost_time_util", "${ability_runtime_services_path}/common:res_sched_util", "${ability_runtime_test_path}/moduletest/common/ams:appmgr_mst_source", ] diff --git a/test/moduletest/common/ams/ipc_app_scheduler_test/BUILD.gn b/test/moduletest/common/ams/ipc_app_scheduler_test/BUILD.gn index f28a13cbde7d138b95cedfe1b31419257afc21a4..8f3185e86e175ca71316cc958ecd36a4461ccb6a 100644 --- a/test/moduletest/common/ams/ipc_app_scheduler_test/BUILD.gn +++ b/test/moduletest/common/ams/ipc_app_scheduler_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2022 Huawei Device Co., Ltd. +# Copyright (c) 2021-2025 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 @@ -33,6 +33,7 @@ ohos_moduletest("AmsIpcAppSchedulerModuleTest") { "${ability_runtime_native_path}/appkit:appkit_manager_helper", "${ability_runtime_services_path}/common:app_util", "${ability_runtime_services_path}/common:perm_verification", + "${ability_runtime_services_path}/common:record_cost_time_util", "${ability_runtime_services_path}/common:res_sched_util", "${ability_runtime_test_path}/moduletest/common/ams:appmgr_mst_source", ] diff --git a/test/moduletest/common/ams/service_start_process_test/BUILD.gn b/test/moduletest/common/ams/service_start_process_test/BUILD.gn index 7387986da1df6bcb70e5f7085bd2209f0f18b05e..92bf5be75cb7dfd5f0b6551e1a865cef4949f0fe 100644 --- a/test/moduletest/common/ams/service_start_process_test/BUILD.gn +++ b/test/moduletest/common/ams/service_start_process_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2024 Huawei Device Co., Ltd. +# Copyright (c) 2021-2025 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 @@ -33,6 +33,7 @@ ohos_moduletest("AmsServiceStartModuleTest") { "${ability_runtime_native_path}/appkit:appkit_manager_helper", "${ability_runtime_services_path}/common:app_util", "${ability_runtime_services_path}/common:perm_verification", + "${ability_runtime_services_path}/common:record_cost_time_util", "${ability_runtime_services_path}/common:res_sched_util", "${ability_runtime_test_path}/moduletest/common/ams:appmgr_mst_source", ] diff --git a/test/moduletest/running_infos_module_test/BUILD.gn b/test/moduletest/running_infos_module_test/BUILD.gn index 829b7f2e4d848e4e05e2e89b9ed1b80d80881e09..6536a7c81eef9cabedb0d7fa98612970df646f5e 100644 --- a/test/moduletest/running_infos_module_test/BUILD.gn +++ b/test/moduletest/running_infos_module_test/BUILD.gn @@ -70,6 +70,7 @@ ohos_moduletest("running_infos_module_test") { "${ability_runtime_services_path}/common:app_util", "${ability_runtime_services_path}/common:event_report", "${ability_runtime_services_path}/common:perm_verification", + "${ability_runtime_services_path}/common:record_cost_time_util", "${ability_runtime_services_path}/common:task_handler_wrap", ] diff --git a/test/unittest/ability_manager_service_seventh_test/BUILD.gn b/test/unittest/ability_manager_service_seventh_test/BUILD.gn index 6e9c05e69219c944c3528b2362dda5dc3f81237c..7b1e3be494af6fd5b858184dd9b8ed5480b5ece5 100644 --- a/test/unittest/ability_manager_service_seventh_test/BUILD.gn +++ b/test/unittest/ability_manager_service_seventh_test/BUILD.gn @@ -40,7 +40,10 @@ ohos_unittest("ability_manager_service_seventh_test") { "src/permission_verification.cpp", ] - deps = [ "${ability_runtime_innerkits_path}/ability_manager:process_options" ] + deps = [ + "${ability_runtime_innerkits_path}/ability_manager:process_options", + "${ability_runtime_services_path}/common:record_cost_time_util", + ] external_deps = [ "ability_base:session_info", diff --git a/test/unittest/ability_manager_service_third_test/BUILD.gn b/test/unittest/ability_manager_service_third_test/BUILD.gn index d5de8f52b68099fd1c5cc83a82a7b1d9db86fee1..86a41de0433bbcf91bf70d2ef4171867987899ad 100644 --- a/test/unittest/ability_manager_service_third_test/BUILD.gn +++ b/test/unittest/ability_manager_service_third_test/BUILD.gn @@ -90,6 +90,7 @@ ohos_unittest("ability_manager_service_third_test") { "${ability_runtime_innerkits_path}/ability_manager:start_window_option", "${ability_runtime_innerkits_path}/connectionobs_manager:connection_obs_manager", "${ability_runtime_innerkits_path}/session_handler:session_handler", + "${ability_runtime_services_path}/common:record_cost_time_util", "${ability_runtime_services_path}/common:res_sched_util", ] diff --git a/test/unittest/ability_permission_util_test/BUILD.gn b/test/unittest/ability_permission_util_test/BUILD.gn index b7e18da688108442947223512a9471856015128a..c92f2ae1cd8197fb7f424d1ce26e5566475bec75 100644 --- a/test/unittest/ability_permission_util_test/BUILD.gn +++ b/test/unittest/ability_permission_util_test/BUILD.gn @@ -55,6 +55,7 @@ ohos_unittest("ability_permission_util_test") { "${ability_runtime_innerkits_path}/ability_manager:ability_manager", "${ability_runtime_innerkits_path}/app_manager:app_manager", "${ability_runtime_services_path}/common:app_util", + "${ability_runtime_services_path}/common:record_cost_time_util", ] external_deps = [ diff --git a/test/unittest/ams_ability_running_record_test/BUILD.gn b/test/unittest/ams_ability_running_record_test/BUILD.gn index 5403becfe77332bd63a4d6105eacac1b3b3ec763..7064b15201a53c9f35327d0bf5871ab0138e5b1f 100644 --- a/test/unittest/ams_ability_running_record_test/BUILD.gn +++ b/test/unittest/ams_ability_running_record_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2024 Huawei Device Co., Ltd. +# Copyright (c) 2021-2025 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 @@ -65,6 +65,7 @@ ohos_unittest("AmsAbilityRunningRecordTest") { "${ability_runtime_services_path}/common:app_util", "${ability_runtime_services_path}/common:event_report", "${ability_runtime_services_path}/common:perm_verification", + "${ability_runtime_services_path}/common:record_cost_time_util", "${ability_runtime_services_path}/common:res_sched_util", "${ability_runtime_services_path}/common:task_handler_wrap", "${ability_runtime_test_path}/unittest:appmgr_test_source", diff --git a/test/unittest/ams_app_workflow_test/BUILD.gn b/test/unittest/ams_app_workflow_test/BUILD.gn index e645d3d63a2cf1e6acc656f609abbc0b92de9257..58a0b0303e29f8aa4a54196b581f88c4889749f1 100644 --- a/test/unittest/ams_app_workflow_test/BUILD.gn +++ b/test/unittest/ams_app_workflow_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2024 Huawei Device Co., Ltd. +# Copyright (c) 2021-2025 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 @@ -54,6 +54,7 @@ ohos_unittest("AmsWorkFlowTest") { "${ability_runtime_services_path}/common:app_util", "${ability_runtime_services_path}/common:event_report", "${ability_runtime_services_path}/common:perm_verification", + "${ability_runtime_services_path}/common:record_cost_time_util", "${ability_runtime_services_path}/common:res_sched_util", "${ability_runtime_services_path}/common:task_handler_wrap", "${ability_runtime_test_path}/unittest:appmgr_test_source", diff --git a/test/unittest/ams_recent_app_list_test/BUILD.gn b/test/unittest/ams_recent_app_list_test/BUILD.gn index 1c4b9e155f4f5665de8cc582a5ef62c9b652c935..d60d2ca04414d1682d0cd85273824e101a108bf8 100644 --- a/test/unittest/ams_recent_app_list_test/BUILD.gn +++ b/test/unittest/ams_recent_app_list_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2024 Huawei Device Co., Ltd. +# Copyright (c) 2021-2025 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 @@ -66,6 +66,7 @@ ohos_unittest("AmsRecentAppListTest") { "${ability_runtime_services_path}/common:app_util", "${ability_runtime_services_path}/common:event_report", "${ability_runtime_services_path}/common:perm_verification", + "${ability_runtime_services_path}/common:record_cost_time_util", "${ability_runtime_services_path}/common:res_sched_util", "${ability_runtime_services_path}/common:task_handler_wrap", "${ability_runtime_test_path}/unittest:appmgr_test_source", diff --git a/test/unittest/ams_service_app_spawn_client_test/BUILD.gn b/test/unittest/ams_service_app_spawn_client_test/BUILD.gn index e4d21f86ff32298b038ed7ec45e60570e37877e1..0077518b672026a69b6c78526b9563b60adbaf38 100644 --- a/test/unittest/ams_service_app_spawn_client_test/BUILD.gn +++ b/test/unittest/ams_service_app_spawn_client_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2024 Huawei Device Co., Ltd. +# Copyright (c) 2021-2025 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 @@ -69,6 +69,7 @@ ohos_unittest("AmsServiceAppSpawnClientTest") { "${ability_runtime_services_path}/common:app_util", "${ability_runtime_services_path}/common:event_report", "${ability_runtime_services_path}/common:perm_verification", + "${ability_runtime_services_path}/common:record_cost_time_util", "${ability_runtime_services_path}/common:res_sched_util", "${ability_runtime_services_path}/common:task_handler_wrap", "${ability_runtime_test_path}/unittest:appmgr_test_source", diff --git a/test/unittest/ams_service_event_drive_test/BUILD.gn b/test/unittest/ams_service_event_drive_test/BUILD.gn index 6bdbdc23728cacef61efc6affd4de256c3313716..b8c94365e88edcfc81ce2ade37d82cbed0e470e8 100644 --- a/test/unittest/ams_service_event_drive_test/BUILD.gn +++ b/test/unittest/ams_service_event_drive_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2024 Huawei Device Co., Ltd. +# Copyright (c) 2021-2025 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 @@ -69,6 +69,7 @@ ohos_unittest("AmsServiceEventDriveTest") { "${ability_runtime_services_path}/common:app_util", "${ability_runtime_services_path}/common:event_report", "${ability_runtime_services_path}/common:perm_verification", + "${ability_runtime_services_path}/common:record_cost_time_util", "${ability_runtime_services_path}/common:res_sched_util", "${ability_runtime_services_path}/common:task_handler_wrap", "${ability_runtime_test_path}/unittest:appmgr_test_source", diff --git a/test/unittest/ams_service_load_ability_process_test/BUILD.gn b/test/unittest/ams_service_load_ability_process_test/BUILD.gn index 7ee8b3694f2cb1f4f9f31a5338e4a70c5eb02462..8ceefa8055c7d923c4ebc6224413b0caf76bb508 100644 --- a/test/unittest/ams_service_load_ability_process_test/BUILD.gn +++ b/test/unittest/ams_service_load_ability_process_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2024 Huawei Device Co., Ltd. +# Copyright (c) 2021-2025 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 @@ -74,6 +74,7 @@ ohos_unittest("AmsServiceLoadAbilityProcessTest") { "${ability_runtime_services_path}/common:app_util", "${ability_runtime_services_path}/common:event_report", "${ability_runtime_services_path}/common:perm_verification", + "${ability_runtime_services_path}/common:record_cost_time_util", "${ability_runtime_services_path}/common:res_sched_util", "${ability_runtime_services_path}/common:task_handler_wrap", "${ability_runtime_test_path}/unittest:appmgr_test_source", diff --git a/test/unittest/ams_service_startup_test/BUILD.gn b/test/unittest/ams_service_startup_test/BUILD.gn index 5c1ed7303c22b4466ae4a61c0c7480d4ccf30d34..1ba09810280931b979425742af54467ae8f5d225 100644 --- a/test/unittest/ams_service_startup_test/BUILD.gn +++ b/test/unittest/ams_service_startup_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2024 Huawei Device Co., Ltd. +# Copyright (c) 2021-2025 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 @@ -66,6 +66,7 @@ ohos_unittest("AmsServiceStartupTest") { "${ability_runtime_services_path}/common:app_util", "${ability_runtime_services_path}/common:event_report", "${ability_runtime_services_path}/common:perm_verification", + "${ability_runtime_services_path}/common:record_cost_time_util", "${ability_runtime_services_path}/common:res_sched_util", "${ability_runtime_services_path}/common:task_handler_wrap", "${ability_runtime_test_path}/unittest:appmgr_test_source", diff --git a/test/unittest/app_exit_reason_data_manager_new_test/BUILD.gn b/test/unittest/app_exit_reason_data_manager_new_test/BUILD.gn index 5ba95e059265e77e4f3ab1cebf2d7ccb18463ce5..b6c3f8eef32e2271742955e12caec3b6a1e4c808 100644 --- a/test/unittest/app_exit_reason_data_manager_new_test/BUILD.gn +++ b/test/unittest/app_exit_reason_data_manager_new_test/BUILD.gn @@ -42,11 +42,13 @@ ohos_unittest("app_exit_reason_data_manager_new_test") { "${ability_runtime_innerkits_path}/app_manager:app_manager", "${ability_runtime_innerkits_path}/deps_wrapper:ability_deps_wrapper", "${ability_runtime_services_path}/abilitymgr:abilityms", + "${ability_runtime_services_path}/common:record_cost_time_util", ] external_deps = [ "access_token:libaccesstoken_sdk", "c_utils:utils", + "ffrt:libffrt", "googletest:gmock_main", "googletest:gtest_main", "hilog:libhilog", diff --git a/test/unittest/app_exit_reason_data_manager_new_test/app_exit_reason_data_manager_new_test.cpp b/test/unittest/app_exit_reason_data_manager_new_test/app_exit_reason_data_manager_new_test.cpp index 9aff32eaf103d67099e26975aa0560770803ca2c..2b10b38392e9e08ccf5bac9f8aee20fe5f4dc364 100644 --- a/test/unittest/app_exit_reason_data_manager_new_test/app_exit_reason_data_manager_new_test.cpp +++ b/test/unittest/app_exit_reason_data_manager_new_test/app_exit_reason_data_manager_new_test.cpp @@ -38,6 +38,7 @@ const std::string JSON_KEY_SUB_KILL_REASON = "sub_kill_reason"; const std::string JSON_KEY_EXIT_MSG = "exit_msg"; constexpr uint32_t ACCESS_TOKEN_ID = 123; const int SESSION_ID = 111; +constexpr int32_t TIME_SLEEP = 4000; } // namespace class AppExitReasonDataManagerTest : public testing::Test { @@ -355,27 +356,6 @@ HWTEST_F(AppExitReasonDataManagerTest, AppExitReasonDataManager_RecordSignalReas EXPECT_EQ(result, AAFwk::ERR_GET_EXIT_INFO_FAILED); } -/* * - * @tc.name: AppExitReasonDataManager_SetAppExitReason_002 - * @tc.desc: SetAppExitReason - * @tc.type: FUNC - */ -HWTEST_F(AppExitReasonDataManagerTest, AppExitReasonDataManager_SetAppExitReason_002, TestSize.Level1) -{ - std::vector abilityList; - abilityList.push_back(ABILITY_NAME); - AAFwk::ExitReason exitReason = {AAFwk::REASON_JS_ERROR, "Js Error."}; - AppExecFwk::RunningProcessInfo processInfo; - - std::shared_ptr kvStorePtr = std::make_shared(); - kvStorePtr->Put_ = DistributedKv::Status::ERROR; - DelayedSingleton::GetInstance()->kvStorePtr_ = kvStorePtr; - - auto result = DelayedSingleton::GetInstance()->SetAppExitReason( - BUNDLE_NAME, ACCESS_TOKEN_ID, abilityList, exitReason, processInfo, false); - EXPECT_EQ(result, ERR_INVALID_OPERATION); -} - /* * * @tc.name: AppExitReasonDataManager_ConvertReasonFromValue_002 * @tc.desc: ConvertReasonFromValue @@ -527,5 +507,40 @@ HWTEST_F(AppExitReasonDataManagerTest, AppExitReasonDataManager_ConvertAppExitRe auto exitMsg = jsonObject.at(JSON_KEY_EXIT_MSG).get(); EXPECT_EQ(exitMsg, exitReason.exitMsg); } + +/** + * @tc.name: AppExitReasonDataManager_PutAsync_001 + * @tc.desc: PutAsync + * @tc.type: FUNC + */ +HWTEST_F(AppExitReasonDataManagerTest, AppExitReasonDataManager_PutAsync_001, TestSize.Level1) +{ + std::shared_ptr kvStorePtr = std::make_shared(); + DelayedSingleton::GetInstance()->kvStorePtr_ = kvStorePtr; + + DistributedKv::Key key("test_key"); + DistributedKv::Value value("test_value"); + AppExitReasonDataManager::PutAsync(key, value); + usleep(TIME_SLEEP); + EXPECT_EQ(kvStorePtr->putCallTimes_, 1); +} + +/** + * @tc.name: AppExitReasonDataManager_PutAsync_002 + * @tc.desc: PutAsync + * @tc.type: FUNC + */ +HWTEST_F(AppExitReasonDataManagerTest, AppExitReasonDataManager_PutAsync_002, TestSize.Level1) +{ + std::shared_ptr kvStorePtr = std::make_shared(); + kvStorePtr->Put_ = DistributedKv::Status::ERROR; + DelayedSingleton::GetInstance()->kvStorePtr_ = kvStorePtr; + + DistributedKv::Key key("test_key"); + DistributedKv::Value value("test_value"); + AppExitReasonDataManager::PutAsync(key, value); + usleep(TIME_SLEEP); + EXPECT_EQ(kvStorePtr->putCallTimes_, 1); +} } // namespace AbilityRuntime } // namespace OHOS diff --git a/test/unittest/app_exit_reason_data_manager_new_test/mock/include/mock_single_kv_store.h b/test/unittest/app_exit_reason_data_manager_new_test/mock/include/mock_single_kv_store.h index b544c7fe3623a0dc81eafc86b449cc14ff620268..4ea253c691af024bdb92099a80bc2ddfbac8e7a8 100644 --- a/test/unittest/app_exit_reason_data_manager_new_test/mock/include/mock_single_kv_store.h +++ b/test/unittest/app_exit_reason_data_manager_new_test/mock/include/mock_single_kv_store.h @@ -143,6 +143,7 @@ public: DistributedKv::Status Put(const DistributedKv::Key &key, const DistributedKv::Value &value) override { + putCallTimes_++; return Put_; }; @@ -206,6 +207,7 @@ public: DistributedKv::Status GetEntries_ = DistributedKv::Status::SUCCESS; DistributedKv::Status Delete_ = DistributedKv::Status::SUCCESS; DistributedKv::Status Put_ = DistributedKv::Status::SUCCESS; + int32_t putCallTimes_ = 0; DistributedKv::Status Get_ = DistributedKv::Status::SUCCESS; }; } diff --git a/test/unittest/app_exit_reason_data_manager_second_test/BUILD.gn b/test/unittest/app_exit_reason_data_manager_second_test/BUILD.gn index dd01857b0cd4f4c4f0880c3e0b8db262b2433f43..613f79b7725bcab4b5ecaf1443ceb7f2f3c969bf 100644 --- a/test/unittest/app_exit_reason_data_manager_second_test/BUILD.gn +++ b/test/unittest/app_exit_reason_data_manager_second_test/BUILD.gn @@ -42,11 +42,13 @@ ohos_unittest("app_exit_reason_data_manager_second_test") { "${ability_runtime_innerkits_path}/app_manager:app_manager", "${ability_runtime_innerkits_path}/deps_wrapper:ability_deps_wrapper", "${ability_runtime_services_path}/abilitymgr:abilityms", + "${ability_runtime_services_path}/common:record_cost_time_util", ] external_deps = [ "access_token:libaccesstoken_sdk", "c_utils:utils", + "ffrt:libffrt", "googletest:gmock_main", "googletest:gtest_main", "hilog:libhilog", diff --git a/test/unittest/app_exit_reason_data_manager_test/BUILD.gn b/test/unittest/app_exit_reason_data_manager_test/BUILD.gn index 0bf171ef31709d4ed3a0f61912abd4299f24a465..b07301aff62a3029274da5923d3f3276382ee8c5 100755 --- a/test/unittest/app_exit_reason_data_manager_test/BUILD.gn +++ b/test/unittest/app_exit_reason_data_manager_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2023-2024 Huawei Device Co., Ltd. +# Copyright (c) 2023-2025 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 @@ -42,11 +42,13 @@ ohos_unittest("app_exit_reason_data_manager_test") { "${ability_runtime_innerkits_path}/app_manager:app_manager", "${ability_runtime_innerkits_path}/deps_wrapper:ability_deps_wrapper", "${ability_runtime_services_path}/abilitymgr:abilityms", + "${ability_runtime_services_path}/common:record_cost_time_util", ] external_deps = [ "access_token:libaccesstoken_sdk", "c_utils:utils", + "ffrt:libffrt", "googletest:gmock_main", "googletest:gtest_main", "hilog:libhilog", diff --git a/test/unittest/app_mgr_service_event_handler_test/BUILD.gn b/test/unittest/app_mgr_service_event_handler_test/BUILD.gn index b614432777064ae766e4dd8192d4d97cf4ec04c5..f10ab814e2e7a9227e83a473b61b8ca99d567b81 100644 --- a/test/unittest/app_mgr_service_event_handler_test/BUILD.gn +++ b/test/unittest/app_mgr_service_event_handler_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2024 Huawei Device Co., Ltd. +# Copyright (c) 2021-2025 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 @@ -70,6 +70,7 @@ ohos_unittest("AMSEventHandlerTest") { "${ability_runtime_services_path}/common:app_util", "${ability_runtime_services_path}/common:event_report", "${ability_runtime_services_path}/common:perm_verification", + "${ability_runtime_services_path}/common:record_cost_time_util", "${ability_runtime_services_path}/common:res_sched_util", "${ability_runtime_services_path}/common:task_handler_wrap", "${ability_runtime_test_path}/unittest:appmgr_test_source", diff --git a/test/unittest/app_mgr_service_fourth_test/BUILD.gn b/test/unittest/app_mgr_service_fourth_test/BUILD.gn index 033bb463ef386440677f56cda60f77110c2b1f0a..3acb0107ed8c1dcc4961c14d323eb66a78326b68 100644 --- a/test/unittest/app_mgr_service_fourth_test/BUILD.gn +++ b/test/unittest/app_mgr_service_fourth_test/BUILD.gn @@ -61,6 +61,7 @@ ohos_unittest("app_mgr_service_fourth_test") { "${ability_runtime_services_path}/common:res_sched_util", "${ability_runtime_test_path}/moduletest/common/ams:appmgr_mst_source", "${ability_runtime_services_path}/common:app_util", + "${ability_runtime_services_path}/common:record_cost_time_util", "${ability_runtime_services_path}/common:task_handler_wrap", ] diff --git a/test/unittest/app_mgr_service_inner_eighth_test/BUILD.gn b/test/unittest/app_mgr_service_inner_eighth_test/BUILD.gn index 4e733fee508e2c81da2f2de910627d2b7bf59f4a..136073f96b8d6f709f71467ef183ca64947c4ce9 100644 --- a/test/unittest/app_mgr_service_inner_eighth_test/BUILD.gn +++ b/test/unittest/app_mgr_service_inner_eighth_test/BUILD.gn @@ -101,6 +101,7 @@ ohos_unittest("app_mgr_service_inner_eighth_test") { "${ability_runtime_services_path}/appmgr:libappms", "${ability_runtime_services_path}/common:app_util", "${ability_runtime_services_path}/common:event_report", + "${ability_runtime_services_path}/common:record_cost_time_util", "${ability_runtime_services_path}/common:perm_verification", "${ability_runtime_services_path}/common:res_sched_util", "${ability_runtime_services_path}/common:task_handler_wrap", diff --git a/test/unittest/app_mgr_service_inner_fourth_test/BUILD.gn b/test/unittest/app_mgr_service_inner_fourth_test/BUILD.gn index bb6fbcb1d575fec6b38055453deaf43e3b81a948..7f2e88f18266a9295eda80fde09822b15d06bbba 100644 --- a/test/unittest/app_mgr_service_inner_fourth_test/BUILD.gn +++ b/test/unittest/app_mgr_service_inner_fourth_test/BUILD.gn @@ -55,6 +55,7 @@ ohos_unittest("AppMgrServiceInnerFourthTest") { "${ability_runtime_path}/utils/server/startup:startup_util", "${ability_runtime_services_path}/abilitymgr:abilityms", "${ability_runtime_services_path}/appmgr:libappms", + "${ability_runtime_services_path}/common:event_report", "${ability_runtime_services_path}/common:task_handler_wrap", ] diff --git a/test/unittest/app_mgr_service_inner_fourth_test/app_mgr_service_inner_fourth_test.cpp b/test/unittest/app_mgr_service_inner_fourth_test/app_mgr_service_inner_fourth_test.cpp index ed9c41ed68c91606da7cf97f826f56f01118167b..74446103db0971a1ee27ea1d90496f4f6a61ae42 100644 --- a/test/unittest/app_mgr_service_inner_fourth_test/app_mgr_service_inner_fourth_test.cpp +++ b/test/unittest/app_mgr_service_inner_fourth_test/app_mgr_service_inner_fourth_test.cpp @@ -537,5 +537,54 @@ HWTEST_F(AppMgrServiceInnerFourthTest, CreateAppRunningRecord_002, TestSize.Leve EXPECT_NE(record, nullptr); TAG_LOGI(AAFwkTag::TEST, "CreateAppRunningRecord_002 end"); } + +/** + * @tc.name: SetKilledEventInfo_001 + * @tc.Function: SetKilledEventInfo + */ +HWTEST_F(AppMgrServiceInnerFourthTest, SetKilledEventInfo_001, TestSize.Level1) +{ + TAG_LOGI(AAFwkTag::TEST, "SetKilledEventInfo_001 start"); + AAFwk::EventInfo eventInfo; + auto appMgrServiceInner = std::make_shared(); + appMgrServiceInner->SetKilledEventInfo(nullptr, eventInfo); + EXPECT_EQ(eventInfo.pid, -1); + TAG_LOGI(AAFwkTag::TEST, "SetKilledEventInfo_001 end"); +} + +/** + * @tc.name: SetKilledEventInfo_002 + * @tc.Function: SetKilledEventInfo + */ +HWTEST_F(AppMgrServiceInnerFourthTest, SetKilledEventInfo_002, TestSize.Level1) +{ + TAG_LOGI(AAFwkTag::TEST, "SetKilledEventInfo_002 start"); + AAFwk::EventInfo eventInfo; + auto appMgrServiceInner = std::make_shared(); + + auto appRecord = std::make_shared(nullptr, 0, "process_name"); + appMgrServiceInner->SetKilledEventInfo(appRecord, eventInfo); + EXPECT_EQ(eventInfo.processName, "process_name"); + EXPECT_TRUE(eventInfo.bundleName.empty()); + TAG_LOGI(AAFwkTag::TEST, "SetKilledEventInfo_002 end"); +} + +/** + * @tc.name: SetKilledEventInfo_003 + * @tc.Function: SetKilledEventInfo + */ +HWTEST_F(AppMgrServiceInnerFourthTest, SetKilledEventInfo_003, TestSize.Level1) +{ + TAG_LOGI(AAFwkTag::TEST, "SetKilledEventInfo_003 start"); + AAFwk::EventInfo eventInfo; + auto appMgrServiceInner = std::make_shared(); + auto appInfo = std::make_shared(); + appInfo->name = "bundle_name"; + auto appRecord = std::make_shared(appInfo, 0, "process_name"); + appMgrServiceInner->SetKilledEventInfo(appRecord, eventInfo); + EXPECT_EQ(eventInfo.processName, "process_name"); + EXPECT_EQ(eventInfo.bundleName, "bundle_name"); + TAG_LOGI(AAFwkTag::TEST, "SetKilledEventInfo_003 end"); +} } // namespace AppExecFwk } // namespace OHOS diff --git a/test/unittest/app_mgr_service_inner_mock_test/BUILD.gn b/test/unittest/app_mgr_service_inner_mock_test/BUILD.gn index 2ac11e3423a5afa901e5ef8d0c3c2e3170688f15..f7de5c202a705979c3487afd21e006f435a29209 100644 --- a/test/unittest/app_mgr_service_inner_mock_test/BUILD.gn +++ b/test/unittest/app_mgr_service_inner_mock_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2024 Huawei Device Co., Ltd. +# Copyright (c) 2024-2025 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 @@ -43,7 +43,9 @@ ohos_unittest("app_mgr_service_inner_mock_test") { "src/window_manager.cpp", ] - deps = [] + deps = [ + "${ability_runtime_services_path}/common:record_cost_time_util", + ] external_deps = [ "ability_base:want", diff --git a/test/unittest/app_mgr_service_inner_ninth_test/BUILD.gn b/test/unittest/app_mgr_service_inner_ninth_test/BUILD.gn index 23f8d57881a7bf6a7239c22204cab1727da071ff..0ad3739a084add947741d41ba8114a71778b38aa 100644 --- a/test/unittest/app_mgr_service_inner_ninth_test/BUILD.gn +++ b/test/unittest/app_mgr_service_inner_ninth_test/BUILD.gn @@ -100,6 +100,7 @@ ohos_unittest("app_mgr_service_inner_ninth_test") { "${ability_runtime_path}/utils/server/startup:startup_util", "${ability_runtime_services_path}/common:app_util", "${ability_runtime_services_path}/common:event_report", + "${ability_runtime_services_path}/common:record_cost_time_util", "${ability_runtime_services_path}/common:perm_verification", "${ability_runtime_services_path}/common:res_sched_util", "${ability_runtime_services_path}/common:task_handler_wrap", diff --git a/test/unittest/app_mgr_service_inner_seventh_test/BUILD.gn b/test/unittest/app_mgr_service_inner_seventh_test/BUILD.gn index 444e58b6285a1480a2dc3010b0eb36c2225769ce..b5a2dfff8d49a54ae944140dfaec6392041c32a4 100644 --- a/test/unittest/app_mgr_service_inner_seventh_test/BUILD.gn +++ b/test/unittest/app_mgr_service_inner_seventh_test/BUILD.gn @@ -100,6 +100,7 @@ ohos_unittest("app_mgr_service_inner_seventh_test") { "${ability_runtime_services_path}/appmgr:libappms", "${ability_runtime_services_path}/common:app_util", "${ability_runtime_services_path}/common:event_report", + "${ability_runtime_services_path}/common:record_cost_time_util", "${ability_runtime_services_path}/common:perm_verification", "${ability_runtime_services_path}/common:res_sched_util", "${ability_runtime_services_path}/common:task_handler_wrap", diff --git a/test/unittest/app_mgr_service_inner_tenth_test/BUILD.gn b/test/unittest/app_mgr_service_inner_tenth_test/BUILD.gn index a329a9a116480e3c842dbbe319025c91edba43c9..e8bb5daeb20988e74b8d22b65a1f4c320d5e4761 100644 --- a/test/unittest/app_mgr_service_inner_tenth_test/BUILD.gn +++ b/test/unittest/app_mgr_service_inner_tenth_test/BUILD.gn @@ -105,6 +105,7 @@ ohos_unittest("app_mgr_service_inner_tenth_test") { "${ability_runtime_services_path}/appmgr:libappms", "${ability_runtime_services_path}/common:app_util", "${ability_runtime_services_path}/common:event_report", + "${ability_runtime_services_path}/common:record_cost_time_util", "${ability_runtime_services_path}/common:perm_verification", "${ability_runtime_services_path}/common:res_sched_util", "${ability_runtime_services_path}/common:task_handler_wrap", diff --git a/test/unittest/app_running_processes_info_test/BUILD.gn b/test/unittest/app_running_processes_info_test/BUILD.gn index 38ca4ebfca0f92315a2811c0068d58a9dd4fe282..74ff4798688416aae7f58b154a8b98e8759c0f42 100644 --- a/test/unittest/app_running_processes_info_test/BUILD.gn +++ b/test/unittest/app_running_processes_info_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2024 Huawei Device Co., Ltd. +# Copyright (c) 2022-2025 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 @@ -68,6 +68,7 @@ ohos_unittest("AppRunningProcessesInfoTest") { "${ability_runtime_services_path}/common:app_util", "${ability_runtime_services_path}/common:event_report", "${ability_runtime_services_path}/common:perm_verification", + "${ability_runtime_services_path}/common:record_cost_time_util", "${ability_runtime_services_path}/common:res_sched_util", "${ability_runtime_services_path}/common:task_handler_wrap", "${ability_runtime_test_path}/unittest:appmgr_test_source", diff --git a/test/unittest/cache_process_manager_second_test/BUILD.gn b/test/unittest/cache_process_manager_second_test/BUILD.gn index 864735a568b0196d297574424149116bf1557d5a..7e9b86f4e81eb22aa31d365428f8a6a681d1f961 100644 --- a/test/unittest/cache_process_manager_second_test/BUILD.gn +++ b/test/unittest/cache_process_manager_second_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2024 Huawei Device Co., Ltd. +# Copyright (c) 2024-2025 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 @@ -114,6 +114,7 @@ ohos_unittest("cache_process_manager_second_test") { "${ability_runtime_path}/utils/server/startup:startup_util", "${ability_runtime_services_path}/common:app_util", "${ability_runtime_services_path}/common:event_report", + "${ability_runtime_services_path}/common:record_cost_time_util", "${ability_runtime_services_path}/common:perm_verification", "${ability_runtime_services_path}/common:res_sched_util", "${ability_runtime_services_path}/common:task_handler_wrap", diff --git a/test/unittest/cache_process_manager_test/BUILD.gn b/test/unittest/cache_process_manager_test/BUILD.gn index e6175d65d7f78e117a3c2c2314ee80af5418c8b3..a2dc318f64938da07d6eb5db6bf9510477365386 100644 --- a/test/unittest/cache_process_manager_test/BUILD.gn +++ b/test/unittest/cache_process_manager_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2024 Huawei Device Co., Ltd. +# Copyright (c) 2024-2025 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 @@ -45,6 +45,7 @@ ohos_unittest("cache_process_manager_test") { "${ability_runtime_path}/utils/server/startup:startup_util", "${ability_runtime_services_path}/appmgr:libappms", "${ability_runtime_services_path}/common:app_util", + "${ability_runtime_services_path}/common:record_cost_time_util", "${ability_runtime_services_path}/common:res_sched_util", "${ability_runtime_services_path}/common:task_handler_wrap", ] diff --git a/test/unittest/native_child_process_test/BUILD.gn b/test/unittest/native_child_process_test/BUILD.gn index eb3c4ee3b76f6447f1e7966285502994665ecc1f..a5c812b90b0dbb49d0219b1a07a12dd9fbbf318f 100644 --- a/test/unittest/native_child_process_test/BUILD.gn +++ b/test/unittest/native_child_process_test/BUILD.gn @@ -70,6 +70,7 @@ ohos_unittest("native_child_process_test") { "${ability_runtime_services_path}/abilitymgr:abilityms", "${ability_runtime_services_path}/common:app_util", "${ability_runtime_services_path}/common:perm_verification", + "${ability_runtime_services_path}/common:record_cost_time_util", "${ability_runtime_services_path}/common:task_handler_wrap", ] diff --git a/test/unittest/screen_unlock_interceptor_test/BUILD.gn b/test/unittest/screen_unlock_interceptor_test/BUILD.gn index 2cc6a489dc9645bfa0204f1951c4db030f17a629..493164aa5f71aed74f3a860b65e21af07c28c5b7 100644 --- a/test/unittest/screen_unlock_interceptor_test/BUILD.gn +++ b/test/unittest/screen_unlock_interceptor_test/BUILD.gn @@ -51,6 +51,7 @@ ohos_unittest("screen_unlock_interceptor_test") { "${ability_runtime_services_path}/abilitymgr:abilityms", "${ability_runtime_services_path}/common:app_util", "${ability_runtime_services_path}/common:perm_verification", + "${ability_runtime_services_path}/common:record_cost_time_util", ] external_deps = [ diff --git a/test/unittest/status_bar_delegate_manager_test/BUILD.gn b/test/unittest/status_bar_delegate_manager_test/BUILD.gn index afdc0331df7fe04f51dd88351de88714c45e4f0a..5e7e4c26c5f140da3557c7e1909a1aa674143faf 100644 --- a/test/unittest/status_bar_delegate_manager_test/BUILD.gn +++ b/test/unittest/status_bar_delegate_manager_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2023-2024 Huawei Device Co., Ltd. +# Copyright (c) 2023-2025 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 @@ -59,6 +59,7 @@ ohos_unittest("status_bar_delegate_manager_test") { "${ability_runtime_services_path}/abilitymgr:abilityms", "${ability_runtime_services_path}/common:app_util", "${ability_runtime_services_path}/common:perm_verification", + "${ability_runtime_services_path}/common:record_cost_time_util", "${ability_runtime_services_path}/common:task_handler_wrap", ] diff --git a/test/unittest/ui_ability_lifecycle_manager_second_test/BUILD.gn b/test/unittest/ui_ability_lifecycle_manager_second_test/BUILD.gn index 9ddaf1dc4a2ce81927ed186bb68a8b3d47ca3f97..3942668ac8172481b48a98e8c4aadb9f7b6c9fed 100644 --- a/test/unittest/ui_ability_lifecycle_manager_second_test/BUILD.gn +++ b/test/unittest/ui_ability_lifecycle_manager_second_test/BUILD.gn @@ -70,6 +70,7 @@ ohos_unittest("ui_ability_lifecycle_manager_second_test") { "${ability_runtime_services_path}/abilitymgr:abilityms", "${ability_runtime_services_path}/common:app_util", "${ability_runtime_services_path}/common:perm_verification", + "${ability_runtime_services_path}/common:record_cost_time_util", "${ability_runtime_services_path}/common:task_handler_wrap", ] diff --git a/test/unittest/ui_ability_lifecycle_manager_test/BUILD.gn b/test/unittest/ui_ability_lifecycle_manager_test/BUILD.gn index a4b5d12e053056ff9dd87b8ee8a5d0d1f857004e..dafdb7a015ff2e5e1a94a0f17689d763059b717c 100644 --- a/test/unittest/ui_ability_lifecycle_manager_test/BUILD.gn +++ b/test/unittest/ui_ability_lifecycle_manager_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2023-2024 Huawei Device Co., Ltd. +# Copyright (c) 2023-2025 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 @@ -64,6 +64,7 @@ ohos_unittest("ui_ability_lifecycle_manager_test") { "${ability_runtime_services_path}/abilitymgr:abilityms", "${ability_runtime_services_path}/common:app_util", "${ability_runtime_services_path}/common:perm_verification", + "${ability_runtime_services_path}/common:record_cost_time_util", "${ability_runtime_services_path}/common:task_handler_wrap", ] diff --git a/test/unittest/ui_ability_lifecycle_manager_third_test/BUILD.gn b/test/unittest/ui_ability_lifecycle_manager_third_test/BUILD.gn index b2c9a7a5ed05f5da8d30823b464cb08e4ba0f0be..7268d7e63def4c4d321946494b75d4c7dbe40322 100644 --- a/test/unittest/ui_ability_lifecycle_manager_third_test/BUILD.gn +++ b/test/unittest/ui_ability_lifecycle_manager_third_test/BUILD.gn @@ -71,6 +71,7 @@ ohos_unittest("ui_ability_lifecycle_manager_third_test") { "${ability_runtime_services_path}/abilitymgr:abilityms", "${ability_runtime_services_path}/common:app_util", "${ability_runtime_services_path}/common:perm_verification", + "${ability_runtime_services_path}/common:record_cost_time_util", "${ability_runtime_services_path}/common:task_handler_wrap", ]