Signed-off-by: MisterE <smart_e@126.com>
This commit is contained in:
MisterE 2024-08-27 11:42:27 +08:00
commit 003613ceb4
2 changed files with 12 additions and 5 deletions

View File

@ -110,12 +110,12 @@ bool DmsBmStorage::SaveStorageDistributeInfo(const std::string &bundleName, bool
AppExecFwk::AppProvisionInfo appProvisionInfo;
std::vector<int32_t> ids;
ErrCode ret = AccountSA::OsAccountManager::QueryActiveOsAccountIds(ids);
if (ret != ERR_OK || ids.empty()) {
HILOGE("Get userId from active Os AccountIds fail, ret : %{public}d", ret);
ErrCode result = AccountSA::OsAccountManager::QueryActiveOsAccountIds(ids);
if (result != ERR_OK || ids.empty()) {
HILOGE("Get userId from active Os AccountIds fail, ret : %{public}d", result);
return false;
}
ret = bundleMgr->GetAppProvisioninfo(bundleName, ids[0], appProvisionInfo);
ret = bundleMgr->GetAppProvisionInfo(bundleName, ids[0], appProvisionInfo);
if (!ret) {
HILOGW("GetAppProvisioninfo (developerId) of %{public}s failed: %{public}d", bundleName.c_str(), ret);
DeleteStorageDistributeInfo(bundleName);

View File

@ -30,6 +30,7 @@
#include "parcel_helper.h"
#include "softbus_adapter/softbus_adapter.h"
#include "switch_status_dependency.h"
#include "os_account_manager.h"
namespace OHOS {
namespace DistributedSchedule {
@ -281,6 +282,12 @@ bool DMSContinueRecvMgr::GetFinalBundleName(const std::string &senderNetworkId,
HILOGE("get bundle manager failed");
return false;
}
std::vector<int32_t> ids;
ErrCode ret = AccountSA::OsAccountManager::QueryActiveOsAccountIds(ids);
if (ret != ERR_OK || ids.empty()) {
HILOGE("Get userId from active Os AccountIds fail, ret : %{public}d", ret);
return false;
}
for (std::string &bundleNameItem: bundleNameList) {
continueType = BundleManagerInternal::GetContinueType(
senderNetworkId, bundleNameItem, continueTypeId);
@ -289,7 +296,7 @@ bool DMSContinueRecvMgr::GetFinalBundleName(const std::string &senderNetworkId,
continue;
}
AppExecFwk::AppProvisionInfo appProvisionInfo;
if (bundleMgr->GetAppProvisionInfo(bundleNameItem, appProvisionInfo)
if (bundleMgr->GetAppProvisionInfo(bundleNameItem, ids[0], appProvisionInfo)
&& appProvisionInfo.developerId == distributedBundleInfo.developerId) {
finalBundleName = bundleNameItem;
return true;