mirror of
https://gitee.com/openharmony/ability_dmsfwk
synced 2024-11-23 14:30:21 +00:00
fix: modify bundlemanager
Signed-off-by: liuxiaowei <liuxiaowei42@huawei.com>
This commit is contained in:
parent
b363a6b5e1
commit
85b17aa5d9
@ -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;
|
||||
}
|
||||
|
@ -438,4 +438,6 @@ HWTEST_F(BundleManagerInternalTest, GetBundleIdFromBms_002, TestSize.Level3)
|
||||
bool ret = BundleManagerInternal::GetBundleIdFromBms(bundleName, accessTokenId);
|
||||
EXPECT_EQ(ret, true);
|
||||
DTEST_LOG << "BundleManagerInternalTest GetBundleIdFromBms_002 end "<< std::endl;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user