Fix prefix of defined variable name
[platform/core/api/package-manager.git] / include / package_manager.h
1 /*
2  * Copyright (c) 2011 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 #ifndef __TIZEN_APPFW_PACKAGE_MANAGER_H
18 #define __TIZEN_APPFW_PACKAGE_MANAGER_H
19
20 #include <sys/types.h>
21
22 #include <tizen.h>
23
24 #include <package_info.h>
25
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29
30 /**
31  * @file package_manager.h
32  */
33
34 /**
35  * @addtogroup CAPI_PACKAGE_MANAGER_MODULE
36  * @{
37  */
38
39 /**
40  * @brief Definition for value to be used when filtering based on install location: Boolean property for filtering whether the package is removable or not based on package info.
41  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
42  */
43 #define PACKAGE_MANAGER_PKGINFO_PROP_REMOVABLE       "PMINFO_PKGINFO_PROP_PACKAGE_REMOVABLE"
44
45
46 /**
47  * @brief Definition for value to be used when filtering based on install location: Boolean property for filtering whether the package is readonly or not based on package info.
48  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
49  */
50 #define PACKAGE_MANAGER_PKGINFO_PROP_READONLY        "PMINFO_PKGINFO_PROP_PACKAGE_READONLY"
51
52
53 /**
54  * @brief Definition for value to be used when filtering based on install location: Boolean property for filtering whether the package supports disable or not based on package info.
55  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
56  */
57 #define PACKAGE_MANAGER_PKGINFO_PROP_SUPPORT_DISABLE     "PMINFO_PKGINFO_PROP_PACKAGE_SUPPORT_DISABLE"
58
59
60 /**
61  * @brief Definition for value to be used when filtering based on install location: Boolean property for filtering whether the package is disabled based on package info.
62  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
63  */
64 #define PACKAGE_MANAGER_PKGINFO_PROP_DISABLE             "PMINFO_PKGINFO_PROP_PACKAGE_DISABLE"
65
66
67 /**
68  * @brief Definition for value to be used when filtering based on install location: Boolean property for filtering whether the package is preload or not based on package info.
69  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
70  */
71 #define PACKAGE_MANAGER_PKGINFO_PROP_PRELOAD            "PMINFO_PKGINFO_PROP_PACKAGE_PRELOAD"
72
73
74 /**
75  * @brief Definition for value to be used when filtering based on resource type: String property for filtering packages with specific resource types.
76  * @since_tizen 6.5
77  */
78 #define PACKAGE_MANAGER_PKGINFO_PROP_RES_TYPE           "PMINFO_PKGINFO_PROP_PACKAGE_RES_TYPE"
79
80
81 /**
82  * @brief Enumeration for error code.
83  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
84  */
85 typedef enum {
86         PACKAGE_MANAGER_ERROR_NONE = TIZEN_ERROR_NONE,                                /**< Successful */
87         PACKAGE_MANAGER_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER,      /**< Invalid parameter */
88         PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY,              /**< Out of memory */
89         PACKAGE_MANAGER_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR,                        /**< Internal I/O error */
90         PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE = TIZEN_ERROR_PACKAGE_MANAGER | 0x71,   /**< No such package */
91         PACKAGE_MANAGER_ERROR_SYSTEM_ERROR = TIZEN_ERROR_PACKAGE_MANAGER | 0x72,      /**< Severe system error */
92         PACKAGE_MANAGER_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED       /**< Permission denied */
93 } package_manager_error_e;
94
95
96 /**
97  * @brief Enumeration for event type.
98  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
99  */
100 typedef enum {
101         PACKAGE_MANAGER_EVENT_TYPE_INSTALL = 0,    /**< Install event type */
102         PACKAGE_MANAGER_EVENT_TYPE_UNINSTALL,      /**< Uninstall event type */
103         PACKAGE_MANAGER_EVENT_TYPE_UPDATE,         /**< Update event type */
104         PACKAGE_MANAGER_EVENT_TYPE_MOVE,           /**< Move event type (Since 3.0) */
105         PACKAGE_MANAGER_EVENT_TYPE_CLEAR,          /**< Clear event type (Since 3.0) */
106         PACKAGE_MANAGER_EVENT_TYPE_RES_COPY,       /**< Resource copy event type (Since 6.5) */
107         PACKAGE_MANAGER_EVENT_TYPE_RES_CREATE_DIR, /**< Create directory for resource event type (Since 6.5) */
108         PACKAGE_MANAGER_EVENT_TYPE_RES_REMOVE,     /**< Remove resource event type (Since 6.5) */
109         PACKAGE_MANAGER_EVENT_TYPE_RES_UNINSTALL,     /**< Uninstall resource event type (Since 6.5) */
110 } package_manager_event_type_e;
111
112
113 /**
114  * @brief Enumeration for event state.
115  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
116  */
117 typedef enum {
118         PACKAGE_MANAGER_EVENT_STATE_STARTED = 0,   /**< Started event state */
119         PACKAGE_MANAGER_EVENT_STATE_PROCESSING,    /**< Processing event state */
120         PACKAGE_MANAGER_EVENT_STATE_COMPLETED,     /**< Completed event state */
121         PACKAGE_MANAGER_EVENT_STATE_FAILED,        /**< Failed event state */
122 } package_manager_event_state_e;
123
124
125 /**
126  * @brief Enumeration for move type.
127  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
128  */
129 typedef enum {
130         PACKAGE_MANAGER_REQUEST_MOVE_TO_INTERNAL = 0,    /**< Internal type */
131         PACKAGE_MANAGER_REQUEST_MOVE_TO_EXTERNAL,        /**< External type */
132         PACKAGE_MANAGER_REQUEST_MOVE_TO_EXTENDED,        /**< Extended type (Since 5.0) */
133 } package_manager_move_type_e;
134
135
136 /**
137  * @brief Enumeration for certification compare type.
138  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
139  */
140 typedef enum {
141         PACKAGE_MANAGER_COMPARE_MATCH = 0,      /**< Matching certification */
142         PACKAGE_MANAGER_COMPARE_MISMATCH,       /**< Mismatching certification */
143         PACKAGE_MANAGER_COMPARE_LHS_NO_CERT,    /**< First package has no certification */
144         PACKAGE_MANAGER_COMPARE_RHS_NO_CERT,    /**< Second package has no certification */
145         PACKAGE_MANAGER_COMPARE_BOTH_NO_CERT,   /**< Both have no certification */
146 } package_manager_compare_result_type_e;
147
148
149 /**
150  * @brief Enumeration for permission type.
151  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
152  */
153 typedef enum {
154         PACKAGE_MANAGER_PERMISSION_NORMAL = 0,    /**< Normal permission */
155         PACKAGE_MANAGER_PERMISSION_SIGNATURE,     /**< Signature permission */
156         PACKAGE_MANAGER_PERMISSION_PRIVILEGE,     /**< Privilege permission */
157 } package_manager_permission_type_e;
158
159
160 /**
161  * @brief Enumeration for status type.
162  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
163  */
164 typedef enum {
165         PACKAGE_MANAGER_STATUS_TYPE_ALL = 0x00,               /**< All status */
166         PACKAGE_MANAGER_STATUS_TYPE_INSTALL = 0x01,           /**< Install package status */
167         PACKAGE_MANAGER_STATUS_TYPE_UNINSTALL = 0x02,         /**< Uninstall package status */
168         PACKAGE_MANAGER_STATUS_TYPE_UPGRADE = 0x04,           /**< Upgrade package status */
169         PACKAGE_MANAGER_STATUS_TYPE_MOVE = 0x08,              /**< Move package status */
170         PACKAGE_MANAGER_STATUS_TYPE_CLEAR_DATA = 0x10,        /**< Clear data status */
171         PACKAGE_MANAGER_STATUS_TYPE_INSTALL_PROGRESS = 0x20,  /**< Install progress status */
172         PACKAGE_MANAGER_STATUS_TYPE_GET_SIZE = 0x40,          /**< Get size status */
173         PACKAGE_MANAGER_STATUS_TYPE_RES_COPY = 0x80,          /**< Resource copy status (Since 6.5) */
174         PACKAGE_MANAGER_STATUS_TYPE_RES_CREATE_DIR = 0x100,   /**< Resource create directory status (Since 6.5) */
175         PACKAGE_MANAGER_STATUS_TYPE_RES_REMOVE = 0x200,       /**< Resource remove status (Since 6.5) */
176         PACKAGE_MANAGER_STATUS_TYPE_RES_UNINSTALL = 0x400,    /**< Resource uninstall status (Since 6.5) */
177 } package_manager_status_type_e;
178
179
180 /**
181  * @brief Enumeration for resource event path state.
182  * @since_tizen 6.5
183  */
184 typedef enum {
185         PACKAGE_MANAGER_RES_EVENT_PATH_STATE_NONE = 0,   /**< State that operation do nothing about the path */
186         PACKAGE_MANAGER_RES_EVENT_PATH_STATE_OK,         /**< State that operation success about the path */
187         PACKAGE_MANAGER_RES_EVENT_PATH_STATE_FAILED,     /**< State that operation fail about the path */
188 } package_manager_res_event_path_state_e;
189
190 /**
191  * @brief The Package manager update info request handle.
192  * @since_tizen 4.0
193  */
194 typedef struct package_updateinfo_request_s *package_updateinfo_request_h;
195
196 /**
197  * @brief The Package manager handle.
198  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
199  */
200 typedef struct package_manager_s *package_manager_h;
201
202
203 /**
204  * @brief Package manager filter handle.
205  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
206  */
207 typedef struct package_manager_filter_s *package_manager_filter_h;
208
209 /**
210  * @brief Resource share event handle.
211  * @since_tizen 6.5
212  */
213 typedef struct package_manager_res_event_info_s *package_manager_res_event_info_h;
214
215 /**
216  * @brief Called when the package is installed, uninstalled, or updated, and the progress of the request to the package manager changes.
217  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
218  * @param[in] type The type of the package to be installed, uninstalled, or updated
219  * @param[in] package The name of the package to be installed, uninstalled, or updated
220  * @param[in] event_type The type of the request to the package manager
221  * @param[in] event_state The current state of the request to the package manager
222  * @param[in] progress    The progress for the request that is being processed by the package manager \n
223  *                        The range of progress is from @c 0 to @c 100
224  * @param[in] error       The error code when the package manager failed to process the request
225  * @param[in] user_data   The user data passed from package_manager_set_event_cb()
226  * @see package_manager_set_event_cb()
227  * @see package_manager_unset_event_cb()
228  */
229 typedef void (*package_manager_event_cb) (const char *type, const char *package, package_manager_event_type_e event_type, package_manager_event_state_e event_state, int progress, package_manager_error_e error, void *user_data);
230
231 /**
232  * @brief Called when the progress of the request to the package resource share changes.
233  * @since_tizen 6.5
234  * @remarks The @a pkgid should not be released. The @a pkgid can be used only in the callback.
235  * @remarks The @a handle should not be released. The @a handle can be used only in the callback.
236  * @param[in] pkgid The package ID of resource owner
237  * @param[in] event_type The type of resource event
238  * @param[in] event_state The state of resource event
239  * @param[in] handle    The handle which contains additional information of event
240  * @param[in] user_data   The user data passed from package_manager_set_res_event_cb()
241  * @see package_manager_set_res_event_cb()
242  * @see package_manager_unset_event_cb()
243  */
244 typedef void (*package_manager_res_event_cb) (const char *pkgid,
245                 package_manager_event_type_e event_type,
246                 package_manager_event_state_e event_state,
247                 package_manager_res_event_info_h handle, void *user_data);
248
249
250 /**
251  * @brief Creates a package manager handle.
252  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
253  * @privlevel public
254  * @privilege %http://tizen.org/privilege/packagemanager.info
255  * @remarks You must release @a manager using package_manager_destroy().
256  * @param[out] manager The package manager handle that is newly created on success
257  * @return @c 0 on success,
258  *         otherwise a negative error value
259  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
260  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
261  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
262  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
263  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          Internal I/O error
264  * @see package_manager_destroy()
265  */
266 int package_manager_create(package_manager_h *manager);
267
268
269 /**
270  * @brief Destroys the package manager handle.
271  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
272  * @param[in] manager The package manager handle
273  * @return @c 0 on success,
274  *         otherwise a negative error value
275  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
276  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
277  * @see package_manager_create()
278  */
279 int package_manager_destroy(package_manager_h manager);
280
281
282 /**
283  * @brief Sets the event status of the package when the package is installed, uninstalled, or updated.
284  * @details You can combine multiple status using OR operation which you want to listen.
285  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
286  * @param[in] manager     The package manager handle
287  * @param[in] status_type The status of the package
288  * @return @c 0 on success,
289  *         otherwise a negative error value
290  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
291  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
292  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          Internal I/O error
293  * @see package_manager_status_type_e
294  * @see package_manager_set_event_cb()
295  */
296 int package_manager_set_event_status(package_manager_h manager, int status_type);
297
298
299 /**
300  * @brief Registers a callback function to be invoked when the package is installed, uninstalled, or updated.
301  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
302  * @privlevel public
303  * @privilege %http://tizen.org/privilege/packagemanager.info
304  * @param[in] manager    The package manager handle
305  * @param[in] callback   The callback function to be registered
306  * @param[in] user_data  The user data to be passed to the callback function
307  * @return @c 0 on success,
308  *         otherwise a negative error value
309  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
310  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
311  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
312  * @post package_manager_event_cb() will be invoked.
313  * @see package_manager_set_event_status()
314  * @see package_manager_event_cb()
315  * @see package_manager_unset_event_cb()
316  */
317 int package_manager_set_event_cb(package_manager_h manager, package_manager_event_cb callback, void *user_data);
318
319
320 /**
321  * @platform
322  * @brief Registers a callback function to be invoked when the progress of the request to the package resource share changes.
323  * @since_tizen 6.5
324  * @privlevel platform
325  * @privilege %http://tizen.org/privilege/packagemanager.admin
326  * @param[in] manager    The package manager handle
327  * @param[in] callback   The callback function to be registered
328  * @param[in] user_data  The user data to be passed to the callback function
329  * @return @c 0 on success,
330  *         otherwise a negative error value
331  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
332  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
333  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
334  * @post package_manager_res_event_cb() will be invoked.
335  * @see package_manager_set_event_status()
336  * @see package_manager_res_event_cb()
337  * @see package_manager_unset_event_cb()
338  */
339 int package_manager_set_res_event_cb(package_manager_h manager, package_manager_res_event_cb callback, void *user_data);
340
341
342 /**
343  * @brief Unregisters the callback function.
344  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
345  * @param[in] manager The package manager handle
346  * @return @c 0 on success,
347  *         otherwise a negative error value
348  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
349  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
350  * @see package_manager_event_cb()
351  * @see package_manager_set_event_cb()
352  */
353 int package_manager_unset_event_cb(package_manager_h manager);
354
355
356 /**
357  * @brief Called to retrieve all packages.
358  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
359  * @param[in] package_info The package information
360  * @param[in] user_data    The user data passed from the foreach function
361  * @return  @c true to continue with the next iteration of the loop,
362  *          otherwise @c false to break out of the loop
363  * @see package_manager_foreach_package_info()
364  */
365 typedef bool (*package_manager_package_info_cb) (package_info_h package_info, void *user_data);
366
367
368 /**
369  * @brief Retrieves all package information of installed packages.
370  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
371  * @privlevel public
372  * @privilege %http://tizen.org/privilege/packagemanager.info
373  * @param[in] callback  The callback function to be invoked
374  * @param[in] user_data The user data to be passed to the callback function
375  * @return @c 0 on success,
376  *         otherwise a negative error value
377  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
378  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
379  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
380  * @post This function invokes package_manager_package_info_cb() repeatedly for each package information.
381  * @see package_manager_package_info_cb()
382  */
383 int package_manager_foreach_package_info(package_manager_package_info_cb callback, void *user_data);
384
385
386 /**
387  * @brief Gets the package ID for the given app ID.
388  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
389  * @privlevel public
390  * @privilege %http://tizen.org/privilege/packagemanager.info
391  * @remarks The @a package_id should be released using free().
392  * @param[in]  app_id     The ID of the application
393  * @param[out] package_id The ID of the package
394  * @return @c 0 on success,
395  *         otherwise a negative error value
396  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
397  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
398  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
399  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
400  */
401 int package_manager_get_package_id_by_app_id(const char *app_id, char **package_id);
402
403
404 /**
405  * @brief Gets the package information for the given package.
406  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
407  * @privlevel public
408  * @privilege %http://tizen.org/privilege/packagemanager.info
409  * @remarks You must release @a package_info using package_info_destroy().
410  * @param[in]  package_id   The ID of the package
411  * @param[out] package_info The package information for the given package ID
412  * @return @c 0 on success,
413  *         otherwise a negative error value
414  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
415  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
416  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
417  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
418  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR Database error occurred
419  */
420 int package_manager_get_package_info(const char *package_id, package_info_h *package_info);
421
422
423 /**
424  * @brief Compares whether two package certifications are matched.
425  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
426  * @param[in]  lhs_package_id The first package ID to compare
427  * @param[in]  rhs_package_id The second package ID to compare
428  * @param[out] compare_result @c 0 if the certification information are matched,
429  *                            otherwise the compared result
430  * @return @c 0 on success,
431  *         otherwise a negative error value
432  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
433  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
434  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
435  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          Database error occurred
436  */
437 int package_manager_compare_package_cert_info(const char *lhs_package_id, const char *rhs_package_id, package_manager_compare_result_type_e *compare_result);
438
439
440 /**
441  * @brief Compares whether two app certifications are matched.
442  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
443  * @param[in]  lhs_app_id     The first app ID to compare
444  * @param[in]  rhs_app_id     The second app ID to compare
445  * @param[out] compare_result @c 0 if the certification information are matched,
446  *                            otherwise the compared result
447  * @return @c 0 on success,
448  *         otherwise a negative error value
449  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
450  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
451  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
452  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          Database error occurred
453  */
454 int package_manager_compare_app_cert_info(const char *lhs_app_id, const char *rhs_app_id, package_manager_compare_result_type_e *compare_result);
455
456
457 /**
458  * @brief Checks whether the package is preloaded by @a app_id.
459  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
460  * @privlevel public
461  * @privilege %http://tizen.org/privilege/packagemanager.info
462  * @param[in]  app_id   The ID of the application
463  * @param[out] preload  The preload info of the package
464  * @return @c 0 on success,
465  *         otherwise a negative error value
466  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
467  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
468  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
469  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
470  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          I/O error
471  */
472 int package_manager_is_preload_package_by_app_id(const char *app_id, bool *preload);
473
474
475 /**
476  * @brief Gets the package permission type by @a app_id.
477  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
478  * @privlevel public
479  * @privilege %http://tizen.org/privilege/packagemanager.info
480  * @param[in]  app_id          The ID of the application
481  * @param[out] permission_type The package permission type
482  * @return @c 0 on success,
483  *         otherwise a negative error value
484  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
485  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
486  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
487  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
488  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          I/O error
489  */
490 int package_manager_get_permission_type(const char *app_id, package_manager_permission_type_e *permission_type);
491
492
493 /**
494  * @brief Clears the application's internal and external cache directory, asynchronously.
495  * @details All files stored in the cache directory of the application specified with the package ID are removed.
496  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
497  * @privlevel public
498  * @privilege %http://tizen.org/privilege/packagemanager.clearcache
499  * @param[in] package_id  The package ID
500  * @return @c 0 on success,
501  *         otherwise a negative error value
502  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
503  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
504  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
505  * @retval #PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE   No such package
506  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
507  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          I/O error
508  * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR      Severe system error
509  */
510 int package_manager_clear_cache_dir(const char *package_id);
511
512 /**
513  * @platform
514  * @brief  Clears all applications' internal and external cache directory, asynchronously.
515  * @details All files stored in the cache directory of each application are removed.
516  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
517  * @privlevel platform
518  * @privilege %http://tizen.org/privilege/packagemanager.admin
519  * @return @c 0 on success,
520  *         otherwise a negative error value
521  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
522  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
523  * @retval #PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE   No such package
524  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
525  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          I/O error
526  * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR      Severe system error
527  */
528 int package_manager_clear_all_cache_dir(void);
529
530 /**
531  * @platform
532  * @brief Clears internal and external data directories used by applications in the given package.
533  * @details All files stored in data directories used by applications in the package specified with the @a package_id are removed.
534  * @since_tizen 4.0
535  * @privlevel platform
536  * @privilege %http://tizen.org/privilege/packagemanager.admin
537  * @param[in] package_id  The package ID
538  * @return @c 0 on success,
539  *         otherwise a negative error value
540  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
541  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
542  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
543  * @retval #PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE   No such package
544  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
545  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          I/O error
546  * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR      Severe system error
547  */
548 int package_manager_clear_data_dir(const char *package_id);
549
550
551 /**
552  * @brief The package size information handle.
553  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
554  */
555 typedef struct package_size_info *package_size_info_h;
556
557
558 /**
559  * @brief Called when the package size information is obtained.
560  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
561  * @param[in] package_id  The package ID
562  * @param[in] size_info   The pointer to the structure including the package size information
563  * @param[in] user_data   The user data to be passed to the callback function
564  */
565 typedef void (*package_manager_size_info_receive_cb)(const char *package_id, const package_size_info_h size_info, void *user_data);
566
567
568 /**
569  * @platform
570  * @brief Called when the total package size information is obtained.
571  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
572  * @param[in] size_info  The pointer to the structure including the package size information
573  * @param[in] user_data  The user data to be passed to the callback function
574  */
575 typedef void (*package_manager_total_size_info_receive_cb)(const package_size_info_h size_info, void *user_data);
576
577
578 /**
579  * @brief Gets the package size information, asynchronously.
580  * @details The package size info is asynchronously obtained by the callback function.
581  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
582  * @privlevel public
583  * @privilege %http://tizen.org/privilege/packagemanager.info
584  * @param[in] package_id  The package ID
585  * @param[in] callback    The asynchronous callback function to get the package size information
586  * @param[in] user_data   The user data to be passed to the callback function
587  * @return @c 0 on success,
588  *         otherwise a negative error value
589  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
590  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
591  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
592  * @retval #PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE   No such package
593  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
594  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          I/O error
595  * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR      Severe system error
596  */
597 int package_manager_get_package_size_info(const char *package_id, package_manager_size_info_receive_cb callback, void *user_data);
598
599
600 /**
601  * @brief Gets the total package size information, asynchronously.
602  * @details The total package size info is asynchronously obtained by the callback function.
603  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
604  * @privlevel public
605  * @privilege %http://tizen.org/privilege/packagemanager.info
606  * @param[in] callback  The asynchronous callback function to get the total package size information
607  * @param[in] user_data The user data to be passed to the callback function
608  * @return @c 0 on success,
609  *         otherwise a negative error value
610  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
611  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
612  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
613  * @retval #PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE   No such package
614  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
615  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          I/O error
616  * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR      Severe system error
617  */
618 int package_manager_get_total_package_size_info(package_manager_total_size_info_receive_cb callback, void *user_data);
619
620
621 /**
622  * @brief Creates the package information filter handle from db.
623  * @details The filtered result will be based on AND operation of all added filter properties.
624  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
625  * @privlevel public
626  * @privilege %http://tizen.org/privilege/packagemanager.info
627  * @remarks The @a handle should be released using package_manager_filter_destroy().
628  * @param[out] handle Pointer to the package info filter handle
629  * @return @c 0 on success,
630  *         otherwise a negative error value
631  * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
632  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
633  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
634  * @post package_manager_filter_destroy()
635  * @see package_manager_filter_add_bool()
636  * @see package_manager_filter_foreach_package_info()
637  */
638 int package_manager_filter_create(package_manager_filter_h *handle);
639
640
641 /**
642  * @brief Destroys the package information filter handle freeing up all the resources.
643  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
644  * @param[in] handle Pointer to the package info filter handle
645  * @return @c 0 on success,
646  *         otherwise a negative error value
647  * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
648  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
649  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
650  * @pre package_manager_filter_create()
651  * @see package_manager_filter_count()
652  * @see package_manager_filter_foreach_package_info()
653  */
654 int package_manager_filter_destroy(package_manager_filter_h handle);
655
656
657 /**
658  * @brief Adds a boolean filter property to the filter handle.
659  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
660  * @param[in] handle Pointer to the package info filter handle
661  * @param[in] property boolean property name
662  * @param[in] value value corresponding to the property
663  * @return @c 0 on success,
664  *         otherwise a negative error value
665  * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
666  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
667  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
668  * @pre package_manager_filter_create()
669  * @post package_manager_filter_destroy()
670  * @see package_manager_filter_count()
671  * @see package_manager_filter_foreach_package_info()
672  */
673 int package_manager_filter_add_bool(package_manager_filter_h handle, const char *property, const bool value);
674
675
676 /**
677  * @brief Adds a string filter property to the filter handle.
678  * @since_tizen 6.5
679  * @param[in] handle pointer to the package info filter handle
680  * @param[in] property string property name
681  * @param[in] value value corresponding to the property
682  * @return @c 0 on success,
683  *         otherwise a negative error value
684  * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
685  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
686  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
687  * @pre package_manager_filter_create()
688  * @post package_manager_filter_destroy()
689  * @see package_manager_filter_count()
690  * @see package_manager_filter_foreach_package_info()
691  */
692 int package_manager_filter_add_string(package_manager_filter_h handle, const char *property, const char *value);
693
694
695 /**
696  * @brief Counts the package that satisfy the filter conditions.
697  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
698  * @privlevel public
699  * @privilege %http://tizen.org/privilege/packagemanager.info
700  * @param[in] handle Pointer to the package info filter handle
701  * @param[out] count Pointer to store the count value
702  * @return @c 0 on success,
703  *         otherwise a negative error value
704  * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
705  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
706  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
707  * @pre package_manager_filter_create()
708  * @post package_manager_filter_destroy()
709  * @see package_manager_filter_foreach_package_info()
710  */
711 int package_manager_filter_count(package_manager_filter_h handle, int *count);
712
713
714 /**
715  * @brief Executes the user supplied callback function for each package that satisfy the filter conditions.
716  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
717  * @privlevel public
718  * @privilege %http://tizen.org/privilege/packagemanager.info
719  * @param[in] handle Pointer to the package info filter handle
720  * @param[in] callback callback function
721  * @param[in] user_data user data to be passed to the callback function
722  * @return @c 0 on success,
723  *         otherwise a negative error value
724  * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
725  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
726  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
727  * @pre package_manager_filter_create()
728  * @post package_manager_filter_destroy()
729  * @post This function invokes package_manager_package_info_cb() repeatedly for each package information.
730  * @see package_manager_package_info_cb()
731  * @see package_manager_filter_count()
732  */
733 int package_manager_filter_foreach_package_info(package_manager_filter_h handle, package_manager_package_info_cb callback, void *user_data);
734
735
736 /**
737  * @platform
738  * @brief Generates request for getting License, asynchronously.
739  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
740  * @privlevel platform
741  * @privilege %http://tizen.org/privilege/packagemanager.admin
742  * @remarks You must release @a req_data and @a license_url by yourself.
743  * @param[in] resp_data The response data string of the purchase request
744  * @param[out] req_data License request data
745  * @param[out] license_url License acquisition url data
746  * @return @c 0 on success,
747  *         otherwise a negative error value
748  * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
749  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
750  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
751  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
752  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR Internal I/O error
753  * @post package_manager_drm_register_license()
754  */
755 int package_manager_drm_generate_license_request(const char *resp_data, char **req_data, char **license_url);
756
757
758 /**
759  * @platform
760  * @brief Registers encrypted license, asynchronously.
761  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
762  * @privlevel platform
763  * @privilege %http://tizen.org/privilege/packagemanager.admin
764  * @param[in] resp_data The response data string of the rights request
765  * @return @c 0 on success,
766  *         otherwise a negative error value
767  * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
768  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
769  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
770  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR Internal I/O error
771  * @pre package_manager_drm_generate_license_request()
772  */
773 int package_manager_drm_register_license(const char *resp_data);
774
775 /**
776  * @platform
777  * @brief Decrypts contents which is encrypted, asynchronously.
778  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
779  * @privlevel platform
780  * @privilege %http://tizen.org/privilege/packagemanager.admin
781  * @param[in] drm_file_path DRM file path
782  * @param[in] decrypted_file_path Decrypted file path
783  * @return @c 0 on success,
784  *         otherwise a negative error value
785  * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
786  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
787  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
788  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR Internal I/O error
789  */
790 int package_manager_drm_decrypt_package(const char *drm_file_path, const char *decrypted_file_path);
791
792
793 /**
794  * @brief Retrieves data size from given handle.
795  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
796  * @param[in] handle Package size info handle
797  * @param[out] data_size Data size will be returned
798  * @return @c 0 on success,
799  *         otherwise a negative error value
800  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
801  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
802  */
803 int package_size_info_get_data_size(package_size_info_h handle, long long *data_size);
804
805
806 /**
807  * @brief Retrieves cache size from given handle.
808  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
809  * @param[in] handle  Package size info handle
810  * @param[out] cache_size Cache size will be returned
811  * @return @c 0 on success,
812  *         otherwise a negative error value
813  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
814  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
815  */
816 int package_size_info_get_cache_size(package_size_info_h handle, long long *cache_size);
817
818
819 /**
820  * @brief Retrieves application size from given handle.
821  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
822  * @param[in] handle Package size info handle
823  * @param[out] app_size App size will be returned
824  * @return @c 0 on success,
825  *         otherwise a negative error value
826  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
827  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
828  */
829 int package_size_info_get_app_size(package_size_info_h handle, long long *app_size);
830
831
832 /**
833  * @brief Retrieves external data size from given handle.
834  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
835  * @param[in] handle  Package size info handle
836  * @param[out] ext_data_size External data size will be returned
837  * @return @c 0 on success,
838  *         otherwise a negative error value
839  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
840  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
841  */
842 int package_size_info_get_external_data_size(package_size_info_h handle, long long *ext_data_size);
843
844
845 /**
846  * @brief Retrieves external cache size from given handle.
847  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
848  * @param[in] handle Package size info handle
849  * @param[out] ext_cache_size External cache size will be returned
850  * @return @c 0 on success,
851  *         otherwise a negative error value
852  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
853  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
854  */
855 int package_size_info_get_external_cache_size(package_size_info_h handle, long long *ext_cache_size);
856
857
858 /**
859  * @brief Retrieves external application size from given handle.
860  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
861  * @param[in] handle Package size info handle
862  * @param[out] ext_app_size External app size will be returned
863  * @return @c 0 on success,
864  *         otherwise a negative error value
865  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
866  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
867  */
868 int package_size_info_get_external_app_size(package_size_info_h handle, long long *ext_app_size);
869
870
871 /**
872 * @}
873 */
874
875 /**
876  * @addtogroup CAPI_PACKAGE_REQUEST_MODULE
877  * @{
878  */
879
880
881 /**
882  * @platform
883  * @brief Enumeration for request mode.
884  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
885  */
886 typedef enum {
887         PACKAGE_MANAGER_REQUEST_MODE_DEFAULT = 0,    /**< @platform Default request mode */
888         PACKAGE_MANAGER_REQUEST_MODE_QUIET,          /**< @platform Quiet request mode */
889 } package_manager_request_mode_e;
890
891
892 /**
893  * @platform
894  * @brief The Package manager request handle.
895  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
896  */
897 typedef struct package_manager_request_s *package_manager_request_h;
898
899
900 /**
901  * @platform
902  * @brief Called when the progress of the request to the package manager changes.
903  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
904  * @param[in] id          The ID of the request to the package manager
905  * @param[in] type        The type of the package to install, uninstall or update
906  * @param[in] package     The name of the package to install, uninstall or update
907  * @param[in] event_type  The type of the request to the package manager
908  * @param[in] event_state The current state of the request to the package manager
909  * @param[in] progress    The progress for the request that is being processed by the package manager \n
910  *                        The range of progress is from @c 0 to @c 100.
911  * @param[in] error       The error code when the package manager failed to process the request
912  * @param[in] user_data   The user data passed from package_manager_request_set_event_cb()
913  * @see package_manager_request_set_event_cb()
914  * @see package_manager_request_unset_event_cb()
915  */
916 typedef void (*package_manager_request_event_cb) (int id, const char *type, const char *package, package_manager_event_type_e event_type, package_manager_event_state_e event_state, int progress, package_manager_error_e error, void *user_data);
917
918
919 /**
920  * @platform
921  * @brief Called when the progress of the request to the package resource share changes.
922  * @since_tizen 6.5
923  * @remarks The @a pkgid should not be released. The @a pkgid can be used only in the callback.
924  * @remarks The @a handle should not be released. The @a handle can be used only in the callback.
925  * @param[in] req_id      The ID of the request to the package manager
926  * @param[in] pkgid       The package ID of resource owner
927  * @param[in] event_type  The type of resource event
928  * @param[in] event_state The state of resource event
929  * @param[in] handle      The handle which contains additional information of event
930  * @param[in] user_data   The user data passed from package_manager_request_res_copy_with_cb(), package_manager_request_res_create_dir_with_cb(), package_manager_request_res_remove_with_cb()
931  * @see package_manager_request_res_copy_with_cb()
932  * @see package_manager_request_res_create_dir_with_cb()
933  * @see package_manager_request_res_remove_with_cb()
934  */
935 typedef void (*package_manager_request_res_event_cb) (int req_id,
936                 const char *pkgid, package_manager_event_type_e event_type, package_manager_event_state_e event_state,
937                 package_manager_res_event_info_h handle, void *user_data);
938
939
940 /**
941  * @platform
942  * @brief Creates a request handle to the package manager.
943  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
944  * @remarks You must release @a request using package_manager_request_destroy().
945  * @param[out] request The request handle that is newly created on success
946  * @return @c 0 on success,
947  *         otherwise a negative error value
948  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
949  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
950  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
951  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          Internal I/O error
952  * @see package_manager_request_destroy()
953  */
954 int package_manager_request_create(package_manager_request_h *request);
955
956
957 /**
958  * @platform
959  * @brief Destroys the request handle to the package manager.
960  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
961  * @param[in] request The request handle to the package manager
962  * @return @c 0 on success,
963  *         otherwise a negative error value
964  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
965  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
966  * @see package_manager_request_create()
967  */
968 int package_manager_request_destroy(package_manager_request_h request);
969
970
971 /**
972  * @platform
973  * @brief Registers a callback function to be invoked when the progress of the request changes.
974  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
975  * @privlevel public
976  * @privilege %http://tizen.org/privilege/packagemanager.info
977  * @param[in] request The request handle
978  * @param[in] callback The callback function to be registered
979  * @param[in] user_data The user data to be passed to the callback function
980  * @return @c 0 on success,
981  *         otherwise a negative error value
982  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
983  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
984  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
985  * @post package_manager_request_event_cb() will be invoked.
986  * @see package_manager_request_event_cb()
987  * @see package_manager_request_unset_event_cb()
988  */
989 int package_manager_request_set_event_cb(package_manager_request_h request, package_manager_request_event_cb callback, void *user_data);
990
991
992 /**
993  * @platform
994  * @brief Unregisters the callback function.
995  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
996  * @param[in] request The request handle
997  * @return @c 0 on success,
998  *         otherwise a negative error value
999  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
1000  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
1001  * @see package_manager_request_event_cb()
1002  * @see package_manager_request_set_event_cb()
1003  */
1004 int package_manager_request_unset_event_cb(package_manager_request_h request);
1005
1006
1007 /**
1008  * @platform
1009  * @brief Sets the type of the package to install, uninstall, or update.
1010  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1011  * @param[in] request The request handle
1012  * @param[in] type    The type of the package
1013  * @return @c 0 on success,
1014  *         otherwise a negative error value
1015  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
1016  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
1017  */
1018 int package_manager_request_set_type(package_manager_request_h request, const char *type);
1019
1020
1021 /**
1022  * @platform
1023  * @brief Sets the mode of the request.
1024  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1025  * @param[in] request The request handle
1026  * @param[in] mode    The mode of the request
1027  * @return @c 0 on success,
1028  *         otherwise a negative error value
1029  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
1030  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
1031  */
1032 int package_manager_request_set_mode(package_manager_request_h request, package_manager_request_mode_e mode);
1033
1034
1035 /**
1036  * @platform
1037  * @brief Sets the path of TEP file to the request. The TEP file that is set will be installed when the package is installed.
1038  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
1039  * @privlevel platform
1040  * @privilege %http://tizen.org/privilege/packagemanager.admin
1041  * @param[in] request The request handle
1042  * @param[in] tep_path The TEP path to set. If this is NULL on update, installed TEP will be removed.
1043  * @return @c 0 on success,
1044  *         otherwise a negative error value
1045  * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
1046  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
1047  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
1048  * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR           Severe system error
1049  */
1050 int package_manager_request_set_tep(package_manager_request_h request, const char *tep_path);
1051
1052
1053 /**
1054  * @platform
1055  * @brief Installs the package located at the given path, asynchronously.
1056  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1057  * @privlevel platform
1058  * @privilege %http://tizen.org/privilege/packagemanager.admin
1059  * @param[in]  request The request handle
1060  * @param[in]  path    The absolute path to the package to be installed
1061  * @param[out] id      The ID of the request to the package manager
1062  * @return @c 0 on success,
1063  *         otherwise a negative error value
1064  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
1065  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
1066  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
1067  * @see package_manager_request_uninstall()
1068  */
1069 int package_manager_request_install(package_manager_request_h request, const char *path, int *id);
1070
1071
1072 /**
1073  * @platform
1074  * @brief Installs the package located at the given path, asynchronously.
1075  * @details The progress of the request is asynchronously received by the callback function.
1076  *          The @a callback is the individual callback only called for the current API call.
1077  *          The @a callback is the only callback called, even if another callback was set for this request
1078  *          with package_manager_request_set_event_cb().
1079  * @since_tizen 4.0
1080  * @privlevel platform
1081  * @privilege %http://tizen.org/privilege/packagemanager.admin
1082  * @param[in]  request   The request handle
1083  * @param[in]  path      The absolute path to the package to be installed
1084  * @param[in]  callback  The callback function to be invoked
1085  * @param[in]  user_data The user data to be passed to the callback function
1086  * @param[out] id        The ID of the request to the package manager
1087  * @return @c 0 on success,
1088  *         otherwise a negative error value
1089  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
1090  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
1091  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
1092  */
1093 int package_manager_request_install_with_cb(package_manager_request_h request,
1094                                                 const char *path,
1095                                                 package_manager_request_event_cb callback,
1096                                                 void *user_data,
1097                                                 int *id);
1098
1099 /**
1100  * @platform
1101  * @brief Installs the packages located at the given paths, asynchronously.
1102  * @since_tizen 6.0
1103  * @privlevel platform
1104  * @privilege %http://tizen.org/privilege/packagemanager.admin
1105  * @param[in]  request The request handle
1106  * @param[in]  paths       The array of absolute paths to the packages to be installed
1107  * @param[in]  paths_count The number of paths in array
1108  * @param[out] id          The ID of the request to the package manager
1109  * @return @c 0 on success,
1110  *         otherwise a negative error value
1111  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
1112  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
1113  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
1114  * @retval #PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE   No such package
1115  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
1116  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          I/O error
1117  * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR      Severe system error
1118  */
1119 int package_manager_request_install_packages(package_manager_request_h request,
1120                                                 const char **paths,
1121                                                 int paths_count,
1122                                                 int *id);
1123
1124 /**
1125  * @platform
1126  * @brief Installs the packages located at the given paths, asynchronously.
1127  * @details The progress of the request is asynchronously received by the callback function.
1128  *          The @a callback is the individual callback only called for the current API call.
1129  *          The @a callback is the only callback called, even if another callback was set for this request
1130  *          with package_manager_request_set_event_cb().
1131  * @since_tizen 6.0
1132  * @privlevel platform
1133  * @privilege %http://tizen.org/privilege/packagemanager.admin
1134  * @param[in]  request       The request handle
1135  * @param[in]  paths         The array of absolute paths to the packages to be installed
1136  * @param[in]  paths_count   The number of paths in array
1137  * @param[in]  callback      The callback function to be invoked
1138  * @param[in]  user_data     The user data to be passed to the callback function
1139  * @param[out] id            The ID of the request to the package manager
1140  * @return @c 0 on success,
1141  *         otherwise a negative error value
1142  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
1143  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
1144  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
1145  * @retval #PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE   No such package
1146  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
1147  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          I/O error
1148  * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR      Severe system error
1149  */
1150 int package_manager_request_install_packages_with_cb(package_manager_request_h request,
1151                                                 const char **paths,
1152                                                 int paths_count,
1153                                                 package_manager_request_event_cb callback,
1154                                                 void *user_data,
1155                                                 int *id);
1156
1157 /**
1158  * @platform
1159  * @brief Uninstalls the package with the given name, asynchronously.
1160  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1161  * @privlevel platform
1162  * @privilege %http://tizen.org/privilege/packagemanager.admin
1163  * @param[in]  request The request handle
1164  * @param[in]  name    The name of the package to be uninstalled
1165  * @param[out] id      The ID of the request to the package manager
1166  * @return @c 0 on success,
1167  *         otherwise a negative error value
1168  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
1169  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
1170  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
1171  */
1172 int package_manager_request_uninstall(package_manager_request_h request, const char *name, int *id);
1173
1174
1175 /**
1176  * @platform
1177  * @brief Uninstalls the package with the given name, asynchronously.
1178  * @details The progress of the request is asynchronously received by the callback function.
1179  *          The @a callback is the individual callback only called for the current API call.
1180  *          The @a callback is the only callback called, even if another callback was set for this request
1181  *          with package_manager_request_set_event_cb().
1182  * @since_tizen 4.0
1183  * @privlevel platform
1184  * @privilege %http://tizen.org/privilege/packagemanager.admin
1185  * @param[in]  request   The request handle
1186  * @param[in]  name      The name of the package to be uninstalled
1187  * @param[in]  callback  The callback function to be invoked
1188  * @param[in]  user_data The user data to be passed to the callback function
1189  * @param[out] id        The ID of the request to the package manager
1190  * @return @c 0 on success,
1191  *         otherwise a negative error value
1192  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
1193  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
1194  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
1195  */
1196 int package_manager_request_uninstall_with_cb(package_manager_request_h request,
1197                                                 const char *name,
1198                                                 package_manager_request_event_cb callback,
1199                                                 void *user_data,
1200                                                 int *id);
1201
1202 /**
1203  * @platform
1204  * @brief Moves the package from SD card to the internal memory and vice versa, asynchronously.
1205  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1206  * @privlevel platform
1207  * @privilege %http://tizen.org/privilege/packagemanager.admin
1208  * @param[in] request   The request handle
1209  * @param[in] name      The name of the package to be moved
1210  * @param[in] move_type The move type [#package_manager_move_type_e], [external to internal/internal to external]
1211  * @return @c 0 on success,
1212  *         otherwise a negative error value
1213  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
1214  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
1215  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
1216  */
1217 int package_manager_request_move(package_manager_request_h request, const char *name, package_manager_move_type_e move_type);
1218
1219
1220 /**
1221  * @platform
1222  * @brief Moves the package from SD card to the internal memory and vice versa, asynchronously.
1223  * @details The progress of the request is asynchronously received by the callback function.
1224  *          The @a callback is the individual callback only called for the current API call.
1225  *          The @a callback is the only callback called, even if another callback was set for this request
1226  *          with package_manager_request_set_event_cb().
1227  * @since_tizen 4.0
1228  * @privlevel platform
1229  * @privilege %http://tizen.org/privilege/packagemanager.admin
1230  * @param[in]  request   The request handle
1231  * @param[in]  name      The name of the package to be moved
1232  * @param[in]  move_type The move type [#package_manager_move_type_e], [external to internal/internal to external]
1233  * @param[in]  callback  The callback function to be invoked
1234  * @param[in]  user_data The user data to be passed to the callback function
1235  * @param[out] id        The ID of the request to the package manager
1236  * @return @c 0 on success,
1237  *         otherwise a negative error value
1238  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
1239  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
1240  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
1241  */
1242 int package_manager_request_move_with_cb(package_manager_request_h request,
1243                                                 const char *name,
1244                                                 package_manager_move_type_e move_type,
1245                                                 package_manager_request_event_cb callback,
1246                                                 void *user_data,
1247                                                 int *id);
1248
1249 /**
1250  * @platform
1251  * @brief Creates a package update info request.
1252  * @since_tizen 4.0
1253  * @privlevel platform
1254  * @privilege %http://tizen.org/privilege/packagemanager.admin
1255  * @remarks You must release @a pkg_updateinfo_req using package_manager_updateinfo_request_destroy().
1256  * @param[out] pkg_updateinfo_req The package update info request handle that is newly created on success
1257  * @return @c 0 on success,
1258  *         otherwise a negative error value
1259  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
1260  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
1261  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
1262  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
1263  * @see package_manager_updateinfo_request_destroy()
1264  */
1265 int package_manager_updateinfo_request_create(package_updateinfo_request_h *pkg_updateinfo_req);
1266
1267 /**
1268  * @brief Sets the package ID to the package update info request.
1269  * @since_tizen 4.0
1270  * @param[in] pkg_updateinfo_req   The update info request handle
1271  * @param[in] pkgid                The package ID
1272  * @return @c 0 on success,
1273  *         otherwise a negative error value
1274  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
1275  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
1276  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
1277  * @see package_manager_updateinfo_request_create()
1278  */
1279 int package_manager_updateinfo_set_pkgid(package_updateinfo_request_h pkg_updateinfo_req, const char *pkgid);
1280
1281 /**
1282  * @brief Sets the package version to the package update info request.
1283  * @since_tizen 4.0
1284  * @param[in] pkg_updateinfo_req   The update info request handle
1285  * @param[in] version              The package version
1286  * @return @c 0 on success,
1287  *         otherwise a negative error value
1288  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
1289  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
1290  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
1291  * @see package_manager_updateinfo_request_create()
1292  */
1293 int package_manager_updateinfo_set_version(package_updateinfo_request_h pkg_updateinfo_req, const char *version);
1294
1295 /**
1296  * @brief Sets the package update type to the package update info request.
1297  * @since_tizen 4.0
1298  * @param[in] pkg_updateinfo_req   The update info request handle
1299  * @param[in] type                 The package update type
1300  * @return @c 0 on success,
1301  *         otherwise a negative error value
1302  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
1303  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
1304  * @see package_manager_updateinfo_request_create()
1305  * @see package_updateinfo_type_e
1306  */
1307 int package_manager_updateinfo_set_type(package_updateinfo_request_h pkg_updateinfo_req, package_updateinfo_type_e type);
1308
1309 /**
1310  * @brief Requests to register package update info in platform.
1311  * @since_tizen 4.0
1312  * @param[in] pkg_updateinfo_req    The update info request handle
1313  * @return @c 0 on success,
1314  *         otherwise a negative error value
1315  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
1316  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
1317  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          I/O error
1318  * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR      Severe system error
1319  * @see package_manager_updateinfo_request_create()
1320  * @see package_manager_updateinfo_request_destroy()
1321  */
1322 int package_manager_updateinfo_request_register(package_updateinfo_request_h pkg_updateinfo_req);
1323
1324 /**
1325  * @brief Destroys the package update info request.
1326  * @since_tizen 4.0
1327  * @param[in] pkg_updateinfo_req    The update info request handle
1328  * @return @c 0 on success,
1329  *         otherwise a negative error value
1330  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
1331  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
1332  * @see package_manager_updateinfo_request_create()
1333  */
1334 int package_manager_updateinfo_request_destroy(package_updateinfo_request_h pkg_updateinfo_req);
1335
1336 /**
1337  * @brief Requests to unregister update info in platform for given package id.
1338  * @since_tizen 4.0
1339  * @param[in] pkg_updateinfo_req   The update info request handle
1340  * @param[in] pkgid                The package id to request unregister update info
1341  * @return @c 0 on success,
1342  *         otherwise a negative error value
1343  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
1344  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
1345  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          I/O error
1346  * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR      Severe system error
1347  */
1348 int package_manager_updateinfo_request_unregister(package_updateinfo_request_h pkg_updateinfo_req, const char *pkgid);
1349
1350 /**
1351  * @brief Request to unregister update info of all packages in platform.
1352  * @since_tizen 4.0
1353  * @param[in] pkg_updateinfo_req    The update info request handle
1354  * @return @c 0 on success,
1355  *         otherwise a negative error value
1356  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
1357  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
1358  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          I/O error
1359  * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR      Severe system error
1360  */
1361 int package_manager_updateinfo_request_unregister_all(package_updateinfo_request_h pkg_updateinfo_req);
1362
1363 /**
1364  * @platform
1365  * @brief  Adds resource source and destination path into handle.
1366  * @details Adds resource source path and destination path to be copied into handle
1367  * @since_tizen 6.5
1368  * @privlevel platform
1369  * @privilege %http://tizen.org/privilege/packagemanager.admin
1370  * @param[in] request      The package manager request handle
1371  * @param[in] src_path     The relative path of resource file or directory to be copied
1372  * @param[in] dest_path    The relative path of destination
1373  * @return @c 0 on success,
1374  *         otherwise a negative error value
1375  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
1376  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
1377  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
1378  * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR      Severe system error
1379  * @see package_manager_request_res_copy_with_cb()
1380  */
1381 int package_manager_request_add_res_copy_path(package_manager_request_h request, const char *src_path, const char *dest_path);
1382
1383 /**
1384  * @platform
1385  * @brief  Copies resources into target directory, asynchronously.
1386  * @details Copies resources into directory, which could be access via privileged applications only.
1387  * @since_tizen 6.5
1388  * @privlevel platform
1389  * @privilege %http://tizen.org/privilege/packagemanager.admin
1390  * @param[in] request      The package manager request handle
1391  * @param[in] callback     The callback function to be invoked
1392  * @param[in] user_data    The user data to be passed to the callback function
1393  * @param[out] id        The ID of the request to the package manager
1394  * @return @c 0 on success,
1395  *         otherwise a negative error value
1396  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
1397  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
1398  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
1399  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
1400  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          I/O error
1401  * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR      Severe system error
1402  * @see package_manager_request_add_res_copy_path()
1403  */
1404 int package_manager_request_res_copy_with_cb(package_manager_request_h request, package_manager_request_res_event_cb callback, void *user_data, int *id);
1405
1406 /**
1407  * @platform
1408  * @brief  Add directory path to be created at privileged shared directory into handle.
1409  * @details Added directory path will be created into directory existed for sharing resources via privileged applications
1410  * @since_tizen 6.5
1411  * @privlevel platform
1412  * @privilege %http://tizen.org/privilege/packagemanager.admin
1413  * @param[in] request      The package manager request handle
1414  * @param[in] dir_path     The relative path of directories to be created under shared resource path
1415  * @return @c 0 on success,
1416  *         otherwise a negative error value
1417  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
1418  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
1419  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
1420  * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR      Severe system error
1421  * @see package_manager_request_res_create_dir_with_cb()
1422  */
1423 int package_manager_request_add_res_create_dir_path(package_manager_request_h request, const char *dir_path);
1424
1425 /**
1426  * @platform
1427  * @brief  Create directories into directory for sharing resources via privileged application, asynchronously.
1428  * @details Create directories into certain directory which could be access via privileged applications only.
1429  * @since_tizen 6.5
1430  * @privlevel platform
1431  * @privilege %http://tizen.org/privilege/packagemanager.admin
1432  * @param[in] request      The package manager request handle
1433  * @param[in] callback     The callback function to be invoked
1434  * @param[in] user_data    The user data to be passed to the callback function
1435  * @param[out] id        The ID of the request to the package manager
1436  * @return @c 0 on success,
1437  *         otherwise a negative error value
1438  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
1439  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
1440  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
1441  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
1442  * @see package_manager_request_add_res_create_dir_path()
1443  */
1444 int package_manager_request_res_create_dir_with_cb(package_manager_request_h request, package_manager_request_res_event_cb callback, void *user_data, int *id);
1445
1446 /**
1447  * @platform
1448  * @brief  Adds file or directory path to be removed located at privileged shared directory into handle.
1449  * @details Added path will be removed from directory existed for sharing resources via privileged applications
1450  * @since_tizen 6.5
1451  * @privlevel platform
1452  * @privilege %http://tizen.org/privilege/packagemanager.admin
1453  * @param[in] request      The package manager request handle
1454  * @param[in] res_path     The relative path of resources to be removed from privileged shared resource directory
1455  * @return @c 0 on success,
1456  *         otherwise a negative error value
1457  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
1458  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
1459  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
1460  * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR      Severe system error
1461  * @see package_manager_request_res_remove_with_cb()
1462  */
1463 int package_manager_request_add_res_remove_path(package_manager_request_h request, const char *res_path);
1464
1465 /**
1466  * @platform
1467  * @brief  Removes resources from for sharing resources via privileged application, asynchronously.
1468  * @details Removes resources added at handle from certain directory which could be access via privileged applications only.
1469  * @since_tizen 6.5
1470  * @privlevel platform
1471  * @privilege %http://tizen.org/privilege/packagemanager.admin
1472  * @param[in] request      The package manager request handle
1473  * @param[in] callback     The callback function to be invoked
1474  * @param[in] user_data    The user data to be passed to the callback function
1475  * @param[out] id        The ID of the request to the package manager
1476  * @return @c 0 on success,
1477  *         otherwise a negative error value
1478  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
1479  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
1480  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
1481  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
1482  * @see package_manager_request_add_res_remove_path()
1483  */
1484 int package_manager_request_res_remove_with_cb(package_manager_request_h request, package_manager_request_res_event_cb callback, void *user_data, int *id);
1485
1486 /**
1487  * @platform
1488  * @brief Gets the error code from given resource event handle.
1489  * @since_tizen 6.5
1490  * @privlevel platform
1491  * @privilege %http://tizen.org/privilege/packagemanager.admin
1492  * @param[in] handle       Resource event info handle
1493  * @param[out] error       Error will be returned
1494  * @return @c 0 on success,
1495  *         otherwise a negative error value
1496  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
1497  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
1498  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
1499  */
1500 int package_manager_res_event_info_get_error_code(package_manager_res_event_info_h handle, package_manager_error_e *error);
1501
1502
1503 /**
1504  * @brief Called to retrieve all path state about resource event.
1505  * @since_tizen 6.5
1506  * @remarks The @a path should not be released. The @a path can be used only in the callback.
1507  * @param[in] path         The path handled by a resource event
1508  * @param[in] state        The state of the path
1509  * @param[in] user_data    The user data passed from the foreach function
1510  * @return  @c true to continue with the next iteration of the loop,
1511  *          otherwise @c false to break out of the loop
1512  * @see package_manager_res_event_info_foreach_path()
1513  */
1514 typedef bool (*package_manager_res_event_path_cb) (const char *path, package_manager_res_event_path_state_e state, void *user_data);
1515
1516 /**
1517  * @platform
1518  * @brief Retrieves all package information of installed packages.
1519  * @since_tizen 6.5
1520  * @privlevel platform
1521  * @privilege %http://tizen.org/privilege/packagemanager.admin
1522  * @param[in] handle    Resource event info handle
1523  * @param[in] callback  The callback function to be invoked
1524  * @param[in] user_data The user data to be passed to the callback function
1525  * @return @c 0 on success,
1526  *         otherwise a negative error value
1527  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
1528  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
1529  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
1530  * @post This function invokes package_manager_res_event_path_cb() repeatedly for each path state handled by resource event.
1531  * @see package_manager_res_event_path_cb()
1532  */
1533 int package_manager_res_event_info_foreach_path(package_manager_res_event_info_h handle, package_manager_res_event_path_cb callback, void *user_data);
1534
1535 /**
1536  * @platform
1537  * @brief Gets the privileged shared resource path for the given package ID.
1538  * @since_tizen 6.5
1539  * @privlevel platform
1540  * @privilege %http://tizen.org/privilege/packagemanager.admin
1541  * @remarks You must release @a path using free().
1542  * @param[in]  package_id       The ID of the package
1543  * @param[out] path                     The path of privileged shared resource path of the package
1544  * @return @c 0 on success,
1545  *         otherwise a negative error value
1546  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
1547  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
1548  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
1549  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
1550  */
1551 int package_manager_get_priv_shared_res_path(const char *package_id, char **path);
1552
1553
1554 /**
1555 * @}
1556 */
1557
1558 #ifdef __cplusplus
1559 }
1560 #endif
1561
1562 #endif /* __TIZEN_APPFW_PACKAGE_MANAGER_H */