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>
35 #define GROUP_MENU 6010
36 #define GLOBAL_USER tzplatform_getuid(TZ_SYS_GLOBALAPP_USER)
38 #define OPT_DESKTOP_DIRECTORY tzplatform_getenv(TZ_SYS_RW_DESKTOP_APP)
39 #define USR_DESKTOP_DIRECTORY tzplatform_getenv(TZ_SYS_RO_DESKTOP_APP)
40 #define APP_INFO_DB_FILE tzplatform_mkpath(TZ_SYS_DB,".app_info.db")
41 #define APP_INFO_DB_FILE_JOURNAL tzplatform_mkpath(TZ_SYS_DB,".app_info.db-journal")
42 #define APP_INFO_DB_LABEL "_"
46 #endif /* __cplusplus */
52 * @ingroup APPLICATION_FRAMEWORK
53 * @defgroup ail Application Information Library
58 * @brief Application Information Library header
59 * @author Sunghyuk Lee (sunghyuk.lee@samsung.com), Jin Yoon (jinny.yoon@samsung.com)
70 * @brief string type properties
72 #define AIL_PROP_PACKAGE_STR "AIL_PROP_PACKAGE_STR"
73 #define AIL_PROP_EXEC_STR "AIL_PROP_EXEC_STR"
74 #define AIL_PROP_NAME_STR "AIL_PROP_NAME_STR"
75 #define AIL_PROP_TYPE_STR "AIL_PROP_TYPE_STR"
76 #define AIL_PROP_ICON_STR "AIL_PROP_ICON_STR"
77 #define AIL_PROP_CATEGORIES_STR "AIL_PROP_CATEGORIES_STR"
78 #define AIL_PROP_VERSION_STR "AIL_PROP_VERSION_STR"
79 #define AIL_PROP_MIMETYPE_STR "AIL_PROP_MIMETYPE_STR"
80 #define AIL_PROP_X_SLP_SERVICE_STR "AIL_PROP_X_SLP_SERVICE_STR"
81 #define AIL_PROP_X_SLP_PACKAGETYPE_STR "AIL_PROP_X_SLP_PACKAGETYPE_STR"
82 #define AIL_PROP_X_SLP_PACKAGECATEGORIES_STR "AIL_PROP_X_SLP_PACKAGECATEGORIES_STR"
83 #define AIL_PROP_X_SLP_PACKAGEID_STR "AIL_PROP_X_SLP_PACKAGEID_STR"
84 #define AIL_PROP_X_SLP_SVC_STR "AIL_PROP_X_SLP_SVC_STR"
85 #define AIL_PROP_X_SLP_EXE_PATH "AIL_PROP_X_SLP_EXE_PATH"
86 #define AIL_PROP_X_SLP_APPID_STR "AIL_PROP_X_SLP_APPID_STR"
87 #define AIL_PROP_X_SLP_PKGID_STR "AIL_PROP_X_SLP_PKGID_STR"
88 #define AIL_PROP_X_SLP_DOMAIN_STR "AIL_PROP_X_SLP_DOMAIN_STR"
89 #define AIL_PROP_X_SLP_SUBMODEMAINID_STR "AIL_PROP_X_SLP_SUBMODEMAINID_STR"
90 #define AIL_PROP_X_SLP_INSTALLEDSTORAGE_STR "AIL_PROP_X_SLP_INSTALLEDSTORAGE_STR"
93 * @brief integer type properties
95 #define AIL_PROP_X_SLP_TEMP_INT "AIL_PROP_X_SLP_TEMP_INT"
96 #define AIL_PROP_X_SLP_INSTALLEDTIME_INT "AIL_PROP_X_SLP_INSTALLEDTIME_INT"
99 * @brief boolean type properties
101 #define AIL_PROP_NODISPLAY_BOOL "AIL_PROP_NODISPLAY_BOOL"
102 #define AIL_PROP_X_SLP_TASKMANAGE_BOOL "AIL_PROP_X_SLP_TASKMANAGE_BOOL"
103 #define AIL_PROP_X_SLP_MULTIPLE_BOOL "AIL_PROP_X_SLP_MULTIPLE_BOOL"
104 #define AIL_PROP_X_SLP_REMOVABLE_BOOL "AIL_PROP_X_SLP_REMOVABLE_BOOL"
105 #define AIL_PROP_X_SLP_ISHORIZONTALSCALE_BOOL "AIL_PROP_X_SLP_ISHORIZONTALSCALE_BOOL"
106 #define AIL_PROP_X_SLP_ENABLED_BOOL "AIL_PROP_X_SLP_ENABLED_BOOL"
107 #define AIL_PROP_X_SLP_SUBMODE_BOOL "AIL_PROP_X_SLP_SUBMODE_BOOL"
110 * @brief A handle for filters
112 typedef struct ail_filter *ail_filter_h;
115 * @brief A handle for appinfos
117 typedef struct ail_appinfo *ail_appinfo_h;
120 * @brief return values
123 AIL_ERROR_OK = 0, /**< General success */
124 AIL_ERROR_FAIL = -1, /**< General error */
125 AIL_ERROR_DB_FAILED = -2, /**< Database error */
126 AIL_ERROR_OUT_OF_MEMORY = -3, /**< Out of memory */
127 AIL_ERROR_INVALID_PARAMETER = -4, /**< Invalid parameter */
128 AIL_ERROR_NO_DATA = -5, /**< Success, but no data */
132 * @fn ail_error_e ail_filter_new(ail_filter_h *filter)
134 * @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.
136 * @par Sync (or) Async : Synchronous API.
138 * @param[out] filter a pointer to a filter which is newly created
140 * @return 0 if success, negative value(<0) if fail\n
141 * @retval AIL_ERROR_OK success
142 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
143 * @retval AIL_ERROR_OUT_OF_MEMORY out of memory
146 * @post If the filter is no longer used, it should be freed with ail_filter_destroy()
148 * @see ail_filter_destroy()
150 * @par Prospective Clients:
160 ret = ail_filter_new(&filter);
161 if (ret != AIL_ERROR_OK) {
165 ret = ail_filter_add_bool(filter, AIL_PROP_NODISPLAY_BOOL, false);
166 if (ret != AIL_ERROR_OK) {
170 ret = ail_filter_add_str(filter, AIL_PROP_MIMETYPE_STR, "audio/wav");
171 if (ret != AIL_ERROR_OK) {
175 ret = ail_filter_count_appinfo(filter, &n);
176 if (ret != AIL_ERROR_OK) {
179 ret = ail_filter_destroy(filter);
181 printf("N of apps not to be displayed and supporting 'audo/wav' mime type = %d\n", n);
187 ail_error_e ail_filter_new(ail_filter_h *filter);
192 * @fn ail_error_e ail_error_e ail_filter_add_int(ail_filter_h filter, const char *property, const int value)
194 * @brief Add integer condition to filter
196 * @par Sync (or) Async : Synchronous API
198 * @param[in] filter a filter handle which can be create with ail_filter_new()
199 * @param[in] property a property type of integer
200 * @param[in] value the value to filter by
202 * @return 0 if success, negative value(<0) if fail\n
203 * @retval AIL_ERROR_OK success
204 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
205 * @retval AIL_ERROR_OUT_OF_MEMORY out of memory
207 * @pre The filter should be valid handle which was created by ail_filter_new()
209 * @see ail_filter_new()
211 * @par Prospective Clients:
221 ret = ail_filter_new(&filter);
222 if (ret != AIL_ERROR_OK) {
226 ret = ail_filter_add_int(filter, AIL_PROP_X_SLP_BASELAYOUTWIDTH_INT, 480);
227 if (ret != AIL_ERROR_OK) {
231 ret = ail_filter_count_appinfo(filter, &n);
232 if (ret != AIL_ERROR_OK) {
236 printf("N of apps = %d\n", n);
242 ail_error_e ail_filter_add_int(ail_filter_h filter, const char *property, const int value);
246 * @fn ail_error_e ail_error_e ail_filter_add_bool(ail_filter_h filter, const char *property, const bool value)
248 * @brief Add boolean condition to filter by. The value can be true/false only
250 * @par Sync (or) Async : Synchronous API
252 * @param[in] filter a filter handle which can be create with ail_filter_new()
253 * @param[in] property a property type of boolean
254 * @param[in] value the value to filter by
256 * @return 0 if success, negative value(<0) if fail\n
257 * @retval AIL_ERROR_OK success
258 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
259 * @retval AIL_ERROR_OUT_OF_MEMORY out of memory
261 * @pre The filter should be valid handle which was created by ail_filter_new()
263 * @see ail_filter_new()
265 * @par Prospective Clients:
275 ret = ail_filter_new(&filter);
276 if (ret != AIL_ERROR_OK) {
280 ret = ail_filter_add_bool(filter, AIL_PROP_X_SLP_REMOVABLE_BOOL, true);
281 if (ret != AIL_ERROR_OK) {
285 ret = ail_filter_count_appinfo(filter, &n);
286 if (ret != AIL_ERROR_OK) {
290 fprintf(stderr, "N of apps = %d\n", n);
296 ail_error_e ail_filter_add_bool(ail_filter_h filter, const char *property, bool value);
301 * @fn ail_error_e ail_error_e ail_filter_add_str(ail_filter_h filter, const char *property, const char *value)
303 * @brief Add string condition to filter by. The string is case-sensitive.
305 * @par Sync (or) Async : Synchronous API
307 * @param[in] filter a filter handle which can be create with ail_filter_new()
308 * @param[in] property a property type of string
309 * @param[in] value the value to filter by
311 * @return 0 if success, negative value(<0) if fail\n
312 * @retval AIL_ERROR_OK success
313 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
314 * @retval AIL_ERROR_OUT_OF_MEMORY out of memory
316 * @pre The filter should be valid handle which was created by ail_filter_new()
318 * @see ail_filter_new()
320 * @par Prospective Clients:
330 ret = ail_filter_new(&filter);
331 if (ret != AIL_ERROR_OK) {
335 ret = ail_filter_add_str(filter, AIL_PROP_PACKAGE_STR, "com.samsung.memo");
336 if (ret != AIL_ERROR_OK) {
340 ret = ail_filter_count_appinfo(filter, &n);
341 if (ret != AIL_ERROR_OK) {
345 fprintf(stderr, "N of apps = %d\n", n);
351 ail_error_e ail_filter_add_str(ail_filter_h filter, const char *property, const char *value);
356 * @fn ail_error_e ail_filter_destroy(ail_filter_h filter)
358 * @brief Destroy a filter which is not used any longer.
360 * @par Sync (or) Async : Synchronous API
362 * @param[in] filter filter handle
364 * @return 0 if success, negative value(<0) if fail\n
365 * @retval AIL_ERROR_OK success
366 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
368 * @post If the filter is no longer used, it should be freed with ail_filter_destroy()
370 * @see ail_filter_new()
372 * @par Prospective Clients:
382 ret = ail_filter_new(&filter);
383 if (ret != AIL_ERROR_OK) {
387 ret = ail_filter_add_bool(filter, AIL_PROP_X_SLP_REMOVABLE_BOOL, true);
388 if (ret != AIL_ERROR_OK) {
392 ret = ail_filter_count_appinfo(filter, &n);
393 if (ret != AIL_ERROR_OK) {
397 printf("N of removable apps = %d\n", n);
399 ret = ail_filter_add_str(filter, AIL_PROP_MIMETYPE_STR, "audio/wav");
400 if (ret != AIL_ERROR_OK) {
404 ret = ail_filter_count_appinfo(filter, &n);
405 if (ret != AIL_ERROR_OK) {
409 printf("N of apps removable and supporting 'audo/wav' mime type = %d\n", n);
411 ret = ail_filter_destroy(filter);
417 ail_error_e ail_filter_destroy(ail_filter_h filter);
422 * @brief return value type of ail_list_appinfo_cb
425 AIL_CB_RET_CONTINUE = 1, /**< continue */
426 AIL_CB_RET_CANCEL = 0, /**< cancel */
430 * @fn ail_cb_ret_e (*ail_list_appinfo_cb) (const ail_appinfo_h appinfo_h, void *user_data)
432 * @breif Specifies the type of functions passed to ail_filter_list_appinfo_foreach().
434 * @param[in] appinfo_h the appinfo's handle
435 * @param[in] user_data user data passed to ail_filtet_list_appinfo_foreach()
437 * @return 0 if success, negative value(<0) if fail\n
438 * @retval AIL_CB_RET_CONTINUE return if you continue iteration
439 * @retval AIL_CB_RET_CANCEL return if you cancel iteration
441 * @see ail_filter_list_appinfo_foreach()
443 typedef ail_cb_ret_e (*ail_list_appinfo_cb) (const ail_appinfo_h appinfo_h, void *user_data);
446 * @fn ail_error_e ail_error_e ail_filter_list_appinfo_foreach(ail_filter_h filter, ail_list_appinfo_cb func, void *user_data)
447 * @fn ail_error_e ail_error_e ail_filter_list_usr_appinfo_foreach(ail_filter_h filter, ail_list_appinfo_cb func, void *user_data, uid_t uid)
448 * @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.
450 * @par Sync (or) Async : Synchronous API
452 * @param[in] filter a filter handle
453 * @param[in] func the function to call with each app's appinfo
454 * @param[in] user_data user_data to pass to the function
455 * @param[in] uid ID of the owner of the application
457 * @return 0 if success, negative value(<0) if fail\n
458 * @retval AIL_ERROR_OK success
459 * @retval AIL_ERROR_DB_FAILED database error
460 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
462 * @see ail_list_appinfo_cb
463 * @see ail_filter_add_bool()
464 * @see ail_filter_add_int()
465 * @see ail_filter_add_str()
467 * @par Prospective Clients:
472 ail_cb_ret_e appinfo_func(const ail_appinfo_h appinfo, void *user_data)
474 int *i = (int *)user_data;
477 ail_appinfo_get_str(appinfo, AIL_PROP_PACKAGE_STR, &appid);
478 printf("i=%d %s\n", (*i)++, appid);
481 return AIL_CB_RET_CANCEL;
483 return AIL_CB_RET_CONTINUE;
492 ret = ail_filter_new(&filter);
493 if (ret != AIL_ERROR_OK) {
497 ret = ail_filter_add_bool(filter, AIL_PROP_X_SLP_REMOVABLE_BOOL, true);
498 if (ret != AIL_ERROR_OK) {
502 ret = ail_filter_add_str(filter, AIL_PROP_TYPE_STR, "Application");
503 if (ret != AIL_ERROR_OK) {
507 printf("List apps which are removable and 'Application' typed\n");
508 ail_filter_list_appinfo_foreach(filter, appinfo_func, (void *)&i);
510 ail_filter_destroy(filter);
516 ail_error_e ail_filter_list_appinfo_foreach(ail_filter_h filter,
517 ail_list_appinfo_cb appinfo_func,
519 ail_error_e ail_filter_list_usr_appinfo_foreach(ail_filter_h filter,
520 ail_list_appinfo_cb appinfo_func,
521 void *user_data, uid_t uid);
523 * @fn ail_error_e ail_error_e ail_filter_count_appinfo(ail_filter_h filter, int *count, uid_t uid)
524 * @fn ail_error_e ail_error_e ail_filter_count_usr_appinfo(ail_filter_h filter, int *count)
525 * @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.
527 * @par Sync (or) Async : Synchronous API
529 * @param[in] filter a filter handle
530 * @param[in] count the number of appinfo which is filtered
531 * @param[in] uid ID of the owner of the application
533 * @return 0 if success, negative value(<0) if fail\n
534 * @retval AIL_ERROR_OK success
535 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
536 * @retval AIL_ERROR_OUT_OF_MEMORY out of memory
541 * @see ail_filter_new()
542 * @see ail_filter_add_bool()
543 * @see ail_filter_add_int()
544 * @see ail_filter_add_str()
546 * @par Prospective Clients:
556 ret = ail_filter_new(&filter);
557 if (ret != AIL_ERROR_OK) {
561 ret = ail_filter_add_bool(filter, AIL_PROP_NODISPLAY_BOOL, true);
562 if (ret != AIL_ERROR_OK) {
566 ret = ail_filter_count_appinfo(filter, &n);
567 if (ret != AIL_ERROR_OK) {
571 printf("N of app not to be displayed = %d", n);
573 ret = ail_filter_count_appinfo(NULL, &n);
574 if (ret != AIL_ERROR_OK) {
578 printf("N of all app = %d\n", n);
584 ail_error_e ail_filter_count_appinfo(ail_filter_h filter, int *count);
585 ail_error_e ail_filter_count_usr_appinfo(ail_filter_h filter, int *count, uid_t uid);
588 * @fn ail_error_e ail_package_get_appinfo(const char *package, ail_appinfo_h *handle)
589 * @fn ail_error_e ail_package_get_appinfo(const char *package, uid_t uid, ail_appinfo_h *handle)
590 * @brief get an application information related to a package.
591 This API just retrieves all the information of the package from Application Information Database.
592 All data related to the package are loaded in the memory after calling this function.
593 If you want to read a value from the retrieving data, you have to use the functions of ail_appinfo_get_xxx.
595 * @par Sync (or) Async : Synchronous API.
597 * @param[in] package package name what you want to know about.
598 * @param[in] uid ID of the owner of the application
599 * @param[out] handle handle will be used with the functions of ail_appinfo_get_xxx. If no data, it will be NULL.
601 * @return 0 if success, negative value(<0) if fail\n
602 * @retval AIL_ERROR_OK success
603 * @retval AIL_ERROR_FAIL internal error
604 * @retval AIL_ERROR_DB_FAILED database error
605 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
606 * @retval AIL_ERROR_NO_DATA no data. cannot find the package.
608 * @pre declare a handle before calling this function. The handle is used as a second argument of this API.
609 * @post destroy the handle with the function of ail_package_destroy_appinfo after using it all.
611 * @see ail_package_destroy_appinfo(), ail_appinfo_get_bool(), ail_appinfo_get_int(), ail_appinfo_get_str()
613 * @par Prospective Clients:
617 static ail_error_e _get_name(const char *package)
619 ail_appinfo_h handle;
623 ret = ail_package_get_appinfo(package, &handle);
624 if (ret != AIL_ERROR_OK) {
625 return AIL_ERROR_FAIL;
628 ret = ail_appinfo_get_str(handle, AIL_PROP_NAME_STR, &str);
629 if (ret != AIL_ERROR_OK) {
630 return AIL_ERROR_FAIL;
632 fprintf(stderr, "Package[%s], Property[%s] : %s\n", package, property, str);
634 ret = ail_package_destroy_appinfo(handle);
635 if (ret != AIL_ERROR_OK) {
636 return AIL_ERROR_FAIL;
643 ail_error_e ail_package_get_appinfo(const char *package, ail_appinfo_h *handle) __attribute__((deprecated));
644 ail_error_e ail_package_get_usr_appinfo(const char *package, uid_t uid, ail_appinfo_h *handle) __attribute__((deprecated));
646 * @fn ail_error_e ail_get_appinfo(const char *appid, ail_appinfo_h *handle)
647 * @fn ail_error_e ail_get_usr_appinfo(const char *appid, uid_t uid, ail_appinfo_h *handle)
648 * @brief get an application information related to a appid.
649 This API just retrieves all the information of the application from Application Information Database.
650 All data related to the appid are loaded in the memory after calling this function.
651 If you want to read a value from the retrieving data, you have to use the functions of ail_appinfo_get_xxx.
653 * @par Sync (or) Async : Synchronous API.
655 * @param[in] appid appid what you want to know about.
656 * @param[out] handle handle will be used with the functions of ail_appinfo_get_xxx. If no data, it will be NULL.
658 * @return 0 if success, negative value(<0) if fail\n
659 * @retval AIL_ERROR_OK success
660 * @retval AIL_ERROR_FAIL internal error
661 * @retval AIL_ERROR_DB_FAILED database error
662 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
663 * @retval AIL_ERROR_NO_DATA no data. cannot find the app.
665 * @pre declare a handle before calling this function. The handle is used as a second argument of this API.
666 * @post destroy the handle with the function of ail_get_appinfo after using it all.
668 * @see ail_get_appinfo(), ail_appinfo_get_bool(), ail_appinfo_get_int(), ail_appinfo_get_str()
670 * @par Prospective Clients:
674 static ail_error_e _get_name(const char *appid)
676 ail_appinfo_h handle;
680 ret = ail_get_appinfo(appid, &handle);
681 if (ret != AIL_ERROR_OK) {
682 return AIL_ERROR_FAIL;
685 ret = ail_appinfo_get_str(handle, AIL_PROP_NAME_STR, &str);
686 if (ret != AIL_ERROR_OK) {
687 return AIL_ERROR_FAIL;
689 fprintf(stderr, "Package[%s], Property[%s] : %s\n", appid, property, str);
691 ret = ail_destroy_appinfo(handle);
692 if (ret != AIL_ERROR_OK) {
693 return AIL_ERROR_FAIL;
700 ail_error_e ail_get_appinfo(const char *appid, ail_appinfo_h *handle);
701 ail_error_e ail_get_usr_appinfo(const char *appid, uid_t uid, ail_appinfo_h *handle);
704 * @fn ail_error_e ail_appinfo_get_bool(const ail_appinfo_h handle, const char *property, bool *value)
706 * @brief get a boolean value related to the property.
707 Before using this API, the handle is defined by calling ail_get_appinfo.
708 This function needs a out-parameter for the value.
710 * @par Sync (or) Async : Synchronous API.
712 * @param[in] handle the handle is defined by calling ail_get_appinfo.
713 * @param[in] property a property type of boolean
714 * @param[out] value a out-parameter value that is mapped with the property.
716 * @return 0 if success, negative value(<0) if fail\n
717 * @retval AIL_ERROR_OK success
718 * @retval AIL_ERROR_DB_FAILED database error
719 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
721 * @pre define a handle using ail_get_appinfo. The handle is used as a first argument of this API.
722 * @post destroy the handle with the function of ail_destroy_appinfo after using it all.
724 * @see ail_get_appinfo(), ail_destroy_appinfo(), ail_appinfo_get_int(), ail_appinfo_get_str()
726 * @par Prospective Clients:
730 static ail_error_e _get_nodisplay(const char *appid)
732 ail_appinfo_h handle;
736 ret = ail_get_appinfo(appid, &handle);
737 if (ret != AIL_ERROR_OK) {
738 return AIL_ERROR_FAIL;
741 ret = ail_appinfo_get_bool(handle, AIL_PROP_NODISPLAY_BOOL, &value);
742 if (ret != AIL_ERROR_OK) {
743 return AIL_ERROR_FAIL;
745 fprintf(stderr, "appid[%s] : %d\n", appid, value);
747 ret = ail_destroy_appinfo(handle);
748 if (ret != AIL_ERROR_OK) {
749 return AIL_ERROR_FAIL;
756 ail_error_e ail_appinfo_get_bool(const ail_appinfo_h handle, const char *property, bool *value);
761 * @fn ail_error_e ail_appinfo_get_int(const ail_appinfo_h handle, const char *property, int *value)
763 * @brief get a integer value related to the property.
764 Before using this API, the handle is defined by calling ail_get_appinfo.
765 This function needs a out-parameter for the value.
767 * @par Sync (or) Async : Synchronous API.
769 * @param[in] handle the handle is defined by calling ail_get_appinfo.
770 * @param[in] property a property type of integer.
771 * @param[out] value a out-parameter value that is mapped with the property.
773 * @return 0 if success, negative value(<0) if fail\n
774 * @retval AIL_ERROR_OK success
775 * @retval AIL_ERROR_DB_FAILED database error
776 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
778 * @pre define a handle using ail_get_appinfo. The handle is used as a first argument of this API.
779 * @post destroy the handle with the function of ail_destroy_appinfo after using it all.
781 * @see ail_get_appinfo(), ail_destroy_appinfo(), ail_appinfo_get_bool(), ail_appinfo_get_str()
783 * @par Prospective Clients:
787 static ail_error_e _get_x_slp_baselayoutwidth(const char *appid)
789 ail_appinfo_h handle;
793 ret = ail_get_appinfo(appid, &handle);
794 if (ret != AIL_ERROR_OK) {
795 return AIL_ERROR_FAIL;
798 ret = ail_appinfo_get_int(handle, AIL_PROP_X_SLP_BASELAYOUTWIDTH_INT, &value);
799 if (ret != AIL_ERROR_OK) {
800 return AIL_ERROR_FAIL;
802 fprintf(stderr, "Package[%s] : %d\n", appid, value);
804 ret = ail_destroy_appinfo(handle);
805 if (ret != AIL_ERROR_OK) {
806 return AIL_ERROR_FAIL;
813 ail_error_e ail_appinfo_get_int(const ail_appinfo_h handle, const char *property, int *value);
816 * @fn ail_error_e ail_appinfo_get_str(const ail_appinfo_h handle, const char *property, uid_t uid, char **str)
817 * @fn ail_error_e ail_appinfo_get_usr_str(const ail_appinfo_h handle, const char *property, char **str)
818 * @brief get a string related to the property.
819 Before using this API, the handle is defined by calling ail_get_appinfo.
820 This function needs a out-parameter for the value.
822 * @par Sync (or) Async : Synchronous API.
824 * @param[in] handle the handle is defined by calling ail_get_appinfo.
825 * @param[in] property a property type of string.
826 * @param[in] uid the addressee user id of the instruction
827 * @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.
829 * @return 0 if success, negative value(<0) if fail\n
830 * @retval AIL_ERROR_OK success
831 * @retval AIL_ERROR_DB_FAILED database error
832 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
834 * @pre define a handle using ail_get_appinfo. The handle is used as a first argument of this API.
835 * @post str doesn't need to be freed. It will be freed by calling ail_destroy_appinfo.
837 * @see ail_get_appinfo(), ail_destroy_appinfo(), ail_appinfo_get_bool(), ail_appinfo_get_int()
839 * @par Prospective Clients:
843 static ail_error_e _get_nodisplay(const char *appid)
845 ail_appinfo_h handle;
849 ret = ail_get_appinfo(appid, &handle);
850 if (ret != AIL_ERROR_OK) {
851 return AIL_ERROR_FAIL;
854 ret = ail_appinfo_get_str(handle, AIL_PROP_NAME_STR, &value);
855 if (ret != AIL_ERROR_OK) {
856 return AIL_ERROR_FAIL;
858 fprintf(stderr, "Package[%s] : %d\n", appid, value);
860 ret = ail_destroy_appinfo(handle);
861 if (ret != AIL_ERROR_OK) {
862 return AIL_ERROR_FAIL;
869 ail_error_e ail_appinfo_get_str(const ail_appinfo_h handle, const char *property, char **str);
870 ail_error_e ail_appinfo_get_usr_str(const ail_appinfo_h handle, const char *property, uid_t uid, char **str);
874 * @fn ail_error_e ail_package_destroy_appinfo(const ail_appinfo_h handle)
876 * @brief destroy a handle what you get with the function of ail_package_get_appinfo.
878 * @par Sync (or) Async : Synchronous API.
880 * @param[in] handle destroy all resources related to the handle.
882 * @return 0 if success, negative value(<0) if fail\n
883 * @retval AIL_ERROR_OK success
884 * @retval AIL_ERROR_DB_FAILED database error
885 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
887 * @pre need a handle that you don't need anymore.
888 * @post cannot use the handle after destroying.
890 * @see ail_package_get_appinfo(), ail_appinfo_get_bool(), ail_appinfo_get_int(), ail_appinfo_get_str()
892 * @par Prospective Clients:
896 static ail_error_e _get_name(const char *package)
898 ail_appinfo_h handle;
902 ret = ail_package_get_appinfo(package, &handle);
903 if (ret != AIL_ERROR_OK) {
904 return AIL_ERROR_FAIL;
907 ret = ail_appinfo_get_str(handle, AIL_PROP_NAME_STR, &str);
908 if (ret != AIL_ERROR_OK) {
909 return AIL_ERROR_FAIL;
911 fprintf(stderr, "Package[%s], Property[%s] : %s\n", package, property, str);
913 ret = ail_package_destroy_appinfo(handle);
914 if (ret != AIL_ERROR_OK) {
915 return AIL_ERROR_FAIL;
922 ail_error_e ail_package_destroy_appinfo(const ail_appinfo_h handle) __attribute__((deprecated));
926 * @fn ail_error_e ail_destroy_appinfo(const ail_appinfo_h handle)
928 * @brief destroy a handle what you get with the function of ail_get_appinfo.
930 * @par Sync (or) Async : Synchronous API.
932 * @param[in] handle destroy all resources related to the handle.
934 * @return 0 if success, negative value(<0) if fail\n
935 * @retval AIL_ERROR_OK success
936 * @retval AIL_ERROR_DB_FAILED database error
937 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
939 * @pre need a handle that you don't need anymore.
940 * @post cannot use the handle after destroying.
942 * @see ail_get_appinfo(), ail_appinfo_get_bool(), ail_appinfo_get_int(), ail_appinfo_get_str()
944 * @par Prospective Clients:
948 static ail_error_e _get_name(const char *appid)
950 ail_appinfo_h handle;
954 ret = ail_get_appinfo(appid, &handle);
955 if (ret != AIL_ERROR_OK) {
956 return AIL_ERROR_FAIL;
959 ret = ail_appinfo_get_str(handle, AIL_PROP_NAME_STR, &str);
960 if (ret != AIL_ERROR_OK) {
961 return AIL_ERROR_FAIL;
963 fprintf(stderr, "Package[%s], Property[%s] : %s\n", appid, property, str);
965 ret = ail_destroy_appinfo(handle);
966 if (ret != AIL_ERROR_OK) {
967 return AIL_ERROR_FAIL;
974 ail_error_e ail_destroy_appinfo(const ail_appinfo_h handle);
977 * @fn ail_error_e ail_close_appinfo_db(void)
979 * @brief close appinfo db.
981 * @par Sync (or) Async : Synchronous API.
983 * @return 0 if success, negative value(<0) if fail\n
984 * @retval AIL_ERROR_OK success
985 * @retval AIL_ERROR_DB_FAILED database error
986 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
988 * @pre need a handle that you don't need anymore.
989 * @post cannot use the handle after destroying.
991 * @see ail_get_appinfo(), ail_appinfo_get_bool(), ail_appinfo_get_int(), ail_appinfo_get_str()
993 * @par Prospective Clients:
997 static ail_error_e _get_name(const char *appid)
999 ail_appinfo_h handle;
1003 ret = ail_get_appinfo(appid, &handle);
1004 if (ret != AIL_ERROR_OK) {
1005 return AIL_ERROR_FAIL;
1008 ret = ail_appinfo_get_str(handle, AIL_PROP_NAME_STR, &str);
1009 if (ret != AIL_ERROR_OK) {
1010 return AIL_ERROR_FAIL;
1012 fprintf(stderr, "Package[%s], Property[%s] : %s\n", appid, property, str);
1014 ret = ail_destroy_appinfo(handle);
1015 if (ret != AIL_ERROR_OK) {
1016 return AIL_ERROR_FAIL;
1019 ret = ail_close_appinfo_db();
1020 if (ret != AIL_ERROR_OK) {
1021 return AIL_ERROR_FAIL;
1024 return AIL_ERROR_OK;
1028 ail_error_e ail_close_appinfo_db(void);
1032 * @fn ail_error_e ail_desktop_add(const char *appid, )
1033 * @fn ail_error_e ail_usr_desktop_add(const char *appid, uid_t uid)
1034 * @brief add a app information into Application Information Database.
1035 A desktop file for this app has to be installed in the desktop directory before using this API.
1036 If there is no database for Application Information Database, this API will create the DB.
1037 If there is a DB, this function adds information for the app into the DB.
1038 And a notification is published to the applications who want to know about changing DB.
1040 * @par Sync (or) Async : Synchronous API.
1043 * @param[in] uid the addressee user id of the instruction
1045 * @return 0 if success, negative value(<0) if fail\n
1046 * @retval AIL_ERROR_OK success
1047 * @retval AIL_ERROR_FAIL internal error
1048 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
1050 * @pre a desktop file for the app has to be installed in the desktop directory before using this API.
1051 * @post app information is added into the Application Information Database.
1053 * @see ail_desktop_update(), ail_desktop_remove()
1055 * @par Prospective Clients:
1059 static ail_error_e _add_desktop(const char *appid)
1064 return AIL_ERROR_FAIL;
1067 ret = ail_desktop_add(appid);
1068 if (ret != AIL_ERROR_OK) {
1069 return AIL_ERROR_FAIL;
1072 return AIL_ERROR_OK;
1076 ail_error_e ail_desktop_add(const char *appid);
1077 ail_error_e ail_usr_desktop_add(const char *appid, uid_t uid);
1081 * @fn ail_error_e ail_desktop_update(const char *appid)
1082 * @fn ail_error_e ail_usr_desktop_update(const char *appid, uid_t uid)
1083 * @brief update a app information in the Application Information Database.
1084 A desktop file for this app has to be installed in the desktop directory before using this API.
1085 And a notification is published to the applications who want to know about changing DB.
1087 * @par Sync (or) Async : Synchronous API.
1090 * @param[in] uid ID of the owner of the application
1092 * @return 0 if success, negative value(<0) if fail\n
1093 * @retval AIL_ERROR_OK success
1094 * @retval AIL_ERROR_FAIL internal error
1095 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
1097 * @pre a desktop file for the app has to be installed in the desktop directory before using this API.
1098 * @post update a app information in the Application Information Database.
1100 * @see ail_desktop_add(), ail_desktop_remove()
1102 * @par Prospective Clients:
1106 static ail_error_e _update_desktop(const char *appid)
1111 return AIL_ERROR_FAIL;
1114 ret = ail_desktop_update(appid);
1115 if (ret != AIL_ERROR_OK) {
1116 return AIL_ERROR_FAIL;
1119 return AIL_ERROR_OK;
1123 ail_error_e ail_desktop_update(const char *appid);
1124 ail_error_e ail_usr_desktop_update(const char *appid, uid_t uid);
1128 * @fn ail_error_e ail_desktop_remove(const char *appid)
1129 * @fn ail_error_e ail_usr_desktop_remove(const char *appid, uid_t uid)
1130 * @brief remove a app information in the Application Information Database.
1131 And a notification is published to the applications who want to know about changing DB.
1133 * @par Sync (or) Async : Synchronous API.
1136 * @param[in] uid the addressee user id of the instruction
1138 * @return 0 if success, negative value(<0) if fail\n
1139 * @retval AIL_ERROR_OK success
1140 * @retval AIL_ERROR_FAIL internal error
1141 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
1143 * @pre no pre-condition.
1144 * @post app information is removed in the Application Information Database.
1146 * @see ail_desktop_add(), ail_desktop_update()
1148 * @par Prospective Clients:
1152 static ail_error_e _remove_desktop(const char *appid)
1157 return AIL_ERROR_FAIL;
1160 ret = ail_desktop_remove(appid);
1161 if (ret != AIL_ERROR_OK) {
1162 return AIL_ERROR_FAIL;
1165 return AIL_ERROR_OK;
1169 ail_error_e ail_desktop_remove(const char *appid);
1170 ail_error_e ail_usr_desktop_remove(const char *appid, uid_t uid);
1173 * @fn ail_error_e ail_desktop_clean(const char *pkgid)
1174 * @fn ail_error_e ail_usr_desktop_clean(const char *pkgid, uid_t uid))
1175 * @brief clean a pkg information in the Application Information Database.
1177 * @par Sync (or) Async : Synchronous API.
1180 * @param[in] uid ID of the owner of the application
1182 * @return 0 if success, negative value(<0) if fail\n
1183 * @retval AIL_ERROR_OK success
1184 * @retval AIL_ERROR_FAIL internal error
1185 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
1187 * @pre no pre-condition.
1188 * @post app information is removed in the Application Information Database.
1190 * @see ail_desktop_add(), ail_desktop_update()
1192 * @par Prospective Clients:
1196 static ail_error_e _clean_desktop(const char *pkgid)
1201 return AIL_ERROR_FAIL;
1204 ret = ail_desktop_clean(pkgid);
1205 if (ret != AIL_ERROR_OK) {
1206 return AIL_ERROR_FAIL;
1209 return AIL_ERROR_OK;
1213 ail_error_e ail_desktop_clean(const char *pkgid);
1214 ail_error_e ail_usr_desktop_clean(const char *pkgid, uid_t uid);
1217 * @fn ail_error_e ail_desktop_fota(const char *appid)
1218 * @fn ail_error_e ail_usr_desktop_fota(const char *appid, uid_t uid)
1219 * @brief add a app information into Application Information Database.
1220 A desktop file for this app has to be installed in the desktop directory before using this API.
1221 If there is no database for Application Information Database, this API will create the DB.
1222 If there is a DB, this function adds information for the app into the DB.
1223 And a notification is not published to the applications who want to know about changing DB.
1225 * @par Sync (or) Async : Synchronous API.
1228 * @param[in] uid the addressee user id of the instruction
1230 * @return 0 if success, negative value(<0) if fail\n
1231 * @retval AIL_ERROR_OK success
1232 * @retval AIL_ERROR_FAIL internal error
1233 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
1235 * @pre a desktop file for the app has to be installed in the desktop directory before using this API.
1236 * @post app information is added into the Application Information Database.
1238 * @see ail_desktop_update(), ail_desktop_remove()
1240 * @par Prospective Clients:
1244 static ail_error_e _add_desktop_fota(const char *appid)
1249 return AIL_ERROR_FAIL;
1252 ret = ail_desktop_fota(appid);
1253 if (ret != AIL_ERROR_OK) {
1254 return AIL_ERROR_FAIL;
1257 return AIL_ERROR_OK;
1261 ail_error_e ail_desktop_fota(const char *appid);
1262 ail_error_e ail_usr_desktop_fota(const char *appid, uid_t uid);
1264 *@fn ail_error_e ail_desktop_appinfo_modify_str(const char *appid, const char *property, const char *value, bool broadcast)
1265 * @fn ail_error_e ail_desktop_appinfo_modify_usr_str(const char *appid, uid_t uid, const char *property, const char *value, bool broadcast)
1266 * @brief update a app information db.
1267 And a notification is published to the applications who want to know about changing DB.
1269 * @par Sync (or) Async : Synchronous API.
1272 * @param[in] uid ID of the owner of the application
1274 * @return 0 if success, negative value(<0) if fail\n
1275 * @retval AIL_ERROR_OK success
1276 * @retval AIL_ERROR_FAIL internal error
1277 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
1279 * @pre no pre-condition.
1280 * @post app information is removed in the Application Information Database.
1283 * @par Prospective Clients:
1287 static ail_error_e _appinfo_modify_str(const char *appid, uid_t uid, const char *property, const char *value, bool broadcast)
1292 return AIL_ERROR_FAIL;
1295 return AIL_ERROR_FAIL;
1298 return AIL_ERROR_FAIL;
1301 ret = ail_desktop_appinfo_modify_str(appid, property, value, broadcast);
1302 if (ret != AIL_ERROR_OK) {
1303 return AIL_ERROR_FAIL;
1306 return AIL_ERROR_OK;
1311 ail_error_e ail_desktop_appinfo_modify_str(const char *appid, const char *property, const char *value, bool broadcast);
1312 ail_error_e ail_desktop_appinfo_modify_usr_str(const char *appid, uid_t uid, const char *property, const char *value, bool broadcast);
1318 #endif /* __cplusplus */
1320 #endif /* __AIL_H__ */