diff --git a/frameworks/cj/ffi/want_agent/BUILD.gn b/frameworks/cj/ffi/want_agent/BUILD.gn index b6e9447be764c7805cd21f8fecf4fd32a2b3024d..15a0a5b1ee25f0dd05784ab88e1aca7df0bbcfb0 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 d74769b20b175e496d97098d1ad261ef911b9f3f..f1b5aa3883720241b5b2ec9061ecc5212a8f78d3 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 55d58d3ea7abfb7c584459f4181dd618d19c0223..4c1e5dc584b915ce5156c36d7c602e384cb72b0a 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 c9658b81753f9371a938e6f71a55f0b8f1ebf6d0..85d43360b97a1d1af977b71c313c1975ecb8d02e 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 52dc49e2bbd007e7e853a806d03ea747ead6a72e..80564f2c441471c2d4a399319b090f26b5a940b0 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 f2e45b845d61952e3acecd89becabfb8f78c8fbb..63a31421cdb94da7176fcb8835ddae2dce81cd31 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 78c33ca8ff10759c433cbe893e184c8a80e51de8..58548c0a6f62fadf69c4cab446a453d9e30dda78 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 328ac436beb5ffa13a040d16990f663a1fd50c1c..0000000000000000000000000000000000000000 --- 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 784a3d80ebd0adac6f3068dd72910e45292fdb85..0000000000000000000000000000000000000000 --- 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 d2daba0fea1187c280e4c05a74f8f4cbbf4de411..0000000000000000000000000000000000000000 --- 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 9dcf43da589e88a183138c7fa0b118b821724c7f..0000000000000000000000000000000000000000 --- 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 15f2e759cd4cf35d84bc9e503cc45ad7bccd7241..0000000000000000000000000000000000000000 --- 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 96eb5f75048273826efc2a46e4a8075e033262ed..0000000000000000000000000000000000000000 --- 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 ed1c8310efa77ee8a507fb9bb3f9d785c03bddc6..0000000000000000000000000000000000000000 --- 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 e557f4802a542ef4ad49255fad99d2560a72e479..0000000000000000000000000000000000000000 --- 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 b1e9d373d3d8c656be1e22591d06408609ceea4b..fffd9c65b5511747889d6fadd9782af106ee5652 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 9bc66b07c2fc058a1746443ac4414a907518663c..4fc049d8374f095019d457e8db7b7a963f26a827 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 cd64bb9f98a0e1f5ec45d1dfb59799431dc396a6..2a8b666588207e45bb375bb7acbdf5cbcb5ddeb9 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 877e2148924cd9713d584b78dab3f43ec029c5ad..f9e18dbf9048857d410c355cd6d2b07394ab137d 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 86d3df61dedc32091e3f3a4f346294cb7a5f116d..7235fc4bf3882b7ffa14bdc13bd82894b7294ad1 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 99dd0a835c078a9a55e37d539c269fb7731b939f..294e9dfc6fab7b884af9a27e24589e804fc529b9 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 99dd0a835c078a9a55e37d539c269fb7731b939f..092f5af6c200c24ccc047127eac7ebc630088732 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 9a3c1e9e3ed30f6138aa90577216a64a8df50dff..c5ab7ef287717a70305ad9e067c45837b57e1516 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 77a731074b6b320a6cabb32eccb7add4e2f0c7f8..678239368c0e65dd87d491f0c4de9f257f75928d 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 4265e2f8404f9b24b02efeb3a1434e015ddd1c68..afb0243fae84b79c4a07f887cea582fa0eb3acc9 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 027540709f7d4abed631aac169cb92831db4f14f..980656987901b8618b2b05bd2190e8a33bcfafce 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 580be23be0891508790ce10ebf65e7050a619822..d2b361c0b3101d46c764adc5cc7482a4bc612d9b 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 dcc5295348fe9d358b0fb4d80ccc62d38e5e7249..355a0d846fc0332dd4dea7389e5f8b525aa4d8eb 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 a76ce33ce28c21a19d21319feeb2f433c99a6332..06998bf3a742c474b7d12d292dc05b4b6afd3a0e 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 2ac11e3423a5afa901e5ef8d0c3c2e3170688f15..ad8b946b92ed6ba1c7a5d1745673579eae51bfd2 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 4643203e841cb72772a88b8767c2171b76caa526..9346c35a91700147d1da815e6f7ee81c9b2c9ebc 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 7cc6e045531900f5d0443139a9a4709d7a0a7cb6..d6a23ffc789281cfb2cb5f625701ea2ef54b58a2 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 0ccd59da340acb6fc77512df998d32f9cdfd41e0..1a7bf5872b21a29a8e2fed62209643b39eec3f87 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 b65ae0f706e19f3b0078938205fa9ffde082f0c6..3b749f1c9c038fb42c9219c37f49a346b7735cf5 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 c253b23dbea5630f3ca2a10e3e0d60983269646c..630de5990303ffc72015be042a543a86e323ffaf 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 afeaf72e9b72941380af9f2bc9343a973e9e07a4..bfbdecfedb33219e80e3161923ff755dd0cebc36 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 ac1a95f76c51656967ecc7842c3d7bf4d3bb0a8d..4541ef621540aead2f34f14dde52be3c9f245562 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 7d977ca14785d8bdd9e5f2bf001f48a3bcf0deb2..1b119fb9764edff6b9c94cb57ad5c1fa02b8a499 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 bea5089ae746e30037f88870954e304eaa757e26..88354ac601600789590b07a133619504970f9b41 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 17b49464e13097538fb427fb4da989b48a3c7b19..835c4a1801e9994aa6784dad3279d926f8d7fbe5 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 6c96b8d56c08f1736b01daa7af50d9567bb46c27..c142cbd5b5797db0e0cc712d10501e18618a18b1 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 85ffb70f707656363ae402891c265c189f48c897..aa558e2e9b5961df7710f2992ba6c854ed0e662c 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 54aba74a6869be7435c79e2cfd206a896acf467c..5d7a6739dc094b376832e2a1c4774201c96256c9 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;