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_updateinfo_s *package_updateinfo_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_EXTENDED_STORAGE = 2, /**< Extended storage (Since 5.0) */
57 } package_info_installed_storage_type_e;
61 * @brief Enumeration for app component type.
65 PACKAGE_INFO_ALLAPP = 0, /**< All application */
66 PACKAGE_INFO_UIAPP = 1, /**< UI application */
67 PACKAGE_INFO_SERVICEAPP = 2, /**< Service application */
68 PACKAGE_INFO_WIDGETAPP = 3, /**< Widget application (Since 4.0) */
69 PACKAGE_INFO_WATCHAPP = 4, /**< Watch application (Since 4.0) */
70 } package_info_app_component_type_e;
74 * @brief Enumeration for certification type.
78 PACKAGE_INFO_AUTHOR_ROOT_CERT = 0, /**< Author Root Certificate*/
79 PACKAGE_INFO_AUTHOR_INTERMEDIATE_CERT = 1, /**< Author Intermediate Certificate*/
80 PACKAGE_INFO_AUTHOR_SIGNER_CERT = 2, /**< Author Signer Certificate*/
81 PACKAGE_INFO_DISTRIBUTOR_ROOT_CERT = 3, /**< Distributor Root Certificate*/
82 PACKAGE_INFO_DISTRIBUTOR_INTERMEDIATE_CERT = 4, /**< Distributor Intermediate Certificate*/
83 PACKAGE_INFO_DISTRIBUTOR_SIGNER_CERT = 5, /**< Distributor Signer Certificate*/
84 PACKAGE_INFO_DISTRIBUTOR2_ROOT_CERT = 6, /**< Distributor2 Root Certificate*/
85 PACKAGE_INFO_DISTRIBUTOR2_INTERMEDIATE_CERT = 7, /**< Distributor2 Intermediate Certificate*/
86 PACKAGE_INFO_DISTRIBUTOR2_SIGNER_CERT = 8, /**< Distributor2 Signer Certificate*/
87 } package_cert_type_e;
90 * @brief Enumeration for package update info type.
94 PACKAGE_UPDATEINFO_TYPE_NONE = 0, /**< None type */
95 PACKAGE_UPDATEINFO_TYPE_FORCE, /**< Force type */
96 PACKAGE_UPDATEINFO_TYPE_OPTIONAL /**< Optional type */
97 } package_updateinfo_type_e;
100 * @brief Called for each update information of all packages.
102 * @remarks @a info should not be freed and can be used only in the callback.
103 * @param[in] info The package update information handle
104 * @param[in] user_data The user data passed from the foreach function
105 * @return @c true to continue with the next iteration of the loop,
106 * otherwise @c false to break out of the loop
107 * @pre package_info_updateinfo_foreach_updateinfo() will invoke this callback.
108 * @see package_info_updateinfo_foreach_updateinfo()
110 typedef bool (*package_info_updateinfo_cb) (package_updateinfo_h info, void *user_data);
113 * @brief Called to get the application ID once for each installed package.
115 * @param[in] comp_type The Application Component type
116 * @param[in] callback The callback function to be invoked
117 * @param[in] user_data The user data passed from the foreach function
118 * @return @c true to continue with the next iteration of the loop,
119 * otherwise @c false to break out of the loop
120 * @pre package_info_foreach_app_from_package() will invoke this callback.
121 * @see package_info_foreach_app_from_package()
123 typedef bool (*package_info_app_cb) (package_info_app_component_type_e comp_type, const char *app_id, void *user_data);
127 * @brief Called to get the certification information.
129 * @param[in] package_info The package info handle
130 * @param[in] cert_type The certificate type
131 * @param[in] cert_value The certificate value of corresponding certificate key \n
132 * This value is base64 encoded data.
133 * @param[in] user_data The user data passed from the foreach function
134 * @return @c true to continue with the next iteration of the loop,
135 * otherwise @c false to break out of the loop
136 * @pre package_info_foreach_cert_info() will invoke this callback.
137 * @see package_info_foreach_cert_info()
139 typedef bool (*package_info_cert_info_cb) (package_info_h handle, package_cert_type_e cert_type, const char *cert_value, void *user_data);
143 * @brief Called to get the privilege information.
145 * @param[in] privilege_name the name of the privilege
146 * @param[in] user_data The user data passed from the foreach function
147 * @return @c true to continue with the next iteration of the loop,
148 * otherwise @c false to break out of the loop
149 * @pre package_info_foreach_privilege_info() will invoke this callback.
150 * @see package_info_foreach_privilege_info()
152 typedef bool (*package_info_privilege_info_cb) (const char *privilege_name, void *user_data);
156 * @brief Retrieves all application IDs of each package.
158 * @param[in] package_info The package info handle
159 * @param[in] comp_type The application component type
160 * @param[in] callback The callback function to invoke
161 * @param[in] user_data The user data to be passed to the callback function
162 * @return @c 0 on success,
163 * otherwise a negative error value
164 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
165 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
166 * @retval #PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE No such package
167 * @post This function invokes package_info_app_cb() repeatedly for each package.
168 * @see package_info_app_cb()
170 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);
174 * @brief Destroys the package information handle and releases all its resources.
176 * @param[in] package_info The package information handle
177 * @return @c 0 on success,
178 * otherwise a negative error value
179 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
180 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
181 * @see package_manager_foreach_package_info()
182 * @see package_manager_get_package_info()
184 int package_info_destroy(package_info_h package_info);
188 * @brief Gets the package name.
190 * @remarks You must release @a package using free().
191 * @param[in] package_info The package information
192 * @param[out] package The package name
193 * @return @c 0 on success,
194 * otherwise a negative error value
195 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
196 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
197 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
199 int package_info_get_package(package_info_h package_info, char **package);
203 * @brief Gets the main application ID of the package.
205 * @remarks You must release @a main_app_id using free().
206 * @param[in] package_info The package information
207 * @param[out] main_app_id The main application ID of the package
208 * @return @c 0 on success,
209 * otherwise a negative error value
210 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
211 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
212 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
213 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
215 int package_info_get_main_app_id(package_info_h package_info, char **main_app_id);
219 * @brief Gets the label of the package.
221 * @remarks You must release @a label using free().
222 * @param[in] package_info The package information
223 * @param[out] label The label of the package
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 I/O error
231 int package_info_get_label(package_info_h package_info, char **label);
235 * @brief Gets the absolute path to the icon image.
237 * @remarks You must release @a path using free().
238 * @param[in] package_info The package information
239 * @param[out] path The path of the package
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 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
245 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
247 int package_info_get_icon(package_info_h package_info, char **path);
251 * @brief Gets the version of the package.
253 * @remarks You must release @a version using free().
254 * @param[in] package_info The package information
255 * @param[out] version The version of the package
256 * @return @c 0 on success,
257 * otherwise a negative error value
258 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
259 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
260 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
261 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
263 int package_info_get_version(package_info_h package_info, char **version);
267 * @brief Gets the type of the package.
269 * @remarks You must release @a type using free().
270 * @param[in] package_info The package information
271 * @param[out] type The type of the package
272 * @return @c 0 on success,
273 * otherwise a negative error value
274 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
275 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
276 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
277 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
279 int package_info_get_type(package_info_h package_info, char **type);
283 * @brief Gets the installed storage for the given package.
285 * @param[in] package_info The package information
286 * @param[out] storage The installed storage
287 * @return @c 0 on success,
288 * otherwise a negative error value
289 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
290 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
292 int package_info_get_installed_storage(package_info_h package_info, package_info_installed_storage_type_e *storage);
296 * @brief Gets the root path of the package.
298 * @remarks You must release @a path using free().
299 * @param[in] package_info The package information
300 * @param[out] path The root path of the package
301 * @return @c 0 on success,
302 * otherwise a negative error value
303 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
304 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
305 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
306 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
308 int package_info_get_root_path(package_info_h package_info, char **path);
313 * @brief Gets the name of the TEP(Tizen Expansion Package).
314 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
315 * @privlevel platform
316 * @privilege %http://tizen.org/privilege/packagemanager.admin
317 * @remarks Name must be released using free().
318 * @param[in] package_info The package information
319 * @param[out] name The name of the tep
320 * @return 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_OUT_OF_MEMORY Out of memory
325 * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR Severe system error
326 * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
328 int package_info_get_tep_name(package_info_h package_info, char **name);
332 * @brief Checks whether the package is system package.
334 * @param[in] package_info The package information
335 * @param[out] system @c true if the package is system package,
336 * otherwise @c false if the package is not system package
337 * @return @c 0 on success,
338 * otherwise a negative error value
339 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
340 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
341 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
342 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
344 int package_info_is_system_package(package_info_h package_info, bool *system);
348 * @brief Checks whether the package is removable.
350 * @param[in] package_info The package information
351 * @param[out] removable The removable info of the package
352 * @return @c 0 on success,
353 * otherwise a negative error value
354 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
355 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
356 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
357 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR IO error
359 int package_info_is_removable_package(package_info_h package_info, bool *removable);
363 * @brief Checks whether the package is preloaded.
365 * @param[in] package_info The package information
366 * @param[out] preload The preload info of the package
367 * @return @c 0 on success,
368 * otherwise a negative error value
369 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
370 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
371 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
372 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
374 int package_info_is_preload_package(package_info_h package_info, bool *preload);
378 * @brief Checks whether two package information is equal.
380 * @param[in] lhs The first package information to be compared
381 * @param[in] rhs The second package information to be compared
382 * @param[out] equal @c true if the package information are equal,
383 * otherwise @c false if package information are not equal
384 * @return @c 0 on success,
385 * otherwise a negative error value
386 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
387 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
388 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
389 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR Database error occurred
391 int package_info_is_equal(package_info_h lhs, package_info_h rhs, bool *equal);
395 * @brief Checks whether the package info is accessible for the given package.
397 * @param[in] package_info The package information
398 * @param[out] accessible @c true if the package info is accessible,
399 * otherwise @c false if the package info is not accessible
400 * @return @c 0 on success,
401 * otherwise a negative error value
402 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
403 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
405 int package_info_is_accessible(package_info_h package_info, bool *accessible);
408 * @brief Gets the installed time for the given package.
409 * @details If the package was updated, the @a installed_time represents updated time.
410 * So, the meaning of 'installed time' corresponds with 'last modified time'.
412 * @param[in] package_info The package information
413 * @param[out] installed_time The integer value of time_t type for installed time
414 * @return @c 0 on success,
415 * 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_IO_ERROR Database error occurred
420 int package_info_get_installed_time(package_info_h package_info, int *installed_time);
423 * @brief Clones the package information handle.
425 * @param[out] clone The newly created package information handle
426 * @param[in] package_info The package information
427 * @return @c 0 on success,
428 * otherwise a negative error value
429 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
430 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
431 * @retval #PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE The package is not installed
432 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
434 int package_info_clone(package_info_h *clone, package_info_h package_info);
437 * @brief Gets the package information for the given package
439 * @remarks You must release @a package_info using package_info_destroy().
440 * @param[in] package The ID of the package
441 * @param[out] package_info The package information for the given package ID
442 * @return @c 0 on success,
443 * otherwise a negative error value
444 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
445 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
446 * @retval #PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE The package is not installed
447 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
449 int package_info_create(const char *package, package_info_h *package_info);
453 * @brief Retrieves certification information of the package.
455 * @param[in] package_info The package information
456 * @param[in] callback The iteration callback function
457 * @param[in] user_data The user data to be passed to the callback function
458 * @return @c 0 on success,
459 * otherwise a negative error value
460 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
461 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
462 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
463 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
465 int package_info_foreach_cert_info(package_info_h package_info, package_info_cert_info_cb callback, void *user_data);
469 * @brief Retrieves privilege information of the package.
471 * @param[in] package_info The package information
472 * @param[in] callback The iteration callback function
473 * @param[in] user_data The user data to be passed to the callback function
474 * @return @c 0 on success,
475 * otherwise a negative error value
476 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
477 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
478 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
479 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
481 int package_info_foreach_privilege_info(package_info_h package_info, package_info_privilege_info_cb callback, void *user_data);
484 * @brief Gets the package update information for the given package.
486 * @remarks You must release @a info using package_info_updateinfo_destroy().
487 * @param[in] pkgid The ID of the package
488 * @param[out] info The package update information for the given package ID
489 * @return @c 0 on success,
490 * otherwise a negative error value
491 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
492 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
493 * @retval #PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE The package is not installed
494 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
495 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR Database error occurred
496 * @see package_info_updateinfo_destroy()
498 int package_info_updateinfo_create(const char *pkgid, package_updateinfo_h *info);
501 * @brief Gets the package name.
503 * @remarks You must release @a package using free().
504 * @param[in] info The package update information
505 * @param[out] package The package name
506 * @return @c 0 on success,
507 * otherwise a negative error value
508 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
509 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
510 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
511 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR Internal I/O error occurred
513 int package_info_updateinfo_get_pkgid(package_updateinfo_h info, char **package);
516 * @brief Gets the update version of package.
518 * @remarks You must release @a version using free().
519 * @param[in] info The package update information
520 * @param[out] version The package update version
521 * @return @c 0 on success,
522 * otherwise a negative error value
523 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
524 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
525 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
526 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR Internal I/O error occurred
528 int package_info_updateinfo_get_version(package_updateinfo_h info, char **version);
531 * @brief Gets the update type of package.
533 * @param[in] info The package update information
534 * @param[out] type The package update type
535 * @return @c 0 on success,
536 * otherwise a negative error value
537 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
538 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
539 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR Internal I/O error occurred
541 int package_info_updateinfo_get_type(package_updateinfo_h info,
542 package_updateinfo_type_e *type);
545 * @brief Destroys the package update information handle and releases all its resources.
547 * @param[in] info The package update information handle
548 * @return @c 0 on success,
549 * otherwise a negative error value
550 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
551 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
552 * @see package_info_updateinfo_create()
554 int package_info_updateinfo_destroy(package_updateinfo_h info);
557 * @brief Retrieve update information of all packages and invoke callback for each of it.
559 * @param[in] callback The iteration callback function
560 * @param[in] user_data The user data to be passed to the callback function
561 * @return @c 0 on success,
562 * otherwise a negative error value
563 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
564 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
565 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
567 int package_info_updateinfo_foreach_info(package_info_updateinfo_cb callback, void *user_data);
578 #endif /* __TIZEN_APPFW_PACKAGE_INFO_H */