mirror of
https://gitee.com/openharmony/bundlemanager_bundle_framework
synced 2024-11-23 15:20:24 +00:00
!7257 [包管理] [分身相关] 分身级联相关
Merge pull request !7257 from chthollystar/master
This commit is contained in:
commit
e9b49741ee
@ -1415,6 +1415,10 @@ public:
|
||||
|
||||
void SetAccessTokenIdEx(const Security::AccessToken::AccessTokenIDEx accessTokenIdEx, const int32_t userId);
|
||||
|
||||
void SetAccessTokenIdExWithAppIndex(
|
||||
const Security::AccessToken::AccessTokenIDEx accessTokenIdEx,
|
||||
const int32_t userId, const int32_t appIndex);
|
||||
|
||||
void SetIsNewVersion(bool flag)
|
||||
{
|
||||
isNewVersion_ = flag;
|
||||
|
@ -65,6 +65,7 @@
|
||||
#include "storage_manager_proxy.h"
|
||||
#endif
|
||||
#include "iservice_registry.h"
|
||||
#include "inner_bundle_clone_common.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AppExecFwk {
|
||||
@ -5870,6 +5871,20 @@ ErrCode BaseBundleInstaller::UpdateHapToken(bool needUpdate, InnerBundleInfo &ne
|
||||
if (needUpdate) {
|
||||
newInfo.SetAccessTokenIdEx(accessTokenIdEx, uerInfo.second.bundleUserInfo.userId);
|
||||
}
|
||||
|
||||
const std::map<std::string, InnerBundleCloneInfo> &cloneInfos = uerInfo.second.cloneInfos;
|
||||
for (const auto &cloneInfoPair : cloneInfos) {
|
||||
Security::AccessToken::AccessTokenIDEx cloneAccessTokenIdEx;
|
||||
cloneAccessTokenIdEx.tokenIDEx = cloneInfoPair.second.accessTokenIdEx;
|
||||
if (BundlePermissionMgr::UpdateHapToken(cloneAccessTokenIdEx, newInfo) != ERR_OK) {
|
||||
LOG_NOFUNC_E(BMS_TAG_INSTALLER, "UpdateHapToken failed %{public}s", bundleName_.c_str());
|
||||
return ERR_APPEXECFWK_INSTALL_GRANT_REQUEST_PERMISSIONS_FAILED;
|
||||
}
|
||||
if (needUpdate) {
|
||||
newInfo.SetAccessTokenIdExWithAppIndex(cloneAccessTokenIdEx,
|
||||
uerInfo.second.bundleUserInfo.userId, cloneInfoPair.second.appIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (needUpdate && !dataMgr_->UpdateInnerBundleInfo(newInfo)) {
|
||||
LOG_NOFUNC_E(BMS_TAG_INSTALLER, "save UpdateInnerBundleInfo failed %{publlic}s", bundleName_.c_str());
|
||||
|
@ -2859,6 +2859,28 @@ void InnerBundleInfo::SetAccessTokenIdEx(
|
||||
infoItem->second.accessTokenIdEx = accessTokenIdEx.tokenIDEx;
|
||||
}
|
||||
|
||||
void InnerBundleInfo::SetAccessTokenIdExWithAppIndex(
|
||||
const Security::AccessToken::AccessTokenIDEx accessTokenIdEx,
|
||||
const int32_t userId, const int32_t appIndex)
|
||||
{
|
||||
auto& key = NameAndUserIdToKey(GetBundleName(), userId);
|
||||
auto infoItem = innerBundleUserInfos_.find(key);
|
||||
if (infoItem == innerBundleUserInfos_.end()) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto& userInfo = infoItem->second;
|
||||
std::map<std::string, InnerBundleCloneInfo> &cloneInfos = userInfo.cloneInfos;
|
||||
|
||||
auto cloneKey = InnerBundleUserInfo::AppIndexToKey(appIndex);
|
||||
auto cloneItem = cloneInfos.find(cloneKey);
|
||||
if (cloneItem == cloneInfos.end()) {
|
||||
return;
|
||||
}
|
||||
cloneItem->second.accessTokenId = accessTokenIdEx.tokenIdExStruct.tokenID;
|
||||
cloneItem->second.accessTokenIdEx = accessTokenIdEx.tokenIDEx;
|
||||
}
|
||||
|
||||
void InnerBundleInfo::SetkeyId(const int32_t userId, const std::string &keyId)
|
||||
{
|
||||
if (keyId.empty()) {
|
||||
|
Loading…
Reference in New Issue
Block a user