add method GetBundleNameByAppIdOrAppIdentifier

Signed-off-by: jiangminsen <jiangminsen@huawei.com>
This commit is contained in:
jiangminsen 2024-11-04 22:12:47 +08:00
parent b3ced90a97
commit 1b89b78901
3 changed files with 4 additions and 4 deletions

View File

@ -5370,7 +5370,7 @@ ErrCode BundleMgrProxy::GetCompatibleDeviceType(const std::string &bundleName, s
ErrCode BundleMgrProxy::GetBundleNameByAppIdOrAppIdentifier(const std::string &appId, std::string &bundleName)
{
APP_LOGD("GetBundleNameByAppIdOrAppIdentifier: appId: %{public}s", ret, appId.c_str());
APP_LOGD("GetBundleNameByAppIdOrAppIdentifier: appId: %{public}s", appId.c_str());
HITRACE_METER_NAME(HITRACE_TAG_APP, __PRETTY_FUNCTION__);
MessageParcel data;
if (appId.empty()) {

View File

@ -8861,12 +8861,12 @@ ErrCode BundleDataMgr::GetBundleNameByAppIdOrAppIdentifier(const std::string &ap
}
std::unique_lock<std::shared_mutex> lock(bundleInfoMutex_);
for (const auto &[key, innerInfo] : bundleInfos_) {
if (innerInfo->GetAppId() == appId || innerInfo->GetAppIdentifier() == appId) {
if (innerInfo.GetAppId() == appId || innerInfo.GetAppIdentifier() == appId) {
bundleName = key;
return ERR_OK;
}
}
APP_LOGI("get bundleName failed %{public}s", appId.c_str());
APP_LOGI("get bundleName failed %{private}s", appId.c_str());
return ERR_BUNDLE_MANAGER_BUNDLE_NOT_EXIST;
}
} // namespace AppExecFwk

View File

@ -4555,7 +4555,7 @@ ErrCode BundleMgrHostImpl::GetBundleNameByAppIdOrAppIdentifier(const std::string
APP_LOGW("get bundleName by appId %{public}s failed %{public}d", appId.c_str(), ret);
return ret;
}
APP_LOGI("appId: %{public}s bundleName : %{public}s", appId.c_str(), bundleName.c_str());
APP_LOGI("appId: %{private}s bundleName : %{public}s", appId.c_str(), bundleName.c_str());
return ERR_OK;
}