diff --git a/agent_runtime_framework/frameworks/js/napi/agent_manager/BUILD.gn b/agent_runtime_framework/frameworks/js/napi/agent_manager/BUILD.gn index cbff06c0ce..5fa70ef014 100644 --- a/agent_runtime_framework/frameworks/js/napi/agent_manager/BUILD.gn +++ b/agent_runtime_framework/frameworks/js/napi/agent_manager/BUILD.gn @@ -51,6 +51,8 @@ ohos_shared_library("js_agent_manager_utils") { } ohos_shared_library("agentmanager_napi") { + branch_protector_ret = "pac_ret" + sanitize = { cfi = true cfi_cross_dso = true diff --git a/agent_runtime_framework/interfaces/inner_api/BUILD.gn b/agent_runtime_framework/interfaces/inner_api/BUILD.gn index ad91963178..258ae50539 100644 --- a/agent_runtime_framework/interfaces/inner_api/BUILD.gn +++ b/agent_runtime_framework/interfaces/inner_api/BUILD.gn @@ -16,6 +16,8 @@ import("//build/ohos.gni") import("//foundation/ability/ability_runtime/ability_runtime.gni") ohos_shared_library("agent_fwk") { + branch_protector_ret = "pac_ret" + sanitize = { cfi = true cfi_cross_dso = true @@ -50,6 +52,8 @@ ohos_shared_library("agent_fwk") { } ohos_shared_library("agent_connection_manager") { + branch_protector_ret = "pac_ret" + sanitize = { cfi = true cfi_cross_dso = true @@ -114,6 +118,8 @@ config("agent_manager_config") { } ohos_shared_library("agent_manager") { + branch_protector_ret = "pac_ret" + sanitize = { cfi = true cfi_cross_dso = true diff --git a/cli_tool_framework/frameworks/js/napi/cli_tool_manager/BUILD.gn b/cli_tool_framework/frameworks/js/napi/cli_tool_manager/BUILD.gn index 59ab20e3b1..6e5c7d874e 100644 --- a/cli_tool_framework/frameworks/js/napi/cli_tool_manager/BUILD.gn +++ b/cli_tool_framework/frameworks/js/napi/cli_tool_manager/BUILD.gn @@ -20,6 +20,7 @@ ohos_source_set("cli_manager_error_utils_src") { cfi_cross_dso = true debug = false } + branch_protector_ret = "pac_ret" include_dirs = [ "include", @@ -51,6 +52,7 @@ ohos_source_set("js_cli_event_handler_manager_src") { cfi_cross_dso = true debug = false } + branch_protector_ret = "pac_ret" include_dirs = [ "include", @@ -75,6 +77,7 @@ ohos_shared_library("climanager_napi") { cfi_cross_dso = true debug = false } + branch_protector_ret = "pac_ret" include_dirs = [ "include", diff --git a/cli_tool_framework/frameworks/js/napi/function_manager/BUILD.gn b/cli_tool_framework/frameworks/js/napi/function_manager/BUILD.gn index e1683ca8ff..286df9355a 100644 --- a/cli_tool_framework/frameworks/js/napi/function_manager/BUILD.gn +++ b/cli_tool_framework/frameworks/js/napi/function_manager/BUILD.gn @@ -20,6 +20,7 @@ ohos_shared_library("functionmanager_napi") { cfi_cross_dso = true debug = false } + branch_protector_ret = "pac_ret" include_dirs = [ "include", diff --git a/cli_tool_framework/frameworks/js/napi/script_manager/BUILD.gn b/cli_tool_framework/frameworks/js/napi/script_manager/BUILD.gn index fc8313a871..6a5d2ab004 100644 --- a/cli_tool_framework/frameworks/js/napi/script_manager/BUILD.gn +++ b/cli_tool_framework/frameworks/js/napi/script_manager/BUILD.gn @@ -20,6 +20,7 @@ ohos_shared_library("scriptmanager_napi") { cfi_cross_dso = true debug = false } + branch_protector_ret = "pac_ret" include_dirs = [ "include", diff --git a/cli_tool_framework/interfaces/cli_tool/BUILD.gn b/cli_tool_framework/interfaces/cli_tool/BUILD.gn index c94c83b666..b939ea08c5 100644 --- a/cli_tool_framework/interfaces/cli_tool/BUILD.gn +++ b/cli_tool_framework/interfaces/cli_tool/BUILD.gn @@ -47,6 +47,7 @@ ohos_shared_library("cli_tool_client") { cfi_cross_dso = true debug = false } + branch_protector_ret = "pac_ret" public_configs = [ ":cli_tool_client_config" ] diff --git a/cli_tool_framework/interfaces/function/BUILD.gn b/cli_tool_framework/interfaces/function/BUILD.gn index cbc9aa5c20..4f42104c76 100644 --- a/cli_tool_framework/interfaces/function/BUILD.gn +++ b/cli_tool_framework/interfaces/function/BUILD.gn @@ -29,6 +29,7 @@ ohos_source_set("function_info") { cfi_cross_dso = true debug = false } + branch_protector_ret = "pac_ret" public_configs = [ ":function_info_config" ] diff --git a/cli_tool_framework/services/climgr/BUILD.gn b/cli_tool_framework/services/climgr/BUILD.gn index c1778e87c8..1da8c70bea 100644 --- a/cli_tool_framework/services/climgr/BUILD.gn +++ b/cli_tool_framework/services/climgr/BUILD.gn @@ -36,6 +36,7 @@ ohos_shared_library("climgr") { cfi_cross_dso = true debug = false } + branch_protector_ret = "pac_ret" shlib_type = "sa" configs = [ ":clisa_config" ] include_dirs = [ "${ability_runtime_path}/interfaces/kits/native/appkit/ability_bundle_manager_helper" ] diff --git a/cli_tool_framework/services/common/BUILD.gn b/cli_tool_framework/services/common/BUILD.gn index 661e18fc83..06ac08ea18 100644 --- a/cli_tool_framework/services/common/BUILD.gn +++ b/cli_tool_framework/services/common/BUILD.gn @@ -20,6 +20,7 @@ ohos_source_set("cli_common") { cfi_cross_dso = true debug = false } + branch_protector_ret = "pac_ret" include_dirs = [ "include", diff --git a/cli_tool_framework/test/unittest/cli_event_reply_manager_test/BUILD.gn b/cli_tool_framework/test/unittest/cli_event_reply_manager_test/BUILD.gn index 4788d7c946..556690bf7e 100644 --- a/cli_tool_framework/test/unittest/cli_event_reply_manager_test/BUILD.gn +++ b/cli_tool_framework/test/unittest/cli_event_reply_manager_test/BUILD.gn @@ -17,6 +17,13 @@ import("//foundation/ability/ability_runtime/ability_runtime.gni") module_output_path = "ability_runtime/ability_runtime/clitool" ohos_unittest("cli_event_reply_manager_test") { + branch_protector_ret = "pac_ret" + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + } + module_out_path = module_output_path include_dirs = [ diff --git a/cli_tool_framework/test/unittest/cli_event_report_test/BUILD.gn b/cli_tool_framework/test/unittest/cli_event_report_test/BUILD.gn index 6f8adc27e9..956671caf8 100644 --- a/cli_tool_framework/test/unittest/cli_event_report_test/BUILD.gn +++ b/cli_tool_framework/test/unittest/cli_event_report_test/BUILD.gn @@ -1,57 +1,62 @@ -# Copyright (c) 2026 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/clitool" - -ohos_unittest("cli_event_report_test") { - module_out_path = module_output_path - - sources = [ - "cli_event_report_test.cpp", - "${cli_tool_framework_path}/services/common/src/cli_event_report.cpp", - ] - - include_dirs = [ - "${ability_runtime_services_path}/common/include", - "${ability_runtime_innerkits_path}/ability_manager/include/appmgr", - "${cli_tool_framework_path}/services/common/include", - "${cli_tool_framework_path}/interfaces/cli_tool/include", - ] - - deps = [ - "${ability_runtime_innerkits_path}/ability_manager:ability_manager", - "${ability_runtime_services_path}/common:hisysevent_report_static", - ] - - external_deps = [ - "ability_base:want", - "access_token:libaccesstoken_sdk", - "bundle_framework:appexecfwk_base", - "c_utils:utils", - "googletest:gmock_main", - "googletest:gtest_main", - "hilog:libhilog", - "hisysevent:libhisysevent", - "ipc:ipc_core", - ] - - defines = [ "AMS_LOG_TAG = \"CliEventReportTest\"" ] -} - -group("unittest") { - testonly = true - deps = [ ":cli_event_report_test" ] -} \ No newline at end of file +# Copyright (c) 2026 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/clitool" + +ohos_unittest("cli_event_report_test") { + module_out_path = module_output_path + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + } + + sources = [ + "cli_event_report_test.cpp", + "${cli_tool_framework_path}/services/common/src/cli_event_report.cpp", + ] + + include_dirs = [ + "${ability_runtime_services_path}/common/include", + "${ability_runtime_innerkits_path}/ability_manager/include/appmgr", + "${cli_tool_framework_path}/services/common/include", + "${cli_tool_framework_path}/interfaces/cli_tool/include", + ] + + deps = [ + "${ability_runtime_innerkits_path}/ability_manager:ability_manager", + "${ability_runtime_services_path}/common:hisysevent_report_static", + ] + + external_deps = [ + "ability_base:want", + "access_token:libaccesstoken_sdk", + "bundle_framework:appexecfwk_base", + "c_utils:utils", + "googletest:gmock_main", + "googletest:gtest_main", + "hilog:libhilog", + "hisysevent:libhisysevent", + "ipc:ipc_core", + ] + + defines = [ "AMS_LOG_TAG = \"CliEventReportTest\"" ] +} + +group("unittest") { + testonly = true + deps = [ ":cli_event_report_test" ] +} diff --git a/cli_tool_framework/test/unittest/cli_tool_mgr_client_test/BUILD.gn b/cli_tool_framework/test/unittest/cli_tool_mgr_client_test/BUILD.gn index da137fd5f4..74fac0316a 100644 --- a/cli_tool_framework/test/unittest/cli_tool_mgr_client_test/BUILD.gn +++ b/cli_tool_framework/test/unittest/cli_tool_mgr_client_test/BUILD.gn @@ -17,6 +17,13 @@ import("//foundation/ability/ability_runtime/ability_runtime.gni") module_output_path = "ability_runtime/ability_runtime/clitool" ohos_unittest("cli_tool_mgr_client_test") { + branch_protector_ret = "pac_ret" + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + } + module_out_path = module_output_path include_dirs = [ diff --git a/cli_tool_framework/test/unittest/cli_tool_mgr_service_test/BUILD.gn b/cli_tool_framework/test/unittest/cli_tool_mgr_service_test/BUILD.gn index 2c05a92c4c..934976f320 100644 --- a/cli_tool_framework/test/unittest/cli_tool_mgr_service_test/BUILD.gn +++ b/cli_tool_framework/test/unittest/cli_tool_mgr_service_test/BUILD.gn @@ -17,6 +17,13 @@ import("//foundation/ability/ability_runtime/ability_runtime.gni") module_output_path = "ability_runtime/ability_runtime/clitool" ohos_unittest("cli_tool_mgr_service_test") { + branch_protector_ret = "pac_ret" + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + } + module_out_path = module_output_path include_dirs = [ diff --git a/cli_tool_framework/test/unittest/function_info_test/BUILD.gn b/cli_tool_framework/test/unittest/function_info_test/BUILD.gn index 3c2d33517e..e41846f295 100644 --- a/cli_tool_framework/test/unittest/function_info_test/BUILD.gn +++ b/cli_tool_framework/test/unittest/function_info_test/BUILD.gn @@ -17,6 +17,13 @@ import("//foundation/ability/ability_runtime/ability_runtime.gni") module_output_path = "ability_runtime/ability_runtime/clitool" ohos_unittest("function_info_test") { + branch_protector_ret = "pac_ret" + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + } + module_out_path = module_output_path include_dirs = [ "${cli_tool_framework_path}/interfaces/function/include" ] diff --git a/cli_tool_framework/test/unittest/invoke_function_executor_test/BUILD.gn b/cli_tool_framework/test/unittest/invoke_function_executor_test/BUILD.gn index 906701066f..89c527b372 100644 --- a/cli_tool_framework/test/unittest/invoke_function_executor_test/BUILD.gn +++ b/cli_tool_framework/test/unittest/invoke_function_executor_test/BUILD.gn @@ -17,6 +17,13 @@ import("//foundation/ability/ability_runtime/ability_runtime.gni") module_output_path = "ability_runtime/ability_runtime/clitool" ohos_unittest("invoke_function_executor_test") { + branch_protector_ret = "pac_ret" + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + } + module_out_path = module_output_path # "mock/include" MUST come before the real interfaces/cli_tool/include so the diff --git a/cli_tool_framework/test/unittest/process_manager_test/BUILD.gn b/cli_tool_framework/test/unittest/process_manager_test/BUILD.gn index ddcc7885f5..575356a613 100644 --- a/cli_tool_framework/test/unittest/process_manager_test/BUILD.gn +++ b/cli_tool_framework/test/unittest/process_manager_test/BUILD.gn @@ -17,6 +17,13 @@ import("//foundation/ability/ability_runtime/ability_runtime.gni") module_output_path = "ability_runtime/ability_runtime/clitool" ohos_unittest("process_manager_test") { + branch_protector_ret = "pac_ret" + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + } + module_out_path = module_output_path include_dirs = [ diff --git a/frameworks/cj/ffi/ark_interop_helper/BUILD.gn b/frameworks/cj/ffi/ark_interop_helper/BUILD.gn index 3777db8e5d..f55168ee28 100644 --- a/frameworks/cj/ffi/ark_interop_helper/BUILD.gn +++ b/frameworks/cj/ffi/ark_interop_helper/BUILD.gn @@ -15,6 +15,8 @@ import("//build/ohos.gni") import("//foundation/ability/ability_runtime/ability_runtime.gni") ohos_shared_library("ark_interop_helper_ffi") { + branch_protector_ret = "pac_ret" + defines = [] sources = [ "ark_interop_helper.cpp" ] diff --git a/frameworks/ets/ani/share_extension_ability/BUILD.gn b/frameworks/ets/ani/share_extension_ability/BUILD.gn index 49e53ff9ff..6ff78a76a3 100644 --- a/frameworks/ets/ani/share_extension_ability/BUILD.gn +++ b/frameworks/ets/ani/share_extension_ability/BUILD.gn @@ -16,6 +16,8 @@ import("//build/ohos.gni") import("//foundation/ability/ability_runtime/ability_runtime.gni") ohos_shared_library("share_extension_ani") { + branch_protector_ret = "pac_ret" + sanitize = { cfi = true cfi_cross_dso = true diff --git a/frameworks/js/napi/abilityDataUriUtils/BUILD.gn b/frameworks/js/napi/abilityDataUriUtils/BUILD.gn index b0a1bd7857..39b7c339f9 100644 --- a/frameworks/js/napi/abilityDataUriUtils/BUILD.gn +++ b/frameworks/js/napi/abilityDataUriUtils/BUILD.gn @@ -35,6 +35,8 @@ gen_js_obj("ability_data_uri_utils_abc") { } ohos_shared_library("datauriutils") { + branch_protector_ret = "pac_ret" + sources = [ "ability_data_uri_utils_module.cpp" ] deps = [ diff --git a/frameworks/js/napi/ability_auto_startup_callback/BUILD.gn b/frameworks/js/napi/ability_auto_startup_callback/BUILD.gn index 876ebd20ad..0d7ff03df7 100644 --- a/frameworks/js/napi/ability_auto_startup_callback/BUILD.gn +++ b/frameworks/js/napi/ability_auto_startup_callback/BUILD.gn @@ -15,6 +15,8 @@ import("//build/ohos.gni") import("//foundation/ability/ability_runtime/ability_runtime.gni") ohos_shared_library("autostartupcallback") { + branch_protector_ret = "pac_ret" + include_dirs = [ "./", "${ability_runtime_napi_path}/inner/napi_common/", diff --git a/frameworks/js/napi/ability_auto_startup_manager/BUILD.gn b/frameworks/js/napi/ability_auto_startup_manager/BUILD.gn index d00e1a890e..833c072e98 100644 --- a/frameworks/js/napi/ability_auto_startup_manager/BUILD.gn +++ b/frameworks/js/napi/ability_auto_startup_manager/BUILD.gn @@ -15,6 +15,8 @@ import("//build/ohos.gni") import("//foundation/ability/ability_runtime/ability_runtime.gni") ohos_shared_library("autostartupmanager") { + branch_protector_ret = "pac_ret" + include_dirs = [ "${ability_runtime_napi_path}/ability_auto_startup_callback", "${ability_runtime_services_path}/common/include", diff --git a/frameworks/js/napi/ability_constant/BUILD.gn b/frameworks/js/napi/ability_constant/BUILD.gn index 8afff20fd0..b0357a6bbe 100644 --- a/frameworks/js/napi/ability_constant/BUILD.gn +++ b/frameworks/js/napi/ability_constant/BUILD.gn @@ -15,6 +15,8 @@ import("//build/ohos.gni") import("//foundation/ability/ability_runtime/ability_runtime.gni") ohos_shared_library("abilityconstant_napi") { + branch_protector_ret = "pac_ret" + include_dirs = [ "${ability_runtime_innerkits_path}/ability_manager/include", "${ability_runtime_services_path}/common/include", @@ -41,6 +43,8 @@ ohos_shared_library("abilityconstant_napi") { } ohos_shared_library("abilityconstant") { + branch_protector_ret = "pac_ret" + include_dirs = [ "${ability_runtime_innerkits_path}/ability_manager/include", "${ability_runtime_services_path}/common/include", diff --git a/frameworks/js/napi/ability_context/BUILD.gn b/frameworks/js/napi/ability_context/BUILD.gn index 7ebbdffb5c..a21e5d9cef 100644 --- a/frameworks/js/napi/ability_context/BUILD.gn +++ b/frameworks/js/napi/ability_context/BUILD.gn @@ -35,6 +35,8 @@ gen_js_obj("ability_context_abc") { } ohos_shared_library("abilitycontext_napi") { + branch_protector_ret = "pac_ret" + sources = [ "ability_context_module.cpp" ] cflags = [ diff --git a/frameworks/js/napi/ability_vertical_panel/BUILD.gn b/frameworks/js/napi/ability_vertical_panel/BUILD.gn index 2a8cde4aff..bfefa583c4 100644 --- a/frameworks/js/napi/ability_vertical_panel/BUILD.gn +++ b/frameworks/js/napi/ability_vertical_panel/BUILD.gn @@ -15,6 +15,8 @@ import("//build/ohos.gni") import("//foundation/ability/ability_runtime/ability_runtime.gni") ohos_shared_library("verticalpanelmanager_napi") { + branch_protector_ret = "pac_ret" + sanitize = { integer_overflow = true ubsan = true diff --git a/frameworks/js/napi/action_extension_ability/BUILD.gn b/frameworks/js/napi/action_extension_ability/BUILD.gn index 0553ca9e05..a08803e43c 100755 --- a/frameworks/js/napi/action_extension_ability/BUILD.gn +++ b/frameworks/js/napi/action_extension_ability/BUILD.gn @@ -35,6 +35,8 @@ gen_js_obj("action_extension_ability_abc") { } ohos_shared_library("actionextensionability_napi") { + branch_protector_ret = "pac_ret" + sources = [ "action_extension_ability_module.cpp" ] deps = [ diff --git a/frameworks/js/napi/app/ability_lifecycle_callback/BUILD.gn b/frameworks/js/napi/app/ability_lifecycle_callback/BUILD.gn index b06d092825..428015ec84 100644 --- a/frameworks/js/napi/app/ability_lifecycle_callback/BUILD.gn +++ b/frameworks/js/napi/app/ability_lifecycle_callback/BUILD.gn @@ -35,6 +35,8 @@ gen_js_obj("ability_lifecycle_callback_abc") { } ohos_shared_library("abilitylifecyclecallback") { + branch_protector_ret = "pac_ret" + sources = [ "ability_lifecycle_callback_module.cpp" ] deps = [ diff --git a/frameworks/js/napi/app/ability_stage/BUILD.gn b/frameworks/js/napi/app/ability_stage/BUILD.gn index 8379ecdda4..3f6e52046c 100644 --- a/frameworks/js/napi/app/ability_stage/BUILD.gn +++ b/frameworks/js/napi/app/ability_stage/BUILD.gn @@ -35,6 +35,8 @@ gen_js_obj("ability_stage_abc") { } ohos_shared_library("abilitystage") { + branch_protector_ret = "pac_ret" + sources = [ "ability_stage_module.cpp" ] deps = [ @@ -52,6 +54,8 @@ ohos_shared_library("abilitystage") { } ohos_shared_library("abilitystage_napi") { + branch_protector_ret = "pac_ret" + sources = [ "ability_stage_napi_module.cpp" ] deps = [ diff --git a/frameworks/js/napi/app/ability_stage_context/BUILD.gn b/frameworks/js/napi/app/ability_stage_context/BUILD.gn index c0508957bb..a2dc517c46 100644 --- a/frameworks/js/napi/app/ability_stage_context/BUILD.gn +++ b/frameworks/js/napi/app/ability_stage_context/BUILD.gn @@ -35,6 +35,8 @@ gen_js_obj("ability_stage_context_abc") { } ohos_shared_library("abilitystagecontext_napi") { + branch_protector_ret = "pac_ret" + sources = [ "ability_stage_context_module.cpp" ] deps = [ diff --git a/frameworks/js/napi/app/app_manager/BUILD.gn b/frameworks/js/napi/app/app_manager/BUILD.gn index bb5de575f8..7887c14562 100644 --- a/frameworks/js/napi/app/app_manager/BUILD.gn +++ b/frameworks/js/napi/app/app_manager/BUILD.gn @@ -15,6 +15,8 @@ import("//build/ohos.gni") import("//foundation/ability/ability_runtime/ability_runtime.gni") ohos_shared_library("appmanager_napi") { + branch_protector_ret = "pac_ret" + include_dirs = [] if (ability_runtime_graphics) { diff --git a/frameworks/js/napi/app/application_context/BUILD.gn b/frameworks/js/napi/app/application_context/BUILD.gn index 279eeab424..a816279e09 100644 --- a/frameworks/js/napi/app/application_context/BUILD.gn +++ b/frameworks/js/napi/app/application_context/BUILD.gn @@ -35,6 +35,8 @@ gen_js_obj("application_context_abc") { } ohos_shared_library("applicationcontext_napi") { + branch_protector_ret = "pac_ret" + sources = [ "application_context_module.cpp" ] cflags = [ diff --git a/frameworks/js/napi/app/application_state_change_callback/BUILD.gn b/frameworks/js/napi/app/application_state_change_callback/BUILD.gn index 39fc58e92a..49c60b079a 100644 --- a/frameworks/js/napi/app/application_state_change_callback/BUILD.gn +++ b/frameworks/js/napi/app/application_state_change_callback/BUILD.gn @@ -37,6 +37,8 @@ gen_js_obj("application_state_change_callback_abc") { } ohos_shared_library("applicationstatechangecallback") { + branch_protector_ret = "pac_ret" + sources = [ "application_state_change_callback_module.cpp" ] deps = [ diff --git a/frameworks/js/napi/app/context/BUILD.gn b/frameworks/js/napi/app/context/BUILD.gn index 831af0e667..5291777e2c 100644 --- a/frameworks/js/napi/app/context/BUILD.gn +++ b/frameworks/js/napi/app/context/BUILD.gn @@ -34,6 +34,8 @@ gen_js_obj("context_abc") { } ohos_shared_library("context_napi") { + branch_protector_ret = "pac_ret" + sources = [ "context_module.cpp" ] cflags = [ diff --git a/frameworks/js/napi/app/environment_callback/BUILD.gn b/frameworks/js/napi/app/environment_callback/BUILD.gn index 4aefb70ebe..8df46538cb 100644 --- a/frameworks/js/napi/app/environment_callback/BUILD.gn +++ b/frameworks/js/napi/app/environment_callback/BUILD.gn @@ -35,6 +35,8 @@ gen_js_obj("environment_callback_abc") { } ohos_shared_library("environmentcallback") { + branch_protector_ret = "pac_ret" + sources = [ "environment_callback_module.cpp" ] deps = [ diff --git a/frameworks/js/napi/app/js_app_manager/BUILD.gn b/frameworks/js/napi/app/js_app_manager/BUILD.gn index 795a168a38..e1b3b6a36f 100644 --- a/frameworks/js/napi/app/js_app_manager/BUILD.gn +++ b/frameworks/js/napi/app/js_app_manager/BUILD.gn @@ -15,6 +15,8 @@ import("//build/ohos.gni") import("//foundation/ability/ability_runtime/ability_runtime.gni") ohos_shared_library("appmanager") { + branch_protector_ret = "pac_ret" + include_dirs = ["${ability_runtime_utils_path}/global/common/include"] if (ability_runtime_graphics) { diff --git a/frameworks/js/napi/app/test_runner/BUILD.gn b/frameworks/js/napi/app/test_runner/BUILD.gn index 4d9da6349c..f6e6457e4a 100644 --- a/frameworks/js/napi/app/test_runner/BUILD.gn +++ b/frameworks/js/napi/app/test_runner/BUILD.gn @@ -35,6 +35,8 @@ gen_js_obj("test_runner_abc") { } ohos_shared_library("testrunner_napi") { + branch_protector_ret = "pac_ret" + sources = [ "test_runner_module.cpp" ] deps = [ diff --git a/frameworks/js/napi/application_context_constant/BUILD.gn b/frameworks/js/napi/application_context_constant/BUILD.gn index a916c487c7..6c812a9922 100644 --- a/frameworks/js/napi/application_context_constant/BUILD.gn +++ b/frameworks/js/napi/application_context_constant/BUILD.gn @@ -15,6 +15,8 @@ import("//build/ohos.gni") import("//foundation/ability/ability_runtime/ability_runtime.gni") ohos_shared_library("contextconstant_napi") { + branch_protector_ret = "pac_ret" + include_dirs = [] sources = [ "application_context_constant_module.cpp" ] diff --git a/frameworks/js/napi/auto_fill_extension_ability/BUILD.gn b/frameworks/js/napi/auto_fill_extension_ability/BUILD.gn index f1757b2157..818aa29180 100644 --- a/frameworks/js/napi/auto_fill_extension_ability/BUILD.gn +++ b/frameworks/js/napi/auto_fill_extension_ability/BUILD.gn @@ -35,6 +35,8 @@ gen_js_obj("auto_fill_extension_ability_abc") { } ohos_shared_library("autofillextensionability_napi") { + branch_protector_ret = "pac_ret" + sources = [ "auto_fill_extension_ability_module.cpp" ] deps = [ diff --git a/frameworks/js/napi/auto_fill_extension_context/BUILD.gn b/frameworks/js/napi/auto_fill_extension_context/BUILD.gn index cdb3cee610..da36c650d9 100755 --- a/frameworks/js/napi/auto_fill_extension_context/BUILD.gn +++ b/frameworks/js/napi/auto_fill_extension_context/BUILD.gn @@ -35,6 +35,8 @@ gen_js_obj("auto_fill_extension_context_abc") { } ohos_shared_library("autofillextensioncontext_napi") { + branch_protector_ret = "pac_ret" + sources = [ "auto_fill_extension_context_module.cpp" ] deps = [ diff --git a/frameworks/js/napi/auto_fill_manager/BUILD.gn b/frameworks/js/napi/auto_fill_manager/BUILD.gn index 3a829b67cd..f836678275 100644 --- a/frameworks/js/napi/auto_fill_manager/BUILD.gn +++ b/frameworks/js/napi/auto_fill_manager/BUILD.gn @@ -15,6 +15,8 @@ import("//build/ohos.gni") import("//foundation/ability/ability_runtime/ability_runtime.gni") ohos_shared_library("autofillmanager_napi") { + branch_protector_ret = "pac_ret" + sources = [ "auto_fill_manager_module.cpp", "js_auto_fill_manager.cpp", diff --git a/frameworks/js/napi/callee/BUILD.gn b/frameworks/js/napi/callee/BUILD.gn index 802a96d09b..b37e8b95a0 100644 --- a/frameworks/js/napi/callee/BUILD.gn +++ b/frameworks/js/napi/callee/BUILD.gn @@ -34,6 +34,8 @@ gen_js_obj("callee_abc") { } ohos_shared_library("callee_napi") { + branch_protector_ret = "pac_ret" + sources = [ "callee_module.cpp" ] deps = [ diff --git a/frameworks/js/napi/caller/BUILD.gn b/frameworks/js/napi/caller/BUILD.gn index 2a0d347f9c..9938cbb742 100644 --- a/frameworks/js/napi/caller/BUILD.gn +++ b/frameworks/js/napi/caller/BUILD.gn @@ -34,6 +34,8 @@ gen_js_obj("caller_abc") { } ohos_shared_library("caller_napi") { + branch_protector_ret = "pac_ret" + sources = [ "caller_module.cpp" ] cflags = [ diff --git a/frameworks/js/napi/completion_handler_for_abilitystartcallback/BUILD.gn b/frameworks/js/napi/completion_handler_for_abilitystartcallback/BUILD.gn index cf4e945310..07c4b7bdbc 100644 --- a/frameworks/js/napi/completion_handler_for_abilitystartcallback/BUILD.gn +++ b/frameworks/js/napi/completion_handler_for_abilitystartcallback/BUILD.gn @@ -15,6 +15,8 @@ import("//build/ohos.gni") import("//foundation/ability/ability_runtime/ability_runtime.gni") ohos_shared_library("completionhandlerforabilitystartcallback") { + branch_protector_ret = "pac_ret" + sanitize = { cfi = true cfi_cross_dso = true diff --git a/frameworks/js/napi/completion_handler_for_atomic_service/BUILD.gn b/frameworks/js/napi/completion_handler_for_atomic_service/BUILD.gn index 8605b4a49a..a56b74b7f1 100644 --- a/frameworks/js/napi/completion_handler_for_atomic_service/BUILD.gn +++ b/frameworks/js/napi/completion_handler_for_atomic_service/BUILD.gn @@ -15,6 +15,8 @@ import("//build/ohos.gni") import("//foundation/ability/ability_runtime/ability_runtime.gni") ohos_shared_library("completionhandlerforatomicservice") { + branch_protector_ret = "pac_ret" + sanitize = { cfi = true cfi_cross_dso = true diff --git a/frameworks/js/napi/configuration_constant/BUILD.gn b/frameworks/js/napi/configuration_constant/BUILD.gn index dad8c16a0c..67640da0fa 100644 --- a/frameworks/js/napi/configuration_constant/BUILD.gn +++ b/frameworks/js/napi/configuration_constant/BUILD.gn @@ -14,6 +14,8 @@ import("//build/ohos.gni") ohos_shared_library("configurationconstant_napi") { + branch_protector_ret = "pac_ret" + include_dirs = [] sources = [ "configuration_constant_napi_module.cpp" ] @@ -34,6 +36,8 @@ ohos_shared_library("configurationconstant_napi") { } ohos_shared_library("configurationconstant") { + branch_protector_ret = "pac_ret" + include_dirs = [] sources = [ "configuration_constant_module.cpp" ] diff --git a/frameworks/js/napi/embeddable_ui_ability/BUILD.gn b/frameworks/js/napi/embeddable_ui_ability/BUILD.gn index a0ba11cdd6..8a74ca6d86 100644 --- a/frameworks/js/napi/embeddable_ui_ability/BUILD.gn +++ b/frameworks/js/napi/embeddable_ui_ability/BUILD.gn @@ -35,6 +35,8 @@ gen_js_obj("embeddable_ui_ability_abc") { } ohos_shared_library("embeddableuiability_napi") { + branch_protector_ret = "pac_ret" + sources = [ "embeddable_ui_ability_module.cpp" ] deps = [ diff --git a/frameworks/js/napi/embeddable_ui_ability_context/BUILD.gn b/frameworks/js/napi/embeddable_ui_ability_context/BUILD.gn index 025fab8fd7..47e5bcb7ad 100644 --- a/frameworks/js/napi/embeddable_ui_ability_context/BUILD.gn +++ b/frameworks/js/napi/embeddable_ui_ability_context/BUILD.gn @@ -36,6 +36,8 @@ gen_js_obj("embeddable_ui_ability_context_abc") { } ohos_shared_library("embeddableuiabilitycontext_napi") { + branch_protector_ret = "pac_ret" + sources = [ "embeddable_ui_ability_context_module.cpp" ] deps = [ diff --git a/frameworks/js/napi/errorcode/BUILD.gn b/frameworks/js/napi/errorcode/BUILD.gn index 4adf473202..ccf1f9f61e 100644 --- a/frameworks/js/napi/errorcode/BUILD.gn +++ b/frameworks/js/napi/errorcode/BUILD.gn @@ -15,6 +15,8 @@ import("//build/ohos.gni") import("//foundation/ability/ability_runtime/ability_runtime.gni") ohos_shared_library("errorcode_napi") { + branch_protector_ret = "pac_ret" + include_dirs = [ "${ability_runtime_services_path}/common/include", ] diff --git a/frameworks/js/napi/extension_ability/BUILD.gn b/frameworks/js/napi/extension_ability/BUILD.gn index f5e6b15ae9..f907243218 100644 --- a/frameworks/js/napi/extension_ability/BUILD.gn +++ b/frameworks/js/napi/extension_ability/BUILD.gn @@ -35,6 +35,8 @@ gen_js_obj("extension_ability_abc") { } ohos_shared_library("extensionability_napi") { + branch_protector_ret = "pac_ret" + sources = [ "extension_ability_module.cpp" ] deps = [ diff --git a/frameworks/js/napi/extensioncontext/BUILD.gn b/frameworks/js/napi/extensioncontext/BUILD.gn index 512f486185..2c38e4c888 100644 --- a/frameworks/js/napi/extensioncontext/BUILD.gn +++ b/frameworks/js/napi/extensioncontext/BUILD.gn @@ -35,6 +35,8 @@ gen_js_obj("extension_context_abc") { } ohos_shared_library("extensioncontext_napi") { + branch_protector_ret = "pac_ret" + sources = [ "extension_context_module.cpp" ] deps = [ diff --git a/frameworks/js/napi/featureAbility/BUILD.gn b/frameworks/js/napi/featureAbility/BUILD.gn index 00283603a5..3eb9b85d9b 100644 --- a/frameworks/js/napi/featureAbility/BUILD.gn +++ b/frameworks/js/napi/featureAbility/BUILD.gn @@ -15,6 +15,8 @@ import("//build/ohos.gni") import("//foundation/ability/ability_runtime/ability_runtime.gni") ohos_shared_library("featureability") { + branch_protector_ret = "pac_ret" + configs = [ "${ability_runtime_services_path}/common:optimize_config" ] include_dirs = [ "./" ] diff --git a/frameworks/js/napi/feature_ability/BUILD.gn b/frameworks/js/napi/feature_ability/BUILD.gn index 1525b43f55..bbb63e54e9 100644 --- a/frameworks/js/napi/feature_ability/BUILD.gn +++ b/frameworks/js/napi/feature_ability/BUILD.gn @@ -15,6 +15,8 @@ import("//build/ohos.gni") import("//foundation/ability/ability_runtime/ability_runtime.gni") ohos_shared_library("featureability_napi") { + branch_protector_ret = "pac_ret" + include_dirs = [] sources = [ diff --git a/frameworks/js/napi/inner/napi_ability_common/BUILD.gn b/frameworks/js/napi/inner/napi_ability_common/BUILD.gn index e8c211b7d3..957fbc9117 100644 --- a/frameworks/js/napi/inner/napi_ability_common/BUILD.gn +++ b/frameworks/js/napi/inner/napi_ability_common/BUILD.gn @@ -19,6 +19,8 @@ config("napi_ability_common_public_config") { } ohos_shared_library("napi_ability_common") { + branch_protector_ret = "pac_ret" + public_configs = [ ":napi_ability_common_public_config", "${ability_runtime_native_path}/ability/native:ability_public_config", diff --git a/frameworks/js/napi/insight_intent/insight_intent/BUILD.gn b/frameworks/js/napi/insight_intent/insight_intent/BUILD.gn index b4b106633e..c8ab8bf7e1 100644 --- a/frameworks/js/napi/insight_intent/insight_intent/BUILD.gn +++ b/frameworks/js/napi/insight_intent/insight_intent/BUILD.gn @@ -15,6 +15,8 @@ import("//build/ohos.gni") import("//foundation/ability/ability_runtime/ability_runtime.gni") ohos_shared_library("insightintent_napi") { + branch_protector_ret = "pac_ret" + sources = [ "js_insight_intent.cpp", "native_module.cpp", diff --git a/frameworks/js/napi/insight_intent/insight_intent_decorator/BUILD.gn b/frameworks/js/napi/insight_intent/insight_intent_decorator/BUILD.gn index 4d88d54daa..53102e832d 100644 --- a/frameworks/js/napi/insight_intent/insight_intent_decorator/BUILD.gn +++ b/frameworks/js/napi/insight_intent/insight_intent_decorator/BUILD.gn @@ -15,6 +15,8 @@ import("//build/ohos.gni") import("//foundation/ability/ability_runtime/ability_runtime.gni") ohos_shared_library("insightintentdecorator_napi") { + branch_protector_ret = "pac_ret" + sources = [ "js_insight_intent_decorator.cpp", "native_module.cpp", diff --git a/frameworks/js/napi/insight_intent/insight_intent_driver/BUILD.gn b/frameworks/js/napi/insight_intent/insight_intent_driver/BUILD.gn index e53e9392c1..7efebbfb56 100644 --- a/frameworks/js/napi/insight_intent/insight_intent_driver/BUILD.gn +++ b/frameworks/js/napi/insight_intent/insight_intent_driver/BUILD.gn @@ -15,6 +15,8 @@ import("//build/ohos.gni") import("//foundation/ability/ability_runtime/ability_runtime.gni") ohos_shared_library("insightintentdriver_napi") { + branch_protector_ret = "pac_ret" + sources = [ "js_insight_intent_driver.cpp", "js_insight_intent_driver_utils.cpp", diff --git a/frameworks/js/napi/insight_intent/insight_intent_executor/BUILD.gn b/frameworks/js/napi/insight_intent/insight_intent_executor/BUILD.gn index add8c609eb..65b0560347 100644 --- a/frameworks/js/napi/insight_intent/insight_intent_executor/BUILD.gn +++ b/frameworks/js/napi/insight_intent/insight_intent_executor/BUILD.gn @@ -35,6 +35,8 @@ gen_js_obj("insight_intent_executor_abc") { } ohos_shared_library("insightintentexecutor_napi") { + branch_protector_ret = "pac_ret" + sources = [ "insight_intent_executor_module.cpp" ] deps = [ diff --git a/frameworks/js/napi/insight_intent/insight_intent_provider/BUILD.gn b/frameworks/js/napi/insight_intent/insight_intent_provider/BUILD.gn index e3c8287e28..873f7bcf4c 100644 --- a/frameworks/js/napi/insight_intent/insight_intent_provider/BUILD.gn +++ b/frameworks/js/napi/insight_intent/insight_intent_provider/BUILD.gn @@ -15,6 +15,8 @@ import("//build/ohos.gni") import("//foundation/ability/ability_runtime/ability_runtime.gni") ohos_shared_library("insightintentprovider_napi") { + branch_protector_ret = "pac_ret" + sanitize = { integer_overflow = true ubsan = true diff --git a/frameworks/js/napi/insight_intent_context/BUILD.gn b/frameworks/js/napi/insight_intent_context/BUILD.gn index 481434a247..4cc102afda 100644 --- a/frameworks/js/napi/insight_intent_context/BUILD.gn +++ b/frameworks/js/napi/insight_intent_context/BUILD.gn @@ -35,6 +35,8 @@ gen_js_obj("insight_intent_context_abc") { } ohos_shared_library("insightintentcontext_napi") { + branch_protector_ret = "pac_ret" + sources = [ "insight_intent_context_module.cpp" ] deps = [ diff --git a/frameworks/js/napi/js_child_process/BUILD.gn b/frameworks/js/napi/js_child_process/BUILD.gn index f3402e8fdc..a9b7df9fff 100644 --- a/frameworks/js/napi/js_child_process/BUILD.gn +++ b/frameworks/js/napi/js_child_process/BUILD.gn @@ -35,6 +35,8 @@ gen_js_obj("child_process_abc") { } ohos_shared_library("childprocess_napi") { + branch_protector_ret = "pac_ret" + sources = [ "native_module.cpp" ] deps = [ diff --git a/frameworks/js/napi/js_child_process_manager/BUILD.gn b/frameworks/js/napi/js_child_process_manager/BUILD.gn index f1878bb22f..70d1fc8e72 100644 --- a/frameworks/js/napi/js_child_process_manager/BUILD.gn +++ b/frameworks/js/napi/js_child_process_manager/BUILD.gn @@ -15,6 +15,8 @@ import("//build/ohos.gni") import("//foundation/ability/ability_runtime/ability_runtime.gni") ohos_shared_library("childprocessmanager_napi") { + branch_protector_ret = "pac_ret" + sources = [] configs = [ diff --git a/frameworks/js/napi/js_dialog_request/BUILD.gn b/frameworks/js/napi/js_dialog_request/BUILD.gn index 67289e22ac..544a11ea64 100755 --- a/frameworks/js/napi/js_dialog_request/BUILD.gn +++ b/frameworks/js/napi/js_dialog_request/BUILD.gn @@ -19,6 +19,8 @@ config("dialog_request_external_config") { } ohos_shared_library("dialogrequest_napi") { + branch_protector_ret = "pac_ret" + sources = [ "js_dialog_request.cpp", "js_dialog_request_callback.cpp", diff --git a/frameworks/js/napi/js_dialog_session/BUILD.gn b/frameworks/js/napi/js_dialog_session/BUILD.gn index b856b6ad4e..9071dfbfa6 100644 --- a/frameworks/js/napi/js_dialog_session/BUILD.gn +++ b/frameworks/js/napi/js_dialog_session/BUILD.gn @@ -15,6 +15,8 @@ import("//build/ohos.gni") import("//foundation/ability/ability_runtime/ability_runtime.gni") ohos_shared_library("dialogsession_napi") { + branch_protector_ret = "pac_ret" + sources = [ "js_dialog_session.cpp", "js_dialog_session_utils.cpp", diff --git a/frameworks/js/napi/js_mission_manager/BUILD.gn b/frameworks/js/napi/js_mission_manager/BUILD.gn index 9ef83552e7..b3781595f3 100755 --- a/frameworks/js/napi/js_mission_manager/BUILD.gn +++ b/frameworks/js/napi/js_mission_manager/BUILD.gn @@ -15,6 +15,8 @@ import("//build/ohos.gni") import("//foundation/ability/ability_runtime/ability_runtime.gni") ohos_shared_library("missionmanager") { + branch_protector_ret = "pac_ret" + sources = [ "js_mission_info_utils.cpp", "js_mission_listener.cpp", diff --git a/frameworks/js/napi/mission_manager/BUILD.gn b/frameworks/js/napi/mission_manager/BUILD.gn index d14259fc1c..60e6b4dac2 100644 --- a/frameworks/js/napi/mission_manager/BUILD.gn +++ b/frameworks/js/napi/mission_manager/BUILD.gn @@ -15,6 +15,8 @@ import("//build/ohos.gni") import("//foundation/ability/ability_runtime/ability_runtime.gni") ohos_shared_library("missionmanager_napi") { + branch_protector_ret = "pac_ret" + sources = [ "js_mission_info_utils.cpp", "js_mission_listener.cpp", @@ -75,6 +77,8 @@ ohos_shared_library("missionmanager_napi") { } ohos_shared_library("distributedmissionmanager") { + branch_protector_ret = "pac_ret" + include_dirs = [] configs = [ diff --git a/frameworks/js/napi/particleAbility/BUILD.gn b/frameworks/js/napi/particleAbility/BUILD.gn index 2a94331f47..5666faf399 100644 --- a/frameworks/js/napi/particleAbility/BUILD.gn +++ b/frameworks/js/napi/particleAbility/BUILD.gn @@ -15,6 +15,8 @@ import("//build/ohos.gni") import("//foundation/ability/ability_runtime/ability_runtime.gni") ohos_shared_library("particleability") { + branch_protector_ret = "pac_ret" + include_dirs = [ "${ability_runtime_napi_path}/featureAbility", "${ability_runtime_services_path}/common/include", diff --git a/frameworks/js/napi/photo_editor_extension_ability/BUILD.gn b/frameworks/js/napi/photo_editor_extension_ability/BUILD.gn index fd0678d174..bb05efc31f 100755 --- a/frameworks/js/napi/photo_editor_extension_ability/BUILD.gn +++ b/frameworks/js/napi/photo_editor_extension_ability/BUILD.gn @@ -36,6 +36,8 @@ gen_js_obj("photo_editor_extension_ability_abc") { } ohos_shared_library("photoeditorextensionability_napi") { + branch_protector_ret = "pac_ret" + sanitize = { integer_overflow = true ubsan = true diff --git a/frameworks/js/napi/photo_editor_extension_context/BUILD.gn b/frameworks/js/napi/photo_editor_extension_context/BUILD.gn index 3a0250fa49..dc2864b2f9 100755 --- a/frameworks/js/napi/photo_editor_extension_context/BUILD.gn +++ b/frameworks/js/napi/photo_editor_extension_context/BUILD.gn @@ -36,6 +36,8 @@ gen_js_obj("photo_editor_extension_context_abc") { } ohos_shared_library("photoeditorextensioncontext_napi") { + branch_protector_ret = "pac_ret" + sanitize = { integer_overflow = true ubsan = true diff --git a/frameworks/js/napi/quick_fix/BUILD.gn b/frameworks/js/napi/quick_fix/BUILD.gn index e32ebb2f20..42cf829b7b 100644 --- a/frameworks/js/napi/quick_fix/BUILD.gn +++ b/frameworks/js/napi/quick_fix/BUILD.gn @@ -15,6 +15,8 @@ import("//build/ohos.gni") import("//foundation/ability/ability_runtime/ability_runtime.gni") ohos_shared_library("quickfixmanager_napi") { + branch_protector_ret = "pac_ret" + sources = [ "js_application_quick_fix_info.cpp", "js_quick_fix_manager.cpp", diff --git a/frameworks/js/napi/service_extension_ability/BUILD.gn b/frameworks/js/napi/service_extension_ability/BUILD.gn index 91abec9b79..f60850e5a0 100644 --- a/frameworks/js/napi/service_extension_ability/BUILD.gn +++ b/frameworks/js/napi/service_extension_ability/BUILD.gn @@ -35,6 +35,8 @@ gen_js_obj("service_extension_ability_abc") { } ohos_shared_library("serviceextensionability_napi") { + branch_protector_ret = "pac_ret" + sources = [ "service_extension_ability_napi_module.cpp" ] deps = [ @@ -50,6 +52,8 @@ ohos_shared_library("serviceextensionability_napi") { } ohos_shared_library("serviceextensionability") { + branch_protector_ret = "pac_ret" + sources = [ "service_extension_ability_module.cpp" ] deps = [ diff --git a/frameworks/js/napi/service_extension_context/BUILD.gn b/frameworks/js/napi/service_extension_context/BUILD.gn index 84cd644117..1152ac05cb 100644 --- a/frameworks/js/napi/service_extension_context/BUILD.gn +++ b/frameworks/js/napi/service_extension_context/BUILD.gn @@ -35,6 +35,8 @@ gen_js_obj("service_extension_context_abc") { } ohos_shared_library("serviceextensioncontext_napi") { + branch_protector_ret = "pac_ret" + sources = [ "service_extension_context_module.cpp" ] deps = [ diff --git a/frameworks/js/napi/share_extension_ability/BUILD.gn b/frameworks/js/napi/share_extension_ability/BUILD.gn index 9388f58551..3fc34d0f8f 100755 --- a/frameworks/js/napi/share_extension_ability/BUILD.gn +++ b/frameworks/js/napi/share_extension_ability/BUILD.gn @@ -35,6 +35,8 @@ gen_js_obj("share_extension_ability_abc") { } ohos_shared_library("shareextensionability_napi") { + branch_protector_ret = "pac_ret" + sources = [ "share_extension_ability_module.cpp" ] deps = [ diff --git a/frameworks/js/napi/ui_extension_ability/BUILD.gn b/frameworks/js/napi/ui_extension_ability/BUILD.gn index af23dfd573..2718c9d450 100755 --- a/frameworks/js/napi/ui_extension_ability/BUILD.gn +++ b/frameworks/js/napi/ui_extension_ability/BUILD.gn @@ -35,6 +35,8 @@ gen_js_obj("ui_extension_ability_abc") { } ohos_shared_library("uiextensionability_napi") { + branch_protector_ret = "pac_ret" + sources = [ "ui_extension_ability_module.cpp" ] deps = [ diff --git a/frameworks/js/napi/ui_extension_context/BUILD.gn b/frameworks/js/napi/ui_extension_context/BUILD.gn index e49ad18138..453b372917 100755 --- a/frameworks/js/napi/ui_extension_context/BUILD.gn +++ b/frameworks/js/napi/ui_extension_context/BUILD.gn @@ -35,6 +35,8 @@ gen_js_obj("ui_extension_context_abc") { } ohos_shared_library("uiextensioncontext_napi") { + branch_protector_ret = "pac_ret" + sources = [ "ui_extension_context_module.cpp" ] deps = [ diff --git a/frameworks/js/napi/uri_permission/BUILD.gn b/frameworks/js/napi/uri_permission/BUILD.gn index 803fe38afd..b1bfd7f06d 100644 --- a/frameworks/js/napi/uri_permission/BUILD.gn +++ b/frameworks/js/napi/uri_permission/BUILD.gn @@ -15,6 +15,8 @@ import("//build/ohos.gni") import("//foundation/ability/ability_runtime/ability_runtime.gni") ohos_shared_library("uripermissionmanager_napi") { + branch_protector_ret = "pac_ret" + sources = [ "js_uri_perm_mgr.cpp", "native_module.cpp", diff --git a/frameworks/js/napi/wantConstant/BUILD.gn b/frameworks/js/napi/wantConstant/BUILD.gn index c52bde3d84..e92ab1f0e1 100644 --- a/frameworks/js/napi/wantConstant/BUILD.gn +++ b/frameworks/js/napi/wantConstant/BUILD.gn @@ -15,6 +15,8 @@ import("//build/ohos.gni") import("//foundation/ability/ability_runtime/ability_runtime.gni") ohos_shared_library("wantconstant") { + branch_protector_ret = "pac_ret" + include_dirs = [ "${ability_runtime_services_path}/common/include" ] sources = [ @@ -41,6 +43,8 @@ ohos_shared_library("wantconstant") { } ohos_shared_library("wantconstant_napi") { + branch_protector_ret = "pac_ret" + include_dirs = [ "${ability_runtime_services_path}/common/include" ] sources = [ diff --git a/frameworks/js/napi/wantagent/BUILD.gn b/frameworks/js/napi/wantagent/BUILD.gn index e22a82fa6d..347a2253c2 100644 --- a/frameworks/js/napi/wantagent/BUILD.gn +++ b/frameworks/js/napi/wantagent/BUILD.gn @@ -15,6 +15,8 @@ import("//build/ohos.gni") import("//foundation/ability/ability_runtime/ability_runtime.gni") ohos_shared_library("wantagent") { + branch_protector_ret = "pac_ret" + include_dirs = [ "${ability_runtime_services_path}/common/include", "${ability_runtime_path}/interfaces/kits/native/appkit/ability_runtime", diff --git a/frameworks/js/napi/wantagent/ability_want_agent/BUILD.gn b/frameworks/js/napi/wantagent/ability_want_agent/BUILD.gn index c4e3ebe814..79f58f0155 100644 --- a/frameworks/js/napi/wantagent/ability_want_agent/BUILD.gn +++ b/frameworks/js/napi/wantagent/ability_want_agent/BUILD.gn @@ -15,6 +15,8 @@ import("//build/ohos.gni") import("//foundation/ability/ability_runtime/ability_runtime.gni") ohos_shared_library("wantagent_napi") { + branch_protector_ret = "pac_ret" + configs = [ "${ability_runtime_services_path}/common:optimize_config" ] include_dirs = [ diff --git a/frameworks/native/ability/ability_runtime/local_call_container.cpp b/frameworks/native/ability/ability_runtime/local_call_container.cpp index 5b1e2ce0bf..7da50f54cf 100644 --- a/frameworks/native/ability/ability_runtime/local_call_container.cpp +++ b/frameworks/native/ability/ability_runtime/local_call_container.cpp @@ -464,13 +464,7 @@ void CallerConnection::OnRemoteStateChanged(const AppExecFwk::ElementName &eleme int32_t LocalCallContainer::GetCurrentUserId() { if (currentUserId_ == DEFAULT_INVAL_VALUE) { - auto osAccount = DelayedSingleton::GetInstance(); - if (osAccount == nullptr) { - TAG_LOGE(AAFwkTag::LOCAL_CALL, "null osAccount"); - return DEFAULT_INVAL_VALUE; - } - - osAccount->GetOsAccountLocalIdFromProcess(currentUserId_); + AppExecFwk::OsAccountManagerWrapper::GetOsAccountLocalIdFromProcess(currentUserId_); } TAG_LOGD(AAFwkTag::LOCAL_CALL, "currentUserId %{public}d", currentUserId_); return currentUserId_; diff --git a/frameworks/native/ability/native/BUILD.gn b/frameworks/native/ability/native/BUILD.gn index 1e09763745..9b8130f7cf 100644 --- a/frameworks/native/ability/native/BUILD.gn +++ b/frameworks/native/ability/native/BUILD.gn @@ -641,6 +641,8 @@ config("extensionkit_public_config") { } ohos_shared_library("extensionkit_native") { + branch_protector_ret = "pac_ret" + defines = [ "AMS_LOG_TAG = \"Ability\"" ] defines += [ "AMS_LOG_DOMAIN = 0xD001300" ] include_dirs = [ @@ -721,6 +723,8 @@ ohos_shared_library("extensionkit_native") { } ohos_shared_library("cj_extensionkit_native") { + branch_protector_ret = "pac_ret" + sanitize = { integer_overflow = true ubsan = true @@ -793,6 +797,8 @@ config("insight_intent_executor_public_config") { } ohos_shared_library("insight_intent_executor") { + branch_protector_ret = "pac_ret" + sources = [ "${ability_runtime_native_path}/ability/native/insight_intent_executor/ets_insight_intent_executor_instance.cpp", "${ability_runtime_native_path}/ability/native/insight_intent_executor/insight_intent_delay_result_callback_mgr.cpp", @@ -849,6 +855,8 @@ ohos_shared_library("insight_intent_executor") { } ohos_shared_library("insight_intent_executor_ani") { + branch_protector_ret = "pac_ret" + sanitize = { cfi = true cfi_cross_dso = true @@ -916,6 +924,8 @@ ohos_shared_library("insight_intent_executor_ani") { } ohos_shared_library("cj_insight_intent_executor") { + branch_protector_ret = "pac_ret" + sanitize = { integer_overflow = true ubsan = true @@ -1124,6 +1134,8 @@ ohos_shared_library("ui_ability_ani") { } ohos_shared_library("uiabilitykit_native") { + branch_protector_ret = "pac_ret" + include_dirs = [ "${ability_runtime_path}/interfaces/kits/native/ability/native", "${ability_runtime_path}/interfaces/kits/native/ability/native/ability_runtime", @@ -1263,6 +1275,8 @@ ohos_shared_library("uiabilitykit_native") { } ohos_shared_library("ability_thread") { + branch_protector_ret = "pac_ret" + configs = [ "${ability_runtime_services_path}/common:optimize_config" ] include_dirs = [ @@ -1332,6 +1346,8 @@ ohos_shared_library("ability_thread") { } ohos_shared_library("ets_form_extension") { + branch_protector_ret = "pac_ret" + sanitize = { integer_overflow = true ubsan = true @@ -1413,6 +1429,8 @@ ohos_shared_library("ets_form_extension") { } ohos_shared_library("form_extension") { + branch_protector_ret = "pac_ret" + defines = [ "AMS_LOG_TAG = \"Ability\"" ] defines += [ "AMS_LOG_DOMAIN = 0xD001300" ] if (ability_runtime_graphics) { @@ -1484,6 +1502,8 @@ ohos_shared_library("form_extension") { } ohos_shared_library("cj_form_extension") { + branch_protector_ret = "pac_ret" + sanitize = { integer_overflow = true ubsan = true @@ -1554,6 +1574,8 @@ ohos_shared_library("cj_form_extension") { } ohos_shared_library("form_extension_module") { + branch_protector_ret = "pac_ret" + include_dirs = [ "${ability_runtime_path}/interfaces/inner_api/ability_manager/include", "${ability_runtime_path}/interfaces/inner_api/runtime/include", @@ -1603,6 +1625,8 @@ ohos_shared_library("form_extension_module") { } ohos_shared_library("service_extension") { + branch_protector_ret = "pac_ret" + configs = [ "${ability_runtime_services_path}/common:optimize_config" ] defines = [ "AMS_LOG_TAG = \"Ability\"" ] @@ -1757,6 +1781,8 @@ ohos_shared_library("app_service_extension_ani") { } ohos_shared_library("service_extension_ani") { + branch_protector_ret = "pac_ret" + sanitize = { cfi = true cfi_cross_dso = true @@ -2307,6 +2333,8 @@ ohos_shared_library("continuation_ipc") { } ohos_shared_library("data_ability_helper") { + branch_protector_ret = "pac_ret" + include_dirs = [ "${ability_runtime_path}/interfaces/kits/native/ability/native" ] @@ -2360,6 +2388,8 @@ ohos_shared_library("data_ability_helper") { } ohos_shared_library("service_extension_module") { + branch_protector_ret = "pac_ret" + include_dirs = [ "${ability_runtime_path}/interfaces/inner_api/ability_manager/include", "${ability_runtime_path}/interfaces/inner_api/runtime/include", @@ -2427,6 +2457,12 @@ config("ability_business_error_public_config") { ohos_shared_library("ability_business_error") { branch_protector_ret = "pac_ret" + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + } + sources = [ "${ability_runtime_native_path}/ability/native/ability_business_error/ability_business_error.cpp" ] configs = [ ":ability_business_error_config" ] @@ -2535,6 +2571,8 @@ config("ui_extension_public_config") { } ohos_shared_library("ui_extension") { + branch_protector_ret = "pac_ret" + include_dirs = [ "${ability_runtime_path}/interfaces/kits/native/ability/native/ui_service_extension_ability/connection", "${ability_runtime_path}/frameworks/ets/ani/ui_extension_ability/include", @@ -2614,6 +2652,8 @@ ohos_shared_library("ui_extension") { } ohos_shared_library("photo_editor_extension_ani") { + branch_protector_ret = "pac_ret" + sanitize = { integer_overflow = true ubsan = true @@ -2714,6 +2754,8 @@ config("ui_extension_ani_public_config") { } ohos_shared_library("ui_extension_ani") { + branch_protector_ret = "pac_ret" + sanitize = { cfi = true cfi_cross_dso = true @@ -2813,6 +2855,8 @@ ohos_shared_library("ui_extension_ani") { } ohos_shared_library("cj_ui_extension") { + branch_protector_ret = "pac_ret" + sanitize = { integer_overflow = true ubsan = true @@ -2890,6 +2934,8 @@ ohos_shared_library("cj_ui_extension") { } ohos_shared_library("ui_extension_module") { + branch_protector_ret = "pac_ret" + include_dirs = [ "${ability_runtime_path}/interfaces/kits/native/ability/native/ui_extension_ability" ] sources = [ "${ability_runtime_native_path}/ability/native/ui_extension_ability/ui_extension_module_loader.cpp" ] @@ -2944,6 +2990,8 @@ config("share_extension_config") { } ohos_shared_library("share_extension") { + branch_protector_ret = "pac_ret" + configs = [ ":share_extension_config", "${ability_runtime_services_path}/common:optimize_config", @@ -2996,6 +3044,8 @@ ohos_shared_library("share_extension") { } ohos_shared_library("cj_share_extension") { + branch_protector_ret = "pac_ret" + sanitize = { integer_overflow = true ubsan = true @@ -3058,6 +3108,8 @@ config("action_extension_config") { } ohos_shared_library("action_extension") { + branch_protector_ret = "pac_ret" + configs = [ ":action_extension_config", "${ability_runtime_services_path}/common:optimize_config", @@ -3110,6 +3162,8 @@ ohos_shared_library("action_extension") { } ohos_shared_library("cj_action_extension") { + branch_protector_ret = "pac_ret" + sanitize = { integer_overflow = true ubsan = true @@ -3159,6 +3213,8 @@ ohos_shared_library("cj_action_extension") { } ohos_shared_library("share_extension_module") { + branch_protector_ret = "pac_ret" + sources = [ "${ability_runtime_native_path}/ability/native/share_extension_ability/share_extension_module_loader.cpp" ] configs = [ @@ -3204,6 +3260,12 @@ ohos_shared_library("share_extension_module") { ohos_shared_library("auto_startup_callback") { branch_protector_ret = "pac_ret" + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + } + include_dirs = [ "${ability_runtime_path}/interfaces/kits/native/ability/native/ability_business_error" ] sources = [ @@ -3229,6 +3291,8 @@ ohos_shared_library("auto_startup_callback") { } ohos_shared_library("action_extension_module") { + branch_protector_ret = "pac_ret" + sources = [ "${ability_runtime_native_path}/ability/native/action_extension_ability/action_extension_module_loader.cpp" ] configs = [ @@ -3520,6 +3584,8 @@ config("auto_fill_extension_config") { } ohos_shared_library("auto_fill_extension") { + branch_protector_ret = "pac_ret" + public_configs = [ ":auto_fill_extension_config" ] configs = [ "${ability_runtime_services_path}/common:optimize_config" ] @@ -3653,6 +3719,8 @@ ohos_shared_library("auto_fill_extension_ani") { } ohos_shared_library("auto_fill_extension_util") { + branch_protector_ret = "pac_ret" + sanitize = { integer_overflow = true ubsan = true @@ -3687,6 +3755,8 @@ ohos_shared_library("auto_fill_extension_util") { } ohos_shared_library("auto_fill_extension_module") { + branch_protector_ret = "pac_ret" + sources = [ "${ability_runtime_native_path}/ability/native/auto_fill_extension_ability/auto_fill_extension_module_loader.cpp" ] configs = [ @@ -3745,6 +3815,8 @@ config("photo_editor_extension_config") { } ohos_shared_library("photo_editor_extension") { + branch_protector_ret = "pac_ret" + sanitize = { integer_overflow = true ubsan = true @@ -3811,6 +3883,8 @@ ohos_shared_library("photo_editor_extension") { } ohos_shared_library("cj_photo_editor_extension") { + branch_protector_ret = "pac_ret" + sanitize = { integer_overflow = true ubsan = true @@ -3871,6 +3945,8 @@ ohos_shared_library("cj_photo_editor_extension") { } ohos_shared_library("photo_editor_extension_module") { + branch_protector_ret = "pac_ret" + sanitize = { integer_overflow = true ubsan = true diff --git a/frameworks/native/appkit/BUILD.gn b/frameworks/native/appkit/BUILD.gn index 0ac6e8bb9c..b83fe7645f 100644 --- a/frameworks/native/appkit/BUILD.gn +++ b/frameworks/native/appkit/BUILD.gn @@ -75,6 +75,8 @@ config("appkit_public_config") { # build so ohos_shared_library("appkit_native") { + branch_protector_ret = "pac_ret" + include_dirs = [ "native", "${ability_runtime_path}/ets_environment/interfaces/inner_api", @@ -353,6 +355,8 @@ ohos_shared_library("appkit_native") { } ohos_shared_library("ability_stage_ani") { + branch_protector_ret = "pac_ret" + sanitize = { cfi = true cfi_cross_dso = true @@ -784,6 +788,12 @@ config("application_context_manager_config") { ohos_shared_library("appkit_manager_helper") { branch_protector_ret = "pac_ret" + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + } + include_dirs = [ "native", "${ability_runtime_path}/interfaces/kits/native/appkit/ability_runtime/app", diff --git a/frameworks/native/appkit/ability_runtime/context/context_impl.cpp b/frameworks/native/appkit/ability_runtime/context/context_impl.cpp index 0879f77393..2753c7a58d 100644 --- a/frameworks/native/appkit/ability_runtime/context/context_impl.cpp +++ b/frameworks/native/appkit/ability_runtime/context/context_impl.cpp @@ -839,12 +839,7 @@ int ContextImpl::GetCurrentAccountId() const { HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); int userId = 0; - auto instance = DelayedSingleton::GetInstance(); - if (instance == nullptr) { - TAG_LOGE(AAFwkTag::APPKIT, "null instance"); - return userId; - } - instance->GetOsAccountLocalIdFromProcess(userId); + AppExecFwk::OsAccountManagerWrapper::GetOsAccountLocalIdFromProcess(userId); TAG_LOGD(AAFwkTag::APPKIT, "userId: %{public}d", userId); return userId; } @@ -853,12 +848,7 @@ int ContextImpl::GetCurrentActiveAccountId() const { HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); std::vector accountIds; - auto instance = DelayedSingleton::GetInstance(); - if (instance == nullptr) { - TAG_LOGE(AAFwkTag::APPKIT, "null instance"); - return 0; - } - ErrCode ret = instance->QueryActiveOsAccountIds(accountIds); + ErrCode ret = AppExecFwk::OsAccountManagerWrapper::QueryActiveOsAccountIds(accountIds); if (ret != ERR_OK) { TAG_LOGE(AAFwkTag::APPKIT, "ContextImpl::GetCurrentActiveAccountId error. ret: %{public}d", ret); return 0; diff --git a/frameworks/native/appkit/app/context_deal.cpp b/frameworks/native/appkit/app/context_deal.cpp index c7e94f17c6..8fe51488b9 100644 --- a/frameworks/native/appkit/app/context_deal.cpp +++ b/frameworks/native/appkit/app/context_deal.cpp @@ -236,7 +236,7 @@ bool ContextDeal::IsCreateBySystemApp() const int ContextDeal::GetCurrentAccountId() const { int userId = 0; - DelayedSingleton::GetInstance()->GetOsAccountLocalIdFromProcess(userId); + OsAccountManagerWrapper::GetOsAccountLocalIdFromProcess(userId); TAG_LOGD(AAFwkTag::APPKIT, "userId: %{public}d", userId); return userId; } diff --git a/frameworks/native/insight_intent/insight_intent_context/BUILD.gn b/frameworks/native/insight_intent/insight_intent_context/BUILD.gn index d1bfb62e43..20ec2daaa1 100644 --- a/frameworks/native/insight_intent/insight_intent_context/BUILD.gn +++ b/frameworks/native/insight_intent/insight_intent_context/BUILD.gn @@ -22,6 +22,8 @@ config("insight_intent_context_public_config") { } ohos_shared_library("insightintentcontext") { + branch_protector_ret = "pac_ret" + sources = [ "insight_intent_context.cpp", "js_insight_intent_context.cpp", @@ -58,6 +60,8 @@ ohos_shared_library("insightintentcontext") { } ohos_shared_library("cj_insightintentcontext") { + branch_protector_ret = "pac_ret" + sanitize = { integer_overflow = true ubsan = true diff --git a/frameworks/simulator/ability_simulator/BUILD.gn b/frameworks/simulator/ability_simulator/BUILD.gn index cbe9c17249..5ff9a639cf 100644 --- a/frameworks/simulator/ability_simulator/BUILD.gn +++ b/frameworks/simulator/ability_simulator/BUILD.gn @@ -21,6 +21,8 @@ config("ability_simulator_public_config") { } ohos_shared_library("ability_simulator_inner") { + branch_protector_ret = "pac_ret" + if (is_mingw || is_mac) { defines = [] if (is_mingw) { diff --git a/frameworks/simulator/napi_module/ability/BUILD.gn b/frameworks/simulator/napi_module/ability/BUILD.gn index c297b1fd52..003a60c2a2 100644 --- a/frameworks/simulator/napi_module/ability/BUILD.gn +++ b/frameworks/simulator/napi_module/ability/BUILD.gn @@ -21,6 +21,8 @@ gen_js_src_binary("ability") { } ohos_shared_library("ability_napi") { + branch_protector_ret = "pac_ret" + if (is_mingw) { defines = [ "WINDOWS_PLATFORM" ] } else { diff --git a/frameworks/simulator/napi_module/ability_constant/BUILD.gn b/frameworks/simulator/napi_module/ability_constant/BUILD.gn index 6f237cd40b..6f9f4c82c5 100644 --- a/frameworks/simulator/napi_module/ability_constant/BUILD.gn +++ b/frameworks/simulator/napi_module/ability_constant/BUILD.gn @@ -15,6 +15,8 @@ import("//build/ohos.gni") import("//foundation/ability/ability_runtime/ability_runtime.gni") ohos_shared_library("abilityconstant") { + branch_protector_ret = "pac_ret" + include_dirs = [ "${ability_runtime_innerkits_path}/ability_manager/include", "${ability_runtime_innerkits_path}/ability_manager/include/continuation", diff --git a/frameworks/simulator/napi_module/ability_context/BUILD.gn b/frameworks/simulator/napi_module/ability_context/BUILD.gn index 91e6fb824d..47034568ad 100644 --- a/frameworks/simulator/napi_module/ability_context/BUILD.gn +++ b/frameworks/simulator/napi_module/ability_context/BUILD.gn @@ -21,6 +21,8 @@ gen_js_src_binary("ability_context") { } ohos_shared_library("abilitycontext_napi") { + branch_protector_ret = "pac_ret" + if (is_mingw) { defines = [ "WINDOWS_PLATFORM" ] } else { diff --git a/frameworks/simulator/napi_module/ability_stage/BUILD.gn b/frameworks/simulator/napi_module/ability_stage/BUILD.gn index e3d2244c07..37af53189e 100644 --- a/frameworks/simulator/napi_module/ability_stage/BUILD.gn +++ b/frameworks/simulator/napi_module/ability_stage/BUILD.gn @@ -21,6 +21,8 @@ gen_js_src_binary("ability_stage") { } ohos_shared_library("abilitystage") { + branch_protector_ret = "pac_ret" + if (is_mingw) { defines = [ "WINDOWS_PLATFORM" ] } else { diff --git a/frameworks/simulator/napi_module/ability_stage_context/BUILD.gn b/frameworks/simulator/napi_module/ability_stage_context/BUILD.gn index a53ad22969..32b5f8e999 100644 --- a/frameworks/simulator/napi_module/ability_stage_context/BUILD.gn +++ b/frameworks/simulator/napi_module/ability_stage_context/BUILD.gn @@ -21,6 +21,8 @@ gen_js_src_binary("ability_stage_context") { } ohos_shared_library("abilitystagecontext_napi") { + branch_protector_ret = "pac_ret" + if (is_mingw) { defines = [ "WINDOWS_PLATFORM" ] } else { diff --git a/frameworks/simulator/napi_module/application_context/BUILD.gn b/frameworks/simulator/napi_module/application_context/BUILD.gn index 533fbf9c15..d078495dfd 100644 --- a/frameworks/simulator/napi_module/application_context/BUILD.gn +++ b/frameworks/simulator/napi_module/application_context/BUILD.gn @@ -21,6 +21,8 @@ gen_js_src_binary("application_context") { } ohos_shared_library("applicationcontext_napi") { + branch_protector_ret = "pac_ret" + if (is_mingw) { defines = [ "WINDOWS_PLATFORM" ] } else { diff --git a/frameworks/simulator/napi_module/callee/BUILD.gn b/frameworks/simulator/napi_module/callee/BUILD.gn index 7fc28faf74..28b188da71 100644 --- a/frameworks/simulator/napi_module/callee/BUILD.gn +++ b/frameworks/simulator/napi_module/callee/BUILD.gn @@ -21,6 +21,8 @@ gen_js_src_binary("callee") { } ohos_shared_library("callee") { + branch_protector_ret = "pac_ret" + if (is_mingw) { defines = [ "WINDOWS_PLATFORM" ] } else { diff --git a/frameworks/simulator/napi_module/caller/BUILD.gn b/frameworks/simulator/napi_module/caller/BUILD.gn index cd8058c5bf..5b4df12793 100644 --- a/frameworks/simulator/napi_module/caller/BUILD.gn +++ b/frameworks/simulator/napi_module/caller/BUILD.gn @@ -21,6 +21,8 @@ gen_js_src_binary("caller") { } ohos_shared_library("caller_napi") { + branch_protector_ret = "pac_ret" + if (is_mingw) { defines = [ "WINDOWS_PLATFORM" ] } else { diff --git a/frameworks/simulator/napi_module/configuration_constant/BUILD.gn b/frameworks/simulator/napi_module/configuration_constant/BUILD.gn index 3d837aa8a2..652a6a7a70 100644 --- a/frameworks/simulator/napi_module/configuration_constant/BUILD.gn +++ b/frameworks/simulator/napi_module/configuration_constant/BUILD.gn @@ -15,6 +15,8 @@ import("//build/ohos.gni") import("//foundation/ability/ability_runtime/ability_runtime.gni") ohos_shared_library("configurationconstant") { + branch_protector_ret = "pac_ret" + include_dirs = [ "${resource_management_path}/interfaces/inner_api/include" ] sources = [ "${ability_runtime_napi_path}/configuration_constant/configuration_constant_module.cpp" ] diff --git a/frameworks/simulator/napi_module/context/BUILD.gn b/frameworks/simulator/napi_module/context/BUILD.gn index 0b612f4e58..dbb3e03764 100644 --- a/frameworks/simulator/napi_module/context/BUILD.gn +++ b/frameworks/simulator/napi_module/context/BUILD.gn @@ -21,6 +21,8 @@ gen_js_src_binary("context") { } ohos_shared_library("context_napi") { + branch_protector_ret = "pac_ret" + if (is_mingw) { defines = [ "WINDOWS_PLATFORM" ] } else { diff --git a/frameworks/simulator/napi_module/embeddable_ui_ability/BUILD.gn b/frameworks/simulator/napi_module/embeddable_ui_ability/BUILD.gn index ab430a396b..d1afb57af7 100644 --- a/frameworks/simulator/napi_module/embeddable_ui_ability/BUILD.gn +++ b/frameworks/simulator/napi_module/embeddable_ui_ability/BUILD.gn @@ -20,6 +20,8 @@ gen_js_src_binary("embeddable_ui_ability") { } ohos_shared_library("embeddableuiability_napi") { + branch_protector_ret = "pac_ret" + if (is_mingw) { defines = [ "WINDOWS_PLATFORM" ] } else { diff --git a/frameworks/simulator/napi_module/embeddable_ui_ability_context/BUILD.gn b/frameworks/simulator/napi_module/embeddable_ui_ability_context/BUILD.gn index 7dd5205e2e..77ef4be910 100644 --- a/frameworks/simulator/napi_module/embeddable_ui_ability_context/BUILD.gn +++ b/frameworks/simulator/napi_module/embeddable_ui_ability_context/BUILD.gn @@ -20,6 +20,8 @@ gen_js_src_binary("embeddable_ui_ability_context") { } ohos_shared_library("embeddeduiextensionability_napi") { + branch_protector_ret = "pac_ret" + if (is_mingw) { defines = [ "WINDOWS_PLATFORM" ] } else { diff --git a/frameworks/simulator/napi_module/uiability/BUILD.gn b/frameworks/simulator/napi_module/uiability/BUILD.gn index 9aae2ff096..e251749f03 100644 --- a/frameworks/simulator/napi_module/uiability/BUILD.gn +++ b/frameworks/simulator/napi_module/uiability/BUILD.gn @@ -21,6 +21,8 @@ gen_js_src_binary("ability") { } ohos_shared_library("uiability") { + branch_protector_ret = "pac_ret" + if (is_mingw) { defines = [ "WINDOWS_PLATFORM" ] } else { diff --git a/frameworks/simulator/napi_module/want_constant/BUILD.gn b/frameworks/simulator/napi_module/want_constant/BUILD.gn index a1d4a08214..5c9ebac1f0 100644 --- a/frameworks/simulator/napi_module/want_constant/BUILD.gn +++ b/frameworks/simulator/napi_module/want_constant/BUILD.gn @@ -15,6 +15,8 @@ import("//build/ohos.gni") import("//foundation/ability/ability_runtime/ability_runtime.gni") ohos_shared_library("wantconstant_napi") { + branch_protector_ret = "pac_ret" + sources = [ "${ability_runtime_napi_path}/wantConstant/native_module.cpp", "${ability_runtime_napi_path}/wantConstant/want_constant.cpp", diff --git a/frameworks/simulator/osal/BUILD.gn b/frameworks/simulator/osal/BUILD.gn index c886210738..7387e4d44b 100644 --- a/frameworks/simulator/osal/BUILD.gn +++ b/frameworks/simulator/osal/BUILD.gn @@ -22,6 +22,8 @@ config("simulator_osal_public_config") { } ohos_source_set("simulator_osal") { + branch_protector_ret = "pac_ret" + sources = [] public_configs = [ ":simulator_osal_public_config" ] diff --git a/frameworks/simulator/test/BUILD.gn b/frameworks/simulator/test/BUILD.gn index 83cbc861ba..7b871e6f61 100644 --- a/frameworks/simulator/test/BUILD.gn +++ b/frameworks/simulator/test/BUILD.gn @@ -15,6 +15,8 @@ import("//build/ohos.gni") import("//foundation/ability/ability_runtime/ability_runtime.gni") ohos_executable("ability_simulator_test") { + branch_protector_ret = "pac_ret" + sources = [ "src/main.cpp" ] deps = [ "${ability_runtime_path}/frameworks/simulator/ability_simulator:ability_simulator" ] diff --git a/interfaces/inner_api/ability_manager/BUILD.gn b/interfaces/inner_api/ability_manager/BUILD.gn index 9c74375c1f..e1db218a9b 100644 --- a/interfaces/inner_api/ability_manager/BUILD.gn +++ b/interfaces/inner_api/ability_manager/BUILD.gn @@ -65,6 +65,16 @@ config("ability_manager_public_config") { ohos_shared_library("ability_manager") { use_exceptions = true branch_protector_ret = "pac_ret" + sanitize = { + integer_overflow = true + ubsan = true + boundary_sanitize = true + cfi = true + cfi_cross_dso = true + cfi_vcall_icall_only = true + cfi_policy = "adaptive" + debug = false + } sources = [ "${ability_runtime_native_path}/ability/native/data_ability_operation.cpp", @@ -270,6 +280,12 @@ ohos_shared_library("ability_start_options") { ohos_shared_library("mission_info") { branch_protector_ret = "pac_ret" + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + } + sources = [ "${ability_runtime_services_path}/abilitymgr/src/mission/mission_info.cpp", "${ability_runtime_services_path}/abilitymgr/src/mission/mission_snapshot.cpp", @@ -300,6 +316,8 @@ ohos_shared_library("mission_info") { } ohos_shared_library("ability_manager_c") { + branch_protector_ret = "pac_ret" + include_dirs = [ "include" ] sources = [ "src/ability_manager_client_c.cpp" ] libs = [] @@ -320,6 +338,12 @@ ohos_shared_library("ability_manager_c") { ohos_shared_library("ability_start_setting") { branch_protector_ret = "pac_ret" + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + } + sources = [ "${ability_runtime_services_path}/abilitymgr/src/ability_start_setting.cpp", ] @@ -418,6 +442,12 @@ ohos_shared_library("start_window_option") { ohos_shared_library("ability_connect_callback_stub") { branch_protector_ret = "pac_ret" + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + } + defines = [ "AMS_LOG_TAG = \"Ability\"" ] defines += [ "AMS_LOG_DOMAIN = 0xD001300" ] include_dirs = [ diff --git a/interfaces/inner_api/ani_base_context/BUILD.gn b/interfaces/inner_api/ani_base_context/BUILD.gn index 20df9f6f4c..d5e9378931 100644 --- a/interfaces/inner_api/ani_base_context/BUILD.gn +++ b/interfaces/inner_api/ani_base_context/BUILD.gn @@ -20,6 +20,8 @@ config("ani_context_base_public_config") { } ohos_shared_library("ani_base_context") { + branch_protector_ret = "pac_ret" + sanitize = { cfi = true cfi_cross_dso = true diff --git a/interfaces/inner_api/app_manager/BUILD.gn b/interfaces/inner_api/app_manager/BUILD.gn index 3121413848..213a43af3f 100644 --- a/interfaces/inner_api/app_manager/BUILD.gn +++ b/interfaces/inner_api/app_manager/BUILD.gn @@ -42,6 +42,16 @@ config("appmgr_core_config") { ohos_shared_library("app_manager") { branch_protector_ret = "pac_ret" + sanitize = { + integer_overflow = true + ubsan = true + boundary_sanitize = true + cfi = true + cfi_cross_dso = true + cfi_vcall_icall_only = true + cfi_policy = "adaptive" + debug = false + } include_dirs = [ "${ability_runtime_path}/interfaces/kits/native/appkit/dfr", diff --git a/interfaces/inner_api/child_process_manager/BUILD.gn b/interfaces/inner_api/child_process_manager/BUILD.gn index c15b50529a..624a2b5821 100644 --- a/interfaces/inner_api/child_process_manager/BUILD.gn +++ b/interfaces/inner_api/child_process_manager/BUILD.gn @@ -27,6 +27,8 @@ config("child_process_manager_config") { } ohos_shared_library("child_process_manager") { + branch_protector_ret = "pac_ret" + include_dirs = [ "${ability_runtime_path}/frameworks/ets/ani/child_process_manager/include", "${ability_runtime_path}/frameworks/ets/ani/ani_common/include", diff --git a/interfaces/inner_api/connectionobs_manager/BUILD.gn b/interfaces/inner_api/connectionobs_manager/BUILD.gn index fc4b3cfe6c..984ad937ae 100644 --- a/interfaces/inner_api/connectionobs_manager/BUILD.gn +++ b/interfaces/inner_api/connectionobs_manager/BUILD.gn @@ -32,6 +32,16 @@ config("connection_obs_manager_public_config") { ohos_shared_library("connection_obs_manager") { branch_protector_ret = "pac_ret" + sanitize = { + integer_overflow = true + ubsan = true + boundary_sanitize = true + cfi = true + cfi_cross_dso = true + cfi_vcall_icall_only = true + cfi_policy = "adaptive" + debug = false + } sources = [ "src/connection_data.cpp", diff --git a/interfaces/inner_api/deps_wrapper/BUILD.gn b/interfaces/inner_api/deps_wrapper/BUILD.gn index df5773767c..bc111c41dc 100644 --- a/interfaces/inner_api/deps_wrapper/BUILD.gn +++ b/interfaces/inner_api/deps_wrapper/BUILD.gn @@ -33,6 +33,12 @@ config("ability_deps_wrapper_config") { ohos_shared_library("ability_deps_wrapper") { branch_protector_ret = "pac_ret" + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + } + sources = [ "src/os_account_manager_wrapper.cpp", "src/sa_mgr_client.cpp", diff --git a/interfaces/inner_api/deps_wrapper/include/os_account_manager_wrapper.h b/interfaces/inner_api/deps_wrapper/include/os_account_manager_wrapper.h index 826ca5b843..110ec9cb67 100644 --- a/interfaces/inner_api/deps_wrapper/include/os_account_manager_wrapper.h +++ b/interfaces/inner_api/deps_wrapper/include/os_account_manager_wrapper.h @@ -16,6 +16,7 @@ #ifndef OHOS_ABILITY_RUNTIME_OS_ACCOUNT_MANAGER_WRAPPER_H #define OHOS_ABILITY_RUNTIME_OS_ACCOUNT_MANAGER_WRAPPER_H +#include #include #include "errors.h" @@ -23,7 +24,7 @@ namespace OHOS { namespace AppExecFwk { -class OsAccountManagerWrapper : public DelayedSingleton { +class OsAccountManagerWrapper { public: OsAccountManagerWrapper() = default; virtual ~OsAccountManagerWrapper() = default; @@ -34,7 +35,7 @@ public: * @param ids The local IDs of all activated OS accounts. * @return error code, ERR_OK on success, others on failure. */ - ErrCode QueryActiveOsAccountIds(std::vector& ids); + static ErrCode QueryActiveOsAccountIds(std::vector& ids); /** * @brief Gets the local ID of an OS account from the process UID @@ -43,7 +44,7 @@ public: * @param id The local ID of the OS account associated with the specified UID. * @return error code, ERR_OK on success, others on failure. */ - ErrCode GetOsAccountLocalIdFromUid(const int32_t uid, int32_t &id); + static ErrCode GetOsAccountLocalIdFromUid(const int32_t uid, int32_t &id); /** * @brief Gets the local ID of the current OS account. @@ -51,7 +52,7 @@ public: * @param id The local ID of the current OS account. * @return error code, ERR_OK on success, others on failure. */ - ErrCode GetOsAccountLocalIdFromProcess(int &id); + static ErrCode GetOsAccountLocalIdFromProcess(int &id); /** * @brief Checks whether the specified OS account exists. @@ -60,7 +61,7 @@ public: * @param isOsAccountExists Indicates whether the specified OS account exists. * @return error code, ERR_OK on success, others on failure. */ - ErrCode IsOsAccountExists(const int id, bool &isOsAccountExists); + static ErrCode IsOsAccountExists(const int id, bool &isOsAccountExists); /** * @brief Creates an OS account using the local name and account type. @@ -69,7 +70,7 @@ public: * @param osAccountUserId The local id of the created OS account. * @return error code, ERR_OK on success, others on failure. */ - ErrCode CreateOsAccount(const std::string &name, int32_t &osAccountUserId); + static ErrCode CreateOsAccount(const std::string &name, int32_t &osAccountUserId); /** * @brief Removes an OS account based on its local ID. @@ -77,7 +78,7 @@ public: * @param id The local ID of the OS account. * @return error code, ERR_OK on success, others on failure. */ - ErrCode RemoveOsAccount(const int id); + static ErrCode RemoveOsAccount(const int id); /** * @brief Get the current active user ID. diff --git a/interfaces/inner_api/deps_wrapper/src/os_account_manager_wrapper.cpp b/interfaces/inner_api/deps_wrapper/src/os_account_manager_wrapper.cpp index 388620c093..30db16d96e 100644 --- a/interfaces/inner_api/deps_wrapper/src/os_account_manager_wrapper.cpp +++ b/interfaces/inner_api/deps_wrapper/src/os_account_manager_wrapper.cpp @@ -108,13 +108,7 @@ ErrCode OsAccountManagerWrapper::RemoveOsAccount(const int id) int32_t OsAccountManagerWrapper::GetCurrentActiveAccountId() { std::vector accountIds; - auto instance = DelayedSingleton::GetInstance(); - if (instance == nullptr) { - TAG_LOGE(AAFwkTag::DEFAULT, "Get OsAccountManager Failed"); - return 0; - } - - ErrCode ret = instance->QueryActiveOsAccountIds(accountIds); + ErrCode ret = QueryActiveOsAccountIds(accountIds); if (ret != ERR_OK) { TAG_LOGE(AAFwkTag::DEFAULT, "Query active id failed. ret: %{public}d", ret); return 0; diff --git a/interfaces/inner_api/error_utils/BUILD.gn b/interfaces/inner_api/error_utils/BUILD.gn index 7b6a188f87..5b0c7d7236 100644 --- a/interfaces/inner_api/error_utils/BUILD.gn +++ b/interfaces/inner_api/error_utils/BUILD.gn @@ -28,6 +28,12 @@ config("error_utils_config") { ohos_shared_library("ability_runtime_error_util") { branch_protector_ret = "pac_ret" + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + } + sources = [ "src/ability_runtime_error_util.cpp" ] public_configs = [ ":error_utils_config" ] diff --git a/interfaces/inner_api/napi_base_context/BUILD.gn b/interfaces/inner_api/napi_base_context/BUILD.gn index d8de1c399e..d159da42b8 100644 --- a/interfaces/inner_api/napi_base_context/BUILD.gn +++ b/interfaces/inner_api/napi_base_context/BUILD.gn @@ -19,6 +19,8 @@ config("napi_context_base_public_config") { } ohos_shared_library("napi_base_context") { + branch_protector_ret = "pac_ret" + sources = [ "src/napi_base_context.cpp" ] configs = [] diff --git a/interfaces/inner_api/quick_fix/BUILD.gn b/interfaces/inner_api/quick_fix/BUILD.gn index 9a0ceb0132..d832f21c8a 100644 --- a/interfaces/inner_api/quick_fix/BUILD.gn +++ b/interfaces/inner_api/quick_fix/BUILD.gn @@ -41,6 +41,14 @@ config("quickfix_config") { } ohos_shared_library("quickfix_manager") { + branch_protector_ret = "pac_ret" + + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + } + include_dirs = [ "${ability_runtime_path}/interfaces/kits/native/appkit/ability_bundle_manager_helper" ] configs = [ "${ability_runtime_services_path}/common:common_config", diff --git a/interfaces/inner_api/runtime/BUILD.gn b/interfaces/inner_api/runtime/BUILD.gn index f3f41f3749..ddcea81dfb 100644 --- a/interfaces/inner_api/runtime/BUILD.gn +++ b/interfaces/inner_api/runtime/BUILD.gn @@ -50,6 +50,16 @@ config("runtime_all_deps_config") { ohos_shared_library("runtime") { branch_protector_ret = "pac_ret" + sanitize = { + integer_overflow = true + ubsan = true + boundary_sanitize = true + cfi = true + cfi_cross_dso = true + cfi_vcall_icall_only = true + cfi_policy = "adaptive" + debug = false + } include_dirs = [ "${ability_runtime_path}/ets_environment/interfaces/inner_api", diff --git a/interfaces/inner_api/session_handler/BUILD.gn b/interfaces/inner_api/session_handler/BUILD.gn index 264abf10b1..5e95b7a4a8 100644 --- a/interfaces/inner_api/session_handler/BUILD.gn +++ b/interfaces/inner_api/session_handler/BUILD.gn @@ -34,6 +34,12 @@ config("session_handler_config") { ohos_shared_library("session_handler") { branch_protector_ret = "pac_ret" + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + } + sources = [ "src/session_handler_proxy.cpp", "src/session_handler_stub.cpp", diff --git a/js_environment/frameworks/js_environment/BUILD.gn b/js_environment/frameworks/js_environment/BUILD.gn index bbc4380620..e2c1aa6f9e 100644 --- a/js_environment/frameworks/js_environment/BUILD.gn +++ b/js_environment/frameworks/js_environment/BUILD.gn @@ -30,6 +30,12 @@ config("public_js_environment_config") { ohos_shared_library("js_environment") { branch_protector_ret = "pac_ret" + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + } + sources = [ "${utils_path}/src/js_env_logger.cpp", "src/js_environment.cpp", diff --git a/service_router_framework/interfaces/inner_api/BUILD.gn b/service_router_framework/interfaces/inner_api/BUILD.gn index 73297cbccb..863069a6ff 100755 --- a/service_router_framework/interfaces/inner_api/BUILD.gn +++ b/service_router_framework/interfaces/inner_api/BUILD.gn @@ -32,6 +32,8 @@ config("srms_fwk_config") { } ohos_source_set("service_router_mgr_proxy") { + branch_protector_ret = "pac_ret" + sanitize = { cfi = true cfi_cross_dso = true @@ -57,6 +59,8 @@ ohos_source_set("service_router_mgr_proxy") { } ohos_source_set("service_router_mgr_stub") { + branch_protector_ret = "pac_ret" + sanitize = { cfi = true cfi_cross_dso = true @@ -85,6 +89,8 @@ ohos_source_set("service_router_mgr_stub") { } ohos_shared_library("srms_fwk") { + branch_protector_ret = "pac_ret" + sanitize = { cfi = true cfi_cross_dso = true diff --git a/services/abilitymgr/src/ability_manager_service.cpp b/services/abilitymgr/src/ability_manager_service.cpp index 42f85e3a9e..0aa297fadc 100644 --- a/services/abilitymgr/src/ability_manager_service.cpp +++ b/services/abilitymgr/src/ability_manager_service.cpp @@ -6940,7 +6940,7 @@ sptr AbilityManagerService::GetWantSenderByUserId(const WantSenderI appIndex = wantSenderInfo.appIndex; appUid = (uid >= 0) ? uid : GetUidByCloneBundleInfo(bundleName, callerUid, userId, appIndex); } else if (uid >= 0) { - if (DelayedSingleton::GetInstance()-> + if (AppExecFwk::OsAccountManagerWrapper:: GetOsAccountLocalIdFromUid(callerUid, userId) != 0) { TAG_LOGE(AAFwkTag::WANTAGENT, "getOsAccountLocalIdFromUid failed uid=%{public}d", callerUid); return nullptr; @@ -6990,7 +6990,7 @@ sptr AbilityManagerService::GetWantSender( CHECK_POINTER_AND_RETURN(bms, nullptr); int32_t bundleMgrResult = 0; - if (DelayedSingleton::GetInstance()-> + if (AppExecFwk::OsAccountManagerWrapper:: GetOsAccountLocalIdFromUid(callerUid, userId) != 0) { TAG_LOGE(AAFwkTag::WANTAGENT, "getOsAccountLocalIdFromUid failed uid=%{public}d", callerUid); return nullptr; @@ -13785,7 +13785,7 @@ int AbilityManagerService::VerifyPermission(const std::string &permission, int p } int account = -1; - DelayedSingleton::GetInstance()->GetOsAccountLocalIdFromUid(uid, account); + AppExecFwk::OsAccountManagerWrapper::GetOsAccountLocalIdFromUid(uid, account); TAG_LOGD(AAFwkTag::ABILITYMGR, "bundleName: %{public}s, account: %{private}d", bundleName.c_str(), account); AppExecFwk::ApplicationInfo appInfo; if (!IN_PROCESS_CALL(bms->GetApplicationInfo(bundleName, AppExecFwk::BundleFlag::GET_BUNDLE_DEFAULT, @@ -14093,8 +14093,7 @@ bool AbilityManagerService::ProcessLowMemoryKill(int32_t pid, const ExitReason & bool AbilityManagerService::ProcessLowMemoryKillUIExtension(int32_t pid, int32_t uid) { int32_t userId = INVALID_USER_ID; - auto ret = DelayedSingleton::GetInstance() - ->GetOsAccountLocalIdFromUid(uid, userId); + auto ret = AppExecFwk::OsAccountManagerWrapper::GetOsAccountLocalIdFromUid(uid, userId); if (ret == 0) { auto uiExtManager = GetUIExtensionAbilityManagerByUserId(userId); if (uiExtManager != nullptr && uiExtManager->IsUIExtensionStarting(uid, pid)) { diff --git a/services/abilitymgr/src/ability_record.cpp b/services/abilitymgr/src/ability_record.cpp index 680e99fd2d..fcd06173a3 100644 --- a/services/abilitymgr/src/ability_record.cpp +++ b/services/abilitymgr/src/ability_record.cpp @@ -2967,7 +2967,7 @@ void AbilityRecord::NotifyMissionBindPid() int32_t AbilityRecord::GetCurrentAccountId() const { std::vector osActiveAccountIds; - ErrCode ret = DelayedSingleton::GetInstance()-> + ErrCode ret = AppExecFwk::OsAccountManagerWrapper:: QueryActiveOsAccountIds(osActiveAccountIds); if (ret != ERR_OK) { TAG_LOGE(AAFwkTag::ABILITYMGR, "queryActiveOsAccountIds failed"); diff --git a/services/abilitymgr/src/app_exit_reason_data_manager.cpp b/services/abilitymgr/src/app_exit_reason_data_manager.cpp index 50eb3a14b0..ad06a33203 100644 --- a/services/abilitymgr/src/app_exit_reason_data_manager.cpp +++ b/services/abilitymgr/src/app_exit_reason_data_manager.cpp @@ -133,7 +133,7 @@ int32_t AppExitReasonDataManager::SetAppExitReason(const std::string &bundleName int32_t AppExitReasonDataManager::DeleteAppExitReason(const std::string &bundleName, int32_t uid, int32_t appIndex) { int32_t userId; - if (DelayedSingleton::GetInstance()-> + if (AppExecFwk::OsAccountManagerWrapper:: GetOsAccountLocalIdFromUid(uid, userId) != ERR_OK) { TAG_LOGE(AAFwkTag::ABILITYMGR, "get GetOsAccountLocalIdFromUid failed"); return ERR_INVALID_VALUE; diff --git a/services/abilitymgr/src/app_exit_reason_helper.cpp b/services/abilitymgr/src/app_exit_reason_helper.cpp index 1d29b261d5..f97f989ab0 100644 --- a/services/abilitymgr/src/app_exit_reason_helper.cpp +++ b/services/abilitymgr/src/app_exit_reason_helper.cpp @@ -47,7 +47,7 @@ int32_t AppExitReasonHelper::RecordAppWithReason(int32_t pid, int32_t uid, const TAG_LOGE(AAFwkTag::ABILITYMGR, "GetNameAndIndexForUid failed, ret: %{public}d", ret); return ret; } - int32_t getOsAccountRet = DelayedSingleton::GetInstance()-> + int32_t getOsAccountRet = AppExecFwk::OsAccountManagerWrapper:: GetOsAccountLocalIdFromUid(uid, userId); if (getOsAccountRet != ERR_OK) { TAG_LOGE(AAFwkTag::ABILITYMGR, "get GetOsAccountLocalIdFromUid failed. ret: %{public}d", getOsAccountRet); @@ -143,7 +143,7 @@ int32_t AppExitReasonHelper::RecordAppExitReason(const ExitReason &exitReason) int32_t pid = exitReason.reason != Reason::REASON_CPP_CRASH ? IPCSkeleton::GetCallingPid() : NO_PID; AppExecFwk::RunningProcessInfo processInfo; int32_t userId = -1; - int32_t getOsAccountRet = DelayedSingleton::GetInstance()-> + int32_t getOsAccountRet = AppExecFwk::OsAccountManagerWrapper:: GetOsAccountLocalIdFromUid(uid, userId); GetRunningProcessInfo(pid, userId, bundleName, processInfo); int32_t resultCode = RecordProcessExtensionExitReason(pid, bundleName, exitReason, processInfo, false); @@ -195,7 +195,7 @@ int32_t AppExitReasonHelper::RecordProcessExitReasonForTimeout(const AppExecFwk: } int32_t targetUserId; - int32_t getOsAccountRet = DelayedSingleton::GetInstance()-> + int32_t getOsAccountRet = AppExecFwk::OsAccountManagerWrapper:: GetOsAccountLocalIdFromUid(uid, targetUserId); if (getOsAccountRet != ERR_OK) { TAG_LOGE(AAFwkTag::ABILITYMGR, "get GetOsAccountLocalIdFromUid failed. ret: %{public}d", getOsAccountRet); @@ -249,7 +249,7 @@ int32_t AppExitReasonHelper::RecordAppExitReason(const std::string &bundleName, const ExitReason &exitReason) { int32_t userId; - int32_t getOsAccountRet = DelayedSingleton::GetInstance()-> + int32_t getOsAccountRet = AppExecFwk::OsAccountManagerWrapper:: GetOsAccountLocalIdFromUid(uid, userId); if (getOsAccountRet != ERR_OK) { TAG_LOGE(AAFwkTag::ABILITYMGR, "get GetOsAccountLocalIdFromUid failed. ret: %{public}d", getOsAccountRet); @@ -287,7 +287,7 @@ int32_t AppExitReasonHelper::RecordProcessExitReason(const int32_t pid, const st } int32_t targetUserId; - int32_t getOsAccountRet = DelayedSingleton::GetInstance()-> + int32_t getOsAccountRet = AppExecFwk::OsAccountManagerWrapper:: GetOsAccountLocalIdFromUid(uid, targetUserId); if (getOsAccountRet != ERR_OK) { TAG_LOGE(AAFwkTag::ABILITYMGR, "get GetOsAccountLocalIdFromUid failed. ret: %{public}d", getOsAccountRet); @@ -364,7 +364,7 @@ int32_t AppExitReasonHelper::AddAppExitReason(const std::string &bundleName, int const ExitReasonCompability &exitReason) { int32_t userId = -1; - int32_t getOsAccountRet = DelayedSingleton::GetInstance()-> + int32_t getOsAccountRet = AppExecFwk::OsAccountManagerWrapper:: GetOsAccountLocalIdFromUid(uid, userId); if (getOsAccountRet != ERR_OK) { TAG_LOGE(AAFwkTag::ABILITYMGR, "get GetOsAccountLocalIdFromUid failed. ret: %{public}d", getOsAccountRet); @@ -425,7 +425,7 @@ void AppExitReasonHelper::GetActiveAbilityList(int32_t uid, std::vector::GetInstance()-> + int32_t getOsAccountRet = AppExecFwk::OsAccountManagerWrapper:: GetOsAccountLocalIdFromUid(uid, targetUserId); if (getOsAccountRet != ERR_OK) { TAG_LOGE(AAFwkTag::ABILITYMGR, "get GetOsAccountLocalIdFromUid failed. ret: %{public}d", getOsAccountRet); @@ -456,7 +456,7 @@ void AppExitReasonHelper::GetActiveAbilityListFromUIAbilityManager(int32_t uid, { CHECK_POINTER(subManagersHelper_); int32_t targetUserId; - int32_t getOsAccountRet = DelayedSingleton::GetInstance()-> + int32_t getOsAccountRet = AppExecFwk::OsAccountManagerWrapper:: GetOsAccountLocalIdFromUid(uid, targetUserId); if (getOsAccountRet != ERR_OK) { TAG_LOGE(AAFwkTag::ABILITYMGR, "get GetOsAccountLocalIdFromUid failed. ret: %{public}d", getOsAccountRet); diff --git a/services/abilitymgr/src/modular_object_utils.cpp b/services/abilitymgr/src/modular_object_utils.cpp index f3cb0b2e9a..6b23c3146a 100644 --- a/services/abilitymgr/src/modular_object_utils.cpp +++ b/services/abilitymgr/src/modular_object_utils.cpp @@ -274,8 +274,7 @@ int32_t ModularObjectUtils::GetCallerAppInfo(AppExecFwk::ApplicationInfo &caller return INNER_ERR; } int32_t callerUserId = -1; - auto osAccountRet = DelayedSingleton::GetInstance() - ->GetOsAccountLocalIdFromUid(callingUid, callerUserId); + auto osAccountRet = AppExecFwk::OsAccountManagerWrapper::GetOsAccountLocalIdFromUid(callingUid, callerUserId); if (osAccountRet != 0) { TAG_LOGE(AAFwkTag::EXT, "getUserId fail, callingUid: %{public}d, ret:%{public}d", callingUid, osAccountRet); return INNER_ERR; diff --git a/services/abilitymgr/src/sub_managers_helper.cpp b/services/abilitymgr/src/sub_managers_helper.cpp index 8f21031037..302980bce5 100644 --- a/services/abilitymgr/src/sub_managers_helper.cpp +++ b/services/abilitymgr/src/sub_managers_helper.cpp @@ -439,7 +439,7 @@ std::shared_ptr SubManagersHelper::GetMissionListMa { int32_t userId = INVALID_USER_ID; int32_t getOsAccountRet = - DelayedSingleton::GetInstance()->GetOsAccountLocalIdFromUid(uid, userId); + AppExecFwk::OsAccountManagerWrapper::GetOsAccountLocalIdFromUid(uid, userId); if (getOsAccountRet != 0) { TAG_LOGE(AAFwkTag::ABILITYMGR, "GetOsAccountLocalIdFromUid() failed. ret: %{public}d", getOsAccountRet); return nullptr; @@ -479,7 +479,7 @@ std::shared_ptr SubManagersHelper::GetUIAbilityManage { int32_t userId = INVALID_USER_ID; int32_t getOsAccountRet = - DelayedSingleton::GetInstance()->GetOsAccountLocalIdFromUid(uid, userId); + AppExecFwk::OsAccountManagerWrapper::GetOsAccountLocalIdFromUid(uid, userId); if (getOsAccountRet != 0) { TAG_LOGE(AAFwkTag::ABILITYMGR, "GetOsAccountLocalIdFromUid() failed. ret: %{public}d", getOsAccountRet); return nullptr; @@ -496,7 +496,7 @@ void SubManagersHelper::UninstallApp(const std::string &bundleName, int32_t uid) { int32_t userId = INVALID_USER_ID; int32_t getOsAccountRet = - DelayedSingleton::GetInstance()->GetOsAccountLocalIdFromUid(uid, userId); + AppExecFwk::OsAccountManagerWrapper::GetOsAccountLocalIdFromUid(uid, userId); if (getOsAccountRet != 0) { TAG_LOGE(AAFwkTag::ABILITYMGR, "GetOsAccountLocalIdFromUid() failed. ret: %{public}d", getOsAccountRet); return; diff --git a/services/appmgr/src/app_mgr_service_inner.cpp b/services/appmgr/src/app_mgr_service_inner.cpp index 823652ba65..ec28e68e6b 100644 --- a/services/appmgr/src/app_mgr_service_inner.cpp +++ b/services/appmgr/src/app_mgr_service_inner.cpp @@ -8587,12 +8587,7 @@ int AppMgrServiceInner::StartRenderProcessImpl(const std::shared_ptr::GetInstance(); - if (osAccountMgr == nullptr) { - TAG_LOGE(AAFwkTag::APPMGR, "osAccountMgr is nullptr"); - return ERR_INVALID_VALUE; - } - int32_t errCode = osAccountMgr->GetOsAccountLocalIdFromUid(appRecord->GetUid(), userId); + int32_t errCode = OsAccountManagerWrapper::GetOsAccountLocalIdFromUid(appRecord->GetUid(), userId); if (errCode != ERR_OK) { TAG_LOGE(AAFwkTag::APPMGR, "GetOsAccountLocalIdFromUid failed,errcode=%{public}d", errCode); return errCode; @@ -10825,12 +10820,7 @@ int32_t AppMgrServiceInner::StartChildProcessImpl(const std::shared_ptr::GetInstance(); - if (osAccountMgr == nullptr) { - TAG_LOGE(AAFwkTag::APPMGR, "osAccountMgr is nullptr"); - return ERR_INVALID_VALUE; - } - int32_t errCode = osAccountMgr->GetOsAccountLocalIdFromUid(appRecord->GetUid(), userId); + int32_t errCode = OsAccountManagerWrapper::GetOsAccountLocalIdFromUid(appRecord->GetUid(), userId); if (errCode != ERR_OK) { TAG_LOGE(AAFwkTag::APPMGR, "GetOsAccountLocalIdFromUid failed,errcode=%{public}d", errCode); return errCode; @@ -10948,13 +10938,8 @@ int32_t AppMgrServiceInner::GetChildProcessInfoEx(const std::shared_ptr::GetInstance(); - if (osAccountMgr == nullptr) { - TAG_LOGE(AAFwkTag::APPMGR, "osAccountMgr is nullptr"); - return ERR_INVALID_VALUE; - } int32_t userId = -1; - errCode = osAccountMgr->GetOsAccountLocalIdFromUid(appRecord->GetUid(), userId); + errCode = OsAccountManagerWrapper::GetOsAccountLocalIdFromUid(appRecord->GetUid(), userId); if (errCode != ERR_OK) { TAG_LOGE(AAFwkTag::APPMGR, "GetOsAccountLocalIdFromUid failed,errcode=%{public}d", errCode); return errCode; @@ -11005,13 +10990,8 @@ int32_t AppMgrServiceInner::GetChildProcessInfo(const std::shared_ptr::GetInstance(); - if (osAccountMgr == nullptr) { - TAG_LOGE(AAFwkTag::APPMGR, "osAccountMgr is nullptr"); - return ERR_INVALID_VALUE; - } int32_t userId = -1; - int errCode = osAccountMgr->GetOsAccountLocalIdFromUid(appRecord->GetUid(), userId); + int errCode = OsAccountManagerWrapper::GetOsAccountLocalIdFromUid(appRecord->GetUid(), userId); if (errCode != ERR_OK) { TAG_LOGE(AAFwkTag::APPMGR, "GetOsAccountLocalIdFromUid failed,errcode=%{public}d", errCode); return errCode; @@ -12453,14 +12433,13 @@ int32_t AppMgrServiceInner::GetSupportedProcessCachePids(const std::string &bund std::vector &pidList) { auto cachePrcoMgr = DelayedSingleton::GetInstance(); - auto osAccountMgr = DelayedSingleton::GetInstance(); - if (cachePrcoMgr == nullptr || osAccountMgr == nullptr || appRunningManager_ == nullptr) { + if (cachePrcoMgr == nullptr || appRunningManager_ == nullptr) { TAG_LOGE(AAFwkTag::APPMGR, "inner manager null"); return AAFwk::INNER_ERR; } pidList.clear(); int32_t callderUserId = -1; - int32_t getOsAccountRet = osAccountMgr->GetOsAccountLocalIdFromUid(IPCSkeleton::GetCallingUid(), callderUserId); + int32_t getOsAccountRet = OsAccountManagerWrapper::GetOsAccountLocalIdFromUid(IPCSkeleton::GetCallingUid(), callderUserId); if (getOsAccountRet != 0) { TAG_LOGE(AAFwkTag::APPMGR, "get caller local id fail. ret: %{public}d", getOsAccountRet); return AAFwk::INNER_ERR; @@ -12472,7 +12451,7 @@ int32_t AppMgrServiceInner::GetSupportedProcessCachePids(const std::string &bund continue; } int32_t procUserId = -1; - int32_t procGetOsAccountRet = osAccountMgr->GetOsAccountLocalIdFromUid(appRecord->GetUid(), procUserId); + int32_t procGetOsAccountRet = OsAccountManagerWrapper::GetOsAccountLocalIdFromUid(appRecord->GetUid(), procUserId); if (appRecord->GetBundleName() == bundleName && procGetOsAccountRet == 0 && procUserId == callderUserId && cachePrcoMgr->IsAppSupportProcessCache(appRecord) && appRecord->GetPriorityObject() != nullptr) { diff --git a/services/appmgr/src/app_running_manager.cpp b/services/appmgr/src/app_running_manager.cpp index ed37130026..971d52e2be 100644 --- a/services/appmgr/src/app_running_manager.cpp +++ b/services/appmgr/src/app_running_manager.cpp @@ -519,7 +519,7 @@ bool AppRunningManager::GetPidsByUserId(int32_t userId, std::list &pids) const auto &appRecord = item.second; if (appRecord) { int32_t id = -1; - if ((DelayedSingleton::GetInstance()-> + if ((OsAccountManagerWrapper:: GetOsAccountLocalIdFromUid(appRecord->GetUid(), id) == 0) && (id == userId)) { TAG_LOGD(AAFwkTag::APPMGR, "GetOsAccountLocalIdFromUid id: %{public}d", id); pid_t pid = appRecord->GetPid(); @@ -543,7 +543,7 @@ bool AppRunningManager::GetProcessInfosByUserId(int32_t userId, std::list::GetInstance()-> + if ((OsAccountManagerWrapper:: GetOsAccountLocalIdFromUid(appRecord->GetUid(), id) == 0) && (id == userId)) { TAG_LOGD(AAFwkTag::APPMGR, "GetOsAccountLocalIdFromUid id: %{public}d", id); pid_t pid = appRecord->GetPid(); diff --git a/services/appmgr/src/app_spawn_client.cpp b/services/appmgr/src/app_spawn_client.cpp index 5d54c67d3c..d04454adae 100644 --- a/services/appmgr/src/app_spawn_client.cpp +++ b/services/appmgr/src/app_spawn_client.cpp @@ -465,14 +465,8 @@ int32_t AppSpawnClient::SetUserIdInfo(const AppSpawnStartMsg &startMsg, AppSpawn if (startMsg.uid < 0) { return ERR_INVALID_VALUE; } - auto osAccountMgr = DelayedSingleton::GetInstance(); - if (osAccountMgr == nullptr) { - TAG_LOGW(AAFwkTag::APPMGR, "osAccountMgr is nullptr"); - return ERR_NULL_OBJECT; - } - int32_t userId = -1; - auto errCode = osAccountMgr->GetOsAccountLocalIdFromUid(startMsg.uid, userId); + auto errCode = OsAccountManagerWrapper::GetOsAccountLocalIdFromUid(startMsg.uid, userId); if (errCode != ERR_OK) { TAG_LOGW(AAFwkTag::APPMGR, "GetOsAccountLocalIdFromUid failed, uid=%{public}d, errcode=%{public}d", startMsg.uid, errCode); diff --git a/services/common/BUILD.gn b/services/common/BUILD.gn index a140289713..06c2a4bb90 100644 --- a/services/common/BUILD.gn +++ b/services/common/BUILD.gn @@ -107,6 +107,11 @@ config("tdd_config") { #build so ohos_shared_library("perm_verification") { branch_protector_ret = "pac_ret" + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + } include_dirs = [ "${ability_runtime_utils_path}/server/constant" ] @@ -183,6 +188,11 @@ ohos_static_library("perm_verification_static") { ohos_shared_library("task_handler_wrap") { branch_protector_ret = "pac_ret" + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + } configs = [ "${ability_runtime_services_path}/common:optimize_config" ] public_configs = [ ":common_config" ] @@ -290,6 +300,11 @@ ohos_static_library("hisysevent_report_static") { ohos_shared_library("app_util") { branch_protector_ret = "pac_ret" + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + } configs = [ "${ability_runtime_services_path}/common:optimize_config" ] public_configs = [ ":common_config" ] diff --git a/services/common/src/user_controller/user_controller.cpp b/services/common/src/user_controller/user_controller.cpp index 4f07720ff2..1b4be731f7 100644 --- a/services/common/src/user_controller/user_controller.cpp +++ b/services/common/src/user_controller/user_controller.cpp @@ -145,7 +145,7 @@ void UserController::SetFreezingNewUserId(int32_t userId) bool UserController::IsExistOsAccount(int32_t userId) const { bool isExist = false; - auto errCode = DelayedSingleton::GetInstance()->IsOsAccountExists(userId, + auto errCode = AppExecFwk::OsAccountManagerWrapper::IsOsAccountExists(userId, isExist); return (errCode == 0) && isExist; } diff --git a/services/quickfixmgr/BUILD.gn b/services/quickfixmgr/BUILD.gn index d845102734..1456700fe7 100644 --- a/services/quickfixmgr/BUILD.gn +++ b/services/quickfixmgr/BUILD.gn @@ -88,6 +88,12 @@ ohos_shared_library("quickfixms") { # Note: Just for test ohos_static_library("quickfixms_static") { + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + } + branch_protector_ret = "pac_ret" include_dirs = [ "${ability_runtime_path}/interfaces/kits/native/appkit/ability_bundle_manager_helper" ] configs = [ "${ability_runtime_services_path}/common:common_config" ] public_configs = [ ":quickfixms_config" ] diff --git a/services/uripermmgr/src/file_uri_distribution_utils.cpp b/services/uripermmgr/src/file_uri_distribution_utils.cpp index 47f0ad73d1..c1c4a89008 100644 --- a/services/uripermmgr/src/file_uri_distribution_utils.cpp +++ b/services/uripermmgr/src/file_uri_distribution_utils.cpp @@ -110,7 +110,7 @@ bool FUDUtils::CheckAndCreateEventInfo(uint32_t callerTokenId, uint32_t targetTo int32_t FUDUtils::GetCurrentAccountId() { std::vector osActiveAccountIds; - auto ret = DelayedSingleton::GetInstance()->QueryActiveOsAccountIds( + auto ret = AppExecFwk::OsAccountManagerWrapper::QueryActiveOsAccountIds( osActiveAccountIds); if (ret != ERR_OK) { TAG_LOGE(AAFwkTag::URIPERMMGR, "QueryActiveOsAccountIds error. ret: %{public}d", ret); diff --git a/test/moduletest/mission_dump_test/BUILD.gn b/test/moduletest/mission_dump_test/BUILD.gn index 9fe701d847..c521a24b14 100644 --- a/test/moduletest/mission_dump_test/BUILD.gn +++ b/test/moduletest/mission_dump_test/BUILD.gn @@ -17,6 +17,13 @@ import("//foundation/ability/ability_runtime/ability_runtime.gni") module_output_path = "ability_runtime/ability_runtime/mstabilitymgrservice" ohos_moduletest("mission_dump_test") { + branch_protector_ret = "pac_ret" + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + } + module_out_path = module_output_path include_dirs = [ diff --git a/test/moduletest/quick_fix/quick_fix_manager_module_test/BUILD.gn b/test/moduletest/quick_fix/quick_fix_manager_module_test/BUILD.gn index ee5242505d..659816ca08 100644 --- a/test/moduletest/quick_fix/quick_fix_manager_module_test/BUILD.gn +++ b/test/moduletest/quick_fix/quick_fix_manager_module_test/BUILD.gn @@ -16,6 +16,13 @@ import("//build/test.gni") import("//foundation/ability/ability_runtime/ability_runtime.gni") ohos_moduletest("quick_fix_manager_module_test") { + branch_protector_ret = "pac_ret" + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + } + module_out_path = "ability_runtime/ability_runtime/quick_fix" include_dirs = [ diff --git a/test/new_test/mock/os_account_manager_wrapper/os_account_manager_wrapper.h b/test/new_test/mock/os_account_manager_wrapper/os_account_manager_wrapper.h index 0831aad853..3a714d7fba 100644 --- a/test/new_test/mock/os_account_manager_wrapper/os_account_manager_wrapper.h +++ b/test/new_test/mock/os_account_manager_wrapper/os_account_manager_wrapper.h @@ -17,19 +17,18 @@ #define MOCK_OHOS_ABILITY_RUNTIME_OS_ACCOUNT_MANAGER_WRAPPER_H #include "errors.h" -#include "singleton.h" #include "oh_mock_utils.h" namespace OHOS { namespace AppExecFwk { -class OsAccountManagerWrapper : public DelayedSingleton { +class OsAccountManagerWrapper { public: - ErrCode GetOsAccountLocalIdFromUid(const int32_t uid, int32_t &id) + static ErrCode GetOsAccountLocalIdFromUid(const int32_t uid, int32_t &id) { return 0; } - OH_MOCK_METHOD_WITH_OUTPUT_1(ErrCode, isOsAccountExists, OsAccountManagerWrapper, + OH_MOCK_METHOD_WITH_DECORATOR_AND_OUTPUT_1(static, ErrCode, isOsAccountExists, OsAccountManagerWrapper, IsOsAccountExists, const int, bool& isOsAccountExists); }; } // namespace AppExecFwk diff --git a/test/unittest/ability_background_connection_test/BUILD.gn b/test/unittest/ability_background_connection_test/BUILD.gn index 92d1d9c664..da50426d4c 100644 --- a/test/unittest/ability_background_connection_test/BUILD.gn +++ b/test/unittest/ability_background_connection_test/BUILD.gn @@ -49,7 +49,6 @@ ohos_unittest("ability_background_connection_test") { "${ability_runtime_services_path}/common:app_util", "${ability_runtime_services_path}/common:perm_verification", "${ability_runtime_services_path}/common:task_handler_wrap", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", ] external_deps = [ @@ -68,6 +67,7 @@ ohos_unittest("ability_background_connection_test") { "hisysevent:libhisysevent", "init:libbeget_proxy", "init:libbegetutil", + "ipc:ipc_single", "kv_store:distributeddata_inner", "window_manager:libwsutils", "window_manager:sms", diff --git a/test/unittest/ability_bundle_event_callback_test/BUILD.gn b/test/unittest/ability_bundle_event_callback_test/BUILD.gn index b6204a1261..3ccef3bdd0 100644 --- a/test/unittest/ability_bundle_event_callback_test/BUILD.gn +++ b/test/unittest/ability_bundle_event_callback_test/BUILD.gn @@ -51,16 +51,16 @@ ohos_unittest("ability_bundle_event_callback_test") { 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}/ability/native:auto_startup_callback", "${ability_runtime_native_path}/appkit:appkit_manager_helper", "${ability_runtime_services_path}/abilitymgr:abilityms", - "${cli_tool_framework_path}/interfaces/cli_tool:cli_tool_client", "${ability_runtime_services_path}/common:app_util", "${ability_runtime_services_path}/common:perm_verification", "${ability_runtime_services_path}/common:task_handler_wrap", "${ability_runtime_services_path}/common:user_controller", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", + "${cli_tool_framework_path}/interfaces/cli_tool:cli_tool_client", ] external_deps = [ @@ -84,6 +84,7 @@ ohos_unittest("ability_bundle_event_callback_test") { "image_framework:image_native", "init:libbeget_proxy", "init:libbegetutil", + "ipc:ipc_single", "json:nlohmann_json_static", "kv_store:distributeddata_inner", "safwk:api_cache_manager", diff --git a/test/unittest/ability_cache_manager_test/BUILD.gn b/test/unittest/ability_cache_manager_test/BUILD.gn index bb75a9fe35..e1eeb122e8 100644 --- a/test/unittest/ability_cache_manager_test/BUILD.gn +++ b/test/unittest/ability_cache_manager_test/BUILD.gn @@ -51,7 +51,6 @@ ohos_unittest("ability_cache_manager_test") { "${ability_runtime_services_path}/common:perm_verification", "${ability_runtime_services_path}/common:task_handler_wrap", "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] diff --git a/test/unittest/ability_connect_callback_proxy_test/BUILD.gn b/test/unittest/ability_connect_callback_proxy_test/BUILD.gn index e21a8de939..5dfabbfe58 100644 --- a/test/unittest/ability_connect_callback_proxy_test/BUILD.gn +++ b/test/unittest/ability_connect_callback_proxy_test/BUILD.gn @@ -37,14 +37,12 @@ ohos_unittest("ability_connect_callback_proxy_test") { deps = [ "${ability_runtime_innerkits_path}/ability_manager:ability_connect_callback_stub", "${ability_runtime_innerkits_path}/ability_manager:ability_manager", + "${ability_runtime_innerkits_path}/app_manager:app_manager", "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_native_path}/appkit:app_context_utils", "${ability_runtime_path}/services/abilitymgr:abilityms_target", "${ability_runtime_services_path}/abilitymgr:abilityms", "${ability_runtime_services_path}/common:perm_verification", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ diff --git a/test/unittest/ability_connect_callback_stub_test/BUILD.gn b/test/unittest/ability_connect_callback_stub_test/BUILD.gn index 9f1a27922c..c240abb33e 100644 --- a/test/unittest/ability_connect_callback_stub_test/BUILD.gn +++ b/test/unittest/ability_connect_callback_stub_test/BUILD.gn @@ -37,12 +37,10 @@ ohos_unittest("ability_connect_callback_stub_test") { deps = [ "${ability_runtime_innerkits_path}/ability_manager:ability_connect_callback_stub", "${ability_runtime_innerkits_path}/ability_manager:ability_manager", + "${ability_runtime_innerkits_path}/app_manager:app_manager", "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_services_path}/abilitymgr:abilityms", "${ability_runtime_services_path}/common:perm_verification", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ @@ -70,6 +68,13 @@ ohos_unittest("ability_connect_callback_stub_test") { } ohos_unittest("ability_connect_callback_recipient_test") { + branch_protector_ret = "pac_ret" + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + } + module_out_path = module_output_path include_dirs = [ "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/system_ability_mock" ] @@ -90,13 +95,11 @@ ohos_unittest("ability_connect_callback_recipient_test") { deps = [ "${ability_runtime_innerkits_path}/ability_manager:ability_connect_callback_stub", "${ability_runtime_innerkits_path}/ability_manager:ability_manager", + "${ability_runtime_innerkits_path}/app_manager:app_manager", "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_path}/services/abilitymgr:abilityms_target", "${ability_runtime_services_path}/abilitymgr:abilityms", "${ability_runtime_services_path}/common:perm_verification", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ diff --git a/test/unittest/ability_connect_manager_first_test/BUILD.gn b/test/unittest/ability_connect_manager_first_test/BUILD.gn index 114822b559..56049cebe5 100644 --- a/test/unittest/ability_connect_manager_first_test/BUILD.gn +++ b/test/unittest/ability_connect_manager_first_test/BUILD.gn @@ -60,7 +60,6 @@ ohos_unittest("ability_connect_manager_first_test") { "${ability_runtime_services_path}/common:perm_verification", "${ability_runtime_services_path}/common:task_handler_wrap", "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] diff --git a/test/unittest/ability_connect_manager_fourth_test/BUILD.gn b/test/unittest/ability_connect_manager_fourth_test/BUILD.gn index 84a911e617..cebd21c5db 100644 --- a/test/unittest/ability_connect_manager_fourth_test/BUILD.gn +++ b/test/unittest/ability_connect_manager_fourth_test/BUILD.gn @@ -57,7 +57,6 @@ ohos_unittest("ability_connect_manager_fourth_test") { "${ability_runtime_services_path}/common:perm_verification", "${ability_runtime_services_path}/common:task_handler_wrap", "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] diff --git a/test/unittest/ability_connect_manager_second_test/BUILD.gn b/test/unittest/ability_connect_manager_second_test/BUILD.gn index 4b9b594cde..9ab0765534 100644 --- a/test/unittest/ability_connect_manager_second_test/BUILD.gn +++ b/test/unittest/ability_connect_manager_second_test/BUILD.gn @@ -49,9 +49,6 @@ ohos_unittest("ability_connect_manager_second_test") { "${ability_runtime_services_path}/abilitymgr:abilityms", "${ability_runtime_services_path}/common:perm_verification", "${ability_runtime_services_path}/common:task_handler_wrap", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ diff --git a/test/unittest/ability_connect_manager_test/BUILD.gn b/test/unittest/ability_connect_manager_test/BUILD.gn index 485ce42b94..bd8f851967 100644 --- a/test/unittest/ability_connect_manager_test/BUILD.gn +++ b/test/unittest/ability_connect_manager_test/BUILD.gn @@ -60,7 +60,6 @@ ohos_unittest("ability_connect_manager_test") { "${ability_runtime_services_path}/common:perm_verification", "${ability_runtime_services_path}/common:task_handler_wrap", "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] diff --git a/test/unittest/ability_event_handler_test/BUILD.gn b/test/unittest/ability_event_handler_test/BUILD.gn index 38533ec258..85e0dad327 100644 --- a/test/unittest/ability_event_handler_test/BUILD.gn +++ b/test/unittest/ability_event_handler_test/BUILD.gn @@ -36,13 +36,11 @@ ohos_unittest("ability_event_handler_test") { } deps = [ "${ability_runtime_innerkits_path}/ability_manager:ability_manager", + "${ability_runtime_innerkits_path}/app_manager:app_manager", "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_services_path}/abilitymgr:abilityms", "${ability_runtime_services_path}/common:perm_verification", "${ability_runtime_services_path}/common:task_handler_wrap", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ diff --git a/test/unittest/ability_extension_base_test/ability_extension_base_test.cpp b/test/unittest/ability_extension_base_test/ability_extension_base_test.cpp index 007cb2baac..904e652564 100644 --- a/test/unittest/ability_extension_base_test/ability_extension_base_test.cpp +++ b/test/unittest/ability_extension_base_test/ability_extension_base_test.cpp @@ -29,8 +29,6 @@ #include "mock_ability_token.h" #include "ohos_application.h" #include "extension_context.h" -#include "js_runtime.h" -#include "js_extension_common.h" #include "want.h" using namespace testing::ext; @@ -38,6 +36,12 @@ using OHOS::AppExecFwk::ElementName; namespace OHOS { namespace AbilityRuntime { +class MockExtensionCommon : public ExtensionCommon { +public: + void OnConfigurationUpdated(const std::shared_ptr &configuration) override {} + void OnMemoryLevel(int level) override {} +}; + class AbilityExtensionBaseTest : public testing::Test { public: static void SetUpTestCase(); @@ -232,11 +236,8 @@ HWTEST_F(AbilityExtensionBaseTest, SetExtensionCommon_0100, TestSize.Level1) ExtensionBase extensionBase; extensionBase.Init(record, application, handler, token); - Runtime::Options options; - std::unique_ptr jsRuntime = JsRuntime::Create(options); - std::unique_ptr jsObj; - extensionBase.SetExtensionCommon(JsExtensionCommon::Create( - static_cast(*jsRuntime), static_cast(*jsObj), nullptr)); + auto common = std::make_shared(); + extensionBase.SetExtensionCommon(common); EXPECT_NE(extensionBase.extensionCommon_, nullptr); TAG_LOGI(AAFwkTag::TEST, "SetExtensionCommon end"); diff --git a/test/unittest/ability_interceptor_second_test/BUILD.gn b/test/unittest/ability_interceptor_second_test/BUILD.gn index 0ffe2ad4f3..87d71ba9ab 100644 --- a/test/unittest/ability_interceptor_second_test/BUILD.gn +++ b/test/unittest/ability_interceptor_second_test/BUILD.gn @@ -53,8 +53,6 @@ ohos_unittest("ability_interceptor_second_test") { "${ability_runtime_services_path}/abilitymgr:abilityms", "${ability_runtime_services_path}/common:app_util", "${ability_runtime_services_path}/common:perm_verification", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] diff --git a/test/unittest/ability_interceptor_test/BUILD.gn b/test/unittest/ability_interceptor_test/BUILD.gn index 5e8e5abae0..dc9391b7a5 100644 --- a/test/unittest/ability_interceptor_test/BUILD.gn +++ b/test/unittest/ability_interceptor_test/BUILD.gn @@ -53,8 +53,6 @@ ohos_unittest("ability_interceptor_test") { "${ability_runtime_services_path}/abilitymgr:abilityms", "${ability_runtime_services_path}/common:app_util", "${ability_runtime_services_path}/common:perm_verification", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] diff --git a/test/unittest/ability_interceptor_third_test/BUILD.gn b/test/unittest/ability_interceptor_third_test/BUILD.gn index 980c5840e8..46891d698b 100644 --- a/test/unittest/ability_interceptor_third_test/BUILD.gn +++ b/test/unittest/ability_interceptor_third_test/BUILD.gn @@ -55,9 +55,6 @@ ohos_unittest("ability_interceptor_third_test") { "${ability_runtime_services_path}/common:app_util", "${ability_runtime_services_path}/common:perm_verification", "${ability_runtime_services_path}/common:task_handler_wrap", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ diff --git a/test/unittest/ability_manager_client_branch_second_test/BUILD.gn b/test/unittest/ability_manager_client_branch_second_test/BUILD.gn index e0bf190629..b5726b7fc7 100644 --- a/test/unittest/ability_manager_client_branch_second_test/BUILD.gn +++ b/test/unittest/ability_manager_client_branch_second_test/BUILD.gn @@ -46,8 +46,6 @@ ohos_unittest("ability_manager_client_branch_second_test") { "${ability_runtime_services_path}/abilitymgr:abilityms", "${ability_runtime_services_path}/common:perm_verification", "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ diff --git a/test/unittest/ability_manager_client_branch_test/BUILD.gn b/test/unittest/ability_manager_client_branch_test/BUILD.gn index 0fdef420d9..d39e252253 100644 --- a/test/unittest/ability_manager_client_branch_test/BUILD.gn +++ b/test/unittest/ability_manager_client_branch_test/BUILD.gn @@ -47,8 +47,6 @@ ohos_unittest("ability_manager_client_branch_test") { "${ability_runtime_services_path}/abilitymgr:abilityms", "${ability_runtime_services_path}/common:perm_verification", "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ diff --git a/test/unittest/ability_manager_client_branch_third_test/BUILD.gn b/test/unittest/ability_manager_client_branch_third_test/BUILD.gn index d978d28dc7..8e3c2bb065 100644 --- a/test/unittest/ability_manager_client_branch_third_test/BUILD.gn +++ b/test/unittest/ability_manager_client_branch_third_test/BUILD.gn @@ -51,8 +51,6 @@ ohos_unittest("ability_manager_client_branch_third_test") { "${ability_runtime_services_path}/abilitymgr:abilityms", "${ability_runtime_services_path}/common:perm_verification", "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ diff --git a/test/unittest/ability_manager_event_subscriber_test/BUILD.gn b/test/unittest/ability_manager_event_subscriber_test/BUILD.gn index 09e98b5ff0..6945d55c17 100644 --- a/test/unittest/ability_manager_event_subscriber_test/BUILD.gn +++ b/test/unittest/ability_manager_event_subscriber_test/BUILD.gn @@ -50,7 +50,6 @@ ohos_unittest("ability_manager_event_subscriber_test") { "${ability_runtime_services_path}/common:perm_verification", "${ability_runtime_services_path}/common:task_handler_wrap", "${ability_runtime_services_path}/common:user_controller", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", ] external_deps = [ diff --git a/test/unittest/ability_manager_proxy_fourth_test/BUILD.gn b/test/unittest/ability_manager_proxy_fourth_test/BUILD.gn index 2da3f2a974..5e4d626c4e 100644 --- a/test/unittest/ability_manager_proxy_fourth_test/BUILD.gn +++ b/test/unittest/ability_manager_proxy_fourth_test/BUILD.gn @@ -18,6 +18,12 @@ module_output_path = "ability_runtime/ability_runtime/abilitymgr" ohos_unittest("ability_manager_proxy_fourth_test") { module_out_path = module_output_path + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + blocklist = "../../cfi_blocklist.txt" + } include_dirs = [ "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/system_ability_mock", @@ -59,8 +65,6 @@ ohos_unittest("ability_manager_proxy_fourth_test") { "${ability_runtime_services_path}/abilitymgr:wantagent_manager", "${ability_runtime_services_path}/common:perm_verification", "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ diff --git a/test/unittest/ability_manager_proxy_second_test/BUILD.gn b/test/unittest/ability_manager_proxy_second_test/BUILD.gn index 3d141989af..eb198fc67a 100644 --- a/test/unittest/ability_manager_proxy_second_test/BUILD.gn +++ b/test/unittest/ability_manager_proxy_second_test/BUILD.gn @@ -57,8 +57,6 @@ ohos_unittest("ability_manager_proxy_second_test") { "${ability_runtime_services_path}/abilitymgr:wantagent_manager", "${ability_runtime_services_path}/common:perm_verification", "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ diff --git a/test/unittest/ability_manager_proxy_sixth_test/BUILD.gn b/test/unittest/ability_manager_proxy_sixth_test/BUILD.gn index c93ae61974..0ba14aab5b 100644 --- a/test/unittest/ability_manager_proxy_sixth_test/BUILD.gn +++ b/test/unittest/ability_manager_proxy_sixth_test/BUILD.gn @@ -57,8 +57,6 @@ ohos_unittest("ability_manager_proxy_sixth_test") { "${ability_runtime_services_path}/common:image_native_bridge", "${ability_runtime_services_path}/common:perm_verification", "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ diff --git a/test/unittest/ability_manager_proxy_test/BUILD.gn b/test/unittest/ability_manager_proxy_test/BUILD.gn index 59b5762b6b..2d651a699b 100644 --- a/test/unittest/ability_manager_proxy_test/BUILD.gn +++ b/test/unittest/ability_manager_proxy_test/BUILD.gn @@ -18,6 +18,12 @@ module_output_path = "ability_runtime/ability_runtime/abilitymgr" ohos_unittest("ability_manager_proxy_test") { module_out_path = module_output_path + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + blocklist = "../../cfi_blocklist.txt" + } include_dirs = [ "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/system_ability_mock", @@ -52,8 +58,6 @@ ohos_unittest("ability_manager_proxy_test") { "${ability_runtime_services_path}/abilitymgr:wantagent_manager", "${ability_runtime_services_path}/common:perm_verification", "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ diff --git a/test/unittest/ability_manager_proxy_third_test/BUILD.gn b/test/unittest/ability_manager_proxy_third_test/BUILD.gn index 5875173ca2..0856b1cdf5 100644 --- a/test/unittest/ability_manager_proxy_third_test/BUILD.gn +++ b/test/unittest/ability_manager_proxy_third_test/BUILD.gn @@ -56,8 +56,6 @@ ohos_unittest("ability_manager_proxy_third_test") { "${ability_runtime_services_path}/abilitymgr:wantagent_manager", "${ability_runtime_services_path}/common:perm_verification", "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ diff --git a/test/unittest/ability_manager_service_account_test/BUILD.gn b/test/unittest/ability_manager_service_account_test/BUILD.gn index 1c30fcd098..adab711b5e 100644 --- a/test/unittest/ability_manager_service_account_test/BUILD.gn +++ b/test/unittest/ability_manager_service_account_test/BUILD.gn @@ -17,6 +17,13 @@ import("//foundation/ability/ability_runtime/ability_runtime.gni") module_output_path = "ability_runtime/ability_runtime/abilitymgr" ohos_unittest("ability_manager_service_account_test") { + branch_protector_ret = "pac_ret" + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + } + module_out_path = module_output_path cflags_cc = [] include_dirs = [ diff --git a/test/unittest/ability_manager_service_account_test/ability_manager_service_account_test.cpp b/test/unittest/ability_manager_service_account_test/ability_manager_service_account_test.cpp index dd06b6bf37..d20151ee21 100644 --- a/test/unittest/ability_manager_service_account_test/ability_manager_service_account_test.cpp +++ b/test/unittest/ability_manager_service_account_test/ability_manager_service_account_test.cpp @@ -103,7 +103,7 @@ void AbilityManagerServiceAccountTest::SetUpTestCase() GTEST_LOG_(INFO) << "AbilityManagerServiceAccountTest SetUpTestCase called"; OHOS::DelayedSingleton::GetInstance()->RegisterSystemAbility( OHOS::BUNDLE_MGR_SERVICE_SYS_ABILITY_ID, new BundleMgrService()); - DelayedSingleton::GetInstance()-> + OsAccountManagerWrapper:: CreateOsAccount("testAccount", newUserId); abilityMs_ = OHOS::DelayedSingleton::GetInstance(); abilityMs_->OnStart(); @@ -117,7 +117,7 @@ void AbilityManagerServiceAccountTest::TearDownTestCase() abilityMs_->OnStop(); OHOS::DelayedSingleton::DestroyInstance(); OHOS::DelayedSingleton::DestroyInstance(); - DelayedSingleton::GetInstance()->RemoveOsAccount(newUserId); + OsAccountManagerWrapper::RemoveOsAccount(newUserId); } void AbilityManagerServiceAccountTest::SetUp() diff --git a/test/unittest/ability_manager_service_distributed_test/BUILD.gn b/test/unittest/ability_manager_service_distributed_test/BUILD.gn index abc2fe573b..b870088c7d 100755 --- a/test/unittest/ability_manager_service_distributed_test/BUILD.gn +++ b/test/unittest/ability_manager_service_distributed_test/BUILD.gn @@ -27,11 +27,6 @@ ohos_unittest("ability_manager_service_distributed_test") { "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_services_path}/abilitymgr:abilityms", "${ability_runtime_services_path}/common:perm_verification", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", - "//third_party/googletest:gmock_main", - "//third_party/googletest:gtest_main", ] external_deps = [ diff --git a/test/unittest/ability_manager_service_sixth_test/BUILD.gn b/test/unittest/ability_manager_service_sixth_test/BUILD.gn index 547e014c79..9b09c07f5a 100644 --- a/test/unittest/ability_manager_service_sixth_test/BUILD.gn +++ b/test/unittest/ability_manager_service_sixth_test/BUILD.gn @@ -107,7 +107,6 @@ ohos_unittest("ability_manager_service_sixth_test") { "${ability_runtime_services_path}/common:image_native_bridge", "${ability_runtime_services_path}/common:task_handler_wrap", "${ability_runtime_services_path}/common:user_controller", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", "${agent_runtime_framework_path}/interfaces/inner_api:agent_manager", "${agent_runtime_framework_path}/interfaces/kits/native/agent_extension/connection:agent_extension_connection", ] diff --git a/test/unittest/ability_manager_service_thirteenth_test/mock/include/os_account_manager_wrapper.h b/test/unittest/ability_manager_service_thirteenth_test/mock/include/os_account_manager_wrapper.h index 6bf7268c98..c903596e00 100644 --- a/test/unittest/ability_manager_service_thirteenth_test/mock/include/os_account_manager_wrapper.h +++ b/test/unittest/ability_manager_service_thirteenth_test/mock/include/os_account_manager_wrapper.h @@ -16,24 +16,24 @@ #ifndef OHOS_ABILITY_RUNTIME_OS_ACCOUNT_MANAGER_WRAPPER_H #define OHOS_ABILITY_RUNTIME_OS_ACCOUNT_MANAGER_WRAPPER_H +#include #include #include "errors.h" -#include "singleton.h" namespace OHOS { namespace AppExecFwk { -class OsAccountManagerWrapper : public DelayedSingleton { +class OsAccountManagerWrapper { public: OsAccountManagerWrapper() {}; virtual ~OsAccountManagerWrapper() {}; - ErrCode QueryActiveOsAccountIds(std::vector& ids); - ErrCode GetOsAccountLocalIdFromUid(const int32_t uid, int32_t& id); - ErrCode GetOsAccountLocalIdFromProcess(int& id); - ErrCode IsOsAccountExists(const int id, bool& isOsAccountExists); - ErrCode CreateOsAccount(const std::string& name, int32_t& osAccountUserId); - ErrCode RemoveOsAccount(const int id); + static ErrCode QueryActiveOsAccountIds(std::vector& ids); + static ErrCode GetOsAccountLocalIdFromUid(const int32_t uid, int32_t& id); + static ErrCode GetOsAccountLocalIdFromProcess(int& id); + static ErrCode IsOsAccountExists(const int id, bool& isOsAccountExists); + static ErrCode CreateOsAccount(const std::string& name, int32_t& osAccountUserId); + static ErrCode RemoveOsAccount(const int id); static int32_t GetCurrentActiveAccountId(); }; } // namespace AppExecFwk diff --git a/test/unittest/ability_manager_stub_second_test/BUILD.gn b/test/unittest/ability_manager_stub_second_test/BUILD.gn index a9652e4753..f97cb00379 100644 --- a/test/unittest/ability_manager_stub_second_test/BUILD.gn +++ b/test/unittest/ability_manager_stub_second_test/BUILD.gn @@ -55,8 +55,6 @@ ohos_unittest("ability_manager_stub_second_test") { "${ability_runtime_services_path}/common:perm_verification", "${ability_runtime_services_path}/common:task_handler_wrap", "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ diff --git a/test/unittest/ability_manager_stub_test/BUILD.gn b/test/unittest/ability_manager_stub_test/BUILD.gn index 8c84e88efe..b11d21e366 100644 --- a/test/unittest/ability_manager_stub_test/BUILD.gn +++ b/test/unittest/ability_manager_stub_test/BUILD.gn @@ -57,8 +57,6 @@ ohos_unittest("ability_manager_stub_test") { "${ability_runtime_services_path}/common:perm_verification", "${ability_runtime_services_path}/common:task_handler_wrap", "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ diff --git a/test/unittest/ability_record_test/BUILD.gn b/test/unittest/ability_record_test/BUILD.gn index 127c3c2dc2..5ef0424d2d 100644 --- a/test/unittest/ability_record_test/BUILD.gn +++ b/test/unittest/ability_record_test/BUILD.gn @@ -62,7 +62,6 @@ ohos_unittest("ability_record_test") { "${ability_runtime_services_path}/common:app_util", "${ability_runtime_services_path}/common:perm_verification", "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] @@ -164,7 +163,6 @@ ohos_unittest("ability_record_test_call") { "${ability_runtime_services_path}/common:app_util", "${ability_runtime_services_path}/common:perm_verification", "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] diff --git a/test/unittest/ability_scheduler_proxy_test/BUILD.gn b/test/unittest/ability_scheduler_proxy_test/BUILD.gn index 13c59edf0d..a9a1f9c753 100644 --- a/test/unittest/ability_scheduler_proxy_test/BUILD.gn +++ b/test/unittest/ability_scheduler_proxy_test/BUILD.gn @@ -45,12 +45,10 @@ ohos_unittest("ability_scheduler_proxy_test") { } deps = [ "${ability_runtime_innerkits_path}/ability_manager:ability_manager", + "${ability_runtime_innerkits_path}/app_manager:app_manager", "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_services_path}/abilitymgr:abilityms", "${ability_runtime_services_path}/common:perm_verification", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ diff --git a/test/unittest/ability_scheduler_stub_second_test/BUILD.gn b/test/unittest/ability_scheduler_stub_second_test/BUILD.gn index 9d281f3e11..7bf5aa6a1f 100644 --- a/test/unittest/ability_scheduler_stub_second_test/BUILD.gn +++ b/test/unittest/ability_scheduler_stub_second_test/BUILD.gn @@ -42,9 +42,6 @@ ohos_unittest("ability_scheduler_stub_second_test") { "${ability_runtime_innerkits_path}/dataobs_manager:dataobs_manager", "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_services_path}/common:perm_verification", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ diff --git a/test/unittest/ability_scheduler_stub_test/BUILD.gn b/test/unittest/ability_scheduler_stub_test/BUILD.gn index 30363c4ee8..4dbe9cc429 100644 --- a/test/unittest/ability_scheduler_stub_test/BUILD.gn +++ b/test/unittest/ability_scheduler_stub_test/BUILD.gn @@ -38,9 +38,6 @@ ohos_unittest("ability_scheduler_stub_test") { "${ability_runtime_innerkits_path}/ability_manager:ability_manager", "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_services_path}/common:perm_verification", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ diff --git a/test/unittest/ability_service_start_test/BUILD.gn b/test/unittest/ability_service_start_test/BUILD.gn index 1aab058f22..b4923e0bd3 100644 --- a/test/unittest/ability_service_start_test/BUILD.gn +++ b/test/unittest/ability_service_start_test/BUILD.gn @@ -41,8 +41,6 @@ ohos_unittest("ability_service_start_test") { "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_services_path}/abilitymgr:abilityms", "${ability_runtime_services_path}/common:perm_verification", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] diff --git a/test/unittest/ability_token_proxy_test/BUILD.gn b/test/unittest/ability_token_proxy_test/BUILD.gn index cdc3562796..f0a9f3d4b1 100644 --- a/test/unittest/ability_token_proxy_test/BUILD.gn +++ b/test/unittest/ability_token_proxy_test/BUILD.gn @@ -36,12 +36,10 @@ ohos_unittest("ability_token_proxy_test") { } deps = [ "${ability_runtime_innerkits_path}/ability_manager:ability_manager", + "${ability_runtime_innerkits_path}/app_manager:app_manager", "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_services_path}/abilitymgr:abilityms", "${ability_runtime_services_path}/common:perm_verification", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ diff --git a/test/unittest/ability_token_stub_test/BUILD.gn b/test/unittest/ability_token_stub_test/BUILD.gn index 5b9cd72f17..b9be3b56d5 100644 --- a/test/unittest/ability_token_stub_test/BUILD.gn +++ b/test/unittest/ability_token_stub_test/BUILD.gn @@ -36,12 +36,10 @@ ohos_unittest("ability_token_stub_test") { } deps = [ "${ability_runtime_innerkits_path}/ability_manager:ability_manager", + "${ability_runtime_innerkits_path}/app_manager:app_manager", "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_services_path}/abilitymgr:abilityms", "${ability_runtime_services_path}/common:perm_verification", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ diff --git a/test/unittest/ag_convert_callback_impl_test/BUILD.gn b/test/unittest/ag_convert_callback_impl_test/BUILD.gn index d04df8528b..d4c2f170ed 100644 --- a/test/unittest/ag_convert_callback_impl_test/BUILD.gn +++ b/test/unittest/ag_convert_callback_impl_test/BUILD.gn @@ -50,7 +50,6 @@ ohos_unittest("ag_convert_callback_impl_test") { "${ability_runtime_services_path}/common:app_util", "${ability_runtime_services_path}/common:perm_verification", "${ability_runtime_services_path}/common:task_handler_wrap", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", ] external_deps = [ @@ -70,6 +69,7 @@ ohos_unittest("ag_convert_callback_impl_test") { "hisysevent:libhisysevent", "init:libbeget_proxy", "init:libbegetutil", + "ipc:ipc_single", "kv_store:distributeddata_inner", "window_manager:libwsutils", "window_manager:sms", diff --git a/test/unittest/ams_app_mgr_client_test/BUILD.gn b/test/unittest/ams_app_mgr_client_test/BUILD.gn index b94d263092..7e7bcbaa3b 100644 --- a/test/unittest/ams_app_mgr_client_test/BUILD.gn +++ b/test/unittest/ams_app_mgr_client_test/BUILD.gn @@ -35,10 +35,15 @@ ohos_unittest("AmsAppMgrClientTest") { "ams_app_mgr_client_test.cpp", ] - include_dirs = [ "${ability_runtime_test_path}/mock/common/include" ] + include_dirs = [ + "${ability_runtime_test_path}/mock/common/include", + "${ability_runtime_test_path}/mock/services_appmgr_test/include", + ] - configs = - [ "${ability_runtime_innerkits_path}/app_manager:appmgr_sdk_config" ] + configs = [ + "${ability_runtime_innerkits_path}/app_manager:appmgr_sdk_config", + "${ability_runtime_services_path}/appmgr:appmgr_config", + ] cflags = [] if (target_cpu == "arm") { cflags += [ "-DBINDER_IPC_32BIT" ] @@ -46,32 +51,32 @@ ohos_unittest("AmsAppMgrClientTest") { deps = [ "${ability_runtime_innerkits_path}/app_manager:app_manager", "${ability_runtime_path}/utils/server/startup:startup_util", - "${ability_runtime_services_path}/common:perm_verification", - "${ability_runtime_test_path}/unittest:appmgr_test_source", ] external_deps = [ + "ability_base:base", "ability_base:configuration", "ability_base:want", "access_token:libnativetoken", "access_token:libtoken_setproc", "appspawn:appspawn_client", + "bundle_framework:appexecfwk_base", "bundle_framework:appexecfwk_core", - "cJSON:cjson", "c_utils:utils", - "common_event_service:cesfwk_innerkits", "ffrt:libffrt", + "googletest:gmock_main", + "googletest:gtest_main", "hilog:libhilog", "hisysevent:libhisysevent", "hitrace:hitrace_meter", "ipc:ipc_core", - "safwk:system_ability_fwk", + "json:nlohmann_json_static", "samgr:samgr_proxy", - "selinux_adapter:librestorecon", ] + defines = [ "AMS_LOG_TAG=\"AppMgrService\"" ] if (ability_runtime_child_process) { - defines = [ "SUPPORT_CHILD_PROCESS" ] + defines += [ "SUPPORT_CHILD_PROCESS" ] } if (ability_runtime_graphics) { external_deps += [ "window_manager:libwm" ] diff --git a/test/unittest/app_exit_reason_helper_fourth_test/mock/include/os_account_manager_wrapper.h b/test/unittest/app_exit_reason_helper_fourth_test/mock/include/os_account_manager_wrapper.h index ffba6fc221..28d5803df9 100644 --- a/test/unittest/app_exit_reason_helper_fourth_test/mock/include/os_account_manager_wrapper.h +++ b/test/unittest/app_exit_reason_helper_fourth_test/mock/include/os_account_manager_wrapper.h @@ -16,14 +16,14 @@ #ifndef OHOS_ABILITY_RUNTIME_OS_ACCOUNT_MANAGER_WRAPPER_H #define OHOS_ABILITY_RUNTIME_OS_ACCOUNT_MANAGER_WRAPPER_H +#include #include #include "errors.h" -#include "singleton.h" namespace OHOS { namespace AppExecFwk { -class OsAccountManagerWrapper : public DelayedSingleton { +class OsAccountManagerWrapper { public: OsAccountManagerWrapper() {}; virtual ~OsAccountManagerWrapper() {}; @@ -34,7 +34,7 @@ public: * @param ids The local IDs of all activated OS accounts. * @return error code, ERR_OK on success, others on failure. */ - ErrCode QueryActiveOsAccountIds(std::vector& ids); + static ErrCode QueryActiveOsAccountIds(std::vector& ids); /** * @brief Gets the local ID of an OS account from the process UID @@ -43,7 +43,7 @@ public: * @param id The local ID of the OS account associated with the specified UID. * @return error code, ERR_OK on success, others on failure. */ - ErrCode GetOsAccountLocalIdFromUid(const int32_t uid, int32_t& id); + static ErrCode GetOsAccountLocalIdFromUid(const int32_t uid, int32_t& id); /** * @brief Gets the local ID of the current OS account. @@ -51,7 +51,7 @@ public: * @param id The local ID of the current OS account. * @return error code, ERR_OK on success, others on failure. */ - ErrCode GetOsAccountLocalIdFromProcess(int& id); + static ErrCode GetOsAccountLocalIdFromProcess(int& id); /** * @brief Checks whether the specified OS account exists. @@ -60,7 +60,7 @@ public: * @param isOsAccountExists Indicates whether the specified OS account exists. * @return error code, ERR_OK on success, others on failure. */ - ErrCode IsOsAccountExists(const int id, bool& isOsAccountExists); + static ErrCode IsOsAccountExists(const int id, bool& isOsAccountExists); /** * @brief Creates an OS account using the local name and account type. @@ -69,7 +69,7 @@ public: * @param osAccountUserId The local id of the created OS account. * @return error code, ERR_OK on success, others on failure. */ - ErrCode CreateOsAccount(const std::string& name, int32_t& osAccountUserId); + static ErrCode CreateOsAccount(const std::string& name, int32_t& osAccountUserId); /** * @brief Removes an OS account based on its local ID. @@ -77,7 +77,7 @@ public: * @param id The local ID of the OS account. * @return error code, ERR_OK on success, others on failure. */ - ErrCode RemoveOsAccount(const int id); + static ErrCode RemoveOsAccount(const int id); /** * @brief Get the current active user ID. diff --git a/test/unittest/app_lifecycle_deal_test/BUILD.gn b/test/unittest/app_lifecycle_deal_test/BUILD.gn index 36856d37e4..8495b722ee 100644 --- a/test/unittest/app_lifecycle_deal_test/BUILD.gn +++ b/test/unittest/app_lifecycle_deal_test/BUILD.gn @@ -18,6 +18,12 @@ module_output_path = "ability_runtime/ability_runtime/appmgrservice" ohos_unittest("app_lifecycle_deal_test") { module_out_path = module_output_path + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + blocklist = "../../cfi_blocklist.txt" + } configs = [ "${ability_runtime_services_path}/common:common_config", diff --git a/test/unittest/app_mgr_client_test/BUILD.gn b/test/unittest/app_mgr_client_test/BUILD.gn index 6f31cb7f27..9f051c3468 100644 --- a/test/unittest/app_mgr_client_test/BUILD.gn +++ b/test/unittest/app_mgr_client_test/BUILD.gn @@ -18,6 +18,12 @@ module_output_path = "ability_runtime/ability_runtime/appmgrservice" ohos_unittest("AppMgrClientTest") { module_out_path = module_output_path + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + blocklist = "../../cfi_blocklist.txt" + } configs = [ "${ability_runtime_services_path}/common:common_config", diff --git a/test/unittest/app_scheduler_host_test/BUILD.gn b/test/unittest/app_scheduler_host_test/BUILD.gn index d73977a1e2..4df95d48cb 100644 --- a/test/unittest/app_scheduler_host_test/BUILD.gn +++ b/test/unittest/app_scheduler_host_test/BUILD.gn @@ -18,6 +18,12 @@ module_output_path = "ability_runtime/ability_runtime/appmgrservice" ohos_unittest("app_scheduler_host_test") { module_out_path = module_output_path + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + blocklist = "../../cfi_blocklist.txt" + } configs = [ "${ability_runtime_services_path}/common:common_config", diff --git a/test/unittest/app_scheduler_proxy_test/BUILD.gn b/test/unittest/app_scheduler_proxy_test/BUILD.gn index 42b57721bb..54cd8bbea7 100644 --- a/test/unittest/app_scheduler_proxy_test/BUILD.gn +++ b/test/unittest/app_scheduler_proxy_test/BUILD.gn @@ -18,6 +18,12 @@ module_output_path = "ability_runtime/ability_runtime/appmgrservice" ohos_unittest("app_scheduler_proxy_test") { module_out_path = module_output_path + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + blocklist = "../../cfi_blocklist.txt" + } configs = [ "${ability_runtime_services_path}/common:common_config", diff --git a/test/unittest/app_scheduler_test/BUILD.gn b/test/unittest/app_scheduler_test/BUILD.gn index ad435261c1..e10e201b56 100644 --- a/test/unittest/app_scheduler_test/BUILD.gn +++ b/test/unittest/app_scheduler_test/BUILD.gn @@ -53,9 +53,7 @@ ohos_unittest("app_scheduler_test") { "${ability_runtime_path}/utils/server/startup:startup_util", "${ability_runtime_services_path}/abilitymgr:abilityms", "${ability_runtime_services_path}/common:perm_verification", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ diff --git a/test/unittest/app_service_extension_context_test/BUILD.gn b/test/unittest/app_service_extension_context_test/BUILD.gn index 1969cd8e46..0bd270f815 100644 --- a/test/unittest/app_service_extension_context_test/BUILD.gn +++ b/test/unittest/app_service_extension_context_test/BUILD.gn @@ -41,6 +41,7 @@ ohos_unittest("app_service_extension_context_test") { deps = [ "${ability_runtime_innerkits_path}/ability_manager:ability_connect_callback_stub", "${ability_runtime_innerkits_path}/ability_manager:ability_manager", + "${ability_runtime_innerkits_path}/app_manager:app_manager", "${ability_runtime_innerkits_path}/runtime:runtime", "${ability_runtime_napi_path}/inner/napi_common:napi_common", "${ability_runtime_native_path}/ability/native:ability_business_error", @@ -52,9 +53,6 @@ ohos_unittest("app_service_extension_context_test") { "${ability_runtime_path}/services/abilitymgr:abilityms_target", "${ability_runtime_services_path}/abilitymgr:abilityms", "${ability_runtime_services_path}/common:perm_verification", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ diff --git a/test/unittest/app_spawn_client_second_test/mock/include/os_account_manager_wrapper.h b/test/unittest/app_spawn_client_second_test/mock/include/os_account_manager_wrapper.h index 8a20fb440a..5c4fd573c1 100644 --- a/test/unittest/app_spawn_client_second_test/mock/include/os_account_manager_wrapper.h +++ b/test/unittest/app_spawn_client_second_test/mock/include/os_account_manager_wrapper.h @@ -19,11 +19,10 @@ #include #include "errors.h" -#include "singleton.h" namespace OHOS { namespace AppExecFwk { -class OsAccountManagerWrapper : public DelayedSingleton { +class OsAccountManagerWrapper { public: OsAccountManagerWrapper() {}; virtual ~OsAccountManagerWrapper() {}; @@ -34,7 +33,7 @@ public: * @param ids The local IDs of all activated OS accounts. * @return error code, ERR_OK on success, others on failure. */ - ErrCode QueryActiveOsAccountIds(std::vector& ids); + static ErrCode QueryActiveOsAccountIds(std::vector& ids); /** * @brief Gets the local ID of an OS account from the process UID @@ -43,7 +42,7 @@ public: * @param id The local ID of the OS account associated with the specified UID. * @return error code, ERR_OK on success, others on failure. */ - ErrCode GetOsAccountLocalIdFromUid(const int32_t uid, int32_t& id); + static ErrCode GetOsAccountLocalIdFromUid(const int32_t uid, int32_t& id); /** * @brief Gets the local ID of the current OS account. @@ -51,7 +50,7 @@ public: * @param id The local ID of the current OS account. * @return error code, ERR_OK on success, others on failure. */ - ErrCode GetOsAccountLocalIdFromProcess(int& id); + static ErrCode GetOsAccountLocalIdFromProcess(int& id); /** * @brief Checks whether the specified OS account exists. @@ -60,7 +59,7 @@ public: * @param isOsAccountExists Indicates whether the specified OS account exists. * @return error code, ERR_OK on success, others on failure. */ - ErrCode IsOsAccountExists(const int id, bool& isOsAccountExists); + static ErrCode IsOsAccountExists(const int id, bool& isOsAccountExists); /** * @brief Creates an OS account using the local name and account type. @@ -69,7 +68,7 @@ public: * @param osAccountUserId The local id of the created OS account. * @return error code, ERR_OK on success, others on failure. */ - ErrCode CreateOsAccount(const std::string& name, int32_t& osAccountUserId); + static ErrCode CreateOsAccount(const std::string& name, int32_t& osAccountUserId); /** * @brief Removes an OS account based on its local ID. @@ -77,7 +76,7 @@ public: * @param id The local ID of the OS account. * @return error code, ERR_OK on success, others on failure. */ - ErrCode RemoveOsAccount(const int id); + static ErrCode RemoveOsAccount(const int id); /** * @brief Get the current active user ID. diff --git a/test/unittest/appkit/ohos_application_first_test/ohos_application_first_test.cpp b/test/unittest/appkit/ohos_application_first_test/ohos_application_first_test.cpp index 000b46a196..5cf2bd3211 100644 --- a/test/unittest/appkit/ohos_application_first_test/ohos_application_first_test.cpp +++ b/test/unittest/appkit/ohos_application_first_test/ohos_application_first_test.cpp @@ -69,6 +69,7 @@ void OHOSApplicationFirstTest::SetUp() void OHOSApplicationFirstTest::TearDown() { + abilityStages_.clear(); ohosApplication_ = nullptr; } @@ -104,6 +105,7 @@ HWTEST_F(OHOSApplicationFirstTest, CleanEmptyAbilityStage_0200, TestSize.Level2) EXPECT_FALSE(ohosApplication_->abilityStages_.empty()); ohosApplication_->CleanEmptyAbilityStage(); EXPECT_TRUE(ohosApplication_->abilityStages_.empty()); + abilityStages_.clear(); TAG_LOGI(AAFwkTag::TEST, "CleanEmptyAbilityStage_0200 end"); } @@ -128,6 +130,7 @@ HWTEST_F(OHOSApplicationFirstTest, CleanEmptyAbilityStage_0300, TestSize.Level2) EXPECT_FALSE(ohosApplication_->abilityStages_.empty()); ohosApplication_->CleanEmptyAbilityStage(); EXPECT_TRUE(ohosApplication_->abilityStages_.empty()); + abilityStages_.clear(); TAG_LOGI(AAFwkTag::TEST, "CleanEmptyAbilityStage_0300 end"); } diff --git a/test/unittest/assert_fault_callback_death_mgr_test/BUILD.gn b/test/unittest/assert_fault_callback_death_mgr_test/BUILD.gn index 53f66cf1a2..5d24385498 100644 --- a/test/unittest/assert_fault_callback_death_mgr_test/BUILD.gn +++ b/test/unittest/assert_fault_callback_death_mgr_test/BUILD.gn @@ -54,15 +54,13 @@ ohos_unittest("assert_fault_callback_death_mgr_test") { deps = [ "${ability_runtime_innerkits_path}/ability_manager:ability_connect_callback_stub", "${ability_runtime_innerkits_path}/ability_manager:ability_manager", + "${ability_runtime_innerkits_path}/app_manager:app_manager", "${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:app_util", "${ability_runtime_services_path}/common:perm_verification", "${ability_runtime_services_path}/common:task_handler_wrap", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ diff --git a/test/unittest/background_task_observer_test/BUILD.gn b/test/unittest/background_task_observer_test/BUILD.gn index 811f34b56c..2ed7dc11c1 100755 --- a/test/unittest/background_task_observer_test/BUILD.gn +++ b/test/unittest/background_task_observer_test/BUILD.gn @@ -36,12 +36,10 @@ ohos_unittest("background_task_observer_test") { } deps = [ "${ability_runtime_innerkits_path}/ability_manager:ability_manager", + "${ability_runtime_innerkits_path}/app_manager:app_manager", "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_services_path}/abilitymgr:abilityms", "${ability_runtime_services_path}/common:perm_verification", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ diff --git a/test/unittest/call_record_test/BUILD.gn b/test/unittest/call_record_test/BUILD.gn index b60d657d61..0a715c3de6 100644 --- a/test/unittest/call_record_test/BUILD.gn +++ b/test/unittest/call_record_test/BUILD.gn @@ -40,18 +40,19 @@ ohos_unittest("call_record_test") { cflags += [ "-DBINDER_IPC_32BIT" ] } deps = [ + "${ability_runtime_innerkits_path}/app_manager:app_manager", "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_services_path}/abilitymgr:abilityms", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", ] external_deps = [ "ability_base:configuration", "ability_base:want", + "c_utils:utils", "ffrt:libffrt", "googletest:gmock_main", "hilog:libhilog", - "napi:ace_napi", + "ipc:ipc_single", "samgr:samgr_proxy", ] diff --git a/test/unittest/child_process_capi_test/BUILD.gn b/test/unittest/child_process_capi_test/BUILD.gn index d9571aeb13..5cd287bb38 100644 --- a/test/unittest/child_process_capi_test/BUILD.gn +++ b/test/unittest/child_process_capi_test/BUILD.gn @@ -17,6 +17,13 @@ import("//foundation/ability/ability_runtime/ability_runtime.gni") module_output_path = "ability_runtime/ability_runtime/child_process_capi" ohos_unittest("child_process_capi_test") { + branch_protector_ret = "pac_ret" + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + } + use_exceptions = true module_out_path = module_output_path diff --git a/test/unittest/child_process_manager_test/BUILD.gn b/test/unittest/child_process_manager_test/BUILD.gn index 20d2dad608..4fc5de4b10 100644 --- a/test/unittest/child_process_manager_test/BUILD.gn +++ b/test/unittest/child_process_manager_test/BUILD.gn @@ -17,6 +17,13 @@ import("//foundation/ability/ability_runtime/ability_runtime.gni") module_output_path = "ability_runtime/ability_runtime/child_process_manager" ohos_unittest("child_process_manager_test") { + branch_protector_ret = "pac_ret" + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + } + module_out_path = module_output_path configs = [ "${ability_runtime_services_path}/common:common_config" ] diff --git a/test/unittest/configuration_test/BUILD.gn b/test/unittest/configuration_test/BUILD.gn index 0fa23035a4..7984a43941 100644 --- a/test/unittest/configuration_test/BUILD.gn +++ b/test/unittest/configuration_test/BUILD.gn @@ -40,14 +40,12 @@ ohos_unittest("configuration_test") { } deps = [ "${ability_runtime_innerkits_path}/ability_manager:ability_manager", + "${ability_runtime_innerkits_path}/app_manager:app_manager", "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_native_path}/ability/native:abilitykit_utils", "${ability_runtime_services_path}/abilitymgr:abilityms", "${ability_runtime_services_path}/common:perm_verification", "${ability_runtime_services_path}/common:task_handler_wrap", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ diff --git a/test/unittest/connection_observer_controller_test/BUILD.gn b/test/unittest/connection_observer_controller_test/BUILD.gn index 524ea60fcd..fb453a787e 100755 --- a/test/unittest/connection_observer_controller_test/BUILD.gn +++ b/test/unittest/connection_observer_controller_test/BUILD.gn @@ -36,13 +36,11 @@ ohos_unittest("connection_observer_controller_test") { } deps = [ "${ability_runtime_innerkits_path}/ability_manager:ability_manager", + "${ability_runtime_innerkits_path}/app_manager:app_manager", "${ability_runtime_innerkits_path}/connectionobs_manager:connection_obs_manager", "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_services_path}/abilitymgr:abilityms", "${ability_runtime_services_path}/common:perm_verification", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ diff --git a/test/unittest/connection_observer_test/BUILD.gn b/test/unittest/connection_observer_test/BUILD.gn index a4e5e40580..6e8344e433 100644 --- a/test/unittest/connection_observer_test/BUILD.gn +++ b/test/unittest/connection_observer_test/BUILD.gn @@ -18,6 +18,12 @@ module_output_path = "ability_runtime/ability_runtime/abilitymgr" ohos_unittest("connection_observer_test") { module_out_path = module_output_path + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + blocklist = "../../cfi_blocklist.txt" + } include_dirs = [ "${ability_runtime_innerkits_path}/connectionobs_manager/include", diff --git a/test/unittest/connection_record_test/BUILD.gn b/test/unittest/connection_record_test/BUILD.gn index b813ee7bad..dcdc84e29c 100644 --- a/test/unittest/connection_record_test/BUILD.gn +++ b/test/unittest/connection_record_test/BUILD.gn @@ -52,7 +52,6 @@ ohos_unittest("connection_record_test") { "${ability_runtime_services_path}/common:perm_verification", "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ diff --git a/test/unittest/connection_state_item_test/BUILD.gn b/test/unittest/connection_state_item_test/BUILD.gn index bbd544e47e..33b96cfce8 100755 --- a/test/unittest/connection_state_item_test/BUILD.gn +++ b/test/unittest/connection_state_item_test/BUILD.gn @@ -42,13 +42,11 @@ ohos_unittest("connection_state_item_test") { } deps = [ "${ability_runtime_innerkits_path}/ability_manager:ability_manager", + "${ability_runtime_innerkits_path}/app_manager:app_manager", "${ability_runtime_innerkits_path}/connectionobs_manager:connection_obs_manager", "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_services_path}/abilitymgr:abilityms", "${ability_runtime_services_path}/common:perm_verification", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ diff --git a/test/unittest/connection_state_manager_test/BUILD.gn b/test/unittest/connection_state_manager_test/BUILD.gn index 100a0c290b..b4b2132bd4 100755 --- a/test/unittest/connection_state_manager_test/BUILD.gn +++ b/test/unittest/connection_state_manager_test/BUILD.gn @@ -42,13 +42,11 @@ ohos_unittest("connection_state_manager_test") { } deps = [ "${ability_runtime_innerkits_path}/ability_manager:ability_manager", + "${ability_runtime_innerkits_path}/app_manager:app_manager", "${ability_runtime_innerkits_path}/connectionobs_manager:connection_obs_manager", "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_services_path}/abilitymgr:abilityms", "${ability_runtime_services_path}/common:perm_verification", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ diff --git a/test/unittest/data_ability_manager_test/BUILD.gn b/test/unittest/data_ability_manager_test/BUILD.gn index b604bd28a1..6217ee31f4 100644 --- a/test/unittest/data_ability_manager_test/BUILD.gn +++ b/test/unittest/data_ability_manager_test/BUILD.gn @@ -60,7 +60,6 @@ ohos_unittest("data_ability_manager_test") { "${ability_runtime_services_path}/abilitymgr:abilityms", "${ability_runtime_services_path}/common:app_util", "${ability_runtime_services_path}/common:perm_verification", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", ] diff --git a/test/unittest/data_ability_record_second_test/BUILD.gn b/test/unittest/data_ability_record_second_test/BUILD.gn index 6564d2693f..6bc4b7ab7a 100644 --- a/test/unittest/data_ability_record_second_test/BUILD.gn +++ b/test/unittest/data_ability_record_second_test/BUILD.gn @@ -50,9 +50,7 @@ ohos_unittest("data_ability_record_second_test") { "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_services_path}/abilitymgr:abilityms", "${ability_runtime_services_path}/common:perm_verification", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ diff --git a/test/unittest/data_ability_record_test/BUILD.gn b/test/unittest/data_ability_record_test/BUILD.gn index bfeebed529..2f070b46b8 100644 --- a/test/unittest/data_ability_record_test/BUILD.gn +++ b/test/unittest/data_ability_record_test/BUILD.gn @@ -51,9 +51,7 @@ ohos_unittest("data_ability_record_test") { "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_services_path}/abilitymgr:abilityms", "${ability_runtime_services_path}/common:perm_verification", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ diff --git a/test/unittest/dlp_state_item_test/BUILD.gn b/test/unittest/dlp_state_item_test/BUILD.gn index d1817b23dd..0d6f2b9593 100644 --- a/test/unittest/dlp_state_item_test/BUILD.gn +++ b/test/unittest/dlp_state_item_test/BUILD.gn @@ -37,13 +37,11 @@ ohos_unittest("dlp_state_item_test") { } deps = [ "${ability_runtime_innerkits_path}/ability_manager:ability_manager", + "${ability_runtime_innerkits_path}/app_manager:app_manager", "${ability_runtime_innerkits_path}/connectionobs_manager:connection_obs_manager", "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_services_path}/abilitymgr:abilityms", "${ability_runtime_services_path}/common:perm_verification", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ diff --git a/test/unittest/ecological_rule_interceptor_test/BUILD.gn b/test/unittest/ecological_rule_interceptor_test/BUILD.gn index 20077ef09c..b085b11dbd 100644 --- a/test/unittest/ecological_rule_interceptor_test/BUILD.gn +++ b/test/unittest/ecological_rule_interceptor_test/BUILD.gn @@ -54,9 +54,6 @@ ohos_unittest("ecological_rule_interceptor_test") { "${ability_runtime_services_path}/common:app_util", "${ability_runtime_services_path}/common:perm_verification", "${ability_runtime_services_path}/common:task_handler_wrap", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ diff --git a/test/unittest/exit_info_data_manager_test/BUILD.gn b/test/unittest/exit_info_data_manager_test/BUILD.gn index d6b9f45257..a9cb085a80 100644 --- a/test/unittest/exit_info_data_manager_test/BUILD.gn +++ b/test/unittest/exit_info_data_manager_test/BUILD.gn @@ -53,7 +53,6 @@ ohos_unittest("exit_info_data_manager_test") { "${ability_runtime_services_path}/common:perm_verification", "${ability_runtime_services_path}/common:task_handler_wrap", "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] diff --git a/test/unittest/exit_reason_test/BUILD.gn b/test/unittest/exit_reason_test/BUILD.gn index 7cb53ddfa5..6981f5afe8 100644 --- a/test/unittest/exit_reason_test/BUILD.gn +++ b/test/unittest/exit_reason_test/BUILD.gn @@ -55,7 +55,6 @@ ohos_unittest("exit_reason_test") { "${ability_runtime_services_path}/common:perm_verification", "${ability_runtime_services_path}/common:task_handler_wrap", "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] diff --git a/test/unittest/extension_record_test/BUILD.gn b/test/unittest/extension_record_test/BUILD.gn index 89df4207b8..f4bf459a8c 100644 --- a/test/unittest/extension_record_test/BUILD.gn +++ b/test/unittest/extension_record_test/BUILD.gn @@ -56,7 +56,6 @@ ohos_unittest("extension_record_test") { "${ability_runtime_services_path}/common:perm_verification", "${ability_runtime_services_path}/common:task_handler_wrap", "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] diff --git a/test/unittest/foreground_app_connection_manager_test/BUILD.gn b/test/unittest/foreground_app_connection_manager_test/BUILD.gn index 091d0cec79..84f934e9b3 100644 --- a/test/unittest/foreground_app_connection_manager_test/BUILD.gn +++ b/test/unittest/foreground_app_connection_manager_test/BUILD.gn @@ -41,13 +41,11 @@ ohos_unittest("foreground_app_connection_manager_test") { } deps = [ "${ability_runtime_innerkits_path}/ability_manager:ability_manager", + "${ability_runtime_innerkits_path}/app_manager:app_manager", "${ability_runtime_innerkits_path}/foreground_app_obs_manager:foreground_app_obs_manager", "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_services_path}/abilitymgr:abilityms", "${ability_runtime_services_path}/common:perm_verification", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ diff --git a/test/unittest/frameworks_kits_appkit_native_test/mock/include/os_account_manager_wrapper.h b/test/unittest/frameworks_kits_appkit_native_test/mock/include/os_account_manager_wrapper.h index 7d9584f7c2..4e5fae1bd1 100644 --- a/test/unittest/frameworks_kits_appkit_native_test/mock/include/os_account_manager_wrapper.h +++ b/test/unittest/frameworks_kits_appkit_native_test/mock/include/os_account_manager_wrapper.h @@ -24,8 +24,7 @@ namespace OHOS { namespace AppExecFwk { class OsAccountManagerWrapper { public: - static std::shared_ptr GetInstance(); - ErrCode GetOsAccountLocalIdFromProcess(int32_t &id); + static ErrCode GetOsAccountLocalIdFromProcess(int32_t &id); }; } // namespace AppExecFwk } // namespace OHOS diff --git a/test/unittest/frameworks_kits_appkit_native_test/mock/src/os_account_manager_wrapper.cpp b/test/unittest/frameworks_kits_appkit_native_test/mock/src/os_account_manager_wrapper.cpp index 467830f06c..7e533d0b64 100644 --- a/test/unittest/frameworks_kits_appkit_native_test/mock/src/os_account_manager_wrapper.cpp +++ b/test/unittest/frameworks_kits_appkit_native_test/mock/src/os_account_manager_wrapper.cpp @@ -15,20 +15,10 @@ #include "os_account_manager_wrapper.h" -#include #include "mock_my_status.h" namespace OHOS { namespace AppExecFwk { -std::shared_ptr OsAccountManagerWrapper::GetInstance() -{ - static std::shared_ptr instance = std::make_shared(); - if (MyStatus::GetInstance().instanceStatus_) { - return instance; - } - return nullptr; -} - ErrCode OsAccountManagerWrapper::GetOsAccountLocalIdFromProcess(int& id) { id = 0; diff --git a/test/unittest/js_auto_fill_extension_test/js_auto_fill_extension_test.cpp b/test/unittest/js_auto_fill_extension_test/js_auto_fill_extension_test.cpp index f9ce763e4f..e86272ea6a 100644 --- a/test/unittest/js_auto_fill_extension_test/js_auto_fill_extension_test.cpp +++ b/test/unittest/js_auto_fill_extension_test/js_auto_fill_extension_test.cpp @@ -83,7 +83,9 @@ void JsAutoFillExtensionTest::SetUp() } void JsAutoFillExtensionTest::TearDown() -{} +{ + jsAutoFillExtension_ = nullptr; +} void JsAutoFillExtensionTest::CreateJsAutoFillExtension() { diff --git a/test/unittest/js_photo_editor_extension_impl_test/js_photo_editor_extension_impl_test.cpp b/test/unittest/js_photo_editor_extension_impl_test/js_photo_editor_extension_impl_test.cpp index 0968b8bc64..1c5a296708 100644 --- a/test/unittest/js_photo_editor_extension_impl_test/js_photo_editor_extension_impl_test.cpp +++ b/test/unittest/js_photo_editor_extension_impl_test/js_photo_editor_extension_impl_test.cpp @@ -20,15 +20,21 @@ #undef private #undef protected #include "hilog_tag_wrapper.h" +#include "event_runner.h" +#include "js_runtime.h" #include "napi/native_api.h" #include "napi/native_node_api.h" #include "js_photo_editor_extension_context.h" #include "js_ui_extension_content_session.h" #include "napi_common_want.h" +#include "runtime.h" #include "session_info.h" namespace OHOS { namespace AbilityRuntime { using namespace testing::ext; +namespace { +constexpr char JS_PHOTO_EDITOR_EXTENSION_TASK_RUNNER[] = "JsPhotoEditorExtension"; +} // namespace class JsPhotoEditorExtensionImplTest : public testing::Test { public: static void SetUpTestCase(void); @@ -57,7 +63,12 @@ void JsPhotoEditorExtensionImplTest::TearDown(void) HWTEST_F(JsPhotoEditorExtensionImplTest, OnStartContentEditingTest_0100, TestSize.Level1) { TAG_LOGI(AAFwkTag::TEST, "OnStartContentEditingTest_0100 start"); - std::unique_ptr runtime; + auto eventRunner = AppExecFwk::EventRunner::Create(JS_PHOTO_EDITOR_EXTENSION_TASK_RUNNER); + Runtime::Options options; + options.preload = true; + options.eventRunner = eventRunner; + std::unique_ptr runtime = JsRuntime::Create(options); + ASSERT_NE(runtime, nullptr); auto jsExtension = std::make_shared(runtime); AAFwk::Want want; sptr sessionInfo; @@ -65,6 +76,7 @@ HWTEST_F(JsPhotoEditorExtensionImplTest, OnStartContentEditingTest_0100, TestSiz imageUri = want.GetStringParam("ability.params.stream"); jsExtension->OnStartContentEditing(want, sessionInfo); EXPECT_EQ(imageUri.empty(), true); + jsExtension = nullptr; TAG_LOGI(AAFwkTag::TEST, "OnStartContentEditingTest_0100 end"); } } // namespace AbilityRuntime diff --git a/test/unittest/lifecycle_deal_test/BUILD.gn b/test/unittest/lifecycle_deal_test/BUILD.gn index d62b7e0e8e..9682062e1f 100644 --- a/test/unittest/lifecycle_deal_test/BUILD.gn +++ b/test/unittest/lifecycle_deal_test/BUILD.gn @@ -43,9 +43,7 @@ ohos_unittest("lifecycle_deal_test") { "${ability_runtime_innerkits_path}/app_manager:app_manager", "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_services_path}/common:perm_verification", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ diff --git a/test/unittest/lifecycle_test/BUILD.gn b/test/unittest/lifecycle_test/BUILD.gn index b2d3e16eae..9fa6adb84c 100644 --- a/test/unittest/lifecycle_test/BUILD.gn +++ b/test/unittest/lifecycle_test/BUILD.gn @@ -17,6 +17,13 @@ import("//foundation/ability/ability_runtime/ability_runtime.gni") module_output_path = "ability_runtime/ability_runtime/abilitymgr" ohos_unittest("lifecycle_test") { + branch_protector_ret = "pac_ret" + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + } + module_out_path = module_output_path include_dirs = [ diff --git a/test/unittest/main_element_utils_test/BUILD.gn b/test/unittest/main_element_utils_test/BUILD.gn index f6911bd827..6e725566b3 100755 --- a/test/unittest/main_element_utils_test/BUILD.gn +++ b/test/unittest/main_element_utils_test/BUILD.gn @@ -47,9 +47,6 @@ ohos_unittest("main_element_utils_test") { "${ability_runtime_innerkits_path}/ability_manager:ability_manager", "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_services_path}/common:perm_verification", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", "${ability_runtime_path}/utils/server/startup:startup_util", ] diff --git a/test/unittest/mission_ability_record_test/BUILD.gn b/test/unittest/mission_ability_record_test/BUILD.gn index 347a077cfa..66ee642f32 100644 --- a/test/unittest/mission_ability_record_test/BUILD.gn +++ b/test/unittest/mission_ability_record_test/BUILD.gn @@ -65,7 +65,6 @@ ohos_unittest("mission_ability_record_test") { "${ability_runtime_services_path}/common:app_util", "${ability_runtime_services_path}/common:perm_verification", "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] diff --git a/test/unittest/mission_data_storage_test/BUILD.gn b/test/unittest/mission_data_storage_test/BUILD.gn index c33bfa7f99..bbabe77807 100755 --- a/test/unittest/mission_data_storage_test/BUILD.gn +++ b/test/unittest/mission_data_storage_test/BUILD.gn @@ -36,15 +36,13 @@ ohos_unittest("mission_data_storage_test") { } deps = [ "${ability_runtime_innerkits_path}/ability_manager:ability_manager", + "${ability_runtime_innerkits_path}/app_manager:app_manager", "${ability_runtime_innerkits_path}/ability_manager:mission_info", "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_services_path}/abilitymgr:abilityms", "${ability_runtime_services_path}/abilitymgr:mission_list", "${ability_runtime_services_path}/common:perm_verification", "${ability_runtime_services_path}/common:task_handler_wrap", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ diff --git a/test/unittest/mission_info_mgr_second_test/BUILD.gn b/test/unittest/mission_info_mgr_second_test/BUILD.gn index a1291231d5..6e1dbf3165 100644 --- a/test/unittest/mission_info_mgr_second_test/BUILD.gn +++ b/test/unittest/mission_info_mgr_second_test/BUILD.gn @@ -42,14 +42,12 @@ ohos_unittest("mission_info_mgr_second_test") { } deps = [ "${ability_runtime_innerkits_path}/ability_manager:ability_manager", + "${ability_runtime_innerkits_path}/app_manager:app_manager", "${ability_runtime_innerkits_path}/ability_manager:mission_info", "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_services_path}/abilitymgr:abilityms", "${ability_runtime_services_path}/abilitymgr:mission_list", "${ability_runtime_services_path}/common:perm_verification", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ diff --git a/test/unittest/mission_info_mgr_test/BUILD.gn b/test/unittest/mission_info_mgr_test/BUILD.gn index 8735ba0398..f8800a7159 100755 --- a/test/unittest/mission_info_mgr_test/BUILD.gn +++ b/test/unittest/mission_info_mgr_test/BUILD.gn @@ -39,14 +39,12 @@ ohos_unittest("mission_info_mgr_test") { } deps = [ "${ability_runtime_innerkits_path}/ability_manager:ability_manager", + "${ability_runtime_innerkits_path}/app_manager:app_manager", "${ability_runtime_innerkits_path}/ability_manager:mission_info", "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_services_path}/abilitymgr:abilityms", "${ability_runtime_services_path}/abilitymgr:mission_list", "${ability_runtime_services_path}/common:perm_verification", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ diff --git a/test/unittest/mission_info_test/BUILD.gn b/test/unittest/mission_info_test/BUILD.gn index 1da5092dbe..6404285bdf 100755 --- a/test/unittest/mission_info_test/BUILD.gn +++ b/test/unittest/mission_info_test/BUILD.gn @@ -36,13 +36,11 @@ ohos_unittest("mission_info_test") { } deps = [ "${ability_runtime_innerkits_path}/ability_manager:ability_manager", + "${ability_runtime_innerkits_path}/app_manager:app_manager", "${ability_runtime_innerkits_path}/ability_manager:mission_info", "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_services_path}/abilitymgr:abilityms", "${ability_runtime_services_path}/common:perm_verification", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ diff --git a/test/unittest/mission_list_manager_first_test/BUILD.gn b/test/unittest/mission_list_manager_first_test/BUILD.gn index 58e027f09b..a524505684 100644 --- a/test/unittest/mission_list_manager_first_test/BUILD.gn +++ b/test/unittest/mission_list_manager_first_test/BUILD.gn @@ -46,6 +46,7 @@ ohos_unittest("mission_list_manager_first_test") { } deps = [ "${ability_runtime_innerkits_path}/ability_manager:ability_manager", + "${ability_runtime_innerkits_path}/app_manager:app_manager", "${ability_runtime_innerkits_path}/ability_manager:mission_info", "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_path}/utils/server/startup:startup_util", @@ -53,9 +54,6 @@ ohos_unittest("mission_list_manager_first_test") { "${ability_runtime_services_path}/abilitymgr:mission_list", "${ability_runtime_services_path}/common:perm_verification", "${ability_runtime_services_path}/common:task_handler_wrap", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ diff --git a/test/unittest/mission_list_manager_second_test/BUILD.gn b/test/unittest/mission_list_manager_second_test/BUILD.gn index 280b5f4482..55c8f7049b 100644 --- a/test/unittest/mission_list_manager_second_test/BUILD.gn +++ b/test/unittest/mission_list_manager_second_test/BUILD.gn @@ -46,6 +46,7 @@ ohos_unittest("mission_list_manager_second_test") { } deps = [ "${ability_runtime_innerkits_path}/ability_manager:ability_manager", + "${ability_runtime_innerkits_path}/app_manager:app_manager", "${ability_runtime_innerkits_path}/ability_manager:mission_info", "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_path}/utils/server/startup:startup_util", @@ -53,9 +54,6 @@ ohos_unittest("mission_list_manager_second_test") { "${ability_runtime_services_path}/abilitymgr:mission_list", "${ability_runtime_services_path}/common:perm_verification", "${ability_runtime_services_path}/common:task_handler_wrap", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ diff --git a/test/unittest/mission_list_manager_test/BUILD.gn b/test/unittest/mission_list_manager_test/BUILD.gn index db23668ea1..082f4431cf 100644 --- a/test/unittest/mission_list_manager_test/BUILD.gn +++ b/test/unittest/mission_list_manager_test/BUILD.gn @@ -46,15 +46,13 @@ ohos_unittest("mission_list_manager_test") { } deps = [ "${ability_runtime_innerkits_path}/ability_manager:ability_manager", + "${ability_runtime_innerkits_path}/app_manager:app_manager", "${ability_runtime_innerkits_path}/ability_manager:mission_info", "${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}/abilitymgr:mission_list", "${ability_runtime_services_path}/common:perm_verification", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ diff --git a/test/unittest/mission_list_manager_third_test/BUILD.gn b/test/unittest/mission_list_manager_third_test/BUILD.gn index ccc976b25b..2ad84c6344 100644 --- a/test/unittest/mission_list_manager_third_test/BUILD.gn +++ b/test/unittest/mission_list_manager_third_test/BUILD.gn @@ -46,6 +46,7 @@ ohos_unittest("mission_list_manager_third_test") { } deps = [ "${ability_runtime_innerkits_path}/ability_manager:ability_manager", + "${ability_runtime_innerkits_path}/app_manager:app_manager", "${ability_runtime_innerkits_path}/ability_manager:mission_info", "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_path}/utils/server/startup:startup_util", @@ -53,9 +54,6 @@ ohos_unittest("mission_list_manager_third_test") { "${ability_runtime_services_path}/abilitymgr:mission_list", "${ability_runtime_services_path}/common:perm_verification", "${ability_runtime_services_path}/common:task_handler_wrap", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ diff --git a/test/unittest/mission_list_manager_ut_test/BUILD.gn b/test/unittest/mission_list_manager_ut_test/BUILD.gn index 059973f28b..22da4ada9e 100644 --- a/test/unittest/mission_list_manager_ut_test/BUILD.gn +++ b/test/unittest/mission_list_manager_ut_test/BUILD.gn @@ -46,9 +46,6 @@ ohos_unittest("mission_list_manager_ut_test") { "${ability_runtime_services_path}/abilitymgr:abilityms", "${ability_runtime_services_path}/abilitymgr:mission_list", "${ability_runtime_services_path}/common:perm_verification", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ diff --git a/test/unittest/mission_list_test/BUILD.gn b/test/unittest/mission_list_test/BUILD.gn index 3d1a7ef107..934d09c898 100644 --- a/test/unittest/mission_list_test/BUILD.gn +++ b/test/unittest/mission_list_test/BUILD.gn @@ -35,13 +35,11 @@ ohos_unittest("mission_list_test") { cflags += [ "-DBINDER_IPC_32BIT" ] } deps = [ + "${ability_runtime_innerkits_path}/app_manager:app_manager", "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_services_path}/abilitymgr:abilityms", "${ability_runtime_services_path}/abilitymgr:mission_list", "${ability_runtime_services_path}/common:perm_verification", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ @@ -84,6 +82,7 @@ ohos_unittest("mission_list_test_call") { cflags += [ "-DBINDER_IPC_32BIT" ] } deps = [ + "${ability_runtime_innerkits_path}/app_manager:app_manager", "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_services_path}/abilitymgr:abilityms", "${ability_runtime_services_path}/abilitymgr:mission_list", diff --git a/test/unittest/mission_listener_proxy_test/BUILD.gn b/test/unittest/mission_listener_proxy_test/BUILD.gn index 1a5d686b24..9c02e562b9 100755 --- a/test/unittest/mission_listener_proxy_test/BUILD.gn +++ b/test/unittest/mission_listener_proxy_test/BUILD.gn @@ -42,12 +42,10 @@ ohos_unittest("mission_listener_proxy_test") { } deps = [ "${ability_runtime_innerkits_path}/ability_manager:ability_manager", + "${ability_runtime_innerkits_path}/app_manager:app_manager", "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_services_path}/abilitymgr:abilityms", "${ability_runtime_services_path}/common:perm_verification", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ diff --git a/test/unittest/mission_listener_test/BUILD.gn b/test/unittest/mission_listener_test/BUILD.gn index 87a9b2443f..807ea12c5d 100644 --- a/test/unittest/mission_listener_test/BUILD.gn +++ b/test/unittest/mission_listener_test/BUILD.gn @@ -44,12 +44,10 @@ ohos_unittest("mission_listener_test") { } deps = [ "${ability_runtime_innerkits_path}/ability_manager:ability_manager", + "${ability_runtime_innerkits_path}/app_manager:app_manager", "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_services_path}/abilitymgr:abilityms", "${ability_runtime_services_path}/common:perm_verification", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ diff --git a/test/unittest/mission_test/BUILD.gn b/test/unittest/mission_test/BUILD.gn index ab1c9dc9b8..8ab9f79a9b 100644 --- a/test/unittest/mission_test/BUILD.gn +++ b/test/unittest/mission_test/BUILD.gn @@ -36,13 +36,11 @@ ohos_unittest("mission_test") { } deps = [ "${ability_runtime_innerkits_path}/ability_manager:ability_manager", + "${ability_runtime_innerkits_path}/app_manager:app_manager", "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_services_path}/abilitymgr:abilityms", "${ability_runtime_services_path}/abilitymgr:mission_list", "${ability_runtime_services_path}/common:perm_verification", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ diff --git a/test/unittest/modal_system_app_freeze_uiextension_test/BUILD.gn b/test/unittest/modal_system_app_freeze_uiextension_test/BUILD.gn index 0daac9e660..c3bbb78fdf 100644 --- a/test/unittest/modal_system_app_freeze_uiextension_test/BUILD.gn +++ b/test/unittest/modal_system_app_freeze_uiextension_test/BUILD.gn @@ -49,9 +49,6 @@ ohos_unittest("modal_system_app_freeze_uiextension_test") { "${ability_runtime_services_path}/common:app_util", "${ability_runtime_services_path}/common:perm_verification", "${ability_runtime_services_path}/common:task_handler_wrap", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ diff --git a/test/unittest/modular_object_connect_test/BUILD.gn b/test/unittest/modular_object_connect_test/BUILD.gn index 43c10f9435..b1044168e8 100644 --- a/test/unittest/modular_object_connect_test/BUILD.gn +++ b/test/unittest/modular_object_connect_test/BUILD.gn @@ -64,8 +64,6 @@ ohos_unittest("modular_object_connect_test") { "${ability_runtime_services_path}/common:task_handler_wrap", "${ability_runtime_path}/utils/server/startup:startup_util", "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ diff --git a/test/unittest/modular_object_utils_test/mock/include/os_account_manager_wrapper.h b/test/unittest/modular_object_utils_test/mock/include/os_account_manager_wrapper.h index 0edbcceb0d..093720f80b 100644 --- a/test/unittest/modular_object_utils_test/mock/include/os_account_manager_wrapper.h +++ b/test/unittest/modular_object_utils_test/mock/include/os_account_manager_wrapper.h @@ -23,9 +23,8 @@ namespace OHOS { namespace AppExecFwk { class OsAccountManagerWrapper { - DECLARE_DELAYED_SINGLETON(OsAccountManagerWrapper); public: - int32_t GetOsAccountLocalIdFromUid(int32_t uid, int32_t &id) + static int32_t GetOsAccountLocalIdFromUid(int32_t uid, int32_t &id) { if (MockFlag::getOsAccountRet != 0) { return MockFlag::getOsAccountRet; diff --git a/test/unittest/os_account_manager_wrapper_test/os_account_manager_wrapper_test.cpp b/test/unittest/os_account_manager_wrapper_test/os_account_manager_wrapper_test.cpp index 0ab7ca0038..131785add0 100644 --- a/test/unittest/os_account_manager_wrapper_test/os_account_manager_wrapper_test.cpp +++ b/test/unittest/os_account_manager_wrapper_test/os_account_manager_wrapper_test.cpp @@ -59,7 +59,7 @@ void OsAccountManagerWrapperTest::TearDown() HWTEST_F(OsAccountManagerWrapperTest, GetOsAccountLocalIdFromUid_0100, TestSize.Level1) { int account = ACCOUNT_VALUE; - int ret = DelayedSingleton::GetInstance()->GetOsAccountLocalIdFromUid(UID, account); + int ret = OsAccountManagerWrapper::GetOsAccountLocalIdFromUid(UID, account); EXPECT_EQ(account, ACCOUNT_ID); EXPECT_EQ(ret, RESULT_OK); } @@ -72,7 +72,7 @@ HWTEST_F(OsAccountManagerWrapperTest, GetOsAccountLocalIdFromUid_0100, TestSize. HWTEST_F(OsAccountManagerWrapperTest, GetOsAccountLocalIdFromProcess_0100, TestSize.Level1) { int account = ACCOUNT_VALUE; - int ret = DelayedSingleton::GetInstance()->GetOsAccountLocalIdFromProcess(account); + int ret = OsAccountManagerWrapper::GetOsAccountLocalIdFromProcess(account); EXPECT_EQ(ret, RESULT_OK); } @@ -84,7 +84,7 @@ HWTEST_F(OsAccountManagerWrapperTest, GetOsAccountLocalIdFromProcess_0100, TestS HWTEST_F(OsAccountManagerWrapperTest, IsOsAccountExists_0100, TestSize.Level2) { bool isOsAccountExists = false; - DelayedSingleton::GetInstance()->IsOsAccountExists(ACCOUNT_VALUE, isOsAccountExists); + OsAccountManagerWrapper::IsOsAccountExists(ACCOUNT_VALUE, isOsAccountExists); EXPECT_EQ(isOsAccountExists, false); } @@ -97,7 +97,7 @@ HWTEST_F(OsAccountManagerWrapperTest, CreateOsAccount_0100, TestSize.Level1) { AAFwk::IsMockSaCall::IsMockSpecificSystemAbilityAccessPermission(); int account = ACCOUNT_VALUE; - int ret = DelayedSingleton::GetInstance()->CreateOsAccount(ACCOUNT_NAME, account); + int ret = OsAccountManagerWrapper::CreateOsAccount(ACCOUNT_NAME, account); EXPECT_NE(ret, ERR_ACCOUNT_COMMON_ACCOUNT_NOT_EXIST_ERROR); } @@ -110,9 +110,9 @@ HWTEST_F(OsAccountManagerWrapperTest, RemoveOsAccount_0100, TestSize.Level1) { AAFwk::IsMockSaCall::IsMockSpecificSystemAbilityAccessPermission(); int account = ACCOUNT_VALUE; - int ret = DelayedSingleton::GetInstance()->CreateOsAccount(ACCOUNT_NAME, account); + int ret = OsAccountManagerWrapper::CreateOsAccount(ACCOUNT_NAME, account); EXPECT_NE(ret, ERR_OK); - ret = DelayedSingleton::GetInstance()->RemoveOsAccount(account); + ret = OsAccountManagerWrapper::RemoveOsAccount(account); EXPECT_EQ(ret, ERR_ACCOUNT_COMMON_ACCOUNT_NOT_EXIST_ERROR); } @@ -123,7 +123,7 @@ HWTEST_F(OsAccountManagerWrapperTest, RemoveOsAccount_0100, TestSize.Level1) */ HWTEST_F(OsAccountManagerWrapperTest, GetCurrentActiveAccountId_0100, TestSize.Level1) { - int ret = DelayedSingleton::GetInstance()->GetCurrentActiveAccountId(); + int ret = OsAccountManagerWrapper::GetCurrentActiveAccountId(); EXPECT_EQ(ret, 100); } } // namespace AAFwk diff --git a/test/unittest/pending_want_key_test/BUILD.gn b/test/unittest/pending_want_key_test/BUILD.gn index 9cb5953f49..7d470059eb 100644 --- a/test/unittest/pending_want_key_test/BUILD.gn +++ b/test/unittest/pending_want_key_test/BUILD.gn @@ -30,13 +30,11 @@ ohos_unittest("pending_want_key_test") { deps = [ "${ability_runtime_innerkits_path}/ability_manager:ability_manager", + "${ability_runtime_innerkits_path}/app_manager:app_manager", "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_services_path}/abilitymgr:abilityms", "${ability_runtime_services_path}/abilitymgr:wantagent_manager", "${ability_runtime_services_path}/common:perm_verification", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ diff --git a/test/unittest/pending_want_manager_test/BUILD.gn b/test/unittest/pending_want_manager_test/BUILD.gn index 539c37b000..e9372a896e 100644 --- a/test/unittest/pending_want_manager_test/BUILD.gn +++ b/test/unittest/pending_want_manager_test/BUILD.gn @@ -46,14 +46,13 @@ ohos_unittest("pending_want_manager_test") { } 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_innerkits_path}/wantagent:wantagent_innerkits", "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_services_path}/abilitymgr:abilityms", "${ability_runtime_services_path}/abilitymgr:wantagent_manager", "${ability_runtime_services_path}/common:perm_verification", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] diff --git a/test/unittest/pending_want_record_test/BUILD.gn b/test/unittest/pending_want_record_test/BUILD.gn index e4adc78ec5..4a16a36698 100644 --- a/test/unittest/pending_want_record_test/BUILD.gn +++ b/test/unittest/pending_want_record_test/BUILD.gn @@ -48,7 +48,6 @@ ohos_unittest("pending_want_record_test") { "${ability_runtime_services_path}/abilitymgr:wantagent_manager", "${ability_runtime_services_path}/common:perm_verification", "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] diff --git a/test/unittest/preload_uiext_state_observer_test/BUILD.gn b/test/unittest/preload_uiext_state_observer_test/BUILD.gn index da06caa4bc..a03f6685d8 100644 --- a/test/unittest/preload_uiext_state_observer_test/BUILD.gn +++ b/test/unittest/preload_uiext_state_observer_test/BUILD.gn @@ -49,12 +49,10 @@ ohos_unittest("preload_uiext_state_observer_test") { } deps = [ "${ability_runtime_innerkits_path}/ability_manager:ability_manager", + "${ability_runtime_innerkits_path}/app_manager:app_manager", "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_services_path}/abilitymgr:abilityms", "${ability_runtime_services_path}/common:perm_verification", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ diff --git a/test/unittest/prepare_terminate_callback_proxy_test/BUILD.gn b/test/unittest/prepare_terminate_callback_proxy_test/BUILD.gn index 0c06fa6c02..bcefd7bfca 100644 --- a/test/unittest/prepare_terminate_callback_proxy_test/BUILD.gn +++ b/test/unittest/prepare_terminate_callback_proxy_test/BUILD.gn @@ -48,7 +48,6 @@ ohos_unittest("prepare_terminate_callback_proxy_test") { "${ability_runtime_services_path}/abilitymgr:wantagent_manager", "${ability_runtime_services_path}/common:perm_verification", "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] diff --git a/test/unittest/quick_fix/quick_fix_manager_service_second_test/BUILD.gn b/test/unittest/quick_fix/quick_fix_manager_service_second_test/BUILD.gn index dca90bc201..f0f8c1a0f3 100644 --- a/test/unittest/quick_fix/quick_fix_manager_service_second_test/BUILD.gn +++ b/test/unittest/quick_fix/quick_fix_manager_service_second_test/BUILD.gn @@ -16,6 +16,13 @@ import("//build/test.gni") import("//foundation/ability/ability_runtime/ability_runtime.gni") ohos_unittest("quick_fix_manager_service_second_test") { + branch_protector_ret = "pac_ret" + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + } + module_out_path = "ability_runtime/ability_runtime/quick_fix" include_dirs = [ diff --git a/test/unittest/quick_fix/quick_fix_manager_service_test/BUILD.gn b/test/unittest/quick_fix/quick_fix_manager_service_test/BUILD.gn index f23381ada2..048c38aafd 100644 --- a/test/unittest/quick_fix/quick_fix_manager_service_test/BUILD.gn +++ b/test/unittest/quick_fix/quick_fix_manager_service_test/BUILD.gn @@ -16,6 +16,13 @@ import("//build/test.gni") import("//foundation/ability/ability_runtime/ability_runtime.gni") ohos_unittest("quick_fix_manager_service_test") { + branch_protector_ret = "pac_ret" + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + } + module_out_path = "ability_runtime/ability_runtime/quick_fix" include_dirs = [ @@ -67,6 +74,13 @@ ohos_unittest("quick_fix_manager_service_test") { } ohos_unittest("quick_fix_manager_apply_task_test") { + branch_protector_ret = "pac_ret" + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + } + module_out_path = "ability_runtime/ability_runtime/quick_fix" include_dirs = [ diff --git a/test/unittest/recovery_info_timer_test/BUILD.gn b/test/unittest/recovery_info_timer_test/BUILD.gn index a481c370d2..6884947d96 100644 --- a/test/unittest/recovery_info_timer_test/BUILD.gn +++ b/test/unittest/recovery_info_timer_test/BUILD.gn @@ -43,12 +43,10 @@ ohos_unittest("recovery_info_timer_test") { } deps = [ "${ability_runtime_innerkits_path}/ability_manager:ability_manager", + "${ability_runtime_innerkits_path}/app_manager:app_manager", "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_services_path}/abilitymgr:abilityms", "${ability_runtime_services_path}/common:perm_verification", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ diff --git a/test/unittest/remote_mission_listener_proxy_test/BUILD.gn b/test/unittest/remote_mission_listener_proxy_test/BUILD.gn index aff0e07808..39ed5123f7 100755 --- a/test/unittest/remote_mission_listener_proxy_test/BUILD.gn +++ b/test/unittest/remote_mission_listener_proxy_test/BUILD.gn @@ -43,12 +43,10 @@ ohos_unittest("remote_mission_listener_proxy_test") { } deps = [ "${ability_runtime_innerkits_path}/ability_manager:ability_manager", + "${ability_runtime_innerkits_path}/app_manager:app_manager", "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_services_path}/abilitymgr:abilityms", "${ability_runtime_services_path}/common:perm_verification", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ diff --git a/test/unittest/resident_process_manager_test/BUILD.gn b/test/unittest/resident_process_manager_test/BUILD.gn index e3d2f590a9..34150012a8 100755 --- a/test/unittest/resident_process_manager_test/BUILD.gn +++ b/test/unittest/resident_process_manager_test/BUILD.gn @@ -46,9 +46,6 @@ ohos_unittest("resident_process_manager_test") { "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_services_path}/abilitymgr:abilityms", "${ability_runtime_services_path}/common:perm_verification", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ diff --git a/test/unittest/restart_app_manager_test/BUILD.gn b/test/unittest/restart_app_manager_test/BUILD.gn index 05127dcf78..12c97619bd 100644 --- a/test/unittest/restart_app_manager_test/BUILD.gn +++ b/test/unittest/restart_app_manager_test/BUILD.gn @@ -43,12 +43,10 @@ ohos_unittest("restart_app_manager_test") { } deps = [ "${ability_runtime_innerkits_path}/ability_manager:ability_manager", + "${ability_runtime_innerkits_path}/app_manager:app_manager", "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_services_path}/abilitymgr:abilityms", "${ability_runtime_services_path}/common:perm_verification", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ diff --git a/test/unittest/sender_info_test/BUILD.gn b/test/unittest/sender_info_test/BUILD.gn index d20919b99c..1f0dc22074 100644 --- a/test/unittest/sender_info_test/BUILD.gn +++ b/test/unittest/sender_info_test/BUILD.gn @@ -39,13 +39,11 @@ ohos_unittest("sender_info_test") { } deps = [ "${ability_runtime_innerkits_path}/ability_manager:ability_manager", + "${ability_runtime_innerkits_path}/app_manager:app_manager", "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_services_path}/abilitymgr:abilityms", "${ability_runtime_services_path}/abilitymgr:wantagent_manager", "${ability_runtime_services_path}/common:perm_verification", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ diff --git a/test/unittest/service_extension_context_test/BUILD.gn b/test/unittest/service_extension_context_test/BUILD.gn index 1c511bc5e1..195d846a81 100644 --- a/test/unittest/service_extension_context_test/BUILD.gn +++ b/test/unittest/service_extension_context_test/BUILD.gn @@ -41,6 +41,7 @@ ohos_unittest("service_extension_context_test") { deps = [ "${ability_runtime_innerkits_path}/ability_manager:ability_connect_callback_stub", "${ability_runtime_innerkits_path}/ability_manager:ability_manager", + "${ability_runtime_innerkits_path}/app_manager:app_manager", "${ability_runtime_innerkits_path}/runtime:runtime", "${ability_runtime_napi_path}/inner/napi_common:napi_common", "${ability_runtime_native_path}/ability/native:ability_business_error", @@ -52,9 +53,6 @@ ohos_unittest("service_extension_context_test") { "${ability_runtime_path}/services/abilitymgr:abilityms_target", "${ability_runtime_services_path}/abilitymgr:abilityms", "${ability_runtime_services_path}/common:perm_verification", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ diff --git a/test/unittest/skill_execute_callback_proxy_test/BUILD.gn b/test/unittest/skill_execute_callback_proxy_test/BUILD.gn index 2472fe7b30..e63522e05f 100644 --- a/test/unittest/skill_execute_callback_proxy_test/BUILD.gn +++ b/test/unittest/skill_execute_callback_proxy_test/BUILD.gn @@ -38,12 +38,11 @@ ohos_unittest("skill_execute_callback_proxy_test") { 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}/ability/native:abilitykit_native", "${ability_runtime_services_path}/abilitymgr:abilityms", "${ability_runtime_services_path}/abilitymgr:abilityms_target", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ diff --git a/test/unittest/skill_execute_callback_stub_test/BUILD.gn b/test/unittest/skill_execute_callback_stub_test/BUILD.gn index 803b2a083d..338671e6cb 100644 --- a/test/unittest/skill_execute_callback_stub_test/BUILD.gn +++ b/test/unittest/skill_execute_callback_stub_test/BUILD.gn @@ -38,12 +38,11 @@ ohos_unittest("skill_execute_callback_stub_test") { 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}/ability/native:abilitykit_native", "${ability_runtime_services_path}/abilitymgr:abilityms", "${ability_runtime_services_path}/abilitymgr:abilityms_target", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ diff --git a/test/unittest/specified_mission_list_test/BUILD.gn b/test/unittest/specified_mission_list_test/BUILD.gn index 0c646d7d8a..5b9c7ba94a 100644 --- a/test/unittest/specified_mission_list_test/BUILD.gn +++ b/test/unittest/specified_mission_list_test/BUILD.gn @@ -45,6 +45,7 @@ ohos_unittest("specified_mission_list_test") { deps = [ "${ability_runtime_innerkits_path}/ability_manager:ability_manager", "${ability_runtime_innerkits_path}/ability_manager:ability_start_setting", + "${ability_runtime_innerkits_path}/app_manager:app_manager", "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_native_path}/ability/native:auto_startup_callback", "${ability_runtime_native_path}/appkit:appkit_manager_helper", @@ -52,9 +53,6 @@ ohos_unittest("specified_mission_list_test") { "${ability_runtime_services_path}/abilitymgr:mission_list", "${ability_runtime_services_path}/common:app_util", "${ability_runtime_services_path}/common:perm_verification", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ diff --git a/test/unittest/start_options_test/BUILD.gn b/test/unittest/start_options_test/BUILD.gn index ee5e5e48d3..6d32b177d5 100755 --- a/test/unittest/start_options_test/BUILD.gn +++ b/test/unittest/start_options_test/BUILD.gn @@ -34,9 +34,6 @@ ohos_unittest("start_options_test") { "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_services_path}/abilitymgr:abilityms", "${ability_runtime_services_path}/common:perm_verification", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ diff --git a/test/unittest/stop_user_callback_proxy_test/BUILD.gn b/test/unittest/stop_user_callback_proxy_test/BUILD.gn index 1453a09457..4542160757 100755 --- a/test/unittest/stop_user_callback_proxy_test/BUILD.gn +++ b/test/unittest/stop_user_callback_proxy_test/BUILD.gn @@ -36,12 +36,10 @@ ohos_unittest("stop_user_callback_proxy_test") { } deps = [ "${ability_runtime_innerkits_path}/ability_manager:ability_manager", + "${ability_runtime_innerkits_path}/app_manager:app_manager", "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_services_path}/abilitymgr:abilityms", "${ability_runtime_services_path}/common:perm_verification", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ diff --git a/test/unittest/stop_user_callback_stub_test/BUILD.gn b/test/unittest/stop_user_callback_stub_test/BUILD.gn index 1e77ad3d5a..cc9b5d3b90 100644 --- a/test/unittest/stop_user_callback_stub_test/BUILD.gn +++ b/test/unittest/stop_user_callback_stub_test/BUILD.gn @@ -39,12 +39,10 @@ ohos_unittest("stop_user_callback_stub_test") { } deps = [ "${ability_runtime_innerkits_path}/ability_manager:ability_manager", + "${ability_runtime_innerkits_path}/app_manager:app_manager", "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_services_path}/abilitymgr:abilityms", "${ability_runtime_services_path}/common:perm_verification", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ diff --git a/test/unittest/system_ability_token_callback_stub_test/BUILD.gn b/test/unittest/system_ability_token_callback_stub_test/BUILD.gn index 3abba1b25a..816883fba3 100644 --- a/test/unittest/system_ability_token_callback_stub_test/BUILD.gn +++ b/test/unittest/system_ability_token_callback_stub_test/BUILD.gn @@ -36,9 +36,6 @@ ohos_unittest("system_ability_token_callback_stub_test") { "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_services_path}/abilitymgr:abilityms", "${ability_runtime_services_path}/common:perm_verification", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ diff --git a/test/unittest/task_data_persistence_mgr_test/BUILD.gn b/test/unittest/task_data_persistence_mgr_test/BUILD.gn index 13676d5655..23051530e7 100755 --- a/test/unittest/task_data_persistence_mgr_test/BUILD.gn +++ b/test/unittest/task_data_persistence_mgr_test/BUILD.gn @@ -37,13 +37,11 @@ ohos_unittest("task_data_persistence_mgr_test") { deps = [ "${ability_runtime_innerkits_path}/ability_manager:ability_manager", "${ability_runtime_innerkits_path}/ability_manager:mission_info", + "${ability_runtime_innerkits_path}/app_manager:app_manager", "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_services_path}/abilitymgr:abilityms", "${ability_runtime_services_path}/abilitymgr:mission_list", "${ability_runtime_services_path}/common:perm_verification", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ diff --git a/test/unittest/ui_extension_ability_manager_second_test/BUILD.gn b/test/unittest/ui_extension_ability_manager_second_test/BUILD.gn index 673adb729d..a9db178cc8 100644 --- a/test/unittest/ui_extension_ability_manager_second_test/BUILD.gn +++ b/test/unittest/ui_extension_ability_manager_second_test/BUILD.gn @@ -55,7 +55,6 @@ ohos_unittest("ui_extension_ability_manager_second_test") { "${ability_runtime_services_path}/common:perm_verification", "${ability_runtime_services_path}/common:task_handler_wrap", "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] diff --git a/test/unittest/ui_extension_ability_manager_test/BUILD.gn b/test/unittest/ui_extension_ability_manager_test/BUILD.gn index 9c2cf32fce..820391f972 100644 --- a/test/unittest/ui_extension_ability_manager_test/BUILD.gn +++ b/test/unittest/ui_extension_ability_manager_test/BUILD.gn @@ -55,7 +55,6 @@ ohos_unittest("ui_extension_ability_manager_test") { "${ability_runtime_services_path}/common:perm_verification", "${ability_runtime_services_path}/common:task_handler_wrap", "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] diff --git a/test/unittest/ui_extension_record_factory_test/BUILD.gn b/test/unittest/ui_extension_record_factory_test/BUILD.gn index 5c0d266370..7972e9814a 100644 --- a/test/unittest/ui_extension_record_factory_test/BUILD.gn +++ b/test/unittest/ui_extension_record_factory_test/BUILD.gn @@ -59,6 +59,7 @@ ohos_unittest("ui_extension_record_factory_test") { "${ability_runtime_innerkits_path}/ability_manager:ability_start_options", "${ability_runtime_innerkits_path}/ability_manager:ability_start_setting", "${ability_runtime_innerkits_path}/ability_manager:mission_info", + "${ability_runtime_innerkits_path}/app_manager:app_manager", "${ability_runtime_innerkits_path}/deps_wrapper:ability_deps_wrapper", "${ability_runtime_innerkits_path}/uri_permission:uri_permission_mgr", "${ability_runtime_native_path}/ability/native:abilitykit_native", @@ -72,9 +73,6 @@ ohos_unittest("ui_extension_record_factory_test") { "${ability_runtime_services_path}/abilitymgr:mission_list", "${ability_runtime_services_path}/common:app_util", "${ability_runtime_services_path}/common:perm_verification", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] if (ability_runtime_upms) { diff --git a/test/unittest/want_receiver_proxy_test/BUILD.gn b/test/unittest/want_receiver_proxy_test/BUILD.gn index 4b2cdb9320..38ef501771 100644 --- a/test/unittest/want_receiver_proxy_test/BUILD.gn +++ b/test/unittest/want_receiver_proxy_test/BUILD.gn @@ -42,13 +42,11 @@ ohos_unittest("want_receiver_proxy_test") { } deps = [ "${ability_runtime_innerkits_path}/ability_manager:ability_manager", + "${ability_runtime_innerkits_path}/app_manager:app_manager", "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_services_path}/abilitymgr:abilityms", "${ability_runtime_services_path}/abilitymgr:wantagent_manager", "${ability_runtime_services_path}/common:perm_verification", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ diff --git a/test/unittest/want_receiver_stub_test/BUILD.gn b/test/unittest/want_receiver_stub_test/BUILD.gn index efd7739e41..997a40a72f 100644 --- a/test/unittest/want_receiver_stub_test/BUILD.gn +++ b/test/unittest/want_receiver_stub_test/BUILD.gn @@ -42,13 +42,11 @@ ohos_unittest("want_receiver_stub_test") { } deps = [ "${ability_runtime_innerkits_path}/ability_manager:ability_manager", + "${ability_runtime_innerkits_path}/app_manager:app_manager", "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_services_path}/abilitymgr:abilityms", "${ability_runtime_services_path}/abilitymgr:wantagent_manager", "${ability_runtime_services_path}/common:perm_verification", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ diff --git a/test/unittest/want_sender_info_test/BUILD.gn b/test/unittest/want_sender_info_test/BUILD.gn index 407ba0a5d8..527ef04fb6 100644 --- a/test/unittest/want_sender_info_test/BUILD.gn +++ b/test/unittest/want_sender_info_test/BUILD.gn @@ -19,50 +19,24 @@ module_output_path = "ability_runtime/ability_runtime/abilitymgr" ohos_unittest("want_sender_info_test") { module_out_path = module_output_path - include_dirs = [ "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/system_ability_mock" ] - sources = [ - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core/src/appmgr/mock_app_scheduler.cpp", + "${ability_runtime_services_path}/abilitymgr/src/want_sender_info.cpp", + "${ability_runtime_services_path}/abilitymgr/src/wants_info.cpp", "want_sender_info_test.cpp", ] - configs = [ - "${ability_runtime_services_path}/abilitymgr:abilityms_config", - "${ability_runtime_test_path}/mock/services_abilitymgr_test:aafwk_mock_config", - ] + configs = [ "${ability_runtime_services_path}/abilitymgr:abilityms_config" ] cflags = [] if (target_cpu == "arm") { cflags += [ "-DBINDER_IPC_32BIT" ] } - deps = [ - "${ability_runtime_innerkits_path}/ability_manager:ability_manager", - "${ability_runtime_native_path}/ability/native:abilitykit_native", - "${ability_runtime_services_path}/abilitymgr:abilityms", - "${ability_runtime_services_path}/abilitymgr:wantagent_manager", - "${ability_runtime_services_path}/common:perm_verification", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", - ] external_deps = [ "ability_base:want", - "ability_base:zuri", - "access_token:libaccesstoken_sdk", "c_utils:utils", - "common_event_service:cesfwk_innerkits", - "ffrt:libffrt", - "googletest:gmock_main", - "googletest:gtest_main", "hilog:libhilog", "ipc:ipc_core", - "napi:ace_napi", - "samgr:samgr_proxy", ] - - if (background_task_mgr_continuous_task_enable) { - external_deps += [ "background_task_mgr:bgtaskmgr_innerkits" ] - } } group("unittest") { diff --git a/test/unittest/want_sender_info_test/want_sender_info_test.cpp b/test/unittest/want_sender_info_test/want_sender_info_test.cpp index 226a6597b1..bae9e9020b 100644 --- a/test/unittest/want_sender_info_test/want_sender_info_test.cpp +++ b/test/unittest/want_sender_info_test/want_sender_info_test.cpp @@ -15,14 +15,11 @@ #include #include "parcel.h" -#include "sender_info.h" -#include "wants_info.h" #define private public #define protected public #include "want_sender_info.h" #undef private #undef protected -#include "want_receiver_stub.h" using namespace testing; using namespace testing::ext; @@ -31,32 +28,14 @@ using OHOS::AppExecFwk::ElementName; namespace OHOS { namespace AAFwk { -#define SLEEP(milli) std::this_thread::sleep_for(std::chrono::seconds(milli)) -namespace {} // namespace class WantSenderInfoTest : public testing::Test { public: static void SetUpTestCase(); static void TearDownTestCase(); void SetUp(); void TearDown(); - static constexpr int TEST_WAIT_TIME = 100000; - class CancelReceiver : public AAFwk::WantReceiverStub { - public: - int performReceiveCount = 0; - void Send(const int32_t resultCode) override; - void PerformReceive(const AAFwk::Want& want, int resultCode, const std::string& data, - const AAFwk::WantParams& extras, bool serialized, bool sticky, int sendingUser) override; - }; - -public: }; -void WantSenderInfoTest::CancelReceiver::Send(const int32_t resultCode) -{} -void WantSenderInfoTest::CancelReceiver::PerformReceive(const AAFwk::Want& want, int resultCode, - const std::string& data, const AAFwk::WantParams& extras, bool serialized, bool sticky, int sendingUser) -{} - void WantSenderInfoTest::SetUpTestCase() {} diff --git a/test/unittest/want_sender_proxy_test/BUILD.gn b/test/unittest/want_sender_proxy_test/BUILD.gn index 889e8ca2fd..86f575e239 100644 --- a/test/unittest/want_sender_proxy_test/BUILD.gn +++ b/test/unittest/want_sender_proxy_test/BUILD.gn @@ -42,13 +42,11 @@ ohos_unittest("want_sender_proxy_test") { } deps = [ "${ability_runtime_innerkits_path}/ability_manager:ability_manager", + "${ability_runtime_innerkits_path}/app_manager:app_manager", "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_services_path}/abilitymgr:abilityms", "${ability_runtime_services_path}/abilitymgr:wantagent_manager", "${ability_runtime_services_path}/common:perm_verification", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ diff --git a/test/unittest/want_sender_stub_test/BUILD.gn b/test/unittest/want_sender_stub_test/BUILD.gn index 52e4c0acd9..b5d29ad4be 100644 --- a/test/unittest/want_sender_stub_test/BUILD.gn +++ b/test/unittest/want_sender_stub_test/BUILD.gn @@ -42,13 +42,11 @@ ohos_unittest("want_sender_stub_test") { } deps = [ "${ability_runtime_innerkits_path}/ability_manager:ability_manager", + "${ability_runtime_innerkits_path}/app_manager:app_manager", "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_services_path}/abilitymgr:abilityms", "${ability_runtime_services_path}/abilitymgr:wantagent_manager", "${ability_runtime_services_path}/common:perm_verification", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ diff --git a/test/unittest/wants_info_test/BUILD.gn b/test/unittest/wants_info_test/BUILD.gn index 04fbf643b1..b18ad3db2b 100644 --- a/test/unittest/wants_info_test/BUILD.gn +++ b/test/unittest/wants_info_test/BUILD.gn @@ -19,10 +19,8 @@ module_output_path = "ability_runtime/ability_runtime/abilitymgr" ohos_unittest("wants_info_test") { module_out_path = module_output_path - include_dirs = [ "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/system_ability_mock" ] - sources = [ - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core/src/appmgr/mock_app_scheduler.cpp", + "${ability_runtime_services_path}/abilitymgr/src/wants_info.cpp", "wants_info_test.cpp", ] @@ -31,34 +29,12 @@ ohos_unittest("wants_info_test") { if (target_cpu == "arm") { cflags += [ "-DBINDER_IPC_32BIT" ] } - deps = [ - "${ability_runtime_innerkits_path}/ability_manager:ability_manager", - "${ability_runtime_native_path}/ability/native:abilitykit_native", - "${ability_runtime_services_path}/abilitymgr:wantagent_manager", - "${ability_runtime_services_path}/common:perm_verification", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", - ] external_deps = [ "ability_base:want", - "ability_base:zuri", - "access_token:libaccesstoken_sdk", "c_utils:utils", - "common_event_service:cesfwk_innerkits", - "ffrt:libffrt", - "googletest:gmock_main", - "googletest:gtest_main", - "hilog:libhilog", "ipc:ipc_core", - "napi:ace_napi", - "samgr:samgr_proxy", ] - - if (background_task_mgr_continuous_task_enable) { - external_deps += [ "background_task_mgr:bgtaskmgr_innerkits" ] - } } group("unittest") { diff --git a/test/unittest/wants_info_test/wants_info_test.cpp b/test/unittest/wants_info_test/wants_info_test.cpp index 1c96533508..891799db69 100644 --- a/test/unittest/wants_info_test/wants_info_test.cpp +++ b/test/unittest/wants_info_test/wants_info_test.cpp @@ -15,13 +15,11 @@ #include #include "parcel.h" -#include "sender_info.h" #define private public #define protected public #include "wants_info.h" #undef private #undef protected -#include "want_receiver_stub.h" using namespace testing; using namespace testing::ext; @@ -38,24 +36,10 @@ public: static void TearDownTestCase(); void SetUp(); void TearDown(); - static constexpr int TEST_WAIT_TIME = 100000; - class CancelReceiver : public AAFwk::WantReceiverStub { - public: - int performReceiveCount = 0; - void Send(const int32_t resultCode) override; - void PerformReceive(const AAFwk::Want& want, int resultCode, const std::string& data, - const AAFwk::WantParams& extras, bool serialized, bool sticky, int sendingUser) override; - }; public: }; -void WantsInfoTest::CancelReceiver::Send(const int32_t resultCode) -{} -void WantsInfoTest::CancelReceiver::PerformReceive(const AAFwk::Want& want, int resultCode, const std::string& data, - const AAFwk::WantParams& extras, bool serialized, bool sticky, int sendingUser) -{} - void WantsInfoTest::SetUpTestCase() {} diff --git a/test/unittest/window_config_test/BUILD.gn b/test/unittest/window_config_test/BUILD.gn index 2d53f89cf2..1f9ff7e614 100644 --- a/test/unittest/window_config_test/BUILD.gn +++ b/test/unittest/window_config_test/BUILD.gn @@ -50,9 +50,6 @@ ohos_unittest("window_config_test") { "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_services_path}/abilitymgr:abilityms", "${ability_runtime_services_path}/common:perm_verification", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ diff --git a/test/unittest/window_focus_changed_listener_test/BUILD.gn b/test/unittest/window_focus_changed_listener_test/BUILD.gn index 731369cc70..8f509c5045 100644 --- a/test/unittest/window_focus_changed_listener_test/BUILD.gn +++ b/test/unittest/window_focus_changed_listener_test/BUILD.gn @@ -64,6 +64,7 @@ ohos_unittest("window_focus_changed_listener_test") { "${ability_runtime_innerkits_path}/ability_manager:ability_start_options", "${ability_runtime_innerkits_path}/ability_manager:ability_start_setting", "${ability_runtime_innerkits_path}/ability_manager:mission_info", + "${ability_runtime_innerkits_path}/app_manager:app_manager", "${ability_runtime_innerkits_path}/deps_wrapper:ability_deps_wrapper", "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_native_path}/ability/native:auto_startup_callback", @@ -74,9 +75,6 @@ ohos_unittest("window_focus_changed_listener_test") { "${ability_runtime_services_path}/abilitymgr:abilityms", "${ability_runtime_services_path}/abilitymgr:mission_list", "${ability_runtime_services_path}/common:perm_verification", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", ] external_deps = [ diff --git a/tools/aa/BUILD.gn b/tools/aa/BUILD.gn index 922d702312..294318fd3b 100644 --- a/tools/aa/BUILD.gn +++ b/tools/aa/BUILD.gn @@ -28,6 +28,8 @@ config("ability_command_exception_config") { } ohos_static_library("tools_aa_source_set") { + branch_protector_ret = "pac_ret" + sources = [ "src/ability_command.cpp", "src/ability_start_with_observer.cpp", @@ -86,6 +88,8 @@ ohos_static_library("tools_aa_source_set") { } ohos_executable("aa") { + branch_protector_ret = "pac_ret" + sources = [ "src/main.cpp" ] cflags = [] diff --git a/tools/ohos-aa/BUILD.gn b/tools/ohos-aa/BUILD.gn index ed7fade19c..5660619999 100644 --- a/tools/ohos-aa/BUILD.gn +++ b/tools/ohos-aa/BUILD.gn @@ -30,6 +30,8 @@ config("ohos_aa_command_exception_config") { } ohos_static_library("ohos_aa_cli_source_set") { + branch_protector_ret = "pac_ret" + sources = [ "src/ohos_aa_command.cpp", "${ability_runtime_path}/tools/aa/src/ability_start_with_observer.cpp", diff --git a/tools/ohos-aa/tests/BUILD.gn b/tools/ohos-aa/tests/BUILD.gn index 3a3bfe4a24..14dbe55d96 100644 --- a/tools/ohos-aa/tests/BUILD.gn +++ b/tools/ohos-aa/tests/BUILD.gn @@ -24,6 +24,13 @@ tools_ohos_aa_mock_sources = [ "${ability_runtime_path}/tools/test/mock/mock_ability_manager_stub.cpp" ] ohos_unittest("ohos_aa_command_start_test") { + branch_protector_ret = "pac_ret" + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + } + module_out_path = module_output_path sources = [ "ohos_aa_command_start_test.cpp" ] @@ -53,6 +60,13 @@ ohos_unittest("ohos_aa_command_start_test") { } ohos_unittest("ohos_aa_command_force_stop_test") { + branch_protector_ret = "pac_ret" + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + } + module_out_path = module_output_path sources = [ "ohos_aa_command_force_stop_test.cpp" ] @@ -82,6 +96,13 @@ ohos_unittest("ohos_aa_command_force_stop_test") { } ohos_unittest("ohos_aa_command_util_test") { + branch_protector_ret = "pac_ret" + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + } + module_out_path = module_output_path sources = [ "ohos_aa_command_util_test.cpp" ] diff --git a/utils/global/freeze/BUILD.gn b/utils/global/freeze/BUILD.gn index 8b5e161a24..aa5e728cd9 100644 --- a/utils/global/freeze/BUILD.gn +++ b/utils/global/freeze/BUILD.gn @@ -21,6 +21,12 @@ config("freeze_util_config") { ohos_shared_library("freeze_util") { branch_protector_ret = "pac_ret" + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + } + include_dirs = [ "${ability_runtime_path}/utils/global/time/include", "${ability_runtime_services_path}/common/include",