diff --git a/interfaces/innerkits/native/common/log.h b/interfaces/innerkits/native/common/log.h index 7353db72b9348ca4e26c678990c22447aac18c1a..7504b3f37f3bada618cf97ba4f60d5f76e17d021 100644 --- a/interfaces/innerkits/native/common/log.h +++ b/interfaces/innerkits/native/common/log.h @@ -20,7 +20,7 @@ namespace OHOS { namespace AppFileService { const unsigned int APP_LOG_DOMAIN = 0xD004313; const char APP_LOG_TAG[] = "AppFileService"; -static constexpr OHOS::HiviewDFX::HiLogLabel LOG_LABEL = { LOG_CORE, APP_LOG_DOMAIN, APP_LOG_TAG}; +static constexpr OHOS::HiviewDFX::HiLogLabel LOG_LABEL = { LOG_CORE, APP_LOG_DOMAIN, APP_LOG_TAG }; #define PRINT_LOG(Level, fmt, ...) \ OHOS::HiviewDFX::HiLog::Level(OHOS::AppFileService::LOG_LABEL, "[%{public}s:%{public}d] " fmt, \ diff --git a/interfaces/kits/js/BUILD.gn b/interfaces/kits/js/BUILD.gn index 2fba1d617fab8f405682d5d76eecd1b1738524f1..fbdd483cfcac2712124b9ed1791bfcfcda53d51b 100644 --- a/interfaces/kits/js/BUILD.gn +++ b/interfaces/kits/js/BUILD.gn @@ -79,6 +79,7 @@ ohos_shared_library("fileuri") { external_deps = [ "ability_runtime:abilitykit_native", + "bundle_framework:appexecfwk_base", "bundle_framework:appexecfwk_core", "c_utils:utils", "file_api:filemgmt_libn", diff --git a/interfaces/kits/js/common/log.h b/interfaces/kits/js/common/log.h index 683e30355b6f37702fa7d52e656377e6e0ab67df..f9d3ece923ff4b0d30f3ad084309fd52c52ef4b3 100644 --- a/interfaces/kits/js/common/log.h +++ b/interfaces/kits/js/common/log.h @@ -20,7 +20,7 @@ namespace OHOS { namespace AppFileService { const unsigned int APP_LOG_DOMAIN = 0xD004313; const char APP_LOG_TAG[] = "AppFileService"; -static constexpr OHOS::HiviewDFX::HiLogLabel LOG_LABEL = { LOG_CORE, APP_LOG_DOMAIN, APP_LOG_TAG}; +static constexpr OHOS::HiviewDFX::HiLogLabel LOG_LABEL = { LOG_CORE, APP_LOG_DOMAIN, APP_LOG_TAG }; #define PRINT_LOG(Level, fmt, ...) \ OHOS::HiviewDFX::HiLog::Level(OHOS::AppFileService::LOG_LABEL, "[%{public}s:%{public}d] " fmt, \ diff --git a/interfaces/kits/js/file_uri/get_uri_from_path.cpp b/interfaces/kits/js/file_uri/get_uri_from_path.cpp index 30c77385ac3784e1c422583d827e806ef8c2be23..b2e93095573421f0282f1f3aed5fa5ef39bc49b8 100644 --- a/interfaces/kits/js/file_uri/get_uri_from_path.cpp +++ b/interfaces/kits/js/file_uri/get_uri_from_path.cpp @@ -14,6 +14,7 @@ */ #include "get_uri_from_path.h" +#include "bundle_info.h" #include "bundle_mgr_proxy.h" #include "ipc_skeleton.h" #include "iservice_registry.h" @@ -56,13 +57,14 @@ static string GetBundleName() return nullptr; } - string bundleName; - if (!bundleMgrProxy->GetBundleNameForUid(uid, bundleName)) { + BundleInfo bundleInfo; + auto ret = bundleMgrProxy->GetBundleInfoForSelf(uid, bundleInfo); + if (ret != ERR_OK) { LOGE("GetBundleName: bundleName get fail. uid is %{public}d", uid); return nullptr; } - return bundleName; + return bundleInfo.name; } napi_value GetUriFromPath::Sync(napi_env env, napi_callback_info info)