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.
18 #ifndef __TIZEN_APPFW_PACKAGE_INFO_H
19 #define __TIZEN_APPFW_PACKAGE_INFO_H
28 * @file package_info.h
32 * @addtogroup CAPI_PACKAGE_INFO_MODULE
38 * @brief The package information handle.
41 typedef struct package_info_s *package_info_h;
44 * @brief The package update information handle.
47 typedef struct package_update_info_s *package_update_info_h;
50 * @brief Enumeration for storage type.
54 PACKAGE_INFO_INTERNAL_STORAGE = 0, /**< Internal storage */
55 PACKAGE_INFO_EXTERNAL_STORAGE = 1, /**< External storage */
56 } package_info_installed_storage_type_e;
60 * @brief Enumeration for app component type.
64 PACKAGE_INFO_ALLAPP = 0, /**< All application */
65 PACKAGE_INFO_UIAPP = 1, /**< UI application */
66 PACKAGE_INFO_SERVICEAPP = 2, /**< Service application */
67 } package_info_app_component_type_e;
71 * @brief Enumeration for certification type.
75 PACKAGE_INFO_AUTHOR_ROOT_CERT = 0, /**< Author Root Certificate*/
76 PACKAGE_INFO_AUTHOR_INTERMEDIATE_CERT = 1, /**< Author Intermediate Certificate*/
77 PACKAGE_INFO_AUTHOR_SIGNER_CERT = 2, /**< Author Signer Certificate*/
78 PACKAGE_INFO_DISTRIBUTOR_ROOT_CERT = 3, /**< Distributor Root Certificate*/
79 PACKAGE_INFO_DISTRIBUTOR_INTERMEDIATE_CERT = 4, /**< Distributor Intermediate Certificate*/
80 PACKAGE_INFO_DISTRIBUTOR_SIGNER_CERT = 5, /**< Distributor Signer Certificate*/
81 PACKAGE_INFO_DISTRIBUTOR2_ROOT_CERT = 6, /**< Distributor2 Root Certificate*/
82 PACKAGE_INFO_DISTRIBUTOR2_INTERMEDIATE_CERT = 7, /**< Distributor2 Intermediate Certificate*/
83 PACKAGE_INFO_DISTRIBUTOR2_SIGNER_CERT = 8, /**< Distributor2 Signer Certificate*/
84 } package_cert_type_e;
87 * @brief Enumeration for package update info type.
91 PACKAGE_UPDATEINFO_TYPE_NONE = 0, /**< None type */
92 PACKAGE_UPDATEINFO_TYPE_FORCE, /**< Force type */
93 PACKAGE_UPDATEINFO_TYPE_OPTIONAL /**< Optional type */
94 } package_update_info_type_e;
97 * @brief Called for each update information of all packages.
99 * @param[in] package_updateinfo The application update information handle
100 * @param[in] user_data The user data passed from the foreach function
101 * @return @c true to continue with the next iteration of the loop,
102 * otherwise @c false to break out of the loop
103 * @pre package_info_updateinfo_foreach_updateinfo() will invoke this callback.
104 * @see package_info_updateinfo_foreach_updateinfo()
106 typedef bool (*package_info_updateinfo_cb) (package_update_info_h package_updateinfo, void *user_data);
109 * @brief Called to get the application ID once for each installed package.
111 * @param[in] comp_type The Application Component type
112 * @param[in] callback The callback function to be invoked
113 * @param[in] user_data The user data passed from the foreach function
114 * @return @c true to continue with the next iteration of the loop,
115 * otherwise @c false to break out of the loop
116 * @pre package_info_foreach_app_from_package() will invoke this callback.
117 * @see package_info_foreach_app_from_package()
119 typedef bool (*package_info_app_cb) (package_info_app_component_type_e comp_type, const char *app_id, void *user_data);
123 * @brief Called to get the certification information.
125 * @param[in] package_info The package info handle
126 * @param[in] cert_type The certificate type
127 * @param[in] cert_value The certificate value of corresponding certificate key \n
128 * This value is base64 encoded data.
129 * @param[in] user_data The user data passed from the foreach function
130 * @return @c true to continue with the next iteration of the loop,
131 * otherwise @c false to break out of the loop
132 * @pre package_info_foreach_cert_info() will invoke this callback.
133 * @see package_info_foreach_cert_info()
135 typedef bool (*package_info_cert_info_cb) (package_info_h handle, package_cert_type_e cert_type, const char *cert_value, void *user_data);
139 * @brief Called to get the privilege information.
141 * @param[in] privilege_name the name of the privilege
142 * @param[in] user_data The user data passed from the foreach function
143 * @return @c true to continue with the next iteration of the loop,
144 * otherwise @c false to break out of the loop
145 * @pre package_info_foreach_privilege_info() will invoke this callback.
146 * @see package_info_foreach_privilege_info()
148 typedef bool (*package_info_privilege_info_cb) (const char *privilege_name, void *user_data);
152 * @brief Retrieves all application IDs of each package.
154 * @param[in] package_info The package info handle
155 * @param[in] comp_type The application component type
156 * @param[in] callback The callback function to invoke
157 * @param[in] user_data The user data to be passed to the callback function
158 * @return @c 0 on success,
159 * otherwise a negative error value
160 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
161 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
162 * @retval #PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE No such package
163 * @post This function invokes package_info_app_cb() repeatedly for each package.
164 * @see package_info_app_cb()
166 int package_info_foreach_app_from_package(package_info_h package_info, package_info_app_component_type_e comp_type, package_info_app_cb callback, void *user_data);
170 * @brief Destroys the package information handle and releases all its resources.
172 * @param[in] package_info The package information handle
173 * @return @c 0 on success,
174 * otherwise a negative error value
175 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
176 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
177 * @see package_manager_foreach_package_info()
178 * @see package_manager_get_package_info()
180 int package_info_destroy(package_info_h package_info);
184 * @brief Gets the package name.
186 * @remarks You must release @a package using free().
187 * @param[in] package_info The package information
188 * @param[out] package The package name
189 * @return @c 0 on success,
190 * otherwise a negative error value
191 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
192 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
193 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
195 int package_info_get_package(package_info_h package_info, char **package);
199 * @brief Gets the main application ID of the package.
201 * @remarks You must release @a main_app_id using free().
202 * @param[in] package_info The package information
203 * @param[out] main_app_id The main application ID of the package
204 * @return @c 0 on success,
205 * otherwise a negative error value
206 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
207 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
208 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
209 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
211 int package_info_get_main_app_id(package_info_h package_info, char **main_app_id);
215 * @brief Gets the label of the package.
217 * @remarks You must release @a label using free().
218 * @param[in] package_info The package information
219 * @param[out] label The label of the package
220 * @return @c 0 on success,
221 * otherwise a negative error value
222 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
223 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
224 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
225 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
227 int package_info_get_label(package_info_h package_info, char **label);
231 * @brief Gets the absolute path to the icon image.
233 * @remarks You must release @a path using free().
234 * @param[in] package_info The package information
235 * @param[out] path The path of the package
236 * @return @c 0 on success,
237 * otherwise a negative error value
238 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
239 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
240 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
241 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
243 int package_info_get_icon(package_info_h package_info, char **path);
247 * @brief Gets the version of the package.
249 * @remarks You must release @a version using free().
250 * @param[in] package_info The package information
251 * @param[out] version The version of the package
252 * @return @c 0 on success,
253 * otherwise a negative error value
254 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
255 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
256 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
257 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
259 int package_info_get_version(package_info_h package_info, char **version);
263 * @brief Gets the type of the package.
265 * @remarks You must release @a type using free().
266 * @param[in] package_info The package information
267 * @param[out] type The type of the package
268 * @return @c 0 on success,
269 * otherwise a negative error value
270 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
271 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
272 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
273 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
275 int package_info_get_type(package_info_h package_info, char **type);
279 * @brief Gets the installed storage for the given package.
281 * @param[in] package_info The package information
282 * @param[out] storage The installed storage
283 * @return @c 0 on success,
284 * otherwise a negative error value
285 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
286 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
288 int package_info_get_installed_storage(package_info_h package_info, package_info_installed_storage_type_e *storage);
292 * @brief Gets the root path of the package.
294 * @remarks You must release @a path using free().
295 * @param[in] package_info The package information
296 * @param[out] path The root path of the package
297 * @return @c 0 on success,
298 * otherwise a negative error value
299 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
300 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
301 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
302 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
304 int package_info_get_root_path(package_info_h package_info, char **path);
309 * @brief Gets the name of the TEP(Tizen Expansion Package).
310 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
311 * @privlevel platform
312 * @privilege %http://tizen.org/privilege/packagemanager.admin
313 * @remarks Name must be released using free().
314 * @param[in] package_info The package information
315 * @param[out] name The name of the tep
316 * @return 0 on success,
317 * otherwise a negative error value
318 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
319 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
320 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
321 * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR Severe system error
322 * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
324 int package_info_get_tep_name(package_info_h package_info, char **name);
328 * @brief Checks whether the package is system package.
330 * @param[in] package_info The package information
331 * @param[out] system @c true if the package is system package,
332 * otherwise @c false if the package is not system package
333 * @return @c 0 on success,
334 * 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_OUT_OF_MEMORY Out of memory
338 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
340 int package_info_is_system_package(package_info_h package_info, bool *system);
344 * @brief Checks whether the package is removable.
346 * @param[in] package_info The package information
347 * @param[out] removable The removable info of the package
348 * @return @c 0 on success,
349 * otherwise a negative error value
350 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
351 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
352 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
353 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR IO error
355 int package_info_is_removable_package(package_info_h package_info, bool *removable);
359 * @brief Checks whether the package is preloaded.
361 * @param[in] package_info The package information
362 * @param[out] preload The preload info of the package
363 * @return @c 0 on success,
364 * otherwise a negative error value
365 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
366 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
367 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
368 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
370 int package_info_is_preload_package(package_info_h package_info, bool *preload);
374 * @brief Checks whether two package information is equal.
376 * @param[in] lhs The first package information to be compared
377 * @param[in] rhs The second package information to be compared
378 * @param[out] equal @c true if the package information are equal,
379 * otherwise @c false if package information are not equal
380 * @return @c 0 on success,
381 * otherwise a negative error value
382 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
383 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
384 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
385 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR Database error occurred
387 int package_info_is_equal(package_info_h lhs, package_info_h rhs, bool *equal);
391 * @brief Checks whether the package info is accessible for the given package.
393 * @param[in] package_info The package information
394 * @param[out] accessible @c true if the package info is accessible,
395 * otherwise @c false if the package info is not accessible
396 * @return @c 0 on success,
397 * otherwise a negative error value
398 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
399 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
401 int package_info_is_accessible(package_info_h package_info, bool *accessible);
404 * @brief Gets the installed time for the given package.
405 * @details If the package was updated, the @a installed_time represents updated time.
406 * So, the meaning of 'installed time' corresponds with 'last modified time'.
408 * @param[in] package_info The package information
409 * @param[out] installed_time The integer value of time_t type for installed time
410 * @return @c 0 on success,
411 * otherwise a negative error value
412 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
413 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
414 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR Database error occurred
416 int package_info_get_installed_time(package_info_h package_info, int *installed_time);
419 * @brief Clones the package information handle.
421 * @param[out] clone The newly created package information handle
422 * @param[in] package_info The package information
423 * @return @c 0 on success,
424 * otherwise a negative error value
425 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
426 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
427 * @retval #PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE The package is not installed
428 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
430 int package_info_clone(package_info_h *clone, package_info_h package_info);
433 * @brief Gets the package information for the given package
435 * @remarks You must release @a package_info using package_info_destroy().
436 * @param[in] package The ID of the package
437 * @param[out] package_info The package information for the given package ID
438 * @return @c 0 on success,
439 * otherwise a negative error value
440 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
441 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
442 * @retval #PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE The package is not installed
443 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
445 int package_info_create(const char *package, package_info_h *package_info);
449 * @brief Retrieves certification information of the package.
451 * @param[in] package_info The package information
452 * @param[in] callback The iteration callback function
453 * @param[in] user_data The user data to be passed to the callback function
454 * @return @c 0 on success,
455 * otherwise a negative error value
456 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
457 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
458 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
459 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
461 int package_info_foreach_cert_info(package_info_h package_info, package_info_cert_info_cb callback, void *user_data);
465 * @brief Retrieves privilege information of the package.
467 * @param[in] package_info The package information
468 * @param[in] callback The iteration callback function
469 * @param[in] user_data The user data to be passed to the callback function
470 * @return @c 0 on success,
471 * otherwise a negative error value
472 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
473 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
474 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
475 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
477 int package_info_foreach_privilege_info(package_info_h package_info, package_info_privilege_info_cb callback, void *user_data);
480 * @brief Gets the package update information for the given package.
482 * @remarks You must release @a package_updateinfo using package_info_updateinfo_destroy().
483 * @param[in] pkgid The ID of the package
484 * @param[out] package_updateinfo The package update information for the given package ID
485 * @return @c 0 on success,
486 * otherwise a negative error value
487 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
488 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
489 * @retval #PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE The package is not installed
490 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
491 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR Database error occurred
492 * @see package_info_updateinfo_destroy()
494 int package_info_updateinfo_create(const char *pkgid, package_update_info_h *package_updateinfo);
497 * @brief Gets the package name.
499 * @remarks You must release @a package using free().
500 * @param[in] package_updateinfo The package update information
501 * @param[out] package The package name
502 * @return @c 0 on success,
503 * otherwise a negative error value
504 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
505 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
506 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
507 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR Internal I/O error occured
509 int package_info_updateinfo_get_pkgid(package_update_info_h package_updateinfo, char **package);
512 * @brief Gets the update version of package.
514 * @remarks You must release @a version using free().
515 * @param[in] package_updateinfo The package update information
516 * @param[out] version The package update version
517 * @return @c 0 on success,
518 * otherwise a negative error value
519 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
520 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
521 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
522 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR Internal I/O error occured
524 int package_info_updateinfo_get_version(package_update_info_h package_updateinfo, char **version);
527 * @brief Gets the update type of package.
529 * @param[in] package_updateinfo The package update information
530 * @param[out] type The package update type
531 * @return @c 0 on success,
532 * otherwise a negative error value
533 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
534 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
535 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR Internal I/O error occured
537 int package_info_updateinfo_get_type(package_update_info_h package_updateinfo, package_update_info_type_e *type);
540 * @brief Destroys the package update information handle and releases all its resources.
542 * @param[in] package_updateinfo The package update information handle
543 * @return @c 0 on success,
544 * otherwise a negative error value
545 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
546 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
547 * @see package_info_updateinfo_create()
549 int package_info_updateinfo_destroy(package_update_info_h package_updateinfo);
552 * @brief Retrieve update information of all packages and invoke callback for each of it.
554 * @param[in] callback The iteration callback function
555 * @param[in] user_data The user data to be passed to the callback function
556 * @return @c 0 on success,
557 * otherwise a negative error value
558 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
559 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
560 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
562 int package_info_updateinfo_foreach_updateinfo(package_info_updateinfo_cb callback, void *user_data);
573 #endif /* __TIZEN_APPFW_PACKAGE_INFO_H */