fix: modify bundlemanager

Signed-off-by: liuxiaowei <liuxiaowei42@huawei.com>
This commit is contained in:
liuxiaowei 2023-05-09 10:40:14 +08:00
parent b363a6b5e1
commit 85b17aa5d9
2 changed files with 8 additions and 4 deletions

View File

@ -296,7 +296,8 @@ int32_t BundleManagerInternal::GetUidFromBms(const std::string& bundleName)
return bundleMgr->GetUidByBundleName(bundleName, ids[0]);
}
bool BundleManagerInternal::GetBundleIdFromBms(const std::string& bundleName, uint32_t& accessTokenId){
bool BundleManagerInternal::GetBundleIdFromBms(const std::string& bundleName, uint32_t& accessTokenId)
{
auto bundleMgr = GetBundleManager();
if (bundleMgr == nullptr) {
HILOGE("failed to get bms");
@ -310,7 +311,7 @@ bool BundleManagerInternal::GetBundleIdFromBms(const std::string& bundleName, ui
AppExecFwk::ApplicationInfo appInfo;
int32_t flag = static_cast<int32_t>(AppExecFwk::GetApplicationFlag::GET_APPLICATION_INFO_DEFAULT);
result = bundleMgr->GetApplicationInfoV9(bundleName, flag, ids[0], appInfo);
if (result != ERR_OK){
if (result != ERR_OK) {
HILOGE("failed to get appInfo from bms");
return false;
}
@ -318,14 +319,15 @@ bool BundleManagerInternal::GetBundleIdFromBms(const std::string& bundleName, ui
return true;
}
bool BundleManagerInternal::GetBundleNameFromDbms(const std::string& networkId, const uint32_t accessTokenId, std::string& bundleName){
bool BundleManagerInternal::GetBundleNameFromDbms(const std::string& networkId, const uint32_t accessTokenId, std::string& bundleName)
{
auto bundleMgr = GetDistributedBundleManager();
if (bundleMgr == nullptr) {
HILOGE("failed to get dbms");
return false;
}
int32_t result = bundleMgr->GetDistributedBundleName(networkId, accessTokenId, bundleName);
if (result != ERR_OK){
if (result != ERR_OK) {
HILOGE("failed to get bundleName from dbms");
return false;
}

View File

@ -439,3 +439,5 @@ HWTEST_F(BundleManagerInternalTest, GetBundleIdFromBms_002, TestSize.Level3)
EXPECT_EQ(ret, true);
DTEST_LOG << "BundleManagerInternalTest GetBundleIdFromBms_002 end "<< std::endl;
}
}
}