4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>, Jaeho Lee <jaeho81.lee@samsung.com>
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
30 #include <sys/types.h>
32 #include <tzplatform_config.h>
34 #define GROUP_MENU 6010
36 #define OPT_DESKTOP_DIRECTORY tzplatform_getenv(TZ_SYS_RW_DESKTOP_APP)
37 #define USR_DESKTOP_DIRECTORY tzplatform_getenv(TZ_SYS_RO_DESKTOP_APP)
38 #define APP_INFO_DB_FILE tzplatform_mkpath(TZ_SYS_DB,".app_info.db")
39 #define APP_INFO_DB_FILE_JOURNAL tzplatform_mkpath(TZ_SYS_DB,".app_info.db-journal")
40 #define APP_INFO_DB_LABEL "ail::db"
44 #endif /* __cplusplus */
50 * @ingroup APPLICATION_FRAMEWORK
51 * @defgroup ail Application Information Library
56 * @brief Application Information Library header
57 * @author Sunghyuk Lee (sunghyuk.lee@samsung.com), Jin Yoon (jinny.yoon@samsung.com)
68 * @brief string type properties
70 #define AIL_PROP_PACKAGE_STR "AIL_PROP_PACKAGE_STR"
71 #define AIL_PROP_EXEC_STR "AIL_PROP_EXEC_STR"
72 #define AIL_PROP_NAME_STR "AIL_PROP_NAME_STR"
73 #define AIL_PROP_TYPE_STR "AIL_PROP_TYPE_STR"
74 #define AIL_PROP_ICON_STR "AIL_PROP_ICON_STR"
75 #define AIL_PROP_CATEGORIES_STR "AIL_PROP_CATEGORIES_STR"
76 #define AIL_PROP_VERSION_STR "AIL_PROP_VERSION_STR"
77 #define AIL_PROP_MIMETYPE_STR "AIL_PROP_MIMETYPE_STR"
78 #define AIL_PROP_X_SLP_SERVICE_STR "AIL_PROP_X_SLP_SERVICE_STR"
79 #define AIL_PROP_X_SLP_PACKAGETYPE_STR "AIL_PROP_X_SLP_PACKAGETYPE_STR"
80 #define AIL_PROP_X_SLP_PACKAGECATEGORIES_STR "AIL_PROP_X_SLP_PACKAGECATEGORIES_STR"
81 #define AIL_PROP_X_SLP_PACKAGEID_STR "AIL_PROP_X_SLP_PACKAGEID_STR"
82 #define AIL_PROP_X_SLP_SVC_STR "AIL_PROP_X_SLP_SVC_STR"
83 #define AIL_PROP_X_SLP_EXE_PATH "AIL_PROP_X_SLP_EXE_PATH"
84 #define AIL_PROP_X_SLP_APPID_STR "AIL_PROP_X_SLP_APPID_STR"
85 #define AIL_PROP_X_SLP_PKGID_STR "AIL_PROP_X_SLP_PKGID_STR"
86 #define AIL_PROP_X_SLP_DOMAIN_STR "AIL_PROP_X_SLP_DOMAIN_STR"
87 #define AIL_PROP_X_SLP_SUBMODEMAINID_STR "AIL_PROP_X_SLP_SUBMODEMAINID_STR"
88 #define AIL_PROP_X_SLP_INSTALLEDSTORAGE_STR "AIL_PROP_X_SLP_INSTALLEDSTORAGE_STR"
91 * @brief integer type properties
93 #define AIL_PROP_X_SLP_TEMP_INT "AIL_PROP_X_SLP_TEMP_INT"
94 #define AIL_PROP_X_SLP_INSTALLEDTIME_INT "AIL_PROP_X_SLP_INSTALLEDTIME_INT"
97 * @brief boolean type properties
99 #define AIL_PROP_NODISPLAY_BOOL "AIL_PROP_NODISPLAY_BOOL"
100 #define AIL_PROP_X_SLP_TASKMANAGE_BOOL "AIL_PROP_X_SLP_TASKMANAGE_BOOL"
101 #define AIL_PROP_X_SLP_MULTIPLE_BOOL "AIL_PROP_X_SLP_MULTIPLE_BOOL"
102 #define AIL_PROP_X_SLP_REMOVABLE_BOOL "AIL_PROP_X_SLP_REMOVABLE_BOOL"
103 #define AIL_PROP_X_SLP_ISHORIZONTALSCALE_BOOL "AIL_PROP_X_SLP_ISHORIZONTALSCALE_BOOL"
104 #define AIL_PROP_X_SLP_ENABLED_BOOL "AIL_PROP_X_SLP_ENABLED_BOOL"
105 #define AIL_PROP_X_SLP_SUBMODE_BOOL "AIL_PROP_X_SLP_SUBMODE_BOOL"
108 * @brief A handle for filters
110 typedef struct ail_filter *ail_filter_h;
113 * @brief A handle for appinfos
115 typedef struct ail_appinfo *ail_appinfo_h;
118 * @brief return values
121 AIL_ERROR_OK = 0, /**< General success */
122 AIL_ERROR_FAIL = -1, /**< General error */
123 AIL_ERROR_DB_FAILED = -2, /**< Database error */
124 AIL_ERROR_OUT_OF_MEMORY = -3, /**< Out of memory */
125 AIL_ERROR_INVALID_PARAMETER = -4, /**< Invalid parameter */
126 AIL_ERROR_NO_DATA = -5, /**< Success, but no data */
130 * @fn ail_error_e ail_filter_new(ail_filter_h *filter)
132 * @brief Create a new filter handle which is used to filter records from Application Information Database. You can add filtering conditions to filter with ail_filter_add_xxx functions. All conditions are ANDed.
134 * @par Sync (or) Async : Synchronous API.
136 * @param[out] filter a pointer to a filter which is newly created
138 * @return 0 if success, negative value(<0) if fail\n
139 * @retval AIL_ERROR_OK success
140 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
141 * @retval AIL_ERROR_OUT_OF_MEMORY out of memory
144 * @post If the filter is no longer used, it should be freed with ail_filter_destroy()
146 * @see ail_filter_destroy()
148 * @par Prospective Clients:
158 ret = ail_filter_new(&filter);
159 if (ret != AIL_ERROR_OK) {
163 ret = ail_filter_add_bool(filter, AIL_PROP_NODISPLAY_BOOL, false);
164 if (ret != AIL_ERROR_OK) {
168 ret = ail_filter_add_str(filter, AIL_PROP_MIMETYPE_STR, "audio/wav");
169 if (ret != AIL_ERROR_OK) {
173 ret = ail_filter_count_appinfo(filter, &n);
174 if (ret != AIL_ERROR_OK) {
177 ret = ail_filter_destroy(filter);
179 printf("N of apps not to be displayed and supporting 'audo/wav' mime type = %d\n", n);
185 ail_error_e ail_filter_new(ail_filter_h *filter);
190 * @fn ail_error_e ail_error_e ail_filter_add_int(ail_filter_h filter, const char *property, const int value)
192 * @brief Add integer condition to filter
194 * @par Sync (or) Async : Synchronous API
196 * @param[in] filter a filter handle which can be create with ail_filter_new()
197 * @param[in] property a property type of integer
198 * @param[in] value the value to filter by
200 * @return 0 if success, negative value(<0) if fail\n
201 * @retval AIL_ERROR_OK success
202 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
203 * @retval AIL_ERROR_OUT_OF_MEMORY out of memory
205 * @pre The filter should be valid handle which was created by ail_filter_new()
207 * @see ail_filter_new()
209 * @par Prospective Clients:
219 ret = ail_filter_new(&filter);
220 if (ret != AIL_ERROR_OK) {
224 ret = ail_filter_add_int(filter, AIL_PROP_X_SLP_BASELAYOUTWIDTH_INT, 480);
225 if (ret != AIL_ERROR_OK) {
229 ret = ail_filter_count_appinfo(filter, &n);
230 if (ret != AIL_ERROR_OK) {
234 printf("N of apps = %d\n", n);
240 ail_error_e ail_filter_add_int(ail_filter_h filter, const char *property, const int value);
244 * @fn ail_error_e ail_error_e ail_filter_add_bool(ail_filter_h filter, const char *property, const bool value)
246 * @brief Add boolean condition to filter by. The value can be true/false only
248 * @par Sync (or) Async : Synchronous API
250 * @param[in] filter a filter handle which can be create with ail_filter_new()
251 * @param[in] property a property type of boolean
252 * @param[in] value the value to filter by
254 * @return 0 if success, negative value(<0) if fail\n
255 * @retval AIL_ERROR_OK success
256 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
257 * @retval AIL_ERROR_OUT_OF_MEMORY out of memory
259 * @pre The filter should be valid handle which was created by ail_filter_new()
261 * @see ail_filter_new()
263 * @par Prospective Clients:
273 ret = ail_filter_new(&filter);
274 if (ret != AIL_ERROR_OK) {
278 ret = ail_filter_add_bool(filter, AIL_PROP_X_SLP_REMOVABLE_BOOL, true);
279 if (ret != AIL_ERROR_OK) {
283 ret = ail_filter_count_appinfo(filter, &n);
284 if (ret != AIL_ERROR_OK) {
288 fprintf(stderr, "N of apps = %d\n", n);
294 ail_error_e ail_filter_add_bool(ail_filter_h filter, const char *property, bool value);
299 * @fn ail_error_e ail_error_e ail_filter_add_str(ail_filter_h filter, const char *property, const char *value)
301 * @brief Add string condition to filter by. The string is case-sensitive.
303 * @par Sync (or) Async : Synchronous API
305 * @param[in] filter a filter handle which can be create with ail_filter_new()
306 * @param[in] property a property type of string
307 * @param[in] value the value to filter by
309 * @return 0 if success, negative value(<0) if fail\n
310 * @retval AIL_ERROR_OK success
311 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
312 * @retval AIL_ERROR_OUT_OF_MEMORY out of memory
314 * @pre The filter should be valid handle which was created by ail_filter_new()
316 * @see ail_filter_new()
318 * @par Prospective Clients:
328 ret = ail_filter_new(&filter);
329 if (ret != AIL_ERROR_OK) {
333 ret = ail_filter_add_str(filter, AIL_PROP_PACKAGE_STR, "com.samsung.memo");
334 if (ret != AIL_ERROR_OK) {
338 ret = ail_filter_count_appinfo(filter, &n);
339 if (ret != AIL_ERROR_OK) {
343 fprintf(stderr, "N of apps = %d\n", n);
349 ail_error_e ail_filter_add_str(ail_filter_h filter, const char *property, const char *value);
354 * @fn ail_error_e ail_filter_destroy(ail_filter_h filter)
356 * @brief Destroy a filter which is not used any longer.
358 * @par Sync (or) Async : Synchronous API
360 * @param[in] filter filter handle
362 * @return 0 if success, negative value(<0) if fail\n
363 * @retval AIL_ERROR_OK success
364 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
366 * @post If the filter is no longer used, it should be freed with ail_filter_destroy()
368 * @see ail_filter_new()
370 * @par Prospective Clients:
380 ret = ail_filter_new(&filter);
381 if (ret != AIL_ERROR_OK) {
385 ret = ail_filter_add_bool(filter, AIL_PROP_X_SLP_REMOVABLE_BOOL, true);
386 if (ret != AIL_ERROR_OK) {
390 ret = ail_filter_count_appinfo(filter, &n);
391 if (ret != AIL_ERROR_OK) {
395 printf("N of removable apps = %d\n", n);
397 ret = ail_filter_add_str(filter, AIL_PROP_MIMETYPE_STR, "audio/wav");
398 if (ret != AIL_ERROR_OK) {
402 ret = ail_filter_count_appinfo(filter, &n);
403 if (ret != AIL_ERROR_OK) {
407 printf("N of apps removable and supporting 'audo/wav' mime type = %d\n", n);
409 ret = ail_filter_destroy(filter);
415 ail_error_e ail_filter_destroy(ail_filter_h filter);
420 * @brief return value type of ail_list_appinfo_cb
423 AIL_CB_RET_CONTINUE = 1, /**< continue */
424 AIL_CB_RET_CANCEL = 0, /**< cancel */
428 * @fn ail_cb_ret_e (*ail_list_appinfo_cb) (const ail_appinfo_h appinfo_h, void *user_data)
430 * @breif Specifies the type of functions passed to ail_filter_list_appinfo_foreach().
432 * @param[in] appinfo_h the appinfo's handle
433 * @param[in] user_data user data passed to ail_filtet_list_appinfo_foreach()
435 * @return 0 if success, negative value(<0) if fail\n
436 * @retval AIL_CB_RET_CONTINUE return if you continue iteration
437 * @retval AIL_CB_RET_CANCEL return if you cancel iteration
439 * @see ail_filter_list_appinfo_foreach()
441 typedef ail_cb_ret_e (*ail_list_appinfo_cb) (const ail_appinfo_h appinfo_h, void *user_data);
444 * @fn ail_error_e ail_error_e ail_filter_list_appinfo_foreach(ail_filter_h filter, ail_list_appinfo_cb func, void *user_data)
446 * @brief Calls the callback function for each app filtered by given filter. If the filter is not given (i.e filter handle is NULL), it is invoked for all apps.
448 * @par Sync (or) Async : Synchronous API
450 * @param[in] filter a filter handle
451 * @param[in] func the function to call with each app's appinfo
452 * @param[in] user_data user_data to pass to the function
454 * @return 0 if success, negative value(<0) if fail\n
455 * @retval AIL_ERROR_OK success
456 * @retval AIL_ERROR_DB_FAILED database error
457 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
459 * @see ail_list_appinfo_cb
460 * @see ail_filter_add_bool()
461 * @see ail_filter_add_int()
462 * @see ail_filter_add_str()
464 * @par Prospective Clients:
469 ail_cb_ret_e appinfo_func(const ail_appinfo_h appinfo, void *user_data)
471 int *i = (int *)user_data;
474 ail_appinfo_get_str(appinfo, AIL_PROP_PACKAGE_STR, &appid);
475 printf("i=%d %s\n", (*i)++, appid);
478 return AIL_CB_RET_CANCEL;
480 return AIL_CB_RET_CONTINUE;
489 ret = ail_filter_new(&filter);
490 if (ret != AIL_ERROR_OK) {
494 ret = ail_filter_add_bool(filter, AIL_PROP_X_SLP_REMOVABLE_BOOL, true);
495 if (ret != AIL_ERROR_OK) {
499 ret = ail_filter_add_str(filter, AIL_PROP_TYPE_STR, "Application");
500 if (ret != AIL_ERROR_OK) {
504 printf("List apps which are removable and 'Application' typed\n");
505 ail_filter_list_appinfo_foreach(filter, appinfo_func, (void *)&i);
507 ail_filter_destroy(filter);
513 ail_error_e ail_filter_list_appinfo_foreach(ail_filter_h filter,
514 ail_list_appinfo_cb appinfo_func,
520 * @fn ail_error_e ail_error_e ail_filter_count_appinfo(ail_filter_h filter, int *count)
522 * @brief Gets the number of app which is filtered by the given filter. If the filter is not given (i.e filter handle is NULL), all app are counted.
524 * @par Sync (or) Async : Synchronous API
526 * @param[in] filter a filter handle
527 * @param[in] count the number of appinfo which is filtered
529 * @return 0 if success, negative value(<0) if fail\n
530 * @retval AIL_ERROR_OK success
531 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
532 * @retval AIL_ERROR_OUT_OF_MEMORY out of memory
537 * @see ail_filter_new()
538 * @see ail_filter_add_bool()
539 * @see ail_filter_add_int()
540 * @see ail_filter_add_str()
542 * @par Prospective Clients:
552 ret = ail_filter_new(&filter);
553 if (ret != AIL_ERROR_OK) {
557 ret = ail_filter_add_bool(filter, AIL_PROP_NODISPLAY_BOOL, true);
558 if (ret != AIL_ERROR_OK) {
562 ret = ail_filter_count_appinfo(filter, &n);
563 if (ret != AIL_ERROR_OK) {
567 printf("N of app not to be displayed = %d", n);
569 ret = ail_filter_count_appinfo(NULL, &n);
570 if (ret != AIL_ERROR_OK) {
574 printf("N of all app = %d\n", n);
580 ail_error_e ail_filter_count_appinfo(ail_filter_h filter, int *count);
585 * @fn ail_error_e ail_package_get_appinfo(const char *package, ail_appinfo_h *handle)
587 * @brief get an application information related to a package.
588 This API just retrieves all the information of the package from Application Information Database.
589 All data related to the package are loaded in the memory after calling this function.
590 If you want to read a value from the retrieving data, you have to use the functions of ail_appinfo_get_xxx.
592 * @par Sync (or) Async : Synchronous API.
594 * @param[in] package package name what you want to know about.
595 * @param[out] handle handle will be used with the functions of ail_appinfo_get_xxx. If no data, it will be NULL.
597 * @return 0 if success, negative value(<0) if fail\n
598 * @retval AIL_ERROR_OK success
599 * @retval AIL_ERROR_FAIL internal error
600 * @retval AIL_ERROR_DB_FAILED database error
601 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
602 * @retval AIL_ERROR_NO_DATA no data. cannot find the package.
604 * @pre declare a handle before calling this function. The handle is used as a second argument of this API.
605 * @post destroy the handle with the function of ail_package_destroy_appinfo after using it all.
607 * @see ail_package_destroy_appinfo(), ail_appinfo_get_bool(), ail_appinfo_get_int(), ail_appinfo_get_str()
609 * @par Prospective Clients:
613 static ail_error_e _get_name(const char *package)
615 ail_appinfo_h handle;
619 ret = ail_package_get_appinfo(package, &handle);
620 if (ret != AIL_ERROR_OK) {
621 return AIL_ERROR_FAIL;
624 ret = ail_appinfo_get_str(handle, AIL_PROP_NAME_STR, &str);
625 if (ret != AIL_ERROR_OK) {
626 return AIL_ERROR_FAIL;
628 fprintf(stderr, "Package[%s], Property[%s] : %s\n", package, property, str);
630 ret = ail_package_destroy_appinfo(handle);
631 if (ret != AIL_ERROR_OK) {
632 return AIL_ERROR_FAIL;
639 ail_error_e ail_package_get_appinfo(const char *package, ail_appinfo_h *handle) __attribute__((deprecated));
643 * @fn ail_error_e ail_get_appinfo(const char *appid, ail_appinfo_h *handle)
645 * @brief get an application information related to a appid.
646 This API just retrieves all the information of the application from Application Information Database.
647 All data related to the appid are loaded in the memory after calling this function.
648 If you want to read a value from the retrieving data, you have to use the functions of ail_appinfo_get_xxx.
650 * @par Sync (or) Async : Synchronous API.
652 * @param[in] appid appid what you want to know about.
653 * @param[out] handle handle will be used with the functions of ail_appinfo_get_xxx. If no data, it will be NULL.
655 * @return 0 if success, negative value(<0) if fail\n
656 * @retval AIL_ERROR_OK success
657 * @retval AIL_ERROR_FAIL internal error
658 * @retval AIL_ERROR_DB_FAILED database error
659 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
660 * @retval AIL_ERROR_NO_DATA no data. cannot find the app.
662 * @pre declare a handle before calling this function. The handle is used as a second argument of this API.
663 * @post destroy the handle with the function of ail_get_appinfo after using it all.
665 * @see ail_get_appinfo(), ail_appinfo_get_bool(), ail_appinfo_get_int(), ail_appinfo_get_str()
667 * @par Prospective Clients:
671 static ail_error_e _get_name(const char *appid)
673 ail_appinfo_h handle;
677 ret = ail_get_appinfo(appid, &handle);
678 if (ret != AIL_ERROR_OK) {
679 return AIL_ERROR_FAIL;
682 ret = ail_appinfo_get_str(handle, AIL_PROP_NAME_STR, &str);
683 if (ret != AIL_ERROR_OK) {
684 return AIL_ERROR_FAIL;
686 fprintf(stderr, "Package[%s], Property[%s] : %s\n", appid, property, str);
688 ret = ail_destroy_appinfo(handle);
689 if (ret != AIL_ERROR_OK) {
690 return AIL_ERROR_FAIL;
697 ail_error_e ail_get_appinfo(const char *appid, ail_appinfo_h *handle);
701 * @fn ail_error_e ail_appinfo_get_bool(const ail_appinfo_h handle, const char *property, bool *value)
703 * @brief get a boolean value related to the property.
704 Before using this API, the handle is defined by calling ail_get_appinfo.
705 This function needs a out-parameter for the value.
707 * @par Sync (or) Async : Synchronous API.
709 * @param[in] handle the handle is defined by calling ail_get_appinfo.
710 * @param[in] property a property type of boolean
711 * @param[out] value a out-parameter value that is mapped with the property.
713 * @return 0 if success, negative value(<0) if fail\n
714 * @retval AIL_ERROR_OK success
715 * @retval AIL_ERROR_DB_FAILED database error
716 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
718 * @pre define a handle using ail_get_appinfo. The handle is used as a first argument of this API.
719 * @post destroy the handle with the function of ail_destroy_appinfo after using it all.
721 * @see ail_get_appinfo(), ail_destroy_appinfo(), ail_appinfo_get_int(), ail_appinfo_get_str()
723 * @par Prospective Clients:
727 static ail_error_e _get_nodisplay(const char *appid)
729 ail_appinfo_h handle;
733 ret = ail_get_appinfo(appid, &handle);
734 if (ret != AIL_ERROR_OK) {
735 return AIL_ERROR_FAIL;
738 ret = ail_appinfo_get_bool(handle, AIL_PROP_NODISPLAY_BOOL, &value);
739 if (ret != AIL_ERROR_OK) {
740 return AIL_ERROR_FAIL;
742 fprintf(stderr, "appid[%s] : %d\n", appid, value);
744 ret = ail_destroy_appinfo(handle);
745 if (ret != AIL_ERROR_OK) {
746 return AIL_ERROR_FAIL;
753 ail_error_e ail_appinfo_get_bool(const ail_appinfo_h handle, const char *property, bool *value);
758 * @fn ail_error_e ail_appinfo_get_int(const ail_appinfo_h handle, const char *property, int *value)
760 * @brief get a integer value related to the property.
761 Before using this API, the handle is defined by calling ail_get_appinfo.
762 This function needs a out-parameter for the value.
764 * @par Sync (or) Async : Synchronous API.
766 * @param[in] handle the handle is defined by calling ail_get_appinfo.
767 * @param[in] property a property type of integer.
768 * @param[out] value a out-parameter value that is mapped with the property.
770 * @return 0 if success, negative value(<0) if fail\n
771 * @retval AIL_ERROR_OK success
772 * @retval AIL_ERROR_DB_FAILED database error
773 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
775 * @pre define a handle using ail_get_appinfo. The handle is used as a first argument of this API.
776 * @post destroy the handle with the function of ail_destroy_appinfo after using it all.
778 * @see ail_get_appinfo(), ail_destroy_appinfo(), ail_appinfo_get_bool(), ail_appinfo_get_str()
780 * @par Prospective Clients:
784 static ail_error_e _get_x_slp_baselayoutwidth(const char *appid)
786 ail_appinfo_h handle;
790 ret = ail_get_appinfo(appid, &handle);
791 if (ret != AIL_ERROR_OK) {
792 return AIL_ERROR_FAIL;
795 ret = ail_appinfo_get_int(handle, AIL_PROP_X_SLP_BASELAYOUTWIDTH_INT, &value);
796 if (ret != AIL_ERROR_OK) {
797 return AIL_ERROR_FAIL;
799 fprintf(stderr, "Package[%s] : %d\n", appid, value);
801 ret = ail_destroy_appinfo(handle);
802 if (ret != AIL_ERROR_OK) {
803 return AIL_ERROR_FAIL;
810 ail_error_e ail_appinfo_get_int(const ail_appinfo_h handle, const char *property, int *value);
815 * @fn ail_error_e ail_appinfo_get_str(const ail_appinfo_h handle, const char *property, char **str)
817 * @brief get a string related to the property.
818 Before using this API, the handle is defined by calling ail_get_appinfo.
819 This function needs a out-parameter for the value.
821 * @par Sync (or) Async : Synchronous API.
823 * @param[in] handle the handle is defined by calling ail_get_appinfo.
824 * @param[in] property a property type of string.
825 * @param[out] str a out-parameter string that is mapped with the property. The icon property contains the absolute file path. If there is no data, the value of str is NULL.
827 * @return 0 if success, negative value(<0) if fail\n
828 * @retval AIL_ERROR_OK success
829 * @retval AIL_ERROR_DB_FAILED database error
830 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
832 * @pre define a handle using ail_get_appinfo. The handle is used as a first argument of this API.
833 * @post str doesn't need to be freed. It will be freed by calling ail_destroy_appinfo.
835 * @see ail_get_appinfo(), ail_destroy_appinfo(), ail_appinfo_get_bool(), ail_appinfo_get_int()
837 * @par Prospective Clients:
841 static ail_error_e _get_nodisplay(const char *appid)
843 ail_appinfo_h handle;
847 ret = ail_get_appinfo(appid, &handle);
848 if (ret != AIL_ERROR_OK) {
849 return AIL_ERROR_FAIL;
852 ret = ail_appinfo_get_str(handle, AIL_PROP_NAME_STR, &value);
853 if (ret != AIL_ERROR_OK) {
854 return AIL_ERROR_FAIL;
856 fprintf(stderr, "Package[%s] : %d\n", appid, value);
858 ret = ail_destroy_appinfo(handle);
859 if (ret != AIL_ERROR_OK) {
860 return AIL_ERROR_FAIL;
867 ail_error_e ail_appinfo_get_str(const ail_appinfo_h handle, const char *property, char **str);
872 * @fn ail_error_e ail_package_destroy_appinfo(const ail_appinfo_h handle)
874 * @brief destroy a handle what you get with the function of ail_package_get_appinfo.
876 * @par Sync (or) Async : Synchronous API.
878 * @param[in] handle destroy all resources related to the handle.
880 * @return 0 if success, negative value(<0) if fail\n
881 * @retval AIL_ERROR_OK success
882 * @retval AIL_ERROR_DB_FAILED database error
883 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
885 * @pre need a handle that you don't need anymore.
886 * @post cannot use the handle after destroying.
888 * @see ail_package_get_appinfo(), ail_appinfo_get_bool(), ail_appinfo_get_int(), ail_appinfo_get_str()
890 * @par Prospective Clients:
894 static ail_error_e _get_name(const char *package)
896 ail_appinfo_h handle;
900 ret = ail_package_get_appinfo(package, &handle);
901 if (ret != AIL_ERROR_OK) {
902 return AIL_ERROR_FAIL;
905 ret = ail_appinfo_get_str(handle, AIL_PROP_NAME_STR, &str);
906 if (ret != AIL_ERROR_OK) {
907 return AIL_ERROR_FAIL;
909 fprintf(stderr, "Package[%s], Property[%s] : %s\n", package, property, str);
911 ret = ail_package_destroy_appinfo(handle);
912 if (ret != AIL_ERROR_OK) {
913 return AIL_ERROR_FAIL;
920 ail_error_e ail_package_destroy_appinfo(const ail_appinfo_h handle) __attribute__((deprecated));
924 * @fn ail_error_e ail_destroy_appinfo(const ail_appinfo_h handle)
926 * @brief destroy a handle what you get with the function of ail_get_appinfo.
928 * @par Sync (or) Async : Synchronous API.
930 * @param[in] handle destroy all resources related to the handle.
932 * @return 0 if success, negative value(<0) if fail\n
933 * @retval AIL_ERROR_OK success
934 * @retval AIL_ERROR_DB_FAILED database error
935 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
937 * @pre need a handle that you don't need anymore.
938 * @post cannot use the handle after destroying.
940 * @see ail_get_appinfo(), ail_appinfo_get_bool(), ail_appinfo_get_int(), ail_appinfo_get_str()
942 * @par Prospective Clients:
946 static ail_error_e _get_name(const char *appid)
948 ail_appinfo_h handle;
952 ret = ail_get_appinfo(appid, &handle);
953 if (ret != AIL_ERROR_OK) {
954 return AIL_ERROR_FAIL;
957 ret = ail_appinfo_get_str(handle, AIL_PROP_NAME_STR, &str);
958 if (ret != AIL_ERROR_OK) {
959 return AIL_ERROR_FAIL;
961 fprintf(stderr, "Package[%s], Property[%s] : %s\n", appid, property, str);
963 ret = ail_destroy_appinfo(handle);
964 if (ret != AIL_ERROR_OK) {
965 return AIL_ERROR_FAIL;
972 ail_error_e ail_destroy_appinfo(const ail_appinfo_h handle);
975 * @fn ail_error_e ail_close_appinfo_db(void)
977 * @brief close appinfo db.
979 * @par Sync (or) Async : Synchronous API.
981 * @return 0 if success, negative value(<0) if fail\n
982 * @retval AIL_ERROR_OK success
983 * @retval AIL_ERROR_DB_FAILED database error
984 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
986 * @pre need a handle that you don't need anymore.
987 * @post cannot use the handle after destroying.
989 * @see ail_get_appinfo(), ail_appinfo_get_bool(), ail_appinfo_get_int(), ail_appinfo_get_str()
991 * @par Prospective Clients:
995 static ail_error_e _get_name(const char *appid)
997 ail_appinfo_h handle;
1001 ret = ail_get_appinfo(appid, &handle);
1002 if (ret != AIL_ERROR_OK) {
1003 return AIL_ERROR_FAIL;
1006 ret = ail_appinfo_get_str(handle, AIL_PROP_NAME_STR, &str);
1007 if (ret != AIL_ERROR_OK) {
1008 return AIL_ERROR_FAIL;
1010 fprintf(stderr, "Package[%s], Property[%s] : %s\n", appid, property, str);
1012 ret = ail_destroy_appinfo(handle);
1013 if (ret != AIL_ERROR_OK) {
1014 return AIL_ERROR_FAIL;
1017 ret = ail_close_appinfo_db();
1018 if (ret != AIL_ERROR_OK) {
1019 return AIL_ERROR_FAIL;
1022 return AIL_ERROR_OK;
1026 ail_error_e ail_close_appinfo_db(void);
1030 * @fn ail_error_e ail_desktop_add(const char *appid)
1032 * @brief add a app information into Application Information Database.
1033 A desktop file for this app has to be installed in the desktop directory before using this API.
1034 If there is no database for Application Information Database, this API will create the DB.
1035 If there is a DB, this function adds information for the app into the DB.
1036 And a notification is published to the applications who want to know about changing DB.
1038 * @par Sync (or) Async : Synchronous API.
1042 * @return 0 if success, negative value(<0) if fail\n
1043 * @retval AIL_ERROR_OK success
1044 * @retval AIL_ERROR_FAIL internal error
1045 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
1047 * @pre a desktop file for the app has to be installed in the desktop directory before using this API.
1048 * @post app information is added into the Application Information Database.
1050 * @see ail_desktop_update(), ail_desktop_remove()
1052 * @par Prospective Clients:
1056 static ail_error_e _add_desktop(const char *appid)
1061 return AIL_ERROR_FAIL;
1064 ret = ail_desktop_add(appid);
1065 if (ret != AIL_ERROR_OK) {
1066 return AIL_ERROR_FAIL;
1069 return AIL_ERROR_OK;
1073 ail_error_e ail_desktop_add(const char *appid);
1078 * @fn ail_error_e ail_desktop_update(const char *appid)
1080 * @brief update a app information in the Application Information Database.
1081 A desktop file for this app has to be installed in the desktop directory before using this API.
1082 And a notification is published to the applications who want to know about changing DB.
1084 * @par Sync (or) Async : Synchronous API.
1088 * @return 0 if success, negative value(<0) if fail\n
1089 * @retval AIL_ERROR_OK success
1090 * @retval AIL_ERROR_FAIL internal error
1091 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
1093 * @pre a desktop file for the app has to be installed in the desktop directory before using this API.
1094 * @post update a app information in the Application Information Database.
1096 * @see ail_desktop_add(), ail_desktop_remove()
1098 * @par Prospective Clients:
1102 static ail_error_e _update_desktop(const char *appid)
1107 return AIL_ERROR_FAIL;
1110 ret = ail_desktop_update(appid);
1111 if (ret != AIL_ERROR_OK) {
1112 return AIL_ERROR_FAIL;
1115 return AIL_ERROR_OK;
1119 ail_error_e ail_desktop_update(const char *appid);
1124 * @fn ail_error_e ail_desktop_remove(const char *appid)
1126 * @brief remove a app information in the Application Information Database.
1127 And a notification is published to the applications who want to know about changing DB.
1129 * @par Sync (or) Async : Synchronous API.
1133 * @return 0 if success, negative value(<0) if fail\n
1134 * @retval AIL_ERROR_OK success
1135 * @retval AIL_ERROR_FAIL internal error
1136 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
1138 * @pre no pre-condition.
1139 * @post app information is removed in the Application Information Database.
1141 * @see ail_desktop_add(), ail_desktop_update()
1143 * @par Prospective Clients:
1147 static ail_error_e _remove_desktop(const char *appid)
1152 return AIL_ERROR_FAIL;
1155 ret = ail_desktop_remove(appid);
1156 if (ret != AIL_ERROR_OK) {
1157 return AIL_ERROR_FAIL;
1160 return AIL_ERROR_OK;
1164 ail_error_e ail_desktop_remove(const char *appid);
1167 * @fn ail_error_e ail_desktop_clean(const char *pkgid)
1169 * @brief clean a pkg information in the Application Information Database.
1171 * @par Sync (or) Async : Synchronous API.
1175 * @return 0 if success, negative value(<0) if fail\n
1176 * @retval AIL_ERROR_OK success
1177 * @retval AIL_ERROR_FAIL internal error
1178 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
1180 * @pre no pre-condition.
1181 * @post app information is removed in the Application Information Database.
1183 * @see ail_desktop_add(), ail_desktop_update()
1185 * @par Prospective Clients:
1189 static ail_error_e _clean_desktop(const char *pkgid)
1194 return AIL_ERROR_FAIL;
1197 ret = ail_desktop_clean(pkgid);
1198 if (ret != AIL_ERROR_OK) {
1199 return AIL_ERROR_FAIL;
1202 return AIL_ERROR_OK;
1206 ail_error_e ail_desktop_clean(const char *pkgid);
1210 * @fn ail_error_e ail_desktop_fota(const char *appid)
1212 * @brief add a app information into Application Information Database.
1213 A desktop file for this app has to be installed in the desktop directory before using this API.
1214 If there is no database for Application Information Database, this API will create the DB.
1215 If there is a DB, this function adds information for the app into the DB.
1216 And a notification is not published to the applications who want to know about changing DB.
1218 * @par Sync (or) Async : Synchronous API.
1222 * @return 0 if success, negative value(<0) if fail\n
1223 * @retval AIL_ERROR_OK success
1224 * @retval AIL_ERROR_FAIL internal error
1225 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
1227 * @pre a desktop file for the app has to be installed in the desktop directory before using this API.
1228 * @post app information is added into the Application Information Database.
1230 * @see ail_desktop_update(), ail_desktop_remove()
1232 * @par Prospective Clients:
1236 static ail_error_e _add_desktop_fota(const char *appid)
1241 return AIL_ERROR_FAIL;
1244 ret = ail_desktop_fota(appid);
1245 if (ret != AIL_ERROR_OK) {
1246 return AIL_ERROR_FAIL;
1249 return AIL_ERROR_OK;
1253 ail_error_e ail_desktop_fota(const char *appid);
1256 * @fn ail_error_e ail_desktop_appinfo_modify_str(const char *appid, const char *property, const char *value, bool broadcast)
1258 * @brief update a app information db.
1259 And a notification is published to the applications who want to know about changing DB.
1261 * @par Sync (or) Async : Synchronous API.
1265 * @return 0 if success, negative value(<0) if fail\n
1266 * @retval AIL_ERROR_OK success
1267 * @retval AIL_ERROR_FAIL internal error
1268 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
1270 * @pre no pre-condition.
1271 * @post app information is removed in the Application Information Database.
1274 * @par Prospective Clients:
1278 static ail_error_e _appinfo_modify_str(const char *appid, const char *property, const char *value, bool broadcast)
1283 return AIL_ERROR_FAIL;
1286 return AIL_ERROR_FAIL;
1289 return AIL_ERROR_FAIL;
1292 ret = ail_desktop_appinfo_modify_str(appid, property, value, broadcast);
1293 if (ret != AIL_ERROR_OK) {
1294 return AIL_ERROR_FAIL;
1297 return AIL_ERROR_OK;
1302 ail_error_e ail_desktop_appinfo_modify_str(const char *appid, const char *property, const char *value, bool broadcast);
1309 #endif /* __cplusplus */
1311 #endif /* __AIL_H__ */