b2b5e739489a741d9131d7d00a0181ea53ec5821
[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 Enumeration for error code.
76  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
77  */
78 typedef enum {
79         PACKAGE_MANAGER_ERROR_NONE = TIZEN_ERROR_NONE,                                /**< Successful */
80         PACKAGE_MANAGER_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER,      /**< Invalid parameter */
81         PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY,              /**< Out of memory */
82         PACKAGE_MANAGER_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR,                        /**< Internal I/O error */
83         PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE = TIZEN_ERROR_PACKAGE_MANAGER | 0x71,   /**< No such package */
84         PACKAGE_MANAGER_ERROR_SYSTEM_ERROR = TIZEN_ERROR_PACKAGE_MANAGER | 0x72,      /**< Severe system error */
85         PACKAGE_MANAGER_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED       /**< Permission denied */
86 } package_manager_error_e;
87
88
89 /**
90  * @brief Enumeration for event type.
91  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
92  */
93 typedef enum {
94         PACKAGE_MANAGER_EVENT_TYPE_INSTALL = 0,    /**< Install event type */
95         PACKAGE_MANAGER_EVENT_TYPE_UNINSTALL,      /**< Uninstall event type */
96         PACKAGE_MANAGER_EVENT_TYPE_UPDATE,         /**< Update event type */
97         PACKAGE_MANAGER_EVENT_TYPE_MOVE,           /**< Move event type (Since 3.0) */
98         PACKAGE_MANAGER_EVENT_TYPE_CLEAR,          /**< Clear event type (Since 3.0) */
99 } package_manager_event_type_e;
100
101
102 /**
103  * @brief Enumeration for event state.
104  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
105  */
106 typedef enum {
107         PACKAGE_MANAGER_EVENT_STATE_STARTED = 0,   /**< Started event state */
108         PACKAGE_MANAGER_EVENT_STATE_PROCESSING,    /**< Processing event state */
109         PACKAGE_MANAGER_EVENT_STATE_COMPLETED,     /**< Completed event state */
110         PACKAGE_MANAGER_EVENT_STATE_FAILED,        /**< Failed event state */
111 } package_manager_event_state_e;
112
113
114 /**
115  * @brief Enumeration for move type.
116  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
117  */
118 typedef enum {
119         PACKAGE_MANAGER_REQUEST_MOVE_TO_INTERNAL = 0,    /**< Internal type */
120         PACKAGE_MANAGER_REQUEST_MOVE_TO_EXTERNAL,        /**< External type */
121         PACKAGE_MANAGER_REQUEST_MOVE_TO_EXTENDED,        /**< Extended type (Since 5.0) */
122 } package_manager_move_type_e;
123
124
125 /**
126  * @brief Enumeration for certification compare type.
127  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
128  */
129 typedef enum {
130         PACKAGE_MANAGER_COMPARE_MATCH = 0,      /**< Matching certification */
131         PACKAGE_MANAGER_COMPARE_MISMATCH,       /**< Mismatching certification */
132         PACKAGE_MANAGER_COMPARE_LHS_NO_CERT,    /**< First package has no certification */
133         PACKAGE_MANAGER_COMPARE_RHS_NO_CERT,    /**< Second package has no certification */
134         PACKAGE_MANAGER_COMPARE_BOTH_NO_CERT,   /**< Both have no certification */
135 } package_manager_compare_result_type_e;
136
137
138 /**
139  * @brief Enumeration for permission type.
140  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
141  */
142 typedef enum {
143         PACKAGE_MANAGER_PERMISSION_NORMAL = 0,    /**< Normal permission */
144         PACKAGE_MANAGER_PERMISSION_SIGNATURE,     /**< Signature permission */
145         PACKAGE_MANAGER_PERMISSION_PRIVILEGE,     /**< Privilege permission */
146 } package_manager_permission_type_e;
147
148
149 /**
150  * @brief Enumeration for status type.
151  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
152  */
153 typedef enum {
154         PACKAGE_MANAGER_STATUS_TYPE_ALL = 0x00,               /**< All status */
155         PACKAGE_MANAGER_STATUS_TYPE_INSTALL = 0x01,           /**< Install package status */
156         PACKAGE_MANAGER_STATUS_TYPE_UNINSTALL = 0x02,         /**< Uninstall package status */
157         PACKAGE_MANAGER_STATUS_TYPE_UPGRADE = 0x04,           /**< Upgrade package status */
158         PACKAGE_MANAGER_STATUS_TYPE_MOVE = 0x08,              /**< Move package status */
159         PACKAGE_MANAGER_STATUS_TYPE_CLEAR_DATA = 0x10,        /**< Clear data status */
160         PACKAGE_MANAGER_STATUS_TYPE_INSTALL_PROGRESS = 0x20,  /**< Install progress status */
161         PACKAGE_MANAGER_STATUS_TYPE_GET_SIZE = 0x40,          /**< Get size status */
162 } package_manager_status_type_e;
163
164 /**
165  * @brief The Package manager update info request handle.
166  * @since_tizen 4.0
167  */
168 typedef struct package_updateinfo_request_s *package_updateinfo_request_h;
169
170 /**
171  * @brief The Package manager handle.
172  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
173  */
174 typedef struct package_manager_s *package_manager_h;
175
176
177 /**
178  * @brief Package manager filter handle.
179  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
180  */
181 typedef struct package_manager_filter_s *package_manager_filter_h;
182
183
184 /**
185  * @brief Called when the package is installed, uninstalled, or updated, and the progress of the request to the package manager changes.
186  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
187  * @param[in] type The type of the package to be installed, uninstalled, or updated
188  * @param[in] package The name of the package to be installed, uninstalled, or updated
189  * @param[in] event_type The type of the request to the package manager
190  * @param[in] event_state The current state of the request to the package manager
191  * @param[in] progress    The progress for the request that is being processed by the package manager \n
192  *                        The range of progress is from @c 0 to @c 100
193  * @param[in] error       The error code when the package manager failed to process the request
194  * @param[in] user_data   The user data passed from package_manager_set_event_cb()
195  * @see package_manager_set_event_cb()
196  * @see package_manager_unset_event_cb()
197  */
198 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);
199
200
201 /**
202  * @brief Creates a package manager handle.
203  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
204  * @privlevel public
205  * @privilege %http://tizen.org/privilege/packagemanager.info
206  * @remarks You must release @a manager using package_manager_destroy().
207  * @param[out] manager The package manager handle that is newly created on success
208  * @return @c 0 on success,
209  *         otherwise a negative error value
210  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
211  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
212  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
213  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
214  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          Internal I/O error
215  * @see package_manager_destroy()
216  */
217 int package_manager_create(package_manager_h *manager);
218
219
220 /**
221  * @brief Destroys the package manager handle.
222  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
223  * @param[in] manager The package manager handle
224  * @return @c 0 on success,
225  *         otherwise a negative error value
226  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
227  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
228  * @see package_manager_create()
229  */
230 int package_manager_destroy(package_manager_h manager);
231
232
233 /**
234  * @brief Sets the event status of the package when the package is installed, uninstalled, or updated.
235  * @details You can combine multiple status using OR operation which you want to listen.
236  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
237  * @param[in] manager     The package manager handle
238  * @param[in] status_type The status of the package
239  * @return @c 0 on success,
240  *         otherwise a negative error value
241  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
242  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
243  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          Internal I/O error
244  * @see package_manager_status_type_e
245  * @see package_manager_set_event_cb()
246  */
247 int package_manager_set_event_status(package_manager_h manager, int status_type);
248
249
250 /**
251  * @brief Registers a callback function to be invoked when the package is installed, uninstalled, or updated.
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  * @param[in] manager    The package manager handle
256  * @param[in] callback   The callback function to be registered
257  * @param[in] user_data  The user data to be passed to the callback function
258  * @return @c 0 on success,
259  *         otherwise a negative error value
260  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
261  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
262  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
263  * @post package_manager_event_cb() will be invoked.
264  * @see package_manager_set_event_status()
265  * @see package_manager_event_cb()
266  * @see package_manager_unset_event_cb()
267  */
268 int package_manager_set_event_cb(package_manager_h manager, package_manager_event_cb callback, void *user_data);
269
270
271 /**
272  * @brief Unregisters the callback function.
273  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
274  * @param[in] manager The package manager handle
275  * @return @c 0 on success,
276  *         otherwise a negative error value
277  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
278  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
279  * @see package_manager_event_cb()
280  * @see package_manager_set_event_cb()
281  */
282 int package_manager_unset_event_cb(package_manager_h manager);
283
284
285 /**
286  * @brief Called to retrieve all packages.
287  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
288  * @param[in] package_info The package information
289  * @param[in] user_data    The user data passed from the foreach function
290  * @return  @c true to continue with the next iteration of the loop,
291  *          otherwise @c false to break out of the loop
292  * @see package_manager_foreach_package_info()
293  */
294 typedef bool (*package_manager_package_info_cb) (package_info_h package_info, void *user_data);
295
296
297 /**
298  * @brief Retrieves all package information of installed packages.
299  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
300  * @privlevel public
301  * @privilege %http://tizen.org/privilege/packagemanager.info
302  * @param[in] callback  The callback function to be invoked
303  * @param[in] user_data The user data to be passed to the callback function
304  * @return @c 0 on success,
305  *         otherwise a negative error value
306  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
307  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
308  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
309  * @post This function invokes package_manager_package_info_cb() repeatedly for each package information.
310  * @see package_manager_package_info_cb()
311  */
312 int package_manager_foreach_package_info(package_manager_package_info_cb callback, void *user_data);
313
314
315 /**
316  * @brief Gets the package ID for the given app ID.
317  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
318  * @privlevel public
319  * @privilege %http://tizen.org/privilege/packagemanager.info
320  * @remarks The @a package_id should be released using free().
321  * @param[in]  app_id     The ID of the application
322  * @param[out] package_id The ID of the package
323  * @return @c 0 on success,
324  *         otherwise a negative error value
325  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
326  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
327  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
328  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
329  */
330 int package_manager_get_package_id_by_app_id(const char *app_id, char **package_id);
331
332
333 /**
334  * @brief Gets the package information for the given package.
335  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
336  * @privlevel public
337  * @privilege %http://tizen.org/privilege/packagemanager.info
338  * @remarks You must release @a package_info using package_info_destroy().
339  * @param[in]  package_id   The ID of the package
340  * @param[out] package_info The package information for the given package ID
341  * @return @c 0 on success,
342  *         otherwise a negative error value
343  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
344  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
345  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
346  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
347  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR Database error occurred
348  */
349 int package_manager_get_package_info(const char *package_id, package_info_h *package_info);
350
351
352 /**
353  * @brief Compares whether two package certifications are matched.
354  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
355  * @param[in]  lhs_package_id The first package ID to compare
356  * @param[in]  rhs_package_id The second package ID to compare
357  * @param[out] compare_result @c 0 if the certification information are matched,
358  *                            otherwise the compared result
359  * @return @c 0 on success,
360  *         otherwise a negative error value
361  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
362  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
363  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
364  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          Database error occurred
365  */
366 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);
367
368
369 /**
370  * @brief Compares whether two app certifications are matched.
371  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
372  * @param[in]  lhs_app_id     The first app ID to compare
373  * @param[in]  rhs_app_id     The second app ID to compare
374  * @param[out] compare_result @c 0 if the certification information are matched,
375  *                            otherwise the compared result
376  * @return @c 0 on success,
377  *         otherwise a negative error value
378  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
379  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
380  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
381  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          Database error occurred
382  */
383 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);
384
385
386 /**
387  * @brief Checks whether the package is preloaded by @a 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  * @param[in]  app_id   The ID of the application
392  * @param[out] preload  The preload info of the package
393  * @return @c 0 on success,
394  *         otherwise a negative error value
395  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
396  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
397  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
398  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
399  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          I/O error
400  */
401 int package_manager_is_preload_package_by_app_id(const char *app_id, bool *preload);
402
403
404 /**
405  * @brief Gets the package permission type by @a app_id.
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  * @param[in]  app_id          The ID of the application
410  * @param[out] permission_type The package permission type
411  * @return @c 0 on success,
412  *         otherwise a negative error value
413  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
414  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
415  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
416  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
417  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          I/O error
418  */
419 int package_manager_get_permission_type(const char *app_id, package_manager_permission_type_e *permission_type);
420
421
422 /**
423  * @brief Clears the application's internal and external cache directory, asynchronously.
424  * @details All files stored in the cache directory of the application specified with the package ID are removed.
425  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
426  * @privlevel public
427  * @privilege %http://tizen.org/privilege/packagemanager.clearcache
428  * @param[in] package_id  The package ID
429  * @return @c 0 on success,
430  *         otherwise a negative error value
431  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
432  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
433  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
434  * @retval #PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE   No such package
435  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
436  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          I/O error
437  * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR      Severe system error
438  */
439 int package_manager_clear_cache_dir(const char *package_id);
440
441 /**
442  * @platform
443  * @brief  Clears all applications' internal and external cache directory, asynchronously.
444  * @details All files stored in the cache directory of each application are removed.
445  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
446  * @privlevel platform
447  * @privilege %http://tizen.org/privilege/packagemanager.admin
448  * @return @c 0 on success,
449  *         otherwise a negative error value
450  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
451  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
452  * @retval #PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE   No such package
453  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
454  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          I/O error
455  * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR      Severe system error
456  */
457 int package_manager_clear_all_cache_dir(void);
458
459 /**
460  * @platform
461  * @brief Clears internal and external data directories used by applications in the given package.
462  * @details All files stored in data directories used by applications in the package specified with the @a package_id are removed.
463  * @since_tizen 4.0
464  * @privlevel platform
465  * @privilege %http://tizen.org/privilege/packagemanager.admin
466  * @param[in] package_id  The package ID
467  * @return @c 0 on success,
468  *         otherwise a negative error value
469  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
470  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
471  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
472  * @retval #PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE   No such package
473  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
474  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          I/O error
475  * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR      Severe system error
476  */
477 int package_manager_clear_data_dir(const char *package_id);
478
479
480 /**
481  * @brief The package size information handle.
482  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
483  */
484 typedef struct package_size_info *package_size_info_h;
485
486
487 /**
488  * @brief Called when the package size information is obtained.
489  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
490  * @param[in] package_id  The package ID
491  * @param[in] size_info   The pointer to the structure including the package size information
492  * @param[in] user_data   The user data to be passed to the callback function
493  */
494 typedef void (*package_manager_size_info_receive_cb)(const char *package_id, const package_size_info_h size_info, void *user_data);
495
496
497 /**
498  * @platform
499  * @brief Called when the total package size information is obtained.
500  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
501  * @param[in] size_info  The pointer to the structure including the package size information
502  * @param[in] user_data  The user data to be passed to the callback function
503  */
504 typedef void (*package_manager_total_size_info_receive_cb)(const package_size_info_h size_info, void *user_data);
505
506
507 /**
508  * @brief Gets the package size information, asynchronously.
509  * @details The package size info is asynchronously obtained by the callback function.
510  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
511  * @privlevel public
512  * @privilege %http://tizen.org/privilege/packagemanager.info
513  * @param[in] package_id  The package ID
514  * @param[in] callback    The asynchronous callback function to get the package size information
515  * @param[in] user_data   The user data to be passed to the callback function
516  * @return @c 0 on success,
517  *         otherwise a negative error value
518  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
519  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
520  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
521  * @retval #PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE   No such package
522  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
523  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          I/O error
524  * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR      Severe system error
525  */
526 int package_manager_get_package_size_info(const char *package_id, package_manager_size_info_receive_cb callback, void *user_data);
527
528
529 /**
530  * @brief Gets the total package size information, asynchronously.
531  * @details The total package size info is asynchronously obtained by the callback function.
532  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
533  * @privlevel public
534  * @privilege %http://tizen.org/privilege/packagemanager.info
535  * @param[in] callback  The asynchronous callback function to get the total package size information
536  * @param[in] user_data The user data to be passed to the callback function
537  * @return @c 0 on success,
538  *         otherwise a negative error value
539  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
540  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
541  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
542  * @retval #PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE   No such package
543  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
544  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          I/O error
545  * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR      Severe system error
546  */
547 int package_manager_get_total_package_size_info(package_manager_total_size_info_receive_cb callback, void *user_data);
548
549
550 /**
551  * @brief Creates the package information filter handle from db.
552  * @details The filtered result will be based on AND operation of all added filter properties.
553  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
554  * @privlevel public
555  * @privilege %http://tizen.org/privilege/packagemanager.info
556  * @remarks The @a handle should be released using package_manager_filter_destroy().
557  * @param[out] handle Pointer to the package info filter handle
558  * @return @c 0 on success,
559  *         otherwise a negative error value
560  * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
561  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
562  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
563  * @post package_manager_filter_destroy()
564  * @see package_manager_filter_add_bool()
565  * @see package_manager_filter_foreach_pkginfo()
566  */
567 int package_manager_filter_create(package_manager_filter_h *handle);
568
569
570 /**
571  * @brief Destroys the package information filter handle freeing up all the resources.
572  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
573  * @param[in] handle Pointer to the package info filter handle
574  * @return @c 0 on success,
575  *         otherwise a negative error value
576  * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
577  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
578  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
579  * @pre package_manager_filter_create()
580  * @see package_manager_filter_count()
581  * @see package_manager_filter_foreach_package_info()
582  */
583 int package_manager_filter_destroy(package_manager_filter_h handle);
584
585
586 /**
587  * @brief Adds a boolean filter property to the filter handle.
588  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
589  * @param[in] handle Pointer to the package info filter handle
590  * @param[in] property boolean property name
591  * @param[in] value value corresponding to the property
592  * @return @c 0 on success,
593  *         otherwise a negative error value
594  * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
595  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
596  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
597  * @pre package_manager_filter_create()
598  * @post package_manager_filter_destroy()
599  * @see package_manager_filter_count()
600  * @see package_manager_filter_foreach_package_info()
601  */
602 int package_manager_filter_add_bool(package_manager_filter_h handle, const char *property, const bool value);
603
604
605 /**
606  * @brief Counts the package that satisfy the filter conditions.
607  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
608  * @privlevel public
609  * @privilege %http://tizen.org/privilege/packagemanager.info
610  * @param[in] handle Pointer to the package info filter handle
611  * @param[out] count Pointer to store the count value
612  * @return @c 0 on success,
613  *         otherwise a negative error value
614  * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
615  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
616  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
617  * @pre package_manager_filter_create()
618  * @post package_manager_filter_destroy()
619  * @see package_manager_filter_foreach_package_info()
620  */
621 int package_manager_filter_count(package_manager_filter_h handle, int *count);
622
623
624 /**
625  * @brief Executes the user supplied callback function for each package that satisfy the filter conditions.
626  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
627  * @privlevel public
628  * @privilege %http://tizen.org/privilege/packagemanager.info
629  * @param[in] handle Pointer to the package info filter handle
630  * @param[in] callback callback function
631  * @param[in] user_data user data to be passed to the callback function
632  * @return @c 0 on success,
633  *         otherwise a negative error value
634  * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
635  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
636  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
637  * @pre package_manager_filter_create()
638  * @post package_manager_filter_destroy()
639  * @post This function invokes package_manager_package_info_cb() repeatedly for each package information.
640  * @see package_manager_package_info_cb()
641  * @see package_manager_filter_count()
642  */
643 int package_manager_filter_foreach_package_info(package_manager_filter_h handle, package_manager_package_info_cb callback, void *user_data);
644
645
646 /**
647  * @platform
648  * @brief Generates request for getting License, asynchronously.
649  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
650  * @privlevel platform
651  * @privilege %http://tizen.org/privilege/packagemanager.admin
652  * @remarks You must release @a req_data and @a license_url by yourself.
653  * @param[in] resp_data The response data string of the purchase request
654  * @param[out] req_data License request data
655  * @param[out] license_url License acquisition url data
656  * @return @c 0 on success,
657  *         otherwise a negative error value
658  * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
659  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
660  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
661  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
662  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR Internal I/O error
663  * @post package_manager_drm_register_license()
664  */
665 int package_manager_drm_generate_license_request(const char *resp_data, char **req_data, char **license_url);
666
667
668 /**
669  * @platform
670  * @brief Registers encrypted license, asynchronously.
671  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
672  * @privlevel platform
673  * @privilege %http://tizen.org/privilege/packagemanager.admin
674  * @param[in] resp_data The response data string of the rights request
675  * @return @c 0 on success,
676  *         otherwise a negative error value
677  * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
678  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
679  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
680  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR Internal I/O error
681  * @pre package_manager_drm_generate_license_request()
682  */
683 int package_manager_drm_register_license(const char *resp_data);
684
685 /**
686  * @platform
687  * @brief Decrypts contents which is encrypted, asynchronously.
688  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
689  * @privlevel platform
690  * @privilege %http://tizen.org/privilege/packagemanager.admin
691  * @param[in] drm_file_path DRM file path
692  * @param[in] decrypted_file_path Decrypted file path
693  * @return @c 0 on success,
694  *         otherwise a negative error value
695  * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
696  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
697  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
698  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR Internal I/O error
699  */
700 int package_manager_drm_decrypt_package(const char *drm_file_path, const char *decrypted_file_path);
701
702
703 /**
704  * @brief Retrieves data size from given handle.
705  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
706  * @param[in] handle Package size info handle
707  * @param[out] data_size Data size will be returned
708  * @return @c 0 on success,
709  *         otherwise a negative error value
710  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
711  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
712  */
713 int package_size_info_get_data_size(package_size_info_h handle, long long *data_size);
714
715
716 /**
717  * @brief Retrieves cache size from given handle.
718  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
719  * @param[in] handle  Package size info handle
720  * @param[out] cache_size Cache size will be returned
721  * @return @c 0 on success,
722  *         otherwise a negative error value
723  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
724  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
725  */
726 int package_size_info_get_cache_size(package_size_info_h handle, long long *cache_size);
727
728
729 /**
730  * @brief Retrieves application size from given handle.
731  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
732  * @param[in] handle Package size info handle
733  * @param[out] app_size App size will be returned
734  * @return @c 0 on success,
735  *         otherwise a negative error value
736  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
737  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
738  */
739 int package_size_info_get_app_size(package_size_info_h handle, long long *app_size);
740
741
742 /**
743  * @brief Retrieves external data size from given handle.
744  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
745  * @param[in] handle  Package size info handle
746  * @param[out] ext_data_size External data size will be returned
747  * @return @c 0 on success,
748  *         otherwise a negative error value
749  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
750  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
751  */
752 int package_size_info_get_external_data_size(package_size_info_h handle, long long *ext_data_size);
753
754
755 /**
756  * @brief Retrieves external cache size from given handle.
757  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
758  * @param[in] handle Package size info handle
759  * @param[out] ext_cache_size External cache size will be returned
760  * @return @c 0 on success,
761  *         otherwise a negative error value
762  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
763  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
764  */
765 int package_size_info_get_external_cache_size(package_size_info_h handle, long long *ext_cache_size);
766
767
768 /**
769  * @brief Retrieves external application size from given handle.
770  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
771  * @param[in] handle Package size info handle
772  * @param[out] ext_app_size External app size will be returned
773  * @return @c 0 on success,
774  *         otherwise a negative error value
775  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
776  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
777  */
778 int package_size_info_get_external_app_size(package_size_info_h handle, long long *ext_app_size);
779
780
781 /**
782 * @}
783 */
784
785 /**
786  * @addtogroup CAPI_PACKAGE_REQUEST_MODULE
787  * @{
788  */
789
790
791 /**
792  * @platform
793  * @brief Enumeration for request mode.
794  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
795  */
796 typedef enum {
797         PACKAGE_MANAGER_REQUEST_MODE_DEFAULT = 0,    /**< @platform Default request mode */
798         PACKAGE_MANAGER_REQUEST_MODE_QUIET,          /**< @platform Quiet request mode */
799 } package_manager_request_mode_e;
800
801
802 /**
803  * @platform
804  * @brief The Package manager request handle.
805  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
806  */
807 typedef struct package_manager_request_s *package_manager_request_h;
808
809
810 /**
811  * @platform
812  * @brief Called when the progress of the request to the package manager changes.
813  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
814  * @param[in] id          The ID of the request to the package manager
815  * @param[in] type        The type of the package to install, uninstall or update
816  * @param[in] package     The name of the package to install, uninstall or update
817  * @param[in] event_type  The type of the request to the package manager
818  * @param[in] event_state The current state of the request to the package manager
819  * @param[in] progress    The progress for the request that is being processed by the package manager \n
820  *                        The range of progress is from @c 0 to @c 100.
821  * @param[in] error       The error code when the package manager failed to process the request
822  * @param[in] user_data   The user data passed from package_manager_request_set_event_cb()
823  * @see package_manager_request_set_event_cb()
824  * @see package_manager_request_unset_event_cb()
825  */
826 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);
827
828
829 /**
830  * @platform
831  * @brief Creates a request handle to the package manager.
832  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
833  * @remarks You must release @a request using package_manager_request_destroy().
834  * @param[out] request The request handle that is newly created on success
835  * @return @c 0 on success,
836  *         otherwise a negative error value
837  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
838  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
839  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
840  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          Internal I/O error
841  * @see package_manager_request_destroy()
842  */
843 int package_manager_request_create(package_manager_request_h *request);
844
845
846 /**
847  * @platform
848  * @brief Destroys the request handle to the package manager.
849  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
850  * @param[in] request The request handle to the package manager
851  * @return @c 0 on success,
852  *         otherwise a negative error value
853  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
854  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
855  * @see package_manager_request_create()
856  */
857 int package_manager_request_destroy(package_manager_request_h request);
858
859
860 /**
861  * @platform
862  * @brief Registers a callback function to be invoked when the progress of the request changes.
863  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
864  * @privlevel public
865  * @privilege %http://tizen.org/privilege/packagemanager.info
866  * @param[in] request The request handle
867  * @param[in] callback The callback function to be registered
868  * @param[in] user_data The user data to be passed to the callback function
869  * @return @c 0 on success,
870  *         otherwise a negative error value
871  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
872  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
873  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
874  * @post package_manager_request_event_cb() will be invoked.
875  * @see package_manager_request_event_cb()
876  * @see package_manager_request_unset_event_cb()
877  */
878 int package_manager_request_set_event_cb(package_manager_request_h request, package_manager_request_event_cb callback, void *user_data);
879
880
881 /**
882  * @platform
883  * @brief Unregisters the callback function.
884  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
885  * @param[in] request The request handle
886  * @return @c 0 on success,
887  *         otherwise a negative error value
888  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
889  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
890  * @see package_manager_request_event_cb()
891  * @see package_manager_request_set_event_cb()
892  */
893 int package_manager_request_unset_event_cb(package_manager_request_h request);
894
895
896 /**
897  * @platform
898  * @brief Sets the type of the package to install, uninstall, or update.
899  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
900  * @param[in] request The request handle
901  * @param[in] type    The type of the package
902  * @return @c 0 on success,
903  *         otherwise a negative error value
904  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
905  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
906  */
907 int package_manager_request_set_type(package_manager_request_h request, const char *type);
908
909
910 /**
911  * @platform
912  * @brief Sets the mode of the request.
913  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
914  * @param[in] request The request handle
915  * @param[in] mode    The mode of the request
916  * @return @c 0 on success,
917  *         otherwise a negative error value
918  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
919  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
920  */
921 int package_manager_request_set_mode(package_manager_request_h request, package_manager_request_mode_e mode);
922
923
924 /**
925  * @platform
926  * @brief Sets the path of TEP file to the request. The TEP file that is set will be installed when the package is installed.
927  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
928  * @privlevel platform
929  * @privilege %http://tizen.org/privilege/packagemanager.admin
930  * @param[in] request The request handle
931  * @param[in] tep_path The TEP path to set. If this is NULL on update, installed TEP will be removed.
932  * @return @c 0 on success,
933  *         otherwise a negative error value
934  * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
935  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
936  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
937  * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR           Severe system error
938  */
939 int package_manager_request_set_tep(package_manager_request_h request, const char *tep_path);
940
941
942 /**
943  * @platform
944  * @brief Installs the package located at the given path, asynchronously.
945  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
946  * @privlevel platform
947  * @privilege %http://tizen.org/privilege/packagemanager.admin
948  * @param[in]  request The request handle
949  * @param[in]  path    The absolute path to the package to be installed
950  * @param[out] id      The ID of the request to the package manager
951  * @return @c 0 on success,
952  *         otherwise a negative error value
953  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
954  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
955  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
956  * @see package_manager_request_uninstall()
957  */
958 int package_manager_request_install(package_manager_request_h request, const char *path, int *id);
959
960
961 /**
962  * @platform
963  * @brief Installs the package located at the given path, asynchronously.
964  * @details The progress of the request is asynchronously received by the callback function.
965  *          The @a callback is the individual callback only called for the current API call.
966  *          The @a callback is the only callback called, even if another callback was set for this request
967  *          with package_manager_request_set_event_cb().
968  * @since_tizen 4.0
969  * @privlevel platform
970  * @privilege %http://tizen.org/privilege/packagemanager.admin
971  * @param[in]  request   The request handle
972  * @param[in]  path      The absolute path to the package to be installed
973  * @param[in]  callback  The callback function to be invoked
974  * @param[in]  user_data The user data to be passed to the callback function
975  * @param[out] id        The ID of the request to the package manager
976  * @return @c 0 on success,
977  *         otherwise a negative error value
978  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
979  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
980  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
981  */
982 int package_manager_request_install_with_cb(package_manager_request_h request,
983                                                 const char *path,
984                                                 package_manager_request_event_cb callback,
985                                                 void *user_data,
986                                                 int *id);
987
988
989 /**
990  * @platform
991  * @brief Uninstalls the package with the given name, asynchronously.
992  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
993  * @privlevel platform
994  * @privilege %http://tizen.org/privilege/packagemanager.admin
995  * @param[in]  request The request handle
996  * @param[in]  name    The name of the package to be uninstalled
997  * @param[out] id      The ID of the request to the package manager
998  * @return @c 0 on success,
999  *         otherwise a negative error value
1000  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
1001  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
1002  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
1003  */
1004 int package_manager_request_uninstall(package_manager_request_h request, const char *name, int *id);
1005
1006
1007 /**
1008  * @platform
1009  * @brief Uninstalls the package with the given name, asynchronously.
1010  * @details The progress of the request is asynchronously received by the callback function.
1011  *          The @a callback is the individual callback only called for the current API call.
1012  *          The @a callback is the only callback called, even if another callback was set for this request
1013  *          with package_manager_request_set_event_cb().
1014  * @since_tizen 4.0
1015  * @privlevel platform
1016  * @privilege %http://tizen.org/privilege/packagemanager.admin
1017  * @param[in]  request   The request handle
1018  * @param[in]  name      The name of the package to be uninstalled
1019  * @param[in]  callback  The callback function to be invoked
1020  * @param[in]  user_data The user data to be passed to the callback function
1021  * @param[out] id        The ID of the request to the package manager
1022  * @return @c 0 on success,
1023  *         otherwise a negative error value
1024  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
1025  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
1026  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
1027  */
1028 int package_manager_request_uninstall_with_cb(package_manager_request_h request,
1029                                                 const char *name,
1030                                                 package_manager_request_event_cb callback,
1031                                                 void *user_data,
1032                                                 int *id);
1033
1034
1035 /**
1036  * @platform
1037  * @brief Moves the package from SD card to the internal memory and vice versa, asynchronously.
1038  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1039  * @privlevel platform
1040  * @privilege %http://tizen.org/privilege/packagemanager.admin
1041  * @param[in] request   The request handle
1042  * @param[in] name      The name of the package to be moved
1043  * @param[in] move_type The move type [#enum package_manager_move_type_e], [external to internal/internal to external]
1044  * @return @c 0 on success,
1045  *         otherwise a negative error value
1046  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
1047  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
1048  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
1049  */
1050 int package_manager_request_move(package_manager_request_h request, const char *name, package_manager_move_type_e move_type);
1051
1052
1053 /**
1054  * @platform
1055  * @brief Moves the package from SD card to the internal memory and vice versa, asynchronously.
1056  * @details The progress of the request is asynchronously received by the callback function.
1057  *          The @a callback is the individual callback only called for the current API call.
1058  *          The @a callback is the only callback called, even if another callback was set for this request
1059  *          with package_manager_request_set_event_cb().
1060  * @since_tizen 4.0
1061  * @privlevel platform
1062  * @privilege %http://tizen.org/privilege/packagemanager.admin
1063  * @param[in]  request   The request handle
1064  * @param[in]  name      The name of the package to be moved
1065  * @param[in]  move_type The move type [#enum package_manager_move_type_e], [external to internal/internal to external]
1066  * @param[in]  callback  The callback function to be invoked
1067  * @param[in]  user_data The user data to be passed to the callback function
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  */
1075 int package_manager_request_move_with_cb(package_manager_request_h request,
1076                                                 const char *name,
1077                                                 package_manager_move_type_e move_type,
1078                                                 package_manager_request_event_cb callback,
1079                                                 void *user_data,
1080                                                 int *id);
1081
1082 /**
1083  * @platform
1084  * @brief Creates a package update info request.
1085  * @since_tizen 4.0
1086  * @privlevel platform
1087  * @privilege %http://tizen.org/privilege/packagemanager.admin
1088  * @remarks You must release @a pkg_updateinfo_req using package_manager_updateinfo_request_destroy().
1089  * @param[out] pkg_updateinfo_req The package update info request handle that is newly created on success
1090  * @return @c 0 on success,
1091  *         otherwise a negative error value
1092  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
1093  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
1094  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
1095  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
1096  * @see package_manager_updateinfo_request_destroy()
1097  */
1098 int package_manager_updateinfo_request_create(package_updateinfo_request_h *pkg_updateinfo_req);
1099
1100 /**
1101  * @brief Sets the package ID to the package update info request.
1102  * @since_tizen 4.0
1103  * @param[in] pkg_updateinfo_req   The update info request handle
1104  * @param[in] pkgid                The package ID
1105  * @return @c 0 on success,
1106  *         otherwise a negative error value
1107  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
1108  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
1109  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
1110  * @see package_manager_updateinfo_request_create()
1111  */
1112 int package_manager_updateinfo_set_pkgid(package_updateinfo_request_h pkg_updateinfo_req, const char *pkgid);
1113
1114 /**
1115  * @brief Sets the package version to the package update info request.
1116  * @since_tizen 4.0
1117  * @param[in] pkg_updateinfo_req   The update info request handle
1118  * @param[in] version              The package version
1119  * @return @c 0 on success,
1120  *         otherwise a negative error value
1121  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
1122  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
1123  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
1124  * @see package_manager_updateinfo_request_create()
1125  */
1126 int package_manager_updateinfo_set_version(package_updateinfo_request_h pkg_updateinfo_req, const char *version);
1127
1128 /**
1129  * @brief Sets the package update type to the package update info request.
1130  * @since_tizen 4.0
1131  * @param[in] pkg_updateinfo_req   The update info request handle
1132  * @param[in] type                 The package update type
1133  * @return @c 0 on success,
1134  *         otherwise a negative error value
1135  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
1136  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
1137  * @see package_manager_updateinfo_request_create()
1138  * @see package_updateinfo_type_e
1139  */
1140 int package_manager_updateinfo_set_type(package_updateinfo_request_h pkg_updateinfo_req, package_updateinfo_type_e type);
1141
1142 /**
1143  * @brief Requests to register package update info in platform.
1144  * @since_tizen 4.0
1145  * @param[in] pkg_updateinfo_req    The update info request handle
1146  * @return @c 0 on success,
1147  *         otherwise a negative error value
1148  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
1149  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
1150  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          I/O error
1151  * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR      Severe system error
1152  * @see package_manager_updateinfo_request_create()
1153  * @see package_manager_updateinfo_request_destroy()
1154  */
1155 int package_manager_updateinfo_request_register(package_updateinfo_request_h pkg_updateinfo_req);
1156
1157 /**
1158  * @brief Destroys the package update info request.
1159  * @since_tizen 4.0
1160  * @param[in] pkg_updateinfo_req    The update info request handle
1161  * @return @c 0 on success,
1162  *         otherwise a negative error value
1163  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
1164  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
1165  * @see package_manager_updateinfo_request_create()
1166  */
1167 int package_manager_updateinfo_request_destroy(package_updateinfo_request_h pkg_updateinfo_req);
1168
1169 /**
1170  * @brief Requests to unregister update info in platform for given package id.
1171  * @since_tizen 4.0
1172  * @param[in] pkg_updateinfo_req   The update info request handle
1173  * @param[in] pkgid                The package id to request unregister update info
1174  * @return @c 0 on success,
1175  *         otherwise a negative error value
1176  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
1177  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
1178  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          I/O error
1179  * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR      Severe system error
1180  */
1181 int package_manager_updateinfo_request_unregister(package_updateinfo_request_h pkg_updateinfo_req, const char *pkgid);
1182
1183 /**
1184  * @brief Request to unregister update info of all packages in platform.
1185  * @since_tizen 4.0
1186  * @param[in] pkg_updateinfo_req    The update info request handle
1187  * @return @c 0 on success,
1188  *         otherwise a negative error value
1189  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
1190  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
1191  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          I/O error
1192  * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR      Severe system error
1193  */
1194 int package_manager_updateinfo_request_unregister_all(package_updateinfo_request_h pkg_updateinfo_req);
1195
1196
1197 /**
1198 * @}
1199 */
1200
1201 #ifdef __cplusplus
1202 }
1203 #endif
1204
1205 #endif /* __TIZEN_APPFW_PACKAGE_MANAGER_H */