diff --git a/tools/backup_tool/src/tools_op_restore_async.cpp b/tools/backup_tool/src/tools_op_restore_async.cpp index 3a07337b6ed332108394c8c78504a2658a144ffb..fa815cda1d4c89510412a44144a4234663c085c0 100644 --- a/tools/backup_tool/src/tools_op_restore_async.cpp +++ b/tools/backup_tool/src/tools_op_restore_async.cpp @@ -180,11 +180,19 @@ static int32_t ChangeBundleInfo(const string &pathCapFile, const vector BJsonCachedEntity cachedEntity(move(fd)); auto cache = cachedEntity.Structuralize(); vector bundleInfos; + auto cacheBundleInfos = cache.GetBundleInfos(); for (auto name : bundleNames) { string versionName = string(BConstants::DEFAULT_VERSION_NAME); uint32_t versionCode = static_cast(BConstants::DEFAULT_VERSION_CODE); - bundleInfos.emplace_back(BJsonEntityCaps::BundleInfo { - .name = name, .needToInstall = false, .versionCode = versionCode, .versionName = versionName}); + for (auto &&bundleInfo : cacheBundleInfos) { + if (bundleInfo.name != name) { + continue; + } + bundleInfos.emplace_back(BJsonEntityCaps::BundleInfo { + .name = name, .versionCode = versionCode, .versionName = versionName, + .spaceOccupied = bundleInfo.spaceOccupied,.allToBackup = bundleInfo.allToBackup, + .extensionName = bundleInfo.extensionName, .needToInstall = false}); + } } cache.SetBundleInfos(bundleInfos); cachedEntity.Persist();