• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 ability_info.h
32  *
33  * @brief Declares structures and functions for managing ability information.
34  *
35  * You can use the function provided in this file to clear ability information.
36  *
37  * @since 1.0
38  * @version 1.0
39  */
40 
41 #ifndef OHOS_ABILITY_INFO_H
42 #define OHOS_ABILITY_INFO_H
43 
44 #include <stdbool.h>
45 #include "stdint.h"
46 
47 #ifdef OHOS_APPEXECFWK_BMS_BUNDLEMANAGER
48 /**
49  * @brief Defines the maximun length of the system capabiliy name.
50  */
51 #define MAX_SYSCAP_NAME_LEN 64
52 
53 /**
54  * @brief Defines the maximun num of system capabilities.
55  */
56 #define MAX_SYSCAP_NUM 512
57 
58 /**
59 * @brief Enumerates types of templates used by an ability.
60 */
61 typedef enum {
62     /** Unknown */
63     UNKNOWN = 0,
64 
65     /** Page */
66     PAGE,
67 
68     /** Service */
69     SERVICE
70 } AbilityType;
71 
72 /**
73  * @brief Enumerates startup modes of an ability.
74  */
75 typedef enum {
76     /** Singleton mode, allowing only one instance */
77     SINGLETON = 0,
78 
79     /** Standard mode, allowing multiple instances */
80     STANDARD
81 } LaunchMode;
82 
83 /**
84 * @brief Defines the system capability name.
85 */
86 typedef struct {
87     char name[MAX_SYSCAP_NAME_LEN];
88 } SystemCapName;
89 
90 /**
91 * @brief Defines the system capability information.
92 */
93 typedef struct {
94     int32_t systemCapNum;
95     SystemCapName *systemCapName;
96 } SystemCapability;
97 
98 #endif
99 
100 /**
101  * @brief Defines the ability information.
102  */
103 typedef struct {
104 #ifdef OHOS_APPEXECFWK_BMS_BUNDLEMANAGER
105     /** Whether the ability is visible */
106     bool isVisible;
107 
108     /** Template used by the ability */
109     AbilityType abilityType;
110 
111     /** Startup mode of the ability */
112     LaunchMode launchMode;
113 
114     /**
115      * Pointer to the name of the HAP package to which the ability belongs. The HAP information is encapsulated in a
116      * {@link ModuleInfo} object.
117      */
118     char *moduleName;
119 
120     /** Pointer to the class name of the ability */
121     char *name;
122 
123     /** Pointer to the description of the ability */
124     char *description;
125 
126     /** Pointer to the icon path of the ability */
127     char *iconPath;
128 
129     /** Pointer to the device ID */
130     char *deviceId;
131 
132     /** Pointer to the ability name visible to users */
133     char *label;
134 
135     /** Pointer to the deviceCapability */
136     SystemCapability deviceCap;
137 #else
138     /** Pointer to the source code path. This field is available only to basic watches. */
139     char *srcPath;
140 #endif
141     /** Pointer to the application bundle name */
142     char *bundleName;
143 } AbilityInfo;
144 
145 #ifdef __cplusplus
146 #if __cplusplus
147 extern "C" {
148 #endif
149 #endif // __cplusplus
150 /**
151  * @brief Clears an {@link AbilityInfo} object.
152  *
153  * This function clears and releases the memory occupied by the fields of the pointer type included in the specified
154  * {@link AbilityInfo} object.
155  * @param abilityInfo Indicates the pointer to the {@link AbilityInfo} object to clear.
156  *
157  * @since 1.0
158  * @version 1.0
159  */
160 void ClearAbilityInfo(AbilityInfo *abilityInfo);
161 #ifdef __cplusplus
162 #if __cplusplus
163 }
164 #endif
165 #endif // __cplusplus
166 
167 #endif  // OHOS_ABILITY_INFO_H
168 /** @} */