From 73fe32b5bb89374b82d544e7ef925ebfba98d425 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=A5=E7=BB=B4?= Date: Mon, 9 Jun 2025 14:09:09 +0800 Subject: [PATCH 1/9] =?UTF-8?q?description:=E5=85=83=E8=83=BD=E5=8A=9BIDL?= =?UTF-8?q?=E5=8C=96=E6=95=B4=E6=94=B9-001?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 查维 --- frameworks/cj/ffi/want_agent/BUILD.gn | 1 + frameworks/native/ability/native/BUILD.gn | 10 +- interfaces/inner_api/ability_manager/BUILD.gn | 103 ++++++++++- .../idl/IUserCallback.idl} | 42 +---- .../include/ability_manager_interface.h | 4 +- .../ability_manager/include/user_callback.h | 65 ------- .../include/user_callback_proxy.h | 65 ------- interfaces/inner_api/app_manager/BUILD.gn | 120 ++++++++++++- .../IAbilityDebugResponse.idl} | 34 +--- .../IAppDebugListener.idl} | 34 +--- .../idl/IStartSpecifiedAbilityResponse.idl} | 43 ++--- .../appmgr/ability_debug_response_interface.h | 54 ------ .../appmgr/ability_debug_response_proxy.h | 56 ------ .../include/appmgr/ams_mgr_interface.h | 6 +- .../include/appmgr/ams_mgr_proxy.h | 2 +- .../include/appmgr/app_debug_listener_proxy.h | 49 ------ .../include/appmgr/app_mgr_client.h | 4 +- .../include/appmgr/app_mgr_interface.h | 2 +- .../istart_specified_ability_response.h | 59 ------- .../start_specified_ability_response_proxy.h | 56 ------ .../start_specified_ability_response_stub.h | 45 ----- .../appmgr/ability_debug_response_proxy.cpp | 131 -------------- .../appmgr/ability_debug_response_stub.cpp | 118 ------------- .../app_manager/src/appmgr/ams_mgr_stub.cpp | 2 +- .../src/appmgr/app_debug_listener_proxy.cpp | 87 --------- .../src/appmgr/app_debug_listener_stub.cpp | 98 ----------- ...start_specified_ability_response_proxy.cpp | 165 ------------------ .../start_specified_ability_response_stub.cpp | 88 ---------- interfaces/inner_api/wantagent/BUILD.gn | 6 +- services/abilitymgr/abilitymgr.gni | 1 - .../abilitymgr/include/ability_debug_deal.h | 8 +- .../include/ability_manager_service.h | 8 +- services/abilitymgr/include/app_scheduler.h | 18 +- .../abilitymgr/src/ability_debug_deal.cpp | 21 ++- services/abilitymgr/src/app_scheduler.cpp | 15 +- .../abilitymgr/src/user_callback_proxy.cpp | 73 -------- .../abilitymgr/src/user_callback_stub.cpp | 75 -------- services/appmgr/include/ams_mgr_scheduler.h | 2 +- services/appmgr/include/app_debug_manager.h | 2 +- .../appmgr/include/app_mgr_service_inner.h | 6 +- services/appmgr/include/app_running_manager.h | 4 +- .../fuzztest/abilitydebugdeal_fuzzer/BUILD.gn | 2 +- .../abilitydebugresponseproxy_fuzzer/BUILD.gn | 2 +- .../abilitydebugresponseproxy_fuzzer.cpp | 6 - ...appmgrabilitydebugresponseproxy_fuzzer.cpp | 12 -- ...acesappmgrappdebuglistenerproxy_fuzzer.cpp | 10 -- ...facesappmgrappdebuglistenerstub_fuzzer.cpp | 9 +- .../usercallbackstub_fuzzer.cpp | 10 +- test/moduletest/app_mgr_client_test/BUILD.gn | 7 +- test/unittest/BUILD.gn | 5 +- .../ability_debug_response_stub_test.cpp | 4 +- .../mock_ability_debug_response_stub.h | 6 +- .../BUILD.gn | 7 +- .../BUILD.gn | 7 +- .../BUILD.gn | 7 +- .../BUILD.gn | 7 +- .../BUILD.gn | 7 +- .../ability_manager_proxy_test/BUILD.gn | 7 +- .../ability_manager_proxy_third_test/BUILD.gn | 7 +- .../ability_manager_proxy_third_test.cpp | 6 +- .../ability_manager_service_eighth_test.cpp | 9 +- .../BUILD.gn | 1 - .../BUILD.gn | 1 - .../mock/include/mock_test_object.h | 10 +- .../BUILD.gn | 7 +- .../ability_scheduler_stub_test/BUILD.gn | 7 +- .../ams_ability_running_record_test/BUILD.gn | 6 + .../ams_mgr_scheduler_dump_test/BUILD.gn | 7 +- .../BUILD.gn | 6 + .../app_debug_listener_proxy_test/BUILD.gn | 7 +- .../app_debug_listener_proxy_test.cpp | 15 +- .../app_debug_listener_stub_mock.h | 6 +- .../app_debug_listener_stub_test.cpp | 24 ++- .../mock_app_debug_listener_stub.h | 4 +- test/unittest/app_mgr_client_test/BUILD.gn | 7 +- .../app_mgr_service_inner_eighth_test.cpp | 49 ++++-- .../mock_ability_debug_response_stub.h | 6 +- .../app_mgr_service_inner_seventh_test.cpp | 30 ++-- .../app_mgr_service_inner_test.cpp | 10 +- test/unittest/app_preloader_test/BUILD.gn | 1 + .../BUILD.gn | 7 +- .../app_state_observer_manager_test/BUILD.gn | 6 + .../BUILD.gn | 6 + test/unittest/call_record_test/BUILD.gn | 7 +- .../data_ability_manager_test/BUILD.gn | 2 + test/unittest/dfr_test/watchdog_test/BUILD.gn | 1 + .../BUILD.gn | 9 +- test/unittest/mission_list_test/BUILD.gn | 1 + test/unittest/pending_want_test/BUILD.gn | 6 + .../quick_fix_manager_service_test/BUILD.gn | 6 +- .../service_extension_context_test/BUILD.gn | 7 +- test/unittest/state_utils_test/BUILD.gn | 2 +- .../stop_user_callback_proxy_test/BUILD.gn | 7 +- .../stop_user_callback_proxy_test.cpp | 4 +- .../stop_user_callback_stub_mock.h | 8 +- .../stop_user_callback_stub_test/BUILD.gn | 7 +- .../stop_user_callback_stub_test.cpp | 10 +- .../timeout_state_utils_test/BUILD.gn | 5 +- test/unittest/unlock_screen_test/BUILD.gn | 1 + test/unittest/user_controller_test/BUILD.gn | 6 + .../user_controller_test.cpp | 13 +- test/unittest/want_sender_info_test/BUILD.gn | 7 +- tools/aa/BUILD.gn | 3 + 103 files changed, 616 insertions(+), 1638 deletions(-) rename interfaces/inner_api/{app_manager/include/appmgr/app_debug_listener_interface.h => ability_manager/idl/IUserCallback.idl} (32%) delete mode 100644 interfaces/inner_api/ability_manager/include/user_callback.h delete mode 100644 interfaces/inner_api/ability_manager/include/user_callback_proxy.h rename interfaces/inner_api/app_manager/{include/appmgr/app_debug_listener_stub.h => idl/IAbilityDebugResponse.idl} (39%) rename interfaces/inner_api/app_manager/{include/appmgr/ability_debug_response_stub.h => idl/IAppDebugListener.idl} (35%) rename interfaces/inner_api/{ability_manager/include/user_callback_stub.h => app_manager/idl/IStartSpecifiedAbilityResponse.idl} (35%) delete mode 100644 interfaces/inner_api/app_manager/include/appmgr/ability_debug_response_interface.h delete mode 100644 interfaces/inner_api/app_manager/include/appmgr/ability_debug_response_proxy.h delete mode 100644 interfaces/inner_api/app_manager/include/appmgr/app_debug_listener_proxy.h delete mode 100644 interfaces/inner_api/app_manager/include/appmgr/istart_specified_ability_response.h delete mode 100644 interfaces/inner_api/app_manager/include/appmgr/start_specified_ability_response_proxy.h delete mode 100644 interfaces/inner_api/app_manager/include/appmgr/start_specified_ability_response_stub.h delete mode 100644 interfaces/inner_api/app_manager/src/appmgr/ability_debug_response_proxy.cpp delete mode 100644 interfaces/inner_api/app_manager/src/appmgr/ability_debug_response_stub.cpp delete mode 100644 interfaces/inner_api/app_manager/src/appmgr/app_debug_listener_proxy.cpp delete mode 100644 interfaces/inner_api/app_manager/src/appmgr/app_debug_listener_stub.cpp delete mode 100644 interfaces/inner_api/app_manager/src/appmgr/start_specified_ability_response_proxy.cpp delete mode 100644 interfaces/inner_api/app_manager/src/appmgr/start_specified_ability_response_stub.cpp delete mode 100644 services/abilitymgr/src/user_callback_proxy.cpp delete mode 100644 services/abilitymgr/src/user_callback_stub.cpp diff --git a/frameworks/cj/ffi/want_agent/BUILD.gn b/frameworks/cj/ffi/want_agent/BUILD.gn index b6e9447be76..7f9e9ea2ba6 100644 --- a/frameworks/cj/ffi/want_agent/BUILD.gn +++ b/frameworks/cj/ffi/want_agent/BUILD.gn @@ -35,6 +35,7 @@ config("cj_want_agent_public_config") { "${ability_runtime_path}/interfaces/kits/native/appkit/ability_runtime", "${ability_runtime_path}/interfaces/kits/native/appkit/ability_runtime/context", ] + configs = [ "${ability_runtime_innerkits_path}/app_manager:appmgr_innerkits_config", ] } ohos_shared_library("cj_want_agent_ffi") { diff --git a/frameworks/native/ability/native/BUILD.gn b/frameworks/native/ability/native/BUILD.gn index d74769b20b1..0afa5d33b10 100644 --- a/frameworks/native/ability/native/BUILD.gn +++ b/frameworks/native/ability/native/BUILD.gn @@ -43,6 +43,7 @@ config("ability_config") { "${ability_runtime_napi_path}/featureAbility", ] + configs = [ "${ability_runtime_innerkits_path}/app_manager:appmgr_innerkits_config", ] cflags = [] if (target_cpu == "arm") { cflags += [ "-DBINDER_IPC_32BIT" ] @@ -140,7 +141,7 @@ config("abilitykit_utils_public_config") { "${ability_runtime_path}/interfaces/kits/native/appkit/app", "${ability_runtime_innerkits_path}/app_manager/include/appmgr", ] - + configs = [ "${ability_runtime_innerkits_path}/app_manager:appmgr_innerkits_config", ] if (ability_runtime_graphics) { defines = [ "SUPPORT_GRAPHICS" ] } @@ -333,6 +334,7 @@ ohos_shared_library("abilitykit_native") { public_configs = [ ":ability_public_config", "${ability_runtime_native_path}/ability:ability_context_public_config", + "${ability_runtime_innerkits_path}/ability_manager:ability_manager_idl_config", "${ability_runtime_innerkits_path}/wantagent:wantagent_innerkits_public_config", ] @@ -550,7 +552,7 @@ config("extensionkit_public_config") { "${ability_runtime_innerkits_path}/app_manager/include/appmgr", "${ability_runtime_services_path}/common/include", ] - + configs = [ "${ability_runtime_innerkits_path}/app_manager:appmgr_innerkits_config", ] if (ability_runtime_graphics) { defines = [ "SUPPORT_GRAPHICS" ] } @@ -758,7 +760,7 @@ config("uiability_config") { "${ability_runtime_services_path}/abilitymgr/include/utils", "${ability_runtime_services_path}/abilitymgr/include", ] - + configs = [ "${ability_runtime_innerkits_path}/app_manager:appmgr_innerkits_config", ] if (ability_runtime_graphics) { defines = [ "SUPPORT_GRAPHICS", @@ -2218,7 +2220,7 @@ config("embedded_ui_extension_module_config") { "${ability_runtime_napi_path}/inner/napi_common", "${ability_runtime_napi_path}/featureAbility", ] - + configs = [ "${ability_runtime_innerkits_path}/app_manager:appmgr_innerkits_config", ] cflags = [] if (target_cpu == "arm") { cflags += [ "-DBINDER_IPC_32BIT" ] diff --git a/interfaces/inner_api/ability_manager/BUILD.gn b/interfaces/inner_api/ability_manager/BUILD.gn index 55d58d3ea7a..c8061b802a6 100644 --- a/interfaces/inner_api/ability_manager/BUILD.gn +++ b/interfaces/inner_api/ability_manager/BUILD.gn @@ -11,9 +11,28 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//build/config/components/idl_tool/idl.gni") import("//build/ohos.gni") import("//foundation/ability/ability_runtime/ability_runtime.gni") +idl_gen_interface("ability_manager_interface") { + sources = [ + "idl/IUserCallback.idl", + ] + sources_callback = [ + ] + sources_common =[ + ] + log_domainid = "0xD001336" + log_tag = "AbilityMgr" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +config("ability_manager_idl_config") { + include_dirs = [ "${target_gen_dir}" ] +} + config("ability_manager_public_config") { visibility = [ ":*" ] visibility += [ @@ -40,8 +59,9 @@ config("ability_manager_public_config") { "${ability_runtime_path}/interfaces/kits/native/appkit/dfr", "${ability_runtime_path}/interfaces/kits/native/appkit", "${ability_runtime_innerkits_path}/dataobs_manager/include", + "${target_gen_dir}", ] - + configs = [ "${ability_runtime_innerkits_path}/app_manager:appmgr_innerkits_config", ] defines = [] if (ability_command_for_test) { @@ -62,7 +82,84 @@ config("ability_manager_public_config") { } } +ohos_source_set("ability_manager_idl_proxy") { + sanitize = { + integer_overflow = true + ubsan = true + boundary_sanitize = true + cfi = true + cfi_cross_dso = true + cfi_vcall_icall_only = true + debug = false + } + output_values = get_target_outputs(":ability_manager_interface") + source_values = [ + "*user_callback_proxy.cpp", + ] + sources = filter_include(output_values, source_values) + + public_configs = [ + ":ability_manager_idl_config", + "${ability_runtime_services_path}/abilitymgr:abilityms_config", + ] + + deps = [ ":ability_manager_interface" ] + + external_deps = [ + "c_utils:utils", + "hilog:libhilog", + "ipc:ipc_core", + "samgr:samgr_proxy", + ] + + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_source_set("ability_manager_idl_stub") { + sanitize = { + integer_overflow = true + ubsan = true + boundary_sanitize = true + cfi = true + cfi_cross_dso = true + cfi_vcall_icall_only = true + debug = false + } + output_values = get_target_outputs(":ability_manager_interface") + source_values = [ + "*user_callback_stub.cpp", + ] + sources = filter_include(output_values, source_values) + + public_configs = [ + ":ability_manager_idl_config", + "${ability_runtime_services_path}/abilitymgr:abilityms_config", + ] + + deps = [ ":ability_manager_interface" ] + + external_deps = [ + "c_utils:utils", + "hilog:libhilog", + "hitrace:hitrace_meter", + "ipc:ipc_core", + ] + + subsystem_name = "ability" + part_name = "ability_runtime" +} + ohos_shared_library("ability_manager") { + sanitize = { + integer_overflow = true + ubsan = true + boundary_sanitize = true + cfi = true + cfi_cross_dso = true + cfi_vcall_icall_only = true + debug = false + } use_exceptions = true branch_protector_ret = "pac_ret" @@ -108,8 +205,6 @@ ohos_shared_library("ability_manager") { "${ability_runtime_services_path}/abilitymgr/src/ui_extension/ui_extension_ability_connect_info.cpp", "${ability_runtime_services_path}/abilitymgr/src/ui_extension/ui_extension_host_info.cpp", "${ability_runtime_services_path}/abilitymgr/src/ui_extension/ui_extension_session_info.cpp", - "${ability_runtime_services_path}/abilitymgr/src/user_callback_proxy.cpp", - "${ability_runtime_services_path}/abilitymgr/src/user_callback_stub.cpp", "${ability_runtime_services_path}/abilitymgr/src/window_config.cpp", "${ability_runtime_services_path}/abilitymgr/src/kiosk_status.cpp", "src/aa_tools/ability_start_with_wait_data.cpp", @@ -139,6 +234,8 @@ ohos_shared_library("ability_manager") { public_deps = [ ":ability_connect_callback_stub" ] deps = [ + ":ability_manager_idl_stub", + ":ability_manager_idl_proxy", ":ability_start_options", ":ability_start_setting", ":mission_info", diff --git a/interfaces/inner_api/app_manager/include/appmgr/app_debug_listener_interface.h b/interfaces/inner_api/ability_manager/idl/IUserCallback.idl similarity index 32% rename from interfaces/inner_api/app_manager/include/appmgr/app_debug_listener_interface.h rename to interfaces/inner_api/ability_manager/idl/IUserCallback.idl index 113002837ee..4651d4c37b8 100644 --- a/interfaces/inner_api/app_manager/include/appmgr/app_debug_listener_interface.h +++ b/interfaces/inner_api/ability_manager/idl/IUserCallback.idl @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -13,38 +13,8 @@ * limitations under the License. */ -#ifndef OHOS_ABILITY_RUNTIME_APP_DEBUG_LISTENER_INTERFACE_H -#define OHOS_ABILITY_RUNTIME_APP_DEBUG_LISTENER_INTERFACE_H - -#include "app_debug_info.h" -#include "iremote_broker.h" - -namespace OHOS { -namespace AppExecFwk { -/** - * @brief Interface to monitor when debug mode. - */ -class IAppDebugListener : public IRemoteBroker { -public: - DECLARE_INTERFACE_DESCRIPTOR(u"ohos.AppExecFwk.AppDebugListener"); - - /** - * @brief Notification of application information registered in listening and debugging mode. - * @param tokens The app info of app running record. - */ - virtual void OnAppDebugStarted(const std::vector &debugInfos) = 0; - - /** - * @brief Notification of application information registered in listening and remove debug mode. - * @param tokens The app info of app running record. - */ - virtual void OnAppDebugStoped(const std::vector &debugInfos) = 0; - - enum class Message { - ON_APP_DEBUG_STARTED = 0, - ON_APP_DEBUG_STOPED, - }; -}; -} // namespace AppExecFwk -} // namespace OHOS -#endif // OHOS_ABILITY_RUNTIME_APP_DEBUG_LISTENER_INTERFACE_H +interface OHOS.AAFwk.IUserCallback { + [oneway] void OnStopUserDone([in] int userId, [in] int errcode); + [oneway] void OnStartUserDone([in] int userId, [in] int errcode); + [oneway] void OnLogoutUserDone([in] int userId, [in] int errcode); +} \ No newline at end of file diff --git a/interfaces/inner_api/ability_manager/include/ability_manager_interface.h b/interfaces/inner_api/ability_manager/include/ability_manager_interface.h index c97397fd82c..72fbd00fc4a 100644 --- a/interfaces/inner_api/ability_manager/include/ability_manager_interface.h +++ b/interfaces/inner_api/ability_manager/include/ability_manager_interface.h @@ -29,7 +29,7 @@ #include "ability_start_setting.h" #include "ability_state.h" #include "ability_state_data.h" -#include "app_debug_listener_interface.h" +#include "iapp_debug_listener.h" #include "auto_startup_info.h" #include "dms_continueInfo.h" #include "exit_reason.h" @@ -51,7 +51,7 @@ #include "sa_interceptor_interface.h" #include "sender_info.h" #include "start_options.h" -#include "user_callback.h" +#include "iuser_callback.h" #include "system_memory_attr.h" #include "ui_extension/ui_extension_ability_connect_info.h" #include "ui_extension/ui_extension_host_info.h" diff --git a/interfaces/inner_api/ability_manager/include/user_callback.h b/interfaces/inner_api/ability_manager/include/user_callback.h deleted file mode 100644 index f2fd6373927..00000000000 --- a/interfaces/inner_api/ability_manager/include/user_callback.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2021-2023 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. - */ - -#ifndef OHOS_ABILITY_RUNTIME_USER_CALLBACK_H -#define OHOS_ABILITY_RUNTIME_USER_CALLBACK_H - -#include "iremote_broker.h" - -namespace OHOS { -namespace AAFwk { -/** - * @class IUserCallback - * user callback. - */ -class IUserCallback : public OHOS::IRemoteBroker { -public: - DECLARE_INTERFACE_DESCRIPTOR(u"ohos.aafwk.UserCallback"); - - virtual void OnStopUserDone(int userId, int errcode) = 0; - - /** - * @brief OnStartUserDone. - * - * @param userId userId. - * @param errcode errcode. - */ - virtual void OnStartUserDone(int userId, int errcode) = 0; - - /** - * @brief OnLogoutUserDone. - * - * @param userId userId. - * @param errcode errcode. - */ - virtual void OnLogoutUserDone(int userId, int errcode) {} - - enum UserCallbackCmd { - // ipc id for OnStopUserDone - ON_STOP_USER_DONE = 0, - - // ipc id for OnStartUserDone - ON_START_USER_DONE = 1, - - // ipc id for OnLogoutUserDone - ON_LOGOUT_USER_DONE = 2, - - // maximum of enum - CMD_MAX - }; -}; -} // namespace AAFwk -} // namespace OHOS -#endif // OHOS_ABILITY_RUNTIME_USER_CALLBACK_H diff --git a/interfaces/inner_api/ability_manager/include/user_callback_proxy.h b/interfaces/inner_api/ability_manager/include/user_callback_proxy.h deleted file mode 100644 index e469b70b04d..00000000000 --- a/interfaces/inner_api/ability_manager/include/user_callback_proxy.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2021-2023 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. - */ - -#ifndef OHOS_ABILITY_RUNTIME_STOP_USER_CALLBACK_PROXY_H -#define OHOS_ABILITY_RUNTIME_STOP_USER_CALLBACK_PROXY_H - -#include -#include "iremote_proxy.h" -#include "user_callback.h" - -namespace OHOS { -namespace AAFwk { -/** - * interface for UserCallbackProxy. - */ -class UserCallbackProxy : public IRemoteProxy { -public: - explicit UserCallbackProxy(const sptr &impl) : IRemoteProxy(impl) - {} - ~UserCallbackProxy() = default; - - /** - * @brief OnStopUserDone. - * - * @param userId userId. - * @param errcode errcode. - */ - virtual void OnStopUserDone(int userId, int errcode) override; - - /** - * @brief OnStartUserDone. - * - * @param userId userId. - * @param errcode errcode. - */ - virtual void OnStartUserDone(int userId, int errcode) override; - - /** - * @brief OnLogoutUserDone. - * - * @param userId userId. - * @param errcode errcode. - */ - virtual void OnLogoutUserDone(int userId, int errcode) override; -private: - void SendRequestCommon(int userId, int errcode, IUserCallback::UserCallbackCmd cmd); - -private: - static inline BrokerDelegator delegator_; -}; -} // namespace AAFwk -} // namespace OHOS -#endif // OHOS_ABILITY_RUNTIME_STOP_USER_CALLBACK_PROXY_H diff --git a/interfaces/inner_api/app_manager/BUILD.gn b/interfaces/inner_api/app_manager/BUILD.gn index c9658b81753..0b96bd17685 100644 --- a/interfaces/inner_api/app_manager/BUILD.gn +++ b/interfaces/inner_api/app_manager/BUILD.gn @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//build/config/components/idl_tool/idl.gni") import("//build/ohos.gni") import("//foundation/ability/ability_runtime/ability_runtime.gni") @@ -40,9 +41,116 @@ config("appmgr_core_config") { } } +idl_gen_interface("appmgr_innerkits") { + sources = [ + "idl/IAbilityDebugResponse.idl", + "idl/IAppDebugListener.idl", + "idl/IStartSpecifiedAbilityResponse.idl", + ] + log_domainid = "0xD001311" + log_tag = "AppMgr" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +config("appmgr_innerkits_config") { + include_dirs = [ "${target_gen_dir}" ] +} + +ohos_source_set("appmgr_innerkits_include") { + sanitize = { + integer_overflow = true + ubsan = true + boundary_sanitize = true + cfi = true + cfi_cross_dso = true + cfi_vcall_icall_only = true + debug = false + } + + public_configs = [ + ":appmgr_innerkits_config", + "${ability_runtime_innerkits_path}/ability_manager:ability_manager_idl_config", + "${ability_runtime_path}/utils/server/startup:startup_util_config", + ] + + deps = [ + ":appmgr_innerkits", + "${ability_runtime_innerkits_path}/ability_manager:ability_manager_interface", + "${ability_runtime_path}/utils/server/startup:startup_util", + ] + external_deps = [ + "bundle_framework:appexecfwk_base", + "c_utils:utils", + "hilog:libhilog", + "hitrace:hitrace_meter", + "ipc:ipc_core", + "samgr:samgr_proxy", + "ability_base:configuration", + ] + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_source_set("appmgr_innerkits_source") { + sanitize = { + integer_overflow = true + ubsan = true + boundary_sanitize = true + cfi = true + cfi_cross_dso = true + cfi_vcall_icall_only = true + debug = false + } + configs = [ + ":appmgr_core_config", + ":appmgr_sdk_config", + ] + + public_configs = [ + ":appmgr_innerkits_config", + "${ability_runtime_innerkits_path}/ability_manager:ability_manager_idl_config", + "${ability_runtime_path}/utils/server/startup:startup_util_config", + ] + + output_values = get_target_outputs(":appmgr_innerkits") + sources = filter_include(output_values, [ "*.cpp" ]) + + deps = [ + ":appmgr_innerkits", + "${ability_runtime_innerkits_path}/ability_manager:ability_manager_interface", + "${ability_runtime_path}/utils/server/startup:startup_util", + ] + external_deps = [ + "c_utils:utils", + "faultloggerd:libfaultloggerd", + "ffrt:libffrt", + "hilog:libhilog", + "hisysevent:libhisysevent", + "hitrace:hitrace_meter", + "ipc:ipc_core", + "samgr:samgr_proxy", + "ability_base:configuration", + "ability_base:session_info", + "ability_base:want", + "bundle_framework:appexecfwk_base", + ] + + subsystem_name = "ability" + part_name = "ability_runtime" +} + ohos_shared_library("app_manager") { + sanitize = { + integer_overflow = true + ubsan = true + boundary_sanitize = true + cfi = true + cfi_cross_dso = true + cfi_vcall_icall_only = true + debug = false + } branch_protector_ret = "pac_ret" - include_dirs = [ "${ability_runtime_path}/interfaces/kits/native/appkit/dfr", "${ability_runtime_path}/utils/global/time/include", @@ -57,8 +165,6 @@ ohos_shared_library("app_manager") { "${ability_runtime_services_path}/appdfr/src/appfreeze_util.cpp", "src/appmgr/ability_controller_proxy.cpp", "src/appmgr/ability_controller_stub.cpp", - "src/appmgr/ability_debug_response_proxy.cpp", - "src/appmgr/ability_debug_response_stub.cpp", "src/appmgr/ability_foreground_state_observer_proxy.cpp", "src/appmgr/ability_foreground_state_observer_stub.cpp", "src/appmgr/ability_info_callback_proxy.cpp", @@ -67,8 +173,6 @@ ohos_shared_library("app_manager") { "src/appmgr/ams_mgr_proxy.cpp", "src/appmgr/ams_mgr_stub.cpp", "src/appmgr/app_debug_info.cpp", - "src/appmgr/app_debug_listener_proxy.cpp", - "src/appmgr/app_debug_listener_stub.cpp", "src/appmgr/app_foreground_state_observer_proxy.cpp", "src/appmgr/app_foreground_state_observer_stub.cpp", "src/appmgr/app_jsheap_mem_info.cpp", @@ -120,8 +224,6 @@ ohos_shared_library("app_manager") { "src/appmgr/render_state_observer_stub.cpp", "src/appmgr/running_multi_info.cpp", "src/appmgr/running_process_info.cpp", - "src/appmgr/start_specified_ability_response_proxy.cpp", - "src/appmgr/start_specified_ability_response_stub.cpp", "src/appmgr/system_memory_attr.cpp", "src/appmgr/process_bind_data.cpp", ] @@ -129,6 +231,9 @@ ohos_shared_library("app_manager") { public_configs = [ ":appmgr_core_config", ":appmgr_sdk_config", + ":appmgr_innerkits_config", + "${ability_runtime_innerkits_path}/ability_manager:ability_manager_idl_config", + "${ability_runtime_path}/utils/server/startup:startup_util_config", ] defines = [ "AMS_LOG_TAG = \"AppexecfwkCore\"" ] @@ -138,6 +243,7 @@ ohos_shared_library("app_manager") { cflags += [ "-DBINDER_IPC_32BIT" ] } deps = [ + ":appmgr_innerkits_source", "${ability_runtime_path}/utils/global/freeze:freeze_util", "${ability_runtime_path}/utils/server/startup:startup_util", "${ability_runtime_services_path}/common:app_util", diff --git a/interfaces/inner_api/app_manager/include/appmgr/app_debug_listener_stub.h b/interfaces/inner_api/app_manager/idl/IAbilityDebugResponse.idl similarity index 39% rename from interfaces/inner_api/app_manager/include/appmgr/app_debug_listener_stub.h rename to interfaces/inner_api/app_manager/idl/IAbilityDebugResponse.idl index 3aab199f486..8f71029a117 100644 --- a/interfaces/inner_api/app_manager/include/appmgr/app_debug_listener_stub.h +++ b/interfaces/inner_api/app_manager/idl/IAbilityDebugResponse.idl @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -13,30 +13,10 @@ * limitations under the License. */ -#ifndef OHOS_ABILITY_RUNTIME_APP_DEBUG_LISTENER_STUB_H -#define OHOS_ABILITY_RUNTIME_APP_DEBUG_LISTENER_STUB_H +sequenceable OHOS.IRemoteObject; -#include - -#include "iremote_stub.h" -#include "app_debug_listener_interface.h" - -namespace OHOS { -namespace AppExecFwk { -class AppDebugListenerStub : public IRemoteStub { -public: - AppDebugListenerStub(); - virtual ~AppDebugListenerStub(); - - virtual int OnRemoteRequest( - uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; - -private: - int32_t HandleOnAppDebugStarted(MessageParcel &data, MessageParcel &reply); - int32_t HandleOnAppDebugStoped(MessageParcel &data, MessageParcel &reply); - - DISALLOW_COPY_AND_MOVE(AppDebugListenerStub); -}; -} // namespace AppExecFwk -} // namespace OHOS -#endif // OHOS_ABILITY_RUNTIME_APP_DEBUG_LISTENER_STUB_H +interface OHOS.AppExecFwk.IAbilityDebugResponse { + void OnAbilitysDebugStarted([in] List tokens); + void OnAbilitysDebugStoped([in] List tokens); + void OnAbilitysAssertDebugChange([in] List tokens, [in] boolean isAssertDebug); +} \ No newline at end of file diff --git a/interfaces/inner_api/app_manager/include/appmgr/ability_debug_response_stub.h b/interfaces/inner_api/app_manager/idl/IAppDebugListener.idl similarity index 35% rename from interfaces/inner_api/app_manager/include/appmgr/ability_debug_response_stub.h rename to interfaces/inner_api/app_manager/idl/IAppDebugListener.idl index 9753d7051b3..2020004d5fc 100644 --- a/interfaces/inner_api/app_manager/include/appmgr/ability_debug_response_stub.h +++ b/interfaces/inner_api/app_manager/idl/IAppDebugListener.idl @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023-2024 Huawei Device Co., Ltd. + * Copyright (c) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -13,31 +13,9 @@ * limitations under the License. */ -#ifndef OHOS_ABILITY_RUNTIME_ABILIYT_DEBUG_RESPONSE_STUB_H -#define OHOS_ABILITY_RUNTIME_ABILIYT_DEBUG_RESPONSE_STUB_H +sequenceable app_debug_info..AppDebugInfo; -#include - -#include "ability_debug_response_interface.h" -#include "iremote_stub.h" - -namespace OHOS { -namespace AppExecFwk { -class AbilityDebugResponseStub : public IRemoteStub { -public: - AbilityDebugResponseStub(); - virtual ~AbilityDebugResponseStub(); - - virtual int OnRemoteRequest( - uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; - -private: - int32_t HandleOnAbilitysDebugStarted(MessageParcel &data, MessageParcel &reply); - int32_t HandleOnAbilitysDebugStoped(MessageParcel &data, MessageParcel &reply); - int32_t HandleOnAbilitysAssertDebugChange(MessageParcel &data, MessageParcel &reply); - - DISALLOW_COPY_AND_MOVE(AbilityDebugResponseStub); -}; -} // namespace AppExecFwk -} // namespace OHOS -#endif // OHOS_ABILITY_RUNTIME_ABILIYT_DEBUG_RESPONSE_STUB_H +interface OHOS.AppExecFwk.IAppDebugListener { + [oneway] void OnAppDebugStarted([in] List debugInfos); + [oneway] void OnAppDebugStoped([in] List debugInfos); +} \ No newline at end of file diff --git a/interfaces/inner_api/ability_manager/include/user_callback_stub.h b/interfaces/inner_api/app_manager/idl/IStartSpecifiedAbilityResponse.idl similarity index 35% rename from interfaces/inner_api/ability_manager/include/user_callback_stub.h rename to interfaces/inner_api/app_manager/idl/IStartSpecifiedAbilityResponse.idl index bed99d5a402..652fa7c75ba 100644 --- a/interfaces/inner_api/ability_manager/include/user_callback_stub.h +++ b/interfaces/inner_api/app_manager/idl/IStartSpecifiedAbilityResponse.idl @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2023 Huawei Device Co., Ltd. + * Copyright (c) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -13,37 +13,14 @@ * limitations under the License. */ -#ifndef OHOS_ABILITY_RUNTIME_USER_CALLBACK_STUB_H -#define OHOS_ABILITY_RUNTIME_USER_CALLBACK_STUB_H +sequenceable want..OHOS.AAFwk.Want; -#include -#include -#include +interface OHOS.AAFwk.IUserCallback; -#include "user_callback.h" -#include "nocopyable.h" - -namespace OHOS { -namespace AAFwk { -/** - * @class UserCallbackStub - * UserCallbackStub. - */ -class UserCallbackStub : public IRemoteStub { -public: - UserCallbackStub(); - virtual ~UserCallbackStub() = default; - - virtual int OnRemoteRequest( - uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; - -private: - DISALLOW_COPY_AND_MOVE(UserCallbackStub); - - int OnStopUserDoneInner(MessageParcel &data, MessageParcel &reply); - int OnStartUserDoneInner(MessageParcel &data, MessageParcel &reply); - int OnLogoutUserDoneInner(MessageParcel &data, MessageParcel &reply); -}; -} // namespace AAFwk -} // namespace OHOS -#endif // OHOS_ABILITY_RUNTIME_USER_CALLBACK_STUB_H +interface OHOS.AppExecFwk.IStartSpecifiedAbilityResponse { + [oneway] void OnAcceptWantResponse([in] Want want, [in] String flag, [in] int requestId); + [oneway] void OnTimeoutResponse([in] int requestId); + [oneway] void OnNewProcessRequestResponse([in] String flag, [in] int requestId); + [oneway] void OnNewProcessRequestTimeoutResponse([in] int requestId); + [oneway] void OnStartSpecifiedFailed([in] int requestId); +} \ No newline at end of file diff --git a/interfaces/inner_api/app_manager/include/appmgr/ability_debug_response_interface.h b/interfaces/inner_api/app_manager/include/appmgr/ability_debug_response_interface.h deleted file mode 100644 index 87ec00b7b17..00000000000 --- a/interfaces/inner_api/app_manager/include/appmgr/ability_debug_response_interface.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2023-2024 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef OHOS_ABILITY_RUNTIME_ABILITY_DEBUG_RESPONSE_INTERFACE_H -#define OHOS_ABILITY_RUNTIME_ABILITY_DEBUG_RESPONSE_INTERFACE_H - -#include "iremote_broker.h" - -namespace OHOS { -namespace AppExecFwk { -class IAbilityDebugResponse : public IRemoteBroker { -public: - DECLARE_INTERFACE_DESCRIPTOR(u"ohos.appexecfwk.AbilityDebugResponse"); - - /** - * @brief Set ability attach debug flag to ability manager service. - * @param tokens The token of ability token. - */ - virtual void OnAbilitysDebugStarted(const std::vector> &tokens) = 0; - - /** - * @brief Cancel ability attach debug flag to ability manager service. - * @param tokens The token of ability token. - */ - virtual void OnAbilitysDebugStoped(const std::vector> &tokens) = 0; - - /** - * @brief Change ability assert debug flag. - * @param tokens The token of ability records. - * @param isAssertDebug Assert debug flag. - */ - virtual void OnAbilitysAssertDebugChange(const std::vector> &tokens, bool isAssertDebug) = 0; - - enum class Message { - ON_ABILITYS_DEBUG_STARTED = 0, - ON_ABILITYS_DEBUG_STOPED, - ON_ABILITYS_ASSERT_DEBUG, - }; -}; -} // namespace AppExecFwk -} // namespace OHOS -#endif // OHOS_ABILITY_RUNTIME_ABILITY_DEBUG_RESPONSE_INTERFACE_H diff --git a/interfaces/inner_api/app_manager/include/appmgr/ability_debug_response_proxy.h b/interfaces/inner_api/app_manager/include/appmgr/ability_debug_response_proxy.h deleted file mode 100644 index 1bdac574de5..00000000000 --- a/interfaces/inner_api/app_manager/include/appmgr/ability_debug_response_proxy.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2023-2024 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef OHOS_ABILITY_RUNTIME_ABILITY_DEBUG_RESPONSE_PROXY_H -#define OHOS_ABILITY_RUNTIME_ABILITY_DEBUG_RESPONSE_PROXY_H - -#include "ability_debug_response_interface.h" -#include "iremote_object.h" -#include "iremote_proxy.h" - -namespace OHOS { -namespace AppExecFwk { -class AbilityDebugResponseProxy : public IRemoteProxy { -public: - explicit AbilityDebugResponseProxy(const sptr &impl); - virtual ~AbilityDebugResponseProxy() = default; - - /** - * @brief Set ability attach debug flag through proxy project. - * @param tokens The token of ability token. - */ - void OnAbilitysDebugStarted(const std::vector> &tokens) override; - - /** - * @brief Cancel ability attach debug flag through proxy project. - * @param tokens The token of ability token. - */ - void OnAbilitysDebugStoped(const std::vector> &tokens) override; - - /** - * @brief Change ability assert debug flag. - * @param tokens The token of ability records. - * @param isAssertDebug Assert debug flag. - */ - void OnAbilitysAssertDebugChange(const std::vector> &tokens, bool isAssertDebug) override; - -private: - bool WriteInterfaceToken(MessageParcel &data); - void SendRequest(const IAbilityDebugResponse::Message &message, const std::vector> &tokens); - static inline BrokerDelegator delegator_; -}; -} // namespace AppExecFwk -} // namespace OHOS -#endif // OHOS_ABILITY_RUNTIME_ABILITY_DEBUG_RESPONSE_PROXY_H diff --git a/interfaces/inner_api/app_manager/include/appmgr/ams_mgr_interface.h b/interfaces/inner_api/app_manager/include/appmgr/ams_mgr_interface.h index d919a230212..11a7d6d41af 100644 --- a/interfaces/inner_api/app_manager/include/appmgr/ams_mgr_interface.h +++ b/interfaces/inner_api/app_manager/include/appmgr/ams_mgr_interface.h @@ -16,9 +16,9 @@ #ifndef OHOS_ABILITY_RUNTIME_AMS_MGR_INTERFACE_H #define OHOS_ABILITY_RUNTIME_AMS_MGR_INTERFACE_H -#include "ability_debug_response_interface.h" +#include "iability_debug_response.h" #include "ability_info.h" -#include "app_debug_listener_interface.h" +#include "iapp_debug_listener.h" #include "app_record_id.h" #include "application_info.h" #include "configuration.h" @@ -27,7 +27,7 @@ #include "iremote_object.h" #include "istart_specified_ability_response.h" #include "running_process_info.h" -#include "user_callback.h" +#include "iuser_callback.h" namespace OHOS { namespace AbilityRuntime { diff --git a/interfaces/inner_api/app_manager/include/appmgr/ams_mgr_proxy.h b/interfaces/inner_api/app_manager/include/appmgr/ams_mgr_proxy.h index fec486a478f..411dd010e6b 100644 --- a/interfaces/inner_api/app_manager/include/appmgr/ams_mgr_proxy.h +++ b/interfaces/inner_api/app_manager/include/appmgr/ams_mgr_proxy.h @@ -17,7 +17,7 @@ #define OHOS_ABILITY_RUNTIME_AMS_MGR_PROXY_H #include "ams_mgr_interface.h" -#include "app_debug_listener_interface.h" +#include "iapp_debug_listener.h" #include "iremote_proxy.h" namespace OHOS { diff --git a/interfaces/inner_api/app_manager/include/appmgr/app_debug_listener_proxy.h b/interfaces/inner_api/app_manager/include/appmgr/app_debug_listener_proxy.h deleted file mode 100644 index a309079a938..00000000000 --- a/interfaces/inner_api/app_manager/include/appmgr/app_debug_listener_proxy.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2023 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. - */ - -#ifndef OHOS_ABILITY_RUNTIME_APP_DEBUG_LISTENER_PROXY_H -#define OHOS_ABILITY_RUNTIME_APP_DEBUG_LISTENER_PROXY_H - -#include "app_debug_info.h" -#include "app_debug_listener_interface.h" -#include "iremote_proxy.h" - -namespace OHOS { -namespace AppExecFwk { -class AppDebugListenerProxy : public IRemoteProxy { -public: - explicit AppDebugListenerProxy(const sptr &impl); - virtual ~AppDebugListenerProxy() = default; - - /** - * @brief Notification of application information registered in listening and debugging mode. - * @param tokens The app info of app running record. - */ - void OnAppDebugStarted(const std::vector &debugInfos) override; - - /** - * @brief Notification of application information registered in listening and remove debug mode. - * @param tokens The app info of app running record. - */ - void OnAppDebugStoped(const std::vector &debugInfos) override; - -private: - bool WriteInterfaceToken(MessageParcel &data); - void SendRequest(const IAppDebugListener::Message &message, const std::vector &debugInfos); - static inline BrokerDelegator delegator_; -}; -} // namespace AppExecFwk -} // namespace OHOS -#endif // OHOS_ABILITY_RUNTIME_APP_DEBUG_LISTENER_PROXY_H diff --git a/interfaces/inner_api/app_manager/include/appmgr/app_mgr_client.h b/interfaces/inner_api/app_manager/include/appmgr/app_mgr_client.h index 3a5e83250bc..38852cc47ee 100644 --- a/interfaces/inner_api/app_manager/include/appmgr/app_mgr_client.h +++ b/interfaces/inner_api/app_manager/include/appmgr/app_mgr_client.h @@ -16,9 +16,9 @@ #ifndef OHOS_ABILITY_RUNTIME_APP_MGR_CLIENT_H #define OHOS_ABILITY_RUNTIME_APP_MGR_CLIENT_H -#include "ability_debug_response_interface.h" +#include "iability_debug_response.h" #include "ability_info.h" -#include "app_debug_listener_interface.h" +#include "iapp_debug_listener.h" #include "app_malloc_info.h" #include "app_mem_info.h" #include "app_mgr_constants.h" diff --git a/interfaces/inner_api/app_manager/include/appmgr/app_mgr_interface.h b/interfaces/inner_api/app_manager/include/appmgr/app_mgr_interface.h index 78c33ca8ff1..e92f6bcac89 100644 --- a/interfaces/inner_api/app_manager/include/appmgr/app_mgr_interface.h +++ b/interfaces/inner_api/app_manager/include/appmgr/app_mgr_interface.h @@ -450,7 +450,7 @@ public: /** * UpdateConfigurationForBackgroundApp - * + * * @param appInfos Background application information. * @param policy Update policy. * @param userId configuration for the user diff --git a/interfaces/inner_api/app_manager/include/appmgr/istart_specified_ability_response.h b/interfaces/inner_api/app_manager/include/appmgr/istart_specified_ability_response.h deleted file mode 100644 index 0777f67ee1d..00000000000 --- a/interfaces/inner_api/app_manager/include/appmgr/istart_specified_ability_response.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2022 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. - */ - -#ifndef OHOS_ABILITY_RUNTIME_ISTART_SPECIFIED_ABILITY_RESPONSE_H -#define OHOS_ABILITY_RUNTIME_ISTART_SPECIFIED_ABILITY_RESPONSE_H - -#include "iremote_broker.h" -#include "iremote_object.h" -#include "want.h" - -namespace OHOS { -namespace AppExecFwk { -class IStartSpecifiedAbilityResponse : public IRemoteBroker { -public: - DECLARE_INTERFACE_DESCRIPTOR(u"ohos.appexecfwk.startSpecifiedAbilityResponse"); - - /** - * @brief called when the module's onAcceptWant done to notify ability mgr to continue - * @param want request param being accepted - * @param flag specified flag return by application - * @param requestId a number represents a request - */ - virtual void OnAcceptWantResponse(const AAFwk::Want &want, const std::string &flag, int32_t requestId) = 0; - - /** - * @brief called when the module's onAcceptWant happens time out - * @param requestId a number represents a request - */ - virtual void OnTimeoutResponse(int32_t requestId) = 0; - - virtual void OnNewProcessRequestResponse(const std::string &flag, int32_t requestId) = 0; - - virtual void OnNewProcessRequestTimeoutResponse(int32_t requestId) = 0; - - virtual void OnStartSpecifiedFailed(int32_t requestId) {}; - - enum Message { - ON_ACCEPT_WANT_RESPONSE = 0, - ON_TIMEOUT_RESPONSE, - ON_NEW_PROCESS_REQUEST_RESPONSE, - ON_NEW_PROCESS_REQUEST_TIMEOUT_RESPONSE, - ON_START_SPECIFIED_FAILED - }; -}; -} // namespace AppExecFwk -} // namespace OHOS -#endif // OHOS_ABILITY_RUNTIME_ISTART_SPECIFIED_ABILITY_RESPONSE_H diff --git a/interfaces/inner_api/app_manager/include/appmgr/start_specified_ability_response_proxy.h b/interfaces/inner_api/app_manager/include/appmgr/start_specified_ability_response_proxy.h deleted file mode 100644 index bf2037afc01..00000000000 --- a/interfaces/inner_api/app_manager/include/appmgr/start_specified_ability_response_proxy.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2022-2023 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. - */ - -#ifndef OHOS_ABILITY_RUNTIME_START_SPECIFIED_ABILITY_RESPONSE_PROXY_H -#define OHOS_ABILITY_RUNTIME_START_SPECIFIED_ABILITY_RESPONSE_PROXY_H - -#include "iremote_proxy.h" -#include "istart_specified_ability_response.h" -namespace OHOS { -namespace AppExecFwk { -class StartSpecifiedAbilityResponseProxy : public IRemoteProxy { -public: - explicit StartSpecifiedAbilityResponseProxy(const sptr &impl); - virtual ~StartSpecifiedAbilityResponseProxy() = default; - - /** - * @brief called when the module's onAcceptWant done to notify ability mgr to continue - * @param want request param being accepted - * @param flag specified flag return by application - * @param requestId a number represents a request - */ - virtual void OnAcceptWantResponse(const AAFwk::Want &want, const std::string &flag, - int32_t requestId) override; - - /** - * @brief called when the module's onAcceptWant happens time out - * @param requestId a number represents a request - */ - virtual void OnTimeoutResponse(int32_t requestId) override; - - virtual void OnNewProcessRequestResponse(const std::string &flag, int32_t requestId = 0) override; - - virtual void OnNewProcessRequestTimeoutResponse(int32_t requestId) override; - - virtual void OnStartSpecifiedFailed(int32_t requestId) override; - -private: - bool WriteInterfaceToken(MessageParcel &data); - static inline BrokerDelegator delegator_; - int32_t SendTransactCmd(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option); -}; -} // namespace AppExecFwk -} // namespace OHOS -#endif // OHOS_ABILITY_RUNTIME_START_SPECIFIED_ABILITY_RESPONSE_PROXY_H diff --git a/interfaces/inner_api/app_manager/include/appmgr/start_specified_ability_response_stub.h b/interfaces/inner_api/app_manager/include/appmgr/start_specified_ability_response_stub.h deleted file mode 100644 index 041320de260..00000000000 --- a/interfaces/inner_api/app_manager/include/appmgr/start_specified_ability_response_stub.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2022 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. - */ - -#ifndef OHOS_ABILITY_RUNTIME_START_SPECIFIED_ABILITY_RESPONSE_STUB_H -#define OHOS_ABILITY_RUNTIME_START_SPECIFIED_ABILITY_RESPONSE_STUB_H - -#include "iremote_stub.h" -#include "nocopyable.h" -#include "string_ex.h" -#include "istart_specified_ability_response.h" - -namespace OHOS { -namespace AppExecFwk { -class StartSpecifiedAbilityResponseStub : public IRemoteStub { -public: - StartSpecifiedAbilityResponseStub() = default; - virtual ~StartSpecifiedAbilityResponseStub() = default; - - virtual int OnRemoteRequest( - uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; - -private: - int32_t HandleOnAcceptWantResponse(MessageParcel &data, MessageParcel &reply); - int32_t HandleOnTimeoutResponse(MessageParcel &data, MessageParcel &reply); - int32_t HandleOnNewProcessRequestResponse(MessageParcel &data, MessageParcel &reply); - int32_t HandleOnNewProcessRequestTimeoutResponse(MessageParcel &data, MessageParcel &reply); - int32_t HandleOnStartSpecifiedFailed(MessageParcel &data, MessageParcel &reply); - - DISALLOW_COPY_AND_MOVE(StartSpecifiedAbilityResponseStub); -}; -} // namespace AppExecFwk -} // namespace OHOS -#endif // OHOS_ABILITY_RUNTIME_START_SPECIFIED_ABILITY_RESPONSE_STUB_H diff --git a/interfaces/inner_api/app_manager/src/appmgr/ability_debug_response_proxy.cpp b/interfaces/inner_api/app_manager/src/appmgr/ability_debug_response_proxy.cpp deleted file mode 100644 index 5736f1b596c..00000000000 --- a/interfaces/inner_api/app_manager/src/appmgr/ability_debug_response_proxy.cpp +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright (c) 2023-2024 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "ability_debug_response_proxy.h" - -#include "hilog_tag_wrapper.h" -#include "ipc_types.h" - -namespace OHOS { -namespace AppExecFwk { -namespace { -constexpr int32_t CYCLE_LIMIT_MIN = 0; -constexpr int32_t CYCLE_LIMIT_MAX = 1000; -} -AbilityDebugResponseProxy::AbilityDebugResponseProxy( - const sptr &impl) : IRemoteProxy(impl) -{} - -bool AbilityDebugResponseProxy::WriteInterfaceToken(MessageParcel &data) -{ - if (!data.WriteInterfaceToken(AbilityDebugResponseProxy::GetDescriptor())) { - TAG_LOGE(AAFwkTag::APPMGR, "Write token failed"); - return false; - } - return true; -} - -void AbilityDebugResponseProxy::OnAbilitysDebugStarted(const std::vector> &tokens) -{ - TAG_LOGD(AAFwkTag::APPMGR, "called"); - SendRequest(IAbilityDebugResponse::Message::ON_ABILITYS_DEBUG_STARTED, tokens); -} - -void AbilityDebugResponseProxy::OnAbilitysDebugStoped(const std::vector> &tokens) -{ - TAG_LOGD(AAFwkTag::APPMGR, "called"); - SendRequest(IAbilityDebugResponse::Message::ON_ABILITYS_DEBUG_STOPED, tokens); -} - -void AbilityDebugResponseProxy::OnAbilitysAssertDebugChange( - const std::vector> &tokens, bool isAssertDebug) -{ - TAG_LOGD(AAFwkTag::APPMGR, "called"); - MessageParcel data; - if (!WriteInterfaceToken(data)) { - TAG_LOGE(AAFwkTag::APPMGR, "Write token failed"); - return; - } - - if (tokens.size() <= CYCLE_LIMIT_MIN || tokens.size() > CYCLE_LIMIT_MAX || - !data.WriteInt32(tokens.size())) { - TAG_LOGE(AAFwkTag::APPMGR, "Write data size failed"); - return; - } - - for (const auto &item : tokens) { - if (!data.WriteRemoteObject(item)) { - TAG_LOGE(AAFwkTag::APPMGR, "Write token failed"); - return; - } - } - - if (!data.WriteBool(isAssertDebug)) { - TAG_LOGE(AAFwkTag::APPMGR, "Write flag failed"); - return; - } - - sptr remote = Remote(); - if (remote == nullptr) { - TAG_LOGE(AAFwkTag::APPMGR, "null remote"); - return; - } - - MessageParcel reply; - MessageOption option; - auto ret = remote->SendRequest(static_cast(Message::ON_ABILITYS_ASSERT_DEBUG), data, reply, option); - if (ret != NO_ERROR) { - TAG_LOGE(AAFwkTag::APPMGR, "SendRequest err: %{public}d", ret); - } -} - -void AbilityDebugResponseProxy::SendRequest( - const IAbilityDebugResponse::Message &message, const std::vector> &tokens) -{ - TAG_LOGD(AAFwkTag::APPMGR, "called"); - MessageParcel data; - if (!WriteInterfaceToken(data)) { - TAG_LOGE(AAFwkTag::APPMGR, "Write token failed"); - return; - } - - if (tokens.size() <= CYCLE_LIMIT_MIN || tokens.size() > CYCLE_LIMIT_MAX || - !data.WriteInt32(tokens.size())) { - TAG_LOGE(AAFwkTag::APPMGR, "Write data size failed"); - return; - } - - for (auto iter = tokens.begin(); iter != tokens.end(); iter++) { - if (!data.WriteRemoteObject(iter->GetRefPtr())) { - TAG_LOGE(AAFwkTag::APPMGR, "Write token failed"); - return; - } - } - - sptr remote = Remote(); - if (remote == nullptr) { - TAG_LOGE(AAFwkTag::APPMGR, "null remote"); - return; - } - - MessageParcel reply; - MessageOption option(MessageOption::TF_SYNC); - auto ret = remote->SendRequest(static_cast(message), data, reply, option); - if (ret != NO_ERROR) { - TAG_LOGE(AAFwkTag::APPMGR, "SendRequest err: %{public}d", ret); - } -} -} // namespace AppExecFwk -} // namespace OHOS diff --git a/interfaces/inner_api/app_manager/src/appmgr/ability_debug_response_stub.cpp b/interfaces/inner_api/app_manager/src/appmgr/ability_debug_response_stub.cpp deleted file mode 100644 index daf6a577ae8..00000000000 --- a/interfaces/inner_api/app_manager/src/appmgr/ability_debug_response_stub.cpp +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (c) 2023-2024 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "ability_debug_response_stub.h" - -#include "appexecfwk_errors.h" -#include "hilog_tag_wrapper.h" -#include "ipc_types.h" -#include "iremote_object.h" - -namespace OHOS { -namespace AppExecFwk { -namespace { -constexpr int32_t CYCLE_LIMIT_MIN = 0; -constexpr int32_t CYCLE_LIMIT_MAX = 1000; -} -AbilityDebugResponseStub::AbilityDebugResponseStub() {} - -AbilityDebugResponseStub::~AbilityDebugResponseStub() {} - -int32_t AbilityDebugResponseStub::HandleOnAbilitysDebugStarted(MessageParcel &data, MessageParcel &reply) -{ - auto tokenSize = data.ReadInt32(); - if (tokenSize <= CYCLE_LIMIT_MIN || tokenSize > CYCLE_LIMIT_MAX) { - TAG_LOGE(AAFwkTag::APPMGR, "Token size exceeds limit"); - return ERR_INVALID_DATA; - } - - std::vector> tokens; - for (int32_t index = 0; index < tokenSize; index++) { - auto token = data.ReadRemoteObject(); - if (token == nullptr) { - TAG_LOGE(AAFwkTag::APPMGR, "null token"); - return ERR_INVALID_DATA; - } - tokens.push_back(token); - } - OnAbilitysDebugStarted(tokens); - return NO_ERROR; -} - -int32_t AbilityDebugResponseStub::HandleOnAbilitysDebugStoped(MessageParcel &data, MessageParcel &reply) -{ - auto tokenSize = data.ReadInt32(); - if (tokenSize <= CYCLE_LIMIT_MIN || tokenSize > CYCLE_LIMIT_MAX) { - TAG_LOGE(AAFwkTag::APPMGR, "Token size exceeds limit"); - return ERR_INVALID_DATA; - } - - std::vector> tokens; - for (int32_t index = 0; index < tokenSize; index++) { - auto token = data.ReadRemoteObject(); - if (token == nullptr) { - TAG_LOGE(AAFwkTag::APPMGR, "null token"); - return ERR_INVALID_DATA; - } - tokens.push_back(token); - } - OnAbilitysDebugStoped(tokens); - return NO_ERROR; -} - -int32_t AbilityDebugResponseStub::HandleOnAbilitysAssertDebugChange(MessageParcel &data, MessageParcel &reply) -{ - auto tokenSize = data.ReadInt32(); - if (tokenSize <= CYCLE_LIMIT_MIN || tokenSize > CYCLE_LIMIT_MAX) { - TAG_LOGE(AAFwkTag::APPMGR, "Token size exceeds limit"); - return ERR_INVALID_DATA; - } - - std::vector> tokens; - for (int32_t index = 0; index < tokenSize; index++) { - auto token = data.ReadRemoteObject(); - if (token == nullptr) { - TAG_LOGE(AAFwkTag::APPMGR, "null token"); - return ERR_INVALID_DATA; - } - tokens.push_back(token); - } - auto isAssertDebug = data.ReadBool(); - OnAbilitysAssertDebugChange(tokens, isAssertDebug); - return NO_ERROR; -} - -int AbilityDebugResponseStub::OnRemoteRequest( - uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) -{ - TAG_LOGD(AAFwkTag::APPMGR, "code: %{public}u, flags: %{public}d", code, option.GetFlags()); - std::u16string descriptor = AbilityDebugResponseStub::GetDescriptor(); - std::u16string remoteDescriptor = data.ReadInterfaceToken(); - if (descriptor != remoteDescriptor) { - TAG_LOGE(AAFwkTag::APPMGR, "invalid descriptor"); - return ERR_INVALID_STATE; - } - - switch (code) { - case static_cast(IAbilityDebugResponse::Message::ON_ABILITYS_DEBUG_STARTED): - return HandleOnAbilitysDebugStarted(data, reply); - case static_cast(IAbilityDebugResponse::Message::ON_ABILITYS_DEBUG_STOPED): - return HandleOnAbilitysDebugStoped(data, reply); - } - - return IPCObjectStub::OnRemoteRequest(code, data, reply, option); -} -} // namespace AppExecFwk -} // namespace OHOS diff --git a/interfaces/inner_api/app_manager/src/appmgr/ams_mgr_stub.cpp b/interfaces/inner_api/app_manager/src/appmgr/ams_mgr_stub.cpp index 4fc28df4288..25d21352b47 100644 --- a/interfaces/inner_api/app_manager/src/appmgr/ams_mgr_stub.cpp +++ b/interfaces/inner_api/app_manager/src/appmgr/ams_mgr_stub.cpp @@ -16,7 +16,7 @@ #include "ams_mgr_stub.h" #include "ability_manager_errors.h" #include "ability_info.h" -#include "app_debug_listener_interface.h" +#include "iapp_debug_listener.h" #include "app_mgr_proxy.h" #include "app_scheduler_interface.h" #include "appexecfwk_errors.h" diff --git a/interfaces/inner_api/app_manager/src/appmgr/app_debug_listener_proxy.cpp b/interfaces/inner_api/app_manager/src/appmgr/app_debug_listener_proxy.cpp deleted file mode 100644 index fc271be274a..00000000000 --- a/interfaces/inner_api/app_manager/src/appmgr/app_debug_listener_proxy.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2023-2024 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "app_debug_listener_proxy.h" - -#include "hilog_tag_wrapper.h" -#include "ipc_types.h" - -namespace OHOS { -namespace AppExecFwk { -namespace { -constexpr int32_t CYCLE_LIMIT_MIN = 0; -constexpr int32_t CYCLE_LIMIT_MAX = 1000; -} -AppDebugListenerProxy::AppDebugListenerProxy( - const sptr &impl) : IRemoteProxy(impl) -{} - -bool AppDebugListenerProxy::WriteInterfaceToken(MessageParcel &data) -{ - if (!data.WriteInterfaceToken(AppDebugListenerProxy::GetDescriptor())) { - TAG_LOGE(AAFwkTag::APPMGR, "Write interface token failed."); - return false; - } - return true; -} - -void AppDebugListenerProxy::OnAppDebugStarted(const std::vector &debugInfos) -{ - TAG_LOGD(AAFwkTag::APPMGR, "called"); - SendRequest(IAppDebugListener::Message::ON_APP_DEBUG_STARTED, debugInfos); -} - -void AppDebugListenerProxy::OnAppDebugStoped(const std::vector &debugInfos) -{ - TAG_LOGD(AAFwkTag::APPMGR, "called"); - SendRequest(IAppDebugListener::Message::ON_APP_DEBUG_STOPED, debugInfos); -} - -void AppDebugListenerProxy::SendRequest( - const IAppDebugListener::Message &message, const std::vector &debugInfos) -{ - MessageParcel data; - if (!WriteInterfaceToken(data)) { - TAG_LOGE(AAFwkTag::APPMGR, "Write interface token failed."); - return; - } - - if (debugInfos.size() <= CYCLE_LIMIT_MIN || debugInfos.size() > CYCLE_LIMIT_MAX || - !data.WriteInt32(debugInfos.size())) { - TAG_LOGE(AAFwkTag::APPMGR, "Write debug info size failed."); - return; - } - for (auto &debugInfo : debugInfos) { - if (!data.WriteParcelable(&debugInfo)) { - TAG_LOGE(AAFwkTag::APPMGR, "Write debug info failed."); - return; - } - }; - - sptr remote = Remote(); - if (remote == nullptr) { - TAG_LOGE(AAFwkTag::APPMGR, "Remote is nullptr."); - return; - } - - MessageParcel reply; - MessageOption option(MessageOption::TF_ASYNC); - int32_t ret = remote->SendRequest(static_cast(message), data, reply, option); - if (ret != NO_ERROR) { - TAG_LOGE(AAFwkTag::APPMGR, "SendRequest is failed, error code: %{public}d", ret); - } -} -} // namespace AppExecFwk -} // namespace OHOS diff --git a/interfaces/inner_api/app_manager/src/appmgr/app_debug_listener_stub.cpp b/interfaces/inner_api/app_manager/src/appmgr/app_debug_listener_stub.cpp deleted file mode 100644 index ae20e2535b8..00000000000 --- a/interfaces/inner_api/app_manager/src/appmgr/app_debug_listener_stub.cpp +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2023-2024 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "app_debug_listener_stub.h" - -#include "hilog_tag_wrapper.h" -#include "ipc_types.h" -#include "iremote_object.h" - -namespace OHOS { -namespace AppExecFwk { -namespace { -constexpr int32_t CYCLE_LIMIT_MIN = 0; -constexpr int32_t CYCLE_LIMIT_MAX = 1000; -} -AppDebugListenerStub::AppDebugListenerStub() {} - -AppDebugListenerStub::~AppDebugListenerStub() {} - -int AppDebugListenerStub::OnRemoteRequest( - uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) -{ - TAG_LOGD(AAFwkTag::APPMGR, "code = %{public}u, flags= %{public}d", code, option.GetFlags()); - std::u16string descriptor = AppDebugListenerStub::GetDescriptor(); - std::u16string remoteDescriptor = data.ReadInterfaceToken(); - if (descriptor != remoteDescriptor) { - TAG_LOGE(AAFwkTag::APPMGR, "Local descriptor is not equal to remote."); - return ERR_INVALID_STATE; - } - - switch (code) { - case static_cast(IAppDebugListener::Message::ON_APP_DEBUG_STARTED): - return HandleOnAppDebugStarted(data, reply); - case static_cast(IAppDebugListener::Message::ON_APP_DEBUG_STOPED): - return HandleOnAppDebugStoped(data, reply); - } - - TAG_LOGD(AAFwkTag::APPMGR, "AppDebugListenerStub::OnRemoteRequest end"); - return IPCObjectStub::OnRemoteRequest(code, data, reply, option); -} - -int32_t AppDebugListenerStub::HandleOnAppDebugStarted(MessageParcel &data, MessageParcel &reply) -{ - auto infoSize = data.ReadInt32(); - if (infoSize <= CYCLE_LIMIT_MIN || infoSize > CYCLE_LIMIT_MAX) { - TAG_LOGE(AAFwkTag::APPMGR, "Token size exceeds limit."); - return ERR_INVALID_DATA; - } - - std::vector appDebugInfos; - for (int32_t index = 0; index < infoSize; index++) { - std::unique_ptr appDebugInfo(data.ReadParcelable()); - if (appDebugInfo == nullptr) { - TAG_LOGE(AAFwkTag::APPMGR, "Read app debug infos failed."); - return ERR_INVALID_DATA; - } - appDebugInfos.emplace_back(*appDebugInfo); - } - - OnAppDebugStarted(appDebugInfos); - return NO_ERROR; -} - -int32_t AppDebugListenerStub::HandleOnAppDebugStoped(MessageParcel &data, MessageParcel &reply) -{ - auto infoSize = data.ReadInt32(); - if (infoSize <= CYCLE_LIMIT_MIN || infoSize > CYCLE_LIMIT_MAX) { - TAG_LOGE(AAFwkTag::APPMGR, "Token size exceeds limit."); - return ERR_INVALID_DATA; - } - - std::vector appDebugInfos; - for (int32_t index = 0; index < infoSize; index++) { - std::unique_ptr appDebugInfo(data.ReadParcelable()); - if (appDebugInfo == nullptr) { - TAG_LOGE(AAFwkTag::APPMGR, "Read app debug infos failed."); - return ERR_INVALID_DATA; - } - appDebugInfos.emplace_back(*appDebugInfo); - } - - OnAppDebugStoped(appDebugInfos); - return NO_ERROR; -} -} // namespace AppExecFwk -} // namespace OHOS diff --git a/interfaces/inner_api/app_manager/src/appmgr/start_specified_ability_response_proxy.cpp b/interfaces/inner_api/app_manager/src/appmgr/start_specified_ability_response_proxy.cpp deleted file mode 100644 index 024dfee1d07..00000000000 --- a/interfaces/inner_api/app_manager/src/appmgr/start_specified_ability_response_proxy.cpp +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Copyright (c) 2022-2024 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "start_specified_ability_response_proxy.h" -#include "ipc_types.h" -#include "hilog_tag_wrapper.h" - -namespace OHOS { -namespace AppExecFwk { -StartSpecifiedAbilityResponseProxy::StartSpecifiedAbilityResponseProxy(const sptr &impl) - : IRemoteProxy(impl) -{} - -bool StartSpecifiedAbilityResponseProxy::WriteInterfaceToken(MessageParcel &data) -{ - if (!data.WriteInterfaceToken(StartSpecifiedAbilityResponseProxy::GetDescriptor())) { - TAG_LOGE(AAFwkTag::APPMGR, "write interface token failed"); - return false; - } - return true; -} - -void StartSpecifiedAbilityResponseProxy::OnAcceptWantResponse( - const AAFwk::Want &want, const std::string &flag, int32_t requestId) -{ - TAG_LOGD(AAFwkTag::APPMGR, "On accept want by proxy."); - MessageParcel data; - MessageParcel reply; - MessageOption option(MessageOption::TF_ASYNC); - if (!WriteInterfaceToken(data)) { - return; - } - if (!data.WriteParcelable(&want) || !data.WriteString(flag) || - !data.WriteInt32(requestId)) { - TAG_LOGE(AAFwkTag::APPMGR, "Write data failed."); - return; - } - - int32_t ret = SendTransactCmd( - static_cast(IStartSpecifiedAbilityResponse::Message::ON_ACCEPT_WANT_RESPONSE), data, reply, option); - if (ret != NO_ERROR) { - TAG_LOGW(AAFwkTag::APPMGR, "SendRequest is failed, error code: %{public}d", ret); - } -} - -void StartSpecifiedAbilityResponseProxy::OnTimeoutResponse(int32_t requestId) -{ - TAG_LOGD(AAFwkTag::APPMGR, "On timeout response by proxy."); - MessageParcel data; - MessageParcel reply; - MessageOption option(MessageOption::TF_ASYNC); - if (!WriteInterfaceToken(data)) { - return; - } - if (!data.WriteInt32(requestId)) { - TAG_LOGE(AAFwkTag::APPMGR, "Write data failed."); - return; - } - - int32_t ret = SendTransactCmd(static_cast( - IStartSpecifiedAbilityResponse::Message::ON_TIMEOUT_RESPONSE), data, reply, option); - if (ret != NO_ERROR) { - TAG_LOGW(AAFwkTag::APPMGR, "SendRequest is failed, error code: %{public}d", ret); - } -} - -int32_t StartSpecifiedAbilityResponseProxy::SendTransactCmd(uint32_t code, MessageParcel &data, - MessageParcel &reply, MessageOption &option) -{ - sptr remote = Remote(); - if (remote == nullptr) { - TAG_LOGE(AAFwkTag::APPMGR, "Remote is nullptr."); - return ERR_NULL_OBJECT; - } - - return remote->SendRequest(code, data, reply, option); -} - -void StartSpecifiedAbilityResponseProxy::OnNewProcessRequestResponse(const std::string &flag, int32_t requestId) -{ - TAG_LOGD(AAFwkTag::APPMGR, "On satrt specified process response by proxy."); - MessageParcel data; - MessageParcel reply; - MessageOption option(MessageOption::TF_ASYNC); - if (!WriteInterfaceToken(data)) { - return; - } - if (!data.WriteString(flag) || !data.WriteInt32(requestId)) { - TAG_LOGE(AAFwkTag::APPMGR, "Write data failed."); - return; - } - - sptr remote = Remote(); - if (remote == nullptr) { - TAG_LOGE(AAFwkTag::APPMGR, "Remote is nullptr."); - return; - } - int32_t ret = remote->SendRequest( - static_cast(IStartSpecifiedAbilityResponse::Message::ON_NEW_PROCESS_REQUEST_RESPONSE), - data, reply, option); - if (ret != NO_ERROR) { - TAG_LOGW(AAFwkTag::APPMGR, "SendRequest is failed, error code: %{public}d", ret); - } -} - -void StartSpecifiedAbilityResponseProxy::OnNewProcessRequestTimeoutResponse(int32_t requestId) -{ - TAG_LOGD(AAFwkTag::APPMGR, "On start specified process timeout response by proxy."); - MessageParcel data; - MessageParcel reply; - MessageOption option(MessageOption::TF_ASYNC); - if (!WriteInterfaceToken(data)) { - return; - } - if (data.WriteInt32(requestId)) { - TAG_LOGE(AAFwkTag::APPMGR, "Write data failed."); - return; - } - - sptr remote = Remote(); - if (remote == nullptr) { - TAG_LOGE(AAFwkTag::APPMGR, "Remote is nullptr."); - return; - } - int32_t ret = remote->SendRequest(static_cast( - IStartSpecifiedAbilityResponse::Message::ON_NEW_PROCESS_REQUEST_TIMEOUT_RESPONSE), - data, reply, option); - if (ret != NO_ERROR) { - TAG_LOGW(AAFwkTag::APPMGR, "SendRequest is failed, error code: %{public}d", ret); - } -} - -void StartSpecifiedAbilityResponseProxy::OnStartSpecifiedFailed(int32_t requestId) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option(MessageOption::TF_ASYNC); - if (!WriteInterfaceToken(data)) { - return; - } - if (!data.WriteInt32(requestId)) { - TAG_LOGE(AAFwkTag::APPMGR, "Write data failed."); - return; - } - - int32_t ret = SendTransactCmd( - static_cast(IStartSpecifiedAbilityResponse::Message::ON_START_SPECIFIED_FAILED), data, reply, option); - if (ret != NO_ERROR) { - TAG_LOGW(AAFwkTag::APPMGR, "SendRequest is failed, error code: %{public}d", ret); - } -} -} // namespace AppExecFwk -} // namespace OHOS diff --git a/interfaces/inner_api/app_manager/src/appmgr/start_specified_ability_response_stub.cpp b/interfaces/inner_api/app_manager/src/appmgr/start_specified_ability_response_stub.cpp deleted file mode 100644 index 690da42b84a..00000000000 --- a/interfaces/inner_api/app_manager/src/appmgr/start_specified_ability_response_stub.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2022-2024 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "start_specified_ability_response_stub.h" -#include "appexecfwk_errors.h" -#include "hilog_tag_wrapper.h" -#include "ipc_types.h" -#include "iremote_object.h" - -namespace OHOS { -namespace AppExecFwk { -int32_t StartSpecifiedAbilityResponseStub::HandleOnAcceptWantResponse(MessageParcel &data, MessageParcel &reply) -{ - AAFwk::Want *want = data.ReadParcelable(); - if (want == nullptr) { - TAG_LOGE(AAFwkTag::APPMGR, "want is nullptr"); - return ERR_INVALID_VALUE; - } - - auto flag = Str16ToStr8(data.ReadString16()); - OnAcceptWantResponse(*want, flag, data.ReadInt32()); - delete want; - return NO_ERROR; -} - -int32_t StartSpecifiedAbilityResponseStub::HandleOnTimeoutResponse(MessageParcel &data, MessageParcel &reply) -{ - OnTimeoutResponse(data.ReadInt32()); - return NO_ERROR; -} - -int32_t StartSpecifiedAbilityResponseStub::HandleOnNewProcessRequestResponse(MessageParcel &data, MessageParcel &reply) -{ - auto flag = Str16ToStr8(data.ReadString16()); - OnNewProcessRequestResponse(flag, data.ReadInt32()); - return NO_ERROR; -} - -int32_t StartSpecifiedAbilityResponseStub::HandleOnNewProcessRequestTimeoutResponse(MessageParcel &data, - MessageParcel &reply) -{ - OnNewProcessRequestTimeoutResponse(data.ReadInt32()); - return NO_ERROR; -} - -int32_t StartSpecifiedAbilityResponseStub::HandleOnStartSpecifiedFailed(MessageParcel &data, - MessageParcel &reply) -{ - OnStartSpecifiedFailed(data.ReadInt32()); - return NO_ERROR; -} - -int StartSpecifiedAbilityResponseStub::OnRemoteRequest( - uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) -{ - TAG_LOGI(AAFwkTag::APPMGR, "StartSpecifiedAbilityResponseStub::OnReceived, code = %{public}u, flags= %{public}d.", - code, option.GetFlags()); - std::u16string descriptor = StartSpecifiedAbilityResponseStub::GetDescriptor(); - std::u16string remoteDescriptor = data.ReadInterfaceToken(); - if (descriptor != remoteDescriptor) { - TAG_LOGE(AAFwkTag::APPMGR, "local descriptor is not equal to remote"); - return ERR_INVALID_STATE; - } - - switch (code) { - case Message::ON_ACCEPT_WANT_RESPONSE: return HandleOnAcceptWantResponse(data, reply); - case Message::ON_TIMEOUT_RESPONSE: return HandleOnTimeoutResponse(data, reply); - case Message::ON_NEW_PROCESS_REQUEST_RESPONSE: return HandleOnNewProcessRequestResponse(data, reply); - case Message::ON_NEW_PROCESS_REQUEST_TIMEOUT_RESPONSE: - return HandleOnNewProcessRequestTimeoutResponse(data, reply); - case Message::ON_START_SPECIFIED_FAILED: return HandleOnStartSpecifiedFailed(data, reply); - default: return IPCObjectStub::OnRemoteRequest(code, data, reply, option); - } -} -} // namespace AppExecFwk -} // namespace OHOS diff --git a/interfaces/inner_api/wantagent/BUILD.gn b/interfaces/inner_api/wantagent/BUILD.gn index b1e9d373d3d..d1c8957a99c 100644 --- a/interfaces/inner_api/wantagent/BUILD.gn +++ b/interfaces/inner_api/wantagent/BUILD.gn @@ -43,6 +43,7 @@ config("wantagent_innerkits_public_config") { "${ability_runtime_path}/interfaces/kits/native/appkit/ability_runtime", "${ability_runtime_path}/interfaces/kits/native/appkit/ability_runtime/context", ] + configs = [ "${ability_runtime_innerkits_path}/app_manager:appmgr_innerkits_config", ] } ohos_shared_library("wantagent_innerkits") { @@ -64,7 +65,10 @@ ohos_shared_library("wantagent_innerkits") { "src/want_agent_info.cpp", ] - public_configs = [ ":wantagent_innerkits_public_config" ] + public_configs = [ + ":wantagent_innerkits_public_config", + "${ability_runtime_innerkits_path}/ability_manager:ability_manager_idl_config", + ] deps = [ "${ability_runtime_innerkits_path}/ability_manager:ability_start_options", diff --git a/services/abilitymgr/abilitymgr.gni b/services/abilitymgr/abilitymgr.gni index 3f646c121f6..398c8a9c216 100644 --- a/services/abilitymgr/abilitymgr.gni +++ b/services/abilitymgr/abilitymgr.gni @@ -80,7 +80,6 @@ abilityms_files = [ "src/ui_extension_record/ui_extension_record_factory.cpp", "src/screen_lock/unlock_screen_manager.cpp", "src/start_options.cpp", - "src/user_callback_proxy.cpp", "src/call_container.cpp", "src/call_record.cpp", "src/inner_mission_info.cpp", diff --git a/services/abilitymgr/include/ability_debug_deal.h b/services/abilitymgr/include/ability_debug_deal.h index 13e446b090b..53f04555e7d 100644 --- a/services/abilitymgr/include/ability_debug_deal.h +++ b/services/abilitymgr/include/ability_debug_deal.h @@ -16,7 +16,7 @@ #ifndef OHOS_ABILITY_RUNTIME_ABILITY_DEBUG_DEAL_H #define OHOS_ABILITY_RUNTIME_ABILITY_DEBUG_DEAL_H -#include "ability_debug_response_interface.h" +#include "iability_debug_response.h" #include "ability_debug_response_stub.h" namespace OHOS { @@ -60,9 +60,9 @@ public: virtual ~AbilityDebugResponse() = default; private: - void OnAbilitysDebugStarted(const std::vector> &tokens) override; - void OnAbilitysDebugStoped(const std::vector> &tokens) override; - void OnAbilitysAssertDebugChange(const std::vector> &tokens, bool isAssertDebug) override; + ErrCode OnAbilitysDebugStarted(const std::vector> &tokens) override; + ErrCode OnAbilitysDebugStoped(const std::vector> &tokens) override; + ErrCode OnAbilitysAssertDebugChange(const std::vector> &tokens, bool isAssertDebug) override; std::weak_ptr abilityDebugDeal_; }; diff --git a/services/abilitymgr/include/ability_manager_service.h b/services/abilitymgr/include/ability_manager_service.h index ec5b8768550..57e09a8535f 100644 --- a/services/abilitymgr/include/ability_manager_service.h +++ b/services/abilitymgr/include/ability_manager_service.h @@ -37,7 +37,7 @@ #include "ability_keep_alive_service.h" #include "ability_start_with_wait_observer_utils.h" #include "ams_configuration_parameter.h" -#include "app_debug_listener_interface.h" +#include "iapp_debug_listener.h" #include "app_exit_reason_helper.h" #include "app_mgr_interface.h" #include "app_scheduler.h" @@ -2170,7 +2170,7 @@ protected: int32_t GetCollaboratorType(const std::string &codePath) const; int32_t KillProcessForCollaborator(int32_t collaboratorType, const std::string &bundleName, int32_t userId); - + /** * Check if Caller is allowed to start AppServiceExtension(Stage). * @@ -2780,9 +2780,9 @@ private: ErrCode IntentOpenLinkInner(const std::shared_ptr ¶m, AbilityRuntime::ExtractInsightIntentGenericInfo &linkInfo, const int32_t userId); - + AbilityRuntime::ExtractInsightIntentGenericInfo GetInsightIntentGenericInfo(const InsightIntentExecuteParam ¶m); - + void CombinLinkInfo( const std::vector ¶mMappings, std::string &uri, AAFwk::Want &want); diff --git a/services/abilitymgr/include/app_scheduler.h b/services/abilitymgr/include/app_scheduler.h index b2de5a39511..9c0fc64fdc3 100644 --- a/services/abilitymgr/include/app_scheduler.h +++ b/services/abilitymgr/include/app_scheduler.h @@ -19,14 +19,14 @@ #include #include -#include "ability_debug_response_interface.h" +#include "iability_debug_response.h" #include "ability_info.h" #include "ability_manager_client.h" -#include "app_debug_listener_interface.h" +#include "iapp_debug_listener.h" #include "application_info.h" #include "appmgr/app_mgr_client.h" #include "appmgr/app_state_callback_host.h" -#include "appmgr/start_specified_ability_response_stub.h" +#include "start_specified_ability_response_stub.h" #include "bundle_info.h" #include "fault_data.h" #include "iremote_object.h" @@ -114,7 +114,7 @@ public: * @param abilityTokens abilities in died process. */ virtual void OnAppRemoteDied(const std::vector> &abilityTokens) {} - + virtual void OnStartProcessFailed(sptr token) {} virtual void OnCacheExitInfo(uint32_t accessTokenId, const AppExecFwk::RunningProcessInfo &exitInfo, @@ -127,14 +127,14 @@ public: StartSpecifiedAbilityResponse() = default; virtual ~StartSpecifiedAbilityResponse() = default; - virtual void OnAcceptWantResponse(const AAFwk::Want &want, const std::string &flag, + virtual ErrCode OnAcceptWantResponse(const AAFwk::Want &want, const std::string &flag, int32_t requestId) override; - virtual void OnTimeoutResponse(int32_t requestId) override; + virtual ErrCode OnTimeoutResponse(int32_t requestId) override; - virtual void OnNewProcessRequestResponse(const std::string &flag, int32_t requestId) override; - virtual void OnNewProcessRequestTimeoutResponse(int32_t requestId) override; + virtual ErrCode OnNewProcessRequestResponse(const std::string &flag, int32_t requestId) override; + virtual ErrCode OnNewProcessRequestTimeoutResponse(int32_t requestId) override; - virtual void OnStartSpecifiedFailed(int32_t requestId) override; + virtual ErrCode OnStartSpecifiedFailed(int32_t requestId) override; }; /** diff --git a/services/abilitymgr/src/ability_debug_deal.cpp b/services/abilitymgr/src/ability_debug_deal.cpp index 9493ef44d47..6a41c648b3a 100644 --- a/services/abilitymgr/src/ability_debug_deal.cpp +++ b/services/abilitymgr/src/ability_debug_deal.cpp @@ -74,50 +74,53 @@ void AbilityDebugDeal::OnAbilitysAssertDebugChange(const std::vector> &tokens) +ErrCode AbilityDebugResponse::OnAbilitysDebugStarted(const std::vector> &tokens) { if (tokens.empty()) { TAG_LOGW(AAFwkTag::ABILITYMGR, "tokens empty"); - return; + return ERR_INVALID_DATA; } auto deal = abilityDebugDeal_.lock(); if (deal == nullptr) { TAG_LOGE(AAFwkTag::ABILITYMGR, "deal null"); - return; + return ERR_INVALID_DATA; } deal->OnAbilitysDebugStarted(tokens); + return ERR_OK; } -void AbilityDebugResponse::OnAbilitysDebugStoped(const std::vector> &tokens) +ErrCode AbilityDebugResponse::OnAbilitysDebugStoped(const std::vector> &tokens) { if (tokens.empty()) { TAG_LOGW(AAFwkTag::ABILITYMGR, "tokens empty"); - return; + return ERR_INVALID_DATA; } auto deal = abilityDebugDeal_.lock(); if (deal == nullptr) { TAG_LOGE(AAFwkTag::ABILITYMGR, "deal null"); - return; + return ERR_INVALID_DATA; } deal->OnAbilitysDebugStoped(tokens); + return ERR_OK; } -void AbilityDebugResponse::OnAbilitysAssertDebugChange( +ErrCode AbilityDebugResponse::OnAbilitysAssertDebugChange( const std::vector> &tokens, bool isAssertDebug) { if (tokens.empty()) { TAG_LOGW(AAFwkTag::ABILITYMGR, "tokens empty"); - return; + return ERR_INVALID_DATA; } auto deal = abilityDebugDeal_.lock(); if (deal == nullptr) { TAG_LOGW(AAFwkTag::ABILITYMGR, "deal null"); - return; + return ERR_INVALID_DATA; } deal->OnAbilitysAssertDebugChange(tokens, isAssertDebug); + return ERR_OK; } } // namespace AAFwk } // namespace OHOS diff --git a/services/abilitymgr/src/app_scheduler.cpp b/services/abilitymgr/src/app_scheduler.cpp index d6385c53b44..d26e6d7ffe6 100644 --- a/services/abilitymgr/src/app_scheduler.cpp +++ b/services/abilitymgr/src/app_scheduler.cpp @@ -386,10 +386,11 @@ void AppScheduler::StartSpecifiedAbility(const AAFwk::Want &want, const AppExecF IN_PROCESS_CALL_WITHOUT_RET(appMgrClient_->StartSpecifiedAbility(want, abilityInfo, requestId)); } -void StartSpecifiedAbilityResponse::OnAcceptWantResponse( +ErrCode StartSpecifiedAbilityResponse::OnAcceptWantResponse( const AAFwk::Want &want, const std::string &flag, int32_t requestId) { DelayedSingleton::GetInstance()->OnAcceptWantResponse(want, flag, requestId); + return ERR_OK; } void AppScheduler::PrepareTerminateApp(const pid_t pid, const std::string &moduleName) @@ -398,9 +399,10 @@ void AppScheduler::PrepareTerminateApp(const pid_t pid, const std::string &modul IN_PROCESS_CALL_WITHOUT_RET(appMgrClient_->PrepareTerminateApp(pid, moduleName)); } -void StartSpecifiedAbilityResponse::OnTimeoutResponse(int32_t requestId) +ErrCode StartSpecifiedAbilityResponse::OnTimeoutResponse(int32_t requestId) { DelayedSingleton::GetInstance()->OnStartSpecifiedAbilityTimeoutResponse(requestId); + return ERR_OK; } void AppScheduler::StartSpecifiedProcess( @@ -410,19 +412,22 @@ void AppScheduler::StartSpecifiedProcess( IN_PROCESS_CALL_WITHOUT_RET(appMgrClient_->StartSpecifiedProcess(want, abilityInfo, requestId)); } -void StartSpecifiedAbilityResponse::OnNewProcessRequestResponse(const std::string &flag, int32_t requestId) +ErrCode StartSpecifiedAbilityResponse::OnNewProcessRequestResponse(const std::string &flag, int32_t requestId) { DelayedSingleton::GetInstance()->OnStartSpecifiedProcessResponse(flag, requestId); + return ERR_OK; } -void StartSpecifiedAbilityResponse::OnNewProcessRequestTimeoutResponse(int32_t requestId) +ErrCode StartSpecifiedAbilityResponse::OnNewProcessRequestTimeoutResponse(int32_t requestId) { DelayedSingleton::GetInstance()->OnStartSpecifiedProcessTimeoutResponse(requestId); + return ERR_OK; } -void StartSpecifiedAbilityResponse::OnStartSpecifiedFailed(int32_t requestId) +ErrCode StartSpecifiedAbilityResponse::OnStartSpecifiedFailed(int32_t requestId) { DelayedSingleton::GetInstance()->OnStartSpecifiedFailed(requestId); + return ERR_OK; } int AppScheduler::GetProcessRunningInfos(std::vector &info) diff --git a/services/abilitymgr/src/user_callback_proxy.cpp b/services/abilitymgr/src/user_callback_proxy.cpp deleted file mode 100644 index a94521710d7..00000000000 --- a/services/abilitymgr/src/user_callback_proxy.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2021-2024 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "user_callback_proxy.h" - -#include "hilog_tag_wrapper.h" - -namespace OHOS { -namespace AAFwk { -void UserCallbackProxy::OnStopUserDone(int userId, int errcode) -{ - SendRequestCommon(userId, errcode, IUserCallback::UserCallbackCmd::ON_STOP_USER_DONE); -} - -void UserCallbackProxy::OnStartUserDone(int userId, int errcode) -{ - SendRequestCommon(userId, errcode, IUserCallback::UserCallbackCmd::ON_START_USER_DONE); -} - -void UserCallbackProxy::OnLogoutUserDone(int userId, int errcode) -{ - SendRequestCommon(userId, errcode, IUserCallback::UserCallbackCmd::ON_LOGOUT_USER_DONE); -} - -void UserCallbackProxy::SendRequestCommon(int userId, int errcode, IUserCallback::UserCallbackCmd cmd) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option(MessageOption::TF_ASYNC); - - TAG_LOGI(AAFwkTag::ABILITYMGR, - "UserCallbackProxy, sendrequest, cmd:%{public}d, userId:%{public}d, errcode:%{public}d", cmd, userId, errcode); - if (!data.WriteInterfaceToken(IUserCallback::GetDescriptor())) { - TAG_LOGE(AAFwkTag::ABILITYMGR, "write interface token failed"); - return; - } - - if (!data.WriteInt32(userId)) { - TAG_LOGE(AAFwkTag::ABILITYMGR, "write userId error"); - return; - } - - if (!data.WriteInt32(errcode)) { - TAG_LOGE(AAFwkTag::ABILITYMGR, "write errcode error"); - return; - } - - sptr remote = Remote(); - if (remote == nullptr) { - TAG_LOGE(AAFwkTag::ABILITYMGR, "null remote object"); - return; - } - - int error = remote->SendRequest(cmd, data, reply, option); - if (error != NO_ERROR) { - TAG_LOGE(AAFwkTag::ABILITYMGR, "SendRequest fail, error: %{public}d", error); - return; - } -} -} // namespace AAFwk -} // namespace OHOS diff --git a/services/abilitymgr/src/user_callback_stub.cpp b/services/abilitymgr/src/user_callback_stub.cpp deleted file mode 100644 index fe078586ffd..00000000000 --- a/services/abilitymgr/src/user_callback_stub.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2021-2024 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "user_callback_stub.h" - -#include "hilog_tag_wrapper.h" - -namespace OHOS { -namespace AAFwk { -UserCallbackStub::UserCallbackStub() {} - -int UserCallbackStub::OnStopUserDoneInner(MessageParcel &data, MessageParcel &reply) -{ - auto accountId = data.ReadInt32(); - auto errCode = data.ReadInt32(); - OnStopUserDone(accountId, errCode); - return NO_ERROR; -} - -int UserCallbackStub::OnStartUserDoneInner(MessageParcel &data, MessageParcel &reply) -{ - auto accountId = data.ReadInt32(); - auto errCode = data.ReadInt32(); - OnStartUserDone(accountId, errCode); - return NO_ERROR; -} - -int UserCallbackStub::OnLogoutUserDoneInner(MessageParcel &data, MessageParcel &reply) -{ - auto accountId = data.ReadInt32(); - auto errCode = data.ReadInt32(); - OnLogoutUserDone(accountId, errCode); - return NO_ERROR; -} - -int UserCallbackStub::OnRemoteRequest( - uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) -{ - std::u16string descriptor = UserCallbackStub::GetDescriptor(); - std::u16string remoteDescriptor = data.ReadInterfaceToken(); - if (descriptor != remoteDescriptor) { - TAG_LOGI(AAFwkTag::ABILITYMGR, "local descriptor invalid"); - return ERR_INVALID_STATE; - } - - if (code < UserCallbackCmd::CMD_MAX && code >= 0) { - switch (code) { - case UserCallbackCmd::ON_STOP_USER_DONE: - return OnStopUserDoneInner(data, reply); - break; - case UserCallbackCmd::ON_START_USER_DONE: - return OnStartUserDoneInner(data, reply); - break; - case UserCallbackCmd::ON_LOGOUT_USER_DONE: - return OnLogoutUserDoneInner(data, reply); - break; - } - } - - return IPCObjectStub::OnRemoteRequest(code, data, reply, option); -} -} // namespace AAFwk -} // namespace OHOS diff --git a/services/appmgr/include/ams_mgr_scheduler.h b/services/appmgr/include/ams_mgr_scheduler.h index 69af744e93a..a2ae1a72f0b 100644 --- a/services/appmgr/include/ams_mgr_scheduler.h +++ b/services/appmgr/include/ams_mgr_scheduler.h @@ -19,7 +19,7 @@ #include "ability_info.h" #include "ability_running_record.h" #include "ams_mgr_stub.h" -#include "app_debug_listener_interface.h" +#include "iapp_debug_listener.h" #include "app_mgr_constants.h" #include "app_mgr_service_inner.h" #include "app_record_id.h" diff --git a/services/appmgr/include/app_debug_manager.h b/services/appmgr/include/app_debug_manager.h index 8da182c9428..d5203399e10 100644 --- a/services/appmgr/include/app_debug_manager.h +++ b/services/appmgr/include/app_debug_manager.h @@ -19,7 +19,7 @@ #include #include -#include "app_debug_listener_interface.h" +#include "iapp_debug_listener.h" namespace OHOS { namespace AppExecFwk { diff --git a/services/appmgr/include/app_mgr_service_inner.h b/services/appmgr/include/app_mgr_service_inner.h index 9bc66b07c2f..fa27cf1a6f7 100644 --- a/services/appmgr/include/app_mgr_service_inner.h +++ b/services/appmgr/include/app_mgr_service_inner.h @@ -24,12 +24,12 @@ #include #include -#include "ability_debug_response_interface.h" +#include "iability_debug_response.h" #include "ability_foreground_state_observer_interface.h" #include "ability_info.h" #include "advanced_security_mode_manager.h" #include "app_death_recipient.h" -#include "app_debug_listener_interface.h" +#include "iapp_debug_listener.h" #include "app_debug_manager.h" #include "app_foreground_state_observer_interface.h" #include "app_malloc_info.h" @@ -81,7 +81,7 @@ #include "app_cjheap_mem_info.h" #include "running_multi_info.h" #include "multi_user_config_mgr.h" -#include "user_callback.h" +#include "iuser_callback.h" #include "native_child_notify_interface.h" namespace OHOS { diff --git a/services/appmgr/include/app_running_manager.h b/services/appmgr/include/app_running_manager.h index d92f1b5228b..5fe6b246d30 100644 --- a/services/appmgr/include/app_running_manager.h +++ b/services/appmgr/include/app_running_manager.h @@ -22,7 +22,7 @@ #include #include "ability_info.h" -#include "app_debug_listener_interface.h" +#include "iapp_debug_listener.h" #include "app_jsheap_mem_info.h" #include "app_cjheap_mem_info.h" #include "app_malloc_info.h" @@ -420,7 +420,7 @@ public: int32_t RemoveUIExtensionBindItemById(int32_t uiExtensionBindAbilityId); std::shared_ptr GetAppRunningRecordByChildRecordPid(const pid_t pid); - + int32_t AssignRunningProcessInfoByAppRecord( std::shared_ptr appRecord, AppExecFwk::RunningProcessInfo &info) const; diff --git a/test/fuzztest/abilitydebugdeal_fuzzer/BUILD.gn b/test/fuzztest/abilitydebugdeal_fuzzer/BUILD.gn index f9c6a7be98b..a620c1cc4e3 100644 --- a/test/fuzztest/abilitydebugdeal_fuzzer/BUILD.gn +++ b/test/fuzztest/abilitydebugdeal_fuzzer/BUILD.gn @@ -37,7 +37,6 @@ ohos_fuzztest("AbilityDebugDealFuzzTest") { "-fno-omit-frame-pointer", ] sources = [ - "${ability_runtime_innerkits_path}/app_manager/src/appmgr/ability_debug_response_stub.cpp", "${ability_runtime_services_path}/abilitymgr/src/ability_debug_deal.cpp", "abilitydebugdeal_fuzzer.cpp", ] @@ -50,6 +49,7 @@ ohos_fuzztest("AbilityDebugDealFuzzTest") { deps = [ "${ability_runtime_innerkits_path}/ability_manager:ability_manager", "${ability_runtime_innerkits_path}/ability_manager:ability_start_options", + "${ability_runtime_innerkits_path}/app_manager:app_manager", "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_services_path}/abilitymgr:abilityms", ] diff --git a/test/fuzztest/abilitydebugresponseproxy_fuzzer/BUILD.gn b/test/fuzztest/abilitydebugresponseproxy_fuzzer/BUILD.gn index 768834e2a31..5a84060ab11 100755 --- a/test/fuzztest/abilitydebugresponseproxy_fuzzer/BUILD.gn +++ b/test/fuzztest/abilitydebugresponseproxy_fuzzer/BUILD.gn @@ -36,7 +36,6 @@ ohos_fuzztest("AbilityDebugResponseProxyFuzzTest") { ] sources = [ - "${ability_runtime_innerkits_path}/app_manager/src/appmgr/ability_debug_response_proxy.cpp", "abilitydebugresponseproxy_fuzzer.cpp", ] @@ -48,6 +47,7 @@ ohos_fuzztest("AbilityDebugResponseProxyFuzzTest") { deps = [ "${ability_runtime_innerkits_path}/ability_manager:ability_manager", "${ability_runtime_innerkits_path}/ability_manager:ability_start_options", + "${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", diff --git a/test/fuzztest/abilitydebugresponseproxy_fuzzer/abilitydebugresponseproxy_fuzzer.cpp b/test/fuzztest/abilitydebugresponseproxy_fuzzer/abilitydebugresponseproxy_fuzzer.cpp index 7840d93e675..a81ad49bebd 100755 --- a/test/fuzztest/abilitydebugresponseproxy_fuzzer/abilitydebugresponseproxy_fuzzer.cpp +++ b/test/fuzztest/abilitydebugresponseproxy_fuzzer/abilitydebugresponseproxy_fuzzer.cpp @@ -68,16 +68,10 @@ void AbilityDebugResponseProxyFuzztest1(bool boolParam, std::string &stringParam std::shared_ptr proxy = std::make_shared(nullptr); // branch constructor MessageParcel data; - proxy->WriteInterfaceToken(data); // branch std::vector> tokens; proxy->OnAbilitysDebugStarted(tokens); // branch proxy->OnAbilitysDebugStoped(tokens); // branch proxy->OnAbilitysAssertDebugChange(tokens, boolParam); // branch - sptr token = GetFuzzAbilityToken(); - tokens.emplace_back(token); - proxy->SendRequest(static_cast(int32Param), tokens); // branch tokens no empty. - tokens.clear(); - proxy->SendRequest(static_cast(int32Param), tokens); // branch tokens empty. } bool DoSomethingInterestingWithMyAPI(const char* data, size_t size) diff --git a/test/fuzztest/abilityinterfacesappmgrabilitydebugresponseproxy_fuzzer/abilityinterfacesappmgrabilitydebugresponseproxy_fuzzer.cpp b/test/fuzztest/abilityinterfacesappmgrabilitydebugresponseproxy_fuzzer/abilityinterfacesappmgrabilitydebugresponseproxy_fuzzer.cpp index b09f529b4c3..34c22d5fc05 100644 --- a/test/fuzztest/abilityinterfacesappmgrabilitydebugresponseproxy_fuzzer/abilityinterfacesappmgrabilitydebugresponseproxy_fuzzer.cpp +++ b/test/fuzztest/abilityinterfacesappmgrabilitydebugresponseproxy_fuzzer/abilityinterfacesappmgrabilitydebugresponseproxy_fuzzer.cpp @@ -20,7 +20,6 @@ #define private public #include "ability_debug_response_proxy.h" -#include "ability_debug_response_interface.h" #undef private #include "securec.h" @@ -73,17 +72,6 @@ bool DoSomethingInterestingWithMyAPI(const char* data, size_t size) infosProxy->OnAbilitysDebugStoped(tokens); bool isAssertDebug = *data % ENABLE; infosProxy->OnAbilitysAssertDebugChange(tokens, isAssertDebug); - MessageParcel parcels; - parcels.WriteInterfaceToken(AMSMGR_INTERFACE_TOKEN); - parcels.WriteBuffer(data, size); - parcels.RewindRead(0); - infosProxy->WriteInterfaceToken(parcels); - IAbilityDebugResponse::Message message = IAbilityDebugResponse::Message::ON_ABILITYS_DEBUG_STARTED; - infosProxy->SendRequest(message, tokens); - message = IAbilityDebugResponse::Message::ON_ABILITYS_DEBUG_STOPED; - infosProxy->SendRequest(message, tokens); - message = IAbilityDebugResponse::Message::ON_ABILITYS_ASSERT_DEBUG; - infosProxy->SendRequest(message, tokens); return true; } } diff --git a/test/fuzztest/abilityinterfacesappmgrappdebuglistenerproxy_fuzzer/abilityinterfacesappmgrappdebuglistenerproxy_fuzzer.cpp b/test/fuzztest/abilityinterfacesappmgrappdebuglistenerproxy_fuzzer/abilityinterfacesappmgrappdebuglistenerproxy_fuzzer.cpp index bb28bb48cd9..a9d69ca2549 100644 --- a/test/fuzztest/abilityinterfacesappmgrappdebuglistenerproxy_fuzzer/abilityinterfacesappmgrappdebuglistenerproxy_fuzzer.cpp +++ b/test/fuzztest/abilityinterfacesappmgrappdebuglistenerproxy_fuzzer/abilityinterfacesappmgrappdebuglistenerproxy_fuzzer.cpp @@ -20,7 +20,6 @@ #define private public #include "app_debug_listener_proxy.h" -#include "app_debug_listener_interface.h" #undef private #include "securec.h" @@ -71,15 +70,6 @@ bool DoSomethingInterestingWithMyAPI(const char* data, size_t size) std::vector debugInfos; infosProxy->OnAppDebugStarted(debugInfos); infosProxy->OnAppDebugStoped(debugInfos); - MessageParcel parcels; - parcels.WriteInterfaceToken(AMSMGR_INTERFACE_TOKEN); - parcels.WriteBuffer(data, size); - parcels.RewindRead(0); - infosProxy->WriteInterfaceToken(parcels); - IAppDebugListener::Message message = IAppDebugListener::Message::ON_APP_DEBUG_STARTED; - infosProxy->SendRequest(message, debugInfos); - message = IAppDebugListener::Message::ON_APP_DEBUG_STOPED; - infosProxy->SendRequest(message, debugInfos); return true; } } diff --git a/test/fuzztest/abilityinterfacesappmgrappdebuglistenerstub_fuzzer/abilityinterfacesappmgrappdebuglistenerstub_fuzzer.cpp b/test/fuzztest/abilityinterfacesappmgrappdebuglistenerstub_fuzzer/abilityinterfacesappmgrappdebuglistenerstub_fuzzer.cpp index 2b94e21e8d6..7b60eaa63f8 100644 --- a/test/fuzztest/abilityinterfacesappmgrappdebuglistenerstub_fuzzer/abilityinterfacesappmgrappdebuglistenerstub_fuzzer.cpp +++ b/test/fuzztest/abilityinterfacesappmgrappdebuglistenerstub_fuzzer/abilityinterfacesappmgrappdebuglistenerstub_fuzzer.cpp @@ -20,7 +20,6 @@ #define private public #include "app_debug_listener_stub.h" -#include "app_debug_listener_interface.h" #undef private #include "securec.h" @@ -55,8 +54,8 @@ public: virtual ~ AppDebugListenerStubFUZZ() {}; int OnRemoteRequest( uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override{ return 0; }; - void OnAppDebugStarted(const std::vector &debugInfos) override{}; - void OnAppDebugStoped(const std::vector &debugInfos) override{}; + ErrCode OnAppDebugStarted(const std::vector &debugInfos) override { return ERR_OK; }; + ErrCode OnAppDebugStoped(const std::vector &debugInfos) override { return ERR_OK; }; }; sptr GetFuzzAbilityToken() @@ -75,7 +74,7 @@ sptr GetFuzzAbilityToken() bool DoSomethingInterestingWithMyAPI(const char* data, size_t size) { - uint32_t codeOne = static_cast(IAppDebugListener::Message::ON_APP_DEBUG_STARTED); + uint32_t codeOne = static_cast(IAppDebugListenerIpcCode::COMMAND_ON_APP_DEBUG_STARTED); MessageParcel parcel; parcel.WriteInterfaceToken(AMSMGR_INTERFACE_TOKEN); parcel.WriteBuffer(data, size); @@ -84,7 +83,7 @@ bool DoSomethingInterestingWithMyAPI(const char* data, size_t size) MessageOption option; std::shared_ptr abmsOne = std::make_shared(); abmsOne->OnRemoteRequest(codeOne, parcel, reply, option); - uint32_t codeTwo = static_cast(IAppDebugListener::Message::ON_APP_DEBUG_STOPED); + uint32_t codeTwo = static_cast(IAppDebugListenerIpcCode::COMMAND_ON_APP_DEBUG_STOPED); abmsOne->OnRemoteRequest(codeTwo, parcel, reply, option); return true; } diff --git a/test/fuzztest/usercallbackstub_fuzzer/usercallbackstub_fuzzer.cpp b/test/fuzztest/usercallbackstub_fuzzer/usercallbackstub_fuzzer.cpp index 11c5ff0e3f9..affdd4884f4 100644 --- a/test/fuzztest/usercallbackstub_fuzzer/usercallbackstub_fuzzer.cpp +++ b/test/fuzztest/usercallbackstub_fuzzer/usercallbackstub_fuzzer.cpp @@ -45,11 +45,9 @@ public: UserCallbackStubFuzzTest() = default; virtual ~UserCallbackStubFuzzTest() {} - void OnStopUserDone(int userId, int errcode) override - {} - void OnStartUserDone(int userId, int errcode) override {} - - void OnLogoutUserDone(int userId, int errcode) override {} + ErrCode OnStopUserDone(int userId, int errcode) override { return ERR_OK; } + ErrCode OnStartUserDone(int userId, int errcode) override { return ERR_OK; } + ErrCode OnLogoutUserDone(int userId, int errcode) override { return ERR_OK; } }; const std::u16string APPMGR_INTERFACE_TOKEN = u"ohos.aafwk.AppManager"; uint32_t GetU32Data(const char* ptr) @@ -70,8 +68,6 @@ bool DoSomethingInterestingWithMyAPI(const char *data, size_t size) MessageParcel reply; MessageOption option; backStub->OnRemoteRequest(code, dataParcel, reply, option); - backStub->OnStopUserDoneInner(dataParcel, reply); - backStub->OnStartUserDoneInner(dataParcel, reply); return true; } diff --git a/test/moduletest/app_mgr_client_test/BUILD.gn b/test/moduletest/app_mgr_client_test/BUILD.gn index 9a3c1e9e3ed..a05d6c24a70 100644 --- a/test/moduletest/app_mgr_client_test/BUILD.gn +++ b/test/moduletest/app_mgr_client_test/BUILD.gn @@ -18,7 +18,12 @@ module_output_path = "ability_runtime/ability_runtime/mstabilitymgrservice" ohos_moduletest("app_mgr_client_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/common/include", "${ability_runtime_test_path}/mock/mock_sa_call", diff --git a/test/unittest/BUILD.gn b/test/unittest/BUILD.gn index c6d53ceff4d..0a8300cd1a9 100644 --- a/test/unittest/BUILD.gn +++ b/test/unittest/BUILD.gn @@ -14,8 +14,7 @@ import("//build/ohos.gni") import("//build/test.gni") import("//foundation/ability/ability_runtime/ability_runtime.gni") -import( - "//foundation/ability/ability_runtime/services/abilitymgr/abilitymgr.gni") +import("//foundation/ability/ability_runtime/services/abilitymgr/abilitymgr.gni") config("appmgr_test_config") { configs = [ @@ -43,8 +42,6 @@ ohos_source_set("appmgr_test_source") { "${ability_runtime_innerkits_path}/app_manager/src/appmgr/app_record_id.cpp", "${ability_runtime_innerkits_path}/app_manager/src/appmgr/app_scheduler_host.cpp", "${ability_runtime_innerkits_path}/app_manager/src/appmgr/app_scheduler_proxy.cpp", - "${ability_runtime_innerkits_path}/app_manager/src/appmgr/app_state_callback_host.cpp", - "${ability_runtime_innerkits_path}/app_manager/src/appmgr/app_state_callback_proxy.cpp", "${ability_runtime_innerkits_path}/app_manager/src/appmgr/fault_data.cpp", "${ability_runtime_innerkits_path}/app_manager/src/appmgr/native_child_notify_proxy.cpp", "${ability_runtime_innerkits_path}/app_manager/src/appmgr/native_child_notify_stub.cpp", diff --git a/test/unittest/ability_debug_response_stub_test/ability_debug_response_stub_test.cpp b/test/unittest/ability_debug_response_stub_test/ability_debug_response_stub_test.cpp index 3167b3fa20f..fe5d6e1e3a7 100644 --- a/test/unittest/ability_debug_response_stub_test/ability_debug_response_stub_test.cpp +++ b/test/unittest/ability_debug_response_stub_test/ability_debug_response_stub_test.cpp @@ -74,7 +74,7 @@ HWTEST_F(AbilityDebugResponseStubTest, HandleOnAbilitysDebugStarted_0100, TestSi data.WriteRemoteObject(token); auto result = stub->OnRemoteRequest( - static_cast(IAbilityDebugResponse::Message::ON_ABILITYS_DEBUG_STARTED), data, reply, option); + static_cast(IAbilityDebugResponseIpcCode::COMMAND_ON_ABILITYS_DEBUG_STARTED), data, reply, option); EXPECT_EQ(result, NO_ERROR); testing::Mock::AllowLeak(stub); GTEST_LOG_(INFO) << "AbilityDebugResponseProxyTest_HandleOnAbilitysDebugStarted_0100 end"; @@ -103,7 +103,7 @@ HWTEST_F(AbilityDebugResponseStubTest, HandleOnAbilitysDebugStoped_0100, TestSiz data.WriteRemoteObject(token); auto result = stub->OnRemoteRequest( - static_cast(IAbilityDebugResponse::Message::ON_ABILITYS_DEBUG_STOPED), data, reply, option); + static_cast(IAbilityDebugResponseIpcCode::COMMAND_ON_ABILITYS_DEBUG_STOPED), data, reply, option); EXPECT_EQ(result, NO_ERROR); testing::Mock::AllowLeak(stub); GTEST_LOG_(INFO) << "AbilityDebugResponseProxyTest_HandleOnAbilitysDebugStoped_0100 end"; diff --git a/test/unittest/ability_debug_response_stub_test/mock_ability_debug_response_stub.h b/test/unittest/ability_debug_response_stub_test/mock_ability_debug_response_stub.h index e4a257354df..caa01322dd8 100644 --- a/test/unittest/ability_debug_response_stub_test/mock_ability_debug_response_stub.h +++ b/test/unittest/ability_debug_response_stub_test/mock_ability_debug_response_stub.h @@ -27,9 +27,9 @@ class MockAbilityDebugResponseStub : public AbilityDebugResponseStub { public: MockAbilityDebugResponseStub() {} virtual ~ MockAbilityDebugResponseStub() {} - MOCK_METHOD1(OnAbilitysDebugStarted, void(const std::vector> &tokens)); - MOCK_METHOD1(OnAbilitysDebugStoped, void(const std::vector> &tokens)); - MOCK_METHOD2(OnAbilitysAssertDebugChange, void(const std::vector> &, bool)); + MOCK_METHOD1(OnAbilitysDebugStarted, ErrCode(const std::vector> &tokens)); + MOCK_METHOD1(OnAbilitysDebugStoped, ErrCode(const std::vector> &tokens)); + MOCK_METHOD2(OnAbilitysAssertDebugChange, ErrCode(const std::vector> &, bool)); }; } // namespace AppExecFwk } // namespace OHOS 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 ccd62f0691e..89a81bac741 100644 --- a/test/unittest/ability_manager_client_branch_second_test/BUILD.gn +++ b/test/unittest/ability_manager_client_branch_second_test/BUILD.gn @@ -16,7 +16,12 @@ import("//foundation/ability/ability_runtime/ability_runtime.gni") ohos_unittest("ability_manager_client_branch_second_test") { module_out_path = "ability_runtime/ability_runtime/ability_call_test" - + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + blocklist = "../../cfi_blocklist.txt" + } include_dirs = [ "${ability_runtime_test_path}/mock/ability_manager_collaborator", "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/system_ability_mock", diff --git a/test/unittest/ability_manager_client_branch_test/BUILD.gn b/test/unittest/ability_manager_client_branch_test/BUILD.gn index 44a1bc89fc6..837d4e5d287 100644 --- a/test/unittest/ability_manager_client_branch_test/BUILD.gn +++ b/test/unittest/ability_manager_client_branch_test/BUILD.gn @@ -16,7 +16,12 @@ import("//foundation/ability/ability_runtime/ability_runtime.gni") ohos_unittest("ability_manager_client_branch_test") { module_out_path = "ability_runtime/ability_runtime/ability_call_test" - + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + blocklist = "../../cfi_blocklist.txt" + } include_dirs = [ "${ability_runtime_test_path}/mock/ability_manager_collaborator", "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/system_ability_mock", 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 4d464465ef5..9863597d244 100644 --- a/test/unittest/ability_manager_client_branch_third_test/BUILD.gn +++ b/test/unittest/ability_manager_client_branch_third_test/BUILD.gn @@ -16,7 +16,12 @@ import("//foundation/ability/ability_runtime/ability_runtime.gni") ohos_unittest("ability_manager_client_branch_third_test") { module_out_path = "ability_runtime/ability_runtime/ability_call_test" - + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + blocklist = "../../cfi_blocklist.txt" + } include_dirs = [ "mock/include", "${ability_runtime_test_path}/mock/common/include", diff --git a/test/unittest/ability_manager_proxy_fourth_test/BUILD.gn b/test/unittest/ability_manager_proxy_fourth_test/BUILD.gn index 660c33c3f51..3763375bdcb 100644 --- a/test/unittest/ability_manager_proxy_fourth_test/BUILD.gn +++ b/test/unittest/ability_manager_proxy_fourth_test/BUILD.gn @@ -18,7 +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", "${ability_runtime_test_path}/unittest/ability_manager_proxy_fourth_test/", diff --git a/test/unittest/ability_manager_proxy_second_test/BUILD.gn b/test/unittest/ability_manager_proxy_second_test/BUILD.gn index f7442776ac3..d13e1cdb39f 100644 --- a/test/unittest/ability_manager_proxy_second_test/BUILD.gn +++ b/test/unittest/ability_manager_proxy_second_test/BUILD.gn @@ -18,7 +18,12 @@ module_output_path = "ability_runtime/ability_runtime/abilitymgr" ohos_unittest("ability_manager_proxy_second_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", "${ability_runtime_test_path}/unittest/ability_manager_proxy_second_test/", diff --git a/test/unittest/ability_manager_proxy_test/BUILD.gn b/test/unittest/ability_manager_proxy_test/BUILD.gn index 697e6e567ea..e4261ca6b4e 100644 --- a/test/unittest/ability_manager_proxy_test/BUILD.gn +++ b/test/unittest/ability_manager_proxy_test/BUILD.gn @@ -18,7 +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", "${ability_runtime_test_path}/unittest/ability_manager_proxy_test/", diff --git a/test/unittest/ability_manager_proxy_third_test/BUILD.gn b/test/unittest/ability_manager_proxy_third_test/BUILD.gn index 62f6e2dac84..09ae8600db6 100644 --- a/test/unittest/ability_manager_proxy_third_test/BUILD.gn +++ b/test/unittest/ability_manager_proxy_third_test/BUILD.gn @@ -18,7 +18,12 @@ module_output_path = "ability_runtime/ability_runtime/abilitymgr" ohos_unittest("ability_manager_proxy_third_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", "${ability_runtime_test_path}/unittest/ability_manager_proxy_third_test/", diff --git a/test/unittest/ability_manager_proxy_third_test/ability_manager_proxy_third_test.cpp b/test/unittest/ability_manager_proxy_third_test/ability_manager_proxy_third_test.cpp index 1a48b715b98..79ef873b77d 100644 --- a/test/unittest/ability_manager_proxy_third_test/ability_manager_proxy_third_test.cpp +++ b/test/unittest/ability_manager_proxy_third_test/ability_manager_proxy_third_test.cpp @@ -75,10 +75,10 @@ public: MockIUserCallback() = default; virtual ~MockIUserCallback() = default; - void OnStopUserDone(int userId, int errcode) override {} - void OnStartUserDone(int userId, int errcode) override {} + ErrCode OnStopUserDone(int userId, int errcode) override { return ERR_OK; } + ErrCode OnStartUserDone(int userId, int errcode) override { return ERR_OK; } - void OnLogoutUserDone(int userId, int errcode) override {} + ErrCode OnLogoutUserDone(int userId, int errcode) override { return ERR_OK; } sptr AsObject() override { diff --git a/test/unittest/ability_manager_service_eighth_test/ability_manager_service_eighth_test.cpp b/test/unittest/ability_manager_service_eighth_test/ability_manager_service_eighth_test.cpp index 3984f0a987a..dc7301c4e64 100644 --- a/test/unittest/ability_manager_service_eighth_test/ability_manager_service_eighth_test.cpp +++ b/test/unittest/ability_manager_service_eighth_test/ability_manager_service_eighth_test.cpp @@ -59,13 +59,10 @@ public: MockIUserCallback() = default; virtual ~MockIUserCallback() = default; - void OnStopUserDone(int userId, int errcode) override - {} - void OnStartUserDone(int userId, int errcode) override - {} + ErrCode OnStopUserDone(int userId, int errcode) override { return ERR_OK; } + ErrCode OnStartUserDone(int userId, int errcode) override { return ERR_OK; } - void OnLogoutUserDone(int userId, int errcode) override - {} + ErrCode OnLogoutUserDone(int userId, int errcode) override { return ERR_OK; } sptr AsObject() override { diff --git a/test/unittest/ability_manager_service_fourteenth_test/BUILD.gn b/test/unittest/ability_manager_service_fourteenth_test/BUILD.gn index ab184c53caf..30b71cea492 100644 --- a/test/unittest/ability_manager_service_fourteenth_test/BUILD.gn +++ b/test/unittest/ability_manager_service_fourteenth_test/BUILD.gn @@ -176,7 +176,6 @@ ohos_unittest("ability_manager_service_fourteenth_test") { "${ability_runtime_services_path}/abilitymgr/src/ui_extension/preload_uiext_state_observer.cpp", "${ability_runtime_services_path}/abilitymgr/src/ui_extension_record/ui_extension_record.cpp", "${ability_runtime_services_path}/abilitymgr/src/ui_extension_record/ui_extension_record_factory.cpp", - "${ability_runtime_services_path}/abilitymgr/src/user_callback_proxy.cpp", "${ability_runtime_services_path}/abilitymgr/src/user_controller.cpp", "${ability_runtime_services_path}/abilitymgr/src/user_event_handler.cpp", "${ability_runtime_services_path}/abilitymgr/src/utils/ability_event_util.cpp", diff --git a/test/unittest/ability_manager_service_thirteenth_test/BUILD.gn b/test/unittest/ability_manager_service_thirteenth_test/BUILD.gn index 4b36e56edc8..41689eb2cbe 100644 --- a/test/unittest/ability_manager_service_thirteenth_test/BUILD.gn +++ b/test/unittest/ability_manager_service_thirteenth_test/BUILD.gn @@ -177,7 +177,6 @@ ohos_unittest("ability_manager_service_thirteenth_test") { "${ability_runtime_services_path}/abilitymgr/src/ui_extension/preload_uiext_state_observer.cpp", "${ability_runtime_services_path}/abilitymgr/src/ui_extension_record/ui_extension_record.cpp", "${ability_runtime_services_path}/abilitymgr/src/ui_extension_record/ui_extension_record_factory.cpp", - "${ability_runtime_services_path}/abilitymgr/src/user_callback_proxy.cpp", "${ability_runtime_services_path}/abilitymgr/src/user_controller.cpp", "${ability_runtime_services_path}/abilitymgr/src/user_event_handler.cpp", "${ability_runtime_services_path}/abilitymgr/src/utils/ability_event_util.cpp", diff --git a/test/unittest/ability_manager_service_twelfth_test/mock/include/mock_test_object.h b/test/unittest/ability_manager_service_twelfth_test/mock/include/mock_test_object.h index 215b46aa8e2..bb13da5d1da 100644 --- a/test/unittest/ability_manager_service_twelfth_test/mock/include/mock_test_object.h +++ b/test/unittest/ability_manager_service_twelfth_test/mock/include/mock_test_object.h @@ -16,16 +16,17 @@ #ifndef ABILITY_MANAGER_SERVICE_TWELFTH_TEST_MOCK_TEST_OBJECT_H #define ABILITY_MANAGER_SERVICE_TWELFTH_TEST_MOCK_TEST_OBJECT_H -#include "user_callback.h" +#include "iuser_callback.h" #include "ability_connect_callback_interface.h" +namespace OHOS { class MockIUserCallback : public OHOS::AAFwk::IUserCallback { public: MockIUserCallback() = default; virtual ~MockIUserCallback() = default; - virtual void OnStopUserDone(int userId, int errcode) override {} - virtual void OnStartUserDone(int userId, int errcode) override {} - virtual void OnLogoutUserDone(int userId, int errcode) override {} + virtual ErrCode OnStopUserDone(int userId, int errcode) override { return ERR_OK; } + virtual ErrCode OnStartUserDone(int userId, int errcode) override { return ERR_OK; } + virtual ErrCode OnLogoutUserDone(int userId, int errcode) override { return ERR_OK; } virtual OHOS::sptr AsObject() { return nullptr; @@ -44,4 +45,5 @@ public: return nullptr; } }; +} #endif // ABILITY_MANAGER_SERVICE_TWELFTH_TEST_MOCK_TEST_OBJECT_H diff --git a/test/unittest/ability_scheduler_stub_second_test/BUILD.gn b/test/unittest/ability_scheduler_stub_second_test/BUILD.gn index 537ffd064a3..70a91787602 100644 --- a/test/unittest/ability_scheduler_stub_second_test/BUILD.gn +++ b/test/unittest/ability_scheduler_stub_second_test/BUILD.gn @@ -18,7 +18,12 @@ module_output_path = "ability_runtime/ability_runtime/abilitymgr" ohos_unittest("ability_scheduler_stub_second_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" ] sources = [ diff --git a/test/unittest/ability_scheduler_stub_test/BUILD.gn b/test/unittest/ability_scheduler_stub_test/BUILD.gn index f8ce56fce58..429d1f6f444 100644 --- a/test/unittest/ability_scheduler_stub_test/BUILD.gn +++ b/test/unittest/ability_scheduler_stub_test/BUILD.gn @@ -18,7 +18,12 @@ module_output_path = "ability_runtime/ability_runtime/abilitymgr" ohos_unittest("ability_scheduler_stub_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" ] sources = [ diff --git a/test/unittest/ams_ability_running_record_test/BUILD.gn b/test/unittest/ams_ability_running_record_test/BUILD.gn index 5403becfe77..b6beb42fe21 100644 --- a/test/unittest/ams_ability_running_record_test/BUILD.gn +++ b/test/unittest/ams_ability_running_record_test/BUILD.gn @@ -18,6 +18,12 @@ module_output_path = "ability_runtime/ability_runtime/appmgrservice" ohos_unittest("AmsAbilityRunningRecordTest") { module_out_path = module_output_path + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + blocklist = "../../cfi_blocklist.txt" + } cflags_cc = [] include_dirs = [ "${ability_runtime_path}/interfaces/kits/native/appkit/ability_bundle_manager_helper", diff --git a/test/unittest/ams_mgr_scheduler_dump_test/BUILD.gn b/test/unittest/ams_mgr_scheduler_dump_test/BUILD.gn index 82fe5a49b19..ee17c6bc88a 100644 --- a/test/unittest/ams_mgr_scheduler_dump_test/BUILD.gn +++ b/test/unittest/ams_mgr_scheduler_dump_test/BUILD.gn @@ -18,7 +18,12 @@ module_output_path = "ability_runtime/ability_runtime/abilitymgr" ohos_unittest("ams_mgr_scheduler_dump_test") { module_out_path = module_output_path - + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + blocklist = "../../cfi_blocklist.txt" + } sources = [ "ams_mgr_scheduler_dump_test.cpp" ] configs = [ "${ability_runtime_services_path}/appmgr:appmgr_config" ] diff --git a/test/unittest/ams_service_load_ability_process_test/BUILD.gn b/test/unittest/ams_service_load_ability_process_test/BUILD.gn index 6e21ffaa9de..a206e7c8154 100644 --- a/test/unittest/ams_service_load_ability_process_test/BUILD.gn +++ b/test/unittest/ams_service_load_ability_process_test/BUILD.gn @@ -19,6 +19,12 @@ module_output_path = "ability_runtime/ability_runtime/appmgrservice" ohos_unittest("AmsServiceLoadAbilityProcessTest") { use_exceptions = true module_out_path = module_output_path + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + blocklist = "../../cfi_blocklist.txt" + } cflags_cc = [] include_dirs = [ "${ability_runtime_services_path}/appmgr/test/unittest/mocks", diff --git a/test/unittest/app_debug_listener_proxy_test/BUILD.gn b/test/unittest/app_debug_listener_proxy_test/BUILD.gn index 185afb3de5f..4fb5f653846 100644 --- a/test/unittest/app_debug_listener_proxy_test/BUILD.gn +++ b/test/unittest/app_debug_listener_proxy_test/BUILD.gn @@ -18,7 +18,12 @@ module_output_path = "ability_runtime/ability_runtime/appmgrservice" ohos_unittest("AppDebugListenerProxyTest") { module_out_path = module_output_path - + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + blocklist = "../../cfi_blocklist.txt" + } include_dirs = [ "${ability_runtime_services_path}/appmgr/include", "${ability_runtime_test_path}/mock/services_appmgr_test/include", diff --git a/test/unittest/app_debug_listener_proxy_test/app_debug_listener_proxy_test.cpp b/test/unittest/app_debug_listener_proxy_test/app_debug_listener_proxy_test.cpp index 18060b90829..242dcdef445 100644 --- a/test/unittest/app_debug_listener_proxy_test/app_debug_listener_proxy_test.cpp +++ b/test/unittest/app_debug_listener_proxy_test/app_debug_listener_proxy_test.cpp @@ -54,17 +54,6 @@ void AppDebugListenerProxyTest::SetUp() void AppDebugListenerProxyTest::TearDown() {} -/** - * @tc.name: WriteInterfaceToken_0100 - * @tc.desc: write token into parcel data - * @tc.type: FUNC - */ -HWTEST_F(AppDebugListenerProxyTest, WriteInterfaceToken_0100, TestSize.Level1) -{ - MessageParcel data; - EXPECT_TRUE(proxy_->WriteInterfaceToken(data)); -} - /** * @tc.name: OnAppDebugStarted_0100 * @tc.desc: Callback of app debug started, verify that AppDebugListener interface calls normally. @@ -83,7 +72,7 @@ HWTEST_F(AppDebugListenerProxyTest, OnAppDebugStarted_0100, TestSize.Level1) .Times(1) .WillOnce(Invoke(mock_.GetRefPtr(), &AppDebugListenerStubMock::InvokeSendRequest)); proxy_->OnAppDebugStarted(appDebugInfos); - auto code = static_cast(IAppDebugListener::Message::ON_APP_DEBUG_STARTED); + auto code = static_cast(IAppDebugListenerIpcCode::COMMAND_ON_APP_DEBUG_STARTED); EXPECT_EQ(code, static_cast(mock_->code_)); } @@ -105,7 +94,7 @@ HWTEST_F(AppDebugListenerProxyTest, OnAppDebugStoped_0100, TestSize.Level1) .Times(1) .WillOnce(Invoke(mock_.GetRefPtr(), &AppDebugListenerStubMock::InvokeSendRequest)); proxy_->OnAppDebugStoped(appDebugInfos); - auto code = static_cast(IAppDebugListener::Message::ON_APP_DEBUG_STOPED); + auto code = static_cast(IAppDebugListenerIpcCode::COMMAND_ON_APP_DEBUG_STOPED); EXPECT_EQ(code, static_cast(mock_->code_)); } } // namespace AppExecFwk diff --git a/test/unittest/app_debug_listener_proxy_test/app_debug_listener_stub_mock.h b/test/unittest/app_debug_listener_proxy_test/app_debug_listener_stub_mock.h index b3c81fc0dcb..f2e6ac5eedd 100644 --- a/test/unittest/app_debug_listener_proxy_test/app_debug_listener_stub_mock.h +++ b/test/unittest/app_debug_listener_proxy_test/app_debug_listener_stub_mock.h @@ -19,7 +19,7 @@ #include #include #define private public -#include "app_debug_listener_interface.h" +#include "iapp_debug_listener.h" #undef private namespace OHOS { @@ -45,8 +45,8 @@ public: uint32_t code_ = 0; MOCK_METHOD4(SendRequest, int(uint32_t, MessageParcel &, MessageParcel &, MessageOption &)); - MOCK_METHOD1(OnAppDebugStarted, void(const std::vector &)); - MOCK_METHOD1(OnAppDebugStoped, void(const std::vector &)); + MOCK_METHOD1(OnAppDebugStarted, ErrCode(const std::vector &)); + MOCK_METHOD1(OnAppDebugStoped, ErrCode(const std::vector &)); }; } // namespace AppExecFwk } // namespace OHOS diff --git a/test/unittest/app_debug_listener_stub_test/app_debug_listener_stub_test.cpp b/test/unittest/app_debug_listener_stub_test/app_debug_listener_stub_test.cpp index 87754032c02..f8942295d42 100644 --- a/test/unittest/app_debug_listener_stub_test/app_debug_listener_stub_test.cpp +++ b/test/unittest/app_debug_listener_stub_test/app_debug_listener_stub_test.cpp @@ -73,7 +73,7 @@ HWTEST_F(AppDebugListenerStubTest, OnRemoteRequest_0100, TestSize.Level1) data.WriteParcelable(&debugInfo); auto result = mockStub_->OnRemoteRequest( - static_cast(IAppDebugListener::Message::ON_APP_DEBUG_STARTED), data, reply, option); + static_cast(IAppDebugListenerIpcCode::COMMAND_ON_APP_DEBUG_STARTED), data, reply, option); EXPECT_EQ(result, NO_ERROR); } @@ -91,7 +91,7 @@ HWTEST_F(AppDebugListenerStubTest, OnRemoteRequest_0200, TestSize.Level1) data.WriteInt32(DEBUG_INFO_SIZE_ZERO); auto result = mockStub_->OnRemoteRequest( - static_cast(IAppDebugListener::Message::ON_APP_DEBUG_STARTED), data, reply, option); + static_cast(IAppDebugListenerIpcCode::COMMAND_ON_APP_DEBUG_STARTED), data, reply, option); EXPECT_EQ(result, ERR_INVALID_STATE); } @@ -128,7 +128,7 @@ HWTEST_F(AppDebugListenerStubTest, OnRemoteRequest_0400, TestSize.Level1) data.WriteInt32(DEBUG_INFO_SIZE_ZERO); auto result = mockStub_->OnRemoteRequest( - static_cast(IAppDebugListener::Message::ON_APP_DEBUG_STARTED), data, reply, option); + static_cast(IAppDebugListenerIpcCode::COMMAND_ON_APP_DEBUG_STARTED), data, reply, option); EXPECT_EQ(result, ERR_INVALID_DATA); } @@ -142,12 +142,14 @@ HWTEST_F(AppDebugListenerStubTest, HandleOnAppDebugStarted_0100, TestSize.Level1 EXPECT_NE(mockStub_, nullptr); MessageParcel data; MessageParcel reply; + MessageOption option(MessageOption::TF_ASYNC); AppDebugInfo debugInfo; data.WriteInt32(DEBUG_INFO_SIZE_ONE); data.WriteParcelable(&debugInfo); EXPECT_CALL(*mockStub_, OnAppDebugStarted(_)).Times(1); - EXPECT_EQ(mockStub_->HandleOnAppDebugStarted(data, reply), NO_ERROR); + mockStub_->OnRemoteRequest( + static_cast(IAppDebugListenerIpcCode::COMMAND_ON_APP_DEBUG_STARTED), data, reply, option); } /** @@ -160,13 +162,15 @@ HWTEST_F(AppDebugListenerStubTest, HandleOnAppDebugStarted_0200, TestSize.Level1 EXPECT_NE(mockStub_, nullptr); MessageParcel data; MessageParcel reply; + MessageOption option(MessageOption::TF_ASYNC); AppDebugInfo *debugInfo = nullptr; WriteInterfaceToken(data); data.WriteInt32(DEBUG_INFO_SIZE_ONE); data.WriteParcelable(debugInfo); EXPECT_CALL(*mockStub_, OnAppDebugStarted(_)).Times(0); - EXPECT_EQ(mockStub_->HandleOnAppDebugStarted(data, reply), ERR_INVALID_DATA); + mockStub_->OnRemoteRequest( + static_cast(IAppDebugListenerIpcCode::COMMAND_ON_APP_DEBUG_STARTED), data, reply, option); } /** @@ -179,12 +183,15 @@ HWTEST_F(AppDebugListenerStubTest, HandleOnAppDebugStoped_0100, TestSize.Level1) EXPECT_NE(mockStub_, nullptr); MessageParcel data; MessageParcel reply; + MessageOption option(MessageOption::TF_ASYNC); AppDebugInfo debugInfo; data.WriteInt32(DEBUG_INFO_SIZE_ONE); data.WriteParcelable(&debugInfo); EXPECT_CALL(*mockStub_, OnAppDebugStoped(_)).Times(1); - EXPECT_EQ(mockStub_->HandleOnAppDebugStoped(data, reply), NO_ERROR); + auto ret = mockStub_->OnRemoteRequest( + static_cast(IAppDebugListenerIpcCode::COMMAND_ON_APP_DEBUG_STOPED), data, reply, option); + EXPECT_EQ(ret, NO_ERROR); } /** @@ -197,13 +204,16 @@ HWTEST_F(AppDebugListenerStubTest, HandleOnAppDebugStoped_0200, TestSize.Level1) EXPECT_NE(mockStub_, nullptr); MessageParcel data; MessageParcel reply; + MessageOption option(MessageOption::TF_ASYNC); AppDebugInfo *debugInfo = nullptr; WriteInterfaceToken(data); data.WriteInt32(DEBUG_INFO_SIZE_ONE); data.WriteParcelable(debugInfo); EXPECT_CALL(*mockStub_, OnAppDebugStoped(_)).Times(0); - EXPECT_EQ(mockStub_->HandleOnAppDebugStoped(data, reply), ERR_INVALID_DATA); + auto ret = mockStub_->OnRemoteRequest( + static_cast(IAppDebugListenerIpcCode::COMMAND_ON_APP_DEBUG_STOPED), data, reply, option); + EXPECT_EQ(ret, ERR_INVALID_DATA); } } // namespace AppExecFwk } // namespace OHOS diff --git a/test/unittest/app_debug_listener_stub_test/mock_app_debug_listener_stub.h b/test/unittest/app_debug_listener_stub_test/mock_app_debug_listener_stub.h index 09418d05921..436837abf2d 100644 --- a/test/unittest/app_debug_listener_stub_test/mock_app_debug_listener_stub.h +++ b/test/unittest/app_debug_listener_stub_test/mock_app_debug_listener_stub.h @@ -26,8 +26,8 @@ class MockAppDebugListenerStub : public AppDebugListenerStub { public: MockAppDebugListenerStub() {} virtual ~ MockAppDebugListenerStub() {} - MOCK_METHOD1(OnAppDebugStarted, void(const std::vector &debugInfos)); - MOCK_METHOD1(OnAppDebugStoped, void(const std::vector &debugInfos)); + MOCK_METHOD1(OnAppDebugStarted, ErrCode(const std::vector &debugInfos)); + MOCK_METHOD1(OnAppDebugStoped, ErrCode(const std::vector &debugInfos)); }; } // namespace AAFwk } // namespace OHOS diff --git a/test/unittest/app_mgr_client_test/BUILD.gn b/test/unittest/app_mgr_client_test/BUILD.gn index 580be23be08..841e02899d2 100644 --- a/test/unittest/app_mgr_client_test/BUILD.gn +++ b/test/unittest/app_mgr_client_test/BUILD.gn @@ -18,7 +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", "${ability_runtime_services_path}/abilitymgr:abilityms_config", diff --git a/test/unittest/app_mgr_service_inner_eighth_test/app_mgr_service_inner_eighth_test.cpp b/test/unittest/app_mgr_service_inner_eighth_test/app_mgr_service_inner_eighth_test.cpp index a76ce33ce28..d6b2b7fe7bf 100644 --- a/test/unittest/app_mgr_service_inner_eighth_test/app_mgr_service_inner_eighth_test.cpp +++ b/test/unittest/app_mgr_service_inner_eighth_test/app_mgr_service_inner_eighth_test.cpp @@ -104,14 +104,21 @@ public: class MyAbilityDebugResponse : public IAbilityDebugResponse { public: - void OnAbilitysDebugStarted(const std::vector> &tokens) override - {} + ErrCode OnAbilitysDebugStarted(const std::vector> &tokens) override + { + return ERR_OK; + } - void OnAbilitysDebugStoped(const std::vector> &tokens) override - {} + ErrCode OnAbilitysDebugStoped(const std::vector> &tokens) override + { + return ERR_OK; + } - void OnAbilitysAssertDebugChange(const std::vector> &tokens, - bool isAssertDebug) override {} + ErrCode OnAbilitysAssertDebugChange(const std::vector> &tokens, + bool isAssertDebug) override + { + return ERR_OK; + } sptr AsObject() override { @@ -121,16 +128,26 @@ public: class MyStartSpecifiedAbilityResponse : public IStartSpecifiedAbilityResponse { public: - void OnAcceptWantResponse(const AAFwk::Want &want, const std::string &flag, int32_t requestId) override - {} - void OnTimeoutResponse(int32_t requestId) override - {} - void OnNewProcessRequestResponse(const std::string &flag, int32_t requestId) override - {} - void OnNewProcessRequestTimeoutResponse(int32_t requestId) override - {} - void OnStartSpecifiedFailed(int32_t requestId) override - {} + ErrCode OnAcceptWantResponse(const AAFwk::Want &want, const std::string &flag, int32_t requestId) override + { + return ERR_OK; + } + ErrCode OnTimeoutResponse(int32_t requestId) override + { + return ERR_OK; + } + ErrCode OnNewProcessRequestResponse(const std::string &flag, int32_t requestId) override + { + return ERR_OK; + } + ErrCode OnNewProcessRequestTimeoutResponse(int32_t requestId) override + { + return ERR_OK; + } + ErrCode OnStartSpecifiedFailed(int32_t requestId) override + { + return ERR_OK; + } sptr AsObject() override { return nullptr; diff --git a/test/unittest/app_mgr_service_inner_second_test/mock/include/mock_ability_debug_response_stub.h b/test/unittest/app_mgr_service_inner_second_test/mock/include/mock_ability_debug_response_stub.h index b3cd1f2cae5..482178787c9 100644 --- a/test/unittest/app_mgr_service_inner_second_test/mock/include/mock_ability_debug_response_stub.h +++ b/test/unittest/app_mgr_service_inner_second_test/mock/include/mock_ability_debug_response_stub.h @@ -27,9 +27,9 @@ class MockAbilityDebugResponseStub : public AbilityDebugResponseStub { public: MockAbilityDebugResponseStub() {} virtual ~ MockAbilityDebugResponseStub() {} - MOCK_METHOD1(OnAbilitysDebugStarted, void(const std::vector> &tokens)); - MOCK_METHOD1(OnAbilitysDebugStoped, void(const std::vector> &tokens)); - MOCK_METHOD2(OnAbilitysAssertDebugChange, void(const std::vector> &, bool)); + MOCK_METHOD1(OnAbilitysDebugStarted, ErrCode(const std::vector> &tokens)); + MOCK_METHOD1(OnAbilitysDebugStoped, ErrCode(const std::vector> &tokens)); + MOCK_METHOD2(OnAbilitysAssertDebugChange, ErrCode(const std::vector> &, bool)); }; } // namespace AppExecFwk } // namespace OHOS diff --git a/test/unittest/app_mgr_service_inner_seventh_test/app_mgr_service_inner_seventh_test.cpp b/test/unittest/app_mgr_service_inner_seventh_test/app_mgr_service_inner_seventh_test.cpp index 65aa161005f..3275de23310 100644 --- a/test/unittest/app_mgr_service_inner_seventh_test/app_mgr_service_inner_seventh_test.cpp +++ b/test/unittest/app_mgr_service_inner_seventh_test/app_mgr_service_inner_seventh_test.cpp @@ -55,16 +55,26 @@ public: class MyStartSpecifiedAbilityResponse : public IStartSpecifiedAbilityResponse { public: - void OnAcceptWantResponse(const AAFwk::Want &want, const std::string &flag, int32_t requestId) override - {} - void OnTimeoutResponse(int32_t requestId) override - {} - void OnNewProcessRequestResponse(const std::string &flag, int32_t requestId) override - {} - void OnNewProcessRequestTimeoutResponse(int32_t requestId) override - {} - void OnStartSpecifiedFailed(int32_t requestId) override - {} + ErrCode OnAcceptWantResponse(const AAFwk::Want &want, const std::string &flag, int32_t requestId) override + { + return ERR_OK; + } + ErrCode OnTimeoutResponse(int32_t requestId) override + { + return ERR_OK; + } + ErrCode OnNewProcessRequestResponse(const std::string &flag, int32_t requestId) override + { + return ERR_OK; + } + ErrCode OnNewProcessRequestTimeoutResponse(int32_t requestId) override + { + return ERR_OK; + } + ErrCode OnStartSpecifiedFailed(int32_t requestId) override + { + return ERR_OK; + } sptr AsObject() override { return nullptr; diff --git a/test/unittest/app_mgr_service_inner_test/app_mgr_service_inner_test.cpp b/test/unittest/app_mgr_service_inner_test/app_mgr_service_inner_test.cpp index 789b3287a5b..8c790ffe6e4 100644 --- a/test/unittest/app_mgr_service_inner_test/app_mgr_service_inner_test.cpp +++ b/test/unittest/app_mgr_service_inner_test/app_mgr_service_inner_test.cpp @@ -117,13 +117,9 @@ public: MockIUserCallback() = default; virtual ~MockIUserCallback() = default; - void OnStopUserDone(int userId, int errcode) override - {} - void OnStartUserDone(int userId, int errcode) override - {} - - void OnLogoutUserDone(int userId, int errcode) override - {} + ErrCode OnStopUserDone(int userId, int errcode) override { return ERR_OK; } + ErrCode OnStartUserDone(int userId, int errcode) override { return ERR_OK; } + ErrCode OnLogoutUserDone(int userId, int errcode) override { return ERR_OK; } sptr AsObject() override { diff --git a/test/unittest/app_preloader_test/BUILD.gn b/test/unittest/app_preloader_test/BUILD.gn index e271f94abcb..5621e4646a7 100755 --- a/test/unittest/app_preloader_test/BUILD.gn +++ b/test/unittest/app_preloader_test/BUILD.gn @@ -33,6 +33,7 @@ ohos_unittest("app_preloader_test") { ] deps = [ + "${ability_runtime_innerkits_path}/app_manager:app_manager", "${ability_runtime_path}/utils/server/startup:startup_util", "${ability_runtime_services_path}/appmgr:libappms", ] diff --git a/test/unittest/app_service_extension_context_test/BUILD.gn b/test/unittest/app_service_extension_context_test/BUILD.gn index d39c7285832..cdd7169e193 100644 --- a/test/unittest/app_service_extension_context_test/BUILD.gn +++ b/test/unittest/app_service_extension_context_test/BUILD.gn @@ -18,7 +18,12 @@ module_output_path = "ability_runtime/ability_runtime/app_service_extension" ohos_unittest("app_service_extension_context_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", "${ability_runtime_native_path}/ability/native", diff --git a/test/unittest/app_state_observer_manager_test/BUILD.gn b/test/unittest/app_state_observer_manager_test/BUILD.gn index 44be34d331a..39dea9ed1a6 100755 --- a/test/unittest/app_state_observer_manager_test/BUILD.gn +++ b/test/unittest/app_state_observer_manager_test/BUILD.gn @@ -18,6 +18,12 @@ module_output_path = "ability_runtime/ability_runtime/appmgr" ohos_unittest("app_state_observer_manager_test") { module_out_path = module_output_path + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + blocklist = "../../cfi_blocklist.txt" + } cflags_cc = [] include_dirs = [ "${ability_runtime_services_path}/appmgr/include", diff --git a/test/unittest/app_state_observer_manager_test_second/BUILD.gn b/test/unittest/app_state_observer_manager_test_second/BUILD.gn index 3d439214764..ade8f768119 100755 --- a/test/unittest/app_state_observer_manager_test_second/BUILD.gn +++ b/test/unittest/app_state_observer_manager_test_second/BUILD.gn @@ -18,6 +18,12 @@ module_output_path = "ability_runtime/ability_runtime/appmgr" ohos_unittest("app_state_observer_manager_test_second") { module_out_path = module_output_path + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + blocklist = "../../cfi_blocklist.txt" + } cflags_cc = [] include_dirs = [ "${ability_runtime_services_path}/appmgr/include", diff --git a/test/unittest/call_record_test/BUILD.gn b/test/unittest/call_record_test/BUILD.gn index a9bfa99149f..e4daaef3a3f 100644 --- a/test/unittest/call_record_test/BUILD.gn +++ b/test/unittest/call_record_test/BUILD.gn @@ -18,7 +18,12 @@ module_output_path = "ability_runtime/ability_runtime/abilitymgr" ohos_unittest("call_record_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/frameworks_kits_ability_ability_runtime_test/AMS", "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/ability_scheduler_mock", diff --git a/test/unittest/data_ability_manager_test/BUILD.gn b/test/unittest/data_ability_manager_test/BUILD.gn index 2596754c478..f2937e420c5 100644 --- a/test/unittest/data_ability_manager_test/BUILD.gn +++ b/test/unittest/data_ability_manager_test/BUILD.gn @@ -24,9 +24,11 @@ ohos_unittest("data_ability_manager_test") { "${ability_runtime_test_path}/mock/services_abilitymgr_test/include", "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/system_ability_mock", "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/ability_scheduler_mock", + "${ability_runtime_innerkits_path}/app_manager/include", "${ability_runtime_innerkits_path}/ability_manager/include", "${ability_runtime_path}/interfaces/kits/native/ability/native", "${ability_runtime_services_path}/common/include", + "${ability_runtime_services_path}/include", ] sources = [ diff --git a/test/unittest/dfr_test/watchdog_test/BUILD.gn b/test/unittest/dfr_test/watchdog_test/BUILD.gn index 7d977ca1478..101dfcdd974 100644 --- a/test/unittest/dfr_test/watchdog_test/BUILD.gn +++ b/test/unittest/dfr_test/watchdog_test/BUILD.gn @@ -64,6 +64,7 @@ ohos_unittest("watchdog_test") { ] deps = [ + "${ability_runtime_innerkits_path}/app_manager:app_manager", "${ability_runtime_innerkits_path}/runtime:runtime", "${ability_runtime_native_path}/appkit:appkit_native", ] diff --git a/test/unittest/frameworks_kits_appkit_native_test/BUILD.gn b/test/unittest/frameworks_kits_appkit_native_test/BUILD.gn index bea5089ae74..84609a8cf12 100644 --- a/test/unittest/frameworks_kits_appkit_native_test/BUILD.gn +++ b/test/unittest/frameworks_kits_appkit_native_test/BUILD.gn @@ -37,6 +37,10 @@ config("module_private_config") { config("module_context_config") { visibility = [ ":*" ] + configs = [ + "${ability_runtime_innerkits_path}/ability_manager:ability_manager_idl_config", + "${ability_runtime_innerkits_path}/app_manager:appmgr_innerkits_config", + ] include_dirs = [ "${ability_runtime_innerkits_path}/app_manager/include/appmgr", "${ability_runtime_test_path}/mock/frameworks_kits_appkit_native_test/include", @@ -1019,7 +1023,10 @@ ohos_unittest("idle_time_test") { configs = [ ":module_context_config" ] - deps = [ "${ability_runtime_native_path}/appkit:appkit_native" ] + deps = [ + "${ability_runtime_innerkits_path}/app_manager:app_manager", + "${ability_runtime_native_path}/appkit:appkit_native", + ] external_deps = [ "ability_runtime:runtime", diff --git a/test/unittest/mission_list_test/BUILD.gn b/test/unittest/mission_list_test/BUILD.gn index 00cbd596216..0bb8ffad82a 100644 --- a/test/unittest/mission_list_test/BUILD.gn +++ b/test/unittest/mission_list_test/BUILD.gn @@ -84,6 +84,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/pending_want_test/BUILD.gn b/test/unittest/pending_want_test/BUILD.gn index b9a780e467e..2484d92cfff 100644 --- a/test/unittest/pending_want_test/BUILD.gn +++ b/test/unittest/pending_want_test/BUILD.gn @@ -19,6 +19,12 @@ module_output_path = "ability_runtime/ability_runtime/wantagent" ohos_unittest("pending_want_test") { module_out_path = module_output_path + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + blocklist = "../../cfi_blocklist.txt" + } include_dirs = [ "${ability_runtime_path}/interfaces/kits/native/appkit/ability_runtime/context/", "${ability_runtime_path}/interfaces/kits/native/appkit/ability_runtime", 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 e35e6e9b2e2..f8d3d42a711 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 @@ -68,7 +68,11 @@ ohos_unittest("quick_fix_manager_service_test") { ohos_unittest("quick_fix_manager_apply_task_test") { module_out_path = "ability_runtime/ability_runtime/quick_fix" - + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + } include_dirs = [ "${ability_runtime_path}/interfaces/kits/native/appkit/ability_bundle_manager_helper", "${ability_runtime_test_path}/unittest/quick_fix/mock/include", diff --git a/test/unittest/service_extension_context_test/BUILD.gn b/test/unittest/service_extension_context_test/BUILD.gn index b6a7c73efc1..19ddf2b1f00 100644 --- a/test/unittest/service_extension_context_test/BUILD.gn +++ b/test/unittest/service_extension_context_test/BUILD.gn @@ -18,7 +18,12 @@ module_output_path = "ability_runtime/ability_runtime/abilitymgr" ohos_unittest("service_extension_context_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", "${ability_runtime_native_path}/ability/native", diff --git a/test/unittest/state_utils_test/BUILD.gn b/test/unittest/state_utils_test/BUILD.gn index 99bec30e48b..bbde094090a 100644 --- a/test/unittest/state_utils_test/BUILD.gn +++ b/test/unittest/state_utils_test/BUILD.gn @@ -31,7 +31,7 @@ ohos_unittest("state_utils_test") { ] include_dirs = [] - deps = [] + deps = [ "${ability_runtime_path}/utils/server/startup:startup_util" ] external_deps = [ "ability_runtime:abilitykit_native", diff --git a/test/unittest/stop_user_callback_proxy_test/BUILD.gn b/test/unittest/stop_user_callback_proxy_test/BUILD.gn index bf90b09291f..3196f493de2 100755 --- a/test/unittest/stop_user_callback_proxy_test/BUILD.gn +++ b/test/unittest/stop_user_callback_proxy_test/BUILD.gn @@ -18,7 +18,12 @@ module_output_path = "ability_runtime/ability_runtime/abilitymgr" ohos_unittest("stop_user_callback_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" ] sources = [ diff --git a/test/unittest/stop_user_callback_proxy_test/stop_user_callback_proxy_test.cpp b/test/unittest/stop_user_callback_proxy_test/stop_user_callback_proxy_test.cpp index bea826a0aa5..6ac8b3fcddd 100755 --- a/test/unittest/stop_user_callback_proxy_test/stop_user_callback_proxy_test.cpp +++ b/test/unittest/stop_user_callback_proxy_test/stop_user_callback_proxy_test.cpp @@ -64,7 +64,7 @@ HWTEST_F(StopUserCallbackProxyTest, OnStopUserDone_001, TestSize.Level1) int userId = 0; int errcode = 0; proxy_->OnStopUserDone(userId, errcode); - EXPECT_EQ(IUserCallback::UserCallbackCmd::ON_STOP_USER_DONE, mock_->code_); + EXPECT_EQ(static_cast(IUserCallbackIpcCode::COMMAND_ON_STOP_USER_DONE), mock_->code_); } /* @@ -83,7 +83,7 @@ HWTEST_F(StopUserCallbackProxyTest, OnStopUserDone_002, TestSize.Level1) int userId = 0; int errcode = 0; proxy_->OnStopUserDone(userId, errcode); - EXPECT_EQ(IUserCallback::UserCallbackCmd::ON_STOP_USER_DONE, mock_->code_); + EXPECT_EQ(static_cast(IUserCallbackIpcCode::COMMAND_ON_STOP_USER_DONE), mock_->code_); } } // namespace AAFwk } // namespace OHOS diff --git a/test/unittest/stop_user_callback_proxy_test/stop_user_callback_stub_mock.h b/test/unittest/stop_user_callback_proxy_test/stop_user_callback_stub_mock.h index 59a6b059561..d212a591345 100755 --- a/test/unittest/stop_user_callback_proxy_test/stop_user_callback_stub_mock.h +++ b/test/unittest/stop_user_callback_proxy_test/stop_user_callback_stub_mock.h @@ -18,7 +18,7 @@ #include #include #include -#include "user_callback.h" +#include "iuser_callback.h" namespace OHOS { namespace AAFwk { @@ -45,9 +45,9 @@ public: int code_ = 0; - virtual void OnStopUserDone(int userId, int errcode) {}; - virtual void OnStartUserDone(int userId, int errcode) {} - virtual void OnLogoutUserDone(int userId, int errcode) {} + virtual ErrCode OnStopUserDone(int userId, int errcode) { return ERR_OK; }; + virtual ErrCode OnStartUserDone(int userId, int errcode) { return ERR_OK; } + virtual ErrCode OnLogoutUserDone(int userId, int errcode) { return ERR_OK; } }; } // namespace AAFwk } // namespace OHOS diff --git a/test/unittest/stop_user_callback_stub_test/BUILD.gn b/test/unittest/stop_user_callback_stub_test/BUILD.gn index 3f8036ff4f2..45eeb3c27e8 100644 --- a/test/unittest/stop_user_callback_stub_test/BUILD.gn +++ b/test/unittest/stop_user_callback_stub_test/BUILD.gn @@ -18,7 +18,12 @@ module_output_path = "ability_runtime/ability_runtime/abilitymgr" ohos_unittest("stop_user_callback_stub_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", "${ability_runtime_innerkits_path}/test/fuzztest/stopusercallbackstub_fuzzer", diff --git a/test/unittest/stop_user_callback_stub_test/stop_user_callback_stub_test.cpp b/test/unittest/stop_user_callback_stub_test/stop_user_callback_stub_test.cpp index 7e6b49e383d..bc333ec6168 100644 --- a/test/unittest/stop_user_callback_stub_test/stop_user_callback_stub_test.cpp +++ b/test/unittest/stop_user_callback_stub_test/stop_user_callback_stub_test.cpp @@ -27,11 +27,13 @@ public: MockStopUserCallbackStub() = default; virtual ~MockStopUserCallbackStub() {} - void OnStopUserDone(int userId, int errcode) override - {} - void OnStartUserDone(int userId, int errcode) override {} + ErrCode OnStopUserDone(int userId, int errcode) override + { + return ERR_OK; + } + ErrCode OnStartUserDone(int userId, int errcode) override { return ERR_OK; } - void OnLogoutUserDone(int userId, int errcode) override {} + ErrCode OnLogoutUserDone(int userId, int errcode) override { return ERR_OK; } }; class StopUserCallbackStubTest : public testing::Test { diff --git a/test/unittest/timeout_state_utils_test/BUILD.gn b/test/unittest/timeout_state_utils_test/BUILD.gn index 4b9f11b6477..1e9e6a196ff 100644 --- a/test/unittest/timeout_state_utils_test/BUILD.gn +++ b/test/unittest/timeout_state_utils_test/BUILD.gn @@ -19,7 +19,10 @@ module_output_path = "ability_runtime/ability_runtime/state_utils_test" ohos_unittest("timeout_state_utils_test") { module_out_path = module_output_path - configs = [ "${ability_runtime_services_path}/abilitymgr:abilityms_config" ] + configs = [ + "${ability_runtime_services_path}/abilitymgr:abilityms_config", + "${ability_runtime_path}/utils/server/startup:startup_util_config", + ] if (target_cpu == "arm") { cflags = [ "-DBINDER_IPC_32BIT" ] diff --git a/test/unittest/unlock_screen_test/BUILD.gn b/test/unittest/unlock_screen_test/BUILD.gn index 5032698033c..84a3f1dd9b0 100644 --- a/test/unittest/unlock_screen_test/BUILD.gn +++ b/test/unittest/unlock_screen_test/BUILD.gn @@ -38,6 +38,7 @@ ohos_unittest("unlock_screen_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", ] diff --git a/test/unittest/user_controller_test/BUILD.gn b/test/unittest/user_controller_test/BUILD.gn index 0fbe66cd0d1..945794b6c8a 100644 --- a/test/unittest/user_controller_test/BUILD.gn +++ b/test/unittest/user_controller_test/BUILD.gn @@ -18,6 +18,12 @@ module_output_path = "ability_runtime/ability_runtime/abilitymgr" ohos_unittest("user_controller_test") { module_out_path = module_output_path + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + blocklist = "../../cfi_blocklist.txt" + } sources = [ "user_controller_test.cpp" ] diff --git a/test/unittest/user_controller_test/user_controller_test.cpp b/test/unittest/user_controller_test/user_controller_test.cpp index 83088ea5f10..f2abcf77474 100644 --- a/test/unittest/user_controller_test/user_controller_test.cpp +++ b/test/unittest/user_controller_test/user_controller_test.cpp @@ -51,21 +51,22 @@ void UserControllerTest::TearDown() class TestUserCallback : public UserCallbackStub { public: - void OnStopUserDone(int userId, int errcode) override; - void OnStartUserDone(int userId, int errcode) override; - void OnLogoutUserDone(int userId, int errcode) override; + ErrCode OnStopUserDone(int userId, int errcode) override; + ErrCode OnStartUserDone(int userId, int errcode) override; + ErrCode OnLogoutUserDone(int userId, int errcode) override; int errCode_ = -1; }; -void TestUserCallback::OnStartUserDone(int userId, int errcode) +ErrCode TestUserCallback::OnStartUserDone(int userId, int errcode) { errCode_ = errcode; + return ERR_OK; } -void TestUserCallback::OnStopUserDone(int userId, int errcode) {} +ErrCode TestUserCallback::OnStopUserDone(int userId, int errcode) { return ERR_OK; } -void TestUserCallback::OnLogoutUserDone(int userId, int errcode) {} +ErrCode TestUserCallback::OnLogoutUserDone(int userId, int errcode) { return ERR_OK; } /** * @tc.name: UserItemSetState_0100 diff --git a/test/unittest/want_sender_info_test/BUILD.gn b/test/unittest/want_sender_info_test/BUILD.gn index 2ae36e4a825..d2dc36e2be3 100644 --- a/test/unittest/want_sender_info_test/BUILD.gn +++ b/test/unittest/want_sender_info_test/BUILD.gn @@ -18,7 +18,12 @@ module_output_path = "ability_runtime/ability_runtime/abilitymgr" ohos_unittest("want_sender_info_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" ] sources = [ diff --git a/tools/aa/BUILD.gn b/tools/aa/BUILD.gn index d6ec4e440c2..86f7594b22d 100644 --- a/tools/aa/BUILD.gn +++ b/tools/aa/BUILD.gn @@ -21,6 +21,7 @@ config("ability_command_config") { "${ability_runtime_services_path}/abilitymgr/include/utils", "${ability_runtime_services_path}/abilitymgr/include", ] + configs = [ "${ability_runtime_innerkits_path}/app_manager:appmgr_innerkits_config", ] } config("ability_command_exception_config") { @@ -45,6 +46,8 @@ ohos_static_library("tools_aa_source_set") { public_configs = [ ":ability_command_config", ":ability_command_exception_config", + "${ability_runtime_innerkits_path}/ability_manager:ability_manager_idl_config", + "${ability_runtime_innerkits_path}/app_manager:appmgr_innerkits_config", "${ability_runtime_services_path}/abilitymgr:abilityms_config", "${ability_runtime_services_path}/common:common_config", ] -- Gitee From 3217c72e7e97c8c4c1e9612ef99db06a0dd81ef8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=A5=E7=BB=B4?= Date: Mon, 9 Jun 2025 21:34:47 +0800 Subject: [PATCH 2/9] =?UTF-8?q?description:=E4=BF=AE=E5=A4=8Dtdd=20appdebu?= =?UTF-8?q?glistener=20fail?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 查维 --- .../app_debug_listener_stub_test.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/test/unittest/app_debug_listener_stub_test/app_debug_listener_stub_test.cpp b/test/unittest/app_debug_listener_stub_test/app_debug_listener_stub_test.cpp index f8942295d42..919aacfa959 100644 --- a/test/unittest/app_debug_listener_stub_test/app_debug_listener_stub_test.cpp +++ b/test/unittest/app_debug_listener_stub_test/app_debug_listener_stub_test.cpp @@ -22,9 +22,9 @@ using namespace testing::ext; namespace OHOS { namespace AppExecFwk { namespace { - constexpr int32_t DEBUG_INFO_SIZE_ONE = 1; - constexpr int32_t DEBUG_INFO_SIZE_ZERO = 0; - constexpr uint32_t UNKNOWN_CODE = 2; +constexpr int32_t DEBUG_INFO_SIZE_ONE = 1; +constexpr int32_t DEBUG_INFO_SIZE_ZERO = 0; +constexpr uint32_t UNKNOWN_CODE = -1; } class AppDebugListenerStubTest : public testing::Test { public: @@ -92,7 +92,7 @@ HWTEST_F(AppDebugListenerStubTest, OnRemoteRequest_0200, TestSize.Level1) auto result = mockStub_->OnRemoteRequest( static_cast(IAppDebugListenerIpcCode::COMMAND_ON_APP_DEBUG_STARTED), data, reply, option); - EXPECT_EQ(result, ERR_INVALID_STATE); + EXPECT_EQ(result, ERR_TRANSACTION_FAILED); // ERR_TRANSACTION_FAILED for no interfaceToken data } /** @@ -129,7 +129,7 @@ HWTEST_F(AppDebugListenerStubTest, OnRemoteRequest_0400, TestSize.Level1) auto result = mockStub_->OnRemoteRequest( static_cast(IAppDebugListenerIpcCode::COMMAND_ON_APP_DEBUG_STARTED), data, reply, option); - EXPECT_EQ(result, ERR_INVALID_DATA); + EXPECT_EQ(result, ERR_NONE); } /** @@ -147,7 +147,7 @@ HWTEST_F(AppDebugListenerStubTest, HandleOnAppDebugStarted_0100, TestSize.Level1 data.WriteInt32(DEBUG_INFO_SIZE_ONE); data.WriteParcelable(&debugInfo); - EXPECT_CALL(*mockStub_, OnAppDebugStarted(_)).Times(1); + EXPECT_CALL(*mockStub_, OnAppDebugStarted(_)).Times(0); mockStub_->OnRemoteRequest( static_cast(IAppDebugListenerIpcCode::COMMAND_ON_APP_DEBUG_STARTED), data, reply, option); } @@ -184,6 +184,7 @@ HWTEST_F(AppDebugListenerStubTest, HandleOnAppDebugStoped_0100, TestSize.Level1) MessageParcel data; MessageParcel reply; MessageOption option(MessageOption::TF_ASYNC); + WriteInterfaceToken(data); AppDebugInfo debugInfo; data.WriteInt32(DEBUG_INFO_SIZE_ONE); data.WriteParcelable(&debugInfo); -- Gitee From b27085d6292aed49535786490c68f30261d2b75c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=A5=E7=BB=B4?= Date: Tue, 10 Jun 2025 14:02:24 +0800 Subject: [PATCH 3/9] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 查维 --- frameworks/cj/ffi/want_agent/BUILD.gn | 5 +- frameworks/native/ability/native/BUILD.gn | 2 +- interfaces/inner_api/ability_manager/BUILD.gn | 64 ++++++++----------- interfaces/inner_api/app_manager/BUILD.gn | 10 +-- interfaces/inner_api/wantagent/BUILD.gn | 10 +-- services/abilitymgr/BUILD.gn | 2 +- .../BUILD.gn | 2 +- tools/aa/BUILD.gn | 2 - 8 files changed, 45 insertions(+), 52 deletions(-) diff --git a/frameworks/cj/ffi/want_agent/BUILD.gn b/frameworks/cj/ffi/want_agent/BUILD.gn index 7f9e9ea2ba6..5b673fbc53d 100644 --- a/frameworks/cj/ffi/want_agent/BUILD.gn +++ b/frameworks/cj/ffi/want_agent/BUILD.gn @@ -35,7 +35,10 @@ config("cj_want_agent_public_config") { "${ability_runtime_path}/interfaces/kits/native/appkit/ability_runtime", "${ability_runtime_path}/interfaces/kits/native/appkit/ability_runtime/context", ] - configs = [ "${ability_runtime_innerkits_path}/app_manager:appmgr_innerkits_config", ] + configs = [ + "${ability_runtime_innerkits_path}/ability_manager:ability_manager_innerkits_config", + "${ability_runtime_innerkits_path}/app_manager:appmgr_innerkits_config", + ] } ohos_shared_library("cj_want_agent_ffi") { diff --git a/frameworks/native/ability/native/BUILD.gn b/frameworks/native/ability/native/BUILD.gn index 0afa5d33b10..e056b24dd31 100644 --- a/frameworks/native/ability/native/BUILD.gn +++ b/frameworks/native/ability/native/BUILD.gn @@ -334,7 +334,7 @@ ohos_shared_library("abilitykit_native") { public_configs = [ ":ability_public_config", "${ability_runtime_native_path}/ability:ability_context_public_config", - "${ability_runtime_innerkits_path}/ability_manager:ability_manager_idl_config", + "${ability_runtime_innerkits_path}/ability_manager:ability_manager_innerkits_config", "${ability_runtime_innerkits_path}/wantagent:wantagent_innerkits_public_config", ] diff --git a/interfaces/inner_api/ability_manager/BUILD.gn b/interfaces/inner_api/ability_manager/BUILD.gn index c8061b802a6..0480803a9b5 100644 --- a/interfaces/inner_api/ability_manager/BUILD.gn +++ b/interfaces/inner_api/ability_manager/BUILD.gn @@ -15,24 +15,6 @@ import("//build/config/components/idl_tool/idl.gni") import("//build/ohos.gni") import("//foundation/ability/ability_runtime/ability_runtime.gni") -idl_gen_interface("ability_manager_interface") { - sources = [ - "idl/IUserCallback.idl", - ] - sources_callback = [ - ] - sources_common =[ - ] - log_domainid = "0xD001336" - log_tag = "AbilityMgr" - subsystem_name = "ability" - part_name = "ability_runtime" -} - -config("ability_manager_idl_config") { - include_dirs = [ "${target_gen_dir}" ] -} - config("ability_manager_public_config") { visibility = [ ":*" ] visibility += [ @@ -82,7 +64,25 @@ config("ability_manager_public_config") { } } -ohos_source_set("ability_manager_idl_proxy") { +idl_gen_interface("ability_manager_innerkits") { + sources = [ + "idl/IUserCallback.idl", + ] + sources_callback = [ + ] + sources_common =[ + ] + log_domainid = "0xD001336" + log_tag = "AbilityMgr" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +config("ability_manager_innerkits_config") { + include_dirs = [ "${target_gen_dir}" ] +} + +ohos_source_set("ability_manager_innerkits_include") { sanitize = { integer_overflow = true ubsan = true @@ -92,19 +92,13 @@ ohos_source_set("ability_manager_idl_proxy") { cfi_vcall_icall_only = true debug = false } - output_values = get_target_outputs(":ability_manager_interface") - source_values = [ - "*user_callback_proxy.cpp", - ] - sources = filter_include(output_values, source_values) public_configs = [ - ":ability_manager_idl_config", + ":ability_manager_innerkits_config", "${ability_runtime_services_path}/abilitymgr:abilityms_config", ] - deps = [ ":ability_manager_interface" ] - + deps = [ ":ability_manager_innerkits" ] external_deps = [ "c_utils:utils", "hilog:libhilog", @@ -116,7 +110,7 @@ ohos_source_set("ability_manager_idl_proxy") { part_name = "ability_runtime" } -ohos_source_set("ability_manager_idl_stub") { +ohos_source_set("ability_manager_innerkits_source") { sanitize = { integer_overflow = true ubsan = true @@ -126,18 +120,16 @@ ohos_source_set("ability_manager_idl_stub") { cfi_vcall_icall_only = true debug = false } - output_values = get_target_outputs(":ability_manager_interface") - source_values = [ - "*user_callback_stub.cpp", - ] + output_values = get_target_outputs(":ability_manager_innerkits") + source_values = [ "*.cpp", ] sources = filter_include(output_values, source_values) public_configs = [ - ":ability_manager_idl_config", + ":ability_manager_innerkits_config", "${ability_runtime_services_path}/abilitymgr:abilityms_config", ] - deps = [ ":ability_manager_interface" ] + deps = [ ":ability_manager_innerkits" ] external_deps = [ "c_utils:utils", @@ -234,8 +226,8 @@ ohos_shared_library("ability_manager") { public_deps = [ ":ability_connect_callback_stub" ] deps = [ - ":ability_manager_idl_stub", - ":ability_manager_idl_proxy", + ":ability_manager_innerkits_include", + ":ability_manager_innerkits_source", ":ability_start_options", ":ability_start_setting", ":mission_info", diff --git a/interfaces/inner_api/app_manager/BUILD.gn b/interfaces/inner_api/app_manager/BUILD.gn index 0b96bd17685..f67ee7e0655 100644 --- a/interfaces/inner_api/app_manager/BUILD.gn +++ b/interfaces/inner_api/app_manager/BUILD.gn @@ -70,13 +70,13 @@ ohos_source_set("appmgr_innerkits_include") { public_configs = [ ":appmgr_innerkits_config", - "${ability_runtime_innerkits_path}/ability_manager:ability_manager_idl_config", + "${ability_runtime_innerkits_path}/ability_manager:ability_manager_innerkits_config", "${ability_runtime_path}/utils/server/startup:startup_util_config", ] deps = [ ":appmgr_innerkits", - "${ability_runtime_innerkits_path}/ability_manager:ability_manager_interface", + "${ability_runtime_innerkits_path}/ability_manager:ability_manager_innerkits", "${ability_runtime_path}/utils/server/startup:startup_util", ] external_deps = [ @@ -109,7 +109,7 @@ ohos_source_set("appmgr_innerkits_source") { public_configs = [ ":appmgr_innerkits_config", - "${ability_runtime_innerkits_path}/ability_manager:ability_manager_idl_config", + "${ability_runtime_innerkits_path}/ability_manager:ability_manager_innerkits_config", "${ability_runtime_path}/utils/server/startup:startup_util_config", ] @@ -118,7 +118,7 @@ ohos_source_set("appmgr_innerkits_source") { deps = [ ":appmgr_innerkits", - "${ability_runtime_innerkits_path}/ability_manager:ability_manager_interface", + "${ability_runtime_innerkits_path}/ability_manager:ability_manager_innerkits", "${ability_runtime_path}/utils/server/startup:startup_util", ] external_deps = [ @@ -232,7 +232,7 @@ ohos_shared_library("app_manager") { ":appmgr_core_config", ":appmgr_sdk_config", ":appmgr_innerkits_config", - "${ability_runtime_innerkits_path}/ability_manager:ability_manager_idl_config", + "${ability_runtime_innerkits_path}/ability_manager:ability_manager_innerkits_config", "${ability_runtime_path}/utils/server/startup:startup_util_config", ] diff --git a/interfaces/inner_api/wantagent/BUILD.gn b/interfaces/inner_api/wantagent/BUILD.gn index d1c8957a99c..456240c020d 100644 --- a/interfaces/inner_api/wantagent/BUILD.gn +++ b/interfaces/inner_api/wantagent/BUILD.gn @@ -43,7 +43,10 @@ config("wantagent_innerkits_public_config") { "${ability_runtime_path}/interfaces/kits/native/appkit/ability_runtime", "${ability_runtime_path}/interfaces/kits/native/appkit/ability_runtime/context", ] - configs = [ "${ability_runtime_innerkits_path}/app_manager:appmgr_innerkits_config", ] + configs = [ + "${ability_runtime_innerkits_path}/ability_manager:ability_manager_innerkits_config", + "${ability_runtime_innerkits_path}/app_manager:appmgr_innerkits_config", + ] } ohos_shared_library("wantagent_innerkits") { @@ -65,10 +68,7 @@ ohos_shared_library("wantagent_innerkits") { "src/want_agent_info.cpp", ] - public_configs = [ - ":wantagent_innerkits_public_config", - "${ability_runtime_innerkits_path}/ability_manager:ability_manager_idl_config", - ] + public_configs = [ ":wantagent_innerkits_public_config" ] deps = [ "${ability_runtime_innerkits_path}/ability_manager:ability_start_options", diff --git a/services/abilitymgr/BUILD.gn b/services/abilitymgr/BUILD.gn index b0fd3beeac8..b54a80a3ddb 100644 --- a/services/abilitymgr/BUILD.gn +++ b/services/abilitymgr/BUILD.gn @@ -64,7 +64,7 @@ config("abilityms_config") { "${ability_runtime_path}/utils/global/time/include", "${ability_runtime_utils_path}/server/constant", ] - + configs = [ "${ability_runtime_innerkits_path}/ability_manager:ability_manager_innerkits_config" ] defines = [] if (ability_command_for_test) { diff --git a/test/unittest/frameworks_kits_appkit_native_test/BUILD.gn b/test/unittest/frameworks_kits_appkit_native_test/BUILD.gn index 84609a8cf12..0e87078bdf3 100644 --- a/test/unittest/frameworks_kits_appkit_native_test/BUILD.gn +++ b/test/unittest/frameworks_kits_appkit_native_test/BUILD.gn @@ -38,7 +38,7 @@ config("module_private_config") { config("module_context_config") { visibility = [ ":*" ] configs = [ - "${ability_runtime_innerkits_path}/ability_manager:ability_manager_idl_config", + "${ability_runtime_innerkits_path}/ability_manager:ability_manager_innerkits_config", "${ability_runtime_innerkits_path}/app_manager:appmgr_innerkits_config", ] include_dirs = [ diff --git a/tools/aa/BUILD.gn b/tools/aa/BUILD.gn index 86f7594b22d..52b9f65b2ea 100644 --- a/tools/aa/BUILD.gn +++ b/tools/aa/BUILD.gn @@ -46,8 +46,6 @@ ohos_static_library("tools_aa_source_set") { public_configs = [ ":ability_command_config", ":ability_command_exception_config", - "${ability_runtime_innerkits_path}/ability_manager:ability_manager_idl_config", - "${ability_runtime_innerkits_path}/app_manager:appmgr_innerkits_config", "${ability_runtime_services_path}/abilitymgr:abilityms_config", "${ability_runtime_services_path}/common:common_config", ] -- Gitee From da7f4491338b0c76d02fd8ba238b1b752fd30c64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=A5=E7=BB=B4?= Date: Tue, 10 Jun 2025 22:32:49 +0800 Subject: [PATCH 4/9] =?UTF-8?q?description:=E6=A3=80=E8=A7=86=E6=84=8F?= =?UTF-8?q?=E8=A7=81=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 查维 --- frameworks/cj/ffi/want_agent/BUILD.gn | 2 +- .../include/ability_manager_interface.h | 4 ++-- interfaces/inner_api/app_manager/BUILD.gn | 3 +-- .../app_manager/include/appmgr/ams_mgr_interface.h | 2 +- .../app_manager/include/appmgr/app_mgr_client.h | 4 ++-- .../app_manager/include/appmgr/app_mgr_interface.h | 2 +- .../app_manager/src/appmgr/ams_mgr_stub.cpp | 2 +- interfaces/inner_api/wantagent/BUILD.gn | 2 +- services/abilitymgr/BUILD.gn | 2 +- services/abilitymgr/include/ability_debug_deal.h | 4 ++-- .../abilitymgr/include/ability_manager_service.h | 2 +- services/abilitymgr/include/app_scheduler.h | 2 +- services/appmgr/include/ams_mgr_scheduler.h | 2 +- services/appmgr/include/app_mgr_service_inner.h | 2 +- test/fuzztest/abilitydebugdeal_fuzzer/BUILD.gn | 2 +- .../abilitydebugresponseproxy_fuzzer/BUILD.gn | 2 +- ...erfacesappmgrabilitydebugresponseproxy_fuzzer.cpp | 2 +- ...yinterfacesappmgrappdebuglistenerproxy_fuzzer.cpp | 2 +- ...tyinterfacesappmgrappdebuglistenerstub_fuzzer.cpp | 2 +- .../usercallbackstub_fuzzer.cpp | 2 +- test/moduletest/app_mgr_client_test/BUILD.gn | 2 +- .../ability_debug_response_stub_test.cpp | 2 +- .../mock_ability_debug_response_stub.h | 2 +- .../BUILD.gn | 2 +- .../ability_manager_client_branch_test/BUILD.gn | 2 +- .../BUILD.gn | 2 +- test/unittest/ability_manager_proxy_test/BUILD.gn | 2 +- test/unittest/ability_scheduler_stub_test/BUILD.gn | 2 +- .../ams_ability_running_record_test/BUILD.gn | 2 +- test/unittest/ams_mgr_scheduler_dump_test/BUILD.gn | 2 +- .../ams_service_load_ability_process_test/BUILD.gn | 2 +- test/unittest/app_debug_listener_proxy_test/BUILD.gn | 2 +- .../app_debug_listener_proxy_test.cpp | 2 +- .../app_debug_listener_stub_mock.h | 2 +- .../app_debug_listener_stub_test.cpp | 2 +- .../mock_app_debug_listener_stub.h | 2 +- test/unittest/app_mgr_client_test/BUILD.gn | 2 +- .../mock/include/mock_ability_debug_response_stub.h | 2 +- test/unittest/app_preloader_test/BUILD.gn | 2 +- .../app_service_extension_context_test/BUILD.gn | 2 +- .../app_state_observer_manager_test/BUILD.gn | 2 +- .../app_state_observer_manager_test_second/BUILD.gn | 2 +- test/unittest/call_record_test/BUILD.gn | 2 +- test/unittest/data_ability_manager_test/BUILD.gn | 2 +- test/unittest/dfr_test/watchdog_test/BUILD.gn | 2 +- test/unittest/mission_list_test/BUILD.gn | 2 +- test/unittest/pending_want_test/BUILD.gn | 2 +- .../quick_fix_manager_service_test/BUILD.gn | 2 +- .../unittest/service_extension_context_test/BUILD.gn | 2 +- test/unittest/stop_user_callback_proxy_test/BUILD.gn | 2 +- .../stop_user_callback_proxy_test.cpp | 2 +- .../stop_user_callback_stub_mock.h | 2 +- test/unittest/stop_user_callback_stub_test/BUILD.gn | 2 +- .../stop_user_callback_stub_test.cpp | 12 ++++++------ test/unittest/unlock_screen_test/BUILD.gn | 2 +- test/unittest/user_controller_test/BUILD.gn | 2 +- .../user_controller_test/user_controller_test.cpp | 2 +- test/unittest/want_sender_info_test/BUILD.gn | 2 +- tools/aa/BUILD.gn | 2 +- 59 files changed, 67 insertions(+), 68 deletions(-) diff --git a/frameworks/cj/ffi/want_agent/BUILD.gn b/frameworks/cj/ffi/want_agent/BUILD.gn index 5b673fbc53d..12d69329e06 100644 --- a/frameworks/cj/ffi/want_agent/BUILD.gn +++ b/frameworks/cj/ffi/want_agent/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2024 Huawei Device Co., Ltd. +# Copyright (c) 2024-2025 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/interfaces/inner_api/ability_manager/include/ability_manager_interface.h b/interfaces/inner_api/ability_manager/include/ability_manager_interface.h index 72fbd00fc4a..203bb19dc64 100644 --- a/interfaces/inner_api/ability_manager/include/ability_manager_interface.h +++ b/interfaces/inner_api/ability_manager/include/ability_manager_interface.h @@ -29,7 +29,6 @@ #include "ability_start_setting.h" #include "ability_state.h" #include "ability_state_data.h" -#include "iapp_debug_listener.h" #include "auto_startup_info.h" #include "dms_continueInfo.h" #include "exit_reason.h" @@ -38,9 +37,11 @@ #include "iability_controller.h" #include "iability_manager_collaborator.h" #include "iacquire_share_data_callback_interface.h" +#include "iapp_debug_listener.h" #include "insight_intent/insight_intent_execute_param.h" #include "insight_intent/insight_intent_execute_result.h" #include "insight_intent/insight_intent_info_for_query.h" +#include "iuser_callback.h" #include "iprepare_terminate_callback_interface.h" #include "keep_alive_info.h" #include "mission_info.h" @@ -51,7 +52,6 @@ #include "sa_interceptor_interface.h" #include "sender_info.h" #include "start_options.h" -#include "iuser_callback.h" #include "system_memory_attr.h" #include "ui_extension/ui_extension_ability_connect_info.h" #include "ui_extension/ui_extension_host_info.h" diff --git a/interfaces/inner_api/app_manager/BUILD.gn b/interfaces/inner_api/app_manager/BUILD.gn index f67ee7e0655..003157d3e04 100644 --- a/interfaces/inner_api/app_manager/BUILD.gn +++ b/interfaces/inner_api/app_manager/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2023 Huawei Device Co., Ltd. +# Copyright (c) 2021-2025 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -231,7 +231,6 @@ ohos_shared_library("app_manager") { public_configs = [ ":appmgr_core_config", ":appmgr_sdk_config", - ":appmgr_innerkits_config", "${ability_runtime_innerkits_path}/ability_manager:ability_manager_innerkits_config", "${ability_runtime_path}/utils/server/startup:startup_util_config", ] diff --git a/interfaces/inner_api/app_manager/include/appmgr/ams_mgr_interface.h b/interfaces/inner_api/app_manager/include/appmgr/ams_mgr_interface.h index 11a7d6d41af..2df1661f0b0 100644 --- a/interfaces/inner_api/app_manager/include/appmgr/ams_mgr_interface.h +++ b/interfaces/inner_api/app_manager/include/appmgr/ams_mgr_interface.h @@ -26,8 +26,8 @@ #include "iremote_broker.h" #include "iremote_object.h" #include "istart_specified_ability_response.h" -#include "running_process_info.h" #include "iuser_callback.h" +#include "running_process_info.h" namespace OHOS { namespace AbilityRuntime { diff --git a/interfaces/inner_api/app_manager/include/appmgr/app_mgr_client.h b/interfaces/inner_api/app_manager/include/appmgr/app_mgr_client.h index 38852cc47ee..5eec5d778fb 100644 --- a/interfaces/inner_api/app_manager/include/appmgr/app_mgr_client.h +++ b/interfaces/inner_api/app_manager/include/appmgr/app_mgr_client.h @@ -16,9 +16,7 @@ #ifndef OHOS_ABILITY_RUNTIME_APP_MGR_CLIENT_H #define OHOS_ABILITY_RUNTIME_APP_MGR_CLIENT_H -#include "iability_debug_response.h" #include "ability_info.h" -#include "iapp_debug_listener.h" #include "app_malloc_info.h" #include "app_mem_info.h" #include "app_mgr_constants.h" @@ -27,6 +25,8 @@ #include "application_info.h" #include "bundle_info.h" #include "fault_data.h" +#include "iability_debug_response.h" +#include "iapp_debug_listener.h" #include "iapplication_state_observer.h" #include "iapp_state_callback.h" #include "iconfiguration_observer.h" diff --git a/interfaces/inner_api/app_manager/include/appmgr/app_mgr_interface.h b/interfaces/inner_api/app_manager/include/appmgr/app_mgr_interface.h index e92f6bcac89..f0d1dbfabbf 100644 --- a/interfaces/inner_api/app_manager/include/appmgr/app_mgr_interface.h +++ b/interfaces/inner_api/app_manager/include/appmgr/app_mgr_interface.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2024 Huawei Device Co., Ltd. + * Copyright (c) 2021-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/interfaces/inner_api/app_manager/src/appmgr/ams_mgr_stub.cpp b/interfaces/inner_api/app_manager/src/appmgr/ams_mgr_stub.cpp index 25d21352b47..33684654877 100644 --- a/interfaces/inner_api/app_manager/src/appmgr/ams_mgr_stub.cpp +++ b/interfaces/inner_api/app_manager/src/appmgr/ams_mgr_stub.cpp @@ -16,12 +16,12 @@ #include "ams_mgr_stub.h" #include "ability_manager_errors.h" #include "ability_info.h" -#include "iapp_debug_listener.h" #include "app_mgr_proxy.h" #include "app_scheduler_interface.h" #include "appexecfwk_errors.h" #include "hilog_tag_wrapper.h" #include "hitrace_meter.h" +#include "iapp_debug_listener.h" #include "iapp_state_callback.h" #include "ipc_skeleton.h" #include "ipc_types.h" diff --git a/interfaces/inner_api/wantagent/BUILD.gn b/interfaces/inner_api/wantagent/BUILD.gn index 456240c020d..e3c00c77ef8 100644 --- a/interfaces/inner_api/wantagent/BUILD.gn +++ b/interfaces/inner_api/wantagent/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2024 Huawei Device Co., Ltd. +# Copyright (c) 2021-2025 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/services/abilitymgr/BUILD.gn b/services/abilitymgr/BUILD.gn index b54a80a3ddb..94b1a2ade4e 100644 --- a/services/abilitymgr/BUILD.gn +++ b/services/abilitymgr/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2024 Huawei Device Co., Ltd. +# Copyright (c) 2021-2025 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/services/abilitymgr/include/ability_debug_deal.h b/services/abilitymgr/include/ability_debug_deal.h index 53f04555e7d..64dc7d60637 100644 --- a/services/abilitymgr/include/ability_debug_deal.h +++ b/services/abilitymgr/include/ability_debug_deal.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023-2024 Huawei Device Co., Ltd. + * Copyright (c) 2023-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -16,8 +16,8 @@ #ifndef OHOS_ABILITY_RUNTIME_ABILITY_DEBUG_DEAL_H #define OHOS_ABILITY_RUNTIME_ABILITY_DEBUG_DEAL_H -#include "iability_debug_response.h" #include "ability_debug_response_stub.h" +#include "iability_debug_response.h" namespace OHOS { namespace AAFwk { diff --git a/services/abilitymgr/include/ability_manager_service.h b/services/abilitymgr/include/ability_manager_service.h index 57e09a8535f..e945eff8b43 100644 --- a/services/abilitymgr/include/ability_manager_service.h +++ b/services/abilitymgr/include/ability_manager_service.h @@ -37,7 +37,6 @@ #include "ability_keep_alive_service.h" #include "ability_start_with_wait_observer_utils.h" #include "ams_configuration_parameter.h" -#include "iapp_debug_listener.h" #include "app_exit_reason_helper.h" #include "app_mgr_interface.h" #include "app_scheduler.h" @@ -52,6 +51,7 @@ #include "event_report.h" #include "free_install_manager.h" #include "iacquire_share_data_callback_interface.h" +#include "iapp_debug_listener.h" #include "interceptor/ability_interceptor_executer.h" #include "iremote_object.h" #include "mission_list_manager_interface.h" diff --git a/services/abilitymgr/include/app_scheduler.h b/services/abilitymgr/include/app_scheduler.h index 9c0fc64fdc3..e1eb97bf0de 100644 --- a/services/abilitymgr/include/app_scheduler.h +++ b/services/abilitymgr/include/app_scheduler.h @@ -26,13 +26,13 @@ #include "application_info.h" #include "appmgr/app_mgr_client.h" #include "appmgr/app_state_callback_host.h" -#include "start_specified_ability_response_stub.h" #include "bundle_info.h" #include "fault_data.h" #include "iremote_object.h" #include "refbase.h" #include "running_process_info.h" #include "singleton.h" +#include "start_specified_ability_response_stub.h" #include "system_memory_attr.h" #include "want.h" diff --git a/services/appmgr/include/ams_mgr_scheduler.h b/services/appmgr/include/ams_mgr_scheduler.h index a2ae1a72f0b..28f6b3e78ff 100644 --- a/services/appmgr/include/ams_mgr_scheduler.h +++ b/services/appmgr/include/ams_mgr_scheduler.h @@ -19,7 +19,6 @@ #include "ability_info.h" #include "ability_running_record.h" #include "ams_mgr_stub.h" -#include "iapp_debug_listener.h" #include "app_mgr_constants.h" #include "app_mgr_service_inner.h" #include "app_record_id.h" @@ -27,6 +26,7 @@ #include "app_scheduler_proxy.h" #include "appexecfwk_errors.h" #include "application_info.h" +#include "iapp_debug_listener.h" #include "if_system_ability_manager.h" #include "nocopyable.h" #include "system_ability.h" diff --git a/services/appmgr/include/app_mgr_service_inner.h b/services/appmgr/include/app_mgr_service_inner.h index fa27cf1a6f7..4f4588802e2 100644 --- a/services/appmgr/include/app_mgr_service_inner.h +++ b/services/appmgr/include/app_mgr_service_inner.h @@ -24,7 +24,6 @@ #include #include -#include "iability_debug_response.h" #include "ability_foreground_state_observer_interface.h" #include "ability_info.h" #include "advanced_security_mode_manager.h" @@ -58,6 +57,7 @@ #include "fault_data.h" #include "fd_guard.h" #include "hisysevent.h" +#include "iability_debug_response.h" #include "iapp_state_callback.h" #include "iapplication_state_observer.h" #include "iconfiguration_observer.h" diff --git a/test/fuzztest/abilitydebugdeal_fuzzer/BUILD.gn b/test/fuzztest/abilitydebugdeal_fuzzer/BUILD.gn index a620c1cc4e3..8ddfb770b05 100644 --- a/test/fuzztest/abilitydebugdeal_fuzzer/BUILD.gn +++ b/test/fuzztest/abilitydebugdeal_fuzzer/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2023 Huawei Device Co., Ltd. +# Copyright (c) 2022-2025 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/test/fuzztest/abilitydebugresponseproxy_fuzzer/BUILD.gn b/test/fuzztest/abilitydebugresponseproxy_fuzzer/BUILD.gn index 5a84060ab11..363a825f1b5 100755 --- a/test/fuzztest/abilitydebugresponseproxy_fuzzer/BUILD.gn +++ b/test/fuzztest/abilitydebugresponseproxy_fuzzer/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2024 Huawei Device Co., Ltd. +# Copyright (c) 2024-2025 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/test/fuzztest/abilityinterfacesappmgrabilitydebugresponseproxy_fuzzer/abilityinterfacesappmgrabilitydebugresponseproxy_fuzzer.cpp b/test/fuzztest/abilityinterfacesappmgrabilitydebugresponseproxy_fuzzer/abilityinterfacesappmgrabilitydebugresponseproxy_fuzzer.cpp index 34c22d5fc05..25969b4b201 100644 --- a/test/fuzztest/abilityinterfacesappmgrabilitydebugresponseproxy_fuzzer/abilityinterfacesappmgrabilitydebugresponseproxy_fuzzer.cpp +++ b/test/fuzztest/abilityinterfacesappmgrabilitydebugresponseproxy_fuzzer/abilityinterfacesappmgrabilitydebugresponseproxy_fuzzer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2024-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/test/fuzztest/abilityinterfacesappmgrappdebuglistenerproxy_fuzzer/abilityinterfacesappmgrappdebuglistenerproxy_fuzzer.cpp b/test/fuzztest/abilityinterfacesappmgrappdebuglistenerproxy_fuzzer/abilityinterfacesappmgrappdebuglistenerproxy_fuzzer.cpp index a9d69ca2549..cf99b6d40af 100644 --- a/test/fuzztest/abilityinterfacesappmgrappdebuglistenerproxy_fuzzer/abilityinterfacesappmgrappdebuglistenerproxy_fuzzer.cpp +++ b/test/fuzztest/abilityinterfacesappmgrappdebuglistenerproxy_fuzzer/abilityinterfacesappmgrappdebuglistenerproxy_fuzzer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2024-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/test/fuzztest/abilityinterfacesappmgrappdebuglistenerstub_fuzzer/abilityinterfacesappmgrappdebuglistenerstub_fuzzer.cpp b/test/fuzztest/abilityinterfacesappmgrappdebuglistenerstub_fuzzer/abilityinterfacesappmgrappdebuglistenerstub_fuzzer.cpp index 7b60eaa63f8..79118353ee2 100644 --- a/test/fuzztest/abilityinterfacesappmgrappdebuglistenerstub_fuzzer/abilityinterfacesappmgrappdebuglistenerstub_fuzzer.cpp +++ b/test/fuzztest/abilityinterfacesappmgrappdebuglistenerstub_fuzzer/abilityinterfacesappmgrappdebuglistenerstub_fuzzer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2024-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/test/fuzztest/usercallbackstub_fuzzer/usercallbackstub_fuzzer.cpp b/test/fuzztest/usercallbackstub_fuzzer/usercallbackstub_fuzzer.cpp index affdd4884f4..59a75929c1e 100644 --- a/test/fuzztest/usercallbackstub_fuzzer/usercallbackstub_fuzzer.cpp +++ b/test/fuzztest/usercallbackstub_fuzzer/usercallbackstub_fuzzer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2024-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/test/moduletest/app_mgr_client_test/BUILD.gn b/test/moduletest/app_mgr_client_test/BUILD.gn index a05d6c24a70..409c2699258 100644 --- a/test/moduletest/app_mgr_client_test/BUILD.gn +++ b/test/moduletest/app_mgr_client_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2024 Huawei Device Co., Ltd. +# Copyright (c) 2022-2025 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/test/unittest/ability_debug_response_stub_test/ability_debug_response_stub_test.cpp b/test/unittest/ability_debug_response_stub_test/ability_debug_response_stub_test.cpp index fe5d6e1e3a7..ad8f8f90b74 100644 --- a/test/unittest/ability_debug_response_stub_test/ability_debug_response_stub_test.cpp +++ b/test/unittest/ability_debug_response_stub_test/ability_debug_response_stub_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2023-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/test/unittest/ability_debug_response_stub_test/mock_ability_debug_response_stub.h b/test/unittest/ability_debug_response_stub_test/mock_ability_debug_response_stub.h index caa01322dd8..79f47778999 100644 --- a/test/unittest/ability_debug_response_stub_test/mock_ability_debug_response_stub.h +++ b/test/unittest/ability_debug_response_stub_test/mock_ability_debug_response_stub.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023-2024 Huawei Device Co., Ltd. + * Copyright (c) 2023-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at 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 89a81bac741..100862c1c25 100644 --- a/test/unittest/ability_manager_client_branch_second_test/BUILD.gn +++ b/test/unittest/ability_manager_client_branch_second_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2024 Huawei Device Co., Ltd. +# Copyright (c) 2021-2025 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/test/unittest/ability_manager_client_branch_test/BUILD.gn b/test/unittest/ability_manager_client_branch_test/BUILD.gn index 837d4e5d287..74881e2c3b9 100644 --- a/test/unittest/ability_manager_client_branch_test/BUILD.gn +++ b/test/unittest/ability_manager_client_branch_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2024 Huawei Device Co., Ltd. +# Copyright (c) 2021-2025 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at 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 9863597d244..6fcb973b301 100644 --- a/test/unittest/ability_manager_client_branch_third_test/BUILD.gn +++ b/test/unittest/ability_manager_client_branch_third_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2024 Huawei Device Co., Ltd. +# Copyright (c) 2021-2025 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/test/unittest/ability_manager_proxy_test/BUILD.gn b/test/unittest/ability_manager_proxy_test/BUILD.gn index e4261ca6b4e..232da0cd55a 100644 --- a/test/unittest/ability_manager_proxy_test/BUILD.gn +++ b/test/unittest/ability_manager_proxy_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2024 Huawei Device Co., Ltd. +# Copyright (c) 2021-2025 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/test/unittest/ability_scheduler_stub_test/BUILD.gn b/test/unittest/ability_scheduler_stub_test/BUILD.gn index 429d1f6f444..6538b2d48dc 100644 --- a/test/unittest/ability_scheduler_stub_test/BUILD.gn +++ b/test/unittest/ability_scheduler_stub_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2024 Huawei Device Co., Ltd. +# Copyright (c) 2021-2025 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/test/unittest/ams_ability_running_record_test/BUILD.gn b/test/unittest/ams_ability_running_record_test/BUILD.gn index b6beb42fe21..ca8ea03f12c 100644 --- a/test/unittest/ams_ability_running_record_test/BUILD.gn +++ b/test/unittest/ams_ability_running_record_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2024 Huawei Device Co., Ltd. +# Copyright (c) 2021-2025 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/test/unittest/ams_mgr_scheduler_dump_test/BUILD.gn b/test/unittest/ams_mgr_scheduler_dump_test/BUILD.gn index ee17c6bc88a..91055070844 100644 --- a/test/unittest/ams_mgr_scheduler_dump_test/BUILD.gn +++ b/test/unittest/ams_mgr_scheduler_dump_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2024 Huawei Device Co., Ltd. +# Copyright (c) 2021-2025 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/test/unittest/ams_service_load_ability_process_test/BUILD.gn b/test/unittest/ams_service_load_ability_process_test/BUILD.gn index a206e7c8154..3c3939cae59 100644 --- a/test/unittest/ams_service_load_ability_process_test/BUILD.gn +++ b/test/unittest/ams_service_load_ability_process_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2024 Huawei Device Co., Ltd. +# Copyright (c) 2021-2025 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/test/unittest/app_debug_listener_proxy_test/BUILD.gn b/test/unittest/app_debug_listener_proxy_test/BUILD.gn index 4fb5f653846..1b24dfb7799 100644 --- a/test/unittest/app_debug_listener_proxy_test/BUILD.gn +++ b/test/unittest/app_debug_listener_proxy_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2023-2024 Huawei Device Co., Ltd. +# Copyright (c) 2023-2025 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/test/unittest/app_debug_listener_proxy_test/app_debug_listener_proxy_test.cpp b/test/unittest/app_debug_listener_proxy_test/app_debug_listener_proxy_test.cpp index 242dcdef445..7bcc341e9b7 100644 --- a/test/unittest/app_debug_listener_proxy_test/app_debug_listener_proxy_test.cpp +++ b/test/unittest/app_debug_listener_proxy_test/app_debug_listener_proxy_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2023-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/test/unittest/app_debug_listener_proxy_test/app_debug_listener_stub_mock.h b/test/unittest/app_debug_listener_proxy_test/app_debug_listener_stub_mock.h index f2e6ac5eedd..f96411fe7ae 100644 --- a/test/unittest/app_debug_listener_proxy_test/app_debug_listener_stub_mock.h +++ b/test/unittest/app_debug_listener_proxy_test/app_debug_listener_stub_mock.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2023-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/test/unittest/app_debug_listener_stub_test/app_debug_listener_stub_test.cpp b/test/unittest/app_debug_listener_stub_test/app_debug_listener_stub_test.cpp index 919aacfa959..0101270c410 100644 --- a/test/unittest/app_debug_listener_stub_test/app_debug_listener_stub_test.cpp +++ b/test/unittest/app_debug_listener_stub_test/app_debug_listener_stub_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2023-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/test/unittest/app_debug_listener_stub_test/mock_app_debug_listener_stub.h b/test/unittest/app_debug_listener_stub_test/mock_app_debug_listener_stub.h index 436837abf2d..010015b826c 100644 --- a/test/unittest/app_debug_listener_stub_test/mock_app_debug_listener_stub.h +++ b/test/unittest/app_debug_listener_stub_test/mock_app_debug_listener_stub.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2023-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/test/unittest/app_mgr_client_test/BUILD.gn b/test/unittest/app_mgr_client_test/BUILD.gn index 841e02899d2..dce07e6590e 100644 --- a/test/unittest/app_mgr_client_test/BUILD.gn +++ b/test/unittest/app_mgr_client_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2024 Huawei Device Co., Ltd. +# Copyright (c) 2022-2025 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/test/unittest/app_mgr_service_inner_second_test/mock/include/mock_ability_debug_response_stub.h b/test/unittest/app_mgr_service_inner_second_test/mock/include/mock_ability_debug_response_stub.h index 482178787c9..1c2349bb873 100644 --- a/test/unittest/app_mgr_service_inner_second_test/mock/include/mock_ability_debug_response_stub.h +++ b/test/unittest/app_mgr_service_inner_second_test/mock/include/mock_ability_debug_response_stub.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2024-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/test/unittest/app_preloader_test/BUILD.gn b/test/unittest/app_preloader_test/BUILD.gn index 5621e4646a7..d7ef4044942 100755 --- a/test/unittest/app_preloader_test/BUILD.gn +++ b/test/unittest/app_preloader_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2024 Huawei Device Co., Ltd. +# Copyright (c) 2024-2025 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/test/unittest/app_service_extension_context_test/BUILD.gn b/test/unittest/app_service_extension_context_test/BUILD.gn index cdd7169e193..8affea4ae64 100644 --- a/test/unittest/app_service_extension_context_test/BUILD.gn +++ b/test/unittest/app_service_extension_context_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2024 Huawei Device Co., Ltd. +# Copyright (c) 2022-2025 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/test/unittest/app_state_observer_manager_test/BUILD.gn b/test/unittest/app_state_observer_manager_test/BUILD.gn index 39dea9ed1a6..7213a5762d0 100755 --- a/test/unittest/app_state_observer_manager_test/BUILD.gn +++ b/test/unittest/app_state_observer_manager_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2024 Huawei Device Co., Ltd. +# Copyright (c) 2021-2025 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/test/unittest/app_state_observer_manager_test_second/BUILD.gn b/test/unittest/app_state_observer_manager_test_second/BUILD.gn index ade8f768119..fd054835268 100755 --- a/test/unittest/app_state_observer_manager_test_second/BUILD.gn +++ b/test/unittest/app_state_observer_manager_test_second/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2024 Huawei Device Co., Ltd. +# Copyright (c) 2021-2025 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/test/unittest/call_record_test/BUILD.gn b/test/unittest/call_record_test/BUILD.gn index e4daaef3a3f..e0a4790d7ca 100644 --- a/test/unittest/call_record_test/BUILD.gn +++ b/test/unittest/call_record_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2023-2024 Huawei Device Co., Ltd. +# Copyright (c) 2023-2025 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/test/unittest/data_ability_manager_test/BUILD.gn b/test/unittest/data_ability_manager_test/BUILD.gn index f2937e420c5..2d1908956a8 100644 --- a/test/unittest/data_ability_manager_test/BUILD.gn +++ b/test/unittest/data_ability_manager_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2024 Huawei Device Co., Ltd. +# Copyright (c) 2021-2025 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/test/unittest/dfr_test/watchdog_test/BUILD.gn b/test/unittest/dfr_test/watchdog_test/BUILD.gn index 101dfcdd974..1b119fb9764 100644 --- a/test/unittest/dfr_test/watchdog_test/BUILD.gn +++ b/test/unittest/dfr_test/watchdog_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2023-2024 Huawei Device Co., Ltd. +# Copyright (c) 2023-2025 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/test/unittest/mission_list_test/BUILD.gn b/test/unittest/mission_list_test/BUILD.gn index 0bb8ffad82a..65a64913010 100644 --- a/test/unittest/mission_list_test/BUILD.gn +++ b/test/unittest/mission_list_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2024 Huawei Device Co., Ltd. +# Copyright (c) 2021-2025 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/test/unittest/pending_want_test/BUILD.gn b/test/unittest/pending_want_test/BUILD.gn index 2484d92cfff..db803aab578 100644 --- a/test/unittest/pending_want_test/BUILD.gn +++ b/test/unittest/pending_want_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2024 Huawei Device Co., Ltd. +# Copyright (c) 2021-2025 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at 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 f8d3d42a711..f9bf19ec8ee 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 @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2024 Huawei Device Co., Ltd. +# Copyright (c) 2022-2025 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/test/unittest/service_extension_context_test/BUILD.gn b/test/unittest/service_extension_context_test/BUILD.gn index 19ddf2b1f00..23dbc979e4d 100644 --- a/test/unittest/service_extension_context_test/BUILD.gn +++ b/test/unittest/service_extension_context_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2024 Huawei Device Co., Ltd. +# Copyright (c) 2022-2025 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/test/unittest/stop_user_callback_proxy_test/BUILD.gn b/test/unittest/stop_user_callback_proxy_test/BUILD.gn index 3196f493de2..20c03e2ac26 100755 --- a/test/unittest/stop_user_callback_proxy_test/BUILD.gn +++ b/test/unittest/stop_user_callback_proxy_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2024 Huawei Device Co., Ltd. +# Copyright (c) 2022-2025 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/test/unittest/stop_user_callback_proxy_test/stop_user_callback_proxy_test.cpp b/test/unittest/stop_user_callback_proxy_test/stop_user_callback_proxy_test.cpp index 6ac8b3fcddd..2318c78e8f5 100755 --- a/test/unittest/stop_user_callback_proxy_test/stop_user_callback_proxy_test.cpp +++ b/test/unittest/stop_user_callback_proxy_test/stop_user_callback_proxy_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/test/unittest/stop_user_callback_proxy_test/stop_user_callback_stub_mock.h b/test/unittest/stop_user_callback_proxy_test/stop_user_callback_stub_mock.h index d212a591345..4c7456b7757 100755 --- a/test/unittest/stop_user_callback_proxy_test/stop_user_callback_stub_mock.h +++ b/test/unittest/stop_user_callback_proxy_test/stop_user_callback_stub_mock.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/test/unittest/stop_user_callback_stub_test/BUILD.gn b/test/unittest/stop_user_callback_stub_test/BUILD.gn index 45eeb3c27e8..dab1f292a8f 100644 --- a/test/unittest/stop_user_callback_stub_test/BUILD.gn +++ b/test/unittest/stop_user_callback_stub_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2024 Huawei Device Co., Ltd. +# Copyright (c) 2021-2025 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/test/unittest/stop_user_callback_stub_test/stop_user_callback_stub_test.cpp b/test/unittest/stop_user_callback_stub_test/stop_user_callback_stub_test.cpp index bc333ec6168..c7a64817d19 100644 --- a/test/unittest/stop_user_callback_stub_test/stop_user_callback_stub_test.cpp +++ b/test/unittest/stop_user_callback_stub_test/stop_user_callback_stub_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -70,7 +70,7 @@ HWTEST_F(StopUserCallbackStubTest, StopUserCallbackStubTest_001, TestSize.Level1 data.WriteString16(value); auto result = backStub->OnRemoteRequest(code, data, reply, option); - EXPECT_EQ(result, ERR_INVALID_STATE); + EXPECT_EQ(result, ERR_TRANSACTION_FAILED); GTEST_LOG_(INFO) << "StopUserCallbackStubTest_001 end"; } @@ -87,11 +87,11 @@ HWTEST_F(StopUserCallbackStubTest, StopUserCallbackStubTest_002, TestSize.Level1 MessageParcel data; MessageParcel reply; MessageOption option; - std::u16string metaDescriptor_ = u"ohos.aafwk.UserCallback"; + std::u16string metaDescriptor_ = u"OHOS.AAFwk.IUserCallback"; data.WriteInterfaceToken(metaDescriptor_); auto result = backStub->OnRemoteRequest(code, data, reply, option); - EXPECT_EQ(result, IPC_STUB_UNKNOW_TRANS_ERR); + EXPECT_EQ(result, ERR_NONE); GTEST_LOG_(INFO) << "StopUserCallbackStubTest_002 end"; } @@ -108,10 +108,10 @@ HWTEST_F(StopUserCallbackStubTest, StopUserCallbackStubTest_003, TestSize.Level1 MessageParcel data; MessageParcel reply; MessageOption option; - std::u16string metaDescriptor_ = u"ohos.aafwk.UserCallback"; + std::u16string metaDescriptor_ = u"OHOS.AAFwk.IUserCallback"; data.WriteInterfaceToken(metaDescriptor_); auto result = backStub->OnRemoteRequest(code, data, reply, option); - EXPECT_EQ(result, ERR_NONE); + EXPECT_EQ(result, IPC_STUB_UNKNOW_TRANS_ERR); GTEST_LOG_(INFO) << "StopUserCallbackStubTest_003 end"; } diff --git a/test/unittest/unlock_screen_test/BUILD.gn b/test/unittest/unlock_screen_test/BUILD.gn index 84a3f1dd9b0..7e6f119e246 100644 --- a/test/unittest/unlock_screen_test/BUILD.gn +++ b/test/unittest/unlock_screen_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2024 Huawei Device Co., Ltd. +# Copyright (c) 2024-2025 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/test/unittest/user_controller_test/BUILD.gn b/test/unittest/user_controller_test/BUILD.gn index 945794b6c8a..120a32b4bfa 100644 --- a/test/unittest/user_controller_test/BUILD.gn +++ b/test/unittest/user_controller_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2024 Huawei Device Co., Ltd. +# Copyright (c) 2022-2025 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/test/unittest/user_controller_test/user_controller_test.cpp b/test/unittest/user_controller_test/user_controller_test.cpp index f2abcf77474..9b4710642f8 100644 --- a/test/unittest/user_controller_test/user_controller_test.cpp +++ b/test/unittest/user_controller_test/user_controller_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/test/unittest/want_sender_info_test/BUILD.gn b/test/unittest/want_sender_info_test/BUILD.gn index d2dc36e2be3..fed944b2617 100644 --- a/test/unittest/want_sender_info_test/BUILD.gn +++ b/test/unittest/want_sender_info_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2024 Huawei Device Co., Ltd. +# Copyright (c) 2021-2025 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/tools/aa/BUILD.gn b/tools/aa/BUILD.gn index 52b9f65b2ea..f04905ae222 100644 --- a/tools/aa/BUILD.gn +++ b/tools/aa/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2024 Huawei Device Co., Ltd. +# Copyright (c) 2021-2025 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -- Gitee From 29f619a4d234b20756b60c3a75e9a60f9c05a333 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=A5=E7=BB=B4?= Date: Tue, 10 Jun 2025 16:10:31 +0000 Subject: [PATCH 5/9] update interfaces/inner_api/app_manager/BUILD.gn. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 查维 --- interfaces/inner_api/app_manager/BUILD.gn | 1 + 1 file changed, 1 insertion(+) diff --git a/interfaces/inner_api/app_manager/BUILD.gn b/interfaces/inner_api/app_manager/BUILD.gn index 003157d3e04..59318b86d69 100644 --- a/interfaces/inner_api/app_manager/BUILD.gn +++ b/interfaces/inner_api/app_manager/BUILD.gn @@ -230,6 +230,7 @@ ohos_shared_library("app_manager") { public_configs = [ ":appmgr_core_config", + ":appmgr_innerkits_config", ":appmgr_sdk_config", "${ability_runtime_innerkits_path}/ability_manager:ability_manager_innerkits_config", "${ability_runtime_path}/utils/server/startup:startup_util_config", -- Gitee From a26a5bd924aaf4aaccb54cc426b68da3a180cfbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=A5=E7=BB=B4?= Date: Wed, 11 Jun 2025 09:42:02 +0000 Subject: [PATCH 6/9] update services/abilitymgr/src/ability_debug_deal.cpp. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 查维 --- services/abilitymgr/src/ability_debug_deal.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/abilitymgr/src/ability_debug_deal.cpp b/services/abilitymgr/src/ability_debug_deal.cpp index 6a41c648b3a..7065cb9492e 100644 --- a/services/abilitymgr/src/ability_debug_deal.cpp +++ b/services/abilitymgr/src/ability_debug_deal.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023-2024 Huawei Device Co., Ltd. + * Copyright (c) 2023-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at -- Gitee From 4bb9020e1684e6a9bbd2d947295b92618a984a87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=A5=E7=BB=B4?= Date: Wed, 11 Jun 2025 09:42:56 +0000 Subject: [PATCH 7/9] update services/appmgr/include/app_debug_manager.h. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 查维 --- services/appmgr/include/app_debug_manager.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/appmgr/include/app_debug_manager.h b/services/appmgr/include/app_debug_manager.h index d5203399e10..aae9db220db 100644 --- a/services/appmgr/include/app_debug_manager.h +++ b/services/appmgr/include/app_debug_manager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2023-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at -- Gitee From 7c533e3699c23dfa747daa24a8d0e23bab88dc61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=A5=E7=BB=B4?= Date: Wed, 11 Jun 2025 09:47:12 +0000 Subject: [PATCH 8/9] update services/appmgr/include/app_running_manager.h. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 查维 --- services/appmgr/include/app_running_manager.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/appmgr/include/app_running_manager.h b/services/appmgr/include/app_running_manager.h index 5fe6b246d30..061d13f2cd6 100644 --- a/services/appmgr/include/app_running_manager.h +++ b/services/appmgr/include/app_running_manager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2024 Huawei Device Co., Ltd. + * Copyright (c) 2021-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at -- Gitee From a5a4c7de38624c05c137e274894418b06dad4277 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=A5=E7=BB=B4?= Date: Wed, 11 Jun 2025 09:58:12 +0000 Subject: [PATCH 9/9] appForegrouedStateObserver Signed-off-by: 18795846185 Change-Id: Ia68fc7b8a52450d0d4873e546abf36e32a3500db --- .../js_app_foreground_state_observer.cpp | 7 +- .../js_app_foreground_state_observer.h | 4 +- interfaces/inner_api/app_manager/BUILD.gn | 4 +- .../IAppForegroundStateObserver.idl} | 57 ++++++--------- ...app_foreground_state_observer_recipient.h} | 26 ++----- .../include/appmgr/app_mgr_interface.h | 2 +- .../app_foreground_state_observer_proxy.cpp | 61 ---------------- ...p_foreground_state_observer_recipient.cpp} | 31 ++++---- .../app_foreground_state_observer_stub.cpp | 70 ------------------- .../appmgr/include/app_mgr_service_inner.h | 2 +- .../include/app_state_observer_manager.h | 4 +- .../appmgr/src/app_state_observer_manager.cpp | 3 +- .../abilitydebugresponseproxy_fuzzer.cpp | 2 +- ...rappforegroundstateobserverstub_fuzzer.cpp | 12 ++-- .../BUILD.gn | 1 - .../abilitymgr.gni | 1 - .../mock/include/mock_iapp_mgr.h | 2 +- .../BUILD.gn | 3 +- ...p_foreground_state_observer_proxy_test.cpp | 11 --- .../mock_app_foreground_state_observer_stub.h | 4 +- .../BUILD.gn | 7 +- ...pp_foreground_state_observer_stub_test.cpp | 21 +----- .../mock_app_foreground_state_observer_stub.h | 4 +- .../app_mgr_proxy_test/app_mgr_proxy_test.cpp | 8 ++- .../app_mgr_service_inner_fifth_test/BUILD.gn | 7 +- .../BUILD.gn | 5 +- .../app_mgr_service_inner_ninth_test.cpp | 35 +++++----- .../app_mgr_service_inner_tenth_test.cpp | 39 ++++++----- .../app_mgr_stub_test/app_mgr_stub_test.cpp | 6 +- .../app_state_observer_manager_test.cpp | 8 ++- ...app_state_observer_manager_test_second.cpp | 8 ++- .../mock_iapp_mgr.h | 2 +- 32 files changed, 142 insertions(+), 315 deletions(-) rename interfaces/inner_api/app_manager/{include/appmgr/app_foreground_state_observer_proxy.h => idl/IAppForegroundStateObserver.idl} (39%) rename interfaces/inner_api/app_manager/include/appmgr/{app_foreground_state_observer_stub.h => app_foreground_state_observer_recipient.h} (58%) delete mode 100644 interfaces/inner_api/app_manager/src/appmgr/app_foreground_state_observer_proxy.cpp rename interfaces/inner_api/app_manager/{include/appmgr/app_foreground_state_observer_interface.h => src/appmgr/app_foreground_state_observer_recipient.cpp} (49%) delete mode 100644 interfaces/inner_api/app_manager/src/appmgr/app_foreground_state_observer_stub.cpp diff --git a/frameworks/js/napi/app/js_app_manager/js_app_foreground_state_observer.cpp b/frameworks/js/napi/app/js_app_manager/js_app_foreground_state_observer.cpp index 05eaf832a71..c5bf91189bc 100644 --- a/frameworks/js/napi/app/js_app_manager/js_app_foreground_state_observer.cpp +++ b/frameworks/js/napi/app/js_app_manager/js_app_foreground_state_observer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023-2024 Huawei Device Co., Ltd. + * Copyright (c) 2023-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -25,12 +25,12 @@ constexpr size_t ARGC_ONE = 1; } JSAppForegroundStateObserver::JSAppForegroundStateObserver(napi_env env) : env_(env) {} -void JSAppForegroundStateObserver::OnAppStateChanged(const AppStateData &appStateData) +ErrCode JSAppForegroundStateObserver::OnAppStateChanged(const AppStateData &appStateData) { TAG_LOGD(AAFwkTag::APPMGR, "called"); if (!valid_) { TAG_LOGE(AAFwkTag::APPMGR, "invalid appMgr"); - return; + return ERR_INVALID_VALUE; } wptr self = this; std::unique_ptr complete = std::make_unique( @@ -45,6 +45,7 @@ void JSAppForegroundStateObserver::OnAppStateChanged(const AppStateData &appStat napi_ref callback = nullptr; NapiAsyncTask::Schedule("JSAppForegroundStateObserver::OnAppStateChanged", env_, std::make_unique(callback, nullptr, std::move(complete))); + return ERR_OK; } void JSAppForegroundStateObserver::HandleOnAppStateChanged(const AppStateData &appStateData) diff --git a/frameworks/js/napi/app/js_app_manager/js_app_foreground_state_observer.h b/frameworks/js/napi/app/js_app_manager/js_app_foreground_state_observer.h index 4e6ea011573..4063f12b5c2 100644 --- a/frameworks/js/napi/app/js_app_manager/js_app_foreground_state_observer.h +++ b/frameworks/js/napi/app/js_app_manager/js_app_foreground_state_observer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2023-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -31,7 +31,7 @@ class JSAppForegroundStateObserver : public AppForegroundStateObserverStub { public: explicit JSAppForegroundStateObserver(napi_env engine); virtual ~JSAppForegroundStateObserver() = default; - void OnAppStateChanged(const AppStateData &appStateData); + ErrCode OnAppStateChanged(const AppStateData &appStateData); void HandleOnAppStateChanged(const AppStateData &appStateData); void CallJsFunction(const napi_value value, const char *methodName, const napi_value *argv, const size_t argc); void AddJsObserverObject(const napi_value &jsObserverObject); diff --git a/interfaces/inner_api/app_manager/BUILD.gn b/interfaces/inner_api/app_manager/BUILD.gn index 59318b86d69..787a706e385 100644 --- a/interfaces/inner_api/app_manager/BUILD.gn +++ b/interfaces/inner_api/app_manager/BUILD.gn @@ -45,6 +45,7 @@ idl_gen_interface("appmgr_innerkits") { sources = [ "idl/IAbilityDebugResponse.idl", "idl/IAppDebugListener.idl", + "idl/IAppForegroundStateObserver.idl", "idl/IStartSpecifiedAbilityResponse.idl", ] log_domainid = "0xD001311" @@ -173,8 +174,7 @@ ohos_shared_library("app_manager") { "src/appmgr/ams_mgr_proxy.cpp", "src/appmgr/ams_mgr_stub.cpp", "src/appmgr/app_debug_info.cpp", - "src/appmgr/app_foreground_state_observer_proxy.cpp", - "src/appmgr/app_foreground_state_observer_stub.cpp", + "src/appmgr/app_foreground_state_observer_recipient.cpp", "src/appmgr/app_jsheap_mem_info.cpp", "src/appmgr/app_cjheap_mem_info.cpp", "src/appmgr/app_launch_data.cpp", diff --git a/interfaces/inner_api/app_manager/include/appmgr/app_foreground_state_observer_proxy.h b/interfaces/inner_api/app_manager/idl/IAppForegroundStateObserver.idl similarity index 39% rename from interfaces/inner_api/app_manager/include/appmgr/app_foreground_state_observer_proxy.h rename to interfaces/inner_api/app_manager/idl/IAppForegroundStateObserver.idl index b7d564bcc98..2fd543880a4 100644 --- a/interfaces/inner_api/app_manager/include/appmgr/app_foreground_state_observer_proxy.h +++ b/interfaces/inner_api/app_manager/idl/IAppForegroundStateObserver.idl @@ -1,37 +1,20 @@ -/* - * Copyright (c) 2023 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. - */ - -#ifndef OHOS_ABILITY_RUNTIME_APP_FOREGROUND_STATE_OBSERVER_PROXY_H -#define OHOS_ABILITY_RUNTIME_APP_FOREGROUND_STATE_OBSERVER_PROXY_H - -#include "app_foreground_state_observer_interface.h" -#include "iremote_proxy.h" - -namespace OHOS { -namespace AppExecFwk { -class AppForegroundStateObserverProxy : public IRemoteProxy { -public: - explicit AppForegroundStateObserverProxy(const sptr &impl); - virtual ~AppForegroundStateObserverProxy() = default; - - void OnAppStateChanged(const AppStateData &appStateData) override; - -private: - bool WriteInterfaceToken(MessageParcel &data); - static inline BrokerDelegator delegator_; -}; -} // namespace AppExecFwk -} // namespace OHOS -#endif // OHOS_ABILITY_RUNTIME_APP_FOREGROUND_STATE_OBSERVER_PROXY_H \ No newline at end of file +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +sequenceable OHOS.AppExecFwk.AppStateData; + +interface OHOS.AppExecFwk.IAppForegroundStateObserver{ + [oneway]void OnAppStateChanged([in] AppStateData appStateData); +} \ No newline at end of file diff --git a/interfaces/inner_api/app_manager/include/appmgr/app_foreground_state_observer_stub.h b/interfaces/inner_api/app_manager/include/appmgr/app_foreground_state_observer_recipient.h similarity index 58% rename from interfaces/inner_api/app_manager/include/appmgr/app_foreground_state_observer_stub.h rename to interfaces/inner_api/app_manager/include/appmgr/app_foreground_state_observer_recipient.h index cbde5f949c8..24344aa85cd 100644 --- a/interfaces/inner_api/app_manager/include/appmgr/app_foreground_state_observer_stub.h +++ b/interfaces/inner_api/app_manager/include/appmgr/app_foreground_state_observer_recipient.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -13,29 +13,13 @@ * limitations under the License. */ -#ifndef OHOS_ABILITY_RUNTIME_APP_FOREGROUND_STATE_OBSERVER_STUB_H -#define OHOS_ABILITY_RUNTIME_APP_FOREGROUND_STATE_OBSERVER_STUB_H +#ifndef OHOS_ABILITY_RUNTIME_APP_FOREGROUND_STATE_OBSERVER_RECIPIENT_H +#define OHOS_ABILITY_RUNTIME_APP_FOREGROUND_STATE_OBSERVER_RECIPIENT_H -#include - -#include "app_foreground_state_observer_interface.h" -#include "iremote_stub.h" -#include "nocopyable.h" -#include "string_ex.h" +#include "iapp_foreground_state_observer.h" namespace OHOS { namespace AppExecFwk { -class AppForegroundStateObserverStub : public IRemoteStub { -public: - AppForegroundStateObserverStub(); - virtual ~AppForegroundStateObserverStub(); - int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; - -private: - int32_t HandleOnAppStateChanged(MessageParcel &data, MessageParcel &reply); - - DISALLOW_COPY_AND_MOVE(AppForegroundStateObserverStub); -}; /** * @class AppForegroundStateObserverRecipient @@ -53,4 +37,4 @@ private: }; } // namespace AppExecFwk } // namespace OHOS -#endif // OHOS_ABILITY_RUNTIME_APP_FOREGROUND_STATE_OBSERVER_STUB_H +#endif // OHOS_ABILITY_RUNTIME_APP_FOREGROUND_STATE_OBSERVER_RECIPIENT_H \ No newline at end of file diff --git a/interfaces/inner_api/app_manager/include/appmgr/app_mgr_interface.h b/interfaces/inner_api/app_manager/include/appmgr/app_mgr_interface.h index f0d1dbfabbf..bc16777c0cb 100644 --- a/interfaces/inner_api/app_manager/include/appmgr/app_mgr_interface.h +++ b/interfaces/inner_api/app_manager/include/appmgr/app_mgr_interface.h @@ -19,7 +19,6 @@ #include "ability_foreground_state_observer_interface.h" #include "ability_info.h" #include "ams_mgr_interface.h" -#include "app_foreground_state_observer_interface.h" #include "app_malloc_info.h" #include "app_mgr_ipc_interface_code.h" #include "app_record_id.h" @@ -33,6 +32,7 @@ #endif // SUPPORT_CHILD_PROCESS #include "fault_data.h" #include "kia_interceptor_interface.h" +#include "iapp_foreground_state_observer.h" #include "iapp_state_callback.h" #include "iapplication_state_observer.h" #include "iconfiguration_observer.h" diff --git a/interfaces/inner_api/app_manager/src/appmgr/app_foreground_state_observer_proxy.cpp b/interfaces/inner_api/app_manager/src/appmgr/app_foreground_state_observer_proxy.cpp deleted file mode 100644 index 59d8eada735..00000000000 --- a/interfaces/inner_api/app_manager/src/appmgr/app_foreground_state_observer_proxy.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2023-2024 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "app_foreground_state_observer_proxy.h" - -#include "hilog_tag_wrapper.h" -#include "ipc_types.h" - -namespace OHOS { -namespace AppExecFwk { -AppForegroundStateObserverProxy::AppForegroundStateObserverProxy(const sptr &impl) - : IRemoteProxy(impl) -{} - -bool AppForegroundStateObserverProxy::WriteInterfaceToken(MessageParcel &data) -{ - if (!data.WriteInterfaceToken(AppForegroundStateObserverProxy::GetDescriptor())) { - TAG_LOGE(AAFwkTag::APPMGR, "Write interface token failed."); - return false; - } - return true; -} - -void AppForegroundStateObserverProxy::OnAppStateChanged(const AppStateData &appStateData) -{ - MessageParcel data; - if (!WriteInterfaceToken(data)) { - TAG_LOGE(AAFwkTag::APPMGR, "Write Token failed."); - return; - } - if (!data.WriteParcelable(&appStateData)) { - TAG_LOGE(AAFwkTag::APPMGR, "Fail to write appStateData."); - return; - } - sptr remote = Remote(); - if (remote == nullptr) { - TAG_LOGE(AAFwkTag::APPMGR, "Remote is NULL."); - return; - } - MessageParcel reply; - MessageOption option(MessageOption::TF_ASYNC); - int32_t ret = remote->SendRequest( - static_cast(IAppForegroundStateObserver::Message::ON_APP_STATE_CHANGED), data, reply, option); - if (ret != NO_ERROR) { - TAG_LOGE(AAFwkTag::APPMGR, "SendRequest is failed, error code: %{public}d.", ret); - } -} -} // namespace AppExecFwk -} // namespace OHOS diff --git a/interfaces/inner_api/app_manager/include/appmgr/app_foreground_state_observer_interface.h b/interfaces/inner_api/app_manager/src/appmgr/app_foreground_state_observer_recipient.cpp similarity index 49% rename from interfaces/inner_api/app_manager/include/appmgr/app_foreground_state_observer_interface.h rename to interfaces/inner_api/app_manager/src/appmgr/app_foreground_state_observer_recipient.cpp index f65b8edb92d..35866522d37 100644 --- a/interfaces/inner_api/app_manager/include/appmgr/app_foreground_state_observer_interface.h +++ b/interfaces/inner_api/app_manager/src/appmgr/app_foreground_state_observer_recipient.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -13,25 +13,20 @@ * limitations under the License. */ -#ifndef OHOS_ABILITY_RUNTIME_APP_FOREGROUND_STATE_OBSERVER_INTERFACE_H -#define OHOS_ABILITY_RUNTIME_APP_FOREGROUND_STATE_OBSERVER_INTERFACE_H - -#include "app_state_data.h" -#include "iremote_broker.h" -#include "iremote_object.h" +#include "app_foreground_state_observer_recipient.h" +#include "hilog_tag_wrapper.h" namespace OHOS { namespace AppExecFwk { -class IAppForegroundStateObserver : public IRemoteBroker { -public: - DECLARE_INTERFACE_DESCRIPTOR(u"ohos.appexecfwk.IAppForegroundStateObserver"); - - virtual void OnAppStateChanged(const AppStateData &appStateData) = 0; +AppForegroundStateObserverRecipient::AppForegroundStateObserverRecipient(RemoteDiedHandler handler) : handler_(handler) +{} - enum class Message { - ON_APP_STATE_CHANGED, - }; -}; +void AppForegroundStateObserverRecipient::OnRemoteDied(const wptr &__attribute__((unused)) remote) +{ + TAG_LOGE(AAFwkTag::APPMGR, "Remote died."); + if (handler_) { + handler_(remote); + } +} } // namespace AppExecFwk -} // namespace OHOS -#endif // OHOS_ABILITY_RUNTIME_APP_FOREGROUND_STATE_OBSERVER_INTERFACE_H +} // namespace OHOS \ No newline at end of file diff --git a/interfaces/inner_api/app_manager/src/appmgr/app_foreground_state_observer_stub.cpp b/interfaces/inner_api/app_manager/src/appmgr/app_foreground_state_observer_stub.cpp deleted file mode 100644 index b35443bb790..00000000000 --- a/interfaces/inner_api/app_manager/src/appmgr/app_foreground_state_observer_stub.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2023-2024 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "app_foreground_state_observer_stub.h" - -#include "appexecfwk_errors.h" -#include "hilog_tag_wrapper.h" -#include "ipc_types.h" -#include "iremote_object.h" - -namespace OHOS { -namespace AppExecFwk { -AppForegroundStateObserverStub::AppForegroundStateObserverStub() {} - -AppForegroundStateObserverStub::~AppForegroundStateObserverStub() {} - -int32_t AppForegroundStateObserverStub::OnRemoteRequest( - uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) -{ - TAG_LOGD(AAFwkTag::APPMGR, "called"); - std::u16string descriptor = AppForegroundStateObserverStub::GetDescriptor(); - std::u16string remoteDescriptor = data.ReadInterfaceToken(); - if (descriptor != remoteDescriptor) { - TAG_LOGE(AAFwkTag::APPMGR, "Local descriptor is not equal to remote."); - return ERR_INVALID_STATE; - } - - if (code == static_cast(IAppForegroundStateObserver::Message::ON_APP_STATE_CHANGED)) { - return HandleOnAppStateChanged(data, reply); - } - - return IPCObjectStub::OnRemoteRequest(code, data, reply, option); -} - -int32_t AppForegroundStateObserverStub::HandleOnAppStateChanged(MessageParcel &data, MessageParcel &reply) -{ - std::unique_ptr processData(data.ReadParcelable()); - if (processData == nullptr) { - TAG_LOGE(AAFwkTag::APPMGR, "ProcessData is null."); - return ERR_APPEXECFWK_PARCEL_ERROR; - } - - OnAppStateChanged(*processData); - return NO_ERROR; -} - -AppForegroundStateObserverRecipient::AppForegroundStateObserverRecipient(RemoteDiedHandler handler) : handler_(handler) -{} - -void AppForegroundStateObserverRecipient::OnRemoteDied(const wptr &__attribute__((unused)) remote) -{ - TAG_LOGE(AAFwkTag::APPMGR, "Remote died."); - if (handler_) { - handler_(remote); - } -} -} // namespace AppExecFwk -} // namespace OHOS \ No newline at end of file diff --git a/services/appmgr/include/app_mgr_service_inner.h b/services/appmgr/include/app_mgr_service_inner.h index 4f4588802e2..599b7b3014d 100644 --- a/services/appmgr/include/app_mgr_service_inner.h +++ b/services/appmgr/include/app_mgr_service_inner.h @@ -30,7 +30,6 @@ #include "app_death_recipient.h" #include "iapp_debug_listener.h" #include "app_debug_manager.h" -#include "app_foreground_state_observer_interface.h" #include "app_malloc_info.h" #include "app_mgr_constants.h" #include "app_mgr_event.h" @@ -57,6 +56,7 @@ #include "fault_data.h" #include "fd_guard.h" #include "hisysevent.h" +#include "iapp_foreground_state_observer.h" #include "iability_debug_response.h" #include "iapp_state_callback.h" #include "iapplication_state_observer.h" diff --git a/services/appmgr/include/app_state_observer_manager.h b/services/appmgr/include/app_state_observer_manager.h index 89588f3376e..edc48346f62 100644 --- a/services/appmgr/include/app_state_observer_manager.h +++ b/services/appmgr/include/app_state_observer_manager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -22,10 +22,10 @@ #include #include "ability_foreground_state_observer_interface.h" -#include "app_foreground_state_observer_interface.h" #include "app_running_record.h" #include "app_state_data.h" #include "cpp/mutex.h" +#include "iapp_foreground_state_observer.h" #include "iapp_state_callback.h" #include "iapplication_state_observer.h" #include "page_state_data.h" diff --git a/services/appmgr/src/app_state_observer_manager.cpp b/services/appmgr/src/app_state_observer_manager.cpp index c5443491634..7685fe83f8d 100644 --- a/services/appmgr/src/app_state_observer_manager.cpp +++ b/services/appmgr/src/app_state_observer_manager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2024 Huawei Device Co., Ltd. + * Copyright (c) 2022-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -16,6 +16,7 @@ #include "app_state_observer_manager.h" #include "ability_foreground_state_observer_stub.h" +#include "app_foreground_state_observer_recipient.h" #include "app_foreground_state_observer_stub.h" #include "application_state_observer_stub.h" #include "hilog_tag_wrapper.h" diff --git a/test/fuzztest/abilitydebugresponseproxy_fuzzer/abilitydebugresponseproxy_fuzzer.cpp b/test/fuzztest/abilitydebugresponseproxy_fuzzer/abilitydebugresponseproxy_fuzzer.cpp index a81ad49bebd..04bd6c2cf48 100755 --- a/test/fuzztest/abilitydebugresponseproxy_fuzzer/abilitydebugresponseproxy_fuzzer.cpp +++ b/test/fuzztest/abilitydebugresponseproxy_fuzzer/abilitydebugresponseproxy_fuzzer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2024-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/test/fuzztest/abilityinterfacesappmgrappforegroundstateobserverstub_fuzzer/abilityinterfacesappmgrappforegroundstateobserverstub_fuzzer.cpp b/test/fuzztest/abilityinterfacesappmgrappforegroundstateobserverstub_fuzzer/abilityinterfacesappmgrappforegroundstateobserverstub_fuzzer.cpp index 049e3e8cc63..44214417b04 100644 --- a/test/fuzztest/abilityinterfacesappmgrappforegroundstateobserverstub_fuzzer/abilityinterfacesappmgrappforegroundstateobserverstub_fuzzer.cpp +++ b/test/fuzztest/abilityinterfacesappmgrappforegroundstateobserverstub_fuzzer/abilityinterfacesappmgrappforegroundstateobserverstub_fuzzer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2024-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -19,8 +19,9 @@ #include #define private public +#include "app_foreground_state_observer_recipient.h" #include "app_foreground_state_observer_stub.h" -#include "app_foreground_state_observer_interface.h" +#include "iapp_foreground_state_observer.h" #undef private #include "securec.h" @@ -56,7 +57,10 @@ public: virtual ~ AppForegroundStateObserverStubFUZZ() {}; int OnRemoteRequest( uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override{ return 0; }; - void OnAppStateChanged(const AppStateData &appStateData) override{}; + ErrCode OnAppStateChanged(const AppStateData &appStateData) override + { + return ERR_OK; + }; }; sptr GetFuzzAbilityToken() @@ -75,7 +79,7 @@ sptr GetFuzzAbilityToken() bool DoSomethingInterestingWithMyAPI(const char* data, size_t size) { - uint32_t code = static_cast(IAppForegroundStateObserver::Message::ON_APP_STATE_CHANGED); + uint32_t code = static_cast(IAppForegroundStateObserverIpcCode::COMMAND_ON_APP_STATE_CHANGED); MessageParcel parcel; parcel.WriteInterfaceToken(IA_APP_FOREGROUND_STATE_OBSERVER_TOKEN); parcel.WriteBuffer(data, size); diff --git a/test/unittest/ability_manager_service_second_test/BUILD.gn b/test/unittest/ability_manager_service_second_test/BUILD.gn index 8a6bb998d0c..0bcdf3e900a 100644 --- a/test/unittest/ability_manager_service_second_test/BUILD.gn +++ b/test/unittest/ability_manager_service_second_test/BUILD.gn @@ -181,7 +181,6 @@ ohos_unittest("ability_manager_service_second_test") { "${ability_runtime_services_path}/abilitymgr/src/ui_extension/preload_uiext_state_observer.cpp", "${ability_runtime_services_path}/abilitymgr/src/ui_extension_record/ui_extension_record.cpp", "${ability_runtime_services_path}/abilitymgr/src/ui_extension_record/ui_extension_record_factory.cpp", - "${ability_runtime_services_path}/abilitymgr/src/user_callback_proxy.cpp", "${ability_runtime_services_path}/abilitymgr/src/user_controller.cpp", "${ability_runtime_services_path}/abilitymgr/src/user_event_handler.cpp", "${ability_runtime_services_path}/abilitymgr/src/utils/ability_event_util.cpp", diff --git a/test/unittest/ability_manager_service_third_test/abilitymgr.gni b/test/unittest/ability_manager_service_third_test/abilitymgr.gni index 571d2a93527..af9117bf388 100644 --- a/test/unittest/ability_manager_service_third_test/abilitymgr.gni +++ b/test/unittest/ability_manager_service_third_test/abilitymgr.gni @@ -79,7 +79,6 @@ abilityms_files = [ "${ability_runtime_services_path}/abilitymgr/src/ui_extension_record/ui_extension_record_factory.cpp", "${ability_runtime_services_path}/abilitymgr/src/screen_lock/unlock_screen_manager.cpp", "${ability_runtime_services_path}/abilitymgr/src/start_options.cpp", - "${ability_runtime_services_path}/abilitymgr/src/user_callback_proxy.cpp", "${ability_runtime_services_path}/abilitymgr/src/call_container.cpp", "${ability_runtime_services_path}/abilitymgr/src/call_record.cpp", "${ability_runtime_services_path}/abilitymgr/src/inner_mission_info.cpp", diff --git a/test/unittest/app_exit_reason_helper_fourth_test/mock/include/mock_iapp_mgr.h b/test/unittest/app_exit_reason_helper_fourth_test/mock/include/mock_iapp_mgr.h index 027540709f7..ac3a16f21fb 100644 --- a/test/unittest/app_exit_reason_helper_fourth_test/mock/include/mock_iapp_mgr.h +++ b/test/unittest/app_exit_reason_helper_fourth_test/mock/include/mock_iapp_mgr.h @@ -17,7 +17,6 @@ #include "ability_foreground_state_observer_interface.h" #include "ability_info.h" -#include "app_foreground_state_observer_interface.h" #include "app_malloc_info.h" #include "app_mgr_ipc_interface_code.h" #include "app_record_id.h" @@ -31,6 +30,7 @@ #include "app_cjheap_mem_info.h" #include "app_mgr_interface.h" #include "fault_data.h" +#include "iapp_foreground_state_observer.h" #include "iapp_state_callback.h" #include "iapplication_state_observer.h" #include "iconfiguration_observer.h" diff --git a/test/unittest/app_foreground_state_observer_proxy_test/BUILD.gn b/test/unittest/app_foreground_state_observer_proxy_test/BUILD.gn index e9c0e14555b..f33c454ea66 100644 --- a/test/unittest/app_foreground_state_observer_proxy_test/BUILD.gn +++ b/test/unittest/app_foreground_state_observer_proxy_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2023-2024 Huawei Device Co., Ltd. +# Copyright (c) 2023-2025 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -26,7 +26,6 @@ ohos_unittest("app_foreground_state_observer_proxy_test") { ] sources = [ - "${ability_runtime_innerkits_path}/app_manager/src/appmgr/app_foreground_state_observer_proxy.cpp", "app_foreground_state_observer_proxy_test.cpp", ] diff --git a/test/unittest/app_foreground_state_observer_proxy_test/app_foreground_state_observer_proxy_test.cpp b/test/unittest/app_foreground_state_observer_proxy_test/app_foreground_state_observer_proxy_test.cpp index d7130616d3e..abec790c3f5 100644 --- a/test/unittest/app_foreground_state_observer_proxy_test/app_foreground_state_observer_proxy_test.cpp +++ b/test/unittest/app_foreground_state_observer_proxy_test/app_foreground_state_observer_proxy_test.cpp @@ -49,17 +49,6 @@ void AppForegroundStateObserverProxyTest::SetUp() void AppForegroundStateObserverProxyTest::TearDown() {} -/** - * @tc.name: WriteInterfaceToken_0100 - * @tc.desc: Write token into parcel data. - * @tc.type: FUNC - */ -HWTEST_F(AppForegroundStateObserverProxyTest, WriteInterfaceToken_0100, TestSize.Level1) -{ - MessageParcel data; - EXPECT_TRUE(observerProxy_->WriteInterfaceToken(data)); -} - /** * @tc.name: OnAppStateChanged_0100 * @tc.desc: Test when the return of WriteInterfaceToken and diff --git a/test/unittest/app_foreground_state_observer_proxy_test/mock_app_foreground_state_observer_stub.h b/test/unittest/app_foreground_state_observer_proxy_test/mock_app_foreground_state_observer_stub.h index 6a6891932f4..3c280ec5298 100644 --- a/test/unittest/app_foreground_state_observer_proxy_test/mock_app_foreground_state_observer_stub.h +++ b/test/unittest/app_foreground_state_observer_proxy_test/mock_app_foreground_state_observer_stub.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2023-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -27,7 +27,7 @@ public: MockAppForegroundStateObserverStub() = default; virtual ~MockAppForegroundStateObserverStub() = default; - MOCK_METHOD1(OnAppStateChanged, void(const AppStateData &appStateData)); + MOCK_METHOD1(OnAppStateChanged, ErrCode(const AppStateData &appStateData)); }; } // namespace AppExecFwk } // namespace OHOS diff --git a/test/unittest/app_foreground_state_observer_stub_test/BUILD.gn b/test/unittest/app_foreground_state_observer_stub_test/BUILD.gn index f946137d66d..d4c026264ab 100644 --- a/test/unittest/app_foreground_state_observer_stub_test/BUILD.gn +++ b/test/unittest/app_foreground_state_observer_stub_test/BUILD.gn @@ -25,11 +25,10 @@ ohos_unittest("app_foreground_state_observer_stub_test") { "${ability_runtime_test_path}/unittest/app_foreground_state_observer_proxy_test/", ] - sources = [ - "${ability_runtime_innerkits_path}/app_manager/src/appmgr/app_foreground_state_observer_stub.cpp", - "app_foreground_state_observer_stub_test.cpp", - ] + sources = [ "app_foreground_state_observer_stub_test.cpp" ] + configs = [ "${ability_runtime_innerkits_path}/app_manager:appmgr_innerkits_config" ] + deps = [ "${ability_runtime_innerkits_path}/app_manager:app_manager" ] external_deps = [ diff --git a/test/unittest/app_foreground_state_observer_stub_test/app_foreground_state_observer_stub_test.cpp b/test/unittest/app_foreground_state_observer_stub_test/app_foreground_state_observer_stub_test.cpp index 6643fe276bd..dc2bbe07f3e 100644 --- a/test/unittest/app_foreground_state_observer_stub_test/app_foreground_state_observer_stub_test.cpp +++ b/test/unittest/app_foreground_state_observer_stub_test/app_foreground_state_observer_stub_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2023-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -51,25 +51,6 @@ void AppForegroundStateObserverStubTest::SetUp() void AppForegroundStateObserverStubTest::TearDown() {} -/** - * @tc.number: HandleOnAppStateChanged_0100 - * @tc.desc: Test when processData is not nullptr. - * @tc.type: FUNC - */ -HWTEST_F(AppForegroundStateObserverStubTest, HandleOnAppStateChanged_0100, TestSize.Level1) -{ - auto stub = new (std::nothrow) MockAppForegroundStateObserverStub(); - EXPECT_TRUE(stub); - EXPECT_CALL(*stub, OnAppStateChanged(_)).Times(1); - MessageParcel data; - AppStateData appStateData; - data.WriteParcelable(&appStateData); - MessageParcel reply; - auto result = stub->HandleOnAppStateChanged(data, reply); - EXPECT_EQ(NO_ERROR, result); - testing::Mock::AllowLeak(stub); -} - /** * @tc.number: OnRemoteRequest_0100 * @tc.desc: Test when descriptor and remoteDescriptor is different and diff --git a/test/unittest/app_foreground_state_observer_stub_test/mock_app_foreground_state_observer_stub.h b/test/unittest/app_foreground_state_observer_stub_test/mock_app_foreground_state_observer_stub.h index d61a16d9713..ee71ee7fe56 100644 --- a/test/unittest/app_foreground_state_observer_stub_test/mock_app_foreground_state_observer_stub.h +++ b/test/unittest/app_foreground_state_observer_stub_test/mock_app_foreground_state_observer_stub.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2023-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -30,7 +30,7 @@ public: MockAppForegroundStateObserverStub() = default; virtual ~MockAppForegroundStateObserverStub() = default; - MOCK_METHOD1(OnAppStateChanged, void(const AppStateData &appStateData)); + MOCK_METHOD1(OnAppStateChanged, ErrCode(const AppStateData &appStateData)); }; } // namespace AppExecFwk } // namespace OHOS diff --git a/test/unittest/app_mgr_proxy_test/app_mgr_proxy_test.cpp b/test/unittest/app_mgr_proxy_test/app_mgr_proxy_test.cpp index dcc5295348f..ee87429eb59 100644 --- a/test/unittest/app_mgr_proxy_test/app_mgr_proxy_test.cpp +++ b/test/unittest/app_mgr_proxy_test/app_mgr_proxy_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2024 Huawei Device Co., Ltd. + * Copyright (c) 2022-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -39,8 +39,10 @@ public: AppForegroundStateObserverMock() = default; virtual ~AppForegroundStateObserverMock() = default; - void OnAppStateChanged(const AppStateData &appStateData) override - {} + ErrCode OnAppStateChanged(const AppStateData &appStateData) override + { + return ERR_OK; + } }; class RenderStateObserverMock : public RenderStateObserverStub { diff --git a/test/unittest/app_mgr_service_inner_fifth_test/BUILD.gn b/test/unittest/app_mgr_service_inner_fifth_test/BUILD.gn index 3b3d01c193e..51446b8b2bb 100644 --- a/test/unittest/app_mgr_service_inner_fifth_test/BUILD.gn +++ b/test/unittest/app_mgr_service_inner_fifth_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2024 Huawei Device Co., Ltd. +# Copyright (c) 2022-2025 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -45,7 +45,10 @@ ohos_unittest("AppMgrServiceInnerFifthTest") { "app_mgr_service_inner_fifth_test.cpp", ] - configs = [ "${ability_runtime_services_path}/appmgr:appmgr_config" ] + configs = [ + "${ability_runtime_innerkits_path}/app_manager:appmgr_innerkits_config", + "${ability_runtime_services_path}/appmgr:appmgr_config", + ] deps = [ "${ability_runtime_path}/utils/server/startup:startup_util", diff --git a/test/unittest/app_mgr_service_inner_fourth_test/BUILD.gn b/test/unittest/app_mgr_service_inner_fourth_test/BUILD.gn index ba15d4f4952..503ea10f94d 100644 --- a/test/unittest/app_mgr_service_inner_fourth_test/BUILD.gn +++ b/test/unittest/app_mgr_service_inner_fourth_test/BUILD.gn @@ -44,7 +44,10 @@ ohos_unittest("AppMgrServiceInnerFourthTest") { "mock/src/mock_permission_verification.cpp", ] - configs = [ "${ability_runtime_services_path}/appmgr:appmgr_config" ] + configs = [ + "${ability_runtime_innerkits_path}/app_manager:appmgr_innerkits_config", + "${ability_runtime_services_path}/appmgr:appmgr_config", + ] cflags = [ "-Dprivate=public", diff --git a/test/unittest/app_mgr_service_inner_ninth_test/app_mgr_service_inner_ninth_test.cpp b/test/unittest/app_mgr_service_inner_ninth_test/app_mgr_service_inner_ninth_test.cpp index ebbdfb05c52..002b575b4f4 100644 --- a/test/unittest/app_mgr_service_inner_ninth_test/app_mgr_service_inner_ninth_test.cpp +++ b/test/unittest/app_mgr_service_inner_ninth_test/app_mgr_service_inner_ninth_test.cpp @@ -67,14 +67,21 @@ public: class MyAbilityDebugResponse : public IAbilityDebugResponse { public: - void OnAbilitysDebugStarted(const std::vector> &tokens) override - {} + ErrCode OnAbilitysDebugStarted(const std::vector> &tokens) override + { + return ERR_OK; + } - void OnAbilitysDebugStoped(const std::vector> &tokens) override - {} + ErrCode OnAbilitysDebugStoped(const std::vector> &tokens) override + { + return ERR_OK; + } - void OnAbilitysAssertDebugChange(const std::vector> &tokens, - bool isAssertDebug) override {} + ErrCode OnAbilitysAssertDebugChange(const std::vector> &tokens, + bool isAssertDebug) override + { + return ERR_OK; + } sptr AsObject() override { @@ -84,16 +91,12 @@ public: class MyStartSpecifiedAbilityResponse : public IStartSpecifiedAbilityResponse { public: - void OnAcceptWantResponse(const AAFwk::Want &want, const std::string &flag, int32_t requestId) override - {} - void OnTimeoutResponse(int32_t requestId) override - {} - void OnNewProcessRequestResponse(const std::string &flag, int32_t requestId) override - {} - void OnNewProcessRequestTimeoutResponse(int32_t requestId) override - {} - void OnStartSpecifiedFailed(int32_t requestId) override - {} + ErrCode OnAcceptWantResponse(const AAFwk::Want &want, const std::string &flag, int32_t requestId) override + { return ERR_OK; } + ErrCode OnTimeoutResponse(int32_t requestId) override { return ERR_OK; } + ErrCode OnNewProcessRequestResponse(const std::string &flag, int32_t requestId) override { return ERR_OK; } + ErrCode OnNewProcessRequestTimeoutResponse(int32_t requestId) override { return ERR_OK; } + ErrCode OnStartSpecifiedFailed(int32_t requestId) override { return ERR_OK; } sptr AsObject() override { return nullptr; diff --git a/test/unittest/app_mgr_service_inner_tenth_test/app_mgr_service_inner_tenth_test.cpp b/test/unittest/app_mgr_service_inner_tenth_test/app_mgr_service_inner_tenth_test.cpp index 74b33289f77..50896942bcd 100644 --- a/test/unittest/app_mgr_service_inner_tenth_test/app_mgr_service_inner_tenth_test.cpp +++ b/test/unittest/app_mgr_service_inner_tenth_test/app_mgr_service_inner_tenth_test.cpp @@ -67,14 +67,21 @@ public: class MyAbilityDebugResponse : public IAbilityDebugResponse { public: - void OnAbilitysDebugStarted(const std::vector> &tokens) override - {} + ErrCode OnAbilitysDebugStarted(const std::vector> &tokens) override + { + return ERR_OK; + } - void OnAbilitysDebugStoped(const std::vector> &tokens) override - {} + ErrCode OnAbilitysDebugStoped(const std::vector> &tokens) override + { + return ERR_OK; + } - void OnAbilitysAssertDebugChange(const std::vector> &tokens, - bool isAssertDebug) override {} + ErrCode OnAbilitysAssertDebugChange(const std::vector> &tokens, + bool isAssertDebug) override + { + return ERR_OK; + } sptr AsObject() override { return nullptr; @@ -83,16 +90,16 @@ public: class MyStartSpecifiedAbilityResponse : public IStartSpecifiedAbilityResponse { public: - void OnAcceptWantResponse(const AAFwk::Want &want, const std::string &flag, int32_t requestId) override - {} - void OnTimeoutResponse(int32_t requestId) override - {} - void OnNewProcessRequestResponse(const std::string &flag, int32_t requestId) override - {} - void OnNewProcessRequestTimeoutResponse(int32_t requestId) override - {} - void OnStartSpecifiedFailed(int32_t requestId) override - {} + ErrCode OnAcceptWantResponse(const AAFwk::Want &want, const std::string &flag, int32_t requestId) override + { return ERR_OK; } + ErrCode OnTimeoutResponse(int32_t requestId) override + { return ERR_OK; } + ErrCode OnNewProcessRequestResponse(const std::string &flag, int32_t requestId) override + { return ERR_OK; } + ErrCode OnNewProcessRequestTimeoutResponse(int32_t requestId) override + { return ERR_OK; } + ErrCode OnStartSpecifiedFailed(int32_t requestId) override + { return ERR_OK; } sptr AsObject() override { return nullptr; diff --git a/test/unittest/app_mgr_stub_test/app_mgr_stub_test.cpp b/test/unittest/app_mgr_stub_test/app_mgr_stub_test.cpp index 7cdbab6100c..0c3b84b4fa4 100644 --- a/test/unittest/app_mgr_stub_test/app_mgr_stub_test.cpp +++ b/test/unittest/app_mgr_stub_test/app_mgr_stub_test.cpp @@ -41,8 +41,10 @@ class AppForegroundStateObserverMock : public AppForegroundStateObserverStub { public: AppForegroundStateObserverMock() = default; virtual ~AppForegroundStateObserverMock() = default; - void OnAppStateChanged(const AppStateData &appStateData) override - {} + ErrCode OnAppStateChanged(const AppStateData &appStateData) override + { + return ERR_OK; + } }; class RenderStateObserverMock : public RenderStateObserverStub { diff --git a/test/unittest/app_state_observer_manager_test/app_state_observer_manager_test.cpp b/test/unittest/app_state_observer_manager_test/app_state_observer_manager_test.cpp index f111a1b1ab2..58a41c6de78 100644 --- a/test/unittest/app_state_observer_manager_test/app_state_observer_manager_test.cpp +++ b/test/unittest/app_state_observer_manager_test/app_state_observer_manager_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -69,8 +69,10 @@ class AppForegroundStateObserver : public AppForegroundStateObserverStub { public: AppForegroundStateObserver() = default; virtual ~AppForegroundStateObserver() = default; - void OnAppStateChanged(const AppStateData &appStateData) override - {} + ErrCode OnAppStateChanged(const AppStateData &appStateData) override + { + return ERR_OK; + } }; class AppSpawnSocketTest : public testing::Test { public: diff --git a/test/unittest/app_state_observer_manager_test_second/app_state_observer_manager_test_second.cpp b/test/unittest/app_state_observer_manager_test_second/app_state_observer_manager_test_second.cpp index 44d9810de9b..c292a92eae1 100644 --- a/test/unittest/app_state_observer_manager_test_second/app_state_observer_manager_test_second.cpp +++ b/test/unittest/app_state_observer_manager_test_second/app_state_observer_manager_test_second.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -87,8 +87,10 @@ class AppForegroundStateObserver : public AppForegroundStateObserverStub { public: AppForegroundStateObserver() = default; virtual ~AppForegroundStateObserver() = default; - void OnAppStateChanged(const AppStateData &appStateData) override - {} + ErrCode OnAppStateChanged(const AppStateData &appStateData) override + { + return ERR_OK; + } }; class AppStateObserverManagerTestSecond : public testing::Test { public: diff --git a/test/unittest/multi_instance_utils_second_test/mock_iapp_mgr.h b/test/unittest/multi_instance_utils_second_test/mock_iapp_mgr.h index 536be151058..cabfac5285b 100644 --- a/test/unittest/multi_instance_utils_second_test/mock_iapp_mgr.h +++ b/test/unittest/multi_instance_utils_second_test/mock_iapp_mgr.h @@ -17,7 +17,6 @@ #include "ability_foreground_state_observer_interface.h" #include "ability_info.h" -#include "app_foreground_state_observer_interface.h" #include "app_malloc_info.h" #include "app_mgr_ipc_interface_code.h" #include "app_record_id.h" @@ -31,6 +30,7 @@ #include "app_mgr_interface.h" #include "fault_data.h" #include "iapp_state_callback.h" +#include "iapp_foreground_state_observer.h" #include "iapplication_state_observer.h" #include "iconfiguration_observer.h" #include "iquick_fix_callback.h" -- Gitee