Add platform tags for certain APIs
[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  * @platform
829  * @brief Creates a request handle to the package manager.
830  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
831  * @remarks You must release @a request using package_manager_request_destroy().
832  * @param[out] request The request handle that is newly created on success
833  * @return @c 0 on success,
834  *         otherwise a negative error value
835  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
836  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
837  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
838  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          Internal I/O error
839  * @see package_manager_request_destroy()
840  */
841 int package_manager_request_create(package_manager_request_h *request);
842
843
844 /**
845  * @platform
846  * @brief Destroys the request handle to the package manager.
847  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
848  * @param[in] request The request handle to the package manager
849  * @return @c 0 on success,
850  *         otherwise a negative error value
851  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
852  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
853  * @see package_manager_request_create()
854  */
855 int package_manager_request_destroy(package_manager_request_h request);
856
857
858 /**
859  * @platform
860  * @brief Registers a callback function to be invoked when the progress of the request changes.
861  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
862  * @privlevel public
863  * @privilege %http://tizen.org/privilege/packagemanager.info
864  * @param[in] request The request handle
865  * @param[in] callback The callback function to be registered
866  * @param[in] user_data The user data to be passed to the callback function
867  * @return @c 0 on success,
868  *         otherwise a negative error value
869  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
870  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
871  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
872  * @post package_manager_request_event_cb() will be invoked.
873  * @see package_manager_request_event_cb()
874  * @see package_manager_request_unset_event_cb()
875  */
876 int package_manager_request_set_event_cb(package_manager_request_h request, package_manager_request_event_cb callback, void *user_data);
877
878
879 /**
880  * @platform
881  * @brief Unregisters the callback function.
882  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
883  * @param[in] request The request handle
884  * @return @c 0 on success,
885  *         otherwise a negative error value
886  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
887  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
888  * @see package_manager_request_event_cb()
889  * @see package_manager_request_set_event_cb()
890  */
891 int package_manager_request_unset_event_cb(package_manager_request_h request);
892
893
894 /**
895  * @platform
896  * @brief Sets the type of the package to install, uninstall, or update.
897  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
898  * @param[in] request The request handle
899  * @param[in] type    The type of the package
900  * @return @c 0 on success,
901  *         otherwise a negative error value
902  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
903  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
904  */
905 int package_manager_request_set_type(package_manager_request_h request, const char *type);
906
907
908 /**
909  * @platform
910  * @brief Sets the mode of the request.
911  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
912  * @param[in] request The request handle
913  * @param[in] mode    The mode of the request
914  * @return @c 0 on success,
915  *         otherwise a negative error value
916  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
917  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
918  */
919 int package_manager_request_set_mode(package_manager_request_h request, package_manager_request_mode_e mode);
920
921
922 /**
923  * @platform
924  * @brief Sets the path of TEP file to the request. The TEP file that is set will be installed when the package is installed.
925  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
926  * @privlevel platform
927  * @privilege %http://tizen.org/privilege/packagemanager.admin
928  * @param[in] request The request handle
929  * @param[in] tep_path The TEP path to set. If this is NULL on update, installed TEP will be removed.
930  * @return @c 0 on success,
931  *         otherwise a negative error value
932  * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
933  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
934  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
935  * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR           Severe system error
936  */
937 int package_manager_request_set_tep(package_manager_request_h request, const char *tep_path);
938
939
940 /**
941  * @platform
942  * @brief Installs the package located at the given path, asynchronously.
943  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
944  * @privlevel platform
945  * @privilege %http://tizen.org/privilege/packagemanager.admin
946  * @param[in]  request The request handle
947  * @param[in]  path    The absolute path to the package to be installed
948  * @param[out] id      The ID of the request to the package manager
949  * @return @c 0 on success,
950  *         otherwise a negative error value
951  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
952  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
953  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
954  * @see package_manager_request_uninstall()
955  */
956 int package_manager_request_install(package_manager_request_h request, const char *path, int *id);
957
958
959 /**
960  * @platform
961  * @brief Installs the package located at the given path, asynchronously.
962  * @details The progress of the request is asynchronously received by the callback function.
963  *          The @a callback is the individual callback only called for the current API call.
964  *          The @a callback is the only callback called, even if another callback was set for this request
965  *          with package_manager_request_set_event_cb().
966  * @since_tizen 4.0
967  * @privlevel platform
968  * @privilege %http://tizen.org/privilege/packagemanager.admin
969  * @param[in]  request   The request handle
970  * @param[in]  path      The absolute path to the package to be installed
971  * @param[in]  callback  The callback function to be invoked
972  * @param[in]  user_data The user data to be passed to the callback function
973  * @param[out] id        The ID of the request to the package manager
974  * @return @c 0 on success,
975  *         otherwise a negative error value
976  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
977  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
978  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
979  */
980 int package_manager_request_install_with_cb(package_manager_request_h request,
981                                                 const char *path,
982                                                 package_manager_request_event_cb callback,
983                                                 void *user_data,
984                                                 int *id);
985
986
987 /**
988  * @platform
989  * @brief Uninstalls the package with the given name, asynchronously.
990  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
991  * @privlevel platform
992  * @privilege %http://tizen.org/privilege/packagemanager.admin
993  * @param[in]  request The request handle
994  * @param[in]  name    The name of the package to be uninstalled
995  * @param[out] id      The ID of the request to the package manager
996  * @return @c 0 on success,
997  *         otherwise a negative error value
998  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
999  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
1000  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
1001  */
1002 int package_manager_request_uninstall(package_manager_request_h request, const char *name, int *id);
1003
1004
1005 /**
1006  * @platform
1007  * @brief Uninstalls the package with the given name, asynchronously.
1008  * @details The progress of the request is asynchronously received by the callback function.
1009  *          The @a callback is the individual callback only called for the current API call.
1010  *          The @a callback is the only callback called, even if another callback was set for this request
1011  *          with package_manager_request_set_event_cb().
1012  * @since_tizen 4.0
1013  * @privlevel platform
1014  * @privilege %http://tizen.org/privilege/packagemanager.admin
1015  * @param[in]  request   The request handle
1016  * @param[in]  name      The name of the package to be uninstalled
1017  * @param[in]  callback  The callback function to be invoked
1018  * @param[in]  user_data The user data to be passed to the callback function
1019  * @param[out] id        The ID of the request to the package manager
1020  * @return @c 0 on success,
1021  *         otherwise a negative error value
1022  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
1023  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
1024  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
1025  */
1026 int package_manager_request_uninstall_with_cb(package_manager_request_h request,
1027                                                 const char *name,
1028                                                 package_manager_request_event_cb callback,
1029                                                 void *user_data,
1030                                                 int *id);
1031
1032
1033 /**
1034  * @platform
1035  * @brief Moves the package from SD card to the internal memory and vice versa, asynchronously.
1036  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1037  * @privlevel platform
1038  * @privilege %http://tizen.org/privilege/packagemanager.admin
1039  * @param[in] request   The request handle
1040  * @param[in] name      The name of the package to be moved
1041  * @param[in] move_type The move type [enum package_manager_move_type_e], [external to internal/internal to external]
1042  * @return @c 0 on success,
1043  *         otherwise a negative error value
1044  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
1045  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
1046  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
1047  */
1048 int package_manager_request_move(package_manager_request_h request, const char *name, package_manager_move_type_e move_type);
1049
1050
1051 /**
1052  * @platform
1053  * @brief Moves the package from SD card to the internal memory and vice versa, asynchronously.
1054  * @details The progress of the request is asynchronously received by the callback function.
1055  *          The @a callback is the individual callback only called for the current API call.
1056  *          The @a callback is the only callback called, even if another callback was set for this request
1057  *          with package_manager_request_set_event_cb().
1058  * @since_tizen 4.0
1059  * @privlevel platform
1060  * @privilege %http://tizen.org/privilege/packagemanager.admin
1061  * @param[in]  request   The request handle
1062  * @param[in]  name      The name of the package to be moved
1063  * @param[in]  move_type The move type [enum package_manager_move_type_e], [external to internal/internal to external]
1064  * @param[in]  callback  The callback function to be invoked
1065  * @param[in]  user_data The user data to be passed to the callback function
1066  * @param[out] id        The ID of the request to the package manager
1067  * @return @c 0 on success,
1068  *         otherwise a negative error value
1069  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
1070  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
1071  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
1072  */
1073 int package_manager_request_move_with_cb(package_manager_request_h request,
1074                                                 const char *name,
1075                                                 package_manager_move_type_e move_type,
1076                                                 package_manager_request_event_cb callback,
1077                                                 void *user_data,
1078                                                 int *id);
1079
1080 /**
1081  * @platform
1082  * @brief Creates a package update info request.
1083  * @since_tizen 4.0
1084  * @privlevel platform
1085  * @privilege %http://tizen.org/privilege/packagemanager.admin
1086  * @remarks You must release @a pkg_updateinfo_req using package_manager_updateinfo_request_destroy().
1087  * @param[out] pkg_updateinfo_req The package update info request handle that is newly created on success
1088  * @return @c 0 on success,
1089  *         otherwise a negative error value
1090  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
1091  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
1092  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
1093  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
1094  * @see package_manager_updateinfo_request_destroy()
1095  */
1096 int package_manager_updateinfo_request_create(package_updateinfo_request_h *pkg_updateinfo_req);
1097
1098 /**
1099  * @brief Sets the package ID to the package update info request.
1100  * @since_tizen 4.0
1101  * @param[in] pkg_updateinfo_req   The update info request handle
1102  * @param[in] pkgid                The package ID
1103  * @return @c 0 on success,
1104  *         otherwise a negative error value
1105  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
1106  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
1107  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
1108  * @see package_manager_updateinfo_request_create()
1109  */
1110 int package_manager_updateinfo_set_pkgid(package_updateinfo_request_h pkg_updateinfo_req, const char *pkgid);
1111
1112 /**
1113  * @brief Sets the package version to the package update info request.
1114  * @since_tizen 4.0
1115  * @param[in] pkg_updateinfo_req   The update info request handle
1116  * @param[in] version              The package version
1117  * @return @c 0 on success,
1118  *         otherwise a negative error value
1119  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
1120  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
1121  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
1122  * @see package_manager_updateinfo_request_create()
1123  */
1124 int package_manager_updateinfo_set_version(package_updateinfo_request_h pkg_updateinfo_req, const char *version);
1125
1126 /**
1127  * @brief Sets the package update type to the package update info request.
1128  * @since_tizen 4.0
1129  * @param[in] pkg_updateinfo_req   The update info request handle
1130  * @param[in] type                 The package update type
1131  * @return @c 0 on success,
1132  *         otherwise a negative error value
1133  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
1134  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
1135  * @see package_manager_updateinfo_request_create()
1136  * @see package_updateinfo_type_e
1137  */
1138 int package_manager_updateinfo_set_type(package_updateinfo_request_h pkg_updateinfo_req, package_updateinfo_type_e type);
1139
1140 /**
1141  * @brief Request to register package update info in platform.
1142  * @since_tizen 4.0
1143  * @param[in] pkg_updateinfo_req    The update info request handle
1144  * @return @c 0 on success,
1145  *         otherwise a negative error value
1146  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
1147  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
1148  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          I/O error
1149  * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR      Severe system error
1150  * @see package_manager_updateinfo_request_create()
1151  * @see package_manager_updateinfo_request_destroy()
1152  */
1153 int package_manager_updateinfo_request_register(package_updateinfo_request_h pkg_updateinfo_req);
1154
1155 /**
1156  * @brief Destroys the package update info request.
1157  * @since_tizen 4.0
1158  * @param[in] pkg_updateinfo_req    The update info request handle
1159  * @return @c 0 on success,
1160  *         otherwise a negative error value
1161  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
1162  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
1163  * @see package_manager_updateinfo_request_create()
1164  */
1165 int package_manager_updateinfo_request_destroy(package_updateinfo_request_h pkg_updateinfo_req);
1166
1167 /**
1168  * @brief Request to unregister update info in platform for given package id.
1169  * @since_tizen 4.0
1170  * @param[in] pkg_updateinfo_req   The update info request handle
1171  * @param[in] pkgid                The package id to request unregister update info
1172  * @return @c 0 on success,
1173  *         otherwise a negative error value
1174  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
1175  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
1176  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          I/O error
1177  * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR      Severe system error
1178  */
1179 int package_manager_updateinfo_request_unregister(package_updateinfo_request_h pkg_updateinfo_req, const char *pkgid);
1180
1181 /**
1182  * @brief Request to unregister update info of all packages in platform.
1183  * @since_tizen 4.0
1184  * @param[in] pkg_updateinfo_req    The update info request handle
1185  * @return @c 0 on success,
1186  *         otherwise a negative error value
1187  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
1188  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
1189  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          I/O error
1190  * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR      Severe system error
1191  */
1192 int package_manager_updateinfo_request_unregister_all(package_updateinfo_request_h pkg_updateinfo_req);
1193
1194
1195 /**
1196 * @}
1197 */
1198
1199 #ifdef __cplusplus
1200 }
1201 #endif
1202
1203 #endif /* __TIZEN_APPFW_PACKAGE_MANAGER_H */