1 /* 2 * Copyright (c) 2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef DEVELOPTOOLS_PACKING_TOOL_APT_FRAMEWORKS_INCLUDE_MODULE_JSON_UTILS_H 17 #define DEVELOPTOOLS_PACKING_TOOL_APT_FRAMEWORKS_INCLUDE_MODULE_JSON_UTILS_H 18 19 #include <string> 20 21 #include "hap_verify_info.h" 22 23 namespace OHOS { 24 namespace AppPackingTool { 25 class ModuleJsonUtils { 26 public: ModuleJsonUtils()27 ModuleJsonUtils() {}; ~ModuleJsonUtils()28 virtual ~ModuleJsonUtils() {}; 29 30 ModuleJsonUtils(const ModuleJsonUtils &) = delete; 31 ModuleJsonUtils &operator=(const ModuleJsonUtils &) = delete; 32 33 static bool GetStageHapVerifyInfo(const std::string& hapFilePath, HapVerifyInfo& hapVerifyInfo); 34 static bool GetFaHapVerifyInfo(const std::string& hapFilePath, HapVerifyInfo& hapVerifyInfo); 35 static bool CheckHapsIsValid(const std::list<std::string>& fileList, const bool& isSharedApp); 36 static bool IsModuleHap(const std::string hapFilePath); 37 static bool GetHapVerifyInfosMapfromFileList(const std::list<std::string>& fileList, 38 std::map<std::string, std::shared_ptr<HapVerifyInfo>>& hapVerifyInfoMap); 39 static bool CheckAppAtomicServiceCompressedSizeValid(std::map<std::string, 40 std::string> parameterMap, std::map<std::string, std::shared_ptr<HapVerifyInfo>>& hapVerifyInfoMap); 41 42 private: 43 static bool CheckSharedAppIsValid(const std::list<HapVerifyInfo>& hapVerifyInfos, bool& isOverlay); 44 static void setAtomicServiceFileSizeLimit(std::list<HapVerifyInfo>& hapVerifyInfos); 45 static bool GetHapVerifyInfosfromFileList(const std::list<std::string>& fileList, 46 std::list<HapVerifyInfo>& hapVerifyInfos); 47 }; 48 } // namespace AppPackingTool 49 } // namespace OHOS 50 #endif // DEVELOPTOOLS_PACKING_TOOL_APT_FRAMEWORKS_INCLUDE_MODULE_JSON_UTILS_H 51