diff --git a/BUILD.gn b/BUILD.gn index 38876b9..831a5bd 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -27,7 +27,8 @@ group("app_domain_verify_packages") { "interfaces/inner_api/client:app_domain_verify_agent_client", "interfaces/inner_api/client:app_domain_verify_mgr_client", "interfaces/inner_api/common:app_domain_verify_common", - "interfaces/kits/js:appdomainverify_napi", + "interfaces/kits/js/ani:appdomainverify_ani", + "interfaces/kits/js/jsi:appdomainverify_napi", "profile:bundlemanager_app_domain_verify_sa_profiles", "services:app_domain_verify_agent_service", "services:app_domain_verify_mgr_service", diff --git a/bundle.json b/bundle.json index 6d50ebf..a5f56ca 100644 --- a/bundle.json +++ b/bundle.json @@ -48,7 +48,8 @@ "hiappevent", "hicollie", "netmanager_base", - "memmgr" + "memmgr", + "runtime_core" ], "third_party": [ "openssl" diff --git a/interfaces/kits/js/ani/BUILD.gn b/interfaces/kits/js/ani/BUILD.gn new file mode 100644 index 0000000..b94b28e --- /dev/null +++ b/interfaces/kits/js/ani/BUILD.gn @@ -0,0 +1,118 @@ +# Copyright (C) 2025-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. + +import("//build/config/components/ets_frontend/ets2abc_config.gni") +import("//build/ohos.gni") +import("//build/ohos/taihe_idl/taihe.gni") +import("../../../../app_domain_verify.gni") + +subsystem_name = "bundlemanager" +part_name = "app_domain_verify" +taihe_generated_file_path = "$taihe_file_path/out/$subsystem_name/$part_name" + +copy_taihe_idl("copy_taihe") { + sources = [ + "${app_domain_verify_kits_path}/ani/idl/ohos.bundle.appDomainVerify.taihe", + ] +} + +ohos_taihe("run_taihe") { + taihe_generated_file_path = "$taihe_generated_file_path" + deps = [ ":copy_taihe" ] + outputs = [ + "$taihe_generated_file_path/src/ohos.bundle.appDomainVerify.ani.cpp", + "$taihe_generated_file_path/src/ohos.bundle.appDomainVerify.abi.c", + ] +} + +taihe_shared_library("app_domain_verify_ani") { + taihe_generated_file_path = "$taihe_generated_file_path" + subsystem_name = "$subsystem_name" + part_name = "$part_name" + include_dirs = [ + "include", + "${app_domain_verify_client_path}/include", + "${app_domain_verify_common_path}/include", + "${app_domain_verify_common_path}/include/zidl", + "${app_domain_verify_kits_path}/common/include", + ] + sources = get_target_outputs(":run_taihe") + sources += [ + "${app_domain_verify_kits_path}/ani/src/ani_constructor.cpp", + "${app_domain_verify_kits_path}/ani/src/ohos.bundle.appDomainVerify.impl.cpp", + "${app_domain_verify_kits_path}/common/src/api_event_reporter.cpp", + "${app_domain_verify_kits_path}/common/src/config_parser.cpp", + ] + deps = [ + ":run_taihe", + "${app_domain_verify_client_path}:app_domain_verify_mgr_client", + "${app_domain_verify_common_path}:app_domain_verify_common", + ] + if (os_level == "standard") { + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + } + } + cflags = [ + "-DHILOG_ENABLE", + "-fPIC", + "-g3", + ] + external_deps = [ + "ability_base:want", + "bundle_framework:appexecfwk_base", + "c_utils:utils", + "hiappevent:hiappevent_innerapi", + "hilog:libhilog", + "ipc:ipc_core", + "napi:ace_napi", + "runtime_core:ani", + "safwk:system_ability_fwk", + "samgr:samgr_proxy", + ] +} + +generate_static_abc("app_domain_verify_ets") { + base_url = "$taihe_generated_file_path" + files = [ "$taihe_generated_file_path/@ohos.bundle.appDomainVerify.ets" ] + is_boot_abc = "True" + device_dst_file = "/system/framework/app_domain_verify_ets.abc" + dependencies = [ ":run_taihe" ] +} + +generate_static_abc("app_domain_verify_test") { + base_url = "${app_domain_verify_kits_path}/ani/test" + files = [ "${app_domain_verify_kits_path}/ani/test/test_main.ets" ] + is_boot_abc = "True" + device_dst_file = "/system/framework/app_domain_verify_test.abc" +} + +ohos_prebuilt_etc("app_domain_verify_etc") { + source = "$target_out_dir/app_domain_verify_ets.abc" + module_install_dir = "framework" + part_name = "$part_name" + subsystem_name = "$subsystem_name" + deps = [ + ":app_domain_verify_ets", + # ":app_domain_verify_test", + ] +} + +group("appdomainverify_ani") { + deps = [ + ":app_domain_verify_ani", + ":app_domain_verify_etc", + ] +} diff --git a/interfaces/kits/js/ani/idl/ohos.bundle.appDomainVerify.taihe b/interfaces/kits/js/ani/idl/ohos.bundle.appDomainVerify.taihe new file mode 100644 index 0000000..50897a1 --- /dev/null +++ b/interfaces/kits/js/ani/idl/ohos.bundle.appDomainVerify.taihe @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2025-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. + */ + +@!namespace("@ohos.bundle.appDomainVerify", "appDomainVerify") +@!typed_array + +@!sts_inject(""" +static { loadLibrary("app_domain_verify_ani.z"); } +""") + +function queryAssociatedDomains(bundleName: String): Array; + +function queryAssociatedBundleNames(domain: String): Array; \ No newline at end of file diff --git a/interfaces/kits/js/ani/src/ani_constructor.cpp b/interfaces/kits/js/ani/src/ani_constructor.cpp new file mode 100644 index 0000000..83b65c4 --- /dev/null +++ b/interfaces/kits/js/ani/src/ani_constructor.cpp @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2025-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 "ohos.bundle.appDomainVerify.ani.hpp" + +ANI_EXPORT ani_status ANI_Constructor(ani_vm* vm, uint32_t* result) +{ + ani_env* env; + if (ANI_OK != vm->GetEnv(ANI_VERSION_1, &env)) { + return ANI_ERROR; + } + if (ANI_OK != ohos::bundle::appDomainVerify::ANIRegister(env)) { + std::cerr << "ohos::bundle::appDomainVerify" << std::endl; + return ANI_ERROR; + } + *result = ANI_VERSION_1; + return ANI_OK; +} diff --git a/interfaces/kits/js/ani/src/ohos.bundle.appDomainVerify.impl.cpp b/interfaces/kits/js/ani/src/ohos.bundle.appDomainVerify.impl.cpp new file mode 100644 index 0000000..3777edd --- /dev/null +++ b/interfaces/kits/js/ani/src/ohos.bundle.appDomainVerify.impl.cpp @@ -0,0 +1,100 @@ +/* + * Copyright (c) 2025-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 "ohos.bundle.appDomainVerify.proj.hpp" +#include "ohos.bundle.appDomainVerify.impl.hpp" +#include "taihe/runtime.hpp" +#include "stdexcept" +#include +#include "app_domain_verify_hilog.h" +#include "app_domain_verify_mgr_client.h" +#include "js_common_defined.h" +#include "api_event_reporter.h" +using namespace taihe; +using namespace OHOS::AppDomainVerify; +namespace { +bool CheckInput(const std::string& input) +{ + if (input.empty() || input.size() > MAX_STR_INPUT_SIZE) { + return false; + } + return true; +} +array BuildError(ErrorCode errorCode) +{ + taihe::set_business_error(errorCode, ErrCodeMap[errorCode]); + return taihe::array(nullptr, 0); +} +array BuildStringArray(const std::vector& data) +{ + array resArr(data.size(), ""); + for (int i = 0; i < data.size(); i++) { + resArr[i] = data[i]; + } + return resArr; +} +array queryAssociatedDomains(string_view bundleName) +{ + Dfx::ApiEventReporter reporter("QueryAssociatedDomains"); + if (!CheckInput(bundleName.c_str())) { + reporter.WriteEndEvent(Dfx::API_FAIL, ErrorCode::E_PARAM_ERROR); + return BuildError(ErrorCode::E_PARAM_ERROR); + } + std::vector domains; + + auto ret = AppDomainVerifyMgrClient::GetInstance()->QueryAssociatedDomains(bundleName.c_str(), domains); + if (ret != 0) { + if (ErrCodeMap.count(static_cast(ret)) != 0) { + reporter.WriteEndEvent(Dfx::API_FAIL, static_cast(ret)); + return BuildError(static_cast(ret)); + } else { + APP_DOMAIN_VERIFY_HILOGE(APP_DOMAIN_VERIFY_MGR_MODULE_SERVICE, "unknown error:%{public}d.", ret); + reporter.WriteEndEvent(Dfx::API_FAIL, ret); + return BuildStringArray(domains); + } + } + reporter.WriteEndEvent(Dfx::API_SUCCESS, ret); + + return BuildStringArray(domains); +} + +array queryAssociatedBundleNames(string_view domain) +{ + Dfx::ApiEventReporter reporter("QueryAssociatedBundleNames"); + if (!CheckInput(domain.c_str())) { + reporter.WriteEndEvent(Dfx::API_FAIL, ErrorCode::E_PARAM_ERROR); + return BuildError(ErrorCode::E_PARAM_ERROR); + } + std::vector bundleNames; + + auto ret = AppDomainVerifyMgrClient::GetInstance()->QueryAssociatedBundleNames(domain.c_str(), bundleNames); + if (ret != 0) { + if (ErrCodeMap.count(static_cast(ret)) != 0) { + reporter.WriteEndEvent(Dfx::API_FAIL, static_cast(ret)); + return BuildError(static_cast(ret)); + } else { + APP_DOMAIN_VERIFY_HILOGE(APP_DOMAIN_VERIFY_MGR_MODULE_SERVICE, "unknown error:%{public}d.", ret); + reporter.WriteEndEvent(Dfx::API_FAIL, ret); + return BuildStringArray(bundleNames); + } + } + reporter.WriteEndEvent(Dfx::API_SUCCESS, ret); + + return BuildStringArray(bundleNames); +} +} // namespace + +TH_EXPORT_CPP_API_queryAssociatedDomains(queryAssociatedDomains); +TH_EXPORT_CPP_API_queryAssociatedBundleNames(queryAssociatedBundleNames); diff --git a/interfaces/kits/js/ani/test/arktsconfig.json b/interfaces/kits/js/ani/test/arktsconfig.json new file mode 100644 index 0000000..6973403 --- /dev/null +++ b/interfaces/kits/js/ani/test/arktsconfig.json @@ -0,0 +1,21 @@ +{ + "compilerOptions": { + "package": "", + "baseUrl": ".", + "outDir": "./dist", + "paths": { + "std": [ + "../../../../../../../arkcompiler/runtime_core/static_core/plugins/ets/stdlib/std" + ], + "escompat": [ + "../../../../../../../arkcompiler/runtime_core/static_core/plugins/ets/stdlib/escompat" + ], + "@ohos": [ + "../../../../../../../interface/sdk-js/api/@ohos" + ] + } + }, + "includes": [ + "*.ets" + ] +} diff --git a/interfaces/kits/js/ani/test/test_main.ets b/interfaces/kits/js/ani/test/test_main.ets new file mode 100644 index 0000000..229f3ff --- /dev/null +++ b/interfaces/kits/js/ani/test/test_main.ets @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2025-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. + */ + +import appDomainVerify from '@ohos.bundle.appDomainVerify'; + +function testQueryAssociatedBundleNames(){ + try{ + let domain = 'https://www.openHarmony.cn' + let bundleNames = appDomainVerify.queryAssociatedDomains(domain) + + console.log('testQueryAssociatedBundleNames: ' + bundleNames) + } + catch (err) { + console.error('testQueryAssociatedBundleNames failed: ' + err) + } +} + +function testQueryAssociatedDomains(){ + try{ + let bundleName = 'com.openHarmony.test' + let domains = appDomainVerify.queryAssociatedDomains(bundleName) + + console.log('testQueryAssociatedDomains: ' + domains) + } + catch (err) { + console.error('testQueryAssociatedDomains failed: ' + err) + } +} + +function main() { + testQueryAssociatedBundleNames(); + testQueryAssociatedDomains(); +} diff --git a/interfaces/kits/js/include/api_event_reporter.h b/interfaces/kits/js/common/include/api_event_reporter.h similarity index 94% rename from interfaces/kits/js/include/api_event_reporter.h rename to interfaces/kits/js/common/include/api_event_reporter.h index 8bc95c4..d7cc018 100644 --- a/interfaces/kits/js/include/api_event_reporter.h +++ b/interfaces/kits/js/common/include/api_event_reporter.h @@ -17,6 +17,8 @@ #include namespace OHOS::AppDomainVerify::Dfx { +constexpr int32_t API_SUCCESS = 0; +constexpr int32_t API_FAIL = 1; class ApiEventReporter { public: explicit ApiEventReporter(const std::string& apiName); diff --git a/interfaces/kits/js/include/config_parser.h b/interfaces/kits/js/common/include/config_parser.h similarity index 100% rename from interfaces/kits/js/include/config_parser.h rename to interfaces/kits/js/common/include/config_parser.h diff --git a/interfaces/kits/js/common/include/js_common_defined.h b/interfaces/kits/js/common/include/js_common_defined.h new file mode 100644 index 0000000..087896e --- /dev/null +++ b/interfaces/kits/js/common/include/js_common_defined.h @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2023 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 APP_DOMAIN_VERIFY_JS_COMMON_DEFINED_H +#define APP_DOMAIN_VERIFY_JS_COMMON_DEFINED_H +#include +#include "app_domain_verify_error.h" + +namespace OHOS::AppDomainVerify { +constexpr int32_t MAX_STR_INPUT_SIZE = 256; +constexpr int32_t STRING_BUF_MAX_SIZE = 4096; +static std::map ErrCodeMap = { { ErrorCode::E_PERMISSION_DENIED, "Permission denied." }, + { ErrorCode::E_IS_NOT_SYS_APP, "System API accessed by non-system app." }, + { ErrorCode::E_PARAM_ERROR, "Parameter error." }, { ErrorCode::E_INTERNAL_ERR, "Internal error." } }; +} +#endif // APP_DOMAIN_VERIFY_JS_COMMON_DEFINED_H diff --git a/interfaces/kits/js/src/api_event_reporter.cpp b/interfaces/kits/js/common/src/api_event_reporter.cpp similarity index 100% rename from interfaces/kits/js/src/api_event_reporter.cpp rename to interfaces/kits/js/common/src/api_event_reporter.cpp diff --git a/interfaces/kits/js/src/config_parser.cpp b/interfaces/kits/js/common/src/config_parser.cpp similarity index 94% rename from interfaces/kits/js/src/config_parser.cpp rename to interfaces/kits/js/common/src/config_parser.cpp index 0cea44d..1312afc 100644 --- a/interfaces/kits/js/src/config_parser.cpp +++ b/interfaces/kits/js/common/src/config_parser.cpp @@ -29,8 +29,8 @@ bool ConfigParser::load(const std::string& filename) std::ifstream file(filename, std::ios::ate); if (!file.is_open()) { std::cerr << "Unable to open file: " << filename << std::endl; - APP_DOMAIN_VERIFY_HILOGE(APP_DOMAIN_VERIFY_MODULE_JS_NAPI, "Unable to open file: filename:%{public}s", - filename.c_str()); + APP_DOMAIN_VERIFY_HILOGE( + APP_DOMAIN_VERIFY_MODULE_JS_NAPI, "Unable to open file: filename:%{public}s", filename.c_str()); return false; } diff --git a/interfaces/kits/js/BUILD.gn b/interfaces/kits/js/jsi/BUILD.gn similarity index 90% rename from interfaces/kits/js/BUILD.gn rename to interfaces/kits/js/jsi/BUILD.gn index 3b5886e..3fcf376 100644 --- a/interfaces/kits/js/BUILD.gn +++ b/interfaces/kits/js/jsi/BUILD.gn @@ -12,7 +12,7 @@ # limitations under the License. import("//build/ohos.gni") -import("../../../app_domain_verify.gni") +import("../../../../app_domain_verify.gni") config("app_domain_verify_mgr_napi_config") { visibility = [ ":*" ] include_dirs = [ @@ -20,6 +20,7 @@ config("app_domain_verify_mgr_napi_config") { "${app_domain_verify_client_path}/include", "${app_domain_verify_common_path}/include", "${app_domain_verify_common_path}/include/zidl", + "${app_domain_verify_kits_path}/common/include", ] configs = [ "//build/config/compiler:exceptions" ] ldflags = [ "-Wl,--exclude-libs=ALL" ] @@ -51,9 +52,9 @@ ohos_shared_library("appdomainverify_napi") { } sources = [ - "src/api_event_reporter.cpp", + "${app_domain_verify_kits_path}/common/src/api_event_reporter.cpp", + "${app_domain_verify_kits_path}/common/src/config_parser.cpp", "src/app_domain_verify_manager_napi.cpp", - "src/config_parser.cpp", "src/native_module.cpp", ] public_configs = [ ":app_domain_verify_mgr_napi_config" ] diff --git a/interfaces/kits/js/include/app_domain_verify_manager_napi.h b/interfaces/kits/js/jsi/include/app_domain_verify_manager_napi.h similarity index 100% rename from interfaces/kits/js/include/app_domain_verify_manager_napi.h rename to interfaces/kits/js/jsi/include/app_domain_verify_manager_napi.h diff --git a/interfaces/kits/js/src/app_domain_verify_manager_napi.cpp b/interfaces/kits/js/jsi/src/app_domain_verify_manager_napi.cpp similarity index 81% rename from interfaces/kits/js/src/app_domain_verify_manager_napi.cpp rename to interfaces/kits/js/jsi/src/app_domain_verify_manager_napi.cpp index 2baa43d..4d833a0 100644 --- a/interfaces/kits/js/src/app_domain_verify_manager_napi.cpp +++ b/interfaces/kits/js/jsi/src/app_domain_verify_manager_napi.cpp @@ -18,17 +18,11 @@ #include "app_domain_verify_manager_napi.h" #include "app_domain_verify_hilog.h" #include "app_domain_verify_mgr_client.h" -#include "app_domain_verify_error.h" +#include "js_common_defined.h" #include "api_event_reporter.h" namespace OHOS::AppDomainVerify { -constexpr int32_t API_SUCCESS = 0; -constexpr int32_t API_FAIL = 1; -constexpr int32_t MAX_STR_INPUT_SIZE = 256; -constexpr int32_t STRING_BUF_MAX_SIZE = 4096; -std::map ErrCodeMap = { { ErrorCode::E_PERMISSION_DENIED, "Permission denied." }, - { ErrorCode::E_IS_NOT_SYS_APP, "System API accessed by non-system app." }, - { ErrorCode::E_PARAM_ERROR, "Parameter error." }, { ErrorCode::E_INTERNAL_ERR, "Internal error." } }; + static std::string GetString(napi_env env, napi_value value) { std::unique_ptr valueBuf = std::make_unique(STRING_BUF_MAX_SIZE); @@ -78,22 +72,22 @@ napi_value QueryAssociatedDomains(napi_env env, napi_callback_info info) NAPI_CALL_BASE(env, napi_get_cb_info(env, info, &argc, args, nullptr, nullptr), nullptr); std::string bundleName = GetString(env, args[0]); if (!CheckInput(bundleName)) { - reporter.WriteEndEvent(API_FAIL, ErrorCode::E_PARAM_ERROR); + reporter.WriteEndEvent(Dfx::API_FAIL, ErrorCode::E_PARAM_ERROR); return BuildError(env, ErrorCode::E_PARAM_ERROR); } std::vector domains; auto ret = AppDomainVerifyMgrClient::GetInstance()->QueryAssociatedDomains(bundleName, domains); if (ret != 0) { if (ErrCodeMap.count(static_cast(ret)) != 0) { - reporter.WriteEndEvent(API_FAIL, static_cast(ret)); + reporter.WriteEndEvent(Dfx::API_FAIL, static_cast(ret)); return BuildError(env, static_cast(ret)); } else { APP_DOMAIN_VERIFY_HILOGE(APP_DOMAIN_VERIFY_MGR_MODULE_SERVICE, "unknown error:%{public}d.", ret); - reporter.WriteEndEvent(API_FAIL, ret); + reporter.WriteEndEvent(Dfx::API_FAIL, ret); return BuildStringArray(env, domains); } } - reporter.WriteEndEvent(API_SUCCESS, ret); + reporter.WriteEndEvent(Dfx::API_SUCCESS, ret); return BuildStringArray(env, domains); } napi_value QueryAssociatedBundleNames(napi_env env, napi_callback_info info) @@ -105,22 +99,22 @@ napi_value QueryAssociatedBundleNames(napi_env env, napi_callback_info info) NAPI_CALL_BASE(env, napi_get_cb_info(env, info, &argc, args, nullptr, nullptr), nullptr); std::string domain = GetString(env, args[0]); if (!CheckInput(domain)) { - reporter.WriteEndEvent(API_FAIL, ErrorCode::E_PARAM_ERROR); + reporter.WriteEndEvent(Dfx::API_FAIL, ErrorCode::E_PARAM_ERROR); return BuildError(env, ErrorCode::E_PARAM_ERROR); } std::vector bundleNames; auto ret = AppDomainVerifyMgrClient::GetInstance()->QueryAssociatedBundleNames(domain, bundleNames); if (ret != 0) { if (ErrCodeMap.count(static_cast(ret)) != 0) { - reporter.WriteEndEvent(API_FAIL, static_cast(ret)); + reporter.WriteEndEvent(Dfx::API_FAIL, static_cast(ret)); return BuildError(env, static_cast(ret)); } else { APP_DOMAIN_VERIFY_HILOGE(APP_DOMAIN_VERIFY_MGR_MODULE_SERVICE, "unknown error:%{public}d.", ret); - reporter.WriteEndEvent(API_FAIL, ret); + reporter.WriteEndEvent(Dfx::API_FAIL, ret); return BuildStringArray(env, bundleNames); } } - reporter.WriteEndEvent(API_SUCCESS, ret); + reporter.WriteEndEvent(Dfx::API_SUCCESS, ret); return BuildStringArray(env, bundleNames); } } \ No newline at end of file diff --git a/interfaces/kits/js/src/native_module.cpp b/interfaces/kits/js/jsi/src/native_module.cpp similarity index 100% rename from interfaces/kits/js/src/native_module.cpp rename to interfaces/kits/js/jsi/src/native_module.cpp