diff --git a/interfaces/kits/js/BUILD.gn b/interfaces/kits/js/BUILD.gn index dfb6f3eeeb904c8c060f365ddb171d935ff2a2e5..8fa5ee4d01898f7c895ed5918ea6706dcdaeb385 100644 --- a/interfaces/kits/js/BUILD.gn +++ b/interfaces/kits/js/BUILD.gn @@ -151,6 +151,7 @@ ohos_shared_library("fs") { "ability_base:zuri", "ability_runtime:abilitykit_native", "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", "bundle_framework:appexecfwk_core", "c_utils:utils", "data_share:datashare_common", diff --git a/interfaces/kits/js/src/mod_fs/properties/open.cpp b/interfaces/kits/js/src/mod_fs/properties/open.cpp index 1bb4350f09d5ac9bfcd64b472d75e69cea21e20c..a066a41a7434fc56b7dbf7b828d4d4a0184eacf5 100644 --- a/interfaces/kits/js/src/mod_fs/properties/open.cpp +++ b/interfaces/kits/js/src/mod_fs/properties/open.cpp @@ -20,6 +20,7 @@ #include #include "ability.h" +#include "bundle_info.h" #include "bundle_mgr_proxy.h" #include "class_file/file_entity.h" #include "class_file/file_n_exporter.h" @@ -126,12 +127,13 @@ static string GetBundleNameSelf() HILOGE("Bundle mgr proxy is null ptr."); return nullptr; } - string bundleName; - if (!bundleMgrProxy->GetBundleNameForUid(uid, bundleName)) { - HILOGE("Failed to get bundleNameSelf. uid is %{public}d", uid); + AppExecFwk::BundleInfo bundleInfo; + auto ret = bundleMgrProxy->GetBundleInfoForSelf(uid, bundleInfo); + if (ret != ERR_OK) { + HILOGE("Failed to get bundleNameSelf."); return nullptr; } - return bundleName; + return bundleInfo.name; } static string GetPathFromFileUri(string path, string bundleName, unsigned int mode)