1 /* 2 * Copyright (c) 2021-2023 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 package ohos; 17 18 import java.util.ArrayList; 19 import java.util.HashMap; 20 import java.util.List; 21 22 /** 23 * Hap info. 24 * 25 */ 26 public class HapInfo { 27 /** 28 * Indicates hap is stage or FA. 29 */ 30 public AppModel appModel = AppModel.FA; 31 32 /** 33 * Indicates the package of HapInfo. 34 */ 35 public String packageStr = ""; 36 37 /** 38 * Indicates the name of HapInfo. 39 */ 40 public String name = ""; 41 42 /** 43 * Indicates the description of HapInfo. 44 */ 45 public String description = ""; 46 47 /** 48 * Indicates the supportedModes of HapInfo. 49 */ 50 public List<String> supportedModes = new ArrayList<String>(); 51 52 /** 53 * Indicates the abilities of HapInfo. 54 */ 55 public List<AbilityInfo> abilities = new ArrayList<AbilityInfo>(); 56 57 /** 58 * Indicates the defPermissions of HapInfo. 59 * @Deprecated 60 */ 61 public List<DefPermission> defPermissions = new ArrayList<DefPermission>(); 62 63 /** 64 * Indicates the definePermissions of HapInfo. 65 * @Deprecated 66 */ 67 public List<DefinePermission> definePermissions = new ArrayList<>(); 68 69 /** 70 * Indicates the defPermissionsGroups of HapInfo. 71 * @Deprecated 72 */ 73 public List<DefPermissionGroup> defPermissionsGroups = new ArrayList<DefPermissionGroup>(); 74 75 /** 76 * Indicates the distro of HapInfo. 77 */ 78 public Distro distro = null; 79 80 /** 81 * Indicates the reqCapabilities of HapInfo. 82 */ 83 public List<String> reqCapabilities = new ArrayList<String>(); 84 85 /** 86 * Indicates the deviceType of HapInfo. 87 */ 88 public List<String> deviceType = new ArrayList<String>(); 89 90 /** 91 * Indicates the metaData of HapInfo. 92 */ 93 public MetaData metaData = new MetaData(); 94 95 /** 96 * Indicates the dependency config. 97 */ 98 public List<DependencyItem> dependencies = new ArrayList<>(); 99 100 /** 101 * Indicates the HapInfo is Js app. 102 */ 103 public boolean isJs = false; 104 105 /** 106 * Indicates the reqPermissions of HapInfo. 107 */ 108 public List<ReqPermission> reqPermissions = new ArrayList<ReqPermission>(); 109 110 /** 111 * Indicates the commonEvents of HapInfo. 112 */ 113 public List<CommonEvent> commonEvents = new ArrayList<CommonEvent>(); 114 115 /** 116 * Indicates the shortcuts of HapInfo. 117 */ 118 public List<Shortcut> shortcuts = new ArrayList<Shortcut>(); 119 120 /** 121 * Indicates the DistroFilter of HapInfo 122 */ 123 public DistroFilter distroFilter = new DistroFilter(); 124 125 // stage module character 126 /** 127 * Indicates the srcEntrance of ModuleInfo. 128 */ 129 public String srcEntrance = ""; 130 131 /** 132 * Indicates the process of ModuleInfo. 133 */ 134 public String process = ""; 135 136 /** 137 * Indicates the mainElement of ModuleInfo. 138 */ 139 public String mainElement = ""; 140 141 /** 142 * Indicates the uiSyntax of ModuleInfo. 143 */ 144 public String uiSyntax = "hml"; 145 146 /** 147 * Indicates the pages of ModuleInfo. 148 */ 149 public List<String> pages = new ArrayList<>(); 150 151 /** 152 * Indicates the extensionAbilityInfo of ModuleInfo. 153 */ 154 public List<ExtensionAbilityInfo> extensionAbilityInfos = new ArrayList<>(); 155 156 /** 157 * Indicates the module atomic service of ModuleInfo. 158 */ 159 public ModuleAtomicService moduleAtomicService = new ModuleAtomicService(); 160 161 /** 162 * Indicates the form of module ModuleJson. 163 */ 164 public List<AbilityFormInfo> formInfos = new ArrayList<>(); 165 166 /** 167 * Indicates the descriptions of HapInfo. 168 */ 169 private HashMap<String, String> descriptions = new HashMap<>(); 170 setDescriptions(HashMap<String, String> descriptions)171 public void setDescriptions(HashMap<String, String> descriptions) { 172 this.descriptions = descriptions; 173 } 174 getDescriptions()175 public HashMap<String, String> getDescriptions() { 176 return descriptions; 177 } 178 179 /** 180 * get the customize Data value defined in this module. 181 */ getCustomizeDataValue(String customizeDataName)182 public String getCustomizeDataValue(String customizeDataName) { 183 for (CustomizeData data : metaData.customizeDatas) { 184 if (customizeDataName.equals(data.name)) { 185 return data.value; 186 } 187 } 188 return ""; 189 } 190 } 191