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 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
43 #define PACKAGE_MANAGER_PKGINFO_PROP_REMOVABLE "PMINFO_PKGINFO_PROP_PACKAGE_REMOVABLE"
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
50 #define PACKAGE_MANAGER_PKGINFO_PROP_READONLY "PMINFO_PKGINFO_PROP_PACKAGE_READONLY"
54 * @brief Definiton 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
57 #define PACKAGE_MANAGER_PKGINFO_PROP_SUPPORT_DISABLE "PMINFO_PKGINFO_PROP_PACKAGE_SUPPORT_DISABLE"
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
64 #define PACKAGE_MANAGER_PKGINFO_PROP_DISABLE "PMINFO_PKGINFO_PROP_PACKAGE_DISABLE"
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
71 #define PACKAGE_MANAGER_PKGINFO_PROP_PRELOAD "PMINFO_PKGINFO_PROP_PACKAGE_PRELOAD"
75 * @brief Enumeration for error code.
76 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
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;
90 * @brief Enumeration for event type.
91 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
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) */
100 /* These enum will be deprecated. Use above enum instead. */
101 PACAKGE_MANAGER_EVENT_TYPE_INSTALL = 0,
102 PACAKGE_MANAGER_EVENT_TYPE_UNINSTALL,
103 PACAKGE_MANAGER_EVENT_TYPE_UPDATE,
104 } package_manager_event_type_e;
108 * @brief Enumeration for event state.
109 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
112 PACKAGE_MANAGER_EVENT_STATE_STARTED = 0, /**< Started event state */
113 PACKAGE_MANAGER_EVENT_STATE_PROCESSING, /**< Processing event state */
114 PACKAGE_MANAGER_EVENT_STATE_COMPLETED, /**< Completed event state */
115 PACKAGE_MANAGER_EVENT_STATE_FAILED, /**< Failed event state */
117 /* These enum will be deprecated. Use above enum instead. */
118 PACAKGE_MANAGER_EVENT_STATE_STARTED = 0,
119 PACAKGE_MANAGER_EVENT_STATE_PROCESSING,
120 PACAKGE_MANAGER_EVENT_STATE_COMPLETED,
121 PACAKGE_MANAGER_EVENT_STATE_FAILED,
122 } package_manager_event_state_e;
126 * @brief Enumeration for move type.
127 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
130 PACKAGE_MANAGER_REQUEST_MOVE_TO_INTERNAL = 0, /**< Internal type */
131 PACKAGE_MANAGER_REQUEST_MOVE_TO_EXTERNAL, /**< External type */
133 /* These enum will be deprecated. Use above enum instead. */
134 PACAKGE_MANAGER_REQUEST_MOVE_TO_INTERNAL = 0,
135 PACAKGE_MANAGER_REQUEST_MOVE_TO_EXTERNAL,
136 } package_manager_move_type_e;
140 * @brief Enumeration for certification compare type.
141 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
144 PACKAGE_MANAGER_COMPARE_MATCH = 0, /**< Matching certification */
145 PACKAGE_MANAGER_COMPARE_MISMATCH, /**< Mismatching certification */
146 PACKAGE_MANAGER_COMPARE_LHS_NO_CERT, /**< First package has no certification */
147 PACKAGE_MANAGER_COMPARE_RHS_NO_CERT, /**< Second package has no certification */
148 PACKAGE_MANAGER_COMPARE_BOTH_NO_CERT, /**< Both have no certification */
150 /* These enum will be deprecated. Use above enum instead. */
151 PACAKGE_MANAGER_COMPARE_MATCH = 0,
152 PACAKGE_MANAGER_COMPARE_MISMATCH,
153 PACAKGE_MANAGER_COMPARE_LHS_NO_CERT,
154 PACAKGE_MANAGER_COMPARE_RHS_NO_CERT,
155 PACAKGE_MANAGER_COMPARE_BOTH_NO_CERT,
156 } package_manager_compare_result_type_e;
160 * @brief Enumeration for permission type.
161 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
164 PACKAGE_MANAGER_PERMISSION_NORMAL = 0, /**< Normal permission */
165 PACKAGE_MANAGER_PERMISSION_SIGNATURE, /**< Signature permission */
166 PACKAGE_MANAGER_PERMISSION_PRIVILEGE, /**< Privilege permission */
167 } package_manager_permission_type_e;
171 * @brief Enumeration for status type.
172 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
175 PACKAGE_MANAGER_STATUS_TYPE_ALL = 0x00, /**< All status */
176 PACKAGE_MANAGER_STATUS_TYPE_INSTALL = 0x01, /**< Install package status */
177 PACKAGE_MANAGER_STATUS_TYPE_UNINSTALL = 0x02, /**< Uninstall package status */
178 PACKAGE_MANAGER_STATUS_TYPE_UPGRADE = 0x04, /**< Upgrade package status */
179 PACKAGE_MANAGER_STATUS_TYPE_MOVE = 0x08, /**< Move package status */
180 PACKAGE_MANAGER_STATUS_TYPE_CLEAR_DATA = 0x10, /**< Clear data status */
181 PACKAGE_MANAGER_STATUS_TYPE_INSTALL_PROGRESS = 0x20, /**< Install progress status */
182 PACKAGE_MANAGER_STATUS_TYPE_GET_SIZE = 0x40, /**< Get size status */
183 } package_manager_status_type_e;
187 * @brief The Package manager handle.
188 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
190 typedef struct package_manager_s *package_manager_h;
194 * @brief Package manager filter handle.
195 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
197 typedef struct package_manager_filter_s *package_manager_filter_h;
201 * @brief Called when the package is installed, uninstalled, or updated, and the progress of the request to the package manager changes.
202 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
203 * @param[in] type The type of the package to be installed, uninstalled, or updated
204 * @param[in] package The name of the package to be installed, uninstalled, or updated
205 * @param[in] event_type The type of the request to the package manager
206 * @param[in] event_state The current state of the request to the package manager
207 * @param[in] progress The progress for the request that is being processed by the package manager \n
208 * The range of progress is from @c 0 to @c 100
209 * @param[in] error The error code when the package manager failed to process the request
210 * @param[in] user_data The user data passed from package_manager_set_event_cb()
211 * @see package_manager_set_event_cb()
212 * @see package_manager_unset_event_cb()
214 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);
218 * @brief Creates a package manager handle.
219 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
221 * @privilege %http://tizen.org/privilege/packagemanager.info
222 * @remarks You must release @a manager using package_manager_destroy().
223 * @param[out] manager The package manager handle that is newly created on success
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 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
229 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR Internal I/O error
230 * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
231 * @see package_manager_destroy()
233 int package_manager_create(package_manager_h *manager);
237 * @brief Destroys the package manager handle.
238 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
239 * @param[in] manager The package manager handle
240 * @return @c 0 on success,
241 * otherwise a negative error value
242 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
243 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
244 * @see package_manager_create()
246 int package_manager_destroy(package_manager_h manager);
250 * @brief Sets the event status of the package when the package is installed, uninstalled, or updated.
251 * @details You can combine multiple status using OR operation which you want to listen.
252 * @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
255 * @return @c 0 on success,
256 * 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
260 * @see package_manager_status_type_e
261 * @see package_manager_set_event_cb()
263 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
274 * @return @c 0 on success,
275 * otherwise a negative error value
276 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
277 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
278 * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
279 * @post package_manager_event_cb() will be invoked.
280 * @see package_manager_set_event_status()
281 * @see package_manager_event_cb()
282 * @see package_manager_unset_event_cb()
284 int package_manager_set_event_cb(package_manager_h manager, package_manager_event_cb callback, void *user_data);
288 * @brief Unregisters the callback function.
289 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
290 * @param[in] manager The package manager handle
291 * @return @c 0 on success,
292 * otherwise a negative error value
293 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
294 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
295 * @see package_manager_event_cb()
296 * @see package_manager_set_event_cb()
298 int package_manager_unset_event_cb(package_manager_h manager);
302 * @brief Called to retrieve all packages.
303 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
304 * @param[in] package_info The package information
305 * @param[in] user_data The user data passed from the foreach function
306 * @return @c true to continue with the next iteration of the loop,
307 * otherwise @c false to break out of the loop
308 * @see package_manager_foreach_package_info()
310 typedef bool (*package_manager_package_info_cb) ( package_info_h package_info, void *user_data);
314 * @brief Retrieves all package information of installed packages.
315 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
317 * @privilege %http://tizen.org/privilege/packagemanager.info
318 * @param[in] callback The callback function to be invoked
319 * @param[in] user_data The user data to be passed to the callback function
320 * @return @c 0 on success,
321 * otherwise a negative error value
322 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
323 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
324 * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
325 * @post This function invokes package_manager_package_info_cb() repeatedly for each package information.
326 * @see package_manager_package_info_cb()
328 int package_manager_foreach_package_info(package_manager_package_info_cb callback, void *user_data);
332 * @brief Gets the package ID for the given app ID.
333 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
335 * @privilege %http://tizen.org/privilege/packagemanager.info
336 * @param[in] app_id The ID of the application
337 * @param[out] package_id The ID of the package
338 * @return @c 0 on success,
339 * otherwise a negative error value
340 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
341 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
342 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
343 * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
345 int package_manager_get_package_id_by_app_id(const char *app_id, char **package_id);
349 * @brief Gets the package information for the given package.
350 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
352 * @privilege %http://tizen.org/privilege/packagemanager.info
353 * @remarks You must release @a package_info using package_info_destroy().
354 * @param[in] package_id The ID of the package
355 * @param[out] package_info The package information for the given package ID
356 * @return @c 0 on success,
357 * 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_IO_ERROR Database error occurred
362 * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
364 int package_manager_get_package_info(const char *package_id, package_info_h *package_info);
368 * @brief Compares whether two package certifications are matched.
369 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
370 * @param[in] lhs_package_id The first package ID to compare
371 * @param[in] rhs_package_id The second package ID to compare
372 * @param[out] compare_result @c 0 if the certification information are matched,
373 * otherwise the compared result
374 * @return @c 0 on success,
375 * 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
381 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);
385 * @brief Compares whether two app certifications are matched.
386 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
387 * @param[in] lhs_app_id The first app ID to compare
388 * @param[in] rhs_app_id The second app ID to compare
389 * @param[out] compare_result @c 0 if the certification information are matched,
390 * otherwise the compared result
391 * @return @c 0 on success,
392 * otherwise a negative error value
393 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
394 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
395 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
396 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR Database error occurred
398 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);
402 * @brief Checks whether the package is preloaded by @a app_id.
403 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
405 * @privilege %http://tizen.org/privilege/packagemanager.info
406 * @param[in] app_id The ID of the application
407 * @param[out] preload The preload info of the package
408 * @return @c 0 on success,
409 * otherwise a negative error value
410 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
411 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
412 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
413 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
414 * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
416 int package_manager_is_preload_package_by_app_id(const char *app_id, bool *preload);
420 * @brief Gets the package permission type by @a app_id.
421 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
423 * @privilege %http://tizen.org/privilege/packagemanager.info
424 * @param[in] app_id The ID of the application
425 * @param[out] permission_type The package permission type
426 * @return @c 0 on success,
427 * otherwise a negative error value
428 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
429 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
430 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
431 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
432 * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
434 int package_manager_get_permission_type(const char *app_id, package_manager_permission_type_e *permission_type);
438 * @brief Clears the application's internal and external cache directory.
439 * @details All files stored in the cache directory of the application specified with the package ID are removed.
440 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
442 * @privilege %http://tizen.org/privilege/packagemanager.clearcache
443 * @param[in] package_id The package ID
444 * @return @c 0 on success,
445 * otherwise a negative error value
446 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
447 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
448 * @retval #PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE No such package
449 * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
450 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
451 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
452 * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR Severe system error
454 int package_manager_clear_cache_dir(const char *package_id);
458 * @brief Clears all applications' internal and external cache directory.
459 * @details All files stored in the cache directory of each application are removed.
460 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
461 * @privlevel platform
462 * @privilege %http://tizen.org/privilege/packagemanager.admin
463 * @return @c 0 on success,
464 * otherwise a negative error value
465 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
466 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
467 * @retval #PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE No such package
468 * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
469 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
470 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
471 * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR Severe system error
473 int package_manager_clear_all_cache_dir(void);
477 * @brief The package size information handle.
478 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
480 typedef struct package_size_info *package_size_info_h;
484 * @brief Called when the package size information is obtained.
485 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
486 * @param[in] package_id The package ID
487 * @param[in] size_info The pointer to the structure including the package size information
488 * @param[in] user_data The user data to be passed to the callback function
490 typedef void (*package_manager_size_info_receive_cb)(const char *package_id, const package_size_info_h size_info, void *user_data);
495 * @brief Called when the total package size information is obtained.
496 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
497 * @param[in] size_info The pointer to the structure including the package size information
498 * @param[in] user_data The user data to be passed to the callback function
500 typedef void (*package_manager_total_size_info_receive_cb)(const package_size_info_h size_info, void *user_data);
504 * @brief Gets the package size information.
505 * @details The package size info is asynchronously obtained by the callback function.
506 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
508 * @privilege %http://tizen.org/privilege/packagemanager.info
509 * @param[in] package_id The package ID
510 * @param[in] callback The asynchronous callback function to get the package size information
511 * @param[in] user_data The user data to be passed to the callback function
512 * @return @c 0 on success,
513 * otherwise a negative error value
514 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
515 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
516 * @retval #PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE No such package
517 * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
518 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
519 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
520 * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR Severe system error
522 int package_manager_get_package_size_info(const char *package_id, package_manager_size_info_receive_cb callback, void *user_data);
527 * @brief Gets the total package size information.
528 * @details The total package size info is asynchronously obtained by the callback function.
529 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
531 * @privilege %http://tizen.org/privilege/packagemanager.info
532 * @param[in] callback The asynchronous callback function to get the total package size information
533 * @param[in] user_data The user data to be passed to the callback function
534 * @return @c 0 on success,
535 * otherwise a negative error value
536 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
537 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
538 * @retval #PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE No such package
539 * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
540 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
541 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
542 * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR Severe system error
544 int package_manager_get_total_package_size_info(package_manager_total_size_info_receive_cb callback, void *user_data);
548 * @brief Creates the package information filter handle from db.
549 * @details All filter properties will be ANDed.
550 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
552 * @privilege %http://tizen.org/privilege/packagemanager.info
553 * @param[out] handle Pointer to the package info filter handle
554 * @return @c 0 on success,
555 * otherwise a negative error value
556 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
557 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
558 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
559 * @post package_manager_filter_destroy()
560 * @see package_manager_filter_add_bool()
561 * @see package_manager_filter_foreach_pkginfo()
563 int package_manager_filter_create(package_manager_filter_h *handle);
567 * @brief This API destroys the package information filter handle freeing up all the resources
568 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
569 * @param[in] handle Pointer to the package info filter handle
570 * @return @c 0 on success,
571 * 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_IO_ERROR I/O error
575 * @pre package_manager_filter_create()
576 * @see package_manager_filter_count()
577 * @see package_manager_filter_foreach_package_info()
579 int package_manager_filter_destroy(package_manager_filter_h handle);
583 * @brief This API adds a boolean filter property to the filter handle
584 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
585 * @param[in] handle Pointer to the package info filter handle
586 * @param[in] property boolean property name
587 * @param[in] value value corresponding to the property
588 * @return @c 0 on success,
589 * otherwise a negative error value
590 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
591 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
592 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
593 * @pre package_manager_filter_create()
594 * @post package_manager_filter_destroy()
595 * @see package_manager_filter_count()
596 * @see package_manager_filter_foreach_package_info()
598 int package_manager_filter_add_bool(package_manager_filter_h handle, const char *property, const bool value);
602 * @brief This API counts the package that satisfy the filter conditions
603 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
605 * @privilege %http://tizen.org/privilege/packagemanager.info
606 * @param[in] handle Pointer to the package info filter handle
607 * @param[out] count Pointer to store the count value
608 * @return @c 0 on success,
609 * otherwise a negative error value
610 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
611 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
612 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
613 * @pre package_manager_filter_create()
614 * @post package_manager_filter_destroy()
615 * @see package_manager_filter_foreach_package_info()
617 int package_manager_filter_count(package_manager_filter_h handle, int *count);
621 * @brief This API executes the user supplied callback function for each package that satisfy the filter conditions
622 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
624 * @privilege %http://tizen.org/privilege/packagemanager.info
625 * @param[in] handle Pointer to the package info filter handle
626 * @param[in] callback callback function
627 * @param[in] user_data user data to be passed to the callback function
628 * @return @c 0 on success,
629 * otherwise a negative error value
630 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
631 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
632 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
633 * @pre package_manager_filter_create()
634 * @post package_manager_filter_destroy()
635 * @post This function invokes package_manager_package_info_cb() repeatedly for each package information.
636 * @see package_manager_package_info_cb()
637 * @see package_manager_filter_count()
639 int package_manager_filter_foreach_package_info(package_manager_filter_h handle, package_manager_package_info_cb callback, void *user_data);
644 * @brief Generates request for getting License
645 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
646 * @privlevel platform
647 * @privilege %http://tizen.org/privilege/packagemanager.admin
648 * @remarks You must release @a req_data and @a license_url by yourself.
649 * @param[in] resp_data The response data string of the purchase request
650 * @param[out] req_data License request data
651 * @param[out] license_url License acquisition url data
652 * @return @c 0 on success,
653 * otherwise a negative error value
654 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
655 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
656 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
657 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR Internal I/O error
658 * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
659 * @post package_manager_drm_register_license
661 int package_manager_drm_generate_license_request(const char *resp_data, char **req_data, char **license_url);
666 * @brief Registers encrypted license
667 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
668 * @privlevel platform
669 * @privilege %http://tizen.org/privilege/packagemanager.admin
670 * @param[in] resp_data The response data string of the rights request
671 * @return @c 0 on success,
672 * otherwise a negative error value
673 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
674 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
675 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR Internal I/O error
676 * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
677 * @pre package_manager_drm_generate_license_request
679 int package_manager_drm_register_license(const char *resp_data);
683 * @brief Decrypts contents which is encrypted
684 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
685 * @privlevel platform
686 * @privilege %http://tizen.org/privilege/packagemanager.admin
687 * @param[in] drm_file_path DRM file path
688 * @param[in] decrypted_file_path Decrypted file path
689 * @return @c 0 on success,
690 * otherwise a negative error value
691 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
692 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
693 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR Internal I/O error
694 * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
696 int package_manager_drm_decrypt_package(const char *drm_file_path, const char *decrypted_file_path);
700 * @brief Retrieves data size from given handle
701 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
702 * @param[in] handle Package size info handle
703 * @param[out] data_size Data size will be returned
704 * @return @c 0 on success,
705 * otherwise a negative error value
706 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
707 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
709 int package_size_info_get_data_size(package_size_info_h handle, long long *data_size);
713 * @brief Retrieves cache size from given handle
714 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
715 * @param[in] handle Package size info handle
716 * @param[out] cache_size Cache size will be returned
717 * @return @c 0 on success,
718 * otherwise a negative error value
719 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
720 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
722 int package_size_info_get_cache_size(package_size_info_h handle, long long *cache_size);
726 * @brief Retrieves application size from given handle
727 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
728 * @param[in] handle Package size info handle
729 * @param[out] app_size App size will be returned
730 * @return @c 0 on success,
731 * otherwise a negative error value
732 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
733 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
735 int package_size_info_get_app_size(package_size_info_h handle, long long *app_size);
739 * @brief Retrieves external data size from given handle
740 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
741 * @param[in] handle Package size info handle
742 * @param[out] ext_data_size External data size will be returned
743 * @return @c 0 on success,
744 * otherwise a negative error value
745 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
746 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
748 int package_size_info_get_external_data_size(package_size_info_h handle, long long *ext_data_size);
752 * @brief Retrieves external cache size from given handle
753 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
754 * @param[in] handle Package size info handle
755 * @param[out] ext_cache_size External cache size will be returned
756 * @return @c 0 on success,
757 * otherwise a negative error value
758 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
759 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
761 int package_size_info_get_external_cache_size(package_size_info_h handle, long long *ext_cache_size);
765 * @brief Retrieves external application size from given handle
766 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
767 * @param[in] handle Package size info handle
768 * @param[out] ext_app_size External app size will be returned
769 * @return @c 0 on success,
770 * otherwise a negative error value
771 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
772 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
774 int package_size_info_get_external_app_size(package_size_info_h handle, long long *ext_app_size);
782 * @addtogroup CAPI_PACKAGE_REQUEST_MODULE
789 * @brief Enumeration for request mode.
790 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
793 PACKAGE_MANAGER_REQUEST_MODE_DEFAULT = 0, /**< @platform Default request mode */
794 PACKAGE_MANAGER_REQUEST_MODE_QUIET, /**< @platform Quiet request mode */
796 /* These enum will be deprecated. Use above enum instead. */
797 PACAKGE_MANAGER_REQUEST_MODE_DEFAULT = 0,
798 PACAKGE_MANAGER_REQUEST_MODE_QUIET,
799 } package_manager_request_mode_e;
804 * @brief The Package manager request handle.
805 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
807 typedef struct package_manager_request_s *package_manager_request_h;
812 * @brief Called when the progress of the request to the package manager changes.
813 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
814 * @param[in] id The ID of the request to the package manager
815 * @param[in] type The type of the package to install, uninstall or update
816 * @param[in] package The name of the package to install, uninstall or update
817 * @param[in] event_type The type of the request to the package manager
818 * @param[in] event_state The current state of the request to the package manager
819 * @param[in] progress The progress for the request that is being processed by the package manager \n
820 * The range of progress is from @c 0 to @c 100.
821 * @param[in] error The error code when the package manager failed to process the request
822 * @param[in] user_data The user data passed from package_manager_request_set_event_cb()
823 * @see package_manager_request_set_event_cb()
824 * @see package_manager_request_unset_event_cb()
826 typedef void (*package_manager_request_event_cb) ( int id, const char *type, const char *package, package_manager_event_type_e event_type, package_manager_event_state_e event_state, int progress, package_manager_error_e error, void *user_data);
831 * @brief Creates a request handle to the package manager.
832 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
833 * @remarks You must release @a request using package_manager_request_destroy().
834 * @param[out] request The request handle that is newly created on success
835 * @return @c 0 on success,
836 * otherwise a negative error value
837 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
838 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
839 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
840 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR Internal I/O error
841 * @see package_manager_request_destroy()
843 int package_manager_request_create(package_manager_request_h *request);
848 * @brief Destroys the request handle to the package manager.
849 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
850 * @param[in] request The request handle to the package manager
851 * @return @c 0 on success,
852 * otherwise a negative error value
853 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
854 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
855 * @see package_manager_request_create()
857 int package_manager_request_destroy(package_manager_request_h request);
862 * @brief Registers a callback function to be invoked when the progress of the request changes.
863 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
865 * @privilege %http://tizen.org/privilege/packagemanager.info
866 * @param[in] request The request handle
867 * @param[in] callback The callback function to be registered
868 * @param[in] user_data The user data to be passed to the callback function
869 * @return @c 0 on success,
870 * otherwise a negative error value
871 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
872 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
873 * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
874 * @post package_manager_request_event_cb() will be invoked.
875 * @see package_manager_request_event_cb()
876 * @see package_manager_request_unset_event_cb()
878 int package_manager_request_set_event_cb(package_manager_request_h request, package_manager_request_event_cb callback, void *user_data);
883 * @brief Unregisters the callback function.
884 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
885 * @param[in] request The request handle
886 * @return @c 0 on success,
887 * otherwise a negative error value
888 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
889 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
890 * @see package_manager_request_event_cb()
891 * @see package_manager_request_set_event_cb()
893 int package_manager_request_unset_event_cb(package_manager_request_h request);
898 * @brief Sets the type of the package to install, uninstall, or update.
899 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
900 * @param[in] request The request handle
901 * @param[in] type The type of the package
902 * @return @c 0 on success,
903 * otherwise a negative error value
904 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
905 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
907 int package_manager_request_set_type(package_manager_request_h request, const char *type);
912 * @brief Sets the mode of the request.
913 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
914 * @param[in] request The request handle
915 * @param[in] mode The mode of the request
916 * @return @c 0 on success,
917 * otherwise a negative error value
918 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
919 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
921 int package_manager_request_set_mode(package_manager_request_h request, package_manager_request_mode_e mode);
926 * @brief Sets the path of TEP file to the request. The TEP file that is set will be installed when the package is installed.
927 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
928 * @privlevel platform
929 * @privilege %http://tizen.org/privilege/packagemanager.admin
930 * @param[in] request The request handle
931 * @param[in] tep_path The TEP path to set. If this is NULL on update, installed TEP will be removed.
932 * @return @c 0 on success,
933 * otherwise a negative error value
934 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
935 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
936 * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
937 * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR Severe system error
939 int package_manager_request_set_tep(package_manager_request_h request, const char *tep_path);
944 * @brief Installs the package located at the given path.
945 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
946 * @privlevel platform
947 * @privilege %http://tizen.org/privilege/packagemanager.admin
948 * @param[in] request The request handle
949 * @param[in] path The absolute path to the package to be installed
950 * @param[out] id The ID of the request to the package manager
951 * @return @c 0 on success,
952 * otherwise a negative error value
953 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
954 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
955 * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
956 * @see package_manager_request_uninstall()
958 int package_manager_request_install(package_manager_request_h request, const char *path, int *id);
963 * @brief Uninstalls the package with the given name.
964 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
965 * @privlevel platform
966 * @privilege %http://tizen.org/privilege/packagemanager.admin
967 * @param[in] request The request handle
968 * @param[in] name The name of the package to be uninstalled
969 * @param[out] id The ID of the request to the package manager
970 * @return @c 0 on success,
971 * otherwise a negative error value
972 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
973 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
974 * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
976 int package_manager_request_uninstall(package_manager_request_h request, const char *name, int *id);
981 * @brief Moves the package from SD card to the internal memory and vice versa.
982 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
983 * @privlevel platform
984 * @privilege %http://tizen.org/privilege/packagemanager.admin
985 * @param[in] request The request handle
986 * @param[in] name The name of the package to be moved
987 * @param[in] move_type The move type [enum package_manager_move_type_e], [external to internal/internal to external]
988 * @return @c 0 on success,
989 * otherwise a negative error value
990 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
991 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
992 * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
994 int package_manager_request_move(package_manager_request_h request, const char *name, package_manager_move_type_e move_type);
1005 #endif /* __TIZEN_APPFW_PACKAGE_MANAGER_H */