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