1 /*
2  * Copyright (c) 2020 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 /**
17  * @addtogroup BundleManager
18  * @{
19  *
20  * @brief Provides structures and functions for managing application bundles and obtaining application information.
21  *
22  * You can use functions provided by this module to install, update, or uninstall an application, obtain
23  * {@link AbilityInfo} and {@link BundleInfo} about an application, and obtain the bundle name of an application based
24  * on the application's user ID (UID).
25  *
26  * @since 1.0
27  * @version 1.0
28  */
29 
30 /**
31  * @file module_info.h
32  *
33  * @brief Declares structures and functions for managing HAP package information.
34  *
35  * The HAP package is used to deploy {@link Ability} instances. It is a module package consisting of the code,
36  * resources, third-party libraries, and an application configuration file. You can use the function provided in this
37  * file to clear HAP information.
38  *
39  * @since 1.0
40  * @version 1.0
41  */
42 #ifndef OHOS_BUNDLE_MODULE_INFO_H
43 #define OHOS_BUNDLE_MODULE_INFO_H
44 
45 #include <stdbool.h>
46 #include "stdint.h"
47 
48 #ifdef OHOS_APPEXECFWK_BMS_BUNDLEMANAGER
49 #define DEVICE_TYPE_SIZE 16
50 #endif
51 #define METADATA_SIZE 16
52 
53 /**
54  * @brief Defines the metadata information in a {@link ModuleInfo} object.
55  */
56 typedef struct {
57     /** Pointer to the metadata name */
58     char *name;
59 
60     /** Pointer to the metadata value */
61     char *value;
62 
63     /** Extra data. You can customize this field as required. */
64     char *extra;
65 } MetaData;
66 
67 /**
68  * @brief Defines the HAP information.
69  */
70 typedef struct {
71     /** Pointer to the HAP package name */
72     char *moduleName;
73 #ifdef OHOS_APPEXECFWK_BMS_BUNDLEMANAGER
74 
75     /** Pointer to the description of the HAP package */
76     char *description;
77 
78     /** Pointer to the class name of the HAP package */
79     char *name;
80 
81     /** Type of the HAP package, either <b>Entry.hap</b> or <b>Feature.hap</b> */
82     char *moduleType;
83 
84     /** Whether the HAP package is installed while the user is installing the application */
85     bool isDeliveryInstall;
86 
87     /**
88      * Pointer to the types of devices that can run the application. The maximum size of the device type array is
89      * {@link DEVICE_TYPE_SIZE}.
90      */
91     char *deviceType[DEVICE_TYPE_SIZE];
92 #endif
93 
94     /** Pointer to the metadata array whose maximum size is {@link METADATA_SIZE} */
95     MetaData *metaData[METADATA_SIZE];
96 } ModuleInfo;
97 
98 #ifdef __cplusplus
99 #if __cplusplus
100 extern "C" {
101 #endif
102 #endif // __cplusplus
103 /**
104  * @brief Clears a {@link ModuleInfo} object.
105  *
106  * This function clears and releases the memory occupied by the fields of the pointer type included in the specified
107  * {@link ModuleInfo} object.
108  * @param moduleInfo Indicates the pointer to the {@link ModuleInfo} object to clear.
109  *
110  * @since 1.0
111  * @version 1.0
112  */
113 void ClearModuleInfo(ModuleInfo *moduleInfo);
114 #ifdef __cplusplus
115 #if __cplusplus
116 }
117 #endif
118 #endif // __cplusplus
119 
120 #endif // OHOS_BUNDLE_MODULE_INFO_H
121 /** @} */