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 #include "application_info.h"
17
18 #include <errno.h>
19 #include <fcntl.h>
20 #include <string.h>
21 #include <set>
22 #include <unistd.h>
23
24 #include "message_parcel.h"
25 #include "nlohmann/json.hpp"
26 #include "parcel_macro.h"
27 #include "string_ex.h"
28
29 #include "app_log_wrapper.h"
30 #include "bundle_constants.h"
31 #include "json_serializer.h"
32 #include "json_util.h"
33
34 namespace OHOS {
35 namespace AppExecFwk {
36 namespace {
37 const std::string APPLICATION_NAME = "name";
38 const std::string APPLICATION_VERSION_CODE = "versionCode";
39 const std::string APPLICATION_VERSION_NAME = "versionName";
40 const std::string APPLICATION_MIN_COMPATIBLE_VERSION_CODE = "minCompatibleVersionCode";
41 const std::string APPLICATION_API_COMPATIBLE_VERSION = "apiCompatibleVersion";
42 const std::string APPLICATION_API_TARGET_VERSION = "apiTargetVersion";
43 const std::string APPLICATION_ICON_PATH = "iconPath";
44 const std::string APPLICATION_ICON_ID = "iconId";
45 const std::string APPLICATION_LABEL = "label";
46 const std::string APPLICATION_LABEL_ID = "labelId";
47 const std::string APPLICATION_DESCRIPTION = "description";
48 const std::string APPLICATION_DESCRIPTION_ID = "descriptionId";
49 const std::string APPLICATION_KEEP_ALIVE = "keepAlive";
50 const std::string APPLICATION_REMOVABLE = "removable";
51 const std::string APPLICATION_SINGLETON = "singleton";
52 const std::string APPLICATION_USER_DATA_CLEARABLE = "userDataClearable";
53 const std::string APPLICATION_IS_SYSTEM_APP = "isSystemApp";
54 const std::string APPLICATION_IS_LAUNCHER_APP = "isLauncherApp";
55 const std::string APPLICATION_IS_FREEINSTALL_APP = "isFreeInstallApp";
56 const std::string APPLICATION_RUNNING_RESOURCES_APPLY = "runningResourcesApply";
57 const std::string APPLICATION_ASSOCIATED_WAKE_UP = "associatedWakeUp";
58 const std::string APPLICATION_HIDE_DESKTOP_ICON = "hideDesktopIcon";
59 const std::string APPLICATION_FORM_VISIBLE_NOTIFY = "formVisibleNotify";
60 const std::string APPLICATION_ALLOW_COMMON_EVENT = "allowCommonEvent";
61 const std::string APPLICATION_CODE_PATH = "codePath";
62 const std::string APPLICATION_DATA_DIR = "dataDir";
63 const std::string APPLICATION_DATA_BASE_DIR = "dataBaseDir";
64 const std::string APPLICATION_CACHE_DIR = "cacheDir";
65 const std::string APPLICATION_ENTRY_DIR = "entryDir";
66 const std::string APPLICATION_API_RELEASETYPE = "apiReleaseType";
67 const std::string APPLICATION_DEBUG = "debug";
68 const std::string APPLICATION_DEVICE_ID = "deviceId";
69 const std::string APPLICATION_DISTRIBUTED_NOTIFICATION_ENABLED = "distributedNotificationEnabled";
70 const std::string APPLICATION_ENTITY_TYPE = "entityType";
71 const std::string APPLICATION_PROCESS = "process";
72 const std::string APPLICATION_SUPPORTED_MODES = "supportedModes";
73 const std::string APPLICATION_VENDOR = "vendor";
74 const std::string APPLICATION_ACCESSIBLE = "accessible";
75 const std::string APPLICATION_PRIVILEGE_LEVEL = "appPrivilegeLevel";
76 const std::string APPLICATION_ACCESSTOKEN_ID = "accessTokenId";
77 const std::string APPLICATION_ACCESSTOKEN_ID_EX = "accessTokenIdEx";
78 const std::string APPLICATION_ENABLED = "enabled";
79 const std::string APPLICATION_UID = "uid";
80 const std::string APPLICATION_PERMISSIONS = "permissions";
81 const std::string APPLICATION_MODULE_SOURCE_DIRS = "moduleSourceDirs";
82 const std::string APPLICATION_MODULE_INFOS = "moduleInfos";
83 const std::string APPLICATION_META_DATA_CONFIG_JSON = "metaData";
84 const std::string APPLICATION_META_DATA_MODULE_JSON = "metadata";
85 const std::string APPLICATION_FINGERPRINT = "fingerprint";
86 const std::string APPLICATION_ICON = "icon";
87 const std::string APPLICATION_FLAGS = "flags";
88 const std::string APPLICATION_ENTRY_MODULE_NAME = "entryModuleName";
89 const std::string APPLICATION_NATIVE_LIBRARY_PATH = "nativeLibraryPath";
90 const std::string APPLICATION_CPU_ABI = "cpuAbi";
91 const std::string APPLICATION_ARK_NATIVE_FILE_PATH = "arkNativeFilePath";
92 const std::string APPLICATION_ARK_NATIVE_FILE_ABI = "arkNativeFileAbi";
93 const std::string APPLICATION_IS_COMPRESS_NATIVE_LIBS = "isCompressNativeLibs";
94 const std::string APPLICATION_SIGNATURE_KEY = "signatureKey";
95 const std::string APPLICATION_TARGETBUNDLELIST = "targetBundleList";
96 const std::string APPLICATION_APP_DISTRIBUTION_TYPE = "appDistributionType";
97 const std::string APPLICATION_APP_PROVISION_TYPE = "appProvisionType";
98 const std::string APPLICATION_ICON_RESOURCE = "iconResource";
99 const std::string APPLICATION_LABEL_RESOURCE = "labelResource";
100 const std::string APPLICATION_DESCRIPTION_RESOURCE = "descriptionResource";
101 const std::string APPLICATION_MULTI_PROJECTS = "multiProjects";
102 const std::string APPLICATION_CROWDTEST_DEADLINE = "crowdtestDeadline";
103 const std::string APPLICATION_APP_QUICK_FIX = "appQuickFix";
104 const std::string RESOURCE_ID = "id";
105 const size_t APPLICATION_CAPACITY = 10240; // 10K
106 const std::string APPLICATION_NEED_APP_DETAIL = "needAppDetail";
107 const std::string APPLICATION_APP_DETAIL_ABILITY_LIBRARY_PATH = "appDetailAbilityLibraryPath";
108 const std::string APPLICATION_APP_TARGET_BUNDLE_NAME = "targetBundleName";
109 const std::string APPLICATION_APP_TARGET_PRIORITY = "targetPriority";
110 const std::string APPLICATION_APP_OVERLAY_STATE = "overlayState";
111 const std::string APPLICATION_ASAN_ENABLED = "asanEnabled";
112 const std::string APPLICATION_ASAN_LOG_PATH = "asanLogPath";
113 const std::string APPLICATION_APP_TYPE = "bundleType";
114 const std::string APPLICATION_COMPILE_SDK_VERSION = "compileSdkVersion";
115 const std::string APPLICATION_COMPILE_SDK_TYPE = "compileSdkType";
116 const std::string APPLICATION_RESOURCES_APPLY = "resourcesApply";
117 const std::string APPLICATION_ALLOW_ENABLE_NOTIFICATION = "allowEnableNotification";
118 const std::string APPLICATION_GWP_ASAN_ENABLED = "GWPAsanEnabled";
119 const std::string APPLICATION_RESERVED_FLAG = "applicationReservedFlag";
120 }
121
Metadata(const std::string & paramName,const std::string & paramValue,const std::string & paramResource)122 Metadata::Metadata(const std::string ¶mName, const std::string ¶mValue, const std::string ¶mResource)
123 : name(paramName), value(paramValue), resource(paramResource)
124 {
125 }
126
ReadFromParcel(Parcel & parcel)127 bool Metadata::ReadFromParcel(Parcel &parcel)
128 {
129 name = Str16ToStr8(parcel.ReadString16());
130 value = Str16ToStr8(parcel.ReadString16());
131 resource = Str16ToStr8(parcel.ReadString16());
132 return true;
133 }
134
Marshalling(Parcel & parcel) const135 bool Metadata::Marshalling(Parcel &parcel) const
136 {
137 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String16, parcel, Str8ToStr16(name));
138 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String16, parcel, Str8ToStr16(value));
139 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String16, parcel, Str8ToStr16(resource));
140 return true;
141 }
142
Unmarshalling(Parcel & parcel)143 Metadata *Metadata::Unmarshalling(Parcel &parcel)
144 {
145 Metadata *metadata = new (std::nothrow) Metadata;
146 if (metadata && !metadata->ReadFromParcel(parcel)) {
147 APP_LOGE("read from parcel failed");
148 delete metadata;
149 metadata = nullptr;
150 }
151 return metadata;
152 }
153
CustomizeData(std::string paramName,std::string paramValue,std::string paramExtra)154 CustomizeData::CustomizeData(std::string paramName, std::string paramValue, std::string paramExtra)
155 :name(paramName), value(paramValue), extra(paramExtra)
156 {
157 }
158
ReadFromParcel(Parcel & parcel)159 bool CustomizeData::ReadFromParcel(Parcel &parcel)
160 {
161 name = Str16ToStr8(parcel.ReadString16());
162 value = Str16ToStr8(parcel.ReadString16());
163 extra = Str16ToStr8(parcel.ReadString16());
164 return true;
165 }
166
Unmarshalling(Parcel & parcel)167 CustomizeData *CustomizeData::Unmarshalling(Parcel &parcel)
168 {
169 CustomizeData *customizeData = new (std::nothrow) CustomizeData;
170 if (customizeData && !customizeData->ReadFromParcel(parcel)) {
171 APP_LOGE("read from parcel failed");
172 delete customizeData;
173 customizeData = nullptr;
174 }
175 return customizeData;
176 }
177
Marshalling(Parcel & parcel) const178 bool CustomizeData::Marshalling(Parcel &parcel) const
179 {
180 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String16, parcel, Str8ToStr16(name));
181 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String16, parcel, Str8ToStr16(value));
182 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String16, parcel, Str8ToStr16(extra));
183 return true;
184 }
185
ReadFromParcel(Parcel & parcel)186 bool Resource::ReadFromParcel(Parcel &parcel)
187 {
188 bundleName = Str16ToStr8(parcel.ReadString16());
189 moduleName = Str16ToStr8(parcel.ReadString16());
190 id = parcel.ReadInt32();
191 return true;
192 }
193
Marshalling(Parcel & parcel) const194 bool Resource::Marshalling(Parcel &parcel) const
195 {
196 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String16, parcel, Str8ToStr16(bundleName));
197 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String16, parcel, Str8ToStr16(moduleName));
198 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, id);
199 return true;
200 }
201
Unmarshalling(Parcel & parcel)202 Resource *Resource::Unmarshalling(Parcel &parcel)
203 {
204 Resource *resource = new (std::nothrow) Resource;
205 if (resource && !resource->ReadFromParcel(parcel)) {
206 APP_LOGE("read from parcel failed");
207 delete resource;
208 resource = nullptr;
209 }
210 return resource;
211 }
212
ReadMetaDataFromParcel(Parcel & parcel)213 bool ApplicationInfo::ReadMetaDataFromParcel(Parcel &parcel)
214 {
215 int32_t metaDataSize = parcel.ReadInt32();
216 CONTAINER_SECURITY_VERIFY(parcel, metaDataSize, &metaData);
217 for (int32_t i = 0; i < metaDataSize; i++) {
218 std::string moduleName = Str16ToStr8(parcel.ReadString16());
219 int32_t customizeDataSize = parcel.ReadInt32();
220 std::vector<CustomizeData> customizeDatas;
221 metaData[moduleName] = customizeDatas;
222 CONTAINER_SECURITY_VERIFY(parcel, customizeDataSize, &customizeDatas);
223 for (int j = 0; j < customizeDataSize; j++) {
224 std::unique_ptr<CustomizeData> customizeData(parcel.ReadParcelable<CustomizeData>());
225 if (!customizeData) {
226 APP_LOGE("ReadParcelable<CustomizeData> failed");
227 return false;
228 }
229 metaData[moduleName].emplace_back(*customizeData);
230 }
231 }
232 return true;
233 }
234
ReadFromParcel(Parcel & parcel)235 bool ApplicationInfo::ReadFromParcel(Parcel &parcel)
236 {
237 name = Str16ToStr8(parcel.ReadString16());
238 bundleName = Str16ToStr8(parcel.ReadString16());
239 versionCode = parcel.ReadUint32();
240 versionName = Str16ToStr8(parcel.ReadString16());
241 minCompatibleVersionCode = parcel.ReadInt32();
242 apiCompatibleVersion = parcel.ReadUint32();
243 apiTargetVersion = parcel.ReadInt32();
244 crowdtestDeadline = parcel.ReadInt64();
245
246 iconPath = Str16ToStr8(parcel.ReadString16());
247 iconId = parcel.ReadInt32();
248 std::unique_ptr<Resource> iconResourcePtr(parcel.ReadParcelable<Resource>());
249 if (!iconResourcePtr) {
250 APP_LOGE("icon ReadParcelable<Resource> failed");
251 return false;
252 }
253 iconResource = *iconResourcePtr;
254
255 label = Str16ToStr8(parcel.ReadString16());
256 labelId = parcel.ReadInt32();
257 std::unique_ptr<Resource> labelResourcePtr(parcel.ReadParcelable<Resource>());
258 if (!labelResourcePtr) {
259 APP_LOGE("label ReadParcelable<Resource> failed");
260 return false;
261 }
262 labelResource = *labelResourcePtr;
263
264 description = Str16ToStr8(parcel.ReadString16());
265 descriptionId = parcel.ReadInt32();
266 std::unique_ptr<Resource> descriptionResourcePtr(parcel.ReadParcelable<Resource>());
267 if (!descriptionResourcePtr) {
268 APP_LOGE("description ReadParcelable<Resource> failed");
269 return false;
270 }
271 descriptionResource = *descriptionResourcePtr;
272
273 keepAlive = parcel.ReadBool();
274 removable = parcel.ReadBool();
275 singleton = parcel.ReadBool();
276 userDataClearable = parcel.ReadBool();
277 accessible = parcel.ReadBool();
278 isSystemApp = parcel.ReadBool();
279 isLauncherApp = parcel.ReadBool();
280 isFreeInstallApp = parcel.ReadBool();
281 runningResourcesApply = parcel.ReadBool();
282 associatedWakeUp = parcel.ReadBool();
283 hideDesktopIcon = parcel.ReadBool();
284 formVisibleNotify = parcel.ReadBool();
285 int32_t allowCommonEventSize;
286 READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, allowCommonEventSize);
287 CONTAINER_SECURITY_VERIFY(parcel, allowCommonEventSize, &allowCommonEvent);
288 for (auto i = 0; i < allowCommonEventSize; i++) {
289 allowCommonEvent.emplace_back(Str16ToStr8(parcel.ReadString16()));
290 }
291
292 codePath = Str16ToStr8(parcel.ReadString16());
293 dataDir = Str16ToStr8(parcel.ReadString16());
294 dataBaseDir = Str16ToStr8(parcel.ReadString16());
295 cacheDir = Str16ToStr8(parcel.ReadString16());
296 entryDir = Str16ToStr8(parcel.ReadString16());
297
298 apiReleaseType = Str16ToStr8(parcel.ReadString16());
299 debug = parcel.ReadBool();
300 deviceId = Str16ToStr8(parcel.ReadString16());
301 distributedNotificationEnabled = parcel.ReadBool();
302 allowEnableNotification = parcel.ReadBool();
303 entityType = Str16ToStr8(parcel.ReadString16());
304 process = Str16ToStr8(parcel.ReadString16());
305 supportedModes = parcel.ReadInt32();
306 vendor = Str16ToStr8(parcel.ReadString16());
307 appPrivilegeLevel = Str16ToStr8(parcel.ReadString16());
308 appDistributionType = Str16ToStr8(parcel.ReadString16());
309 appProvisionType = Str16ToStr8(parcel.ReadString16());
310 accessTokenId = parcel.ReadUint32();
311 accessTokenIdEx = parcel.ReadUint64();
312 enabled = parcel.ReadBool();
313 uid = parcel.ReadInt32();
314 nativeLibraryPath = Str16ToStr8(parcel.ReadString16());
315 cpuAbi = Str16ToStr8(parcel.ReadString16());
316 arkNativeFilePath = Str16ToStr8(parcel.ReadString16());
317 arkNativeFileAbi = Str16ToStr8(parcel.ReadString16());
318
319 int32_t permissionsSize;
320 READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, permissionsSize);
321 CONTAINER_SECURITY_VERIFY(parcel, permissionsSize, &permissions);
322 for (auto i = 0; i < permissionsSize; i++) {
323 permissions.emplace_back(Str16ToStr8(parcel.ReadString16()));
324 }
325
326 int32_t moduleSourceDirsSize;
327 READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, moduleSourceDirsSize);
328 CONTAINER_SECURITY_VERIFY(parcel, moduleSourceDirsSize, &moduleSourceDirs);
329 for (auto i = 0; i < moduleSourceDirsSize; i++) {
330 moduleSourceDirs.emplace_back(Str16ToStr8(parcel.ReadString16()));
331 }
332
333 int32_t moduleInfosSize;
334 READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, moduleInfosSize);
335 CONTAINER_SECURITY_VERIFY(parcel, moduleInfosSize, &moduleInfos);
336 for (auto i = 0; i < moduleInfosSize; i++) {
337 std::unique_ptr<ModuleInfo> moduleInfo(parcel.ReadParcelable<ModuleInfo>());
338 if (!moduleInfo) {
339 APP_LOGE("ReadParcelable<ModuleInfo> failed");
340 return false;
341 }
342 moduleInfos.emplace_back(*moduleInfo);
343 }
344
345 int32_t metaDataSize;
346 READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, metaDataSize);
347 CONTAINER_SECURITY_VERIFY(parcel, metaDataSize, &metaData);
348 for (int32_t i = 0; i < metaDataSize; ++i) {
349 std::string key = Str16ToStr8(parcel.ReadString16());
350 int32_t customizeDataSize = parcel.ReadInt32();
351 CONTAINER_SECURITY_VERIFY(parcel, customizeDataSize, &metaData[key]);
352 for (int n = 0; n < customizeDataSize; ++n) {
353 std::unique_ptr<CustomizeData> customizeData(parcel.ReadParcelable<CustomizeData>());
354 if (!customizeData) {
355 APP_LOGE("ReadParcelable<CustomizeData> failed");
356 return false;
357 }
358 metaData[key].emplace_back(*customizeData);
359 }
360 }
361
362 int32_t metadataSize;
363 READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, metadataSize);
364 CONTAINER_SECURITY_VERIFY(parcel, metadataSize, &metadata);
365 for (int32_t i = 0; i < metadataSize; ++i) {
366 std::string key = Str16ToStr8(parcel.ReadString16());
367 int32_t metaSize = parcel.ReadInt32();
368 CONTAINER_SECURITY_VERIFY(parcel, metaSize, &metadata[key]);
369 for (int n = 0; n < metaSize; ++n) {
370 std::unique_ptr<Metadata> meta(parcel.ReadParcelable<Metadata>());
371 if (!meta) {
372 APP_LOGE("ReadParcelable<Metadata> failed");
373 return false;
374 }
375 metadata[key].emplace_back(*meta);
376 }
377 }
378
379 int32_t targetBundleListSize;
380 READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, targetBundleListSize);
381 CONTAINER_SECURITY_VERIFY(parcel, targetBundleListSize, &targetBundleList);
382 for (auto i = 0; i < targetBundleListSize; i++) {
383 targetBundleList.emplace_back(Str16ToStr8(parcel.ReadString16()));
384 }
385
386 fingerprint = Str16ToStr8(parcel.ReadString16());
387 icon = Str16ToStr8(parcel.ReadString16());
388 flags = parcel.ReadInt32();
389 entryModuleName = Str16ToStr8(parcel.ReadString16());
390 isCompressNativeLibs = parcel.ReadBool();
391 signatureKey = Str16ToStr8(parcel.ReadString16());
392 multiProjects = parcel.ReadBool();
393 std::unique_ptr<AppQuickFix> appQuickFixPtr(parcel.ReadParcelable<AppQuickFix>());
394 if (appQuickFixPtr == nullptr) {
395 APP_LOGE("ReadParcelable<AppQuickFixPtr> failed");
396 return false;
397 }
398 appQuickFix = *appQuickFixPtr;
399 needAppDetail = parcel.ReadBool();
400 appDetailAbilityLibraryPath = Str16ToStr8(parcel.ReadString16());
401 targetBundleName = Str16ToStr8(parcel.ReadString16());
402 targetPriority = parcel.ReadInt32();
403 overlayState = parcel.ReadInt32();
404 asanEnabled = parcel.ReadBool();
405 asanLogPath = Str16ToStr8(parcel.ReadString16());
406 bundleType = static_cast<BundleType>(parcel.ReadInt32());
407 compileSdkVersion = Str16ToStr8(parcel.ReadString16());
408 compileSdkType = Str16ToStr8(parcel.ReadString16());
409 int32_t resourceApplySize;
410 READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, resourceApplySize);
411 CONTAINER_SECURITY_VERIFY(parcel, resourceApplySize, &resourcesApply);
412 for (int32_t i = 0; i < resourceApplySize; ++i) {
413 resourcesApply.emplace_back(parcel.ReadInt32());
414 }
415
416 gwpAsanEnabled = parcel.ReadBool();
417 applicationReservedFlag = parcel.ReadUint32();
418 return true;
419 }
420
Unmarshalling(Parcel & parcel)421 ApplicationInfo *ApplicationInfo::Unmarshalling(Parcel &parcel)
422 {
423 ApplicationInfo *info = new (std::nothrow) ApplicationInfo();
424 if (info && !info->ReadFromParcel(parcel)) {
425 APP_LOGW("read from parcel failed");
426 delete info;
427 info = nullptr;
428 }
429 return info;
430 }
431
Marshalling(Parcel & parcel) const432 bool ApplicationInfo::Marshalling(Parcel &parcel) const
433 {
434 APP_LOGD("ApplicationInfo::Marshalling called, bundleName: %{public}s", bundleName.c_str());
435 CHECK_PARCEL_CAPACITY(parcel, APPLICATION_CAPACITY);
436 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String16, parcel, Str8ToStr16(name));
437 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String16, parcel, Str8ToStr16(bundleName));
438 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Uint32, parcel, versionCode);
439 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String16, parcel, Str8ToStr16(versionName));
440 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, minCompatibleVersionCode);
441
442 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Uint32, parcel, apiCompatibleVersion);
443 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, apiTargetVersion);
444 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int64, parcel, crowdtestDeadline);
445
446 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String16, parcel, Str8ToStr16(iconPath));
447 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, iconId);
448 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Parcelable, parcel, &iconResource);
449
450 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String16, parcel, Str8ToStr16(label));
451 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, labelId);
452 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Parcelable, parcel, &labelResource);
453
454 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String16, parcel, Str8ToStr16(description));
455 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, descriptionId);
456 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Parcelable, parcel, &descriptionResource);
457
458 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Bool, parcel, keepAlive);
459 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Bool, parcel, removable);
460 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Bool, parcel, singleton);
461 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Bool, parcel, userDataClearable);
462 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Bool, parcel, accessible);
463 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Bool, parcel, isSystemApp);
464 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Bool, parcel, isLauncherApp);
465 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Bool, parcel, isFreeInstallApp);
466 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Bool, parcel, runningResourcesApply);
467 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Bool, parcel, associatedWakeUp);
468 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Bool, parcel, hideDesktopIcon);
469 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Bool, parcel, formVisibleNotify);
470 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, allowCommonEvent.size());
471 for (auto &event : allowCommonEvent) {
472 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String16, parcel, Str8ToStr16(event));
473 }
474
475 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String16, parcel, Str8ToStr16(codePath));
476 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String16, parcel, Str8ToStr16(dataDir));
477 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String16, parcel, Str8ToStr16(dataBaseDir));
478 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String16, parcel, Str8ToStr16(cacheDir));
479 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String16, parcel, Str8ToStr16(entryDir));
480
481 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String16, parcel, Str8ToStr16(apiReleaseType));
482 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Bool, parcel, debug);
483 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String16, parcel, Str8ToStr16(deviceId));
484 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Bool, parcel, distributedNotificationEnabled);
485 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Bool, parcel, allowEnableNotification);
486 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String16, parcel, Str8ToStr16(entityType));
487 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String16, parcel, Str8ToStr16(process));
488 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, supportedModes);
489 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String16, parcel, Str8ToStr16(vendor));
490
491 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String16, parcel, Str8ToStr16(appPrivilegeLevel));
492 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String16, parcel, Str8ToStr16(appDistributionType));
493 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String16, parcel, Str8ToStr16(appProvisionType));
494
495 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Uint32, parcel, accessTokenId);
496 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Uint64, parcel, accessTokenIdEx);
497 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Bool, parcel, enabled);
498 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, uid);
499
500 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String16, parcel, Str8ToStr16(nativeLibraryPath));
501 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String16, parcel, Str8ToStr16(cpuAbi));
502 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String16, parcel, Str8ToStr16(arkNativeFilePath));
503 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String16, parcel, Str8ToStr16(arkNativeFileAbi));
504 CHECK_PARCEL_CAPACITY(parcel, APPLICATION_CAPACITY);
505 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, permissions.size());
506 for (auto &permission : permissions) {
507 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String16, parcel, Str8ToStr16(permission));
508 }
509
510 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, moduleSourceDirs.size());
511 for (auto &moduleSourceDir : moduleSourceDirs) {
512 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String16, parcel, Str8ToStr16(moduleSourceDir));
513 }
514
515 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, moduleInfos.size());
516 for (auto &moduleInfo : moduleInfos) {
517 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Parcelable, parcel, &moduleInfo);
518 }
519
520 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, metaData.size());
521 for (auto &item : metaData) {
522 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String16, parcel, Str8ToStr16(item.first));
523 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, item.second.size());
524 for (auto &customizeData : item.second) {
525 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Parcelable, parcel, &customizeData);
526 }
527 }
528
529 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, metadata.size());
530 for (auto &item : metadata) {
531 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String16, parcel, Str8ToStr16(item.first));
532 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, item.second.size());
533 for (auto &meta : item.second) {
534 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Parcelable, parcel, &meta);
535 }
536 }
537
538 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, targetBundleList.size());
539 for (auto &targetBundle : targetBundleList) {
540 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String16, parcel, Str8ToStr16(targetBundle));
541 }
542
543 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String16, parcel, Str8ToStr16(fingerprint));
544 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String16, parcel, Str8ToStr16(icon));
545 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, flags);
546 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String16, parcel, Str8ToStr16(entryModuleName));
547 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Bool, parcel, isCompressNativeLibs);
548 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String16, parcel, Str8ToStr16(signatureKey));
549
550 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Bool, parcel, multiProjects);
551 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Parcelable, parcel, &appQuickFix);
552 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Bool, parcel, needAppDetail);
553 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String16, parcel, Str8ToStr16(appDetailAbilityLibraryPath));
554 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String16, parcel, Str8ToStr16(targetBundleName));
555 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, targetPriority);
556 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, overlayState);
557 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Bool, parcel, asanEnabled);
558 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String16, parcel, Str8ToStr16(asanLogPath));
559 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, static_cast<int32_t>(bundleType));
560 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String16, parcel, Str8ToStr16(compileSdkVersion));
561 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String16, parcel, Str8ToStr16(compileSdkType));
562 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, resourcesApply.size());
563 for (auto &item : resourcesApply) {
564 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, item);
565 }
566 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Bool, parcel, gwpAsanEnabled);
567 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Uint32, parcel, applicationReservedFlag);
568 return true;
569 }
570
Dump(std::string prefix,int fd)571 void ApplicationInfo::Dump(std::string prefix, int fd)
572 {
573 APP_LOGI("called dump ApplicationInfo");
574 if (fd < 0) {
575 APP_LOGE("dump ApplicationInfo fd error");
576 return;
577 }
578 int flags = fcntl(fd, F_GETFL);
579 if (flags < 0) {
580 APP_LOGE("dump ApplicationInfo fcntl error, errno : %{public}d", errno);
581 return;
582 }
583 uint uflags = static_cast<uint>(flags);
584 uflags &= O_ACCMODE;
585 if ((uflags == O_WRONLY) || (uflags == O_RDWR)) {
586 nlohmann::json jsonObject = *this;
587 std::string result;
588 result.append(prefix);
589 result.append(jsonObject.dump(Constants::DUMP_INDENT));
590 int ret = TEMP_FAILURE_RETRY(write(fd, result.c_str(), result.size()));
591 if (ret < 0) {
592 APP_LOGE("dump ApplicationInfo write error, errno : %{public}d", errno);
593 }
594 }
595 return;
596 }
597
CheckNeedPreload(const std::string & moduleName) const598 bool ApplicationInfo::CheckNeedPreload(const std::string &moduleName) const
599 {
600 std::set<std::string> preloadModules;
601 auto it = std::find_if(std::begin(moduleInfos), std::end(moduleInfos),
602 [&moduleName](ModuleInfo info) {
603 return info.moduleName == moduleName;
604 });
605 if (it != moduleInfos.end()) {
606 for (const std::string &name : it->preloads) {
607 preloadModules.insert(name);
608 }
609 }
610 if (preloadModules.empty()) {
611 APP_LOGD("the module have no preloads.");
612 return false;
613 }
614 for (const ModuleInfo &moduleInfo : moduleInfos) {
615 auto iter = preloadModules.find(moduleInfo.moduleName);
616 if (iter != preloadModules.end()) {
617 preloadModules.erase(iter);
618 }
619 }
620 if (preloadModules.empty()) {
621 APP_LOGD("all preload modules exist locally.");
622 return false;
623 }
624 APP_LOGD("need to process preload.");
625 return true;
626 }
627
to_json(nlohmann::json & jsonObject,const Resource & resource)628 void to_json(nlohmann::json &jsonObject, const Resource &resource)
629 {
630 jsonObject = nlohmann::json {
631 {Constants::BUNDLE_NAME, resource.bundleName},
632 {Constants::MODULE_NAME, resource.moduleName},
633 {RESOURCE_ID, resource.id}
634 };
635 }
636
from_json(const nlohmann::json & jsonObject,Resource & resource)637 void from_json(const nlohmann::json &jsonObject, Resource &resource)
638 {
639 const auto &jsonObjectEnd = jsonObject.end();
640 int32_t parseResult = ERR_OK;
641 GetValueIfFindKey<std::string>(jsonObject,
642 jsonObjectEnd,
643 Constants::BUNDLE_NAME,
644 resource.bundleName,
645 JsonType::STRING,
646 true,
647 parseResult,
648 ArrayType::NOT_ARRAY);
649 GetValueIfFindKey<std::string>(jsonObject,
650 jsonObjectEnd,
651 Constants::MODULE_NAME,
652 resource.moduleName,
653 JsonType::STRING,
654 true,
655 parseResult,
656 ArrayType::NOT_ARRAY);
657 GetValueIfFindKey<int32_t>(jsonObject,
658 jsonObjectEnd,
659 RESOURCE_ID,
660 resource.id,
661 JsonType::NUMBER,
662 true,
663 parseResult,
664 ArrayType::NOT_ARRAY);
665 if (parseResult != ERR_OK) {
666 APP_LOGE("read Resource from database error, error code : %{public}d", parseResult);
667 }
668 }
669
to_json(nlohmann::json & jsonObject,const ApplicationInfo & applicationInfo)670 void to_json(nlohmann::json &jsonObject, const ApplicationInfo &applicationInfo)
671 {
672 jsonObject = nlohmann::json {
673 {APPLICATION_NAME, applicationInfo.name},
674 {Constants::BUNDLE_NAME, applicationInfo.bundleName},
675 {APPLICATION_VERSION_CODE, applicationInfo.versionCode},
676 {APPLICATION_VERSION_NAME, applicationInfo.versionName},
677 {APPLICATION_MIN_COMPATIBLE_VERSION_CODE, applicationInfo.minCompatibleVersionCode},
678 {APPLICATION_API_COMPATIBLE_VERSION, applicationInfo.apiCompatibleVersion},
679 {APPLICATION_API_TARGET_VERSION, applicationInfo.apiTargetVersion},
680 {APPLICATION_ICON_PATH, applicationInfo.iconPath},
681 {APPLICATION_ICON_ID, applicationInfo.iconId},
682 {APPLICATION_LABEL, applicationInfo.label},
683 {APPLICATION_LABEL_ID, applicationInfo.labelId},
684 {APPLICATION_DESCRIPTION, applicationInfo.description},
685 {APPLICATION_DESCRIPTION_ID, applicationInfo.descriptionId},
686 {APPLICATION_KEEP_ALIVE, applicationInfo.keepAlive},
687 {APPLICATION_REMOVABLE, applicationInfo.removable},
688 {APPLICATION_SINGLETON, applicationInfo.singleton},
689 {APPLICATION_USER_DATA_CLEARABLE, applicationInfo.userDataClearable},
690 {APPLICATION_ACCESSIBLE, applicationInfo.accessible},
691 {APPLICATION_IS_SYSTEM_APP, applicationInfo.isSystemApp},
692 {APPLICATION_IS_LAUNCHER_APP, applicationInfo.isLauncherApp},
693 {APPLICATION_IS_FREEINSTALL_APP, applicationInfo.isFreeInstallApp},
694 {APPLICATION_RUNNING_RESOURCES_APPLY, applicationInfo.runningResourcesApply},
695 {APPLICATION_ASSOCIATED_WAKE_UP, applicationInfo.associatedWakeUp},
696 {APPLICATION_HIDE_DESKTOP_ICON, applicationInfo.hideDesktopIcon},
697 {APPLICATION_FORM_VISIBLE_NOTIFY, applicationInfo.formVisibleNotify},
698 {APPLICATION_ALLOW_COMMON_EVENT, applicationInfo.allowCommonEvent},
699 {APPLICATION_CODE_PATH, applicationInfo.codePath},
700 {APPLICATION_DATA_DIR, applicationInfo.dataDir},
701 {APPLICATION_DATA_BASE_DIR, applicationInfo.dataBaseDir},
702 {APPLICATION_CACHE_DIR, applicationInfo.cacheDir},
703 {APPLICATION_ENTRY_DIR, applicationInfo.entryDir},
704 {APPLICATION_API_RELEASETYPE, applicationInfo.apiReleaseType},
705 {APPLICATION_DEBUG, applicationInfo.debug},
706 {APPLICATION_DEVICE_ID, applicationInfo.deviceId},
707 {APPLICATION_DISTRIBUTED_NOTIFICATION_ENABLED, applicationInfo.distributedNotificationEnabled},
708 {APPLICATION_ALLOW_ENABLE_NOTIFICATION, applicationInfo.allowEnableNotification},
709 {APPLICATION_ENTITY_TYPE, applicationInfo.entityType},
710 {APPLICATION_PROCESS, applicationInfo.process},
711 {APPLICATION_SUPPORTED_MODES, applicationInfo.supportedModes},
712 {APPLICATION_VENDOR, applicationInfo.vendor},
713 {APPLICATION_PRIVILEGE_LEVEL, applicationInfo.appPrivilegeLevel},
714 {APPLICATION_ACCESSTOKEN_ID, applicationInfo.accessTokenId},
715 {APPLICATION_ACCESSTOKEN_ID_EX, applicationInfo.accessTokenIdEx},
716 {APPLICATION_ENABLED, applicationInfo.enabled},
717 {APPLICATION_UID, applicationInfo.uid},
718 {APPLICATION_PERMISSIONS, applicationInfo.permissions},
719 {APPLICATION_MODULE_SOURCE_DIRS, applicationInfo.moduleSourceDirs},
720 {APPLICATION_MODULE_INFOS, applicationInfo.moduleInfos},
721 {APPLICATION_META_DATA_CONFIG_JSON, applicationInfo.metaData},
722 {APPLICATION_META_DATA_MODULE_JSON, applicationInfo.metadata},
723 {APPLICATION_FINGERPRINT, applicationInfo.fingerprint},
724 {APPLICATION_ICON, applicationInfo.icon},
725 {APPLICATION_FLAGS, applicationInfo.flags},
726 {APPLICATION_ENTRY_MODULE_NAME, applicationInfo.entryModuleName},
727 {APPLICATION_NATIVE_LIBRARY_PATH, applicationInfo.nativeLibraryPath},
728 {APPLICATION_CPU_ABI, applicationInfo.cpuAbi},
729 {APPLICATION_ARK_NATIVE_FILE_PATH, applicationInfo.arkNativeFilePath},
730 {APPLICATION_ARK_NATIVE_FILE_ABI, applicationInfo.arkNativeFileAbi},
731 {APPLICATION_IS_COMPRESS_NATIVE_LIBS, applicationInfo.isCompressNativeLibs},
732 {APPLICATION_SIGNATURE_KEY, applicationInfo.signatureKey},
733 {APPLICATION_TARGETBUNDLELIST, applicationInfo.targetBundleList},
734 {APPLICATION_APP_DISTRIBUTION_TYPE, applicationInfo.appDistributionType},
735 {APPLICATION_APP_PROVISION_TYPE, applicationInfo.appProvisionType},
736 {APPLICATION_ICON_RESOURCE, applicationInfo.iconResource},
737 {APPLICATION_LABEL_RESOURCE, applicationInfo.labelResource},
738 {APPLICATION_DESCRIPTION_RESOURCE, applicationInfo.descriptionResource},
739 {APPLICATION_MULTI_PROJECTS, applicationInfo.multiProjects},
740 {APPLICATION_CROWDTEST_DEADLINE, applicationInfo.crowdtestDeadline},
741 {APPLICATION_APP_QUICK_FIX, applicationInfo.appQuickFix},
742 {APPLICATION_NEED_APP_DETAIL, applicationInfo.needAppDetail},
743 {APPLICATION_APP_DETAIL_ABILITY_LIBRARY_PATH, applicationInfo.appDetailAbilityLibraryPath},
744 {APPLICATION_APP_TARGET_BUNDLE_NAME, applicationInfo.targetBundleName},
745 {APPLICATION_APP_TARGET_PRIORITY, applicationInfo.targetPriority},
746 {APPLICATION_APP_OVERLAY_STATE, applicationInfo.overlayState},
747 {APPLICATION_ASAN_ENABLED, applicationInfo.asanEnabled},
748 {APPLICATION_ASAN_LOG_PATH, applicationInfo.asanLogPath},
749 {APPLICATION_APP_TYPE, applicationInfo.bundleType},
750 {APPLICATION_COMPILE_SDK_VERSION, applicationInfo.compileSdkVersion},
751 {APPLICATION_COMPILE_SDK_TYPE, applicationInfo.compileSdkType},
752 {APPLICATION_RESOURCES_APPLY, applicationInfo.resourcesApply},
753 {APPLICATION_GWP_ASAN_ENABLED, applicationInfo.gwpAsanEnabled},
754 {APPLICATION_RESERVED_FLAG, applicationInfo.applicationReservedFlag}
755 };
756 }
757
from_json(const nlohmann::json & jsonObject,ApplicationInfo & applicationInfo)758 void from_json(const nlohmann::json &jsonObject, ApplicationInfo &applicationInfo)
759 {
760 const auto &jsonObjectEnd = jsonObject.end();
761 int32_t parseResult = ERR_OK;
762 GetValueIfFindKey<std::string>(jsonObject,
763 jsonObjectEnd,
764 APPLICATION_NAME,
765 applicationInfo.name,
766 JsonType::STRING,
767 false,
768 parseResult,
769 ArrayType::NOT_ARRAY);
770 GetValueIfFindKey<std::string>(jsonObject,
771 jsonObjectEnd,
772 Constants::BUNDLE_NAME,
773 applicationInfo.bundleName,
774 JsonType::STRING,
775 false,
776 parseResult,
777 ArrayType::NOT_ARRAY);
778 GetValueIfFindKey<uint32_t>(jsonObject,
779 jsonObjectEnd,
780 APPLICATION_VERSION_CODE,
781 applicationInfo.versionCode,
782 JsonType::NUMBER,
783 false,
784 parseResult,
785 ArrayType::NOT_ARRAY);
786 GetValueIfFindKey<std::string>(jsonObject,
787 jsonObjectEnd,
788 APPLICATION_VERSION_NAME,
789 applicationInfo.versionName,
790 JsonType::STRING,
791 false,
792 parseResult,
793 ArrayType::NOT_ARRAY);
794 GetValueIfFindKey<int32_t>(jsonObject,
795 jsonObjectEnd,
796 APPLICATION_MIN_COMPATIBLE_VERSION_CODE,
797 applicationInfo.minCompatibleVersionCode,
798 JsonType::NUMBER,
799 false,
800 parseResult,
801 ArrayType::NOT_ARRAY);
802 GetValueIfFindKey<int32_t>(jsonObject,
803 jsonObjectEnd,
804 APPLICATION_API_COMPATIBLE_VERSION,
805 applicationInfo.apiCompatibleVersion,
806 JsonType::NUMBER,
807 false,
808 parseResult,
809 ArrayType::NOT_ARRAY);
810 GetValueIfFindKey<int32_t>(jsonObject,
811 jsonObjectEnd,
812 APPLICATION_API_TARGET_VERSION,
813 applicationInfo.apiTargetVersion,
814 JsonType::NUMBER,
815 false,
816 parseResult,
817 ArrayType::NOT_ARRAY);
818 GetValueIfFindKey<std::string>(jsonObject,
819 jsonObjectEnd,
820 APPLICATION_ICON_PATH,
821 applicationInfo.iconPath,
822 JsonType::STRING,
823 false,
824 parseResult,
825 ArrayType::NOT_ARRAY);
826 GetValueIfFindKey<int32_t>(jsonObject,
827 jsonObjectEnd,
828 APPLICATION_ICON_ID,
829 applicationInfo.iconId,
830 JsonType::NUMBER,
831 false,
832 parseResult,
833 ArrayType::NOT_ARRAY);
834 GetValueIfFindKey<std::string>(jsonObject,
835 jsonObjectEnd,
836 APPLICATION_LABEL,
837 applicationInfo.label,
838 JsonType::STRING,
839 false,
840 parseResult,
841 ArrayType::NOT_ARRAY);
842 GetValueIfFindKey<int32_t>(jsonObject,
843 jsonObjectEnd,
844 APPLICATION_LABEL_ID,
845 applicationInfo.labelId,
846 JsonType::NUMBER,
847 false,
848 parseResult,
849 ArrayType::NOT_ARRAY);
850 GetValueIfFindKey<std::string>(jsonObject,
851 jsonObjectEnd,
852 APPLICATION_DESCRIPTION,
853 applicationInfo.description,
854 JsonType::STRING,
855 false,
856 parseResult,
857 ArrayType::NOT_ARRAY);
858 GetValueIfFindKey<int32_t>(jsonObject,
859 jsonObjectEnd,
860 APPLICATION_DESCRIPTION_ID,
861 applicationInfo.descriptionId,
862 JsonType::NUMBER,
863 false,
864 parseResult,
865 ArrayType::NOT_ARRAY);
866 GetValueIfFindKey<bool>(jsonObject,
867 jsonObjectEnd,
868 APPLICATION_KEEP_ALIVE,
869 applicationInfo.keepAlive,
870 JsonType::BOOLEAN,
871 false,
872 parseResult,
873 ArrayType::NOT_ARRAY);
874 GetValueIfFindKey<bool>(jsonObject,
875 jsonObjectEnd,
876 APPLICATION_REMOVABLE,
877 applicationInfo.removable,
878 JsonType::BOOLEAN,
879 false,
880 parseResult,
881 ArrayType::NOT_ARRAY);
882 GetValueIfFindKey<bool>(jsonObject,
883 jsonObjectEnd,
884 APPLICATION_SINGLETON,
885 applicationInfo.singleton,
886 JsonType::BOOLEAN,
887 false,
888 parseResult,
889 ArrayType::NOT_ARRAY);
890 GetValueIfFindKey<bool>(jsonObject,
891 jsonObjectEnd,
892 APPLICATION_USER_DATA_CLEARABLE,
893 applicationInfo.userDataClearable,
894 JsonType::BOOLEAN,
895 false,
896 parseResult,
897 ArrayType::NOT_ARRAY);
898 GetValueIfFindKey<bool>(jsonObject,
899 jsonObjectEnd,
900 APPLICATION_ACCESSIBLE,
901 applicationInfo.accessible,
902 JsonType::BOOLEAN,
903 false,
904 parseResult,
905 ArrayType::NOT_ARRAY);
906 GetValueIfFindKey<bool>(jsonObject,
907 jsonObjectEnd,
908 APPLICATION_IS_SYSTEM_APP,
909 applicationInfo.isSystemApp,
910 JsonType::BOOLEAN,
911 false,
912 parseResult,
913 ArrayType::NOT_ARRAY);
914 GetValueIfFindKey<bool>(jsonObject,
915 jsonObjectEnd,
916 APPLICATION_IS_LAUNCHER_APP,
917 applicationInfo.isLauncherApp,
918 JsonType::BOOLEAN,
919 false,
920 parseResult,
921 ArrayType::NOT_ARRAY);
922 GetValueIfFindKey<bool>(jsonObject,
923 jsonObjectEnd,
924 APPLICATION_IS_FREEINSTALL_APP,
925 applicationInfo.isFreeInstallApp,
926 JsonType::BOOLEAN,
927 false,
928 parseResult,
929 ArrayType::NOT_ARRAY);
930 GetValueIfFindKey<bool>(jsonObject,
931 jsonObjectEnd,
932 APPLICATION_RUNNING_RESOURCES_APPLY,
933 applicationInfo.runningResourcesApply,
934 JsonType::BOOLEAN,
935 false,
936 parseResult,
937 ArrayType::NOT_ARRAY);
938 GetValueIfFindKey<bool>(jsonObject,
939 jsonObjectEnd,
940 APPLICATION_ASSOCIATED_WAKE_UP,
941 applicationInfo.associatedWakeUp,
942 JsonType::BOOLEAN,
943 false,
944 parseResult,
945 ArrayType::NOT_ARRAY);
946 GetValueIfFindKey<bool>(jsonObject,
947 jsonObjectEnd,
948 APPLICATION_HIDE_DESKTOP_ICON,
949 applicationInfo.hideDesktopIcon,
950 JsonType::BOOLEAN,
951 false,
952 parseResult,
953 ArrayType::NOT_ARRAY);
954 GetValueIfFindKey<bool>(jsonObject,
955 jsonObjectEnd,
956 APPLICATION_FORM_VISIBLE_NOTIFY,
957 applicationInfo.formVisibleNotify,
958 JsonType::BOOLEAN,
959 false,
960 parseResult,
961 ArrayType::NOT_ARRAY);
962 GetValueIfFindKey<std::vector<std::string>>(jsonObject,
963 jsonObjectEnd,
964 APPLICATION_ALLOW_COMMON_EVENT,
965 applicationInfo.allowCommonEvent,
966 JsonType::ARRAY,
967 false,
968 parseResult,
969 ArrayType::STRING);
970 GetValueIfFindKey<std::string>(jsonObject,
971 jsonObjectEnd,
972 APPLICATION_CODE_PATH,
973 applicationInfo.codePath,
974 JsonType::STRING,
975 false,
976 parseResult,
977 ArrayType::NOT_ARRAY);
978 GetValueIfFindKey<std::string>(jsonObject,
979 jsonObjectEnd,
980 APPLICATION_DATA_DIR,
981 applicationInfo.dataDir,
982 JsonType::STRING,
983 false,
984 parseResult,
985 ArrayType::NOT_ARRAY);
986 GetValueIfFindKey<std::string>(jsonObject,
987 jsonObjectEnd,
988 APPLICATION_DATA_BASE_DIR,
989 applicationInfo.dataBaseDir,
990 JsonType::STRING,
991 false,
992 parseResult,
993 ArrayType::NOT_ARRAY);
994 GetValueIfFindKey<std::string>(jsonObject,
995 jsonObjectEnd,
996 APPLICATION_CACHE_DIR,
997 applicationInfo.cacheDir,
998 JsonType::STRING,
999 false,
1000 parseResult,
1001 ArrayType::NOT_ARRAY);
1002 GetValueIfFindKey<std::string>(jsonObject,
1003 jsonObjectEnd,
1004 APPLICATION_ENTRY_DIR,
1005 applicationInfo.entryDir,
1006 JsonType::STRING,
1007 false,
1008 parseResult,
1009 ArrayType::NOT_ARRAY);
1010 GetValueIfFindKey<std::string>(jsonObject,
1011 jsonObjectEnd,
1012 APPLICATION_API_RELEASETYPE,
1013 applicationInfo.apiReleaseType,
1014 JsonType::STRING,
1015 false,
1016 parseResult,
1017 ArrayType::NOT_ARRAY);
1018 GetValueIfFindKey<bool>(jsonObject,
1019 jsonObjectEnd,
1020 APPLICATION_DEBUG,
1021 applicationInfo.debug,
1022 JsonType::BOOLEAN,
1023 false,
1024 parseResult,
1025 ArrayType::NOT_ARRAY);
1026 GetValueIfFindKey<std::string>(jsonObject,
1027 jsonObjectEnd,
1028 APPLICATION_DEVICE_ID,
1029 applicationInfo.deviceId,
1030 JsonType::STRING,
1031 false,
1032 parseResult,
1033 ArrayType::NOT_ARRAY);
1034 GetValueIfFindKey<bool>(jsonObject,
1035 jsonObjectEnd,
1036 APPLICATION_DISTRIBUTED_NOTIFICATION_ENABLED,
1037 applicationInfo.distributedNotificationEnabled,
1038 JsonType::BOOLEAN,
1039 false,
1040 parseResult,
1041 ArrayType::NOT_ARRAY);
1042 GetValueIfFindKey<bool>(jsonObject,
1043 jsonObjectEnd,
1044 APPLICATION_ALLOW_ENABLE_NOTIFICATION,
1045 applicationInfo.allowEnableNotification,
1046 JsonType::BOOLEAN,
1047 false,
1048 parseResult,
1049 ArrayType::NOT_ARRAY);
1050 GetValueIfFindKey<std::string>(jsonObject,
1051 jsonObjectEnd,
1052 APPLICATION_ENTITY_TYPE,
1053 applicationInfo.entityType,
1054 JsonType::STRING,
1055 false,
1056 parseResult,
1057 ArrayType::NOT_ARRAY);
1058 GetValueIfFindKey<std::string>(jsonObject,
1059 jsonObjectEnd,
1060 APPLICATION_PROCESS,
1061 applicationInfo.process,
1062 JsonType::STRING,
1063 false,
1064 parseResult,
1065 ArrayType::NOT_ARRAY);
1066 GetValueIfFindKey<int>(jsonObject,
1067 jsonObjectEnd,
1068 APPLICATION_SUPPORTED_MODES,
1069 applicationInfo.supportedModes,
1070 JsonType::NUMBER,
1071 false,
1072 parseResult,
1073 ArrayType::NOT_ARRAY);
1074 GetValueIfFindKey<std::string>(jsonObject,
1075 jsonObjectEnd,
1076 APPLICATION_VENDOR,
1077 applicationInfo.vendor,
1078 JsonType::STRING,
1079 false,
1080 parseResult,
1081 ArrayType::NOT_ARRAY);
1082 GetValueIfFindKey<std::string>(jsonObject,
1083 jsonObjectEnd,
1084 APPLICATION_PRIVILEGE_LEVEL,
1085 applicationInfo.appPrivilegeLevel,
1086 JsonType::STRING,
1087 false,
1088 parseResult,
1089 ArrayType::NOT_ARRAY);
1090 GetValueIfFindKey<uint32_t>(jsonObject,
1091 jsonObjectEnd,
1092 APPLICATION_ACCESSTOKEN_ID,
1093 applicationInfo.accessTokenId,
1094 JsonType::NUMBER,
1095 false,
1096 parseResult,
1097 ArrayType::NOT_ARRAY);
1098 GetValueIfFindKey<uint64_t>(jsonObject,
1099 jsonObjectEnd,
1100 APPLICATION_ACCESSTOKEN_ID_EX,
1101 applicationInfo.accessTokenIdEx,
1102 JsonType::NUMBER,
1103 false,
1104 parseResult,
1105 ArrayType::NOT_ARRAY);
1106 GetValueIfFindKey<bool>(jsonObject,
1107 jsonObjectEnd,
1108 APPLICATION_ENABLED,
1109 applicationInfo.enabled,
1110 JsonType::BOOLEAN,
1111 false,
1112 parseResult,
1113 ArrayType::NOT_ARRAY);
1114 GetValueIfFindKey<int>(jsonObject,
1115 jsonObjectEnd,
1116 APPLICATION_UID,
1117 applicationInfo.uid,
1118 JsonType::NUMBER,
1119 false,
1120 parseResult,
1121 ArrayType::NOT_ARRAY);
1122 GetValueIfFindKey<std::vector<std::string>>(jsonObject,
1123 jsonObjectEnd,
1124 APPLICATION_PERMISSIONS,
1125 applicationInfo.permissions,
1126 JsonType::ARRAY,
1127 false,
1128 parseResult,
1129 ArrayType::STRING);
1130 GetValueIfFindKey<std::vector<std::string>>(jsonObject,
1131 jsonObjectEnd,
1132 APPLICATION_MODULE_SOURCE_DIRS,
1133 applicationInfo.moduleSourceDirs,
1134 JsonType::ARRAY,
1135 false,
1136 parseResult,
1137 ArrayType::STRING);
1138 GetValueIfFindKey<std::vector<ModuleInfo>>(jsonObject,
1139 jsonObjectEnd,
1140 APPLICATION_MODULE_INFOS,
1141 applicationInfo.moduleInfos,
1142 JsonType::ARRAY,
1143 false,
1144 parseResult,
1145 ArrayType::OBJECT);
1146 GetValueIfFindKey<std::map<std::string, std::vector<CustomizeData>>>(jsonObject,
1147 jsonObjectEnd,
1148 APPLICATION_META_DATA_CONFIG_JSON,
1149 applicationInfo.metaData,
1150 JsonType::OBJECT,
1151 false,
1152 parseResult,
1153 ArrayType::NOT_ARRAY);
1154 GetValueIfFindKey<std::map<std::string, std::vector<Metadata>>>(jsonObject,
1155 jsonObjectEnd,
1156 APPLICATION_META_DATA_MODULE_JSON,
1157 applicationInfo.metadata,
1158 JsonType::OBJECT,
1159 false,
1160 parseResult,
1161 ArrayType::NOT_ARRAY);
1162 GetValueIfFindKey<std::string>(jsonObject,
1163 jsonObjectEnd,
1164 APPLICATION_FINGERPRINT,
1165 applicationInfo.fingerprint,
1166 JsonType::STRING,
1167 false,
1168 parseResult,
1169 ArrayType::NOT_ARRAY);
1170 GetValueIfFindKey<std::string>(jsonObject,
1171 jsonObjectEnd,
1172 APPLICATION_ICON,
1173 applicationInfo.icon,
1174 JsonType::STRING,
1175 false,
1176 parseResult,
1177 ArrayType::NOT_ARRAY);
1178 GetValueIfFindKey<int>(jsonObject,
1179 jsonObjectEnd,
1180 APPLICATION_FLAGS,
1181 applicationInfo.flags,
1182 JsonType::NUMBER,
1183 false,
1184 parseResult,
1185 ArrayType::NOT_ARRAY);
1186 GetValueIfFindKey<std::string>(jsonObject,
1187 jsonObjectEnd,
1188 APPLICATION_ENTRY_MODULE_NAME,
1189 applicationInfo.entryModuleName,
1190 JsonType::STRING,
1191 false,
1192 parseResult,
1193 ArrayType::NOT_ARRAY);
1194 GetValueIfFindKey<std::string>(jsonObject,
1195 jsonObjectEnd,
1196 APPLICATION_NATIVE_LIBRARY_PATH,
1197 applicationInfo.nativeLibraryPath,
1198 JsonType::STRING,
1199 false,
1200 parseResult,
1201 ArrayType::NOT_ARRAY);
1202 GetValueIfFindKey<std::string>(jsonObject,
1203 jsonObjectEnd,
1204 APPLICATION_CPU_ABI,
1205 applicationInfo.cpuAbi,
1206 JsonType::STRING,
1207 false,
1208 parseResult,
1209 ArrayType::NOT_ARRAY);
1210 GetValueIfFindKey<std::string>(jsonObject,
1211 jsonObjectEnd,
1212 APPLICATION_ARK_NATIVE_FILE_PATH,
1213 applicationInfo.arkNativeFilePath,
1214 JsonType::STRING,
1215 false,
1216 parseResult,
1217 ArrayType::NOT_ARRAY);
1218 GetValueIfFindKey<std::string>(jsonObject,
1219 jsonObjectEnd,
1220 APPLICATION_ARK_NATIVE_FILE_ABI,
1221 applicationInfo.arkNativeFileAbi,
1222 JsonType::STRING,
1223 false,
1224 parseResult,
1225 ArrayType::NOT_ARRAY);
1226 GetValueIfFindKey<bool>(jsonObject,
1227 jsonObjectEnd,
1228 APPLICATION_IS_COMPRESS_NATIVE_LIBS,
1229 applicationInfo.isCompressNativeLibs,
1230 JsonType::BOOLEAN,
1231 false,
1232 parseResult,
1233 ArrayType::NOT_ARRAY);
1234 GetValueIfFindKey<std::string>(jsonObject,
1235 jsonObjectEnd,
1236 APPLICATION_SIGNATURE_KEY,
1237 applicationInfo.signatureKey,
1238 JsonType::STRING,
1239 false,
1240 parseResult,
1241 ArrayType::NOT_ARRAY);
1242 GetValueIfFindKey<std::vector<std::string>>(jsonObject,
1243 jsonObjectEnd,
1244 APPLICATION_TARGETBUNDLELIST,
1245 applicationInfo.targetBundleList,
1246 JsonType::ARRAY,
1247 false,
1248 parseResult,
1249 ArrayType::STRING);
1250 GetValueIfFindKey<std::string>(jsonObject,
1251 jsonObjectEnd,
1252 APPLICATION_APP_DISTRIBUTION_TYPE,
1253 applicationInfo.appDistributionType,
1254 JsonType::STRING,
1255 false,
1256 parseResult,
1257 ArrayType::NOT_ARRAY);
1258 GetValueIfFindKey<std::string>(jsonObject,
1259 jsonObjectEnd,
1260 APPLICATION_APP_PROVISION_TYPE,
1261 applicationInfo.appProvisionType,
1262 JsonType::STRING,
1263 false,
1264 parseResult,
1265 ArrayType::NOT_ARRAY);
1266 GetValueIfFindKey<Resource>(jsonObject,
1267 jsonObjectEnd,
1268 APPLICATION_ICON_RESOURCE,
1269 applicationInfo.iconResource,
1270 JsonType::OBJECT,
1271 false,
1272 parseResult,
1273 ArrayType::NOT_ARRAY);
1274 GetValueIfFindKey<Resource>(jsonObject,
1275 jsonObjectEnd,
1276 APPLICATION_LABEL_RESOURCE,
1277 applicationInfo.labelResource,
1278 JsonType::OBJECT,
1279 false,
1280 parseResult,
1281 ArrayType::NOT_ARRAY);
1282 GetValueIfFindKey<Resource>(jsonObject,
1283 jsonObjectEnd,
1284 APPLICATION_DESCRIPTION_RESOURCE,
1285 applicationInfo.descriptionResource,
1286 JsonType::OBJECT,
1287 false,
1288 parseResult,
1289 ArrayType::NOT_ARRAY);
1290 GetValueIfFindKey<bool>(jsonObject,
1291 jsonObjectEnd,
1292 APPLICATION_MULTI_PROJECTS,
1293 applicationInfo.multiProjects,
1294 JsonType::BOOLEAN,
1295 false,
1296 parseResult,
1297 ArrayType::NOT_ARRAY);
1298 GetValueIfFindKey<int64_t>(jsonObject,
1299 jsonObjectEnd,
1300 APPLICATION_CROWDTEST_DEADLINE,
1301 applicationInfo.crowdtestDeadline,
1302 JsonType::NUMBER,
1303 false,
1304 parseResult,
1305 ArrayType::NOT_ARRAY);
1306 GetValueIfFindKey<AppQuickFix>(jsonObject,
1307 jsonObjectEnd,
1308 APPLICATION_APP_QUICK_FIX,
1309 applicationInfo.appQuickFix,
1310 JsonType::OBJECT,
1311 false,
1312 parseResult,
1313 ArrayType::NOT_ARRAY);
1314 GetValueIfFindKey<bool>(jsonObject,
1315 jsonObjectEnd,
1316 APPLICATION_NEED_APP_DETAIL,
1317 applicationInfo.needAppDetail,
1318 JsonType::BOOLEAN,
1319 false,
1320 parseResult,
1321 ArrayType::NOT_ARRAY);
1322 GetValueIfFindKey<std::string>(jsonObject,
1323 jsonObjectEnd,
1324 APPLICATION_APP_DETAIL_ABILITY_LIBRARY_PATH,
1325 applicationInfo.appDetailAbilityLibraryPath,
1326 JsonType::STRING,
1327 false,
1328 parseResult,
1329 ArrayType::NOT_ARRAY);
1330 GetValueIfFindKey<std::string>(jsonObject,
1331 jsonObjectEnd,
1332 APPLICATION_APP_TARGET_BUNDLE_NAME,
1333 applicationInfo.targetBundleName,
1334 JsonType::STRING,
1335 false,
1336 parseResult,
1337 ArrayType::NOT_ARRAY);
1338 GetValueIfFindKey<int>(jsonObject,
1339 jsonObjectEnd,
1340 APPLICATION_APP_TARGET_PRIORITY,
1341 applicationInfo.targetPriority,
1342 JsonType::NUMBER,
1343 false,
1344 parseResult,
1345 ArrayType::NOT_ARRAY);
1346 GetValueIfFindKey<int>(jsonObject,
1347 jsonObjectEnd,
1348 APPLICATION_APP_OVERLAY_STATE,
1349 applicationInfo.overlayState,
1350 JsonType::NUMBER,
1351 false,
1352 parseResult,
1353 ArrayType::NOT_ARRAY);
1354 GetValueIfFindKey<bool>(jsonObject,
1355 jsonObjectEnd,
1356 APPLICATION_ASAN_ENABLED,
1357 applicationInfo.asanEnabled,
1358 JsonType::BOOLEAN,
1359 false,
1360 parseResult,
1361 ArrayType::NOT_ARRAY);
1362 GetValueIfFindKey<std::string>(jsonObject,
1363 jsonObjectEnd,
1364 APPLICATION_ASAN_LOG_PATH,
1365 applicationInfo.asanLogPath,
1366 JsonType::STRING,
1367 false,
1368 parseResult,
1369 ArrayType::NOT_ARRAY);
1370 GetValueIfFindKey<BundleType>(jsonObject,
1371 jsonObjectEnd,
1372 APPLICATION_APP_TYPE,
1373 applicationInfo.bundleType,
1374 JsonType::NUMBER,
1375 false,
1376 parseResult,
1377 ArrayType::NOT_ARRAY);
1378 GetValueIfFindKey<std::string>(jsonObject,
1379 jsonObjectEnd,
1380 APPLICATION_COMPILE_SDK_VERSION,
1381 applicationInfo.compileSdkVersion,
1382 JsonType::STRING,
1383 false,
1384 parseResult,
1385 ArrayType::NOT_ARRAY);
1386 GetValueIfFindKey<std::string>(jsonObject,
1387 jsonObjectEnd,
1388 APPLICATION_COMPILE_SDK_TYPE,
1389 applicationInfo.compileSdkType,
1390 JsonType::STRING,
1391 false,
1392 parseResult,
1393 ArrayType::NOT_ARRAY);
1394 GetValueIfFindKey<std::vector<int32_t>>(jsonObject,
1395 jsonObjectEnd,
1396 APPLICATION_RESOURCES_APPLY,
1397 applicationInfo.resourcesApply,
1398 JsonType::ARRAY,
1399 false,
1400 parseResult,
1401 ArrayType::NUMBER);
1402 GetValueIfFindKey<bool>(jsonObject,
1403 jsonObjectEnd,
1404 APPLICATION_GWP_ASAN_ENABLED,
1405 applicationInfo.gwpAsanEnabled,
1406 JsonType::BOOLEAN,
1407 false,
1408 parseResult,
1409 ArrayType::NOT_ARRAY);
1410 GetValueIfFindKey<uint32_t>(jsonObject,
1411 jsonObjectEnd,
1412 APPLICATION_RESERVED_FLAG,
1413 applicationInfo.applicationReservedFlag,
1414 JsonType::NUMBER,
1415 false,
1416 parseResult,
1417 ArrayType::NOT_ARRAY);
1418 if (parseResult != ERR_OK) {
1419 APP_LOGE("from_json error, error code : %{public}d", parseResult);
1420 }
1421 }
1422
ConvertToCompatibleApplicationInfo(CompatibleApplicationInfo & compatibleApplicationInfo) const1423 void ApplicationInfo::ConvertToCompatibleApplicationInfo(CompatibleApplicationInfo& compatibleApplicationInfo) const
1424 {
1425 APP_LOGD("ApplicationInfo::ConvertToCompatibleApplicationInfo called");
1426 compatibleApplicationInfo.name = name;
1427 compatibleApplicationInfo.icon = icon;
1428 compatibleApplicationInfo.label = label;
1429 compatibleApplicationInfo.description = description;
1430 compatibleApplicationInfo.cpuAbi = cpuAbi;
1431 compatibleApplicationInfo.process = process;
1432 compatibleApplicationInfo.systemApp = isSystemApp;
1433 compatibleApplicationInfo.isCompressNativeLibs = isCompressNativeLibs;
1434 compatibleApplicationInfo.iconId = iconId;
1435 compatibleApplicationInfo.labelId = labelId;
1436 compatibleApplicationInfo.descriptionId = descriptionId;
1437 compatibleApplicationInfo.permissions = permissions;
1438 compatibleApplicationInfo.moduleInfos = moduleInfos;
1439 compatibleApplicationInfo.supportedModes = supportedModes;
1440 compatibleApplicationInfo.enabled = enabled;
1441 compatibleApplicationInfo.debug = debug;
1442 }
1443 } // namespace AppExecFwk
1444 } // namespace OHOS
1445