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 #include "hap_verify_info.h"
17
18 #include <iostream>
19
20 namespace OHOS {
21 namespace AppPackingTool {
GetBundleName() const22 const std::string& HapVerifyInfo::GetBundleName() const
23 {
24 return bundleName_;
25 }
26
SetBundleName(const std::string & bundleName)27 void HapVerifyInfo::SetBundleName(const std::string& bundleName)
28 {
29 bundleName_ = bundleName;
30 }
31
GetVendor() const32 const std::string& HapVerifyInfo::GetVendor() const
33 {
34 return vendor_;
35 }
36
SetVendor(const std::string & vendor)37 void HapVerifyInfo::SetVendor(const std::string& vendor)
38 {
39 vendor_ = vendor;
40 }
41
GetVersion() const42 const Version& HapVerifyInfo::GetVersion() const
43 {
44 return version_;
45 }
46
SetVersion(const Version & version)47 void HapVerifyInfo::SetVersion(const Version& version)
48 {
49 version_ = version;
50 }
51
GetApiVersion() const52 const ModuleApiVersion& HapVerifyInfo::GetApiVersion() const
53 {
54 return apiVersion_;
55 }
56
SetApiVersion(const ModuleApiVersion & apiVersion)57 void HapVerifyInfo::SetApiVersion(const ModuleApiVersion& apiVersion)
58 {
59 apiVersion_ = apiVersion;
60 }
61
GetModuleName() const62 const std::string& HapVerifyInfo::GetModuleName() const
63 {
64 return moduleName_;
65 }
66
SetModuleName(const std::string & moduleName)67 void HapVerifyInfo::SetModuleName(const std::string& moduleName)
68 {
69 moduleName_ = moduleName;
70 }
71
GetPackageName() const72 const std::string& HapVerifyInfo::GetPackageName() const
73 {
74 return packageName_;
75 }
76
SetPackageName(const std::string & packageName)77 void HapVerifyInfo::SetPackageName(const std::string& packageName)
78 {
79 packageName_ = packageName;
80 }
81
GetAbilityNames() const82 const std::list<std::string>& HapVerifyInfo::GetAbilityNames() const
83 {
84 return abilityNames_;
85 }
86
SetAbilityNames(const std::list<std::string> & abilityNames)87 void HapVerifyInfo::SetAbilityNames(const std::list<std::string>& abilityNames)
88 {
89 abilityNames_ = abilityNames;
90 }
91
AddAbilityNames(const std::list<std::string> & nameList)92 void HapVerifyInfo::AddAbilityNames(const std::list<std::string>& nameList)
93 {
94 abilityNames_.insert(abilityNames_.end(), nameList.begin(), nameList.end());
95 }
96
GetDistroFilter() const97 const DistroFilter& HapVerifyInfo::GetDistroFilter() const
98 {
99 return distroFilter_;
100 }
101
SetDistroFilter(const DistroFilter & distroFilter)102 void HapVerifyInfo::SetDistroFilter(const DistroFilter& distroFilter)
103 {
104 distroFilter_ = distroFilter;
105 }
106
GetDeviceTypes() const107 const std::list<std::string>& HapVerifyInfo::GetDeviceTypes() const
108 {
109 return deviceTypes_;
110 }
111
SetDeviceTypes(const std::list<std::string> & deviceTypes)112 void HapVerifyInfo::SetDeviceTypes(const std::list<std::string>& deviceTypes)
113 {
114 deviceTypes_ = deviceTypes;
115 }
116
IsStageModule() const117 const bool& HapVerifyInfo::IsStageModule() const
118 {
119 return isStageModule_;
120 }
121
SetStageModule(const bool & isStageModule)122 void HapVerifyInfo::SetStageModule(const bool& isStageModule)
123 {
124 isStageModule_ = isStageModule;
125 }
126
GetModuleType() const127 const std::string& HapVerifyInfo::GetModuleType() const
128 {
129 return moduleType_;
130 }
131
SetModuleType(const std::string & moduleType)132 void HapVerifyInfo::SetModuleType(const std::string& moduleType)
133 {
134 moduleType_ = moduleType;
135 }
136
IsInstallationFree() const137 const bool& HapVerifyInfo::IsInstallationFree() const
138 {
139 return isInstallationFree_;
140 }
141
SetInstallationFree(const bool & isInstallationFree)142 void HapVerifyInfo::SetInstallationFree(const bool& isInstallationFree)
143 {
144 isInstallationFree_ = isInstallationFree;
145 }
146
GetDependencies() const147 const std::list<std::string>& HapVerifyInfo::GetDependencies() const
148 {
149 return dependencies_;
150 }
151
SetDependencies(const std::list<std::string> & dependencies)152 void HapVerifyInfo::SetDependencies(const std::list<std::string>& dependencies)
153 {
154 dependencies_ = dependencies;
155 }
156
GetDependencyItemList() const157 const std::list<DependencyItem>& HapVerifyInfo::GetDependencyItemList() const
158 {
159 return dependencyItemList_;
160 }
161
SetDependencyItemList(const std::list<DependencyItem> & dependencyItemList)162 void HapVerifyInfo::SetDependencyItemList(const std::list<DependencyItem>& dependencyItemList)
163 {
164 dependencyItemList_ = dependencyItemList;
165 ConvertToDependency();
166 }
167
GetProfileStr() const168 const std::string& HapVerifyInfo::GetProfileStr() const
169 {
170 return profileStr_;
171 }
172
SetProfileStr(const std::string & profileStr)173 void HapVerifyInfo::SetProfileStr(const std::string& profileStr)
174 {
175 profileStr_ = profileStr;
176 }
177
GetResourceMap() const178 const std::map<std::string, std::string>& HapVerifyInfo::GetResourceMap() const
179 {
180 return resourceMap_;
181 }
182
SetResourceMap(const std::map<std::string,std::string> & resourceMap)183 void HapVerifyInfo::SetResourceMap(const std::map<std::string, std::string>& resourceMap)
184 {
185 resourceMap_ = resourceMap;
186 }
187
GetBundleType() const188 const std::string& HapVerifyInfo::GetBundleType() const
189 {
190 return bundleType_;
191 }
192
SetBundleType(const std::string & bundleType)193 void HapVerifyInfo::SetBundleType(const std::string& bundleType)
194 {
195 bundleType_ = bundleType;
196 }
197
GetAtomicServiceType() const198 const std::string& HapVerifyInfo::GetAtomicServiceType() const
199 {
200 return atomicServiceType_;
201 }
202
SetAtomicServiceType(const std::string & atomicServiceType)203 void HapVerifyInfo::SetAtomicServiceType(const std::string& atomicServiceType)
204 {
205 atomicServiceType_ = atomicServiceType;
206 }
207
GetPreloadItems() const208 const std::list<PreloadItem>& HapVerifyInfo::GetPreloadItems() const
209 {
210 return preloadItems_;
211 }
212
SetPreloadItems(const std::list<PreloadItem> & preloadItems)213 void HapVerifyInfo::SetPreloadItems(const std::list<PreloadItem>& preloadItems)
214 {
215 preloadItems_ = preloadItems;
216 }
217
GetTargetBundleName() const218 const std::string& HapVerifyInfo::GetTargetBundleName() const
219 {
220 return targetBundleName_;
221 }
222
SetTargetBundleName(const std::string & targetBundleName)223 void HapVerifyInfo::SetTargetBundleName(const std::string& targetBundleName)
224 {
225 targetBundleName_ = targetBundleName;
226 }
227
GetTargetPriority() const228 const int32_t& HapVerifyInfo::GetTargetPriority() const
229 {
230 return targetPriority_;
231 }
232
SetTargetPriority(const int32_t & priority)233 void HapVerifyInfo::SetTargetPriority(const int32_t& priority)
234 {
235 targetPriority_ = priority;
236 }
237
GetTargetModuleName() const238 const std::string& HapVerifyInfo::GetTargetModuleName() const
239 {
240 return targetModuleName_;
241 }
242
SetTargetModuleName(const std::string & targetModuleName)243 void HapVerifyInfo::SetTargetModuleName(const std::string& targetModuleName)
244 {
245 targetModuleName_ = targetModuleName;
246 }
247
GetTargetModulePriority() const248 const int32_t& HapVerifyInfo::GetTargetModulePriority() const
249 {
250 return targetModulePriority_;
251 }
252
SetTargetModulePriority(const int32_t & priority)253 void HapVerifyInfo::SetTargetModulePriority(const int32_t& priority)
254 {
255 targetModulePriority_ = priority;
256 }
257
GetFileLength() const258 const int64_t& HapVerifyInfo::GetFileLength() const
259 {
260 return fileLength_;
261 }
262
SetFileLength(const int64_t & fileLength)263 void HapVerifyInfo::SetFileLength(const int64_t& fileLength)
264 {
265 fileLength_ = fileLength;
266 }
267
GetEntrySizeLimit() const268 const int32_t& HapVerifyInfo::GetEntrySizeLimit() const
269 {
270 return entrySizeLimit_;
271 }
272
SetEntrySizeLimit(const int32_t & limit)273 void HapVerifyInfo::SetEntrySizeLimit(const int32_t& limit)
274 {
275 entrySizeLimit_ = limit;
276 }
277
GetNotEntrySizeLimit() const278 const int32_t& HapVerifyInfo::GetNotEntrySizeLimit() const
279 {
280 return notEntrySizeLimit_;
281 }
282
SetNotEntrySizeLimit(const int32_t & notEntrySizeLimit)283 void HapVerifyInfo::SetNotEntrySizeLimit(const int32_t& notEntrySizeLimit)
284 {
285 notEntrySizeLimit_ = notEntrySizeLimit;
286 }
287
GetSumSizeLimit() const288 const int32_t& HapVerifyInfo::GetSumSizeLimit() const
289 {
290 return sumSizeLimit_;
291 }
292
SetSumSizeLimit(const int32_t & sumSizeLimit)293 void HapVerifyInfo::SetSumSizeLimit(const int32_t& sumSizeLimit)
294 {
295 sumSizeLimit_ = sumSizeLimit;
296 }
297
IsDebug() const298 const bool& HapVerifyInfo::IsDebug() const
299 {
300 return debug_;
301 }
302
SetDebug(const bool & debug)303 void HapVerifyInfo::SetDebug(const bool& debug)
304 {
305 debug_ = debug;
306 }
307
GetCompileSdkVersion() const308 const std::string& HapVerifyInfo::GetCompileSdkVersion() const
309 {
310 return compileSdkVersion_;
311 }
312
SetCompileSdkVersion(const std::string & compileSdkVersion)313 void HapVerifyInfo::SetCompileSdkVersion(const std::string& compileSdkVersion)
314 {
315 compileSdkVersion_ = compileSdkVersion;
316 }
317
GetCompileSdkType() const318 const std::string& HapVerifyInfo::GetCompileSdkType() const
319 {
320 return compileSdkType_;
321 }
322
SetCompileSdkType(const std::string & compileSdkType)323 void HapVerifyInfo::SetCompileSdkType(const std::string& compileSdkType)
324 {
325 compileSdkType_ = compileSdkType;
326 }
327
GetProxyDataUris() const328 const std::list<std::string>& HapVerifyInfo::GetProxyDataUris() const
329 {
330 return proxyDataUris_;
331 }
332
SetProxyDataUris(const std::list<std::string> & proxyDataUris)333 void HapVerifyInfo::SetProxyDataUris(const std::list<std::string>& proxyDataUris)
334 {
335 proxyDataUris_ = proxyDataUris;
336 }
337
GetContinueTypeMap() const338 const std::map<std::string, std::list<std::string>>& HapVerifyInfo::GetContinueTypeMap() const
339 {
340 return continueTypeMap_;
341 }
342
SetContinueTypeMap(const std::map<std::string,std::list<std::string>> & continueTypeMap)343 void HapVerifyInfo::SetContinueTypeMap(const std::map<std::string, std::list<std::string>>& continueTypeMap)
344 {
345 continueTypeMap_ = continueTypeMap;
346 }
347
GetMultiAppMode() const348 const MultiAppMode& HapVerifyInfo::GetMultiAppMode() const
349 {
350 return multiAppMode_;
351 }
352
SetMultiAppMode(const MultiAppMode & multiAppMode)353 void HapVerifyInfo::SetMultiAppMode(const MultiAppMode& multiAppMode)
354 {
355 multiAppMode_ = multiAppMode;
356 }
357
GetAssetAccessGroups() const358 const std::list<std::string>& HapVerifyInfo::GetAssetAccessGroups() const
359 {
360 return assetAccessGroups_;
361 }
362
SetAssetAccessGroups(const std::list<std::string> & assetAccessGroups)363 void HapVerifyInfo::SetAssetAccessGroups(const std::list<std::string>& assetAccessGroups)
364 {
365 assetAccessGroups_ = assetAccessGroups;
366 }
367
ConvertToDependency()368 void HapVerifyInfo::ConvertToDependency()
369 {
370 for (DependencyItem item : dependencyItemList_) {
371 if (!item.bundleName.empty() && item.bundleName.compare(bundleName_) == 0) {
372 dependencies_.emplace_back(item.moduleName);
373 }
374 }
375 }
376
GetFileType() const377 const std::string& HapVerifyInfo::GetFileType() const
378 {
379 return fileType_;
380 }
381
SetFileType(const std::string & fileType)382 void HapVerifyInfo::SetFileType(const std::string& fileType)
383 {
384 fileType_ = fileType;
385 }
386 } // namespace AppPackingTool
387 } // namespace OHOS
388