2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef __TIZEN_APPFW_PACKAGE_MANAGER_H
18 #define __TIZEN_APPFW_PACKAGE_MANAGER_H
20 #include <sys/types.h>
24 #include <package_info.h>
31 * @file package_manager.h
35 * @addtogroup CAPI_PACKAGE_MANAGER_MODULE
40 * @brief 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
43 #define PACKAGE_MANAGER_PKGINFO_PROP_REMOVABLE "PMINFO_PKGINFO_PROP_PACKAGE_REMOVABLE"
46 * @brief 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
47 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
49 #define PACKAGE_MANAGER_PKGINFO_PROP_READONLY "PMINFO_PKGINFO_PROP_PACKAGE_READONLY"
52 * @brief 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
53 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
55 #define PACKAGE_MANAGER_PKGINFO_PROP_SUPPORT_DISABLE "PMINFO_PKGINFO_PROP_PACKAGE_SUPPORT_DISABLE"
58 * @brief Value to be used when filtering based on install location: Boolean property for filtering whether the package is disabled based on package info
59 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
61 #define PACKAGE_MANAGER_PKGINFO_PROP_DISABLE "PMINFO_PKGINFO_PROP_PACKAGE_DISABLE"
64 * @brief 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
65 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
67 #define PACKAGE_MANAGER_PKGINFO_PROP_PRELOAD "PMINFO_PKGINFO_PROP_PACKAGE_PRELOAD"
70 * @brief Enumeration for error code.
71 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
74 PACKAGE_MANAGER_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
75 PACKAGE_MANAGER_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
76 PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
77 PACKAGE_MANAGER_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR, /**< Internal I/O error */
78 PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE = TIZEN_ERROR_PACKAGE_MANAGER | 0x71, /**< No such package */
79 PACKAGE_MANAGER_ERROR_SYSTEM_ERROR = TIZEN_ERROR_PACKAGE_MANAGER | 0x72, /**< Severe system error */
80 PACKAGE_MANAGER_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED /**< Permission denied */
81 } package_manager_error_e;
84 * @brief Enumeration for event type.
85 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
88 PACKAGE_MANAGER_EVENT_TYPE_INSTALL = 0, /**< Install event type */
89 PACKAGE_MANAGER_EVENT_TYPE_UNINSTALL, /**< Uninstall event type */
90 PACKAGE_MANAGER_EVENT_TYPE_UPDATE, /**< Update event type */
91 PACKAGE_MANAGER_EVENT_TYPE_MOVE, /**< Move event type (Since 3.0) */
92 PACKAGE_MANAGER_EVENT_TYPE_CLEAR, /**< Clear event type (Since 3.0) */
94 /* These enum will be deprecated. Use above enum instead. */
95 PACAKGE_MANAGER_EVENT_TYPE_INSTALL = 0,
96 PACAKGE_MANAGER_EVENT_TYPE_UNINSTALL,
97 PACAKGE_MANAGER_EVENT_TYPE_UPDATE,
98 } package_manager_event_type_e;
101 * @brief Enumeration for event state.
102 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
105 PACKAGE_MANAGER_EVENT_STATE_STARTED = 0, /**< Started event state */
106 PACKAGE_MANAGER_EVENT_STATE_PROCESSING, /**< Processing event state */
107 PACKAGE_MANAGER_EVENT_STATE_COMPLETED, /**< Completed event state */
108 PACKAGE_MANAGER_EVENT_STATE_FAILED, /**< Failed event state */
110 /* These enum will be deprecated. Use above enum instead. */
111 PACAKGE_MANAGER_EVENT_STATE_STARTED = 0,
112 PACAKGE_MANAGER_EVENT_STATE_PROCESSING,
113 PACAKGE_MANAGER_EVENT_STATE_COMPLETED,
114 PACAKGE_MANAGER_EVENT_STATE_FAILED,
115 } package_manager_event_state_e;
118 * @brief Enumeration for move type.
119 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
122 PACKAGE_MANAGER_REQUEST_MOVE_TO_INTERNAL = 0, /**< Internal type */
123 PACKAGE_MANAGER_REQUEST_MOVE_TO_EXTERNAL, /**< External type */
125 /* These enum will be deprecated. Use above enum instead. */
126 PACAKGE_MANAGER_REQUEST_MOVE_TO_INTERNAL = 0,
127 PACAKGE_MANAGER_REQUEST_MOVE_TO_EXTERNAL,
128 } package_manager_move_type_e;
131 * @brief Enumeration for certification compare type.
132 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
135 PACKAGE_MANAGER_COMPARE_MATCH = 0, /**< Matching certification */
136 PACKAGE_MANAGER_COMPARE_MISMATCH, /**< Mismatching certification */
137 PACKAGE_MANAGER_COMPARE_LHS_NO_CERT, /**< First package has no certification */
138 PACKAGE_MANAGER_COMPARE_RHS_NO_CERT, /**< Second package has no certification */
139 PACKAGE_MANAGER_COMPARE_BOTH_NO_CERT, /**< Both have no certification */
141 /* These enum will be deprecated. Use above enum instead. */
142 PACAKGE_MANAGER_COMPARE_MATCH = 0,
143 PACAKGE_MANAGER_COMPARE_MISMATCH,
144 PACAKGE_MANAGER_COMPARE_LHS_NO_CERT,
145 PACAKGE_MANAGER_COMPARE_RHS_NO_CERT,
146 PACAKGE_MANAGER_COMPARE_BOTH_NO_CERT,
147 } package_manager_compare_result_type_e;
150 * @brief Enumeration for permission type.
151 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
154 PACKAGE_MANAGER_PERMISSION_NORMAL = 0, /**< Normal permission */
155 PACKAGE_MANAGER_PERMISSION_SIGNATURE, /**< Signature permission */
156 PACKAGE_MANAGER_PERMISSION_PRIVILEGE, /**< Privilege permission */
157 } package_manager_permission_type_e;
160 * @brief Enumeration for status type.
161 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
164 PACKAGE_MANAGER_STATUS_TYPE_ALL = 0x00, /**< All status */
165 PACKAGE_MANAGER_STATUS_TYPE_INSTALL = 0x01, /**< Install package status */
166 PACKAGE_MANAGER_STATUS_TYPE_UNINSTALL = 0x02, /**< Uninstall package status */
167 PACKAGE_MANAGER_STATUS_TYPE_UPGRADE = 0x04, /**< Upgrade package status */
168 PACKAGE_MANAGER_STATUS_TYPE_MOVE = 0x08, /**< Move package status */
169 PACKAGE_MANAGER_STATUS_TYPE_CLEAR_DATA = 0x10, /**< Clear data status */
170 PACKAGE_MANAGER_STATUS_TYPE_INSTALL_PROGRESS = 0x20, /**< Install progress status */
171 PACKAGE_MANAGER_STATUS_TYPE_GET_SIZE = 0x40, /**< Get size status */
172 } package_manager_status_type_e;
175 * @brief The Package manager handle.
176 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
178 typedef struct package_manager_s *package_manager_h;
181 * @brief Package manager filter handle.
182 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
184 typedef struct package_manager_filter_s *package_manager_filter_h;
187 * @brief Called when the package is installed, uninstalled or updated, and the progress of the request to the package manager changes.
188 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
190 * @param[in] type The type of the package to be installed, uninstalled or updated
191 * @param[in] package The name of the package to be installed, uninstalled or updated
192 * @param[in] event_type The type of the request to the package manager
193 * @param[in] event_state The current state of the request to the package manager
194 * @param[in] progress The progress for the request that is being processed by the package manager \n
195 * The range of progress is from @c 0 to @c 100.
196 * @param[in] error The error code when the package manager failed to process the request
197 * @param[in] user_data The user data passed from package_manager_set_event_cb()
199 * @see package_manager_set_event_cb()
200 * @see package_manager_unset_event_cb()
202 typedef void (*package_manager_event_cb) (
205 package_manager_event_type_e event_type,
206 package_manager_event_state_e event_state,
208 package_manager_error_e error,
212 * @brief Creates a package manager handle.
213 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
215 * @privilege %http://tizen.org/privilege/packagemanager.info
216 * @remarks You must release @a manager using package_manager_destroy().
218 * @param[out] manager The package manager handle that is newly created on success
220 * @return @c 0 on success,
221 * otherwise a negative error value
223 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
224 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
225 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
226 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR Internal I/O error
227 * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
228 * @see package_manager_destroy()
230 int package_manager_create(package_manager_h *manager);
233 * @brief Destroys the package manager handle.
234 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
236 * @param[in] manager The package manager handle
238 * @return @c 0 on success,
239 * otherwise a negative error value
241 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
242 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
244 * @see package_manager_create()
246 int package_manager_destroy(package_manager_h manager);
249 * @brief Sets the event status of the package when the package is installed, uninstalled or updated.
250 * You can combine multiple status using OR operation which you want to listen.
251 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
253 * @param [in] manager The package manager handle
254 * @param [in] status_type The status of the package
256 * @return @c 0 on success,
257 * otherwise a negative error value
259 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
260 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
261 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR Internal I/O error
263 * @see package_manager_status_type_e
264 * @see package_manager_set_event_cb()
266 int package_manager_set_event_status(package_manager_h manager, int status_type);
269 * @brief Registers a callback function to be invoked when the package is installed, uninstalled or updated.
270 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
272 * @privilege %http://tizen.org/privilege/packagemanager.info
273 * @param[in] manager The package manager handle
274 * @param[in] callback The callback function to be registered
275 * @param[in] user_data The user data to be passed to the callback function
277 * @return @c 0 on success,
278 * otherwise a negative error value
280 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
281 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
282 * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
283 * @post package_manager_event_cb() will be invoked.
285 * @see package_manager_set_event_status()
286 * @see package_manager_event_cb()
287 * @see package_manager_unset_event_cb()
289 int package_manager_set_event_cb(package_manager_h manager,
290 package_manager_event_cb callback,
294 * @brief Unregisters the callback function.
295 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
297 * @param[in] manager The package manager handle
299 * @return @c 0 on success,
300 * otherwise a negative error value
302 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
303 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
305 * @see package_manager_event_cb()
306 * @see package_manager_set_event_cb()
308 int package_manager_unset_event_cb(package_manager_h manager);
311 * @brief Called to retrieve all packages.
312 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
314 * @param[in] package_info The package information
315 * @param[in] user_data The user data passed from the foreach function
317 * @return @c true to continue with the next iteration of the loop,
318 * otherwise @c false to break out of the loop
320 * @see package_manager_foreach_package_info()
322 typedef bool (*package_manager_package_info_cb) (
323 package_info_h package_info,
327 * @brief Retrieves all package information of installed packages.
328 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
330 * @privilege %http://tizen.org/privilege/packagemanager.info
331 * @param[in] callback The callback function to be invoked
332 * @param[in] user_data The user data to be passed to the callback function
334 * @return @c 0 on success,
335 * otherwise a negative error value
337 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
338 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
339 * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
340 * @post This function invokes package_manager_package_info_cb() repeatedly for each package information.
342 * @see package_manager_package_info_cb()
344 int package_manager_foreach_package_info(package_manager_package_info_cb callback,
348 * @brief Gets the package ID for the given app ID.
349 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
351 * @privilege %http://tizen.org/privilege/packagemanager.info
352 * @param[in] app_id The ID of the application
353 * @param[out] package_id The ID of the package
355 * @return @c 0 on success,
356 * otherwise a negative error value
358 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
359 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
360 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
361 * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
363 int package_manager_get_package_id_by_app_id(const char *app_id, char **package_id);
366 * @brief Gets the package information for the given package.
367 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
369 * @privilege %http://tizen.org/privilege/packagemanager.info
370 * @remarks You must release @a package_info using package_info_destroy().
372 * @param[in] package_id The ID of the package
373 * @param[out] package_info The package information for the given package ID
375 * @return @c 0 on success,
376 * otherwise a negative error value
378 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
379 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
380 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
381 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR Database error occurred
382 * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
384 int package_manager_get_package_info(const char *package_id, package_info_h *package_info);
388 * @brief Compares whether two package certifications are matched.
389 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
391 * @param[in] lhs_package_id The first package ID to compare
392 * @param[in] rhs_package_id The second package ID to compare
393 * @param[out] compare_result @c 0 if the certification information are matched,
394 * otherwise the compared result
396 * @return @c 0 on success,
397 * otherwise a negative error value
399 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
400 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
401 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
402 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR Database error occurred
404 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);
407 * @brief Compares whether two app certifications are matched.
408 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
410 * @param[in] lhs_app_id The first app ID to compare
411 * @param[in] rhs_app_id The second app ID to compare
412 * @param[out] compare_result @c 0 if the certification information are matched,
413 * otherwise the compared result
415 * @return @c 0 on success,
416 * otherwise a negative error value
418 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
419 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
420 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
421 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR Database error occurred
423 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);
426 * @brief Checks whether the package is preloaded by @a app_id.
427 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
429 * @privilege %http://tizen.org/privilege/packagemanager.info
430 * @param[in] app_id The ID of the application
431 * @param[out] preload The preload info of the package
433 * @return @c 0 on success,
434 * otherwise a negative error value
436 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
437 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
438 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
439 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
440 * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
442 int package_manager_is_preload_package_by_app_id(const char *app_id, bool *preload);
445 * @brief Gets the package permission type by @a app_id.
446 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
448 * @privilege %http://tizen.org/privilege/packagemanager.info
449 * @param[in] app_id The ID of the application
450 * @param[out] permission_type The package permission type
452 * @return @c 0 on success,
453 * otherwise a negative error value
455 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
456 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
457 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
458 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
459 * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
461 int package_manager_get_permission_type(const char *app_id, package_manager_permission_type_e *permission_type);
464 * @brief Clears the application's internal and external cache directory.
465 * @details All files stored in the cache directory of the application specified with the
466 * package ID are removed.
468 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
470 * @privilege %http://tizen.org/privilege/packagemanager.clearcache
472 * @param[in] package_id The package ID
474 * @return @c 0 on success,
475 * otherwise a negative error value
477 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
478 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
479 * @retval #PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE No such package
480 * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
481 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
482 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
483 * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR Severe system error
485 int package_manager_clear_cache_dir(const char *package_id);
489 * @brief Clears all applications' internal and external cache directory.
490 * @details All files stored in the cache directory of each application are removed.
492 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
493 * @privlevel platform
494 * @privilege %http://tizen.org/privilege/packagemanager.admin
496 * @return @c 0 on success,
497 * otherwise a negative error value
499 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
500 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
501 * @retval #PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE No such package
502 * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
503 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
504 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
505 * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR Severe system error
507 int package_manager_clear_all_cache_dir(void);
510 * @brief The handle for the package size information.
511 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
513 typedef struct package_size_info *package_size_info_h;
516 * @brief Called when the package size information is obtained.
517 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
519 * @param[in] package_id The package ID
520 * @param[in] size_info The pointer to the structure including the package size information
521 * @param[in] user_data The user data to be passed to the callback function
523 typedef void (*package_manager_size_info_receive_cb)(const char *package_id, const package_size_info_h size_info, void *user_data);
527 * @brief Called when the total package size information is obtained.
528 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
530 * @param[in] size_info The pointer to the structure including the package size information
531 * @param[in] user_data The user data to be passed to the callback function
533 typedef void (*package_manager_total_size_info_receive_cb)(const package_size_info_h size_info, void *user_data);
536 * @brief Gets the package size information.
537 * @details The package size info is asynchronously obtained by the callback function.
539 * @privilege %http://tizen.org/privilege/packagemanager.info
541 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
543 * @param[in] package_id The package ID
544 * @param[in] callback The asynchronous callback function to get the package size information
545 * @param[in] user_data The user data to be passed to the callback function
547 * @return @c 0 on success,
548 * otherwise a negative error value
550 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
551 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
552 * @retval #PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE No such package
553 * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
554 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
555 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
556 * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR Severe system error
558 int package_manager_get_package_size_info(const char *package_id, package_manager_size_info_receive_cb callback, void *user_data);
562 * @brief Gets the total package size information.
563 * @details The total package size info is asynchronously obtained by the callback function.
564 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
566 * @privilege %http://tizen.org/privilege/packagemanager.info
568 * @param [in] callback The asynchronous callback function to get the total package size information
569 * @param [in] user_data The user data to be passed to the callback function
571 * @return @c 0 on success,
572 * 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_NO_SUCH_PACKAGE No such package
577 * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
578 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
579 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
580 * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR Severe system error
582 int package_manager_get_total_package_size_info(package_manager_total_size_info_receive_cb callback, void *user_data);
585 * @brief Creates the package information filter handle from db.
586 * @details All filter properties will be ANDed.
587 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
589 * @privilege %http://tizen.org/privilege/packagemanager.info
591 * @param[out] handle Pointer to the package info filter handle.
593 * @return @c 0 on success,
594 * otherwise a negative error value
596 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
597 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
598 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
599 * @post package_manager_filter_destroy()
600 * @see package_manager_filter_add_bool()
601 * @see package_manager_filter_foreach_pkginfo()
603 int package_manager_filter_create(package_manager_filter_h *handle);
606 * @brief This API destroys the package information filter handle freeing up all the resources
607 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
609 * @param[in] handle Pointer to the package info filter handle.
611 * @return @c 0 on success,
612 * otherwise a negative error value
614 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
615 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
616 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
617 * @pre package_manager_filter_create()
618 * @see package_manager_filter_count()
619 * @see package_manager_filter_foreach_package_info()
621 int package_manager_filter_destroy(package_manager_filter_h handle);
624 * @brief This API adds a boolean filter property to the filter handle
625 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
627 * @param[in] handle Pointer to the package info filter handle.
628 * @param[in] property boolean property name.
629 * @param[in] value value corresponding to the property.
631 * @return @c 0 on success,
632 * otherwise a negative error value
634 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
635 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
636 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
637 * @pre package_manager_filter_create()
638 * @post package_manager_filter_destroy()
639 * @see package_manager_filter_count()
640 * @see package_manager_filter_foreach_package_info()
642 int package_manager_filter_add_bool(package_manager_filter_h handle,
643 const char *property, const bool value);
646 * @brief This API counts the package that satisfy the filter conditions
647 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
649 * @privilege %http://tizen.org/privilege/packagemanager.info
651 * @param[in] handle Pointer to the package info filter handle.
652 * @param[out] count Pointer to store the count value.
654 * @return @c 0 on success,
655 * otherwise a negative error value
657 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
658 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
659 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
660 * @pre package_manager_filter_create()
661 * @post package_manager_filter_destroy()
662 * @see package_manager_filter_foreach_package_info()
664 int package_manager_filter_count(package_manager_filter_h handle, int *count);
667 * @brief This API executes the user supplied callback function for each package that satisfy the filter conditions
668 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
670 * @privilege %http://tizen.org/privilege/packagemanager.info
672 * @param[in] handle Pointer to the package info filter handle.
673 * @param[in] callback callback function.
674 * @param[in] user_data user data to be passed to the callback function
676 * @return @c 0 on success,
677 * otherwise a negative error value
679 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
680 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
681 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
682 * @pre package_manager_filter_create()
683 * @post package_manager_filter_destroy()
684 * @post This function invokes package_manager_package_info_cb() repeatedly for each package information.
685 * @see package_manager_package_info_cb()
686 * @see package_manager_filter_count()
688 int package_manager_filter_foreach_package_info(package_manager_filter_h handle,
689 package_manager_package_info_cb callback, void *user_data);
693 * @brief Generates request for getting License
694 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
695 * @privlevel platform
696 * @privilege %http://tizen.org/privilege/packagemanager.admin
697 * @param[in] resp_data The response data string of the purchase request
698 * @param[out] req_data License request data
699 * @param[out] license_url License acquisition url data
700 * @remarks You must release @a req_data and @a license_url by yourself.
701 * @return 0 on success, otherwise a negative error value
702 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
703 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
704 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
705 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR Internal I/O error
706 * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
707 * @post package_manager_drm_register_license
709 int package_manager_drm_generate_license_request(const char *resp_data, char **req_data, char **license_url);
713 * @brief Registers encrypted license
714 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
715 * @privlevel platform
716 * @privilege %http://tizen.org/privilege/packagemanager.admin
717 * @param[in] resp_data The response data string of the rights request
718 * @return 0 on success, otherwise a negative error value
719 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
720 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
721 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR Internal I/O error
722 * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
723 * @pre package_manager_drm_generate_license_request
725 int package_manager_drm_register_license(const char *resp_data);
729 * @brief Decrypts contents which is encrypted
730 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
731 * @privlevel platform
732 * @privilege %http://tizen.org/privilege/packagemanager.admin
733 * @param[in] drm_file_path DRM file path
734 * @param[in] decrypted_file_path Decrypted file path
735 * @return 0 on success, otherwise a negative error value
736 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
737 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
738 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR Internal I/O error
739 * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
741 int package_manager_drm_decrypt_package(const char *drm_file_path, const char *decrypted_file_path);
744 * @brief Retrieves data size from given handle
746 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
748 * @param[in] handle Package size info handle
749 * @param[out] data_size Data size will be returned
751 * @return @c 0 on success,
752 * otherwise a negative error value
754 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
755 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
757 int package_size_info_get_data_size(package_size_info_h handle, long long *data_size);
760 * @brief Retrieves cache size from given handle
762 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
764 * @param[in] handle Package size info handle
765 * @param[out] cache_size Cache size will be returned
767 * @return @c 0 on success,
768 * otherwise a negative error value
770 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
771 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
773 int package_size_info_get_cache_size(package_size_info_h handle, long long *cache_size);
776 * @brief Retrieves application size from given handle
778 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
780 * @param[in] handle Package size info handle
781 * @param[out] app_size App size will be returned
783 * @return @c 0 on success,
784 * otherwise a negative error value
786 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
787 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
789 int package_size_info_get_app_size(package_size_info_h handle, long long *app_size);
792 * @brief Retrieves external data size from given handle
794 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
796 * @param[in] handle Package size info handle
797 * @param[out] ext_data_size External data size will be returned
799 * @return @c 0 on success,
800 * otherwise a negative error value
802 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
803 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
805 int package_size_info_get_external_data_size(package_size_info_h handle, long long *ext_data_size);
809 * @brief Retrieves external cache size from given handle
811 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
813 * @param[in] handle Package size info handle
814 * @param[out] ext_cache_size External cache size will be returned
816 * @return @c 0 on success,
817 * otherwise a negative error value
819 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
820 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
822 int package_size_info_get_external_cache_size(package_size_info_h handle, long long *ext_cache_size);
826 * @brief Retrieves external application size from given handle
828 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
830 * @param[in] handle Package size info handle
831 * @param[out] ext_app_size External app size will be returned
833 * @return @c 0 on success,
834 * otherwise a negative error value
836 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
837 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
839 int package_size_info_get_external_app_size(package_size_info_h handle, long long *ext_app_size);
846 * @addtogroup CAPI_PACKAGE_REQUEST_MODULE
852 * @brief Enumeration for request mode.
853 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
856 PACKAGE_MANAGER_REQUEST_MODE_DEFAULT = 0, /**< @platform Default request mode */
857 PACKAGE_MANAGER_REQUEST_MODE_QUIET, /**< @platform Quiet request mode */
859 /* These enum will be deprecated. Use above enum instead. */
860 PACAKGE_MANAGER_REQUEST_MODE_DEFAULT = 0,
861 PACAKGE_MANAGER_REQUEST_MODE_QUIET,
862 } package_manager_request_mode_e;
866 * @brief The Package manager request handle.
867 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
869 typedef struct package_manager_request_s *package_manager_request_h;
873 * @brief Called when the progress of the request to the package manager changes.
874 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
876 * @param[in] id The ID of the request to the package manager
877 * @param[in] type The type of the package to install, uninstall or update
878 * @param[in] package The name of the package to install, uninstall or update
879 * @param[in] event_type The type of the request to the package manager
880 * @param[in] event_state The current state of the request to the package manager
881 * @param[in] progress The progress for the request that is being processed by the package manager \n
882 * The range of progress is from @c 0 to @c 100.
883 * @param[in] error The error code when the package manager failed to process the request
884 * @param[in] user_data The user data passed from package_manager_request_set_event_cb()
886 * @see package_manager_request_set_event_cb()
887 * @see package_manager_request_unset_event_cb()
889 typedef void (*package_manager_request_event_cb) (
893 package_manager_event_type_e event_type,
894 package_manager_event_state_e event_state,
896 package_manager_error_e error,
901 * @brief Creates a request handle to the package manager.
902 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
904 * @remarks You must release @a request using package_manager_request_destroy().
906 * @param[out] request The request handle that is newly created on success
908 * @return @c 0 on success,
909 * otherwise a negative error value
911 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
912 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
913 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
914 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR Internal I/O error
916 * @see package_manager_request_destroy()
918 int package_manager_request_create(package_manager_request_h *request);
922 * @brief Destroys the request handle to the package manager.
923 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
925 * @param[in] request The request handle to the package manager
927 * @return @c 0 on success,
928 * otherwise a negative error value
930 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
931 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
933 * @see package_manager_request_create()
935 int package_manager_request_destroy(package_manager_request_h request);
939 * @brief Registers a callback function to be invoked when the progress of the request changes.
940 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
942 * @privilege %http://tizen.org/privilege/packagemanager.info
943 * @param[in] request The request handle
944 * @param[in] callback The callback function to be registered
945 * @param[in] user_data The user data to be passed to the callback function
947 * @return @c 0 on success,
948 * otherwise a negative error value
950 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
951 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
952 * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
953 * @post package_manager_request_event_cb() will be invoked.
955 * @see package_manager_request_event_cb()
956 * @see package_manager_request_unset_event_cb()
958 int package_manager_request_set_event_cb(package_manager_request_h request,
959 package_manager_request_event_cb callback, void *user_data);
963 * @brief Unregisters the callback function.
964 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
966 * @param[in] request The request handle
968 * @return @c 0 on success,
969 * otherwise a negative error value
971 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
972 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
974 * @see package_manager_request_event_cb()
975 * @see package_manager_request_set_event_cb()
977 int package_manager_request_unset_event_cb(package_manager_request_h request);
981 * @brief Sets the type of the package to install, uninstall or update.
982 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
984 * @param[in] request The request handle
985 * @param[in] type The type of the package
987 * @return @c 0 on success,
988 * otherwise a negative error value
990 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
991 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
993 int package_manager_request_set_type(package_manager_request_h request,
998 * @brief Sets the mode of the request.
999 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1001 * @param[in] request The request handle
1002 * @param[in] mode The mode of the request
1004 * @return @c 0 on success,
1005 * otherwise a negative error value
1007 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
1008 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
1010 int package_manager_request_set_mode(package_manager_request_h request,
1011 package_manager_request_mode_e mode);
1015 * @brief Sets the path of TEP file to the request. The TEP file that is set will be installed when the package is installed.
1016 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
1017 * @privlevel platform
1018 * @privilege %http://tizen.org/privilege/packagemanager.admin
1019 * @param[in] request The request handle
1020 * @param[in] tep_path The tep path to set. If this is NULL on update, installed tep will be removed.
1021 * @return 0 on success, 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 * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR Severe system error
1027 int package_manager_request_set_tep(package_manager_request_h request,
1028 const char *tep_path);
1032 * @brief Installs the package located at the given path.
1033 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1034 * @privlevel platform
1035 * @privilege %http://tizen.org/privilege/packagemanager.admin
1036 * @param[in] request The request handle
1037 * @param[in] path The absolute path to the package to be installed
1038 * @param[out] id The ID of the request to the package manager
1040 * @return @c 0 on success,
1041 * otherwise a negative error value
1043 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
1044 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
1045 * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
1046 * @see package_manager_request_uninstall()
1048 int package_manager_request_install(package_manager_request_h request,
1049 const char *path, int *id);
1053 * @brief Uninstalls the package with the given name.
1054 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1055 * @privlevel platform
1056 * @privilege %http://tizen.org/privilege/packagemanager.admin
1057 * @param[in] request The request handle
1058 * @param[in] name The name of the package to be uninstalled
1059 * @param[out] id The ID of the request to the package manager
1061 * @return @c 0 on success,
1062 * otherwise a negative error value
1064 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
1065 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
1066 * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
1068 int package_manager_request_uninstall(package_manager_request_h request,
1069 const char *name, int *id);
1073 * @brief Moves the package from SD card to the internal memory and vice versa.
1074 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1075 * @privlevel platform
1076 * @privilege %http://tizen.org/privilege/packagemanager.admin
1077 * @param[in] request The request handle
1078 * @param[in] name The name of the package to be moved
1079 * @param[in] move_type The move type [enum package_manager_move_type_e], [external to internal/internal to external]
1081 * @return @c 0 on success,
1082 * 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_PERMISSION_DENIED Permission denied
1088 int package_manager_request_move(package_manager_request_h request,
1089 const char *name, package_manager_move_type_e move_type);
1099 #endif /* __TIZEN_APPFW_PACKAGE_MANAGER_H */