diff --git a/packing_tool/frameworks/include/app_packager.h b/packing_tool/frameworks/include/app_packager.h index 5fa7d4023721770f0c6ad1b7169931b1b87fcaa6..b92bee4783d9c213a3b80535b57cac2884d2b819 100644 --- a/packing_tool/frameworks/include/app_packager.h +++ b/packing_tool/frameworks/include/app_packager.h @@ -63,6 +63,7 @@ private: std::list formattedEntryCardPathList_; bool isSharedApp_ = false; bool isAppService_ = false; + std::map> hapVerifyInfoMap_; }; } // namespace AppExecFwk } // namespace OHOS diff --git a/packing_tool/frameworks/include/fast_app_packager.h b/packing_tool/frameworks/include/fast_app_packager.h index 046715bd58f837b4450477ed8bb94d9a491ee624..ddac54a9384b3b864e7e5d12fc8c5f111b2e7813 100644 --- a/packing_tool/frameworks/include/fast_app_packager.h +++ b/packing_tool/frameworks/include/fast_app_packager.h @@ -83,6 +83,7 @@ private: std::list formattedHapPathList_; std::list formattedHspPathList_; ZipWrapper zipWrapper_; + std::map> hapVerifyInfoMap_; }; } // namespace AppExecFwk } // namespace OHOS diff --git a/packing_tool/frameworks/include/json/hap_verify_utils.h b/packing_tool/frameworks/include/json/hap_verify_utils.h index 55d55e6be9dff5ab76ac6f791030f4282a37d30e..5821ece7dc5999ce2258373bedc79c3451e82064 100644 --- a/packing_tool/frameworks/include/json/hap_verify_utils.h +++ b/packing_tool/frameworks/include/json/hap_verify_utils.h @@ -69,6 +69,7 @@ public: static bool CheckHapIsValid(const std::list& hapVerifyInfos); static bool CheckSharedAppIsValid(const std::list& hapVerifyInfos); + static bool CheckFileSizeIsValid(const std::list& hapVerifyInfos); private: static bool CheckAppFieldsIsSame(const std::list& hapVerifyInfos); @@ -123,7 +124,6 @@ private: static bool GetDeviceHapVerifyInfoMap(const std::list& hapVerifyInfos, std::map>& deviceInfoMap); static bool CheckAtomicServicePreloadsIsValid(const std::list& hapVerifyInfos); - static bool CheckFileSizeIsValid(const std::list& hapVerifyInfos); static bool CheckAtomicServiceModuleSize(const std::list& hapVerifyInfos); static void GetModuleDependency(const HapVerifyInfo& hapVerifyInfo, const std::list& hapVerifyInfoList, std::list& moduleDependency); diff --git a/packing_tool/frameworks/include/json/module_json_utils.h b/packing_tool/frameworks/include/json/module_json_utils.h index 94666925315558104f9dba523e1c3a85652b6637..5e844e246fff0625198b5470d6d3a3f9c76eefab 100644 --- a/packing_tool/frameworks/include/json/module_json_utils.h +++ b/packing_tool/frameworks/include/json/module_json_utils.h @@ -34,6 +34,8 @@ public: static bool GetFaHapVerifyInfo(const std::string& hapFilePath, HapVerifyInfo& hapVerifyInfo); static bool CheckHapsIsValid(const std::list& fileList, const bool& isSharedApp); static bool IsModuleHap(const std::string hapFilePath); + static bool GetHapVerifyInfosMapfromFileList(const std::list& fileList, std::map>& hapVerifyInfoMap); + static bool CheckAppAtomicServiceCompressedSizeValid(std::map parameterMap, std::map>& hapVerifyInfoMap); private: static bool CheckSharedAppIsValid(const std::list& hapVerifyInfos, bool& isOverlay); diff --git a/packing_tool/frameworks/include/multiapp_packager.h b/packing_tool/frameworks/include/multiapp_packager.h index 87c1ebf6b6ea999248690fc41d6172c3f760d72e..ca23c62cfd37207b5fe80ba853efaa1fb3f9ce27 100644 --- a/packing_tool/frameworks/include/multiapp_packager.h +++ b/packing_tool/frameworks/include/multiapp_packager.h @@ -56,6 +56,7 @@ private: ZipWrapper zipWrapper_; std::list formattedAppList_; std::list formattedHapAndHspList_; + std::map> hapVerifyInfoMap_; }; } // namespace AppExecFwk } // namespace OHOS diff --git a/packing_tool/frameworks/include/zip_constants.h b/packing_tool/frameworks/include/zip_constants.h index 9b5c54abe912e416d2696a0cac891ec0fad1909a..3abcd4a33673557ce79a915de0cd17d5cde13842 100644 --- a/packing_tool/frameworks/include/zip_constants.h +++ b/packing_tool/frameworks/include/zip_constants.h @@ -32,6 +32,11 @@ enum ZipErrCode { ZIP_ERR_SUCCESS = 0 }; +enum class ZipMethod : int32_t { + ZIP_METHOD_STORED = 0, + ZIP_METHOD_DEFLATED = Z_DEFLATED +}; + enum class ZipLevel : int32_t { ZIP_LEVEL_DEFAULT = Z_DEFAULT_COMPRESSION, ZIP_LEVEL_0 = Z_NO_COMPRESSION, diff --git a/packing_tool/frameworks/include/zip_wrapper.h b/packing_tool/frameworks/include/zip_wrapper.h index 7bdddc1db0efab574198a144b50b292a5a338127..7a14000472313bc5e07e6fff01364fc0da4ed81f 100644 --- a/packing_tool/frameworks/include/zip_wrapper.h +++ b/packing_tool/frameworks/include/zip_wrapper.h @@ -46,6 +46,11 @@ public: zipLevel_ = zipLevel; } + void SetZipMethod(ZipMethod zipMethod) + { + zipMethod_ = zipMethod; + } + const zip_fileinfo& ZipFileInfo() const { return zipFileInfo_; @@ -72,6 +77,7 @@ private: zip_fileinfo zipFileInfo_ = {}; std::string zipFilePath_; ZipLevel zipLevel_ = ZipLevel::ZIP_LEVEL_DEFAULT; + ZipMethod zipMethod_ = ZipMethod::ZIP_METHOD_STORED; }; } // namespace AppPackingTool } // namespace OHOS diff --git a/packing_tool/frameworks/src/app_packager.cpp b/packing_tool/frameworks/src/app_packager.cpp index 67355a736cac11f1b281e73c57c5a729c159ec20..b96a04c07377cab2bf0cfedbda6d5f906d46646d 100644 --- a/packing_tool/frameworks/src/app_packager.cpp +++ b/packing_tool/frameworks/src/app_packager.cpp @@ -18,6 +18,7 @@ #include "constants.h" #include "json/hap_verify_info.h" #include "json/module_json_utils.h" +#include "json/hap_verify_utils.h" #include "log.h" #include "utils.h" @@ -423,6 +424,10 @@ bool AppPackager::CompressHapAndHspFiles(const fs::path &tempPath, const fs::pat LOGE("AppPackager::CheckHapsIsValid verify failed."); return false; } + if (!ModuleJsonUtils::GetHapVerifyInfosMapfromFileList(fileList, hapVerifyInfoMap_)) { + LOGE("AppPackager::GetHapVerifyInfosMapfromFileList failed."); + return false; + } if (!AddHapListToApp(fileList)) { zipWrapper_.SetZipLevel(ZipLevel::ZIP_LEVEL_DEFAULT); LOGE("AppPackager::AddHapListToApp failed."); @@ -453,12 +458,16 @@ bool AppPackager::AddHapListToApp(const std::list &fileList) if (hapVerifyInfo.IsDebug()) { zipWrapper_.SetZipLevel(ZipLevel::ZIP_LEVEL_0); } + zipWrapper_.SetZipMethod(ZipMethod::ZIP_METHOD_DEFLATED); if (zipWrapper_.AddFileOrDirectoryToZip(hapPath, fs::path(hapPath).filename().string()) != ZipErrCode::ZIP_ERR_SUCCESS) { + zipWrapper_.SetZipLevel(ZipLevel::ZIP_LEVEL_DEFAULT); + zipWrapper_.SetZipMethod(ZipMethod::ZIP_METHOD_STORED); LOGE("AppPackager::Process: zipWrapper AddFileOrDirectoryToZip failed!"); return false; } zipWrapper_.SetZipLevel(ZipLevel::ZIP_LEVEL_DEFAULT); + zipWrapper_.SetZipMethod(ZipMethod::ZIP_METHOD_STORED); } return true; } @@ -531,6 +540,10 @@ bool AppPackager::CompressAppMode() } } zipWrapper_.Close(); + if (!ModuleJsonUtils::CheckAppAtomicServiceCompressedSizeValid(parameterMap_, hapVerifyInfoMap_)) { + LOGE("AppPackager::CompressAppMode: CheckAppAtomicServiceCompressedSizeValid() failed!"); + return false; + } return true; } } // namespace AppPackingTool diff --git a/packing_tool/frameworks/src/fast_app_packager.cpp b/packing_tool/frameworks/src/fast_app_packager.cpp index 6c540d5ac38efb2b39fdae7fef392da2671d2758..6c6041283034145759e1cd839aebbc151d08170c 100644 --- a/packing_tool/frameworks/src/fast_app_packager.cpp +++ b/packing_tool/frameworks/src/fast_app_packager.cpp @@ -510,6 +510,10 @@ bool FastAppPackager::CompressFastAppMode() if (fs::exists(tmpDir)) { fs::remove_all(tmpDir); } + if (!ModuleJsonUtils::CheckAppAtomicServiceCompressedSizeValid(parameterMap_, hapVerifyInfoMap_)) { + LOGE("FastAppPackager::CompressFastAppMode: CheckAppAtomicServiceCompressedSizeValid() failed!"); + return false; + } return true; } @@ -519,8 +523,11 @@ bool FastAppPackager::CheckHapAndPackFastApp(std::list &fileList, c LOGE("FastAppPackager::CheckHapsIsValid verify failed, " "check version, apiVersion, moduleName, packageName."); return false; - } - + } + if (!ModuleJsonUtils::GetHapVerifyInfosMapfromFileList(fileList, hapVerifyInfoMap_)) { + LOGE("FastAppPackager::CheckHapAndPackFastApp GetHapVerifyInfosMapfromFileList failed."); + return false; + } if (!PackFastApp(fileList)) { LOGE("FastAppPackager::CompressFastAppMode PackFastApp failed."); return false; @@ -717,12 +724,16 @@ bool FastAppPackager::AddHapListToApp(const std::list &fileList) if (hapVerifyInfo.IsDebug()) { zipWrapper_.SetZipLevel(ZipLevel::ZIP_LEVEL_0); } + zipWrapper_.SetZipMethod(ZipMethod::ZIP_METHOD_DEFLATED); if (zipWrapper_.AddFileOrDirectoryToZip(hapPath, fs::path(hapPath).filename().string()) != ZipErrCode::ZIP_ERR_SUCCESS) { + zipWrapper_.SetZipLevel(ZipLevel::ZIP_LEVEL_DEFAULT); + zipWrapper_.SetZipMethod(ZipMethod::ZIP_METHOD_STORED); LOGE("FastAppPackager::Process: zipWrapper AddFileOrDirectoryToZip failed!"); return false; } zipWrapper_.SetZipLevel(ZipLevel::ZIP_LEVEL_DEFAULT); + zipWrapper_.SetZipMethod(ZipMethod::ZIP_METHOD_STORED); } return true; } diff --git a/packing_tool/frameworks/src/json/hap_verify_utils.cpp b/packing_tool/frameworks/src/json/hap_verify_utils.cpp index d0d9fd6a012140627edda2ba7c1deb950489f40f..0896f59ba1fcc312ac9c57e0cafda9c54894cc8b 100644 --- a/packing_tool/frameworks/src/json/hap_verify_utils.cpp +++ b/packing_tool/frameworks/src/json/hap_verify_utils.cpp @@ -858,10 +858,6 @@ bool HapVerifyUtils::CheckAtomicServiceIsValid(const std::list& h return false; } } - if (!CheckFileSizeIsValid(hapVerifyInfos)) { - LOGE("CheckFileSizeIsValid failed."); - return false; - } return true; } @@ -966,6 +962,7 @@ bool HapVerifyUtils::CheckFileSizeIsValid(const std::list& hapVer std::map> deviceInfosMap; if (!GetDeviceHapVerifyInfoMap(hapVerifyInfos, deviceInfosMap)) { + LOGE("HapVerifyUtils::CheckFileSizeIsValid GetDeviceHapVerifyInfoMap failed!"); return false; } std::map>::iterator iter; diff --git a/packing_tool/frameworks/src/json/module_json_utils.cpp b/packing_tool/frameworks/src/json/module_json_utils.cpp index 7ede4143c5bd2c9e8940c0bf6e19774b80ae1852..984071c3862325046530a33be6bc68b41665aaa8 100644 --- a/packing_tool/frameworks/src/json/module_json_utils.cpp +++ b/packing_tool/frameworks/src/json/module_json_utils.cpp @@ -24,6 +24,7 @@ #include "module_json.h" #include "utils.h" #include "zip_utils.h" +#include "constants.h" namespace fs = std::filesystem; @@ -171,6 +172,104 @@ bool ModuleJsonUtils::GetHapVerifyInfosfromFileList(const std::list return true; } +bool ModuleJsonUtils::GetHapVerifyInfosMapfromFileList(const std::list& fileList, std::map>& hapVerifyInfoMap) +{ + for (auto& hapPath : fileList) { + if (hapPath.empty()) { + LOGE("Hap file path is empty!"); + return false; + } + fs::path fsHapPath(hapPath); + std::string fileName = fsHapPath.filename().string(); + if (fileName.empty()) { + LOGE("Hap file name is empty!"); + return false; + } + std::transform(fileName.begin(), fileName.end(), fileName.begin(), ::tolower); + if (!Utils::EndsWith(fileName, HAP_SUFFIX) && !Utils::EndsWith(fileName, HSP_SUFFIX)) { + LOGE("Hap file is not a hap or hsp file!"); + return false; + } + auto hapVerifyInfo = std::make_shared(); + if (IsModuleHap(hapPath)) { + if (!GetStageHapVerifyInfo(hapPath, *hapVerifyInfo)) { + LOGE("GetStageHapVerifyInfo failed"); + return false; + } + } else { + if (!GetFaHapVerifyInfo(hapPath, *hapVerifyInfo)) { + LOGE("GetFaHapVerifyInfo failed"); + return false; + } + } + hapVerifyInfoMap.emplace(fileName, hapVerifyInfo); + } + return true; +} + +bool ModuleJsonUtils::CheckAppAtomicServiceCompressedSizeValid(std::map parameterMap, std::map>& hapVerifyInfoMap) +{ + std::string packMode; + std::string outPath; + if (parameterMap.find(Constants::PARAM_MODE) == parameterMap.end() || + parameterMap.find(Constants::PARAM_OUT_PATH) == parameterMap.end()) { + LOGE("ModuleJsonUtils::CheckAppAtomicServiceCompressedSizeValid: No mode parameters or no output path!"); + return false; + } + packMode = parameterMap.at(Constants::PARAM_MODE); + if (packMode != Constants::MODE_APP && packMode != Constants::MODE_FAST_APP && packMode != Constants::MODE_MULTIAPP) { + return true; + } + outPath = parameterMap.at(Constants::PARAM_OUT_PATH); + unzFile zipApp = unzOpen(outPath.c_str()); + if (!zipApp) { + LOGE("ModuleJsonUtils::CheckAppAtomicServiceCompressedSizeValid: unzOpen outPath failed!"); + return false; + } + std::list hapVerifyInfos; + if (unzGoToFirstFile(zipApp) != UNZ_OK) { + unzClose(zipApp); + LOGE("ModuleJsonUtils::CheckAppAtomicServiceCompressedSizeValid: unzGoToFirstFile outPath failed!"); + return false; + } + do { + unz_file_info fileInfo; + if (unzGetCurrentFileInfo(zipApp, &fileInfo, nullptr, 0, nullptr, 0, nullptr, 0) != UNZ_OK) { + unzClose(zipApp); + LOGE("ModuleJsonUtils::CheckAppAtomicServiceCompressedSizeValid: failed to get file info (phase 1)"); + return false; + } + std::vector fileNameBuffer(fileInfo.size_filename + 1); + if (unzGetCurrentFileInfo(zipApp, &fileInfo, fileNameBuffer.data(), fileNameBuffer.size(), + nullptr, 0, nullptr, 0) != UNZ_OK) { + unzClose(zipApp); + LOGE("ModuleJsonUtils::CheckAppAtomicServiceCompressedSizeValid: failed to get file info (phase 2)"); + return false; + } + std::string fileName(fileNameBuffer.data()); + auto it = hapVerifyInfoMap.find(fileName); + if (it == hapVerifyInfoMap.end()) { + continue; + } + it->second->SetFileLength(fileInfo.compressed_size); + hapVerifyInfos.push_back(*(it->second)); + } while (unzGoToNextFile(zipApp) == UNZ_OK); + unzClose(zipApp); + if (hapVerifyInfos.empty()) { + LOGI("ModuleJsonUtils::CheckAppAtomicServiceCompressedSizeValid: hapVerifyInfos is empty"); + return true; + } + std::string bundleType = hapVerifyInfos.front().GetBundleType(); + if (bundleType != Constants::ATOMIC_SERVICE) { + return true; + } + bool isStage = hapVerifyInfos.front().IsStageModule(); + if (!isStage) { + return true; + } + return HapVerifyUtils::CheckFileSizeIsValid(hapVerifyInfos); +} + // java : checkHapIsValid bool ModuleJsonUtils::CheckHapsIsValid(const std::list& fileList, const bool& isSharedApp) { diff --git a/packing_tool/frameworks/src/multiapp_packager.cpp b/packing_tool/frameworks/src/multiapp_packager.cpp index a3014d69fcde30314e2cb8a67165865890de4859..951d023d4afe3f985df8225e957e683103ecff30 100644 --- a/packing_tool/frameworks/src/multiapp_packager.cpp +++ b/packing_tool/frameworks/src/multiapp_packager.cpp @@ -400,6 +400,10 @@ bool MultiAppPackager::CompressAppModeForMultiProject() } return false; } + if (!ModuleJsonUtils::GetHapVerifyInfosMapfromFileList(fileList, hapVerifyInfoMap_)) { + LOGE("MultiAppPackager::CompressAppModeForMultiProject GetHapVerifyInfosMapfromFileList failed."); + return false; + } for (const auto &hapPath : fileList) { std::string zipPath = fs::path(hapPath).filename().string(); if (zipWrapper_.AddFileOrDirectoryToZip(hapPath, zipPath) != ZipErrCode::ZIP_ERR_SUCCESS) { @@ -416,6 +420,10 @@ bool MultiAppPackager::CompressAppModeForMultiProject() if (fs::exists(tempSelectedHapDirPath)) { fs::remove_all(tempSelectedHapDirPath); } + if (!ModuleJsonUtils::CheckAppAtomicServiceCompressedSizeValid(parameterMap_, hapVerifyInfoMap_)) { + LOGE("MultiAppPackager::CompressAppModeForMultiProject: CheckAppAtomicServiceCompressedSizeValid() failed!"); + return false; + } return true; } } // namespace AppPackingTool diff --git a/packing_tool/frameworks/src/zip_wrapper.cpp b/packing_tool/frameworks/src/zip_wrapper.cpp index ec0e612e77044b97847c8fdbfca6072ded3844c3..b7a811f0a52841100dd3cd31ebb44c1773ca6b26 100644 --- a/packing_tool/frameworks/src/zip_wrapper.cpp +++ b/packing_tool/frameworks/src/zip_wrapper.cpp @@ -163,7 +163,7 @@ int32_t ZipWrapper::AddFileToZip(const fs::path &fsFilePath, const fs::path &fsZ } zipFileInfo_.external_fa = ZIP_FILE_ATTR_DEFAULT; int ret = zipOpenNewFileInZip64(zipFile_, fsZipPath.string().c_str(), &zipFileInfo_, nullptr, 0, - nullptr, 0, nullptr, 0, static_cast(zipLevel_), 1); + nullptr, 0, nullptr, static_cast(zipMethod_), static_cast(zipLevel_), 1); if (ret != ZIP_OK) { LOGE("open file in zip failed![ret=%d][fsZipPath=%s]", ret, fsZipPath.string().c_str()); file.close(); diff --git a/packing_tool/frameworks/test/unittest/app_packager_test/mock/mock_module_json_utils.cpp b/packing_tool/frameworks/test/unittest/app_packager_test/mock/mock_module_json_utils.cpp index 81fc4b8594a6eaec53206956ee106d7449e60721..1e5ea8bf9866c1152c159d1c67c74a9d478b64e8 100644 --- a/packing_tool/frameworks/test/unittest/app_packager_test/mock/mock_module_json_utils.cpp +++ b/packing_tool/frameworks/test/unittest/app_packager_test/mock/mock_module_json_utils.cpp @@ -25,6 +25,7 @@ #include "module_json.h" #include "utils.h" #include "zip_utils.h" +#include "constants.h" namespace fs = std::filesystem; @@ -200,6 +201,104 @@ bool ModuleJsonUtils::GetHapVerifyInfosfromFileList(const std::list return true; } +bool ModuleJsonUtils::GetHapVerifyInfosMapfromFileList(const std::list& fileList, std::map>& hapVerifyInfoMap) +{ + for (auto& hapPath : fileList) { + if (hapPath.empty()) { + LOGE("Hap file path is empty!"); + return false; + } + fs::path fsHapPath(hapPath); + std::string fileName = fsHapPath.filename().string(); + if (fileName.empty()) { + LOGE("Hap file name is empty!"); + return false; + } + std::transform(fileName.begin(), fileName.end(), fileName.begin(), ::tolower); + if (!Utils::EndsWith(fileName, HAP_SUFFIX) && !Utils::EndsWith(fileName, HSP_SUFFIX)) { + LOGE("Hap file is not a hap or hsp file!"); + return false; + } + auto hapVerifyInfo = std::make_shared(); + if (IsModuleHap(hapPath)) { + if (!GetStageHapVerifyInfo(hapPath, *hapVerifyInfo)) { + LOGE("GetStageHapVerifyInfo failed"); + return false; + } + } else { + if (!GetFaHapVerifyInfo(hapPath, *hapVerifyInfo)) { + LOGE("GetFaHapVerifyInfo failed"); + return false; + } + } + hapVerifyInfoMap.emplace(fileName, hapVerifyInfo); + } + return true; +} + +bool ModuleJsonUtils::CheckAppAtomicServiceCompressedSizeValid(std::map parameterMap, std::map>& hapVerifyInfoMap) +{ + std::string packMode; + std::string outPath; + if (parameterMap.find(Constants::PARAM_MODE) == parameterMap.end() || + parameterMap.find(Constants::PARAM_OUT_PATH) == parameterMap.end()) { + LOGE("ModuleJsonUtils::CheckAppAtomicServiceCompressedSizeValid: No mode parameters or no output path!"); + return false; + } + packMode = parameterMap.at(Constants::PARAM_MODE); + if (packMode != Constants::MODE_APP && packMode != Constants::MODE_FAST_APP && packMode != Constants::MODE_MULTIAPP) { + return true; + } + outPath = parameterMap.at(Constants::PARAM_OUT_PATH); + unzFile zipApp = unzOpen(outPath.c_str()); + if (!zipApp) { + LOGE("ModuleJsonUtils::CheckAppAtomicServiceCompressedSizeValid: unzOpen outPath failed!"); + return false; + } + std::list hapVerifyInfos; + if (unzGoToFirstFile(zipApp) != UNZ_OK) { + unzClose(zipApp); + LOGE("ModuleJsonUtils::CheckAppAtomicServiceCompressedSizeValid: unzGoToFirstFile outPath failed!"); + return false; + } + do { + unz_file_info fileInfo; + if (unzGetCurrentFileInfo(zipApp, &fileInfo, nullptr, 0, nullptr, 0, nullptr, 0) != UNZ_OK) { + unzClose(zipApp); + LOGE("ModuleJsonUtils::CheckAppAtomicServiceCompressedSizeValid: failed to get file info (phase 1)"); + return false; + } + std::vector fileNameBuffer(fileInfo.size_filename + 1); + if (unzGetCurrentFileInfo(zipApp, &fileInfo, fileNameBuffer.data(), fileNameBuffer.size(), + nullptr, 0, nullptr, 0) != UNZ_OK) { + unzClose(zipApp); + LOGE("ModuleJsonUtils::CheckAppAtomicServiceCompressedSizeValid: failed to get file info (phase 2)"); + return false; + } + std::string fileName(fileNameBuffer.data()); + auto it = hapVerifyInfoMap.find(fileName); + if (it == hapVerifyInfoMap.end()) { + continue; + } + it->second->SetFileLength(fileInfo.compressed_size); + hapVerifyInfos.push_back(*(it->second)); + } while (unzGoToNextFile(zipApp) == UNZ_OK); + unzClose(zipApp); + if (hapVerifyInfos.empty()) { + LOGI("ModuleJsonUtils::CheckAppAtomicServiceCompressedSizeValid: hapVerifyInfos is empty"); + return true; + } + std::string bundleType = hapVerifyInfos.front().GetBundleType(); + if (bundleType != Constants::ATOMIC_SERVICE) { + return true; + } + bool isStage = hapVerifyInfos.front().IsStageModule(); + if (!isStage) { + return true; + } + return HapVerifyUtils::CheckFileSizeIsValid(hapVerifyInfos); +} + // java : checkHapIsValid bool ModuleJsonUtils::CheckHapsIsValid(const std::list& fileList, const bool& isSharedApp) {