• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
38 private:
39     static bool CheckSharedAppIsValid(const std::list<HapVerifyInfo>& hapVerifyInfos, bool& isOverlay);
40     static void setAtomicServiceFileSizeLimit(std::list<HapVerifyInfo>& hapVerifyInfos);
41     static bool GetHapVerifyInfosfromFileList(const std::list<std::string>& fileList,
42         std::list<HapVerifyInfo>& hapVerifyInfos);
43 };
44 }  // namespace AppPackingTool
45 }  // namespace OHOS
46 #endif  // DEVELOPTOOLS_PACKING_TOOL_APT_FRAMEWORKS_INCLUDE_MODULE_JSON_UTILS_H
47