Move function definition to aul header
[platform/core/appfw/aul-1.git] / include / aul_comp_info.h
1 /*
2  * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #pragma once
18
19 #include <unistd.h>
20
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24
25 /**
26  * @brief The component information handle.
27  * @since_tizen 5.5
28  */
29 typedef void *aul_comp_info_h;
30
31 /**
32  * @brief Called to get the component information once for each installed component.
33  * @since_tizen 5.5
34  *
35  * @param[in]   handle          The component information handle
36  * @param[in]   user_data       The user data passed from the foreach function
37  * @return      @c true to continue with the next iteration of the loop, \n
38  *              otherwise @ false to break out of the loop
39  * @see aul_comp_info_foreach_comp_info()
40  * @see aul_comp_info_usr_foreach_comp_info()
41  */
42 typedef bool (*aul_comp_info_cb)(aul_comp_info_h handle, void *user_data);
43
44 /**
45  * @brief Creates the component information handle.
46  * @since_tizen 5.5
47  * @privlevel public
48  * @privilege %http://tizen.org/privilege/packagemanager.info
49  * @remarks You MUST release @a handle using aul_comp_info_destroy().
50  *
51  * @param[in]   comp_id         The component ID
52  * @param[out]  handle          The component information handle
53  * @return      @c 0 on success,
54  *              otherwise a negative error value
55  *
56  * @remarks This function is only for App Framework internally.
57  */
58 int aul_comp_info_create(const char *comp_id, aul_comp_info_h *handle);
59
60 /**
61  * @brief Creates the component information handle.
62  * @since_tizen 5.5
63  * @privlevel public
64  * @privilege %http://tizen.org/privilege/packagemanager.info
65  * @remarks You MUST release @a handle using aul_comp_info_destroy().
66  *
67  * @param[in]   comp_id         The component ID
68  * @param[in]   uid             The user ID
69  * @param[out]  handle          The component information handle
70  * @return      @c 0 on success,
71  *              otherwise a negative error value
72  *
73  * @remarks This function is only for App Framework internally.
74  */
75 int aul_comp_info_usr_create(const char *comp_id, uid_t uid,
76                 aul_comp_info_h *handle);
77
78 /**
79  * @brief Destroys the component information handle.
80  * @since_tizen 5.5
81  *
82  * @param[in]   handle          The component information handle
83  * @return      @c 0 on success,
84  *              otherwise a negative error value
85  *
86  * @remarks This function is only for App Framework internally.
87  */
88 int aul_comp_info_destroy(aul_comp_info_h handle);
89
90 /**
91  * @brief Clones the component information handle.
92  * @since_tizen 5.5
93  * @remarks You MUST release @a clone using aul_comp_info_destroy().
94  *
95  * @param[in]   handle          The component information handle
96  * @param[out]  clone           A newly created component information handle, if successfully cloned
97  * @return      @c 0 on success,
98  *              otherwise a negative error value
99  *
100  * @remarks This function is only for App Framework internally.
101  */
102 int aul_comp_info_clone(aul_comp_info_h handle, aul_comp_info_h *clone);
103
104 /**
105  * @brief Gets the application ID of the component.
106  * @since_tizen 5.5
107  * @remarks You MUST NOT release @a app_id using free().
108  *
109  * @param[in]   handle          The component information handle
110  * @param[out]  app_id          The application ID of the component
111  * @return      @c 0 on success,
112  *              otherwise a negative error value
113  *
114  * @remarks This function is only for App Framework internally.
115  */
116 int aul_comp_info_get_app_id(aul_comp_info_h handle, const char **app_id);
117
118 /**
119  * @brief Gets the ID of the component.
120  * @since_tizen 5.5
121  * @remarks You MUST NOT release @a comp_id using free().
122  *
123  * @param[in]   handle          The component information handle
124  * @param[out]  comp_id         The ID of the component
125  * @return      @c 0 on success,
126  *              otherwise a negative error value
127  *
128  * @remarks This function is only for App Framework internally.
129  */
130 int aul_comp_info_get_comp_id(aul_comp_info_h handle, const char **comp_id);
131
132 /**
133  * @brief Gets the type of the component.
134  * @since_tizen 5.5
135  * @remarks You MUST NOT release @a type using free().
136  *
137  * @param[in]   handle          The component information handle
138  * @param[out]  type            The type of the component
139  * @return      @c 0 on success,
140  *              otherwise a negative error value
141  *
142  * @remarks This function is only for App Framework internally.
143  */
144 int aul_comp_info_get_type(aul_comp_info_h handle, const char **type);
145
146 /**
147  * @brief Gets the launch mode of the component.
148  * @since_tizen 5.5
149  * @remarks You MUST NOT release @a launch_mode using free().
150  *
151  * @param[in]   handle          The component information handle
152  * @param[out]  launch_mode     The launch mode of the component
153  * @return      @c 0 on success,
154  *              otherwise a negative error value
155  *
156  * @remarks This function is only for App Framework internally.
157  */
158 int aul_comp_info_get_launch_mode(aul_comp_info_h handle,
159                 const char **launch_mode);
160
161 /**
162  * @brief Checks whether the component is the main component or not.
163  * @since_tizen 5.5
164  *
165  * @param[in]   handle          The component information handle
166  * @param[out]  main_comp       @c true if the component is the main component, \n
167  *                              otherwise @c false
168  * @return      @c 0 on success,
169  *              otherwise a negative error value
170  *
171  * @remarks This function is only for App Framework internally.
172  */
173 int aul_comp_info_is_main_comp(aul_comp_info_h handle, bool *main_comp);
174
175 /**
176  * @brief Checks whether the icon of the component should be displayed or not.
177  * @since_tizen 5.5
178  *
179  * @param[in]   handle          The component information handle
180  * @param[out]  icon_display    @c true if the icon should be displayed, \n
181  *                              otherwise @c false
182  * @return      @c 0 on success,
183  *              otherwise a negative error value
184  *
185  * @remarks This function is only for App Framework internally.
186  */
187 int aul_comp_info_is_icon_display(aul_comp_info_h handle, bool *icon_display);
188
189 /**
190  * @brief Checks whether the component should be managed by task-manager or not.
191  * @since_tizen 5.5
192  *
193  * @param[in]   handle          The component information handle
194  * @param[out]  taskmanage      @c true if the component should be managed by task-manager, \n
195  *                              otherwise @c false
196  * @return      @c 0 on success,
197  *              otherwise a negative error value
198  *
199  * @remarks This function is only for App Framework internally.
200  */
201 int aul_comp_info_is_taskmanage(aul_comp_info_h handle, bool *taskmanage);
202
203 /**
204  * @brief Gets the icon path of the component.
205  * @since_tizen 5.5
206  * @remarks You MUST NOT release @a icon using free().
207  *
208  * @param[in]   handle          The component information handle
209  * @param[out]  icon            The icon path of the component
210  * @return      @c 0 on success,
211  *              otherwise a negative error value
212  *
213  * @remarks This function is only for App Framework internally.
214  */
215 int aul_comp_info_get_icon(aul_comp_info_h handle, const char **icon);
216
217 /**
218  * @brief Gets the label of the component.
219  * @since_tizen 5.5
220  * @remarks You MUST NOT release @a label using free().
221  *
222  * @param[in]   handle          The component information handle
223  * @param[out]  label           The label of the component
224  * @return      @c 0 on success,
225  *              otherwise a negative error value
226  *
227  * @remarks This function is only for App Framework internally.
228  */
229 int aul_comp_info_get_label(aul_comp_info_h handle, const char **label);
230
231 /**
232  * @brief Gets the localed label of the component.
233  * @since_tizen 5.5
234  * @remarks You MUST release @a label using free().
235  *
236  * @param[in]   comp_id         The component ID
237  * @param[in]   locale          The locale information
238  * @param[out]  label           The localed label of the component
239  * @return      @c 0 on success,
240  *              otherwise a negative error value
241  *
242  * @remarks This function is only for App Framework internally.
243  */
244 int aul_comp_info_get_localed_label(aul_comp_info_h handle, const char *locale,
245                 const char **label);
246
247 /**
248  * @brief Retrieves all installed components information of the specified application.
249  * @since_tizen 5.5
250  * @privlevel public
251  * @privilege %http://tizen.org/privilege/packagemanager.info
252  *
253  * @param[in]   app_id          The application ID
254  * @param[in]   callback        The callback function to invoke
255  * @param[in]   user_data       The user data to be passed to the callback function
256  * @return      @c 0 on success,
257  *              otherwise a negative error value
258  * @see aul_comp_info_cb()
259  *
260  * @remarks This function is only for App Framework internally.
261  */
262 int aul_comp_info_foreach_comp_info_from_app(const char *app_id,
263                 aul_comp_info_cb callback, void *user_data);
264
265 /**
266  * @brief Retrieves all installed components information of the specified application.
267  * @since_tizen 5.5
268  * @privlevel public
269  * @privilege %http://tizen.org/privilege/packagemanager.info
270  *
271  * @param[in]   app_id          The application ID
272  * @param[in]   uid             The user ID
273  * @param[in]   callback        The callback function to invoke
274  * @param[in]   user_data       The user data to be passed to the callback function
275  * @return      @c 0 on success,
276  *              otherwise a negative error value
277  * @see aul_comp_info_cb()
278  *
279  * @remarks This function is only for App Framework internally.
280  */
281 int aul_comp_info_usr_foreach_comp_info_from_app(const char *app_id, uid_t uid,
282                 aul_comp_info_cb callback, void *user_data);
283
284 /**
285  * @brief Retrieves all installed components information.
286  * @since_tizen 5.5
287  * @privlevel public
288  * @privilege %http://tizen.org/privilege/packagemanager.info
289  *
290  * @param[in]   callback        The callback function to invoke
291  * @param[in]   user_data       The user data to be passed to the callback function
292  * @return      @c 0 on success,
293  *              otherwise a negative error value
294  * @see aul_comp_info_cb()
295  *
296  * @remarks This function is only for App Framework internally.
297  */
298 int aul_comp_info_foreach_comp_info(aul_comp_info_cb callback, void *user_data);
299
300 /**
301  * @brief Retrieves all installed components information.
302  * @since_tizen 5.5
303  * @privlevel public
304  * @privilege %http://tizen.org/privilege/packagemanager.info
305  *
306  * @param[in]   uid             The user ID
307  * @param[in]   callback        The callback function to invoke
308  * @param[in]   user_data       The user data to be passed to the callback function
309  * @return      @c 0 on success,
310  *              otherwise a negative error value
311  * @see aul_comp_info_cb()
312  *
313  * @remarks This function is only for App Framework internally.
314  */
315 int aul_comp_info_usr_foreach_comp_info(uid_t uid, aul_comp_info_cb callback,
316                 void *user_data);
317
318 #ifdef __cplusplus
319 }
320 #endif