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