From 8f5f62a4c10a99c413f81dd32e4bdb5b21f95cc7 Mon Sep 17 00:00:00 2001 From: Otto Eotvos Date: Mon, 25 Aug 2025 11:13:50 +0200 Subject: [PATCH] Update hardcoded names affected by name mangling Issue: https://gitee.com/openharmony/bundlemanager_bundle_framework/issues/ICULGE Description: Swap hard-coded names to API calls when interacting with ANI. Signed-off-by: Otto Eotvos Change-Id: I8700f2949209a5eedc706368395ec1311e0955ff --- interfaces/kits/ani/common/BUILD.gn | 4 ++++ interfaces/kits/ani/common/common_fun_ani.cpp | 3 +-- interfaces/kits/ani/common/common_fun_ani.h | 10 ++++++---- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/interfaces/kits/ani/common/BUILD.gn b/interfaces/kits/ani/common/BUILD.gn index febafb002b..bea607aa8e 100644 --- a/interfaces/kits/ani/common/BUILD.gn +++ b/interfaces/kits/ani/common/BUILD.gn @@ -73,6 +73,10 @@ ohos_shared_library("bms_ani_common") { "samgr:samgr_proxy", ] + public_external_deps = [ + "runtime_core:ani_helpers" + ] + subsystem_name = "bundlemanager" part_name = "bundle_framework" } diff --git a/interfaces/kits/ani/common/common_fun_ani.cpp b/interfaces/kits/ani/common/common_fun_ani.cpp index 885090a7d3..60abfb1dab 100644 --- a/interfaces/kits/ani/common/common_fun_ani.cpp +++ b/interfaces/kits/ani/common/common_fun_ani.cpp @@ -17,7 +17,6 @@ #include #include -#include "ani_signature_builder.h" #include "app_log_wrapper.h" #include "common_fun_ani.h" @@ -3047,4 +3046,4 @@ bool CommonFunAni::ParseElementName(ani_env* env, ani_object object, ElementName return true; } } // namespace AppExecFwk -} // namespace OHOS \ No newline at end of file +} // namespace OHOS diff --git a/interfaces/kits/ani/common/common_fun_ani.h b/interfaces/kits/ani/common/common_fun_ani.h index c32848c0d5..09c29e74fe 100644 --- a/interfaces/kits/ani/common/common_fun_ani.h +++ b/interfaces/kits/ani/common/common_fun_ani.h @@ -30,10 +30,12 @@ #include "enum_util.h" #include "install_param.h" #include "launcher_ability_info.h" +#include namespace OHOS { namespace AppExecFwk { using Want = OHOS::AAFwk::Want; +using namespace arkts::ani_signature; namespace CommonFunAniNS { constexpr const char* PROPERTYNAME_UNBOXED = "unboxed"; } // namespace CommonFunAniNS @@ -230,6 +232,7 @@ public: return true; }); } + template static inline bool ParseEnumArray(ani_env* env, ani_object arrayObj, std::vector& enums) { @@ -639,11 +642,10 @@ public: return false; } - std::string setterName(""); - setterName.append(propertyName); ani_method setter; ani_status status = - env->Class_FindMethod(cls, setterName.c_str(), setterSig.empty() ? nullptr : setterSig.c_str(), &setter); + env->Class_FindMethod(cls, Builder::BuildSetterName(propertyName).c_str(), + setterSig.empty() ? nullptr : setterSig.c_str(), &setter); if (status != ANI_OK) { APP_LOGE("Class_FindMethod %{public}s failed %{public}d", propertyName, status); return false; @@ -714,4 +716,4 @@ public: }; } // namespace AppExecFwk } // namespace OHOS -#endif \ No newline at end of file +#endif -- Gitee