Add new functions to handling running components
[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()
40  * @see aul_comp_info_usr_foreach()
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  * @remarks You MUST release @a handle using aul_comp_info_destroy().
48  *
49  * @param[in]   comp_id         The component ID
50  * @param[out]  handle          The component information handle
51  * @return      @c 0 on success,
52  *              otherwise a negative error value
53  *
54  * @remarks This function is only for App Framework internally.
55  */
56 int aul_comp_info_create(const char *comp_id, aul_comp_info_h *handle);
57
58 /**
59  * @brief Creates the component information handle.
60  * @since_tizen 5.5
61  * @remarks You MUST release @a handle using aul_comp_info_destroy().
62  *
63  * @param[in]   comp_id         The component ID
64  * @param[in]   uid             The user ID
65  * @param[out]  handle          The component information handle
66  * @return      @c 0 on success,
67  *              otherwise a negative error value
68  *
69  * @remarks This function is only for App Framework internally.
70  */
71 int aul_comp_info_create_usr(const char *comp_id, uid_t uid,
72                 aul_comp_info_h *handle);
73
74 /**
75  * @brief Destroys the component information handle.
76  * @since_tizen 5.5
77  *
78  * @param[in]   handle          The component information handle
79  * @return      @c 0 on success,
80  *              otherwise a negative error value
81  *
82  * @remarks This function is only for App Framework internally.
83  */
84 int aul_comp_info_destroy(aul_comp_info_h handle);
85
86 /**
87  * @brief Clones the component information handle.
88  * @since_tizen 5.5
89  * @remarks You MUST release @a clone using aul_comp_info_destroy().
90  *
91  * @param[in]   handle          The component information handle
92  * @param[out]  clone           A newly created component information handle, if successfully cloned
93  * @return      @c 0 on success,
94  *              otherwise a negative error value
95  *
96  * @remarks This function is only for App Framework internally.
97  */
98 int aul_comp_info_clone(aul_comp_info_h handle, aul_comp_info_h *clone);
99
100 /**
101  * @brief Gets the application ID of the component.
102  * @since_tizen 5.5
103  * @remarks You MUST NOT release @a app_id using free().
104  *
105  * @param[in]   handle          The component information handle
106  * @param[out]  app_id          The application ID of the component
107  * @return      @c 0 on success,
108  *              otherwise a negative error value
109  *
110  * @remarks This function is only for App Framework internally.
111  */
112 int aul_comp_info_get_app_id(aul_comp_info_h handle, const char **app_id);
113
114 /**
115  * @brief Gets the ID of the component.
116  * @since_tizen 5.5
117  * @remarks You MUST NOT release @a comp_id using free().
118  *
119  * @param[in]   handle          The component information handle
120  * @param[out]  comp_id         The ID of the component
121  * @return      @c 0 on success,
122  *              otherwise a negative error value
123  *
124  * @remarks This function is only for App Framework internally.
125  */
126 int aul_comp_info_get_comp_id(aul_comp_info_h handle, const char **comp_id);
127
128 /**
129  * @brief Gets the type of the component.
130  * @since_tizen 5.5
131  * @remarks You MUST NOT release @a type using free().
132  *
133  * @param[in]   handle          The component information handle
134  * @param[out]  type            The type of the component
135  * @return      @c 0 on success,
136  *              otherwise a negative error value
137  *
138  * @remarks This function is only for App Framework internally.
139  */
140 int aul_comp_info_get_type(aul_comp_info_h handle, const char **type);
141
142 /**
143  * @brief Gets the launch mode of the component.
144  * @since_tizen 5.5
145  * @remarks You MUST NOT release @a launch_mode using free().
146  *
147  * @param[in]   handle          The component information handle
148  * @param[out]  launch_mode     The launch mode of the component
149  * @return      @c 0 on success,
150  *              otherwise a negative error value
151  *
152  * @remarks This function is only for App Framework internally.
153  */
154 int aul_comp_info_get_launch_mode(aul_comp_info_h handle,
155                 const char **launch_mode);
156
157 /**
158  * @brief Checks whether the component is the main component or not.
159  * @since_tizen 5.5
160  *
161  * @param[in]   handle          The component information handle
162  * @param[out]  main_comp       @c true if the component is the main component, \n
163  *                              otherwise @c false
164  * @return      @c 0 on success,
165  *              otherwise a negative error value
166  *
167  * @remarks This function is only for App Framework internally.
168  */
169 int aul_comp_info_is_main_comp(aul_comp_info_h handle, bool *main_comp);
170
171 /**
172  * @brief Checks whether the icon of the component should be displayed or not.
173  * @since_tizen 5.5
174  *
175  * @param[in]   handle          The component information handle
176  * @param[out]  icon_display    @c true if the icon should be displayed, \n
177  *                              otherwise @c false
178  * @return      @c 0 on success,
179  *              otherwise a negative error value
180  *
181  * @remarks This function is only for App Framework internally.
182  */
183 int aul_comp_info_is_icon_display(aul_comp_info_h handle, bool *icon_display);
184
185 /**
186  * @brief Checks whether the component should be managed by task-manager or not.
187  * @since_tizen 5.5
188  *
189  * @param[in]   handle          The component information handle
190  * @param[out]  taskmanage      @c true if the component should be managed by task-manager, \n
191  *                              otherwise @c false
192  * @return      @c 0 on success,
193  *              otherwise a negative error value
194  *
195  * @remarks This function is only for App Framework internally.
196  */
197 int aul_comp_info_is_taskmanage(aul_comp_info_h handle, bool *taskmanage);
198
199 /**
200  * @brief Gets the icon path of the component.
201  * @since_tizen 5.5
202  * @remarks You MUST NOT release @a icon using free().
203  *
204  * @param[in]   handle          The component information handle
205  * @param[out]  icon            The icon path of the component
206  * @return      @c 0 on success,
207  *              otherwise a negative error value
208  *
209  * @remarks This function is only for App Framework internally.
210  */
211 int aul_comp_info_get_icon(aul_comp_info_h handle, const char **icon);
212
213 /**
214  * @brief Gets the label of the component.
215  * @since_tizen 5.5
216  * @remarks You MUST NOT release @a label using free().
217  *
218  * @param[in]   handle          The component information handle
219  * @param[out]  label           The label of the component
220  * @return      @c 0 on success,
221  *              otherwise a negative error value
222  *
223  * @remarks This function is only for App Framework internally.
224  */
225 int aul_comp_info_get_label(aul_comp_info_h handle, const char **label);
226
227 /**
228  * @brief Gets the localed label of the component.
229  * @since_tizen 5.5
230  * @remarks You MUST release @a label using free().
231  *
232  * @param[in]   comp_id         The component ID
233  * @param[in]   locale          The locale information
234  * @param[out]  label           The localed label of the component
235  * @return      @c 0 on success,
236  *              otherwise a negative error value
237  *
238  * @remarks This function is only for App Framework internally.
239  */
240 int aul_comp_info_get_localed_label(const char *comp_id, const char *locale,
241                 char **label);
242
243 /**
244  * @brief Gets the localed label of the component.
245  * @since_tizen 5.5
246  * @remarks You MUST release @a label using free().
247  *
248  * @param[in]   comp_id         The component ID
249  * @param[in]   locale          The locale information
250  * @param[in]   uid             The user ID
251  * @param[out]  label           The localed label of the component
252  * @return      @c 0 on success,
253  *              otherwise a negative error value
254  *
255  * @remarks This function is only for App Framework internally.
256  */
257 int aul_comp_info_get_usr_localed_label(const char *comp_id, const char *locale,
258                 uid_t uid, char **label);
259
260 /**
261  * @brief Retrieves all installed components information of the specified application.
262  * @since_tizen 5.5
263  *
264  * @param[in]   app_id          The application ID
265  * @param[in]   callback        The callback function to invoke
266  * @param[in]   user_data       The user data to be passed to the callback function
267  * @return      @c 0 on success,
268  *              otherwise a negative error value
269  * @see aul_comp_info_cb()
270  *
271  * @remarks This function is only for App Framework internally.
272  */
273 int aul_comp_info_foreach(const char *app_id, aul_comp_info_cb callback,
274                 void *user_data);
275
276 /**
277  * @brief Retrieves all installed components information of the specified application.
278  * @since_tizen 5.5
279  *
280  * @param[in]   app_id          The application ID
281  * @param[in]   uid             The user ID
282  * @param[in]   callback        The callback function to invoke
283  * @param[in]   user_data       The user data to be passed to the callback function
284  * @return      @c 0 on success,
285  *              otherwise a negative error value
286  * @see aul_comp_info_cb()
287  *
288  * @remarks This function is only for App Framework internally.
289  */
290 int aul_comp_info_foreach_usr(const char *app_id, uid_t uid,
291                 aul_comp_info_cb callback, void *user_data);
292
293 #ifdef __cplusplus
294 }
295 #endif