• 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
24  * based on the application's user ID (UID).
25  *
26  * @since 1.0
27  * @version 1.0
28  */
29 
30 /**
31  * @file element_name.h
32  *
33  * @brief Declares the structure that defines the required information for querying {@link AbilityInfo}, including
34  *        the device ID, bundle name, and class name, and functions for setting such information.
35  *
36  * You can use functions provided in this file to specify the information for querying {@link AbilityInfo}.
37  *
38  * @since 1.0
39  * @version 1.0
40  */
41 
42 #ifndef OHOS_ELEMENT_NAME_H
43 #define OHOS_ELEMENT_NAME_H
44 
45 #ifdef OHOS_APPEXECFWK_BMS_BUNDLEMANAGER
46 #include <serializer.h>
47 #endif
48 #include <stdbool.h>
49 
50 /**
51  * @brief Defines the ability information.
52  */
53 typedef struct {
54     /**
55      * Pointer to the ID of the device running the application
56      */
57     char *deviceId;
58 
59     /**
60      * Pointer to the bundle name of the application
61      */
62     char *bundleName;
63 
64     /**
65      * Pointer to the class name of the ability
66      */
67     char *abilityName;
68 } ElementName;
69 
70 #ifdef __cplusplus
71 #if __cplusplus
72 extern "C" {
73 #endif
74 #endif // __cplusplus
75 /**
76  * @brief Clears the internal data of a specified <b>ElementName</b>.
77  *
78  * After {@link AbilityInfo} is queried, clear the internal data of an <b>ElementName</b> if it is no longer required.
79  * @param element Indicates the pointer to the <b>ElementName</b> to clear.
80  */
81 void ClearElement(ElementName *element);
82 
83 /**
84  * @brief Sets the device ID used to query {@link AbilityInfo}.
85  *
86  * @param element Indicates the pointer to the <b>ElementName</b> to set.
87  * @param deviceId Indicates the pointer to the device ID to set.
88  *
89  * @return Returns <b>true</b> if the setting is successful; returns <b>false</b> otherwise.
90  */
91 bool SetElementDeviceID(ElementName *element, const char *deviceId);
92 
93 /**
94  * @brief Sets the bundle name used to query {@link AbilityInfo}.
95  *
96  * @param element Indicates the pointer to the <b>ElementName</b> to set.
97  * @param bundleName Indicates the pointer to the bundle name to set.
98  *
99  * @return Returns <b>true</b> if the setting is successful; returns <b>false</b> otherwise.
100  */
101 bool SetElementBundleName(ElementName *element, const char *bundleName);
102 
103 /**
104  * @brief Sets the class name of the ability used to query {@link AbilityInfo}.
105  *
106  * @param element Indicates the pointer to the <b>ElementName</b> to set.
107  * @param abilityName Indicates the pointer to the class name to set.
108  *
109  * @return Returns <b>true</b> if the setting is successful; returns <b>false</b> otherwise.
110  */
111 bool SetElementAbilityName(ElementName *element, const char *abilityName);
112 
113 #ifdef OHOS_APPEXECFWK_BMS_BUNDLEMANAGER
114 bool SerializeElement(IpcIo *io, const ElementName *element);
115 bool DeserializeElement(ElementName *element, IpcIo *io);
116 #endif
117 #ifdef __cplusplus
118 #if __cplusplus
119 }
120 #endif
121 #endif // __cplusplus
122 
123 #endif // OHOS_ELEMENT_NAME_H
124 /** @} */
125