From d902f27d48f5fbb87595aad37a0f02cf1d9a0755 Mon Sep 17 00:00:00 2001 From: wanghang Date: Thu, 20 Oct 2022 11:17:07 +0800 Subject: [PATCH] IssueNo:#I5WPLV Description:fix fa getAbilityLabel and getAbilityIcon Sig:SIG_ApplicaitonFramework Feature or Bugfix:Bugfix Binary Source:No Signed-off-by: wanghang Change-Id: I38754592d392cf95c5584ed8136567c2b82d3b9e --- services/bundlemgr/src/bundle_data_mgr.cpp | 28 ++++++++++------------ 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/services/bundlemgr/src/bundle_data_mgr.cpp b/services/bundlemgr/src/bundle_data_mgr.cpp index 0fc4d1dce9..17b2c1e347 100644 --- a/services/bundlemgr/src/bundle_data_mgr.cpp +++ b/services/bundlemgr/src/bundle_data_mgr.cpp @@ -1762,18 +1762,16 @@ ErrCode BundleDataMgr::GetAbilityLabel(const std::string &bundleName, const std: if (ret != ERR_OK) { return ret; } - if (!moduleName.empty()) { - std::map InnerModuleInfos = innerBundleInfo.GetInnerModuleInfos(); - auto moduleItem = InnerModuleInfos.find(moduleName); - if (moduleItem == InnerModuleInfos.end()) { - APP_LOGE("%{public}s can not find module: %{public}s", bundleName.c_str(), moduleName.c_str()); - return ERR_BUNDLE_MANAGER_MODULE_NOT_EXIST; - } - } auto ability = innerBundleInfo.FindAbilityInfoV9(bundleName, moduleName, abilityName); if (!ability) { return ERR_BUNDLE_MANAGER_ABILITY_NOT_EXIST; } + if (!moduleName.empty()) { + if ((*ability).moduleName != moduleName) { + APP_LOGE("%{public}s can not find module: %{public}s", bundleName.c_str(), moduleName.c_str()); + return ERR_BUNDLE_MANAGER_ABILITY_NOT_EXIST; + } + } bool isEnable = false; ret = innerBundleInfo.IsAbilityEnabledV9(*ability, GetUserId(), isEnable); if (ret != ERR_OK) { @@ -4070,20 +4068,18 @@ ErrCode BundleDataMgr::GetMediaData(const std::string &bundleName, const std::st if (errCode != ERR_OK) { return errCode; } - std::map InnerModuleInfos = innerBundleInfo.GetInnerModuleInfos(); - if (!moduleName.empty()) { - auto moduleItem = InnerModuleInfos.find(moduleName); - if (moduleItem == InnerModuleInfos.end()) { - APP_LOGE("%{public}s can not find module: %{public}s", bundleName.c_str(), moduleName.c_str()); - return ERR_BUNDLE_MANAGER_MODULE_NOT_EXIST; - } - } auto ability = innerBundleInfo.FindAbilityInfoV9(bundleName, moduleName, abilityName); if (!ability) { APP_LOGE("abilityName:%{public}s not find", abilityName.c_str()); return ERR_BUNDLE_MANAGER_ABILITY_NOT_EXIST; } + if (!moduleName.empty()) { + if ((*ability).moduleName != moduleName) { + APP_LOGE("%{public}s can not find module: %{public}s", bundleName.c_str(), moduleName.c_str()); + return ERR_BUNDLE_MANAGER_ABILITY_NOT_EXIST; + } + } bool isEnable; errCode = innerBundleInfo.IsAbilityEnabledV9(*ability, GetUserId(userId), isEnable); if (errCode != ERR_OK) { -- Gitee