diff --git a/frameworks/native/child_process/include/native_child_callback.h b/frameworks/native/child_process/include/native_child_callback.h index 128ef026e504fe182fefc6121ab626abb5fc4a27..c13e68d8d0205190658b4919bd20733fec83359e 100644 --- a/frameworks/native/child_process/include/native_child_callback.h +++ b/frameworks/native/child_process/include/native_child_callback.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 @@ -29,9 +29,9 @@ public: explicit NativeChildCallback(OH_Ability_OnNativeChildProcessStarted cb); ~NativeChildCallback() = default; - void OnNativeChildStarted(const sptr &nativeChild) override; - void OnError(int32_t errCode) override; - int32_t OnNativeChildExit(int32_t pid, int32_t signal) override; + ErrCode OnNativeChildStarted(const sptr &nativeChild) override; + ErrCode OnError(int32_t errCode) override; + ErrCode OnNativeChildExit(int32_t pid, int32_t signal) override; bool IsCallbacksEmpty(); void AddExitCallback(OH_Ability_OnNativeChildProcessExit callback); diff --git a/frameworks/native/child_process/src/native_child_callback.cpp b/frameworks/native/child_process/src/native_child_callback.cpp index 86e451643422f67d45353c6f571e3d5dc2d6d5fc..95a743ba6be1adde7ebeb3837752567ef67c98dc 100644 --- a/frameworks/native/child_process/src/native_child_callback.cpp +++ b/frameworks/native/child_process/src/native_child_callback.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 @@ -26,16 +26,16 @@ NativeChildCallback::NativeChildCallback(OH_Ability_OnNativeChildProcessStarted { } -void NativeChildCallback::OnNativeChildStarted(const sptr &nativeChild) +ErrCode NativeChildCallback::OnNativeChildStarted(const sptr &nativeChild) { if (callback_ == nullptr) { TAG_LOGE(AAFwkTag::PROCESSMGR, "null callback_"); - return; + return ERR_INVALID_VALUE; } if (!nativeChild) { TAG_LOGE(AAFwkTag::PROCESSMGR, "null nativeChild"); - return; + return ERR_INVALID_VALUE; } TAG_LOGI(AAFwkTag::PROCESSMGR, "Native child process started"); @@ -44,20 +44,21 @@ void NativeChildCallback::OnNativeChildStarted(const sptr &native if (ipcProxy == nullptr) { TAG_LOGE(AAFwkTag::PROCESSMGR, "null ipcProxy"); callback_(NCP_ERR_INTERNAL, nullptr); - return; + return ERR_INVALID_VALUE; } callback_(static_cast(ChildProcessManagerErrorCode::ERR_OK), ipcProxy); callback_ = nullptr; ChildCallbackManager::GetInstance().RemoveRemoteObject(this); + return ERR_OK; } -void NativeChildCallback::OnError(int32_t errCode) +ErrCode NativeChildCallback::OnError(int32_t errCode) { if (callback_ == nullptr) { TAG_LOGE(AAFwkTag::PROCESSMGR, "null callback_"); - return; + return ERR_INVALID_VALUE; } TAG_LOGI(AAFwkTag::PROCESSMGR, "Native child process start err %{public}d", errCode); @@ -65,9 +66,10 @@ void NativeChildCallback::OnError(int32_t errCode) callback_ = nullptr; ChildCallbackManager::GetInstance().RemoveRemoteObject(this); + return ERR_OK; } -int32_t NativeChildCallback::OnNativeChildExit(int32_t pid, int32_t signal) +ErrCode NativeChildCallback::OnNativeChildExit(int32_t pid, int32_t signal) { auto exitCallbacks = GetExitCallbacks(); for (const auto &exitCallback : exitCallbacks) { diff --git a/interfaces/inner_api/app_manager/BUILD.gn b/interfaces/inner_api/app_manager/BUILD.gn index 59318b86d696ecc230586dab81c63f9db0e2327e..d9c9bdf700f91f41458661eb06e2a2a8732a49e6 100644 --- a/interfaces/inner_api/app_manager/BUILD.gn +++ b/interfaces/inner_api/app_manager/BUILD.gn @@ -45,6 +45,9 @@ idl_gen_interface("appmgr_innerkits") { sources = [ "idl/IAbilityDebugResponse.idl", "idl/IAppDebugListener.idl", + "idl/IKiaInterceptor.idl", + "idl/INativeChildNotify.idl", + "idl/IQuickFixCallback.idl", "idl/IStartSpecifiedAbilityResponse.idl", ] log_domainid = "0xD001311" @@ -202,20 +205,14 @@ 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_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", 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/native_child_notify_stub.h b/interfaces/inner_api/app_manager/idl/INativeChildNotify.idl similarity index 38% rename from interfaces/inner_api/app_manager/include/appmgr/native_child_notify_stub.h rename to interfaces/inner_api/app_manager/idl/INativeChildNotify.idl index e81ad08281f066a910bf1bc832f0ffa896bcc370..496990474684d54a8a27c2edd25527e2b718f109 100644 --- a/interfaces/inner_api/app_manager/include/appmgr/native_child_notify_stub.h +++ b/interfaces/inner_api/app_manager/idl/INativeChildNotify.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,30 +13,10 @@ * limitations under the License. */ -#ifndef OHOS_ABILITY_RUNTIME_NATIVE_CHILD_NOTIFY_STUB_H -#define OHOS_ABILITY_RUNTIME_NATIVE_CHILD_NOTIFY_STUB_H +sequenceable OHOS.IRemoteObject; -#include "native_child_notify_interface.h" -#include "iremote_stub.h" - -namespace OHOS { -namespace AppExecFwk { - -class NativeChildNotifyStub : public IRemoteStub { -public: - NativeChildNotifyStub() = default; - virtual ~NativeChildNotifyStub() = default; - - int OnRemoteRequest( - uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; - -private: - int32_t HandleOnNativeChildStarted(MessageParcel &data, MessageParcel &reply); - int32_t HandleOnError(MessageParcel &data, MessageParcel &reply); - int32_t HandleOnNativeChildExit(MessageParcel &data, MessageParcel &reply); -}; - -} // OHOS -} // AppExecFwk - -#endif // OHOS_ABILITY_RUNTIME_NATIVE_CHILD_NOTIFY_STUB_H \ No newline at end of file +interface OHOS.AppExecFwk.INativeChildNotify { + [oneway] void OnNativeChildStarted([in] IRemoteObject nativeChild); + [oneway] void OnError([in] int errorCode); + [oneway] void OnNativeChildExit([in] int pid, [in] int signal); +}; \ 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 f0d1dbfabbf912a084e45c7843e572d219179b4a..677b1e28794777185022cc60636ff1f7c4360838 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 @@ -32,10 +32,11 @@ #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 "inative_child_notify.h" +#include "ikia_interceptor.h" #include "iquick_fix_callback.h" #include "iremote_broker.h" #include "iremote_object.h" @@ -51,7 +52,6 @@ #include "app_jsheap_mem_info.h" #include "app_cjheap_mem_info.h" #include "running_multi_info.h" -#include "native_child_notify_interface.h" namespace OHOS { namespace AppExecFwk { 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/native_child_notify_interface.h b/interfaces/inner_api/app_manager/include/appmgr/native_child_notify_interface.h deleted file mode 100644 index 3eba849f17f2c7eace96039793fa91017db33727..0000000000000000000000000000000000000000 --- a/interfaces/inner_api/app_manager/include/appmgr/native_child_notify_interface.h +++ /dev/null @@ -1,65 +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_NATIVE_CHILD_NOTIFY_INTERFACE_H -#define OHOS_ABILITY_RUNTIME_NATIVE_CHILD_NOTIFY_INTERFACE_H - -#include "iremote_broker.h" - -namespace OHOS { -namespace AppExecFwk { - -class INativeChildNotify : public IRemoteBroker { -public: - DECLARE_INTERFACE_DESCRIPTOR(u"ohos.appexecfwk.NativeChildNotify"); - - /** - * Notify native child process started. - * - * @param nativeChild child process ipc object - */ - virtual void OnNativeChildStarted(const sptr &nativeChild) = 0; - - /** - * Notify native child process start failed. - * - * @param errCode failed error code - */ - virtual void OnError(int32_t errCode) = 0; - - /** - * Notify native child process exit. - * - * @param pid child process pid - * @param signal child process exit signal - * @return Returns ERR_OK on success, others on failure. - */ - virtual int32_t OnNativeChildExit(int32_t pid, int32_t signal) = 0; - - enum { - // ipc id for OnNativeChildStarted - IPC_ID_ON_NATIVE_CHILD_STARTED = 0, - - // ipc id for OnError - IPC_ID_ON_ERROR = 1, - - IPC_ID_ON_NATIVE_CHILD_EXIT = 2 - }; -}; - -} // OHOS -} // AppExecFwk - -#endif // OHOS_ABILITY_RUNTIME_NATIVE_CHILD_NOTIFY_INTERFACE_H \ No newline at end of file diff --git a/interfaces/inner_api/app_manager/include/appmgr/native_child_notify_proxy.h b/interfaces/inner_api/app_manager/include/appmgr/native_child_notify_proxy.h deleted file mode 100644 index d843439fb1e2938a7016f0c5bf2fa25e8b6aef95..0000000000000000000000000000000000000000 --- a/interfaces/inner_api/app_manager/include/appmgr/native_child_notify_proxy.h +++ /dev/null @@ -1,44 +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_NATIVE_CHILD_NOTIFY_PROXY_H -#define OHOS_ABILITY_RUNTIME_NATIVE_CHILD_NOTIFY_PROXY_H - -#include "native_child_notify_interface.h" -#include "iremote_proxy.h" - -namespace OHOS { -namespace AppExecFwk { - -class NativeChildNotifyProxy : public IRemoteProxy { -public: - explicit NativeChildNotifyProxy(const sptr &impl); - virtual ~NativeChildNotifyProxy() = default; - - void OnNativeChildStarted(const sptr &nativeChild) override; - void OnError(int32_t errCode) override; - int32_t OnNativeChildExit(int32_t pid, int32_t signal) override; - -private: - bool WriteInterfaceToken(MessageParcel &data); - int32_t SendRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption& option); - - static inline BrokerDelegator delegator_; -}; - -} // OHOS -} // AppExecFwk - -#endif // OHOS_ABILITY_RUNTIME_NATIVE_CHILD_NOTIFY_PROXY_H \ No newline at end of file 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/native_child_notify_proxy.cpp b/interfaces/inner_api/app_manager/src/appmgr/native_child_notify_proxy.cpp deleted file mode 100644 index 533799eaa6a49e3ad5266d3bd6c4d3261808bc6c..0000000000000000000000000000000000000000 --- a/interfaces/inner_api/app_manager/src/appmgr/native_child_notify_proxy.cpp +++ /dev/null @@ -1,116 +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 "native_child_notify_proxy.h" -#include "hilog_tag_wrapper.h" -#include "ipc_types.h" - -namespace OHOS { -namespace AppExecFwk { - -NativeChildNotifyProxy::NativeChildNotifyProxy(const sptr &impl) - : IRemoteProxy(impl) -{ -} - -bool NativeChildNotifyProxy::WriteInterfaceToken(MessageParcel &data) -{ - if (!data.WriteInterfaceToken(NativeChildNotifyProxy::GetDescriptor())) { - TAG_LOGE(AAFwkTag::APPMGR, "NativeChildNotifyProxy write interface token failed"); - return false; - } - - return true; -} - -int32_t NativeChildNotifyProxy::SendRequest(uint32_t code, MessageParcel &data, - MessageParcel &reply, MessageOption& option) -{ - sptr remote = Remote(); - if (!remote) { - TAG_LOGE(AAFwkTag::APPMGR, "NativeChildNotifyProxy get remote object failed"); - return ERR_NULL_OBJECT; - } - - int32_t ret = remote->SendRequest(code, data, reply, option); - if (ret != NO_ERROR) { - TAG_LOGE(AAFwkTag::APPMGR, "NativeChildNotifyProxy SendRequest failed(%{public}d)", ret); - return ret; - } - - return NO_ERROR; -} - -void NativeChildNotifyProxy::OnNativeChildStarted(const sptr &nativeChild) -{ - TAG_LOGD(AAFwkTag::APPMGR, "NativeChildNotifyProxy OnNativeChildStarted"); - MessageParcel data; - MessageParcel reply; - MessageOption option(MessageOption::TF_ASYNC); - if (!WriteInterfaceToken(data)) { - return; - } - - if (!data.WriteRemoteObject(nativeChild)) { - TAG_LOGE(AAFwkTag::APPMGR, "NativeChildNotifyProxy write native child ipc object failed."); - return; - } - - SendRequest(INativeChildNotify::IPC_ID_ON_NATIVE_CHILD_STARTED, data, reply, option); -} - -void NativeChildNotifyProxy::OnError(int32_t errCode) -{ - TAG_LOGD(AAFwkTag::APPMGR, "NativeChildNotifyProxy OnError(%{public}d)", errCode); - MessageParcel data; - MessageParcel reply; - MessageOption option(MessageOption::TF_ASYNC); - if (!WriteInterfaceToken(data)) { - return; - } - - if (!data.WriteInt32(errCode)) { - TAG_LOGE(AAFwkTag::APPMGR, "NativeChildNotifyProxy write error code failed."); - return; - } - - SendRequest(INativeChildNotify::IPC_ID_ON_ERROR, data, reply, option); -} - -int32_t NativeChildNotifyProxy::OnNativeChildExit(int32_t pid, int32_t signal) -{ - TAG_LOGD(AAFwkTag::APPMGR, "NativeChildNotifyProxy OnNativeChildExit"); - MessageParcel data; - MessageParcel reply; - MessageOption option(MessageOption::TF_ASYNC); - if (!WriteInterfaceToken(data)) { - return ERR_NULL_OBJECT; - } - - if (!data.WriteInt32(pid)) { - TAG_LOGE(AAFwkTag::APPMGR, "NativeChildNotifyProxy write native child pid failed."); - return ERR_NULL_OBJECT; - } - - if (!data.WriteInt32(signal)) { - TAG_LOGE(AAFwkTag::APPMGR, "NativeChildNotifyProxy write native child signal failed."); - return ERR_NULL_OBJECT; - } - - return SendRequest(INativeChildNotify::IPC_ID_ON_NATIVE_CHILD_EXIT, data, reply, option); -} - -} // OHOS -} // AppExecFwk \ No newline at end of file diff --git a/interfaces/inner_api/app_manager/src/appmgr/native_child_notify_stub.cpp b/interfaces/inner_api/app_manager/src/appmgr/native_child_notify_stub.cpp deleted file mode 100644 index 7d1e49251544887d8822facead7fa5e820d8fbd0..0000000000000000000000000000000000000000 --- a/interfaces/inner_api/app_manager/src/appmgr/native_child_notify_stub.cpp +++ /dev/null @@ -1,81 +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 "native_child_notify_stub.h" -#include "hilog_tag_wrapper.h" -#include "ipc_types.h" - -namespace OHOS { -namespace AppExecFwk { - -int NativeChildNotifyStub::OnRemoteRequest(uint32_t code, MessageParcel &data, - MessageParcel &reply, MessageOption &option) -{ - TAG_LOGD(AAFwkTag::APPMGR, "NativeChildNotifyStub::OnRemoteRequest, code=%{public}u, flags=%{public}d.", - code, option.GetFlags()); - std::u16string descriptor = NativeChildNotifyStub::GetDescriptor(); - std::u16string remoteDesc = data.ReadInterfaceToken(); - if (descriptor != remoteDesc) { - TAG_LOGE(AAFwkTag::APPMGR, "A local descriptor is not equivalent to a remote"); - return ERR_INVALID_STATE; - } - - int32_t ret; - switch (code) { - case INativeChildNotify::IPC_ID_ON_NATIVE_CHILD_STARTED: - ret = HandleOnNativeChildStarted(data, reply); - break; - - case INativeChildNotify::IPC_ID_ON_NATIVE_CHILD_EXIT: - ret = HandleOnNativeChildExit(data, reply); - break; - - case INativeChildNotify::IPC_ID_ON_ERROR: - ret = HandleOnError(data, reply); - break; - - default: - TAG_LOGW(AAFwkTag::APPMGR, "NativeChildNotifyStub Unknow ipc call(%{public}u)", code); - ret = IPCObjectStub::OnRemoteRequest(code, data, reply, option); - break; - } - - TAG_LOGD(AAFwkTag::APPMGR, "NativeChildNotifyStub::OnRemoteRequest end"); - return ret; -} - -int32_t NativeChildNotifyStub::HandleOnNativeChildStarted(MessageParcel &data, MessageParcel &reply) -{ - sptr cb = data.ReadRemoteObject(); - OnNativeChildStarted(cb); - return ERR_NONE; -} - -int32_t NativeChildNotifyStub::HandleOnNativeChildExit(MessageParcel &data, MessageParcel &reply) -{ - int pid = data.ReadInt32(); - int signal = data.ReadInt32(); - return OnNativeChildExit(pid, signal); -} - -int32_t NativeChildNotifyStub::HandleOnError(MessageParcel &data, MessageParcel &reply) -{ - int32_t err = data.ReadInt32(); - OnError(err); - return ERR_NONE; -} - -} // OHOS -} // AppExecFwk 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/child_process_manager/include/native_child_ipc_process.h b/interfaces/inner_api/child_process_manager/include/native_child_ipc_process.h index 5a007069e87a215803738223958fb1eb2edb77e5..f69b5fb9144b1bf03636891c8d6da1bf8eed749f 100644 --- a/interfaces/inner_api/child_process_manager/include/native_child_ipc_process.h +++ b/interfaces/inner_api/child_process_manager/include/native_child_ipc_process.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 #include "child_process.h" -#include "native_child_notify_interface.h" +#include "inative_child_notify.h" #include "ipc_inner_object.h" namespace OHOS { diff --git a/services/appmgr/include/app_mgr_service_inner.h b/services/appmgr/include/app_mgr_service_inner.h index 4f4588802e2f10fd120223cd4dad8da384b76e64..0437ca56d8884d0957645c9644d10007db92e75d 100644 --- a/services/appmgr/include/app_mgr_service_inner.h +++ b/services/appmgr/include/app_mgr_service_inner.h @@ -61,10 +61,11 @@ #include "iapp_state_callback.h" #include "iapplication_state_observer.h" #include "iconfiguration_observer.h" +#include "ikia_interceptor.h" +#include "inative_child_notify.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" @@ -82,7 +83,6 @@ #include "running_multi_info.h" #include "multi_user_config_mgr.h" #include "iuser_callback.h" -#include "native_child_notify_interface.h" namespace OHOS { namespace AbilityRuntime { diff --git a/services/appmgr/include/app_native_spawn_manager.h b/services/appmgr/include/app_native_spawn_manager.h index 31f4a2793c73353edc93a1ed093259274daca8db..0fcfd4153ecdd4910f9b989724399031cd673bfe 100644 --- a/services/appmgr/include/app_native_spawn_manager.h +++ b/services/appmgr/include/app_native_spawn_manager.h @@ -20,7 +20,7 @@ #include #include "nocopyable.h" #include "app_running_manager.h" -#include "native_child_notify_interface.h" +#include "inative_child_notify.h" namespace OHOS { namespace AppExecFwk { 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/fuzztest/abilityinterfacesappmgrnativechildnotifyproxy_fuzzer/abilityinterfacesappmgrnativechildnotifyproxy_fuzzer.cpp b/test/fuzztest/abilityinterfacesappmgrnativechildnotifyproxy_fuzzer/abilityinterfacesappmgrnativechildnotifyproxy_fuzzer.cpp index 0a571fa70c90061c765a4c90103997ff74b4cb92..3b8a5210b42f769469e9e647028e18dec6e8079d 100644 --- a/test/fuzztest/abilityinterfacesappmgrnativechildnotifyproxy_fuzzer/abilityinterfacesappmgrnativechildnotifyproxy_fuzzer.cpp +++ b/test/fuzztest/abilityinterfacesappmgrnativechildnotifyproxy_fuzzer/abilityinterfacesappmgrnativechildnotifyproxy_fuzzer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2024-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -19,8 +19,8 @@ #include #define private public +#include "inative_child_notify.h" #include "native_child_notify_proxy.h" -#include "native_child_notify_interface.h" #undef private #include "securec.h" @@ -72,21 +72,6 @@ bool DoSomethingInterestingWithMyAPI(const char* data, size_t size) infosProxy->OnNativeChildStarted(nativeChild); int32_t errCode = static_cast(GetU32Data(data)); infosProxy->OnError(errCode); - MessageParcel parcel; - parcel.WriteInterfaceToken(AMSMGR_INTERFACE_TOKEN); - parcel.WriteBuffer(data, size); - parcel.RewindRead(0); - MessageParcel parcels; - parcels.WriteInterfaceToken(AMSMGR_INTERFACE_TOKEN); - parcels.WriteBuffer(data, size); - parcels.RewindRead(0); - infosProxy->WriteInterfaceToken(parcels); - uint32_t codeOne = static_cast(INPUT_ZERO); - MessageParcel reply; - MessageOption option; - infosProxy->SendRequest(codeOne, parcel, reply, option); - uint32_t codeTwo = static_cast(INPUT_ONE); - infosProxy->SendRequest(codeTwo, parcel, reply, option); return true; } } diff --git a/test/fuzztest/abilityinterfacesappmgrnativechildnotifystub_fuzzer/abilityinterfacesappmgrnativechildnotifystub_fuzzer.cpp b/test/fuzztest/abilityinterfacesappmgrnativechildnotifystub_fuzzer/abilityinterfacesappmgrnativechildnotifystub_fuzzer.cpp index ac67588a931237589c45bd4df7d94419c08e12ad..68361148c332a9b9c0cd60ba35d63ba86667bb16 100644 --- a/test/fuzztest/abilityinterfacesappmgrnativechildnotifystub_fuzzer/abilityinterfacesappmgrnativechildnotifystub_fuzzer.cpp +++ b/test/fuzztest/abilityinterfacesappmgrnativechildnotifystub_fuzzer/abilityinterfacesappmgrnativechildnotifystub_fuzzer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2024-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -20,8 +20,8 @@ #define private public #define protected public +#include "inative_child_notify.h" #include "native_child_notify_stub.h" -#include "native_child_notify_interface.h" #undef protected #undef private @@ -58,9 +58,18 @@ public: virtual ~ NativeChildNotifyStubFUZZ() {}; int OnRemoteRequest( uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override{ return 0; }; - void OnNativeChildStarted(const sptr &nativeChild) override{}; - void OnError(int32_t errCode) override{}; - int32_t OnNativeChildExit(int32_t pid, int32_t signal) override{ return 0; }; + ErrCode OnNativeChildStarted(const sptr &nativeChild) override + { + return ERR_OK; + } + ErrCode OnError(int32_t errCode) override + { + return ERR_OK; + } + ErrCode OnNativeChildExit(int32_t pid, int32_t signal) override + { + return ERR_OK; + } }; sptr GetFuzzAbilityToken() @@ -79,7 +88,7 @@ sptr GetFuzzAbilityToken() bool DoSomethingInterestingWithMyAPI(const char* data, size_t size) { - uint32_t code = static_cast(INativeChildNotify::IPC_ID_ON_NATIVE_CHILD_STARTED); + uint32_t code = static_cast(INativeChildNotifyIpcCode::COMMAND_ON_NATIVE_CHILD_STARTED); MessageParcel parcel; parcel.WriteInterfaceToken(NATIVE_CHILD_NOTIFY_TOKEN); parcel.WriteBuffer(data, size); @@ -88,7 +97,7 @@ bool DoSomethingInterestingWithMyAPI(const char* data, size_t size) MessageOption option; std::shared_ptr abms = std::make_shared(); abms->OnRemoteRequest(code, parcel, reply, option); - code = static_cast(INativeChildNotify::IPC_ID_ON_ERROR); + code = static_cast(INativeChildNotifyIpcCode::COMMAND_ON_ERROR); abms->OnRemoteRequest(code, parcel, reply, option); return true; } diff --git a/test/fuzztest/cleanallmissions_fuzzer/BUILD.gn b/test/fuzztest/cleanallmissions_fuzzer/BUILD.gn index 0f2a26569e1841ef0f3031c5524b8b1898a83948..d5fa5ab70671648f9cd4b60b788e055c6b0ef7f7 100755 --- a/test/fuzztest/cleanallmissions_fuzzer/BUILD.gn +++ b/test/fuzztest/cleanallmissions_fuzzer/BUILD.gn @@ -38,7 +38,10 @@ ohos_fuzztest("CleanAllMissionsFuzzTest") { "${ability_runtime_services_path}/abilitymgr:abilityms_config", ] - deps = [ "${ability_runtime_innerkits_path}/ability_manager:ability_manager" ] + deps = [ + "${ability_runtime_innerkits_path}/ability_manager:ability_manager_innerkits", + "${ability_runtime_innerkits_path}/ability_manager:ability_manager" , + ] external_deps = [ "ability_base:want", @@ -46,6 +49,7 @@ ohos_fuzztest("CleanAllMissionsFuzzTest") { "ability_runtime:app_manager", "c_utils:utils", "eventhandler:libeventhandler", + "hilog:libhilog", "ipc:ipc_core", "jsoncpp:jsoncpp", "relational_store:native_dataability", 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/ui_extension_ability_test/ui_extension_stability_test/BUILD.gn b/test/moduletest/ui_extension_ability_test/ui_extension_stability_test/BUILD.gn index 235ec854fbb1a88417c79950a8e452651d92ad09..ae347347ccb2360e144b20f9eddecced99500292 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/BUILD.gn b/test/unittest/BUILD.gn index 88c49ffabd1c02478f8f28cef43f7d8a446f3d25..56ca4fa8c83c1573bf757d095ed662a4f72b7514 100644 --- a/test/unittest/BUILD.gn +++ b/test/unittest/BUILD.gn @@ -43,8 +43,6 @@ ohos_source_set("appmgr_test_source") { "${ability_runtime_innerkits_path}/app_manager/src/appmgr/app_scheduler_host.cpp", "${ability_runtime_innerkits_path}/app_manager/src/appmgr/app_scheduler_proxy.cpp", "${ability_runtime_innerkits_path}/app_manager/src/appmgr/fault_data.cpp", - "${ability_runtime_innerkits_path}/app_manager/src/appmgr/native_child_notify_proxy.cpp", - "${ability_runtime_innerkits_path}/app_manager/src/appmgr/native_child_notify_stub.cpp", "${ability_runtime_innerkits_path}/app_manager/src/appmgr/process_info.cpp", "${ability_runtime_innerkits_path}/app_manager/src/appmgr/profile.cpp", "${ability_runtime_innerkits_path}/app_manager/src/appmgr/render_scheduler_host.cpp", diff --git a/test/unittest/ams_ipc_interface_test/BUILD.gn b/test/unittest/ams_ipc_interface_test/BUILD.gn index 4265e2f8404f9b24b02efeb3a1434e015ddd1c68..f794cca64ccfad98eec28b1d7b6fc94da483218b 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,11 @@ 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/ams_ipc_interface_test/ams_ipc_appmgr_interface_test.cpp b/test/unittest/ams_ipc_interface_test/ams_ipc_appmgr_interface_test.cpp index f12b91f70f0075cdee33a2b1804e0711e77bd3ec..6372eb3d018a914c79611163a73029b1a4be5f70 100644 --- a/test/unittest/ams_ipc_interface_test/ams_ipc_appmgr_interface_test.cpp +++ b/test/unittest/ams_ipc_interface_test/ams_ipc_appmgr_interface_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -45,9 +45,18 @@ public: NativeChildCallbackMock() = default; virtual ~NativeChildCallbackMock() = default; - void OnNativeChildStarted(const sptr &nativeChild) {} - void OnError(int32_t errCode) {} - int32_t OnNativeChildExit(int32_t pid, int32_t signal) { return 0; } + ErrCode OnNativeChildStarted(const sptr &nativeChild) + { + return ERR_OK; + } + ErrCode OnError(int32_t errCode) + { + return ERR_OK; + } + ErrCode OnNativeChildExit(int32_t pid, int32_t signal) + { + return ERR_OK; + } }; class AmsIpcAppMgrInterfaceTest : public testing::Test { 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_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 d6b2b7fe7bf553b35e2420ea3da08e4cca671452..a683251b8bccc99ecbe73aacddda6243093ec6e8 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_mgr_stub_test/app_mgr_stub_test.cpp b/test/unittest/app_mgr_stub_test/app_mgr_stub_test.cpp index 7cdbab6100cb6b8934dde76ddf2957e339c410c8..1de9b86baf1e0818f3958c50a8c2d553e729f595 100644 --- a/test/unittest/app_mgr_stub_test/app_mgr_stub_test.cpp +++ b/test/unittest/app_mgr_stub_test/app_mgr_stub_test.cpp @@ -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 @@ -58,9 +58,18 @@ public: NativeChildCallbackMock() = default; virtual ~NativeChildCallbackMock() = default; - void OnNativeChildStarted(const sptr &nativeChild) {} - void OnError(int32_t errCode) {} - int32_t OnNativeChildExit(int32_t pid, int32_t signal) { return 0; } + ErrCode OnNativeChildStarted(const sptr &nativeChild) + { + return ERR_OK; + } + ErrCode OnError(int32_t errCode) + { + return ERR_OK; + } + ErrCode OnNativeChildExit(int32_t pid, int32_t signal) + { + return ERR_OK; + } }; class AppMgrStubTest : public testing::Test { 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/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;