# 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 # # 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("//build/test.gni") import("//foundation/ability/ability_runtime/ability_runtime.gni") module_output_path = "ability_runtime/ability_runtime/appmgrservice" ohos_unittest("cache_process_manager_second_test") { sanitize = { cfi = true cfi_cross_dso = true debug = false blocklist = "../../cfi_blocklist.txt" } branch_protector_ret = "pac_ret" module_out_path = module_output_path include_dirs = [ "mock/include", "${ability_runtime_services_path}/appmgr/include", "${ability_runtime_services_path}/appmgr/include/utils", "${ability_runtime_innerkits_path}/ability_manager/include", "${ability_runtime_services_path}/common/include", "${ability_runtime_path}/tools/aa/include", "${ability_runtime_path}/utils/global/time/include", "${ability_runtime_path}/interfaces/kits/native/appkit/ability_bundle_manager_helper", "${ability_runtime_utils_path}/global/constant", ] sources = [ "${ability_runtime_path}/tools/aa/src/shell_command_result.cpp", "${ability_runtime_path}/tools/aa/src/test_observer_proxy.cpp", "${ability_runtime_services_path}/appmgr/src/ability_running_record.cpp", "${ability_runtime_services_path}/appmgr/src/advanced_security_mode_manager.cpp", "${ability_runtime_services_path}/appmgr/src/ams_mgr_scheduler.cpp", "${ability_runtime_services_path}/appmgr/src/app_config_data_manager.cpp", "${ability_runtime_services_path}/appmgr/src/app_death_recipient.cpp", "${ability_runtime_services_path}/appmgr/src/app_debug_manager.cpp", "${ability_runtime_services_path}/appmgr/src/app_lifecycle_deal.cpp", "${ability_runtime_services_path}/appmgr/src/app_mgr_event.cpp", "${ability_runtime_services_path}/appmgr/src/app_mgr_service.cpp", "${ability_runtime_services_path}/appmgr/src/app_mgr_service_event_handler.cpp", "${ability_runtime_services_path}/appmgr/src/app_mgr_service_inner.cpp", "${ability_runtime_services_path}/appmgr/src/app_native_spawn_manager.cpp", "${ability_runtime_services_path}/appmgr/src/app_preloader.cpp", "${ability_runtime_services_path}/appmgr/src/app_running_manager.cpp", "${ability_runtime_services_path}/appmgr/src/app_running_status_module.cpp", "${ability_runtime_services_path}/appmgr/src/app_spawn_client.cpp", "${ability_runtime_services_path}/appmgr/src/app_state_observer_manager.cpp", "${ability_runtime_services_path}/appmgr/src/cache_process_manager.cpp", "${ability_runtime_services_path}/appmgr/src/exit_resident_process_manager.cpp", "${ability_runtime_services_path}/appmgr/src/killing_process_manager.cpp", "${ability_runtime_services_path}/appmgr/src/modal_system_app_freeze_uiextension.cpp", "${ability_runtime_services_path}/appmgr/src/module_running_record.cpp", "${ability_runtime_services_path}/appmgr/src/multi_user_config_mgr.cpp", "${ability_runtime_services_path}/appmgr/src/quick_fix_callback_with_record.cpp", "${ability_runtime_services_path}/appmgr/src/remote_client_manager.cpp", "${ability_runtime_services_path}/appmgr/src/render_record.cpp", "${ability_runtime_services_path}/appmgr/src/render_state_observer_manager.cpp", "${ability_runtime_services_path}/appmgr/src/user_record_manager.cpp", "${ability_runtime_services_path}/appmgr/src/window_focus_changed_listener.cpp", "${ability_runtime_services_path}/appmgr/src/window_pid_visibility_changed_listener.cpp", "${ability_runtime_services_path}/appmgr/src/window_visibility_changed_listener.cpp", "cache_process_manager_second_test.cpp", "mock/src/moc_res_sched_util.cpp", "mock/src/mock_app_running_record.cpp", "mock/src/mock_my_status.cpp", ] defines = [ "AMS_LOG_TAG = \"AppMgrService\"" ] defines += [ "AMS_LOG_DOMAIN = 0xD001303" ] defines += [ "OHOS_ACCOUNT_ENABLED" ] defines += [ "INCLUDE_ZURI" ] if (product_name != "ohcore") { defines += [ "APP_MGR_SERVICE_APPMS" ] } if (ability_command_for_test) { defines += [ "ABILITY_COMMAND_FOR_TEST" ] } if (ability_fault_and_exit_test) { defines += [ "ABILITY_FAULT_AND_EXIT_TEST" ] } if (ability_runtime_check_internet_permission) { defines += [ "ABILITY_PLATFORM_CHECK_PERMISSION" ] } configs = [ "${ability_runtime_services_path}/appmgr:appmgr_config" ] cflags = [] if (target_cpu == "arm") { cflags += [ "-DBINDER_IPC_32BIT" ] } deps = [ "${ability_runtime_innerkits_path}/ability_manager:ability_manager", "${ability_runtime_innerkits_path}/app_manager:app_manager", "${ability_runtime_innerkits_path}/deps_wrapper:ability_deps_wrapper", "${ability_runtime_native_path}/appkit:appkit_manager_helper", "${ability_runtime_path}/utils/global/freeze:freeze_util", "${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", ] external_deps = [ "ability_base:base", "ability_base:configuration", "ability_base:want", "ability_base:zuri", "access_token:libaccesstoken_sdk", "appspawn:appspawn_client", "bundle_framework:appexecfwk_base", "bundle_framework:appexecfwk_core", "c_utils:utils", "common_event_service:cesfwk_core", "common_event_service:cesfwk_innerkits", "eventhandler:libeventhandler", "ffrt:libffrt", "googletest:gmock_main", "googletest:gtest_main", "hicollie:libhicollie", "hilog:libhilog", "hisysevent:libhisysevent", "hitrace:hitrace_meter", "init:libbeget_proxy", "init:libbegetutil", "ipc:ipc_core", "json:nlohmann_json_static", "kv_store:distributeddata_inner", "memmgr:memmgrclient", "memory_utils:libmeminfo", "os_account:libaccountkits", "os_account:os_account_innerkits", "resource_schedule_service:ressched_client", "safwk:system_ability_fwk", "samgr:samgr_proxy", "window_manager:session_manager_lite", ] public_external_deps = [ "kv_store:distributeddata_mgr" ] if (product_name != "ohcore") { external_deps += [ "netmanager_base:net_conn_manager_if" ] } if (ability_runtime_feature_sandboxmanager) { external_deps += [ "sandbox_manager:libsandbox_manager_sdk" ] defines += [ "ABILITY_RUNTIME_FEATURE_SANDBOXMANAGER" ] } if (ability_runtime_child_process) { defines += [ "SUPPORT_CHILD_PROCESS" ] sources += [ "${ability_runtime_services_path}/appmgr/src/child_process_record.cpp", ] } if (ability_runtime_graphics) { defines += [ "SUPPORT_GRAPHICS", "SUPPORT_SCREEN", ] deps += [] external_deps += [ "i18n:i18n_sa_client", "i18n:intl_util", "window_manager:libwm", "window_manager:libwsutils", ] } if (ability_runtime_upms) { defines += [ "SUPPORT_UPMS" ] deps += [ "${ability_runtime_innerkits_path}/uri_permission:uri_permission_mgr", ] } cflags_cc = [] if (os_dlp_part_enabled) { cflags_cc += [ "-DWITH_DLP" ] } if (background_task_mgr_continuous_task_enable) { defines += [ "BGTASKMGR_CONTINUOUS_TASK_ENABLE" ] } if (is_asan || asan_detector) { defines += [ "SUPPORT_ASAN" ] } if (ability_runtime_app_no_response_dialog) { defines += [ "APP_NO_RESPONSE_DIALOG" ] } if (app_mgr_service_hicollie_enable) { defines += [ "APP_MGR_SERVICE_HICOLLIE_ENABLE" ] } cflags += [ "-DAPP_NO_RESPONSE_BUNDLENAME=\"${ability_runtime_app_no_response_bundlename}\"" ] } group("unittest") { testonly = true deps = [ ":cache_process_manager_second_test" ] }