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