From 5523f4029908d2d5b4da62e31bd30cd23ad21de5 Mon Sep 17 00:00:00 2001 From: 18795846185 Date: Wed, 11 Jun 2025 17:22:10 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=83=E8=83=BD=E5=8A=9BIDL=E5=8C=96?= =?UTF-8?q?=E6=95=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 18795846185 --- frameworks/cj/ffi/want_agent/BUILD.gn | 5 +- frameworks/native/ability/native/BUILD.gn | 20 ++- interfaces/inner_api/ability_manager/BUILD.gn | 4 + interfaces/inner_api/app_manager/BUILD.gn | 116 ++++++++++++++++-- .../IKiaInterceptor.idl} | 39 +----- .../IQuickFixCallback.idl} | 31 +---- .../include/appmgr/app_mgr_interface.h | 4 +- .../include/appmgr/kia_interceptor_proxy.h | 66 ---------- .../include/appmgr/kia_interceptor_stub.h | 68 ---------- .../include/appmgr/quick_fix_callback_proxy.h | 40 ------ .../include/appmgr/quick_fix_callback_stub.h | 44 ------- .../src/appmgr/kia_interceptor_proxy.cpp | 67 ---------- .../src/appmgr/kia_interceptor_stub.cpp | 59 --------- .../src/appmgr/quick_fix_callback_proxy.cpp | 93 -------------- .../src/appmgr/quick_fix_callback_stub.cpp | 71 ----------- interfaces/inner_api/wantagent/BUILD.gn | 5 +- .../appmgr/include/app_mgr_service_inner.h | 2 +- .../include/quick_fix_callback_with_record.h | 8 +- .../src/quick_fix_callback_with_record.cpp | 11 +- .../src/quick_fix_manager_apply_task.cpp | 33 +++-- .../include/mock_kia_interceptor.h | 6 +- .../include/mock_kia_interceptor.h | 6 +- test/moduletest/app_mgr_client_test/BUILD.gn | 8 +- .../ui_extension_stability_test/BUILD.gn | 8 +- test/unittest/ams_ipc_interface_test/BUILD.gn | 9 +- .../mock/include/mock_iapp_mgr.h | 2 +- test/unittest/app_mgr_client_test/BUILD.gn | 8 +- .../app_mgr_proxy_test/app_mgr_proxy_test.cpp | 11 +- .../app_mgr_service_inner_eighth_test.cpp | 4 +- .../app_mgr_service_inner_mock_test/BUILD.gn | 6 +- .../include/mock_app_mgr_service_inner.h | 4 +- .../include/mock_kia_interceptor_impl.h | 4 +- .../src/mock_kia_interceptor_impl.cpp | 4 +- .../app_mgr_service_inner_second_test.cpp | 4 +- .../app_running_manager_second_test.cpp | 20 +-- .../main_fourth_test/main_fourth_test.cpp | 11 +- .../main_thread_test/main_thread_test.cpp | 11 +- test/unittest/dfr_test/watchdog_test/BUILD.gn | 3 +- .../BUILD.gn | 5 +- .../include/mock_quick_fix_callback_stub.h | 8 +- .../quick_fix_callback_proxy_test.cpp | 8 +- .../quick_fix_callback_stub_test.cpp | 12 +- .../quick_fix_callback_with_record_test.cpp | 11 +- 43 files changed, 293 insertions(+), 666 deletions(-) rename interfaces/inner_api/app_manager/{include/appmgr/kia_interceptor_interface.h => idl/IKiaInterceptor.idl} (39%) rename interfaces/inner_api/app_manager/{include/appmgr/iquick_fix_callback.h => idl/IQuickFixCallback.idl} (37%) delete mode 100644 interfaces/inner_api/app_manager/include/appmgr/kia_interceptor_proxy.h delete mode 100644 interfaces/inner_api/app_manager/include/appmgr/kia_interceptor_stub.h delete mode 100644 interfaces/inner_api/app_manager/include/appmgr/quick_fix_callback_proxy.h delete mode 100644 interfaces/inner_api/app_manager/include/appmgr/quick_fix_callback_stub.h delete mode 100644 interfaces/inner_api/app_manager/src/appmgr/kia_interceptor_proxy.cpp delete mode 100644 interfaces/inner_api/app_manager/src/appmgr/kia_interceptor_stub.cpp delete mode 100644 interfaces/inner_api/app_manager/src/appmgr/quick_fix_callback_proxy.cpp delete mode 100644 interfaces/inner_api/app_manager/src/appmgr/quick_fix_callback_stub.cpp diff --git a/frameworks/cj/ffi/want_agent/BUILD.gn b/frameworks/cj/ffi/want_agent/BUILD.gn index b6e9447be76..15a0a5b1ee2 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 @@ -35,6 +35,9 @@ 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..f1b5aa38837 100644 --- a/frameworks/native/ability/native/BUILD.gn +++ b/frameworks/native/ability/native/BUILD.gn @@ -43,6 +43,9 @@ 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" ] @@ -141,6 +144,10 @@ config("abilitykit_utils_public_config") { "${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" ] } @@ -551,6 +558,10 @@ config("extensionkit_public_config") { "${ability_runtime_services_path}/common/include", ] + configs = [ + "${ability_runtime_innerkits_path}/app_manager:appmgr_innerkits_config", + ] + if (ability_runtime_graphics) { defines = [ "SUPPORT_GRAPHICS" ] } @@ -759,6 +770,10 @@ config("uiability_config") { "${ability_runtime_services_path}/abilitymgr/include", ] + configs = [ + "${ability_runtime_innerkits_path}/app_manager:appmgr_innerkits_config", + ] + if (ability_runtime_graphics) { defines = [ "SUPPORT_GRAPHICS", @@ -1150,8 +1165,8 @@ ohos_shared_library("service_extension") { "${ability_runtime_native_path}/ability/native:insight_intent_executor", "${ability_runtime_native_path}/appkit:app_context", "${ability_runtime_native_path}/insight_intent/insight_intent_context:insightintentcontext", - "${ability_runtime_path}/utils/global/freeze:freeze_util", "${ability_runtime_path}/frameworks/ets/ani/ani_common:ani_common", + "${ability_runtime_path}/utils/global/freeze:freeze_util", ] external_deps = [ @@ -2219,6 +2234,9 @@ config("embedded_ui_extension_module_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" ] diff --git a/interfaces/inner_api/ability_manager/BUILD.gn b/interfaces/inner_api/ability_manager/BUILD.gn index 55d58d3ea7a..4c1e5dc584b 100644 --- a/interfaces/inner_api/ability_manager/BUILD.gn +++ b/interfaces/inner_api/ability_manager/BUILD.gn @@ -44,6 +44,10 @@ config("ability_manager_public_config") { defines = [] + configs = [ + "${ability_runtime_innerkits_path}/app_manager:appmgr_innerkits_config", + ] + if (ability_command_for_test) { defines += [ "ABILITY_COMMAND_FOR_TEST" ] } diff --git a/interfaces/inner_api/app_manager/BUILD.gn b/interfaces/inner_api/app_manager/BUILD.gn index c9658b81753..85d43360b97 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 @@ -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,111 @@ config("appmgr_core_config") { } } +idl_gen_interface("appmgr_innerkits") { + sources = [ + "idl/IKiaInterceptor.idl", + "idl/IQuickFixCallback.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_path}/utils/server/startup:startup_util_config", + ] + + deps = [ + ":appmgr_innerkits", + "${ability_runtime_path}/utils/server/startup:startup_util", + ] + external_deps = [ + "ability_base:configuration", + "bundle_framework:appexecfwk_base", + "c_utils:utils", + "hilog:libhilog", + "hitrace:hitrace_meter", + "ipc:ipc_core", + "samgr:samgr_proxy", + ] + 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_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_path}/utils/server/startup:startup_util", + ] + external_deps = [ + "ability_base:configuration", + "ability_base:session_info", + "ability_base:want", + "bundle_framework:appexecfwk_base", + "c_utils:utils", + "faultloggerd:libfaultloggerd", + "ffrt:libffrt", + "hilog:libhilog", + "hisysevent:libhisysevent", + "hitrace:hitrace_meter", + "ipc:ipc_core", + "samgr:samgr_proxy", + ] + + 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", @@ -98,20 +201,17 @@ ohos_shared_library("app_manager") { "src/appmgr/configuration_observer_stub.cpp", "src/appmgr/configuration_policy.cpp", "src/appmgr/fault_data.cpp", - "src/appmgr/kia_interceptor_proxy.cpp", - "src/appmgr/kia_interceptor_stub.cpp", "src/appmgr/killed_process_info.cpp", "src/appmgr/memory_level_info.cpp", "src/appmgr/native_child_notify_proxy.cpp", "src/appmgr/native_child_notify_stub.cpp", "src/appmgr/page_state_data.cpp", "src/appmgr/priority_object.cpp", + "src/appmgr/process_bind_data.cpp", "src/appmgr/process_data.cpp", "src/appmgr/process_info.cpp", "src/appmgr/process_memory_state.cpp", "src/appmgr/profile.cpp", - "src/appmgr/quick_fix_callback_proxy.cpp", - "src/appmgr/quick_fix_callback_stub.cpp", "src/appmgr/render_process_info.cpp", "src/appmgr/render_scheduler_host.cpp", "src/appmgr/render_scheduler_proxy.cpp", @@ -123,12 +223,13 @@ ohos_shared_library("app_manager") { "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", ] public_configs = [ ":appmgr_core_config", ":appmgr_sdk_config", + ":appmgr_innerkits_config", + "${ability_runtime_path}/utils/server/startup:startup_util_config", ] defines = [ "AMS_LOG_TAG = \"AppexecfwkCore\"" ] @@ -138,6 +239,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/kia_interceptor_interface.h b/interfaces/inner_api/app_manager/idl/IKiaInterceptor.idl similarity index 39% rename from interfaces/inner_api/app_manager/include/appmgr/kia_interceptor_interface.h rename to interfaces/inner_api/app_manager/idl/IKiaInterceptor.idl index 52dc49e2bbd..80564f2c441 100644 --- a/interfaces/inner_api/app_manager/include/appmgr/kia_interceptor_interface.h +++ b/interfaces/inner_api/app_manager/idl/IKiaInterceptor.idl @@ -1,5 +1,5 @@ /* - * Copyright (c) 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,37 +13,8 @@ * limitations under the License. */ -#ifndef OHOS_ABILITY_RUNTIME_KIA_INTERCEPTOR_INTERFACE_H -#define OHOS_ABILITY_RUNTIME_KIA_INTERCEPTOR_INTERFACE_H +sequenceable want..OHOS.AAFwk.Want; -#include - -#include "want.h" - -namespace OHOS { -namespace AppExecFwk { -/** - * @class IKiaInterceptor - * IPC interface for KIA. - */ -class IKiaInterceptor : public OHOS::IRemoteBroker { -public: - DECLARE_INTERFACE_DESCRIPTOR(u"ohos.appexecfwk.IKiaInterceptor"); - - /** - * OnIntercept, processing method from KIA. - * - * @param want The param of openning the app. - * @return Error code of calling the function. - */ - virtual int OnIntercept(AAFwk::Want &want) = 0; - - enum { - // ipc code for calling OnIntercept - KIA_INTERCEPTOR_ON_INTERCEPT = 0, - }; -}; -} // namespace AppExecFwk -} // namespace OHOS - -#endif // OHOS_ABILITY_RUNTIME_KIA_INTERCEPTOR_INTERFACE_H +interface OHOS.AppExecFwk.IKiaInterceptor { + void OnIntercept([inout] Want want); +} \ No newline at end of file diff --git a/interfaces/inner_api/app_manager/include/appmgr/iquick_fix_callback.h b/interfaces/inner_api/app_manager/idl/IQuickFixCallback.idl similarity index 37% rename from interfaces/inner_api/app_manager/include/appmgr/iquick_fix_callback.h rename to interfaces/inner_api/app_manager/idl/IQuickFixCallback.idl index f2e45b845d6..63a31421cdb 100644 --- a/interfaces/inner_api/app_manager/include/appmgr/iquick_fix_callback.h +++ b/interfaces/inner_api/app_manager/idl/IQuickFixCallback.idl @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 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,27 +13,8 @@ * limitations under the License. */ -#ifndef OHOS_ABILITY_RUNTIME_IQUICK_FIX_CALLBACK_H -#define OHOS_ABILITY_RUNTIME_IQUICK_FIX_CALLBACK_H - -#include "iremote_broker.h" - -namespace OHOS { -namespace AppExecFwk { -class IQuickFixCallback : public IRemoteBroker { -public: - DECLARE_INTERFACE_DESCRIPTOR(u"ohos.appexecfwk.QuickFixCallback"); - - virtual void OnLoadPatchDone(int32_t resultCode, int32_t recordId) = 0; - virtual void OnUnloadPatchDone(int32_t resultCode, int32_t recordId) = 0; - virtual void OnReloadPageDone(int32_t resultCode, int32_t recordId) = 0; - - enum QuickFixCallbackCmd { - ON_NOTIFY_LOAD_PATCH = 0, // ipc id for OnLoadPatchDone - ON_NOTIFY_UNLOAD_PATCH = 1, // ipc id for OnUnloadPatchDone - ON_NOTIFY_RELOAD_PAGE = 2, // ipc id for OnReloadPageDone - }; -}; -} // namespace AppExecFwk -} // namespace OHOS -#endif // OHOS_ABILITY_RUNTIME_IQUICK_FIX_CALLBACK_H +interface OHOS.AppExecFwk.IQuickFixCallback { + void OnLoadPatchDone([in] int resultCode, [in] int recordId); + void OnUnloadPatchDone([in] int resultCode, [in] int recordId); + void OnReloadPageDone([in] int resultCode, [in] int recordId); +} \ 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 78c33ca8ff1..58548c0a6f6 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 @@ -32,10 +32,10 @@ #include "child_process_request.h" #endif // SUPPORT_CHILD_PROCESS #include "fault_data.h" -#include "kia_interceptor_interface.h" #include "iapp_state_callback.h" #include "iapplication_state_observer.h" #include "iconfiguration_observer.h" +#include "ikia_interceptor.h" #include "iquick_fix_callback.h" #include "iremote_broker.h" #include "iremote_object.h" diff --git a/interfaces/inner_api/app_manager/include/appmgr/kia_interceptor_proxy.h b/interfaces/inner_api/app_manager/include/appmgr/kia_interceptor_proxy.h deleted file mode 100644 index 328ac436beb..00000000000 --- a/interfaces/inner_api/app_manager/include/appmgr/kia_interceptor_proxy.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 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_KIA_INTERCEPTOR_PROXY_H -#define OHOS_ABILITY_RUNTIME_KIA_INTERCEPTOR_PROXY_H - -#include "kia_interceptor_interface.h" - -#include - -namespace OHOS { -namespace AppExecFwk { -/** - * @class KiaInterceptorProxy - * IPC proxy of IKiaInterceptor. - */ -class KiaInterceptorProxy : public IRemoteProxy { -public: - /** - * KiaInterceptorProxy, constructor. - * - * @param impl The implementation of IKiaInterceptor. - */ - explicit KiaInterceptorProxy(const sptr &impl) : IRemoteProxy(impl) - {} - - /** - * KiaInterceptorProxy, destructor. - * - */ - virtual ~KiaInterceptorProxy() - {} - - /** - * OnIntercept, processing method from KIA. - * - * @param want The param of openning the app. - */ - virtual int OnIntercept(AAFwk::Want &want) override; - -private: - /** - * WriteInterfaceToken. - * - * @param data The message parcel data. - * @return Flag whether write is successful. - */ - bool WriteInterfaceToken(MessageParcel &data); - - static inline BrokerDelegator delegator_; -}; -} // namespace AppExecFwk -} // namespace OHOS -#endif // OHOS_ABILITY_RUNTIME_KIA_INTERCEPTOR_PROXY_H diff --git a/interfaces/inner_api/app_manager/include/appmgr/kia_interceptor_stub.h b/interfaces/inner_api/app_manager/include/appmgr/kia_interceptor_stub.h deleted file mode 100644 index 784a3d80ebd..00000000000 --- a/interfaces/inner_api/app_manager/include/appmgr/kia_interceptor_stub.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 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_KIA_INTERCEPTOR_STUB_H -#define OHOS_ABILITY_RUNTIME_KIA_INTERCEPTOR_STUB_H - -#include "kia_interceptor_interface.h" - -#include -#include - -namespace OHOS { -namespace AppExecFwk { -/** - * @class KiaInterceptorStub - * IPC stub of IKiaInterceptor. - */ -class KiaInterceptorStub : public IRemoteStub { -public: - /** - * KiaInterceptorStub, constructor. - * - */ - KiaInterceptorStub(); - - /** - * KiaInterceptorStub, destructor. - * - */ - virtual ~KiaInterceptorStub(); - - /** - * OnRemoteRequest, IPC method. - * - * @param code The IPC code. - * @param data The message parcel data. - * @param reply The message parcel reply. - * @param option The message parcel option. - * @return Error code of calling the function. - */ - virtual int OnRemoteRequest( - uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; - -private: - /** - * OnInterceptInner, inner processing method from KIA. - * - * @param data The message parcel data. - * @param reply The message parcel reply. - * @return Error code of calling the function. - */ - int OnInterceptInner(MessageParcel &data, MessageParcel &reply); -}; -} // namespace AppExecFwk -} // namespace OHOS -#endif // OHOS_ABILITY_RUNTIME_KIA_INTERCEPTOR_STUB_H diff --git a/interfaces/inner_api/app_manager/include/appmgr/quick_fix_callback_proxy.h b/interfaces/inner_api/app_manager/include/appmgr/quick_fix_callback_proxy.h deleted file mode 100644 index d2daba0fea1..00000000000 --- a/interfaces/inner_api/app_manager/include/appmgr/quick_fix_callback_proxy.h +++ /dev/null @@ -1,40 +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_QUICK_FIX_CALLBACK_PROXY_H -#define OHOS_ABILITY_RUNTIME_QUICK_FIX_CALLBACK_PROXY_H - -#include "iquick_fix_callback.h" -#include "iremote_proxy.h" - -namespace OHOS { -namespace AppExecFwk { -class QuickFixCallbackProxy : public IRemoteProxy { -public: - explicit QuickFixCallbackProxy(const sptr &impl) : IRemoteProxy(impl) {}; - virtual ~QuickFixCallbackProxy() = default; - - void OnLoadPatchDone(int32_t resultCode, int32_t recordId) override; - void OnUnloadPatchDone(int32_t resultCode, int32_t recordId) override; - void OnReloadPageDone(int32_t resultCode, int32_t recordId) override; - -private: - bool SendRequestWithCmd(uint32_t code, MessageParcel &data, MessageParcel &reply); - - static inline BrokerDelegator delegator_; -}; -} // namespace AppExecFwk -} // namespace OHOS -#endif // OHOS_ABILITY_RUNTIME_QUICK_FIX_CALLBACK_PROXY_H diff --git a/interfaces/inner_api/app_manager/include/appmgr/quick_fix_callback_stub.h b/interfaces/inner_api/app_manager/include/appmgr/quick_fix_callback_stub.h deleted file mode 100644 index 9dcf43da589..00000000000 --- a/interfaces/inner_api/app_manager/include/appmgr/quick_fix_callback_stub.h +++ /dev/null @@ -1,44 +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_QUICK_FIX_CALLBACK_STUB_H -#define OHOS_ABILITY_RUNTIME_QUICK_FIX_CALLBACK_STUB_H - -#include - -#include "iquick_fix_callback.h" -#include "iremote_stub.h" -#include "message_parcel.h" -#include "nocopyable.h" - -namespace OHOS { -namespace AppExecFwk { -class QuickFixCallbackStub : public IRemoteStub { -public: - QuickFixCallbackStub(); - virtual ~QuickFixCallbackStub(); - - int OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; - -private: - int32_t HandleOnLoadPatchDoneInner(MessageParcel &data, MessageParcel &reply); - int32_t HandleOnUnloadPatchDoneInner(MessageParcel &data, MessageParcel &reply); - int32_t HandleOnReloadPageDoneInner(MessageParcel &data, MessageParcel &reply); - - DISALLOW_COPY_AND_MOVE(QuickFixCallbackStub); -}; -} // namespace AppExecFwk -} // namespace OHOS -#endif // OHOS_ABILITY_RUNTIME_QUICK_FIX_CALLBACK_STUB_H diff --git a/interfaces/inner_api/app_manager/src/appmgr/kia_interceptor_proxy.cpp b/interfaces/inner_api/app_manager/src/appmgr/kia_interceptor_proxy.cpp deleted file mode 100644 index 15f2e759cd4..00000000000 --- a/interfaces/inner_api/app_manager/src/appmgr/kia_interceptor_proxy.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 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 "kia_interceptor_proxy.h" - -#include "hilog_tag_wrapper.h" -#include "ipc_capacity_wrap.h" - -namespace OHOS { -namespace AppExecFwk { -bool KiaInterceptorProxy::WriteInterfaceToken(MessageParcel &data) -{ - if (!data.WriteInterfaceToken(KiaInterceptorProxy::GetDescriptor())) { - TAG_LOGE(AAFwkTag::APPMGR, "write interface token failed"); - return false; - } - return true; -} - -int KiaInterceptorProxy::OnIntercept(AAFwk::Want &want) -{ - MessageParcel data; - MessageParcel reply; - AAFwk::ExtendMaxIpcCapacityForInnerWant(data); - MessageOption option(MessageOption::TF_SYNC); - if (!WriteInterfaceToken(data)) { - return ERR_INVALID_VALUE; - } - data.WriteParcelable(&want); - sptr remote = Remote(); - if (remote == nullptr) { - TAG_LOGE(AAFwkTag::APPMGR, "Remote() is NULL"); - return ERR_INVALID_VALUE; - } - int32_t ret = remote->SendRequest(static_cast(IKiaInterceptor::KIA_INTERCEPTOR_ON_INTERCEPT), - data, reply, option); - if (ret != NO_ERROR) { - TAG_LOGE(AAFwkTag::APPMGR, "SendRequest is failed, error code: %{public}d.", ret); - return ret; - } - int resultCode = reply.ReadInt32(); - if (resultCode != ERR_OK) { - TAG_LOGE(AAFwkTag::APPMGR, "OnIntercept failed, resultCode=%{public}d.", resultCode); - return resultCode; - } - sptr resultWant = reply.ReadParcelable(); - if (resultWant == nullptr) { - TAG_LOGE(AAFwkTag::APPMGR, "resultWant is nullptr."); - return ERR_INVALID_VALUE; - } - want = *resultWant; - return resultCode; -} -} // namespace AppExecFwk -} // namespace OHOS diff --git a/interfaces/inner_api/app_manager/src/appmgr/kia_interceptor_stub.cpp b/interfaces/inner_api/app_manager/src/appmgr/kia_interceptor_stub.cpp deleted file mode 100644 index 96eb5f75048..00000000000 --- a/interfaces/inner_api/app_manager/src/appmgr/kia_interceptor_stub.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 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 "kia_interceptor_stub.h" - -#include "hilog_tag_wrapper.h" - -namespace OHOS { -namespace AppExecFwk { -KiaInterceptorStub::KiaInterceptorStub() {} - -KiaInterceptorStub::~KiaInterceptorStub() {} - -int KiaInterceptorStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) -{ - TAG_LOGD(AAFwkTag::APPMGR, "cmd=%d,flags=%d", code, option.GetFlags()); - std::u16string descriptor = KiaInterceptorStub::GetDescriptor(); - std::u16string remoteDescriptor = data.ReadInterfaceToken(); - if (descriptor != remoteDescriptor) { - TAG_LOGI(AAFwkTag::APPMGR, "local descriptor is not equal to remote"); - return ERR_INVALID_STATE; - } - - if (code == KIA_INTERCEPTOR_ON_INTERCEPT) { - return OnInterceptInner(data, reply); - } - TAG_LOGW(AAFwkTag::APPMGR, "KiaInterceptorStub::OnRemoteRequest, default case, need check."); - return IPCObjectStub::OnRemoteRequest(code, data, reply, option); -} - -int KiaInterceptorStub::OnInterceptInner(MessageParcel &data, MessageParcel &reply) -{ - sptr want = data.ReadParcelable(); - int resultCode = OnIntercept(*want); - if (!reply.WriteInt32(resultCode)) { - TAG_LOGE(AAFwkTag::APPMGR, "write resultCode failed."); - return ERR_INVALID_VALUE; - } - if (!reply.WriteParcelable(want)) { - TAG_LOGE(AAFwkTag::APPMGR, "write want failed."); - return ERR_INVALID_VALUE; - } - - return NO_ERROR; -} -} // namespace AppExecFwk -} // namespace OHOS diff --git a/interfaces/inner_api/app_manager/src/appmgr/quick_fix_callback_proxy.cpp b/interfaces/inner_api/app_manager/src/appmgr/quick_fix_callback_proxy.cpp deleted file mode 100644 index ed1c8310efa..00000000000 --- a/interfaces/inner_api/app_manager/src/appmgr/quick_fix_callback_proxy.cpp +++ /dev/null @@ -1,93 +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 "quick_fix_callback_proxy.h" - -#include "hilog_tag_wrapper.h" -#include "message_parcel.h" -#include "parcel_macro_base.h" - -namespace OHOS { -namespace AppExecFwk { -void QuickFixCallbackProxy::OnLoadPatchDone(int32_t resultCode, int32_t recordId) -{ - TAG_LOGD(AAFwkTag::APPMGR, "called"); - - MessageParcel data; - MessageParcel reply; - WRITE_PARCEL_AND_RETURN(InterfaceToken, data, QuickFixCallbackProxy::GetDescriptor()); - WRITE_PARCEL_AND_RETURN(Int32, data, resultCode); - WRITE_PARCEL_AND_RETURN(Int32, data, recordId); - if (!SendRequestWithCmd(IQuickFixCallback::QuickFixCallbackCmd::ON_NOTIFY_LOAD_PATCH, data, reply)) { - return; - } - - TAG_LOGD(AAFwkTag::APPMGR, "function finished."); - return; -} - -void QuickFixCallbackProxy::OnUnloadPatchDone(int32_t resultCode, int32_t recordId) -{ - TAG_LOGD(AAFwkTag::APPMGR, "called"); - - MessageParcel data; - MessageParcel reply; - WRITE_PARCEL_AND_RETURN(InterfaceToken, data, QuickFixCallbackProxy::GetDescriptor()); - WRITE_PARCEL_AND_RETURN(Int32, data, resultCode); - WRITE_PARCEL_AND_RETURN(Int32, data, recordId); - if (!SendRequestWithCmd(IQuickFixCallback::QuickFixCallbackCmd::ON_NOTIFY_UNLOAD_PATCH, data, reply)) { - return; - } - - TAG_LOGD(AAFwkTag::APPMGR, "function finished."); - return; -} - -void QuickFixCallbackProxy::OnReloadPageDone(int32_t resultCode, int32_t recordId) -{ - TAG_LOGD(AAFwkTag::APPMGR, "called"); - - MessageParcel data; - MessageParcel reply; - WRITE_PARCEL_AND_RETURN(InterfaceToken, data, QuickFixCallbackProxy::GetDescriptor()); - WRITE_PARCEL_AND_RETURN(Int32, data, resultCode); - WRITE_PARCEL_AND_RETURN(Int32, data, recordId); - if (!SendRequestWithCmd(IQuickFixCallback::QuickFixCallbackCmd::ON_NOTIFY_RELOAD_PAGE, data, reply)) { - return; - } - - TAG_LOGD(AAFwkTag::APPMGR, "function finished."); - return; -} - -bool QuickFixCallbackProxy::SendRequestWithCmd(uint32_t code, MessageParcel &data, MessageParcel &reply) -{ - sptr remote = Remote(); - if (remote == nullptr) { - TAG_LOGE(AAFwkTag::APPMGR, "Remote is nullptr."); - return false; - } - - MessageOption option(MessageOption::TF_SYNC); - auto ret = remote->SendRequest(code, data, reply, option); - if (ret != 0) { - TAG_LOGE(AAFwkTag::APPMGR, "Send request failed with error %{public}d.", ret); - return false; - } - - return true; -} -} // namespace AppExecFwk -} // namespace OHOS diff --git a/interfaces/inner_api/app_manager/src/appmgr/quick_fix_callback_stub.cpp b/interfaces/inner_api/app_manager/src/appmgr/quick_fix_callback_stub.cpp deleted file mode 100644 index e557f4802a5..00000000000 --- a/interfaces/inner_api/app_manager/src/appmgr/quick_fix_callback_stub.cpp +++ /dev/null @@ -1,71 +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 "quick_fix_callback_stub.h" - -#include "hilog_tag_wrapper.h" - -namespace OHOS { -namespace AppExecFwk { -QuickFixCallbackStub::QuickFixCallbackStub() {} - -QuickFixCallbackStub::~QuickFixCallbackStub() {} - -int QuickFixCallbackStub::OnRemoteRequest( - uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) -{ - if (data.ReadInterfaceToken() != IQuickFixCallback::GetDescriptor()) { - TAG_LOGE(AAFwkTag::APPMGR, "local descriptor is not equal to remote."); - return ERR_INVALID_STATE; - } - - switch (code) { - case ON_NOTIFY_LOAD_PATCH: - return HandleOnLoadPatchDoneInner(data, reply); - case ON_NOTIFY_UNLOAD_PATCH: - return HandleOnUnloadPatchDoneInner(data, reply); - case ON_NOTIFY_RELOAD_PAGE: - return HandleOnReloadPageDoneInner(data, reply); - } - - TAG_LOGW(AAFwkTag::APPMGR, "default case, need check value of code!"); - return IPCObjectStub::OnRemoteRequest(code, data, reply, option); -} - -int32_t QuickFixCallbackStub::HandleOnLoadPatchDoneInner(MessageParcel &data, MessageParcel &reply) -{ - int32_t resultCode = data.ReadInt32(); - int32_t recordId = data.ReadInt32(); - OnLoadPatchDone(resultCode, recordId); - return ERR_OK; -} - -int32_t QuickFixCallbackStub::HandleOnUnloadPatchDoneInner(MessageParcel &data, MessageParcel &reply) -{ - int32_t resultCode = data.ReadInt32(); - int32_t recordId = data.ReadInt32(); - OnUnloadPatchDone(resultCode, recordId); - return ERR_OK; -} - -int32_t QuickFixCallbackStub::HandleOnReloadPageDoneInner(MessageParcel &data, MessageParcel &reply) -{ - int32_t resultCode = data.ReadInt32(); - int32_t recordId = data.ReadInt32(); - OnReloadPageDone(resultCode, recordId); - return ERR_OK; -} -} // namespace AAFwk -} // namespace OHOS diff --git a/interfaces/inner_api/wantagent/BUILD.gn b/interfaces/inner_api/wantagent/BUILD.gn index b1e9d373d3d..fffd9c65b55 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 @@ -43,6 +43,9 @@ 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") { diff --git a/services/appmgr/include/app_mgr_service_inner.h b/services/appmgr/include/app_mgr_service_inner.h index 9bc66b07c2f..4fc049d8374 100644 --- a/services/appmgr/include/app_mgr_service_inner.h +++ b/services/appmgr/include/app_mgr_service_inner.h @@ -61,10 +61,10 @@ #include "iapp_state_callback.h" #include "iapplication_state_observer.h" #include "iconfiguration_observer.h" +#include "ikia_interceptor.h" #include "iremote_object.h" #include "irender_state_observer.h" #include "istart_specified_ability_response.h" -#include "kia_interceptor_interface.h" #include "kill_process_config.h" #include "killed_process_info.h" #include "process_memory_state.h" diff --git a/services/appmgr/include/quick_fix_callback_with_record.h b/services/appmgr/include/quick_fix_callback_with_record.h index cd64bb9f98a..2a8b6665882 100644 --- a/services/appmgr/include/quick_fix_callback_with_record.h +++ b/services/appmgr/include/quick_fix_callback_with_record.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 @@ -32,9 +32,9 @@ public: ~QuickFixCallbackWithRecord() override; - void OnLoadPatchDone(int32_t resultCode, int32_t recordId) override; - void OnUnloadPatchDone(int32_t resultCode, int32_t recordId) override; - void OnReloadPageDone(int32_t resultCode, int32_t recordId) override; + ErrCode OnLoadPatchDone(int32_t resultCode, int32_t recordId) override; + ErrCode OnUnloadPatchDone(int32_t resultCode, int32_t recordId) override; + ErrCode OnReloadPageDone(int32_t resultCode, int32_t recordId) override; void AddRecordId(int32_t recordId); void RemoveRecordId(int32_t recordId); diff --git a/services/appmgr/src/quick_fix_callback_with_record.cpp b/services/appmgr/src/quick_fix_callback_with_record.cpp index 877e2148924..f9e18dbf904 100644 --- a/services/appmgr/src/quick_fix_callback_with_record.cpp +++ b/services/appmgr/src/quick_fix_callback_with_record.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 @@ -24,31 +24,34 @@ QuickFixCallbackWithRecord::~QuickFixCallbackWithRecord() TAG_LOGD(AAFwkTag::APPMGR, "destroyed."); } -void QuickFixCallbackWithRecord::OnLoadPatchDone(int32_t resultCode, int32_t recordId) +ErrCode QuickFixCallbackWithRecord::OnLoadPatchDone(int32_t resultCode, int32_t recordId) { TAG_LOGD(AAFwkTag::APPMGR, "called"); ProcessCallback(resultCode, recordId); if (IsRecordListEmpty() && callback_ != nullptr) { callback_->OnLoadPatchDone(finalResult.load(), recordId); } + return ERR_OK; } -void QuickFixCallbackWithRecord::OnUnloadPatchDone(int32_t resultCode, int32_t recordId) +ErrCode QuickFixCallbackWithRecord::OnUnloadPatchDone(int32_t resultCode, int32_t recordId) { TAG_LOGD(AAFwkTag::APPMGR, "called"); ProcessCallback(resultCode, recordId); if (IsRecordListEmpty() && callback_ != nullptr) { callback_->OnUnloadPatchDone(finalResult.load(), recordId); } + return ERR_OK; } -void QuickFixCallbackWithRecord::OnReloadPageDone(int32_t resultCode, int32_t recordId) +ErrCode QuickFixCallbackWithRecord::OnReloadPageDone(int32_t resultCode, int32_t recordId) { TAG_LOGD(AAFwkTag::APPMGR, "called"); ProcessCallback(resultCode, recordId); if (IsRecordListEmpty() && callback_ != nullptr) { callback_->OnReloadPageDone(finalResult.load(), recordId); } + return ERR_OK; } void QuickFixCallbackWithRecord::ProcessCallback(int32_t resultCode, int32_t recordId) diff --git a/services/quickfixmgr/src/quick_fix_manager_apply_task.cpp b/services/quickfixmgr/src/quick_fix_manager_apply_task.cpp index 86d3df61ded..7235fc4bf38 100644 --- a/services/quickfixmgr/src/quick_fix_manager_apply_task.cpp +++ b/services/quickfixmgr/src/quick_fix_manager_apply_task.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 @@ -235,52 +235,55 @@ public: TAG_LOGD(AAFwkTag::QUICKFIX, "destroyed"); } - void OnLoadPatchDone(int32_t resultCode, [[maybe_unused]] int32_t recordId) override + ErrCode OnLoadPatchDone(int32_t resultCode, [[maybe_unused]] int32_t recordId) override { TAG_LOGD(AAFwkTag::QUICKFIX, "called"); if (resultCode != 0) { TAG_LOGE(AAFwkTag::QUICKFIX, "notify patch failed: %{public}d", resultCode); applyTask_->NotifyApplyStatus(QUICK_FIX_NOTIFY_LOAD_PATCH_FAILED); applyTask_->RemoveSelf(); - return; + return ERR_INVALID_VALUE; } applyTask_->PostDeleteQuickFixTask(); + return ERR_OK; } - void OnUnloadPatchDone(int32_t resultCode, [[maybe_unused]] int32_t recordId) override + ErrCode OnUnloadPatchDone(int32_t resultCode, [[maybe_unused]] int32_t recordId) override { TAG_LOGD(AAFwkTag::QUICKFIX, "called"); if (resultCode != 0) { TAG_LOGE(AAFwkTag::QUICKFIX, "notify patch failed: %{public}d", resultCode); applyTask_->NotifyApplyStatus(QUICK_FIX_NOTIFY_UNLOAD_PATCH_FAILED); applyTask_->RemoveSelf(); - return; + return ERR_INVALID_VALUE; } if (applyTask_->GetTaskType() == QuickFixManagerApplyTask::TaskType::QUICK_FIX_APPLY) { applyTask_->PostSwitchQuickFixTask(); - return; + return ERR_OK; } else if (applyTask_->GetTaskType() == QuickFixManagerApplyTask::TaskType::QUICK_FIX_REVOKE) { applyTask_->PostRevokeQuickFixDeleteTask(); - return; + return ERR_OK; } TAG_LOGW(AAFwkTag::QUICKFIX, "Invalid task type"); + return ERR_OK; } - void OnReloadPageDone(int32_t resultCode, [[maybe_unused]] int32_t recordId) override + ErrCode OnReloadPageDone(int32_t resultCode, [[maybe_unused]] int32_t recordId) override { TAG_LOGD(AAFwkTag::QUICKFIX, "called"); if (resultCode != 0) { TAG_LOGE(AAFwkTag::QUICKFIX, "notify app load patch failed: %{public}d", resultCode); applyTask_->NotifyApplyStatus(QUICK_FIX_NOTIFY_RELOAD_PAGE_FAILED); applyTask_->RemoveSelf(); - return; + return ERR_INVALID_VALUE; } applyTask_->NotifyApplyStatus(QUICK_FIX_OK); applyTask_->RemoveSelf(); + return ERR_OK; } private: @@ -295,11 +298,15 @@ public: virtual ~RevokeQuickFixNotifyCallback() = default; - void OnLoadPatchDone(int32_t resultCode, [[maybe_unused]] int32_t recordId) override - {} + ErrCode OnLoadPatchDone(int32_t resultCode, [[maybe_unused]] int32_t recordId) override + { + return ERR_OK; + } - void OnReloadPageDone(int32_t resultCode, [[maybe_unused]] int32_t recordId) override - {} + ErrCode OnReloadPageDone(int32_t resultCode, [[maybe_unused]] int32_t recordId) override + { + return ERR_OK; + } }; QuickFixManagerApplyTask::~QuickFixManagerApplyTask() diff --git a/test/mock/mock_appmgr_service/include/mock_kia_interceptor.h b/test/mock/mock_appmgr_service/include/mock_kia_interceptor.h index 99dd0a835c0..294e9dfc6fa 100644 --- a/test/mock/mock_appmgr_service/include/mock_kia_interceptor.h +++ b/test/mock/mock_appmgr_service/include/mock_kia_interceptor.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 @@ -28,9 +28,9 @@ public: MockKiaInterceptor() {} virtual ~MockKiaInterceptor() = default; - int OnIntercept(AAFwk::Want &want) override + ErrCode OnIntercept(AAFwk::Want &want) override { - return 0; + return ERR_OK; } }; } // namespace AppExecFwk diff --git a/test/mock/services_appmgr_test/include/mock_kia_interceptor.h b/test/mock/services_appmgr_test/include/mock_kia_interceptor.h index 99dd0a835c0..092f5af6c20 100644 --- a/test/mock/services_appmgr_test/include/mock_kia_interceptor.h +++ b/test/mock/services_appmgr_test/include/mock_kia_interceptor.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 @@ -28,9 +28,9 @@ public: MockKiaInterceptor() {} virtual ~MockKiaInterceptor() = default; - int OnIntercept(AAFwk::Want &want) override + ErrCode OnIntercept(AAFwk::Want &want) override { - return 0; + return ERR_OK; } }; } // namespace AppExecFwk diff --git a/test/moduletest/app_mgr_client_test/BUILD.gn b/test/moduletest/app_mgr_client_test/BUILD.gn index 9a3c1e9e3ed..c5ab7ef2877 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 @@ -19,6 +19,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 + } + include_dirs = [ "${ability_runtime_test_path}/mock/common/include", "${ability_runtime_test_path}/mock/mock_sa_call", diff --git a/test/moduletest/ui_extension_ability_test/ui_extension_stability_test/BUILD.gn b/test/moduletest/ui_extension_ability_test/ui_extension_stability_test/BUILD.gn index 77a731074b6..678239368c0 100644 --- a/test/moduletest/ui_extension_ability_test/ui_extension_stability_test/BUILD.gn +++ b/test/moduletest/ui_extension_ability_test/ui_extension_stability_test/BUILD.gn @@ -18,6 +18,12 @@ import("//foundation/ability/ability_runtime/ability_runtime.gni") ohos_moduletest("ui_extension_stability_test") { module_out_path = "ability_runtime/ability_runtime/ui_extension" + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + } + include_dirs = [ "../include", "${ability_runtime_test_path}/mock/mock_sa_call", @@ -49,8 +55,8 @@ ohos_moduletest("ui_extension_stability_test") { "access_token:libtoken_setproc", "bundle_framework:appexecfwk_base", "bundle_framework:appexecfwk_core", - "c_utils:utils", "cJSON:cjson_static", + "c_utils:utils", "eventhandler:libeventhandler", "ffrt:libffrt", "googletest:gmock_main", diff --git a/test/unittest/ams_ipc_interface_test/BUILD.gn b/test/unittest/ams_ipc_interface_test/BUILD.gn index 4265e2f8404..afb0243fae8 100644 --- a/test/unittest/ams_ipc_interface_test/BUILD.gn +++ b/test/unittest/ams_ipc_interface_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 @@ -28,7 +28,12 @@ ohos_unittest("AmsIpcAppSchedulerInterfaceTest") { if (target_cpu == "arm") { cflags += [ "-DBINDER_IPC_32BIT" ] } - deps = [ "${ability_runtime_test_path}/unittest:appmgr_test_source" ] + + deps = [ + "${ability_runtime_innerkits_path}/app_manager:app_manager", + "${ability_runtime_native_path}/appkit:appkit_native", + "${ability_runtime_test_path}/unittest:appmgr_test_source", + ] external_deps = [ "ability_base:base", 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..98065698790 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 @@ -34,11 +34,11 @@ #include "iapp_state_callback.h" #include "iapplication_state_observer.h" #include "iconfiguration_observer.h" +#include "ikia_interceptor.h" #include "iquick_fix_callback.h" #include "iremote_broker.h" #include "iremote_object.h" #include "irender_state_observer.h" -#include "kia_interceptor_interface.h" #include "killed_process_info.h" #include "memory_level_info.h" #include "page_state_data.h" diff --git a/test/unittest/app_mgr_client_test/BUILD.gn b/test/unittest/app_mgr_client_test/BUILD.gn index 580be23be08..d2b361c0b31 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 @@ -19,6 +19,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 + } + configs = [ "${ability_runtime_services_path}/common:common_config", "${ability_runtime_services_path}/abilitymgr:abilityms_config", 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..355a0d846fc 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 @@ -56,19 +56,22 @@ public: QuickFixCallbackImpl() = default; virtual ~QuickFixCallbackImpl() = default; - void OnLoadPatchDone(int32_t resultCode, int32_t recordId) override + ErrCode OnLoadPatchDone(int32_t resultCode, int32_t recordId) override { TAG_LOGD(AAFwkTag::TEST, "function called."); + return ERR_OK; } - void OnUnloadPatchDone(int32_t resultCode, int32_t recordId) override + ErrCode OnUnloadPatchDone(int32_t resultCode, int32_t recordId) override { TAG_LOGD(AAFwkTag::TEST, "function called."); + return ERR_OK; } - void OnReloadPageDone(int32_t resultCode, int32_t recordId) override + ErrCode OnReloadPageDone(int32_t resultCode, int32_t recordId) override { TAG_LOGD(AAFwkTag::TEST, "function called."); + return ERR_OK; } }; 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..06998bf3a74 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 @@ -54,9 +54,9 @@ public: }; class MyKiaInterceptor : public IKiaInterceptor { public: - int OnIntercept(AAFwk::Want &want) override + ErrCode OnIntercept(AAFwk::Want &want) override { - return 0; + return ERR_OK; } sptr AsObject() override diff --git a/test/unittest/app_mgr_service_inner_mock_test/BUILD.gn b/test/unittest/app_mgr_service_inner_mock_test/BUILD.gn index 2ac11e3423a..ad8b946b92e 100644 --- a/test/unittest/app_mgr_service_inner_mock_test/BUILD.gn +++ b/test/unittest/app_mgr_service_inner_mock_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2024 Huawei Device Co., Ltd. +# Copyright (c) 2024-2025 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -33,8 +33,6 @@ ohos_unittest("app_mgr_service_inner_mock_test") { ] sources = [ - "${ability_runtime_innerkits_path}/app_manager/src/appmgr/kia_interceptor_proxy.cpp", - "${ability_runtime_innerkits_path}/app_manager/src/appmgr/kia_interceptor_stub.cpp", "app_mgr_service_inner_mock_test.cpp", "src/app_utils.cpp", "src/mock_app_mgr_service_inner.cpp", @@ -43,7 +41,7 @@ ohos_unittest("app_mgr_service_inner_mock_test") { "src/window_manager.cpp", ] - deps = [] + deps = [ "${ability_runtime_innerkits_path}/app_manager:app_manager" ] external_deps = [ "ability_base:want", diff --git a/test/unittest/app_mgr_service_inner_mock_test/include/mock_app_mgr_service_inner.h b/test/unittest/app_mgr_service_inner_mock_test/include/mock_app_mgr_service_inner.h index 4643203e841..9346c35a917 100644 --- a/test/unittest/app_mgr_service_inner_mock_test/include/mock_app_mgr_service_inner.h +++ b/test/unittest/app_mgr_service_inner_mock_test/include/mock_app_mgr_service_inner.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 @@ -18,7 +18,7 @@ #include "app_running_manager.h" #include "app_running_record.h" -#include "kia_interceptor_interface.h" +#include "ikia_interceptor.h" namespace OHOS { namespace AppExecFwk { diff --git a/test/unittest/app_mgr_service_inner_mock_test/include/mock_kia_interceptor_impl.h b/test/unittest/app_mgr_service_inner_mock_test/include/mock_kia_interceptor_impl.h index 7cc6e045531..d6a23ffc789 100644 --- a/test/unittest/app_mgr_service_inner_mock_test/include/mock_kia_interceptor_impl.h +++ b/test/unittest/app_mgr_service_inner_mock_test/include/mock_kia_interceptor_impl.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 @@ -31,7 +31,7 @@ public: static int onInterceptRetCode; static std::string kiaWatermarkBusinessName; static bool isWatermarkEnabled; - virtual int OnIntercept(AAFwk::Want &want) override; + virtual ErrCode OnIntercept(AAFwk::Want &want) override; }; } // namespace AppExecFwk } // namespace OHOS diff --git a/test/unittest/app_mgr_service_inner_mock_test/src/mock_kia_interceptor_impl.cpp b/test/unittest/app_mgr_service_inner_mock_test/src/mock_kia_interceptor_impl.cpp index 0ccd59da340..1a7bf5872b2 100644 --- a/test/unittest/app_mgr_service_inner_mock_test/src/mock_kia_interceptor_impl.cpp +++ b/test/unittest/app_mgr_service_inner_mock_test/src/mock_kia_interceptor_impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2024-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -23,7 +23,7 @@ int MockKiaInterceptorImpl::onInterceptRetCode = 0; std::string MockKiaInterceptorImpl::kiaWatermarkBusinessName; bool MockKiaInterceptorImpl::isWatermarkEnabled = false; -int MockKiaInterceptorImpl::OnIntercept(AAFwk::Want &want) +ErrCode MockKiaInterceptorImpl::OnIntercept(AAFwk::Want &want) { if (onInterceptRetCode != 0) { return onInterceptRetCode; diff --git a/test/unittest/app_mgr_service_inner_second_test/app_mgr_service_inner_second_test.cpp b/test/unittest/app_mgr_service_inner_second_test/app_mgr_service_inner_second_test.cpp index b65ae0f706e..3b749f1c9c0 100644 --- a/test/unittest/app_mgr_service_inner_second_test/app_mgr_service_inner_second_test.cpp +++ b/test/unittest/app_mgr_service_inner_second_test/app_mgr_service_inner_second_test.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 @@ -133,7 +133,7 @@ class IKiaInterceptorTest : public IKiaInterceptor { public: IKiaInterceptorTest() = default; virtual ~IKiaInterceptorTest() = default; - int OnIntercept(AAFwk::Want &want) override { return 0; } + ErrCode OnIntercept(AAFwk::Want &want) override { return ERR_OK; } }; /** diff --git a/test/unittest/app_running_manager_second_test/app_running_manager_second_test.cpp b/test/unittest/app_running_manager_second_test/app_running_manager_second_test.cpp index c253b23dbea..630de599030 100644 --- a/test/unittest/app_running_manager_second_test/app_running_manager_second_test.cpp +++ b/test/unittest/app_running_manager_second_test/app_running_manager_second_test.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 @@ -48,14 +48,20 @@ public: QuickFixCallbackImpl() = default; virtual ~QuickFixCallbackImpl() = default; - void OnLoadPatchDone(int32_t resultCode, [[maybe_unused]] int32_t recordId) override - {} + ErrCode OnLoadPatchDone(int32_t resultCode, [[maybe_unused]] int32_t recordId) override + { + return ERR_OK; + } - void OnUnloadPatchDone(int32_t resultCode, [[maybe_unused]] int32_t recordId) override - {} + ErrCode OnUnloadPatchDone(int32_t resultCode, [[maybe_unused]] int32_t recordId) override + { + return ERR_OK; + } - void OnReloadPageDone(int32_t resultCode, [[maybe_unused]] int32_t recordId) override - {} + ErrCode OnReloadPageDone(int32_t resultCode, [[maybe_unused]] int32_t recordId) override + { + return ERR_OK; + } }; } diff --git a/test/unittest/appkit/main_fourth_test/main_fourth_test.cpp b/test/unittest/appkit/main_fourth_test/main_fourth_test.cpp index afeaf72e9b7..bfbdecfedb3 100644 --- a/test/unittest/appkit/main_fourth_test/main_fourth_test.cpp +++ b/test/unittest/appkit/main_fourth_test/main_fourth_test.cpp @@ -1,5 +1,5 @@ /* - * 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 @@ -43,19 +43,22 @@ public: QuickFixCallbackImpl() = default; virtual ~QuickFixCallbackImpl() = default; - void OnLoadPatchDone(int32_t resultCode, int32_t recordId) override + ErrCode OnLoadPatchDone(int32_t resultCode, int32_t recordId) override { TAG_LOGD(AAFwkTag::TEST, "function called."); + return ERR_OK; } - void OnUnloadPatchDone(int32_t resultCode, int32_t recordId) override + ErrCode OnUnloadPatchDone(int32_t resultCode, int32_t recordId) override { TAG_LOGD(AAFwkTag::TEST, "function called."); + return ERR_OK; } - void OnReloadPageDone(int32_t resultCode, int32_t recordId) override + ErrCode OnReloadPageDone(int32_t resultCode, int32_t recordId) override { TAG_LOGD(AAFwkTag::TEST, "function called."); + return ERR_OK; } }; diff --git a/test/unittest/appkit/main_thread_test/main_thread_test.cpp b/test/unittest/appkit/main_thread_test/main_thread_test.cpp index ac1a95f76c5..4541ef62154 100644 --- a/test/unittest/appkit/main_thread_test/main_thread_test.cpp +++ b/test/unittest/appkit/main_thread_test/main_thread_test.cpp @@ -1,5 +1,5 @@ /* - * 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 @@ -42,19 +42,22 @@ public: QuickFixCallbackImpl() = default; virtual ~QuickFixCallbackImpl() = default; - void OnLoadPatchDone(int32_t resultCode, int32_t recordId) override + ErrCode OnLoadPatchDone(int32_t resultCode, int32_t recordId) override { TAG_LOGD(AAFwkTag::TEST, "function called."); + return ERR_OK; } - void OnUnloadPatchDone(int32_t resultCode, int32_t recordId) override + ErrCode OnUnloadPatchDone(int32_t resultCode, int32_t recordId) override { TAG_LOGD(AAFwkTag::TEST, "function called."); + return ERR_OK; } - void OnReloadPageDone(int32_t resultCode, int32_t recordId) override + ErrCode OnReloadPageDone(int32_t resultCode, int32_t recordId) override { TAG_LOGD(AAFwkTag::TEST, "function called."); + return ERR_OK; } }; diff --git a/test/unittest/dfr_test/watchdog_test/BUILD.gn b/test/unittest/dfr_test/watchdog_test/BUILD.gn index 7d977ca1478..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 @@ -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..88354ac6016 100644 --- a/test/unittest/frameworks_kits_appkit_native_test/BUILD.gn +++ b/test/unittest/frameworks_kits_appkit_native_test/BUILD.gn @@ -1019,7 +1019,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/quick_fix/mock/include/mock_quick_fix_callback_stub.h b/test/unittest/quick_fix/mock/include/mock_quick_fix_callback_stub.h index 17b49464e13..835c4a1801e 100644 --- a/test/unittest/quick_fix/mock/include/mock_quick_fix_callback_stub.h +++ b/test/unittest/quick_fix/mock/include/mock_quick_fix_callback_stub.h @@ -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 @@ -24,9 +24,9 @@ namespace AppExecFwk { class MockQuickFixCallbackStub : public QuickFixCallbackStub { public: MOCK_METHOD4(SendRequest, int(uint32_t, MessageParcel&, MessageParcel&, MessageOption&)); - MOCK_METHOD2(OnLoadPatchDone, void(int32_t resultCode, int32_t recordId)); - MOCK_METHOD2(OnUnloadPatchDone, void(int32_t resultCode, int32_t recordId)); - MOCK_METHOD2(OnReloadPageDone, void(int32_t resultCode, int32_t recordId)); + MOCK_METHOD2(OnLoadPatchDone, ErrCode(int32_t resultCode, int32_t recordId)); + MOCK_METHOD2(OnUnloadPatchDone, ErrCode(int32_t resultCode, int32_t recordId)); + MOCK_METHOD2(OnReloadPageDone, ErrCode(int32_t resultCode, int32_t recordId)); int InvokeSendRequest(uint32_t code, MessageParcel& data, MessageParcel& reply, MessageOption& option) { diff --git a/test/unittest/quick_fix/quick_fix_callback_proxy_test/quick_fix_callback_proxy_test.cpp b/test/unittest/quick_fix/quick_fix_callback_proxy_test/quick_fix_callback_proxy_test.cpp index 6c96b8d56c0..c142cbd5b57 100644 --- a/test/unittest/quick_fix/quick_fix_callback_proxy_test/quick_fix_callback_proxy_test.cpp +++ b/test/unittest/quick_fix/quick_fix_callback_proxy_test/quick_fix_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 @@ -74,7 +74,7 @@ HWTEST_F(QuickFixCallbackProxyTest, OnLoadPatchDone_0100, TestSize.Level1) quickFixMgrProxy_->OnLoadPatchDone(resultCode, recordId); EXPECT_EQ(mockCallbackService_->code_, - static_cast(IQuickFixCallback::QuickFixCallbackCmd::ON_NOTIFY_LOAD_PATCH)); + static_cast(IQuickFixCallbackIpcCode::COMMAND_ON_LOAD_PATCH_DONE)); TAG_LOGI(AAFwkTag::TEST, "%{public}s end.", __func__); } @@ -98,7 +98,7 @@ HWTEST_F(QuickFixCallbackProxyTest, OnUnloadPatchDone_0100, TestSize.Level1) quickFixMgrProxy_->OnUnloadPatchDone(resultCode, recordId); EXPECT_EQ(mockCallbackService_->code_, - static_cast(IQuickFixCallback::QuickFixCallbackCmd::ON_NOTIFY_UNLOAD_PATCH)); + static_cast(IQuickFixCallbackIpcCode::COMMAND_ON_UNLOAD_PATCH_DONE)); TAG_LOGI(AAFwkTag::TEST, "%{public}s end.", __func__); } @@ -122,7 +122,7 @@ HWTEST_F(QuickFixCallbackProxyTest, OnReloadPageDone_0100, TestSize.Level1) quickFixMgrProxy_->OnReloadPageDone(resultCode, recordId); EXPECT_EQ(mockCallbackService_->code_, - static_cast(IQuickFixCallback::QuickFixCallbackCmd::ON_NOTIFY_RELOAD_PAGE)); + static_cast(IQuickFixCallbackIpcCode::COMMAND_ON_RELOAD_PAGE_DONE)); TAG_LOGI(AAFwkTag::TEST, "%{public}s end.", __func__); } diff --git a/test/unittest/quick_fix/quick_fix_callback_stub_test/quick_fix_callback_stub_test.cpp b/test/unittest/quick_fix/quick_fix_callback_stub_test/quick_fix_callback_stub_test.cpp index 85ffb70f707..aa558e2e9b5 100644 --- a/test/unittest/quick_fix/quick_fix_callback_stub_test/quick_fix_callback_stub_test.cpp +++ b/test/unittest/quick_fix/quick_fix_callback_stub_test/quick_fix_callback_stub_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 @@ -74,7 +74,7 @@ HWTEST_F(QuickFixCallbackStubTest, OnLoadPatchDone_0100, TestSize.Level1) EXPECT_CALL(*mockQuickFixCallback_, OnLoadPatchDone(_, _)).Times(1); auto result = mockQuickFixCallback_->OnRemoteRequest( - IQuickFixCallback::QuickFixCallbackCmd::ON_NOTIFY_LOAD_PATCH, data, reply, option); + static_cast(IQuickFixCallbackIpcCode::COMMAND_ON_LOAD_PATCH_DONE), data, reply, option); EXPECT_EQ(result, NO_ERROR); TAG_LOGI(AAFwkTag::TEST, "%{public}s end.", __func__); @@ -103,7 +103,7 @@ HWTEST_F(QuickFixCallbackStubTest, OnUnloadPatchDone_0100, TestSize.Level1) EXPECT_CALL(*mockQuickFixCallback_, OnUnloadPatchDone(_, _)).Times(1); auto result = mockQuickFixCallback_->OnRemoteRequest( - IQuickFixCallback::QuickFixCallbackCmd::ON_NOTIFY_UNLOAD_PATCH, data, reply, option); + static_cast(IQuickFixCallbackIpcCode::COMMAND_ON_UNLOAD_PATCH_DONE), data, reply, option); EXPECT_EQ(result, NO_ERROR); TAG_LOGI(AAFwkTag::TEST, "%{public}s end.", __func__); @@ -132,7 +132,7 @@ HWTEST_F(QuickFixCallbackStubTest, OnReloadPageDone_0100, TestSize.Level1) EXPECT_CALL(*mockQuickFixCallback_, OnReloadPageDone(_, _)).Times(1); auto result = mockQuickFixCallback_->OnRemoteRequest( - IQuickFixCallback::QuickFixCallbackCmd::ON_NOTIFY_RELOAD_PAGE, data, reply, option); + static_cast(IQuickFixCallbackIpcCode::COMMAND_ON_RELOAD_PAGE_DONE), data, reply, option); EXPECT_EQ(result, NO_ERROR); TAG_LOGI(AAFwkTag::TEST, "%{public}s end.", __func__); @@ -157,8 +157,8 @@ HWTEST_F(QuickFixCallbackStubTest, OnRemoteRequest_0100, TestSize.Level1) data.WriteInt32(resultCode); auto result = mockQuickFixCallback_->OnRemoteRequest( - IQuickFixCallback::QuickFixCallbackCmd::ON_NOTIFY_LOAD_PATCH, data, reply, option); - EXPECT_EQ(result, ERR_INVALID_STATE); + static_cast(IQuickFixCallbackIpcCode::COMMAND_ON_LOAD_PATCH_DONE), data, reply, option); + EXPECT_EQ(result, ERR_TRANSACTION_FAILED); TAG_LOGI(AAFwkTag::TEST, "%{public}s end.", __func__); } diff --git a/test/unittest/quick_fix/quick_fix_callback_with_record_test/quick_fix_callback_with_record_test.cpp b/test/unittest/quick_fix/quick_fix_callback_with_record_test/quick_fix_callback_with_record_test.cpp index 54aba74a686..5d7a6739dc0 100644 --- a/test/unittest/quick_fix/quick_fix_callback_with_record_test/quick_fix_callback_with_record_test.cpp +++ b/test/unittest/quick_fix/quick_fix_callback_with_record_test/quick_fix_callback_with_record_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 @@ -28,28 +28,31 @@ public: QuickFixCallbackImpl() = default; virtual ~QuickFixCallbackImpl() = default; - void OnLoadPatchDone(int32_t resultCode, [[maybe_unused]] int32_t recordId) override + ErrCode OnLoadPatchDone(int32_t resultCode, [[maybe_unused]] int32_t recordId) override { TAG_LOGD(AAFwkTag::TEST, "function called."); loadPatchDone_ = true; loadPatchResult_ = resultCode; loadPatchTimes_++; + return ERR_OK; } - void OnUnloadPatchDone(int32_t resultCode, [[maybe_unused]] int32_t recordId) override + ErrCode OnUnloadPatchDone(int32_t resultCode, [[maybe_unused]] int32_t recordId) override { TAG_LOGD(AAFwkTag::TEST, "function called."); unloadPatchDone_ = true; unloadPatchResult_ = resultCode; unloadPatchTimes_++; + return ERR_OK; } - void OnReloadPageDone(int32_t resultCode, [[maybe_unused]] int32_t recordId) override + ErrCode OnReloadPageDone(int32_t resultCode, [[maybe_unused]] int32_t recordId) override { TAG_LOGD(AAFwkTag::TEST, "function called."); reloadPageDone_ = true; reloadPageResult_ = resultCode; reloadPageTimes_++; + return ERR_OK; } bool loadPatchDone_ = false; -- Gitee