diff --git a/frameworks/native/backup_ext/include/ext_extension.h b/frameworks/native/backup_ext/include/ext_extension.h index 34a509ffb60f1f5de263864da1e00386003d2036..9c450efb45880a7df62c486d782ef682eabe4eb7 100644 --- a/frameworks/native/backup_ext/include/ext_extension.h +++ b/frameworks/native/backup_ext/include/ext_extension.h @@ -260,6 +260,7 @@ private: void DeleteBackupIdxFile(); void DeleteBackupIncrementalTars(const string &tarName); void SetClearDataFlag(bool isClearData); + std::string GetBundlePath(); std::vector GetExtManageInfo(); ErrCode RestoreFilesForSpecialCloneCloud(); void RestoreBigFilesForSpecialCloneCloud(const ExtManageInfo &item); @@ -297,7 +298,7 @@ private: std::string bundleName_; int32_t sendRate_ = BConstants::DEFAULT_FD_SEND_RATE; bool isClearData_ {true}; - bool isDebug_ {false}; + bool isDebug_ {true}; std::map endFileInfos_; std::map> errFileInfos_; bool isRpValid_ {false}; diff --git a/frameworks/native/backup_ext/src/ext_extension.cpp b/frameworks/native/backup_ext/src/ext_extension.cpp index 094d19cb3db7650fd9a76d5670278509f918d48c..2ba8859d9cebaac2c0b5641f1f0d07ada11d08ba 100644 --- a/frameworks/native/backup_ext/src/ext_extension.cpp +++ b/frameworks/native/backup_ext/src/ext_extension.cpp @@ -1134,9 +1134,9 @@ void BackupExtExtension::FillEndFileInfos(const std::string &path, for (const auto &it : result) { std::string filePath = it.first; if (!filePath.empty() && filePath.size() <= PATH_MAX) { - endFileInfos_[filePath] = it.second.size; + endFileInfos_[path + filePath] = it.second.size; } else { - HILOGE("FileName : %{public}s error", GetAnonyPath(filePath).c_str()); + HILOGE("File name : %{public}s check error", GetAnonyPath(path + filePath).c_str()); } } } diff --git a/frameworks/native/backup_ext/src/sub_ext_extension.cpp b/frameworks/native/backup_ext/src/sub_ext_extension.cpp index cc63b94c52111fe1238d9044ba83017f1be606df..540cb94acac9e7fd940b062f8185a4cb30350271 100644 --- a/frameworks/native/backup_ext/src/sub_ext_extension.cpp +++ b/frameworks/native/backup_ext/src/sub_ext_extension.cpp @@ -107,11 +107,19 @@ void BackupExtExtension::SetClearDataFlag(bool isClearData) } } +string BackupExtExtension::GetBundlePath() +{ + if (bundleName_ == BConstants::BUNDLE_FILE_MANAGER) { + return string(BConstants::PATH_FILEMANAGE_BACKUP_HOME).append(BConstants::SA_BUNDLE_BACKUP_RESTORE); + } else if (bundleName_ == BConstants::BUNDLE_MEDIAL_DATA) { + return string(BConstants::PATH_MEDIALDATA_BACKUP_HOME).append(BConstants::SA_BUNDLE_BACKUP_RESTORE); + } + return string(BConstants::PATH_BUNDLE_BACKUP_HOME).append(BConstants::SA_BUNDLE_BACKUP_RESTORE); +} + std::map BackupExtExtension::GetIdxFileInfos(bool isSpecialVersion) { - string restoreDir = isSpecialVersion ? - "" : - string(BConstants::PATH_BUNDLE_BACKUP_HOME).append(BConstants::SA_BUNDLE_BACKUP_RESTORE); + string restoreDir = isSpecialVersion ? "" : GetBundlePath(); auto extManageInfo = GetExtManageInfo(); std::map idxFileInfos; for (size_t i = 0; i < extManageInfo.size(); ++i) { @@ -159,11 +167,12 @@ tuple> BackupExtExtension::CheckRestoreFileInfos() struct stat curFileStat {}; for (const auto &it : endFileInfos_) { if (lstat(it.first.c_str(), &curFileStat) != 0) { - HILOGE("(Debug) Failed to lstat, err = %{public}d", errno); + HILOGE("Failed to lstat %{public}s, err = %{public}d", GetAnonyPath(it.first).c_str(), errno); errFiles.emplace_back(it.first); errFileInfos_[it.first].push_back(errno); } else if (curFileStat.st_size != it.second && (!S_ISDIR(curFileStat.st_mode))) { - HILOGE("(Debug) File size check error, file: %{public}s", GetAnonyPath(it.first).c_str()); + HILOGE("File size error, file: %{public}s, idx: %{public}" PRId64 ", act: %{public}" PRId64 "", + GetAnonyPath(it.first).c_str(), it.second, curFileStat.st_size); errFiles.emplace_back(it.first); errFileInfos_[it.first].push_back(errno); }