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 /**< Permisson 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 */
92 /* These enum will be deprecated. Use above enum instead. */
93 PACAKGE_MANAGER_EVENT_TYPE_INSTALL = 0,
94 PACAKGE_MANAGER_EVENT_TYPE_UNINSTALL,
95 PACAKGE_MANAGER_EVENT_TYPE_UPDATE,
96 } package_manager_event_type_e;
99 * @brief Enumeration for event state.
100 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
103 PACKAGE_MANAGER_EVENT_STATE_STARTED = 0, /**< Started event state */
104 PACKAGE_MANAGER_EVENT_STATE_PROCESSING, /**< Processing event state */
105 PACKAGE_MANAGER_EVENT_STATE_COMPLETED, /**< Completed event state */
106 PACKAGE_MANAGER_EVENT_STATE_FAILED, /**< Failed event state */
108 /* These enum will be deprecated. Use above enum instead. */
109 PACAKGE_MANAGER_EVENT_STATE_STARTED = 0,
110 PACAKGE_MANAGER_EVENT_STATE_PROCESSING,
111 PACAKGE_MANAGER_EVENT_STATE_COMPLETED,
112 PACAKGE_MANAGER_EVENT_STATE_FAILED,
113 } package_manager_event_state_e;
116 * @brief Enumeration for move type.
117 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
120 PACKAGE_MANAGER_REQUEST_MOVE_TO_INTERNAL = 0, /**< Internal type */
121 PACKAGE_MANAGER_REQUEST_MOVE_TO_EXTERNAL, /**< External type */
123 /* These enum will be deprecated. Use above enum instead. */
124 PACAKGE_MANAGER_REQUEST_MOVE_TO_INTERNAL = 0,
125 PACAKGE_MANAGER_REQUEST_MOVE_TO_EXTERNAL,
126 } package_manager_move_type_e;
129 * @brief Enumeration for certification compare type.
130 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
133 PACKAGE_MANAGER_COMPARE_MATCH = 0, /**< Matching certification */
134 PACKAGE_MANAGER_COMPARE_MISMATCH, /**< Mismatching certification */
135 PACKAGE_MANAGER_COMPARE_LHS_NO_CERT, /**< First package has no certification */
136 PACKAGE_MANAGER_COMPARE_RHS_NO_CERT, /**< Second package has no certification */
137 PACKAGE_MANAGER_COMPARE_BOTH_NO_CERT, /**< Both have no certification */
139 /* These enum will be deprecated. Use above enum instead. */
140 PACAKGE_MANAGER_COMPARE_MATCH = 0,
141 PACAKGE_MANAGER_COMPARE_MISMATCH,
142 PACAKGE_MANAGER_COMPARE_LHS_NO_CERT,
143 PACAKGE_MANAGER_COMPARE_RHS_NO_CERT,
144 PACAKGE_MANAGER_COMPARE_BOTH_NO_CERT,
145 } package_manager_compare_result_type_e;
148 * @brief Enumeration for permission type.
149 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
152 PACKAGE_MANAGER_PERMISSION_NORMAL = 0, /**< Normal permission */
153 PACKAGE_MANAGER_PERMISSION_SIGNATURE, /**< Signature permission */
154 PACKAGE_MANAGER_PERMISSION_PRIVILEGE, /**< Privilege permission */
155 } package_manager_permission_type_e;
158 * @brief Enumeration for status type.
159 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
162 PACKAGE_MANAGER_STATUS_TYPE_ALL = 0x00, /**< All status */
163 PACKAGE_MANAGER_STATUS_TYPE_INSTALL = 0x01, /**< Install package status */
164 PACKAGE_MANAGER_STATUS_TYPE_UNINSTALL = 0x02, /**< Uninstall package status */
165 PACKAGE_MANAGER_STATUS_TYPE_UPGRADE = 0x04, /**< Upgrade package status */
166 PACKAGE_MANAGER_STATUS_TYPE_MOVE = 0x08, /**< Move package status */
167 PACKAGE_MANAGER_STATUS_TYPE_CLEAR_DATA = 0x10, /**< Clear data status */
168 PACKAGE_MANAGER_STATUS_TYPE_INSTALL_PROGRESS = 0x20, /**< Install progress status */
169 PACKAGE_MANAGER_STATUS_TYPE_GET_SIZE = 0x40, /**< Get size status */
170 } package_manager_status_type_e;
173 * @brief The Package manager handle.
174 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
176 typedef struct package_manager_s *package_manager_h;
179 * @brief Package manager filter handle.
180 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
182 typedef struct package_manager_filter_s *package_manager_filter_h;
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
188 * @param[in] type The type of the package to be installed, uninstalled or updated
189 * @param[in] package The name of the package to be installed, uninstalled or updated
190 * @param[in] event_type The type of the request to the package manager
191 * @param[in] event_state The current state of the request to the package manager
192 * @param[in] progress The progress for the request that is being processed by the package manager \n
193 * The range of progress is from @c 0 to @c 100.
194 * @param[in] error The error code when the package manager failed to process the request
195 * @param[in] user_data The user data passed from package_manager_set_event_cb()
197 * @see package_manager_set_event_cb()
198 * @see package_manager_unset_event_cb()
200 typedef void (*package_manager_event_cb) (
203 package_manager_event_type_e event_type,
204 package_manager_event_state_e event_state,
206 package_manager_error_e error,
210 * @brief Creates a package manager handle.
211 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
213 * @privilege %http://tizen.org/privilege/packagemanager.info
214 * @remarks You must release @a manager using package_manager_destroy().
216 * @param[out] manager The package manager handle that is newly created on success
218 * @return @c 0 on success,
219 * otherwise a negative error value
221 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
222 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
223 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
224 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR Internal I/O error
225 * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
226 * @see package_manager_destroy()
228 int package_manager_create(package_manager_h *manager);
231 * @brief Destroys the package manager handle.
232 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
234 * @param[in] manager The package manager handle
236 * @return @c 0 on success,
237 * otherwise a negative error value
239 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
240 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
242 * @see package_manager_create()
244 int package_manager_destroy(package_manager_h manager);
247 * @brief Sets the event status of the package when the package is installed, uninstalled or updated.
248 * You can combine multiple status using OR operation which you want to listen.
249 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
251 * @param [in] manager The package manager handle
252 * @param [in] status_type The status of the package
254 * @return @c 0 on success,
255 * otherwise a negative error value
257 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
258 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
259 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR Internal I/O error
261 * @see package_manager_status_type_e
262 * @see package_manager_set_event_cb()
264 int package_manager_set_event_status(package_manager_h manager, int status_type);
267 * @brief Registers a callback function to be invoked when the package is installed, uninstalled or updated.
268 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
270 * @privilege %http://tizen.org/privilege/packagemanager.info
271 * @param[in] manager The package manager handle
272 * @param[in] callback The callback function to be registered
273 * @param[in] user_data The user data to be passed to the callback function
275 * @return @c 0 on success,
276 * otherwise a negative error value
278 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
279 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
280 * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
281 * @post package_manager_event_cb() will be invoked.
283 * @see package_manager_set_event_status()
284 * @see package_manager_event_cb()
285 * @see package_manager_unset_event_cb()
287 int package_manager_set_event_cb(package_manager_h manager,
288 package_manager_event_cb callback,
292 * @brief Unregisters the callback function.
293 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
295 * @param[in] manager The package manager handle
297 * @return @c 0 on success,
298 * otherwise a negative error value
300 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
301 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
303 * @see package_manager_event_cb()
304 * @see package_manager_set_event_cb()
306 int package_manager_unset_event_cb(package_manager_h manager);
309 * @brief Called to retrieve all packages.
310 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
312 * @param[in] package_info The package information
313 * @param[in] user_data The user data passed from the foreach function
315 * @return @c true to continue with the next iteration of the loop,
316 * otherwise @c false to break out of the loop
318 * @see package_manager_foreach_package_info()
320 typedef bool (*package_manager_package_info_cb) (
321 package_info_h package_info,
325 * @brief Retrieves all package information of installed packages.
326 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
328 * @privilege %http://tizen.org/privilege/packagemanager.info
329 * @param[in] callback The callback function to be invoked
330 * @param[in] user_data The user data to be passed to the callback function
332 * @return @c 0 on success,
333 * otherwise a negative error value
335 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
336 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
337 * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
338 * @post This function invokes package_manager_package_info_cb() repeatedly for each package information.
340 * @see package_manager_package_info_cb()
342 int package_manager_foreach_package_info(package_manager_package_info_cb callback,
346 * @brief Gets the package ID for the given app ID.
347 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
349 * @privilege %http://tizen.org/privilege/packagemanager.info
350 * @param[in] app_id The ID of the application
351 * @param[out] package_id The ID of the package
353 * @return @c 0 on success,
354 * otherwise a negative error value
356 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
357 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
358 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
359 * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
361 int package_manager_get_package_id_by_app_id(const char *app_id, char **package_id);
364 * @brief Gets the package information for the given package.
365 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
367 * @privilege %http://tizen.org/privilege/packagemanager.info
368 * @remarks You must release @a package_info using package_info_destroy().
370 * @param[in] package_id The ID of the package
371 * @param[out] package_info The package information for the given package ID
373 * @return @c 0 on success,
374 * otherwise a negative error value
376 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
377 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
378 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
379 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR Database error occurred
380 * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
382 int package_manager_get_package_info(const char *package_id, package_info_h *package_info);
386 * @brief Compares whether two package certifications are matched.
387 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
389 * @param[in] lhs_package_id The first package ID to compare
390 * @param[in] rhs_package_id The second package ID to compare
391 * @param[out] compare_result @c 0 if the certification information are matched,
392 * otherwise the compared result
394 * @return @c 0 on success,
395 * otherwise a negative error value
397 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
398 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
399 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
400 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR Database error occurred
402 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);
405 * @brief Compares whether two app certifications are matched.
406 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
408 * @param[in] lhs_app_id The first app ID to compare
409 * @param[in] rhs_app_id The second app ID to compare
410 * @param[out] compare_result @c 0 if the certification information are matched,
411 * otherwise the compared result
413 * @return @c 0 on success,
414 * otherwise a negative error value
416 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
417 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
418 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
419 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR Database error occurred
421 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);
424 * @brief Checks whether the package is preloaded by @a app_id.
425 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
427 * @privilege %http://tizen.org/privilege/packagemanager.info
428 * @param[in] app_id The ID of the application
429 * @param[out] preload The preload info of the package
431 * @return @c 0 on success,
432 * otherwise a negative error value
434 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
435 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
436 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
437 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
438 * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
440 int package_manager_is_preload_package_by_app_id(const char *app_id, bool *preload);
443 * @brief Gets the package permission type by @a app_id.
444 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
446 * @privilege %http://tizen.org/privilege/packagemanager.info
447 * @param[in] app_id The ID of the application
448 * @param[out] permission_type The package permission type
450 * @return @c 0 on success,
451 * otherwise a negative error value
453 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
454 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
455 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
456 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
457 * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
459 int package_manager_get_permission_type(const char *app_id, package_manager_permission_type_e *permission_type);
462 * @brief Clears the application's internal and external cache directory.
463 * @details All files stored in the cache directory of the application specified with the
464 * package ID are removed.
466 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
468 * @privilege %http://tizen.org/privilege/packagemanager.clearcache
470 * @param[in] package_id The package ID
472 * @return @c 0 on success,
473 * otherwise a negative error value
475 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
476 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
477 * @retval #PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE No such package
478 * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
479 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
480 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
481 * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR Severe system error
483 int package_manager_clear_cache_dir(const char *package_id);
487 * @brief Clears all applications' internal and external cache directory.
488 * @details All files stored in the cache directory of each application are removed.
490 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
491 * @privlevel platform
492 * @privilege %http://tizen.org/privilege/packagemanager.admin
494 * @return @c 0 on success,
495 * otherwise a negative error value
497 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
498 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
499 * @retval #PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE No such package
500 * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
501 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
502 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
503 * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR Severe system error
505 int package_manager_clear_all_cache_dir(void);
508 * @brief The handle for the package size information.
509 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
511 typedef struct package_size_info *package_size_info_h;
514 * @brief Called when the package size information is obtained.
515 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
517 * @param[in] package_id The package ID
518 * @param[in] size_info The pointer to the structure including the package size information
519 * @param[in] user_data The user data to be passed to the callback function
521 typedef void (*package_manager_size_info_receive_cb)(const char *package_id, const package_size_info_h size_info, void *user_data);
525 * @brief Called when the total package size information is obtained.
526 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
528 * @param[in] size_info The pointer to the structure including the package size information
529 * @param[in] user_data The user data to be passed to the callback function
531 typedef void (*package_manager_total_size_info_receive_cb)(const package_size_info_h size_info, void *user_data);
534 * @brief Gets the package size information.
535 * @details The package size info is asynchronously obtained by the callback function.
537 * @privilege %http://tizen.org/privilege/packagemanager.info
539 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
541 * @param[in] package_id The package ID
542 * @param[in] callback The asynchronous callback function to get the package size information
543 * @param[in] user_data The user data to be passed to the callback function
545 * @return @c 0 on success,
546 * otherwise a negative error value
548 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
549 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
550 * @retval #PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE No such package
551 * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permision denied
552 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
553 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
554 * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR Severe system error
556 int package_manager_get_package_size_info(const char *package_id, package_manager_size_info_receive_cb callback, void *user_data);
560 * @brief Gets the total package size information.
561 * @details The total package size info is asynchronously obtained by the callback function.
562 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
564 * @privilege %http://tizen.org/privilege/packagemanager.info
566 * @param [in] callback The asynchronous callback function to get the total package size information
567 * @param [in] user_data The user data to be passed to the callback function
569 * @return @c 0 on success,
570 * otherwise a negative error value
572 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
573 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
574 * @retval #PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE No such package
575 * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
576 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
577 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
578 * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR Severe system error
580 int package_manager_get_total_package_size_info(package_manager_total_size_info_receive_cb callback, void *user_data);
583 * @brief Creates the package information filter handle from db.
584 * @details All filter properties will be ANDed.
585 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
587 * @privilege %http://tizen.org/privilege/packagemanager.info
589 * @param[out] handle Pointer to the package info filter handle.
591 * @return @c 0 on success,
592 * otherwise a negative error value
594 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
595 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
596 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
597 * @post package_manager_filter_destroy()
598 * @see package_manager_filter_add_bool()
599 * @see package_manager_filter_foreach_pkginfo()
601 int package_manager_filter_create(package_manager_filter_h *handle);
604 * @brief This API destroys the package information filter handle freeing up all the resources
605 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
607 * @param[in] handle Pointer to the package info filter handle.
609 * @return @c 0 on success,
610 * 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 * @see package_manager_filter_count()
617 * @see package_manager_filter_foreach_package_info()
619 int package_manager_filter_destroy(package_manager_filter_h handle);
622 * @brief This API adds a boolean filter property to the filter handle
623 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
625 * @param[in] handle Pointer to the package info filter handle.
626 * @param[in] property boolean property name.
627 * @param[in] value value corresponding to the property.
629 * @return @c 0 on success,
630 * 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 * @see package_manager_filter_count()
638 * @see package_manager_filter_foreach_package_info()
640 int package_manager_filter_add_bool(package_manager_filter_h handle,
641 const char *property, const bool value);
644 * @brief This API counts the package that satisfy the filter conditions
645 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
647 * @privilege %http://tizen.org/privilege/packagemanager.info
649 * @param[in] handle Pointer to the package info filter handle.
650 * @param[out] count Pointer to store the count value.
652 * @return @c 0 on success,
653 * otherwise a negative error value
655 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
656 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
657 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
658 * @pre package_manager_filter_create()
659 * @post package_manager_filter_destroy()
660 * @see package_manager_filter_foreach_package_info()
662 int package_manager_filter_count(package_manager_filter_h handle, int *count);
665 * @brief This API executes the user supplied callback function for each package that satisfy the filter conditions
666 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
668 * @privilege %http://tizen.org/privilege/packagemanager.info
670 * @param[in] handle Pointer to the package info filter handle.
671 * @param[in] callback callback function.
672 * @param[in] user_data user data to be passed to the callback function
674 * @return @c 0 on success,
675 * otherwise a negative error value
677 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
678 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
679 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
680 * @pre package_manager_filter_create()
681 * @post package_manager_filter_destroy()
682 * @post This function invokes package_manager_package_info_cb() repeatedly for each package information.
683 * @see package_manager_package_info_cb()
684 * @see package_manager_filter_count()
686 int package_manager_filter_foreach_package_info(package_manager_filter_h handle,
687 package_manager_package_info_cb callback, void *user_data);
691 * @brief Generates request for getting License
692 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
693 * @privlevel platform
694 * @privilege %http://tizen.org/privilege/packagemanager.admin
695 * @param[in] resp_data The response data string of the purchase request
696 * @param[out] req_data License request data
697 * @param[out] license_url License acquisition url data
698 * @remarks You must release @a req_data and @a license_url by yourself.
699 * @return 0 on success, otherwise a negative error value
700 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
701 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
702 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
703 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR Internal I/O error
704 * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
705 * @post package_manager_drm_register_license
707 int package_manager_drm_generate_license_request(const char *resp_data, char **req_data, char **license_url);
711 * @brief Registers encrypted license
712 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
713 * @privlevel platform
714 * @privilege %http://tizen.org/privilege/packagemanager.admin
715 * @param[in] resp_data The response data string of the rights request
716 * @return 0 on success, otherwise a negative error value
717 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
718 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
719 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR Internal I/O error
720 * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
721 * @pre package_manager_drm_generate_license_request
723 int package_manager_drm_register_license(const char *resp_data);
727 * @brief Decrypts contents which is encrypted
728 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
729 * @privlevel platform
730 * @privilege %http://tizen.org/privilege/packagemanager.admin
731 * @param[in] drm_file_path DRM file path
732 * @param[in] decrypted_file_path Decrypted file path
733 * @return 0 on success, otherwise a negative error value
734 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
735 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
736 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR Internal I/O error
737 * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
739 int package_manager_drm_decrypt_package(const char *drm_file_path, const char *decrypted_file_path);
742 * @brief Retrieves data size from given handle
744 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
746 * @param[in] handle Package size info handle
747 * @param[out] data_size Data size will be returned
749 * @return @c 0 on success,
750 * otherwise a negative error value
752 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
753 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
755 int package_size_info_get_data_size(package_size_info_h handle, long long *data_size);
758 * @brief Retrieves cache size from given handle
760 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
762 * @param[in] handle Package size info handle
763 * @param[out] cache_size Cache size will be returned
765 * @return @c 0 on success,
766 * otherwise a negative error value
768 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
769 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
771 int package_size_info_get_cache_size(package_size_info_h handle, long long *cache_size);
774 * @brief Retrieves application size from given handle
776 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
778 * @param[in] handle Package size info handle
779 * @param[out] app_size App size will be returned
781 * @return @c 0 on success,
782 * otherwise a negative error value
784 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
785 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
787 int package_size_info_get_app_size(package_size_info_h handle, long long *app_size);
790 * @brief Retrieves external data size from given handle
792 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
794 * @param[in] handle Package size info handle
795 * @param[out] ext_data_size External data size will be returned
797 * @return @c 0 on success,
798 * otherwise a negative error value
800 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
801 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
803 int package_size_info_get_external_data_size(package_size_info_h handle, long long *ext_data_size);
807 * @brief Retrieves external cache size from given handle
809 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
811 * @param[in] handle Package size info handle
812 * @param[out] ext_cache_size External cache size will be returned
814 * @return @c 0 on success,
815 * otherwise a negative error value
817 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
818 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
820 int package_size_info_get_external_cache_size(package_size_info_h handle, long long *ext_cache_size);
824 * @brief Retrieves external application size from given handle
826 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
828 * @param[in] handle Package size info handle
829 * @param[out] ext_app_size External app size will be returned
831 * @return @c 0 on success,
832 * otherwise a negative error value
834 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
835 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
837 int package_size_info_get_external_app_size(package_size_info_h handle, long long *ext_app_size);
844 * @addtogroup CAPI_PACKAGE_REQUEST_MODULE
850 * @brief Enumeration for request mode.
851 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
854 PACKAGE_MANAGER_REQUEST_MODE_DEFAULT = 0, /**< @platform Default request mode */
855 PACKAGE_MANAGER_REQUEST_MODE_QUIET, /**< @platform Quiet request mode */
857 /* These enum will be deprecated. Use above enum instead. */
858 PACAKGE_MANAGER_REQUEST_MODE_DEFAULT = 0,
859 PACAKGE_MANAGER_REQUEST_MODE_QUIET,
860 } package_manager_request_mode_e;
864 * @brief The Package manager request handle.
865 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
867 typedef struct package_manager_request_s *package_manager_request_h;
871 * @brief Called when the progress of the request to the package manager changes.
872 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
874 * @param[in] id The ID of the request to the package manager
875 * @param[in] type The type of the package to install, uninstall or update
876 * @param[in] package The name of the package to install, uninstall or update
877 * @param[in] event_type The type of the request to the package manager
878 * @param[in] event_state The current state of the request to the package manager
879 * @param[in] progress The progress for the request that is being processed by the package manager \n
880 * The range of progress is from @c 0 to @c 100.
881 * @param[in] error The error code when the package manager failed to process the request
882 * @param[in] user_data The user data passed from package_manager_request_set_event_cb()
884 * @see package_manager_request_set_event_cb()
885 * @see package_manager_request_unset_event_cb()
887 typedef void (*package_manager_request_event_cb) (
891 package_manager_event_type_e event_type,
892 package_manager_event_state_e event_state,
894 package_manager_error_e error,
899 * @brief Creates a request handle to the package manager.
900 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
902 * @remarks You must release @a request using package_manager_request_destroy().
904 * @param[out] request The request handle that is newly created on success
906 * @return @c 0 on success,
907 * otherwise a negative error value
909 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
910 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
911 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
912 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR Internal I/O error
914 * @see package_manager_request_destroy()
916 int package_manager_request_create(package_manager_request_h *request);
920 * @brief Destroys the request handle to the package manager.
921 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
923 * @param[in] request The request handle to the package manager
925 * @return @c 0 on success,
926 * otherwise a negative error value
928 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
929 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
931 * @see package_manager_request_create()
933 int package_manager_request_destroy(package_manager_request_h request);
937 * @brief Registers a callback function to be invoked when the progress of the request changes.
938 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
940 * @privilege %http://tizen.org/privilege/packagemanager.info
941 * @param[in] request The request handle
942 * @param[in] callback The callback function to be registered
943 * @param[in] user_data The user data to be passed to the callback function
945 * @return @c 0 on success,
946 * otherwise a negative error value
948 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
949 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
950 * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
951 * @post package_manager_request_event_cb() will be invoked.
953 * @see package_manager_request_event_cb()
954 * @see package_manager_request_unset_event_cb()
956 int package_manager_request_set_event_cb(package_manager_request_h request,
957 package_manager_request_event_cb callback, void *user_data);
961 * @brief Unregisters the callback function.
962 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
964 * @param[in] request The request handle
966 * @return @c 0 on success,
967 * otherwise a negative error value
969 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
970 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
972 * @see package_manager_request_event_cb()
973 * @see package_manager_request_set_event_cb()
975 int package_manager_request_unset_event_cb(package_manager_request_h request);
979 * @brief Sets the type of the package to install, uninstall or update.
980 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
982 * @param[in] request The request handle
983 * @param[in] type The type of the package
985 * @return @c 0 on success,
986 * otherwise a negative error value
988 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
989 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
991 int package_manager_request_set_type(package_manager_request_h request,
996 * @brief Sets the mode of the request.
997 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
999 * @param[in] request The request handle
1000 * @param[in] mode The mode of the request
1002 * @return @c 0 on success,
1003 * otherwise a negative error value
1005 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
1006 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
1008 int package_manager_request_set_mode(package_manager_request_h request,
1009 package_manager_request_mode_e mode);
1013 * @brief Sets the path of TEP file to the request. The TEP file that is set will be installed when the package is installed.
1014 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
1015 * @privlevel platform
1016 * @privilege %http://tizen.org/privilege/packagemanager.admin
1017 * @param[in] request The request handle
1018 * @param[in] tep_path The tep path to set. If this is NULL on update, installed tep will be removed.
1019 * @return 0 on success, otherwise a negative error value
1020 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
1021 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
1022 * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
1023 * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR Severe system error
1025 int package_manager_request_set_tep(package_manager_request_h request,
1026 const char *tep_path);
1030 * @brief Installs the package located at the given path.
1031 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1032 * @privlevel platform
1033 * @privilege %http://tizen.org/privilege/packagemanager.admin
1034 * @param[in] request The request handle
1035 * @param[in] path The absolute path to the package to be installed
1036 * @param[out] id The ID of the request to the package manager
1038 * @return @c 0 on success,
1039 * otherwise a negative error value
1041 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
1042 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
1043 * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
1044 * @see package_manager_request_uninstall()
1046 int package_manager_request_install(package_manager_request_h request,
1047 const char *path, int *id);
1051 * @brief Uninstalls the package with the given name.
1052 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1053 * @privlevel platform
1054 * @privilege %http://tizen.org/privilege/packagemanager.admin
1055 * @param[in] request The request handle
1056 * @param[in] name The name of the package to be uninstalled
1057 * @param[out] id The ID of the request to the package manager
1059 * @return @c 0 on success,
1060 * otherwise a negative error value
1062 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
1063 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
1064 * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
1066 int package_manager_request_uninstall(package_manager_request_h request,
1067 const char *name, int *id);
1071 * @brief Moves the package from SD card to the internal memory and vice versa.
1072 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1073 * @privlevel platform
1074 * @privilege %http://tizen.org/privilege/packagemanager.admin
1075 * @param[in] request The request handle
1076 * @param[in] name The name of the package to be moved
1077 * @param[in] move_type The move type [enum package_manager_move_type_e], [external to internal/internal to external]
1079 * @return @c 0 on success,
1080 * otherwise a negative error value
1082 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
1083 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
1084 * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
1086 int package_manager_request_move(package_manager_request_h request,
1087 const char *name, package_manager_move_type_e move_type);
1097 #endif /* __TIZEN_APPFW_PACKAGE_MANAGER_H */