5082960f49d7c01cead26d99fdcbaced628b9ca0
[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_INVALID_PARAMETER Invalid parameter
212  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
213  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          Internal I/O error
214  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
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_INVALID_PARAMETER Invalid parameter
262  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
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_INVALID_PARAMETER Invalid parameter
308  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
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  * @param[in]  app_id     The ID of the application
321  * @param[out] package_id The ID of the package
322  * @return @c 0 on success,
323  *         otherwise a negative error value
324  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
325  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
326  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
327  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
328  */
329 int package_manager_get_package_id_by_app_id(const char *app_id, char **package_id);
330
331
332 /**
333  * @brief Gets the package information for the given package.
334  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
335  * @privlevel public
336  * @privilege %http://tizen.org/privilege/packagemanager.info
337  * @remarks You must release @a package_info using package_info_destroy().
338  * @param[in]  package_id   The ID of the package
339  * @param[out] package_info The package information for the given package ID
340  * @return @c 0 on success,
341  *         otherwise a negative error value
342  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
343  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
344  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
345  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR Database error occurred
346  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
347  */
348 int package_manager_get_package_info(const char *package_id, package_info_h *package_info);
349
350
351 /**
352  * @brief Compares whether two package certifications are matched.
353  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
354  * @param[in]  lhs_package_id The first package ID to compare
355  * @param[in]  rhs_package_id The second package ID to compare
356  * @param[out] compare_result @c 0 if the certification information are matched,
357  *                            otherwise the compared result
358  * @return @c 0 on success,
359  *         otherwise a negative error value
360  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
361  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
362  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
363  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          Database error occurred
364  */
365 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);
366
367
368 /**
369  * @brief Compares whether two app certifications are matched.
370  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
371  * @param[in]  lhs_app_id     The first app ID to compare
372  * @param[in]  rhs_app_id     The second app ID to compare
373  * @param[out] compare_result @c 0 if the certification information are matched,
374  *                            otherwise the compared result
375  * @return @c 0 on success,
376  *         otherwise a negative error value
377  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
378  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
379  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
380  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          Database error occurred
381  */
382 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);
383
384
385 /**
386  * @brief Checks whether the package is preloaded by @a app_id.
387  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
388  * @privlevel public
389  * @privilege %http://tizen.org/privilege/packagemanager.info
390  * @param[in]  app_id   The ID of the application
391  * @param[out] preload  The preload info of the package
392  * @return @c 0 on success,
393  *         otherwise a negative error value
394  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
395  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
396  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
397  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          I/O error
398  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
399  */
400 int package_manager_is_preload_package_by_app_id(const char *app_id, bool *preload);
401
402
403 /**
404  * @brief Gets the package permission type by @a app_id.
405  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
406  * @privlevel public
407  * @privilege %http://tizen.org/privilege/packagemanager.info
408  * @param[in]  app_id          The ID of the application
409  * @param[out] permission_type The package permission type
410  * @return @c 0 on success,
411  *         otherwise a negative error value
412  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
413  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
414  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
415  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          I/O error
416  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
417  */
418 int package_manager_get_permission_type(const char *app_id, package_manager_permission_type_e *permission_type);
419
420
421 /**
422  * @brief Clears the application's internal and external cache directory, asynchronously.
423  * @details All files stored in the cache directory of the application specified with the package ID are removed.
424  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
425  * @privlevel public
426  * @privilege %http://tizen.org/privilege/packagemanager.clearcache
427  * @param[in] package_id  The package ID
428  * @return @c 0 on success,
429  *         otherwise a negative error value
430  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
431  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
432  * @retval #PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE   No such package
433  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
434  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
435  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          I/O error
436  * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR      Severe system error
437  */
438 int package_manager_clear_cache_dir(const char *package_id);
439
440 /**
441  * @platform
442  * @brief  Clears all applications' internal and external cache directory, asynchronously.
443  * @details All files stored in the cache directory of each application are removed.
444  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
445  * @privlevel platform
446  * @privilege %http://tizen.org/privilege/packagemanager.admin
447  * @return @c 0 on success,
448  *         otherwise a negative error value
449  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
450  * @retval #PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE   No such package
451  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
452  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
453  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          I/O error
454  * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR      Severe system error
455  */
456 int package_manager_clear_all_cache_dir(void);
457
458 /**
459  * @platform
460  * @brief Clears internal and external data directories used by applications in the given package.
461  * @details All files stored in data directories used by applications in the package specified with the @a package_id are removed.
462  * @since_tizen 4.0
463  * @privlevel platform
464  * @privilege %http://tizen.org/privilege/packagemanager.admin
465  * @param[in] package_id  The package ID
466  * @return @c 0 on success,
467  *         otherwise a negative error value
468  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
469  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
470  * @retval #PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE   No such package
471  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
472  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
473  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          I/O error
474  * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR      Severe system error
475  */
476 int package_manager_clear_data_dir(const char *package_id);
477
478
479 /**
480  * @brief The package size information handle.
481  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
482  */
483 typedef struct package_size_info *package_size_info_h;
484
485
486 /**
487  * @brief Called when the package size information is obtained.
488  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
489  * @param[in] package_id  The package ID
490  * @param[in] size_info   The pointer to the structure including the package size information
491  * @param[in] user_data   The user data to be passed to the callback function
492  */
493 typedef void (*package_manager_size_info_receive_cb)(const char *package_id, const package_size_info_h size_info, void *user_data);
494
495
496 /**
497  * @platform
498  * @brief Called when the total package size information is obtained.
499  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
500  * @param[in] size_info  The pointer to the structure including the package size information
501  * @param[in] user_data  The user data to be passed to the callback function
502  */
503 typedef void (*package_manager_total_size_info_receive_cb)(const package_size_info_h size_info, void *user_data);
504
505
506 /**
507  * @brief Gets the package size information, asynchronously.
508  * @details The package size info is asynchronously obtained by the callback function.
509  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
510  * @privlevel public
511  * @privilege %http://tizen.org/privilege/packagemanager.info
512  * @param[in] package_id  The package ID
513  * @param[in] callback    The asynchronous callback function to get the package size information
514  * @param[in] user_data   The user data to be passed to the callback function
515  * @return @c 0 on success,
516  *         otherwise a negative error value
517  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
518  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
519  * @retval #PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE   No such package
520  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
521  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
522  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          I/O error
523  * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR      Severe system error
524  */
525 int package_manager_get_package_size_info(const char *package_id, package_manager_size_info_receive_cb callback, void *user_data);
526
527
528 /**
529  * @brief Gets the total package size information, asynchronously.
530  * @details The total package size info is asynchronously obtained by the callback function.
531  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
532  * @privlevel public
533  * @privilege %http://tizen.org/privilege/packagemanager.info
534  * @param[in] callback  The asynchronous callback function to get the total package size information
535  * @param[in] user_data The user data to be passed to the callback function
536  * @return @c 0 on success,
537  *         otherwise a negative error value
538  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
539  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
540  * @retval #PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE   No such package
541  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
542  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
543  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          I/O error
544  * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR      Severe system error
545  */
546 int package_manager_get_total_package_size_info(package_manager_total_size_info_receive_cb callback, void *user_data);
547
548
549 /**
550  * @brief Creates the package information filter handle from db.
551  * @details The filtered result will be based on AND operation of all added filter properties.
552  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
553  * @privlevel public
554  * @privilege %http://tizen.org/privilege/packagemanager.info
555  * @param[out] handle Pointer to the package info filter handle
556  * @return @c 0 on success,
557  *         otherwise a negative error value
558  * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
559  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
560  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
561  * @post package_manager_filter_destroy()
562  * @see package_manager_filter_add_bool()
563  * @see package_manager_filter_foreach_pkginfo()
564  */
565 int package_manager_filter_create(package_manager_filter_h *handle);
566
567
568 /**
569  * @brief This API destroys the package information filter handle freeing up all the resources
570  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
571  * @param[in] handle Pointer to the package info filter handle
572  * @return @c 0 on success,
573  *         otherwise a negative error value
574  * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
575  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
576  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
577  * @pre package_manager_filter_create()
578  * @see package_manager_filter_count()
579  * @see package_manager_filter_foreach_package_info()
580  */
581 int package_manager_filter_destroy(package_manager_filter_h handle);
582
583
584 /**
585  * @brief This API adds a boolean filter property to the filter handle
586  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
587  * @param[in] handle Pointer to the package info filter handle
588  * @param[in] property boolean property name
589  * @param[in] value value corresponding to the property
590  * @return @c 0 on success,
591  *         otherwise a negative error value
592  * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
593  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
594  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
595  * @pre package_manager_filter_create()
596  * @post package_manager_filter_destroy()
597  * @see package_manager_filter_count()
598  * @see package_manager_filter_foreach_package_info()
599  */
600 int package_manager_filter_add_bool(package_manager_filter_h handle, const char *property, const bool value);
601
602
603 /**
604  * @brief This API counts the package that satisfy the filter conditions
605  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
606  * @privlevel public
607  * @privilege %http://tizen.org/privilege/packagemanager.info
608  * @param[in] handle Pointer to the package info filter handle
609  * @param[out] count Pointer to store the count value
610  * @return @c 0 on success,
611  *         otherwise a negative error value
612  * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
613  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
614  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
615  * @pre package_manager_filter_create()
616  * @post package_manager_filter_destroy()
617  * @see package_manager_filter_foreach_package_info()
618  */
619 int package_manager_filter_count(package_manager_filter_h handle, int *count);
620
621
622 /**
623  * @brief This API executes the user supplied callback function for each package that satisfy the filter conditions
624  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
625  * @privlevel public
626  * @privilege %http://tizen.org/privilege/packagemanager.info
627  * @param[in] handle Pointer to the package info filter handle
628  * @param[in] callback callback function
629  * @param[in] user_data user data to be passed to the callback function
630  * @return @c 0 on success,
631  *         otherwise a negative error value
632  * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
633  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
634  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
635  * @pre package_manager_filter_create()
636  * @post package_manager_filter_destroy()
637  * @post This function invokes package_manager_package_info_cb() repeatedly for each package information.
638  * @see package_manager_package_info_cb()
639  * @see package_manager_filter_count()
640  */
641 int package_manager_filter_foreach_package_info(package_manager_filter_h handle, package_manager_package_info_cb callback, void *user_data);
642
643
644 /**
645  * @platform
646  * @brief Generates request for getting License, asynchronously.
647  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
648  * @privlevel platform
649  * @privilege %http://tizen.org/privilege/packagemanager.admin
650  * @remarks You must release @a req_data and @a license_url by yourself.
651  * @param[in] resp_data The response data string of the purchase request
652  * @param[out] req_data License request data
653  * @param[out] license_url License acquisition url data
654  * @return @c 0 on success,
655  *         otherwise a negative error value
656  * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
657  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
658  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
659  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR Internal I/O error
660  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
661  * @post package_manager_drm_register_license
662  */
663 int package_manager_drm_generate_license_request(const char *resp_data, char **req_data, char **license_url);
664
665
666 /**
667  * @platform
668  * @brief Registers encrypted license, asynchronously.
669  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
670  * @privlevel platform
671  * @privilege %http://tizen.org/privilege/packagemanager.admin
672  * @param[in] resp_data The response data string of the rights request
673  * @return @c 0 on success,
674  *         otherwise a negative error value
675  * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
676  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
677  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR Internal I/O error
678  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
679  * @pre package_manager_drm_generate_license_request
680  */
681 int package_manager_drm_register_license(const char *resp_data);
682
683 /**
684  * @platform
685  * @brief Decrypts contents which is encrypted, asynchronously.
686  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
687  * @privlevel platform
688  * @privilege %http://tizen.org/privilege/packagemanager.admin
689  * @param[in] drm_file_path DRM file path
690  * @param[in] decrypted_file_path Decrypted file path
691  * @return @c 0 on success,
692  *         otherwise a negative error value
693  * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
694  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
695  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR Internal I/O error
696  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
697  */
698 int package_manager_drm_decrypt_package(const char *drm_file_path, const char *decrypted_file_path);
699
700
701 /**
702  * @brief Retrieves data size from given handle
703  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
704  * @param[in] handle Package size info handle
705  * @param[out] data_size Data size will be returned
706  * @return @c 0 on success,
707  *         otherwise a negative error value
708  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
709  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
710  */
711 int package_size_info_get_data_size(package_size_info_h handle, long long *data_size);
712
713
714 /**
715  * @brief Retrieves cache size from given handle
716  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
717  * @param[in] handle  Package size info handle
718  * @param[out] cache_size Cache size will be returned
719  * @return @c 0 on success,
720  *         otherwise a negative error value
721  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
722  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
723  */
724 int package_size_info_get_cache_size(package_size_info_h handle, long long *cache_size);
725
726
727 /**
728  * @brief Retrieves application size from given handle
729  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
730  * @param[in] handle Package size info handle
731  * @param[out] app_size App size will be returned
732  * @return @c 0 on success,
733  *         otherwise a negative error value
734  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
735  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
736  */
737 int package_size_info_get_app_size(package_size_info_h handle, long long *app_size);
738
739
740 /**
741  * @brief Retrieves external data size from given handle
742  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
743  * @param[in] handle  Package size info handle
744  * @param[out] ext_data_size External data size will be returned
745  * @return @c 0 on success,
746  *         otherwise a negative error value
747  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
748  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
749  */
750 int package_size_info_get_external_data_size(package_size_info_h handle, long long *ext_data_size);
751
752
753 /**
754  * @brief Retrieves external cache size from given handle
755  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
756  * @param[in] handle Package size info handle
757  * @param[out] ext_cache_size External cache size will be returned
758  * @return @c 0 on success,
759  *         otherwise a negative error value
760  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
761  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
762  */
763 int package_size_info_get_external_cache_size(package_size_info_h handle, long long *ext_cache_size);
764
765
766 /**
767  * @brief Retrieves external application size from given handle
768  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
769  * @param[in] handle Package size info handle
770  * @param[out] ext_app_size External app size will be returned
771  * @return @c 0 on success,
772  *         otherwise a negative error value
773  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
774  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
775  */
776 int package_size_info_get_external_app_size(package_size_info_h handle, long long *ext_app_size);
777
778
779 /**
780 * @}
781 */
782
783 /**
784  * @addtogroup CAPI_PACKAGE_REQUEST_MODULE
785  * @{
786  */
787
788
789 /**
790  * @platform
791  * @brief Enumeration for request mode.
792  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
793  */
794 typedef enum {
795         PACKAGE_MANAGER_REQUEST_MODE_DEFAULT = 0,    /**< @platform Default request mode */
796         PACKAGE_MANAGER_REQUEST_MODE_QUIET,          /**< @platform Quiet request mode */
797 } package_manager_request_mode_e;
798
799
800 /**
801  * @platform
802  * @brief The Package manager request handle.
803  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
804  */
805 typedef struct package_manager_request_s *package_manager_request_h;
806
807
808 /**
809  * @platform
810  * @brief Called when the progress of the request to the package manager changes.
811  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
812  * @param[in] id          The ID of the request to the package manager
813  * @param[in] type        The type of the package to install, uninstall or update
814  * @param[in] package     The name of the package to install, uninstall or update
815  * @param[in] event_type  The type of the request to the package manager
816  * @param[in] event_state The current state of the request to the package manager
817  * @param[in] progress    The progress for the request that is being processed by the package manager \n
818  *                        The range of progress is from @c 0 to @c 100.
819  * @param[in] error       The error code when the package manager failed to process the request
820  * @param[in] user_data   The user data passed from package_manager_request_set_event_cb()
821  * @see package_manager_request_set_event_cb()
822  * @see package_manager_request_unset_event_cb()
823  */
824 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);
825
826
827 /**
828  * @brief Creates a request handle to the package manager.
829  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
830  * @remarks You must release @a request using package_manager_request_destroy().
831  * @param[out] request The request handle that is newly created on success
832  * @return @c 0 on success,
833  *         otherwise a negative error value
834  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
835  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
836  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
837  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          Internal I/O error
838  * @see package_manager_request_destroy()
839  */
840 int package_manager_request_create(package_manager_request_h *request);
841
842
843 /**
844  * @brief Destroys the request handle to the package manager.
845  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
846  * @param[in] request The request handle to the package manager
847  * @return @c 0 on success,
848  *         otherwise a negative error value
849  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
850  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
851  * @see package_manager_request_create()
852  */
853 int package_manager_request_destroy(package_manager_request_h request);
854
855
856 /**
857  * @brief Registers a callback function to be invoked when the progress of the request changes.
858  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
859  * @privlevel public
860  * @privilege %http://tizen.org/privilege/packagemanager.info
861  * @param[in] request The request handle
862  * @param[in] callback The callback function to be registered
863  * @param[in] user_data The user data to be passed to the callback function
864  * @return @c 0 on success,
865  *         otherwise a negative error value
866  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
867  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
868  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
869  * @post package_manager_request_event_cb() will be invoked.
870  * @see package_manager_request_event_cb()
871  * @see package_manager_request_unset_event_cb()
872  */
873 int package_manager_request_set_event_cb(package_manager_request_h request, package_manager_request_event_cb callback, void *user_data);
874
875
876 /**
877  * @brief Unregisters the callback function.
878  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
879  * @param[in] request The request handle
880  * @return @c 0 on success,
881  *         otherwise a negative error value
882  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
883  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
884  * @see package_manager_request_event_cb()
885  * @see package_manager_request_set_event_cb()
886  */
887 int package_manager_request_unset_event_cb(package_manager_request_h request);
888
889
890 /**
891  * @brief Sets the type of the package to install, uninstall, or update.
892  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
893  * @param[in] request The request handle
894  * @param[in] type    The type of the package
895  * @return @c 0 on success,
896  *         otherwise a negative error value
897  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
898  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
899  */
900 int package_manager_request_set_type(package_manager_request_h request, const char *type);
901
902
903 /**
904  * @brief Sets the mode of the request.
905  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
906  * @param[in] request The request handle
907  * @param[in] mode    The mode of the request
908  * @return @c 0 on success,
909  *         otherwise a negative error value
910  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
911  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
912  */
913 int package_manager_request_set_mode(package_manager_request_h request, package_manager_request_mode_e mode);
914
915
916 /**
917  * @platform
918  * @brief Sets the path of TEP file to the request. The TEP file that is set will be installed when the package is installed.
919  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
920  * @privlevel platform
921  * @privilege %http://tizen.org/privilege/packagemanager.admin
922  * @param[in] request The request handle
923  * @param[in] tep_path The TEP path to set. If this is NULL on update, installed TEP will be removed.
924  * @return @c 0 on success,
925  *         otherwise a negative error value
926  * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
927  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
928  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
929  * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR           Severe system error
930  */
931 int package_manager_request_set_tep(package_manager_request_h request, const char *tep_path);
932
933
934 /**
935  * @platform
936  * @brief Installs the package located at the given path, asynchronously.
937  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
938  * @privlevel platform
939  * @privilege %http://tizen.org/privilege/packagemanager.admin
940  * @param[in]  request The request handle
941  * @param[in]  path    The absolute path to the package to be installed
942  * @param[out] id      The ID of the request to the package manager
943  * @return @c 0 on success,
944  *         otherwise a negative error value
945  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
946  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
947  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
948  * @see package_manager_request_uninstall()
949  */
950 int package_manager_request_install(package_manager_request_h request, const char *path, int *id);
951
952
953 /**
954  * @platform
955  * @brief Installs the package located at the given path, asynchronously.
956  * @details The progress of the request is asynchronously received by the callback function.
957  *          The @a callback is the individual callback only called for the current API call.
958  *          The @a callback is the only callback called, even if another callback was set for this request
959  *          with package_manager_request_set_event_cb().
960  * @since_tizen 4.0
961  * @privlevel platform
962  * @privilege %http://tizen.org/privilege/packagemanager.admin
963  * @param[in]  request   The request handle
964  * @param[in]  path      The absolute path to the package to be installed
965  * @param[in]  callback  The callback function to be invoked
966  * @param[in]  user_data The user data to be passed to the callback function
967  * @param[out] id        The ID of the request to the package manager
968  * @return @c 0 on success,
969  *         otherwise a negative error value
970  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
971  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
972  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
973  */
974 int package_manager_request_install_with_cb(package_manager_request_h request,
975                                                 const char *path,
976                                                 package_manager_request_event_cb callback,
977                                                 void *user_data,
978                                                 int *id);
979
980
981 /**
982  * @platform
983  * @brief Uninstalls the package with the given name, asynchronously.
984  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
985  * @privlevel platform
986  * @privilege %http://tizen.org/privilege/packagemanager.admin
987  * @param[in]  request The request handle
988  * @param[in]  name    The name of the package to be uninstalled
989  * @param[out] id      The ID of the request to the package manager
990  * @return @c 0 on success,
991  *         otherwise a negative error value
992  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
993  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
994  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
995  */
996 int package_manager_request_uninstall(package_manager_request_h request, const char *name, int *id);
997
998
999 /**
1000  * @platform
1001  * @brief Uninstalls the package with the given name, asynchronously.
1002  * @details The progress of the request is asynchronously received by the callback function.
1003  *          The @a callback is the individual callback only called for the current API call.
1004  *          The @a callback is the only callback called, even if another callback was set for this request
1005  *          with package_manager_request_set_event_cb().
1006  * @since_tizen 4.0
1007  * @privlevel platform
1008  * @privilege %http://tizen.org/privilege/packagemanager.admin
1009  * @param[in]  request   The request handle
1010  * @param[in]  name      The name of the package to be uninstalled
1011  * @param[in]  callback  The callback function to be invoked
1012  * @param[in]  user_data The user data to be passed to the callback function
1013  * @param[out] id        The ID of the request to the package manager
1014  * @return @c 0 on success,
1015  *         otherwise a negative error value
1016  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
1017  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
1018  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
1019  */
1020 int package_manager_request_uninstall_with_cb(package_manager_request_h request,
1021                                                 const char *name,
1022                                                 package_manager_request_event_cb callback,
1023                                                 void *user_data,
1024                                                 int *id);
1025
1026
1027 /**
1028  * @platform
1029  * @brief Moves the package from SD card to the internal memory and vice versa, asynchronously.
1030  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1031  * @privlevel platform
1032  * @privilege %http://tizen.org/privilege/packagemanager.admin
1033  * @param[in] request   The request handle
1034  * @param[in] name      The name of the package to be moved
1035  * @param[in] move_type The move type [enum package_manager_move_type_e], [external to internal/internal to external]
1036  * @return @c 0 on success,
1037  *         otherwise a negative error value
1038  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
1039  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
1040  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
1041  */
1042 int package_manager_request_move(package_manager_request_h request, const char *name, package_manager_move_type_e move_type);
1043
1044
1045 /**
1046  * @platform
1047  * @brief Moves the package from SD card to the internal memory and vice versa, asynchronously.
1048  * @details The progress of the request is asynchronously received by the callback function.
1049  *          The @a callback is the individual callback only called for the current API call.
1050  *          The @a callback is the only callback called, even if another callback was set for this request
1051  *          with package_manager_request_set_event_cb().
1052  * @since_tizen 4.0
1053  * @privlevel platform
1054  * @privilege %http://tizen.org/privilege/packagemanager.admin
1055  * @param[in]  request   The request handle
1056  * @param[in]  name      The name of the package to be moved
1057  * @param[in]  move_type The move type [enum package_manager_move_type_e], [external to internal/internal to external]
1058  * @param[in]  callback  The callback function to be invoked
1059  * @param[in]  user_data The user data to be passed to the callback function
1060  * @param[out] id        The ID of the request to the package manager
1061  * @return @c 0 on success,
1062  *         otherwise a negative error value
1063  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
1064  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
1065  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
1066  */
1067 int package_manager_request_move_with_cb(package_manager_request_h request,
1068                                                 const char *name,
1069                                                 package_manager_move_type_e move_type,
1070                                                 package_manager_request_event_cb callback,
1071                                                 void *user_data,
1072                                                 int *id);
1073
1074 /**
1075  * @platform
1076  * @brief Creates a package update info request.
1077  * @since_tizen 4.0
1078  * @privlevel platform
1079  * @privilege %http://tizen.org/privilege/packagemanager.admin
1080  * @remarks You must release @a pkg_updateinfo_req using package_manager_updateinfo_request_destroy().
1081  * @param[out] pkg_updateinfo_req The package update info request handle that is newly created on success
1082  * @return @c 0 on success,
1083  *         otherwise a negative error value
1084  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
1085  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
1086  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
1087  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
1088  * @see package_manager_updateinfo_request_destroy()
1089  */
1090 int package_manager_updateinfo_request_create(package_updateinfo_request_h *pkg_updateinfo_req);
1091
1092 /**
1093  * @brief Sets the package ID to the package update info request.
1094  * @since_tizen 4.0
1095  * @param[in] pkg_updateinfo_req   The update info request handle
1096  * @param[in] pkgid                The package ID
1097  * @return @c 0 on success,
1098  *         otherwise a negative error value
1099  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
1100  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
1101  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
1102  * @see package_manager_updateinfo_request_create()
1103  */
1104 int package_manager_updateinfo_set_pkgid(package_updateinfo_request_h pkg_updateinfo_req, const char *pkgid);
1105
1106 /**
1107  * @brief Sets the package version to the package update info request.
1108  * @since_tizen 4.0
1109  * @param[in] pkg_updateinfo_req   The update info request handle
1110  * @param[in] version              The package version
1111  * @return @c 0 on success,
1112  *         otherwise a negative error value
1113  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
1114  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
1115  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
1116  * @see package_manager_updateinfo_request_create()
1117  */
1118 int package_manager_updateinfo_set_version(package_updateinfo_request_h pkg_updateinfo_req, const char *version);
1119
1120 /**
1121  * @brief Sets the package update type to the package update info request.
1122  * @since_tizen 4.0
1123  * @param[in] pkg_updateinfo_req   The update info request handle
1124  * @param[in] type                 The package update type
1125  * @return @c 0 on success,
1126  *         otherwise a negative error value
1127  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
1128  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
1129  * @see package_manager_updateinfo_request_create()
1130  * @see package_updateinfo_type_e
1131  */
1132 int package_manager_updateinfo_set_type(package_updateinfo_request_h pkg_updateinfo_req, package_updateinfo_type_e type);
1133
1134 /**
1135  * @brief Request to register package update info in platform.
1136  * @since_tizen 4.0
1137  * @param[in] pkg_updateinfo_req    The update info request handle
1138  * @return @c 0 on success,
1139  *         otherwise a negative error value
1140  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
1141  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
1142  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          I/O error
1143  * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR      Severe system error
1144  * @see package_manager_updateinfo_request_create()
1145  * @see package_manager_updateinfo_request_destroy()
1146  */
1147 int package_manager_updateinfo_request_register(package_updateinfo_request_h pkg_updateinfo_req);
1148
1149 /**
1150  * @brief Destroys the package update info request.
1151  * @since_tizen 4.0
1152  * @param[in] pkg_updateinfo_req    The update info request handle
1153  * @return @c 0 on success,
1154  *         otherwise a negative error value
1155  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
1156  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
1157  * @see package_manager_updateinfo_request_create()
1158  */
1159 int package_manager_updateinfo_request_destroy(package_updateinfo_request_h pkg_updateinfo_req);
1160
1161 /**
1162  * @brief Request to unregister update info in platform for given package id.
1163  * @since_tizen 4.0
1164  * @param[in] pkg_updateinfo_req   The update info request handle
1165  * @param[in] pkgid                The package id to request unregister update info
1166  * @return @c 0 on success,
1167  *         otherwise a negative error value
1168  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
1169  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
1170  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          I/O error
1171  * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR      Severe system error
1172  */
1173 int package_manager_updateinfo_request_unregister(package_updateinfo_request_h pkg_updateinfo_req, const char *pkgid);
1174
1175 /**
1176  * @brief Request to unregister update info of all packages in platform.
1177  * @since_tizen 4.0
1178  * @param[in] pkg_updateinfo_req    The update info request handle
1179  * @return @c 0 on success,
1180  *         otherwise a negative error value
1181  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
1182  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
1183  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          I/O error
1184  * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR      Severe system error
1185  */
1186 int package_manager_updateinfo_request_unregister_all(package_updateinfo_request_h pkg_updateinfo_req);
1187
1188
1189 /**
1190 * @}
1191 */
1192
1193 #ifdef __cplusplus
1194 }
1195 #endif
1196
1197 #endif /* __TIZEN_APPFW_PACKAGE_MANAGER_H */