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_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_WIDGETAPP = 3, /**< Widget application (Since 4.0) */
68 PACKAGE_INFO_WATCHAPP = 4, /**< Watch application (Since 4.0) */
69 } package_info_app_component_type_e;
73 * @brief Enumeration for certification type.
77 PACKAGE_INFO_AUTHOR_ROOT_CERT = 0, /**< Author Root Certificate*/
78 PACKAGE_INFO_AUTHOR_INTERMEDIATE_CERT = 1, /**< Author Intermediate Certificate*/
79 PACKAGE_INFO_AUTHOR_SIGNER_CERT = 2, /**< Author Signer Certificate*/
80 PACKAGE_INFO_DISTRIBUTOR_ROOT_CERT = 3, /**< Distributor Root Certificate*/
81 PACKAGE_INFO_DISTRIBUTOR_INTERMEDIATE_CERT = 4, /**< Distributor Intermediate Certificate*/
82 PACKAGE_INFO_DISTRIBUTOR_SIGNER_CERT = 5, /**< Distributor Signer Certificate*/
83 PACKAGE_INFO_DISTRIBUTOR2_ROOT_CERT = 6, /**< Distributor2 Root Certificate*/
84 PACKAGE_INFO_DISTRIBUTOR2_INTERMEDIATE_CERT = 7, /**< Distributor2 Intermediate Certificate*/
85 PACKAGE_INFO_DISTRIBUTOR2_SIGNER_CERT = 8, /**< Distributor2 Signer Certificate*/
86 } package_cert_type_e;
89 * @brief Enumeration for package update info type.
93 PACKAGE_UPDATEINFO_TYPE_NONE = 0, /**< None type */
94 PACKAGE_UPDATEINFO_TYPE_FORCE, /**< Force type */
95 PACKAGE_UPDATEINFO_TYPE_OPTIONAL /**< Optional type */
96 } package_updateinfo_type_e;
99 * @brief Called for each update information of all packages.
101 * @remarks @a info should not be freed and can be used only in the callback.
102 * @param[in] info The package update information handle
103 * @param[in] user_data The user data passed from the foreach function
104 * @return @c true to continue with the next iteration of the loop,
105 * otherwise @c false to break out of the loop
106 * @pre package_info_updateinfo_foreach_updateinfo() will invoke this callback.
107 * @see package_info_updateinfo_foreach_updateinfo()
109 typedef bool (*package_info_updateinfo_cb) (package_updateinfo_h info, void *user_data);
112 * @brief Called to get the application ID once for each installed package.
114 * @param[in] comp_type The Application Component type
115 * @param[in] callback The callback function to be invoked
116 * @param[in] user_data The user data passed from the foreach function
117 * @return @c true to continue with the next iteration of the loop,
118 * otherwise @c false to break out of the loop
119 * @pre package_info_foreach_app_from_package() will invoke this callback.
120 * @see package_info_foreach_app_from_package()
122 typedef bool (*package_info_app_cb) (package_info_app_component_type_e comp_type, const char *app_id, void *user_data);
126 * @brief Called to get the certification information.
128 * @param[in] package_info The package info handle
129 * @param[in] cert_type The certificate type
130 * @param[in] cert_value The certificate value of corresponding certificate key \n
131 * This value is base64 encoded data.
132 * @param[in] user_data The user data passed from the foreach function
133 * @return @c true to continue with the next iteration of the loop,
134 * otherwise @c false to break out of the loop
135 * @pre package_info_foreach_cert_info() will invoke this callback.
136 * @see package_info_foreach_cert_info()
138 typedef bool (*package_info_cert_info_cb) (package_info_h handle, package_cert_type_e cert_type, const char *cert_value, void *user_data);
142 * @brief Called to get the privilege information.
144 * @param[in] privilege_name the name of the privilege
145 * @param[in] user_data The user data passed from the foreach function
146 * @return @c true to continue with the next iteration of the loop,
147 * otherwise @c false to break out of the loop
148 * @pre package_info_foreach_privilege_info() will invoke this callback.
149 * @see package_info_foreach_privilege_info()
151 typedef bool (*package_info_privilege_info_cb) (const char *privilege_name, void *user_data);
155 * @brief Retrieves all application IDs of each package.
157 * @param[in] package_info The package info handle
158 * @param[in] comp_type The application component type
159 * @param[in] callback The callback function to invoke
160 * @param[in] user_data The user data to be passed to the callback function
161 * @return @c 0 on success,
162 * otherwise a negative error value
163 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
164 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
165 * @retval #PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE No such package
166 * @post This function invokes package_info_app_cb() repeatedly for each package.
167 * @see package_info_app_cb()
169 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);
173 * @brief Destroys the package information handle and releases all its resources.
175 * @param[in] package_info The package information handle
176 * @return @c 0 on success,
177 * otherwise a negative error value
178 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
179 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
180 * @see package_manager_foreach_package_info()
181 * @see package_manager_get_package_info()
183 int package_info_destroy(package_info_h package_info);
187 * @brief Gets the package name.
189 * @remarks You must release @a package using free().
190 * @param[in] package_info The package information
191 * @param[out] package The package name
192 * @return @c 0 on success,
193 * otherwise a negative error value
194 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
195 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
196 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
198 int package_info_get_package(package_info_h package_info, char **package);
202 * @brief Gets the main application ID of the package.
204 * @remarks You must release @a main_app_id using free().
205 * @param[in] package_info The package information
206 * @param[out] main_app_id The main application ID of the package
207 * @return @c 0 on success,
208 * otherwise a negative error value
209 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
210 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
211 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
212 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
214 int package_info_get_main_app_id(package_info_h package_info, char **main_app_id);
218 * @brief Gets the label of the package.
220 * @remarks You must release @a label using free().
221 * @param[in] package_info The package information
222 * @param[out] label The label of the package
223 * @return @c 0 on success,
224 * otherwise a negative error value
225 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
226 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
227 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
228 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
230 int package_info_get_label(package_info_h package_info, char **label);
234 * @brief Gets the absolute path to the icon image.
236 * @remarks You must release @a path using free().
237 * @param[in] package_info The package information
238 * @param[out] path The path of the package
239 * @return @c 0 on success,
240 * otherwise a negative error value
241 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
242 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
243 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
244 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
246 int package_info_get_icon(package_info_h package_info, char **path);
250 * @brief Gets the version of the package.
252 * @remarks You must release @a version using free().
253 * @param[in] package_info The package information
254 * @param[out] version The version 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_OUT_OF_MEMORY Out of memory
260 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
262 int package_info_get_version(package_info_h package_info, char **version);
266 * @brief Gets the type of the package.
268 * @remarks You must release @a type using free().
269 * @param[in] package_info The package information
270 * @param[out] type The type of the package
271 * @return @c 0 on success,
272 * otherwise a negative error value
273 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
274 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
275 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
276 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
278 int package_info_get_type(package_info_h package_info, char **type);
282 * @brief Gets the installed storage for the given package.
284 * @param[in] package_info The package information
285 * @param[out] storage The installed storage
286 * @return @c 0 on success,
287 * otherwise a negative error value
288 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
289 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
291 int package_info_get_installed_storage(package_info_h package_info, package_info_installed_storage_type_e *storage);
295 * @brief Gets the root path of the package.
297 * @remarks You must release @a path using free().
298 * @param[in] package_info The package information
299 * @param[out] path The root path of the package
300 * @return @c 0 on success,
301 * otherwise a negative error value
302 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
303 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
304 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
305 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
307 int package_info_get_root_path(package_info_h package_info, char **path);
312 * @brief Gets the name of the TEP(Tizen Expansion Package).
313 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
314 * @privlevel platform
315 * @privilege %http://tizen.org/privilege/packagemanager.admin
316 * @remarks Name must be released using free().
317 * @param[in] package_info The package information
318 * @param[out] name The name of the tep
319 * @return 0 on success,
320 * otherwise a negative error value
321 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
322 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
323 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
324 * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR Severe system error
325 * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
327 int package_info_get_tep_name(package_info_h package_info, char **name);
331 * @brief Checks whether the package is system package.
333 * @param[in] package_info The package information
334 * @param[out] system @c true if the package is system package,
335 * otherwise @c false if the package is not system package
336 * @return @c 0 on success,
337 * otherwise a negative error value
338 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
339 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
340 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
341 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
343 int package_info_is_system_package(package_info_h package_info, bool *system);
347 * @brief Checks whether the package is removable.
349 * @param[in] package_info The package information
350 * @param[out] removable The removable info of the package
351 * @return @c 0 on success,
352 * otherwise a negative error value
353 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
354 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
355 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
356 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR IO error
358 int package_info_is_removable_package(package_info_h package_info, bool *removable);
362 * @brief Checks whether the package is preloaded.
364 * @param[in] package_info The package information
365 * @param[out] preload The preload info of the package
366 * @return @c 0 on success,
367 * otherwise a negative error value
368 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
369 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
370 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
371 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
373 int package_info_is_preload_package(package_info_h package_info, bool *preload);
377 * @brief Checks whether two package information is equal.
379 * @param[in] lhs The first package information to be compared
380 * @param[in] rhs The second package information to be compared
381 * @param[out] equal @c true if the package information are equal,
382 * otherwise @c false if package information are not equal
383 * @return @c 0 on success,
384 * otherwise a negative error value
385 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
386 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
387 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
388 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR Database error occurred
390 int package_info_is_equal(package_info_h lhs, package_info_h rhs, bool *equal);
394 * @brief Checks whether the package info is accessible for the given package.
396 * @param[in] package_info The package information
397 * @param[out] accessible @c true if the package info is accessible,
398 * otherwise @c false if the package info is not accessible
399 * @return @c 0 on success,
400 * otherwise a negative error value
401 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
402 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
404 int package_info_is_accessible(package_info_h package_info, bool *accessible);
407 * @brief Gets the installed time for the given package.
408 * @details If the package was updated, the @a installed_time represents updated time.
409 * So, the meaning of 'installed time' corresponds with 'last modified time'.
411 * @param[in] package_info The package information
412 * @param[out] installed_time The integer value of time_t type for installed time
413 * @return @c 0 on success,
414 * otherwise a negative error value
415 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
416 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
417 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR Database error occurred
419 int package_info_get_installed_time(package_info_h package_info, int *installed_time);
422 * @brief Clones the package information handle.
424 * @param[out] clone The newly created package information handle
425 * @param[in] package_info The package information
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_NO_SUCH_PACKAGE The package is not installed
431 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
433 int package_info_clone(package_info_h *clone, package_info_h package_info);
436 * @brief Gets the package information for the given package
438 * @remarks You must release @a package_info using package_info_destroy().
439 * @param[in] package The ID of the package
440 * @param[out] package_info The package information for the given package ID
441 * @return @c 0 on success,
442 * otherwise a negative error value
443 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
444 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
445 * @retval #PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE The package is not installed
446 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
448 int package_info_create(const char *package, package_info_h *package_info);
452 * @brief Retrieves certification information of the package.
454 * @param[in] package_info The package information
455 * @param[in] callback The iteration callback function
456 * @param[in] user_data The user data to be passed to the callback function
457 * @return @c 0 on success,
458 * otherwise a negative error value
459 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
460 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
461 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
462 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
464 int package_info_foreach_cert_info(package_info_h package_info, package_info_cert_info_cb callback, void *user_data);
468 * @brief Retrieves privilege information of the package.
470 * @param[in] package_info The package information
471 * @param[in] callback The iteration callback function
472 * @param[in] user_data The user data to be passed to the callback function
473 * @return @c 0 on success,
474 * 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_OUT_OF_MEMORY Out of memory
478 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
480 int package_info_foreach_privilege_info(package_info_h package_info, package_info_privilege_info_cb callback, void *user_data);
483 * @brief Gets the package update information for the given package.
485 * @remarks You must release @a info using package_info_updateinfo_destroy().
486 * @param[in] pkgid The ID of the package
487 * @param[out] info The package update information for the given package ID
488 * @return @c 0 on success,
489 * otherwise a negative error value
490 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
491 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
492 * @retval #PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE The package is not installed
493 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
494 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR Database error occurred
495 * @see package_info_updateinfo_destroy()
497 int package_info_updateinfo_create(const char *pkgid, package_updateinfo_h *info);
500 * @brief Gets the package name.
502 * @remarks You must release @a package using free().
503 * @param[in] info The package update information
504 * @param[out] package The package name
505 * @return @c 0 on success,
506 * otherwise a negative error value
507 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
508 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
509 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
510 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR Internal I/O error occured
512 int package_info_updateinfo_get_pkgid(package_updateinfo_h info, char **package);
515 * @brief Gets the update version of package.
517 * @remarks You must release @a version using free().
518 * @param[in] info The package update information
519 * @param[out] version The package update version
520 * @return @c 0 on success,
521 * otherwise a negative error value
522 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
523 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
524 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
525 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR Internal I/O error occured
527 int package_info_updateinfo_get_version(package_updateinfo_h info, char **version);
530 * @brief Gets the update type of package.
532 * @param[in] info The package update information
533 * @param[out] type The package update type
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_IO_ERROR Internal I/O error occured
540 int package_info_updateinfo_get_type(package_updateinfo_h info,
541 package_updateinfo_type_e *type);
544 * @brief Destroys the package update information handle and releases all its resources.
546 * @param[in] info The package update information handle
547 * @return @c 0 on success,
548 * otherwise a negative error value
549 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
550 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
551 * @see package_info_updateinfo_create()
553 int package_info_updateinfo_destroy(package_updateinfo_h info);
556 * @brief Retrieve update information of all packages and invoke callback for each of it.
558 * @param[in] callback The iteration callback function
559 * @param[in] user_data The user data to be passed to the callback function
560 * @return @c 0 on success,
561 * otherwise a negative error value
562 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
563 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
564 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
566 int package_info_updateinfo_foreach_info(package_info_updateinfo_cb callback, void *user_data);
577 #endif /* __TIZEN_APPFW_PACKAGE_INFO_H */