diff --git a/services/backup_sa/src/module_ipc/service.cpp b/services/backup_sa/src/module_ipc/service.cpp index 2d9dc3fe3f78e91cab7693517de9b342d5944e92..edbe73329bfcc7685873324008145694fb1ae349 100644 --- a/services/backup_sa/src/module_ipc/service.cpp +++ b/services/backup_sa/src/module_ipc/service.cpp @@ -168,9 +168,8 @@ UniqueFd Service::GetLocalCapabilities() return UniqueFd(-EPERM); } session_->IncreaseSessionCnt(__PRETTY_FUNCTION__); - session_->SetSessionUserId(GetUserIdDefault()); VerifyCaller(); - string path = BConstants::GetSaBundleBackupRootDir(session_->GetSessionUserId()); + string path = BConstants::GetSaBundleBackupRootDir(GetUserIdDefault()); BExcepUltils::VerifyPath(path, false); UniqueFd fd(open(path.data(), O_TMPFILE | O_RDWR, S_IRUSR | S_IWUSR)); if (fd < 0) { @@ -184,7 +183,7 @@ UniqueFd Service::GetLocalCapabilities() cache.SetSystemFullName(GetOSFullName()); cache.SetDeviceType(GetDeviceType()); - auto bundleInfos = BundleMgrAdapter::GetFullBundleInfos(session_->GetSessionUserId()); + auto bundleInfos = BundleMgrAdapter::GetFullBundleInfos(GetUserIdDefault()); cache.SetBundleInfos(bundleInfos); cachedEntity.Persist(); session_->DecreaseSessionCnt(__PRETTY_FUNCTION__); @@ -1599,7 +1598,6 @@ ErrCode Service::GetBackupInfoCmdHandle(BundleName &bundleName, std::string &res HILOGE("Get BackupInfo error, session is empty."); return BError(BError::Codes::SA_INVAL_ARG); } - session_->SetSessionUserId(GetUserIdDefault()); auto backupConnection = session_->CreateBackupConnection(bundleName); if (backupConnection == nullptr) { HILOGE("backupConnection is null. bundleName: %{public}s", bundleName.c_str()); @@ -1610,7 +1608,7 @@ ErrCode Service::GetBackupInfoCmdHandle(BundleName &bundleName, std::string &res backupConnection->SetCallback(callConnected); backupConnection->SetCallDied(callDied); AAFwk::Want want = CreateConnectWant(bundleName); - auto ret = backupConnection->ConnectBackupExtAbility(want, session_->GetSessionUserId()); + auto ret = backupConnection->ConnectBackupExtAbility(want, GetUserIdDefault()); if (ret) { HILOGE("ConnectBackupExtAbility faild, bundleName:%{public}s, ret:%{public}d", bundleName.c_str(), ret); return BError(BError::Codes::SA_BOOT_EXT_FAIL); diff --git a/services/backup_sa/src/module_ipc/service_incremental.cpp b/services/backup_sa/src/module_ipc/service_incremental.cpp index a5e09c3570cec357a6273058fcac7f50b17ec8ac..400a76ac17c5781d16459f272e195ce9815b0fa3 100644 --- a/services/backup_sa/src/module_ipc/service_incremental.cpp +++ b/services/backup_sa/src/module_ipc/service_incremental.cpp @@ -98,9 +98,8 @@ UniqueFd Service::GetLocalCapabilitiesIncremental(const std::vectorIncreaseSessionCnt(__PRETTY_FUNCTION__); - session_->SetSessionUserId(GetUserIdDefault()); VerifyCaller(); - string path = BConstants::GetSaBundleBackupRootDir(session_->GetSessionUserId()); + string path = BConstants::GetSaBundleBackupRootDir(GetUserIdDefault()); BExcepUltils::VerifyPath(path, false); UniqueFd fd(open(path.data(), O_TMPFILE | O_RDWR, S_IRUSR | S_IWUSR)); if (fd < 0) { @@ -113,7 +112,7 @@ UniqueFd Service::GetLocalCapabilitiesIncremental(const std::vectorGetSessionUserId(), bundleNames); + auto bundleInfos = BundleMgrAdapter::GetBundleInfosForIncremental(GetUserIdDefault(), bundleNames); cache.SetBundleInfos(bundleInfos, true); cachedEntity.Persist(); HILOGI("Service GetLocalCapabilitiesIncremental persist");