1 /* 2 * Copyright (c) 2021 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 * Ability info. 24 * 25 */ 26 public class AbilityInfo { 27 /** 28 * Indicates the name of ability. 29 */ 30 public String name = ""; 31 32 /** 33 * Indicates the description of ability. 34 */ 35 public String description = ""; 36 37 /** 38 * Indicates the description resource of ability. 39 */ 40 public String descriptionRes = ""; 41 42 /** 43 * Indicates the icon of ability. 44 */ 45 public String icon = ""; 46 47 /** 48 * Indicates the icon path of ability. 49 */ 50 public String iconPath = ""; 51 52 /** 53 * Indicates the label of ability. 54 */ 55 public String label = ""; 56 57 /** 58 * Indicates the label resource of ability. 59 */ 60 public String labelRes = ""; 61 62 /** 63 * Indicates the type of ability. 64 */ 65 public String type = ""; 66 67 /** 68 * Indicates the formsEnabled of ability. 69 */ 70 public boolean formsEnabled = false; 71 72 /** 73 * Indicates the formInfo of ability. 74 */ 75 public FormInfo formInfo = null; 76 77 /** 78 * Indicates the uri of ability. 79 */ 80 public String uri = ""; 81 82 /** 83 * Indicates the launchType of ability. 84 */ 85 public String launchType = ""; 86 87 /** 88 * Indicates the orientation of ability. 89 */ 90 public String orientation = ""; 91 92 /** 93 * Indicates the visible of ability. 94 */ 95 public boolean visible = false; 96 97 /** 98 * Indicates the grantPermission of ability. 99 */ 100 public boolean grantPermission = false; 101 102 /** 103 * Indicates the readPermission of ability. 104 */ 105 public String readPermission = ""; 106 107 /** 108 * Indicates the writePermission of ability. 109 */ 110 public String writePermission = ""; 111 112 /** 113 * Indicates the uriPermission mode of ability. 114 */ 115 public String uriPermissionMode = ""; 116 117 /** 118 * Indicates the uriPermission path of ability. 119 */ 120 public String uriPermissionPath = ""; 121 122 /** 123 * Indicates the directLaunch of ability. 124 */ 125 public boolean directLaunch = false; 126 127 /** 128 * Indicates the mission of ability. 129 */ 130 public String mission = ""; 131 132 /** 133 * Indicates the targetAbility of ability. 134 */ 135 public String targetAbility = ""; 136 137 /** 138 * Indicates the multiUserShared of ability. 139 */ 140 public boolean multiUserShared = false; 141 142 /** 143 * Indicates the supportPipMode of ability. 144 */ 145 public boolean supportPipMode = false; 146 147 /** 148 * Indicates the srcLanguage of ability. 149 */ 150 public String srcLanguage = "js"; 151 152 /** 153 * Indicates the srcPath of ability. 154 */ 155 public String srcPath = ""; 156 157 // stage module character 158 /** 159 * Indicates the srcEntrance of module ModuleJson. 160 */ 161 public String srcEntrance = ""; 162 163 /** 164 * Indicates the continuable of module ModuleJson. 165 */ 166 public boolean continuable = false; 167 168 /** 169 * Indicates the metaData of ability. 170 */ 171 public MetaData metaData = new MetaData(); 172 173 /** 174 * Indicates the configChanges of ability. 175 */ 176 public List<String> configChanges = new ArrayList<String>(); 177 178 /** 179 * Indicates the forms of ability. 180 */ 181 public List<AbilityFormInfo> formInfos = new ArrayList<AbilityFormInfo>(); 182 183 /** 184 * Indicates the permissions of ability. 185 */ 186 public List<String> permissions = new ArrayList<String>(); 187 188 /** 189 * Indicates the skills of ability. 190 */ 191 public List<SkillInfo> skills = new ArrayList<SkillInfo>(); 192 193 /** 194 * Indicates the backgroundModes of ability. 195 */ 196 public List<String> backgroundModes = new ArrayList<String>(); 197 198 /** 199 * Indicates the labels of ability, for Multilingual. 200 */ 201 private HashMap<String, String> labels = new HashMap<>(); 202 203 /** 204 * Indicates the descriptions of ability, for Multilingual. 205 */ 206 private HashMap<String, String> descriptions = new HashMap<>(); 207 208 /** 209 * get the customize Data value defined in this ability. 210 */ getCustomizeDataValue(String customizeDataName)211 public String getCustomizeDataValue(String customizeDataName) { 212 for (CustomizeData data : metaData.customizeDatas) { 213 if (customizeDataName.equals(data.name)) { 214 return data.value; 215 } 216 } 217 return ""; 218 } 219 setDescriptions(HashMap<String, String> descriptions)220 public void setDescriptions(HashMap<String, String> descriptions) { 221 this.descriptions = descriptions; 222 } 223 setLabels(HashMap<String, String> labels)224 public void setLabels(HashMap<String, String> labels) { 225 this.labels = labels; 226 } 227 getLabels()228 public HashMap<String, String> getLabels() { 229 return labels; 230 } 231 getDescriptions()232 public HashMap<String, String> getDescriptions() { 233 return descriptions; 234 } 235 }