From 64f7ad918ab17bf9052359855bc50ec14ddfd62a Mon Sep 17 00:00:00 2001 From: amao Date: Wed, 14 May 2025 14:26:47 +0800 Subject: [PATCH] use no cache for hqf Signed-off-by: amao Change-Id: If8b0494744e185ddc19f51344d9bbe6c7ed3fe1b --- .../bundle_mgr_helper.cpp | 13 +++++++++++++ frameworks/native/appkit/app/main_thread.cpp | 2 +- .../bundle_mgr_helper.h | 1 + 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/frameworks/native/appkit/ability_bundle_manager_helper/bundle_mgr_helper.cpp b/frameworks/native/appkit/ability_bundle_manager_helper/bundle_mgr_helper.cpp index 66126dc744..e09b955385 100644 --- a/frameworks/native/appkit/ability_bundle_manager_helper/bundle_mgr_helper.cpp +++ b/frameworks/native/appkit/ability_bundle_manager_helper/bundle_mgr_helper.cpp @@ -426,6 +426,19 @@ ErrCode BundleMgrHelper::GetBundleInfoForSelf(int32_t flags, BundleInfo &bundleI return bundleMgr->GetBundleInfoForSelf(flags, bundleInfo); } +ErrCode BundleMgrHelper::GetBundleInfoForSelfWithOutCache(int32_t flags, BundleInfo &bundleInfo) +{ + TAG_LOGD(AAFwkTag::BUNDLEMGRHELPER, "called"); + auto bundleMgr = Connect(); + if (bundleMgr == nullptr) { + TAG_LOGE(AAFwkTag::BUNDLEMGRHELPER, "null bundleMgr"); + return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; + } + + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); + return bundleMgr->GetBundleInfoForSelfWithOutCache(flags, bundleInfo); +} + ErrCode BundleMgrHelper::GetDependentBundleInfo(const std::string &sharedBundleName, BundleInfo &sharedBundleInfo, GetDependentBundleInfoFlag flag) { diff --git a/frameworks/native/appkit/app/main_thread.cpp b/frameworks/native/appkit/app/main_thread.cpp index 0c43243b7f..0c262bb46e 100644 --- a/frameworks/native/appkit/app/main_thread.cpp +++ b/frameworks/native/appkit/app/main_thread.cpp @@ -3349,7 +3349,7 @@ bool MainThread::GetHqfFileAndHapPath(const std::string &bundleName, } BundleInfo bundleInfo; - if (bundleMgrHelper->GetBundleInfoForSelf( + if (bundleMgrHelper->GetBundleInfoForSelfWithOutCache( (static_cast(AppExecFwk::GetBundleInfoFlag::GET_BUNDLE_INFO_WITH_HAP_MODULE) + static_cast(AppExecFwk::GetBundleInfoFlag::GET_BUNDLE_INFO_WITH_ABILITY) + static_cast(AppExecFwk::GetBundleInfoFlag::GET_BUNDLE_INFO_WITH_APPLICATION) + diff --git a/interfaces/kits/native/appkit/ability_bundle_manager_helper/bundle_mgr_helper.h b/interfaces/kits/native/appkit/ability_bundle_manager_helper/bundle_mgr_helper.h index c221af6963..ced7ca0a1e 100644 --- a/interfaces/kits/native/appkit/ability_bundle_manager_helper/bundle_mgr_helper.h +++ b/interfaces/kits/native/appkit/ability_bundle_manager_helper/bundle_mgr_helper.h @@ -56,6 +56,7 @@ public: const std::string &bundleName, std::vector &baseSharedBundleInfos, GetDependentBundleInfoFlag flag = GetDependentBundleInfoFlag::GET_APP_CROSS_HSP_BUNDLE_INFO); ErrCode GetBundleInfoForSelf(int32_t flags, BundleInfo &bundleInfo); + ErrCode GetBundleInfoForSelfWithOutCache(int32_t flags, BundleInfo &bundleInfo); ErrCode GetDependentBundleInfo(const std::string &sharedBundleName, BundleInfo &sharedBundleInfo, GetDependentBundleInfoFlag flag = GetDependentBundleInfoFlag::GET_APP_CROSS_HSP_BUNDLE_INFO); bool GetGroupDir(const std::string &dataGroupId, std::string &dir);