From 09057af9d0bb0194230bf2c793aab4b5488c244b Mon Sep 17 00:00:00 2001 From: zhangzezhong Date: Thu, 11 Sep 2025 20:18:53 +0800 Subject: [PATCH] fix rpc taihe Signed-off-by: zhangzezhong --- frameworks/ets/ani/ani_common/BUILD.gn | 4 +- .../ani_common/include/ani_common_remote.h | 31 ------------- .../ani/ani_common/src/ani_common_remote.cpp | 43 ------------------- .../ani/ani_common/src/ani_common_want.cpp | 2 +- frameworks/ets/ani/caller_complex/BUILD.gn | 2 +- .../caller_complex/src/ets_caller_complex.cpp | 2 +- .../src/ets_service_extension.cpp | 2 +- .../src/ets_service_extension_context.cpp | 5 +-- .../ui_ability/src/ets_ability_context.cpp | 5 +-- .../ets/ani/ui_ability/src/ets_ui_ability.cpp | 2 +- .../src/ets_ui_extension_context.cpp | 5 +-- frameworks/ets/ani/want/BUILD.gn | 2 +- .../ets/ani/want/src/ani_want_module.cpp | 2 +- frameworks/native/ability/native/BUILD.gn | 8 ++-- 14 files changed, 18 insertions(+), 97 deletions(-) delete mode 100644 frameworks/ets/ani/ani_common/include/ani_common_remote.h delete mode 100644 frameworks/ets/ani/ani_common/src/ani_common_remote.cpp diff --git a/frameworks/ets/ani/ani_common/BUILD.gn b/frameworks/ets/ani/ani_common/BUILD.gn index aa4d97e986e..6ea77a0ed84 100644 --- a/frameworks/ets/ani/ani_common/BUILD.gn +++ b/frameworks/ets/ani/ani_common/BUILD.gn @@ -60,7 +60,6 @@ ohos_shared_library("ani_common") { "src/ets_error_utils.cpp", "src/ets_extension_context.cpp", "src/ets_free_install_observer.cpp", - "src/ani_common_remote.cpp", ] cflags = [] @@ -96,10 +95,9 @@ ohos_shared_library("ani_common") { "hilog:libhilog", "hitrace:hitrace_meter", "image_framework:image_ani", - "ipc:rpc_ani", + "ipc:rpc_taihe", "ipc:ipc_core", "ipc:ipc_napi", - "ipc:rpc_ani", "json:nlohmann_json_static", "napi:ace_napi", "resource_management:global_resmgr", diff --git a/frameworks/ets/ani/ani_common/include/ani_common_remote.h b/frameworks/ets/ani/ani_common/include/ani_common_remote.h deleted file mode 100644 index a8fe380d9d7..00000000000 --- a/frameworks/ets/ani/ani_common/include/ani_common_remote.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef OHOS_ABILITY_RUNTIME_ANI_REMOTE_H -#define OHOS_ABILITY_RUNTIME_ANI_REMOTE_H - -#include "ani.h" -#include "ani_remote_object.h" - -namespace OHOS { -namespace AbilityRuntime { - -class AniRemote { -public: - static ani_object CreateAniRemoteObject(ani_env *env, const sptr target); -}; -} // namespace AbilityRuntime -} // namespace OHOS -#endif // OHOS_ABILITY_RUNTIME_ANI_REMOTE_H \ No newline at end of file diff --git a/frameworks/ets/ani/ani_common/src/ani_common_remote.cpp b/frameworks/ets/ani/ani_common/src/ani_common_remote.cpp deleted file mode 100644 index f74600380b2..00000000000 --- a/frameworks/ets/ani/ani_common/src/ani_common_remote.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "ani_common_remote.h" - -#include "hilog_tag_wrapper.h" - -namespace OHOS { -namespace AbilityRuntime { -ani_object AniRemote::CreateAniRemoteObject(ani_env *env, const sptr target) -{ - ani_status status = ANI_ERROR; - ani_class cls {}; - ani_method method = nullptr; - if ((status = env->FindClass("L@ohos/rpc/rpc/RemoteProxy;", &cls)) != ANI_OK) { - TAG_LOGE(AAFwkTag::ABILITY, "FindClass RemoteProxy: %{public}d", status); - return nullptr; - } - if ((status = env->Class_FindMethod(cls, "", "l:", &method)) != ANI_OK) { - TAG_LOGE(AAFwkTag::ABILITY, "RemoteProxy ctor: %{public}d", status); - return nullptr; - } - ani_object remoteObj = nullptr; - if ((status = env->Object_New(cls, method, &remoteObj, (ani_long)(target.GetRefPtr()))) != ANI_OK) { - TAG_LOGE(AAFwkTag::ABILITY, "RemoteProxy create: %{public}d", status); - return nullptr; - } - return remoteObj; -} -} // namespace AbilityRuntime -} // namespace OHOS \ No newline at end of file diff --git a/frameworks/ets/ani/ani_common/src/ani_common_want.cpp b/frameworks/ets/ani/ani_common/src/ani_common_want.cpp index 9c638af8fb9..e84a544fc1f 100644 --- a/frameworks/ets/ani/ani_common/src/ani_common_want.cpp +++ b/frameworks/ets/ani/ani_common/src/ani_common_want.cpp @@ -15,7 +15,7 @@ #include "ani_common_want.h" #include "ani_common_util.h" -#include "ani_remote_object.h" +#include "remote_object_taihe_ani.h" #include "array_wrapper.h" #include "bool_wrapper.h" #include "byte_wrapper.h" diff --git a/frameworks/ets/ani/caller_complex/BUILD.gn b/frameworks/ets/ani/caller_complex/BUILD.gn index 8f835927e4b..ef58253a976 100644 --- a/frameworks/ets/ani/caller_complex/BUILD.gn +++ b/frameworks/ets/ani/caller_complex/BUILD.gn @@ -49,7 +49,7 @@ ohos_shared_library("caller_complex_ani") { "c_utils:utils", "hilog:libhilog", "ipc:ipc_single", - "ipc:rpc_ani", + "ipc:rpc_taihe", "napi:ace_napi", "runtime_core:ani", "runtime_core:ani_helpers", diff --git a/frameworks/ets/ani/caller_complex/src/ets_caller_complex.cpp b/frameworks/ets/ani/caller_complex/src/ets_caller_complex.cpp index 16983755c59..58d8540e280 100644 --- a/frameworks/ets/ani/caller_complex/src/ets_caller_complex.cpp +++ b/frameworks/ets/ani/caller_complex/src/ets_caller_complex.cpp @@ -17,7 +17,7 @@ #include "ability_business_error.h" #include "ability_runtime/js_caller_complex.h" -#include "ani_remote_object.h" +#include "remote_object_taihe_ani.h" #include "ets_error_utils.h" #include "hilog_tag_wrapper.h" #include "interop_js/arkts_esvalue.h" diff --git a/frameworks/ets/ani/service_extension_ability/src/ets_service_extension.cpp b/frameworks/ets/ani/service_extension_ability/src/ets_service_extension.cpp index c5e26b60281..fc0ad5044d2 100644 --- a/frameworks/ets/ani/service_extension_ability/src/ets_service_extension.cpp +++ b/frameworks/ets/ani/service_extension_ability/src/ets_service_extension.cpp @@ -20,7 +20,7 @@ #include "ability_manager_client.h" #include "ani_common_configuration.h" #include "ani_common_want.h" -#include "ani_remote_object.h" +#include "remote_object_taihe_ani.h" #include "configuration_utils.h" #include "ets_service_extension_context.h" #include "hilog_tag_wrapper.h" diff --git a/frameworks/ets/ani/service_extension_ability/src/ets_service_extension_context.cpp b/frameworks/ets/ani/service_extension_ability/src/ets_service_extension_context.cpp index 965c6196e96..f5c5686f099 100644 --- a/frameworks/ets/ani/service_extension_ability/src/ets_service_extension_context.cpp +++ b/frameworks/ets/ani/service_extension_ability/src/ets_service_extension_context.cpp @@ -16,9 +16,8 @@ #include "ability_manager_client.h" #include "ani_common_start_options.h" -#include "ani_common_remote.h" #include "ani_common_want.h" -#include "ani_remote_object.h" +#include "remote_object_taihe_ani.h" #include "common_fun_ani.h" #include "ets_context_utils.h" #include "ets_error_utils.h" @@ -667,7 +666,7 @@ void ETSServiceExtensionConnection::OnAbilityConnectDone( DetachCurrentThread(); return; } - ani_object refRemoteObject = AniRemote::CreateAniRemoteObject(env, remoteObject); + ani_object refRemoteObject = ANI_ohos_rpc_CreateJsRemoteObject(env, remoteObject); if (refRemoteObject == nullptr) { TAG_LOGE(AAFwkTag::SERVICE_EXT, "null refRemoteObject"); DetachCurrentThread(); diff --git a/frameworks/ets/ani/ui_ability/src/ets_ability_context.cpp b/frameworks/ets/ani/ui_ability/src/ets_ability_context.cpp index 709f81007be..b37a4e3d9e7 100644 --- a/frameworks/ets/ani/ui_ability/src/ets_ability_context.cpp +++ b/frameworks/ets/ani/ui_ability/src/ets_ability_context.cpp @@ -20,10 +20,9 @@ #include "ani_common_ability_result.h" #include "ani_common_configuration.h" #include "ani_common_start_options.h" -#include "ani_common_remote.h" #include "ani_common_want.h" #include "ani_enum_convert.h" -#include "ani_remote_object.h" +#include "remote_object_taihe_ani.h" #include "app_utils.h" #include "common_fun_ani.h" #include "interop_js/arkts_esvalue.h" @@ -1545,7 +1544,7 @@ void ETSAbilityConnection::OnAbilityConnectDone( DetachCurrentThread(); return; } - ani_object refRemoteObject = AniRemote::CreateAniRemoteObject(env, remoteObject); + ani_object refRemoteObject = ANI_ohos_rpc_CreateJsRemoteObject(env, remoteObject); if (refRemoteObject == nullptr) { TAG_LOGE(AAFwkTag::CONTEXT, "null refRemoteObject"); DetachCurrentThread(); diff --git a/frameworks/ets/ani/ui_ability/src/ets_ui_ability.cpp b/frameworks/ets/ani/ui_ability/src/ets_ui_ability.cpp index 6aeb0e9b8a3..d4d6f6eaeb7 100644 --- a/frameworks/ets/ani/ui_ability/src/ets_ui_ability.cpp +++ b/frameworks/ets/ani/ui_ability/src/ets_ui_ability.cpp @@ -21,7 +21,7 @@ #include "ani_common_configuration.h" #include "ani_common_want.h" #include "ani_enum_convert.h" -#include "ani_remote_object.h" +#include "remote_object_taihe_ani.h" #ifdef SUPPORT_SCREEN #include "ani_window_stage.h" #endif diff --git a/frameworks/ets/ani/ui_extension_ability/src/ets_ui_extension_context.cpp b/frameworks/ets/ani/ui_extension_ability/src/ets_ui_extension_context.cpp index d02e40c9dfa..cd6a1df7db1 100644 --- a/frameworks/ets/ani/ui_extension_ability/src/ets_ui_extension_context.cpp +++ b/frameworks/ets/ani/ui_extension_ability/src/ets_ui_extension_context.cpp @@ -17,10 +17,9 @@ #include "ability_manager_client.h" #include "ani_common_ability_result.h" #include "ani_common_start_options.h" -#include "ani_common_remote.h" #include "ani_common_want.h" #include "ani_enum_convert.h" -#include "ani_remote_object.h" +#include "remote_object_taihe_ani.h" #include "common_fun_ani.h" #include "ets_context_utils.h" #include "ets_error_utils.h" @@ -786,7 +785,7 @@ void EtsUIExtensionConnection::OnAbilityConnectDone(const AppExecFwk::ElementNam DetachCurrentThread(); return; } - ani_object refRemoteObject = AniRemote::CreateAniRemoteObject(env, remoteObject); + ani_object refRemoteObject = ANI_ohos_rpc_CreateJsRemoteObject(env, remoteObject); if (refRemoteObject == nullptr) { TAG_LOGE(AAFwkTag::UI_EXT, "null refRemoteObject"); DetachCurrentThread(); diff --git a/frameworks/ets/ani/want/BUILD.gn b/frameworks/ets/ani/want/BUILD.gn index 51e2f6360d1..33017fcaae3 100644 --- a/frameworks/ets/ani/want/BUILD.gn +++ b/frameworks/ets/ani/want/BUILD.gn @@ -42,7 +42,7 @@ ohos_shared_library("want_ani_kit") { "ability_base:base", "c_utils:utils", "hilog:libhilog", - "ipc:rpc_ani", + "ipc:rpc_taihe", "runtime_core:ani", ] diff --git a/frameworks/ets/ani/want/src/ani_want_module.cpp b/frameworks/ets/ani/want/src/ani_want_module.cpp index 1726c10222d..7d8368c2196 100644 --- a/frameworks/ets/ani/want/src/ani_want_module.cpp +++ b/frameworks/ets/ani/want/src/ani_want_module.cpp @@ -16,7 +16,7 @@ #include "ani_want_module.h" #include "ani_common_util.h" -#include "ani_remote_object.h" +#include "remote_object_taihe_ani.h" #include "array_wrapper.h" #include "bool_wrapper.h" #include "double_wrapper.h" diff --git a/frameworks/native/ability/native/BUILD.gn b/frameworks/native/ability/native/BUILD.gn index b4759c3826c..971c17c74e1 100644 --- a/frameworks/native/ability/native/BUILD.gn +++ b/frameworks/native/ability/native/BUILD.gn @@ -930,7 +930,7 @@ ohos_shared_library("ui_ability_ani") { "hitrace:hitrace_meter", "ipc:ipc_core", "ipc:ipc_napi", - "ipc:rpc_ani", + "ipc:rpc_taihe", "resource_management:global_resmgr", "runtime_core:ani", "runtime_core:ani_helpers", @@ -1434,7 +1434,7 @@ ohos_shared_library("service_extension") { "hitrace:hitrace_meter", "ipc:ipc_core", "ipc:ipc_napi", - "ipc:rpc_ani", + "ipc:rpc_taihe", "napi:ace_napi", "safwk:system_ability_fwk", "samgr:samgr_proxy", @@ -1507,7 +1507,7 @@ ohos_shared_library("service_extension_ani") { "hitrace:hitrace_meter", "ipc:ipc_core", "ipc:ipc_napi", - "ipc:rpc_ani", + "ipc:rpc_taihe", "runtime_core:ani", "safwk:system_ability_fwk", "samgr:samgr_proxy", @@ -2153,7 +2153,7 @@ ohos_shared_library("ui_extension_ani") { "hitrace:hitrace_meter", "ipc:ipc_core", "ipc:ipc_napi", - "ipc:rpc_ani", + "ipc:rpc_taihe", "window_manager:embeddablewindowstage_kit", "window_manager:embeddablewindowstageani_kit", "window_manager:extensionwindow_napi", -- Gitee