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.
27 #include <sys/types.h>
29 #include <tzplatform_config.h>
32 #define GROUP_MENU 6010
33 #define GLOBAL_USER tzplatform_getuid(TZ_SYS_GLOBALAPP_USER)
35 #define USR_DESKTOP_DIRECTORY tzplatform_getenv(TZ_SYS_RO_DESKTOP_APP)
36 #define APP_INFO_DB_FILE tzplatform_mkpath(TZ_SYS_DB, ".app_info.db")
37 #define APP_INFO_DB_FILE_JOURNAL tzplatform_mkpath(TZ_SYS_DB, ".app_info.db-journal")
38 #define APP_INFO_DB_LABEL "*"
42 #endif /* __cplusplus */
46 * @ingroup APPLICATION_FRAMEWORK
47 * @defgroup ail Application Information Library
52 * @brief Application Information Library header
53 * @author Sunghyuk Lee (sunghyuk.lee@samsung.com), Jin Yoon (jinny.yoon@samsung.com)
64 * @brief string type properties
66 #define AIL_PROP_PACKAGE_STR "AIL_PROP_PACKAGE_STR"
67 #define AIL_PROP_EXEC_STR "AIL_PROP_EXEC_STR"
68 #define AIL_PROP_NAME_STR "AIL_PROP_NAME_STR"
69 #define AIL_PROP_TYPE_STR "AIL_PROP_TYPE_STR"
70 #define AIL_PROP_ICON_STR "AIL_PROP_ICON_STR"
71 #define AIL_PROP_CATEGORIES_STR "AIL_PROP_CATEGORIES_STR"
72 #define AIL_PROP_VERSION_STR "AIL_PROP_VERSION_STR"
73 #define AIL_PROP_MIMETYPE_STR "AIL_PROP_MIMETYPE_STR"
74 #define AIL_PROP_X_SLP_SERVICE_STR "AIL_PROP_X_SLP_SERVICE_STR"
75 #define AIL_PROP_X_SLP_PACKAGETYPE_STR "AIL_PROP_X_SLP_PACKAGETYPE_STR"
76 #define AIL_PROP_X_SLP_PACKAGECATEGORIES_STR "AIL_PROP_X_SLP_PACKAGECATEGORIES_STR"
77 #define AIL_PROP_X_SLP_PACKAGEID_STR "AIL_PROP_X_SLP_PACKAGEID_STR"
78 #define AIL_PROP_X_SLP_SVC_STR "AIL_PROP_X_SLP_SVC_STR"
79 #define AIL_PROP_X_SLP_EXE_PATH "AIL_PROP_X_SLP_EXE_PATH"
80 #define AIL_PROP_X_SLP_APPID_STR "AIL_PROP_X_SLP_APPID_STR"
81 #define AIL_PROP_X_SLP_PKGID_STR "AIL_PROP_X_SLP_PKGID_STR"
82 #define AIL_PROP_X_SLP_DOMAIN_STR "AIL_PROP_X_SLP_DOMAIN_STR"
83 #define AIL_PROP_X_SLP_SUBMODEMAINID_STR "AIL_PROP_X_SLP_SUBMODEMAINID_STR"
84 #define AIL_PROP_X_SLP_INSTALLEDSTORAGE_STR "AIL_PROP_X_SLP_INSTALLEDSTORAGE_STR"
87 * @brief integer type properties
89 #define AIL_PROP_X_SLP_TEMP_INT "AIL_PROP_X_SLP_TEMP_INT"
90 #define AIL_PROP_X_SLP_INSTALLEDTIME_INT "AIL_PROP_X_SLP_INSTALLEDTIME_INT"
93 * @brief boolean type properties
95 #define AIL_PROP_NODISPLAY_BOOL "AIL_PROP_NODISPLAY_BOOL"
96 #define AIL_PROP_X_SLP_TASKMANAGE_BOOL "AIL_PROP_X_SLP_TASKMANAGE_BOOL"
97 #define AIL_PROP_X_SLP_MULTIPLE_BOOL "AIL_PROP_X_SLP_MULTIPLE_BOOL"
98 #define AIL_PROP_X_SLP_REMOVABLE_BOOL "AIL_PROP_X_SLP_REMOVABLE_BOOL"
99 #define AIL_PROP_X_SLP_ISHORIZONTALSCALE_BOOL "AIL_PROP_X_SLP_ISHORIZONTALSCALE_BOOL"
100 #define AIL_PROP_X_SLP_ENABLED_BOOL "AIL_PROP_X_SLP_ENABLED_BOOL"
101 #define AIL_PROP_X_SLP_SUBMODE_BOOL "AIL_PROP_X_SLP_SUBMODE_BOOL"
104 * @brief A handle for filters
106 typedef struct ail_filter *ail_filter_h;
109 * @brief A handle for appinfos
111 typedef struct ail_appinfo *ail_appinfo_h;
114 * @brief return values
117 AIL_ERROR_OK = 0, /**< General success */
118 AIL_ERROR_FAIL = -1, /**< General error */
119 AIL_ERROR_DB_FAILED = -2, /**< Database error */
120 AIL_ERROR_OUT_OF_MEMORY = -3, /**< Out of memory */
121 AIL_ERROR_INVALID_PARAMETER = -4, /**< Invalid parameter */
122 AIL_ERROR_NO_DATA = -5, /**< Success, but no data */
126 * @fn ail_error_e ail_filter_new(ail_filter_h *filter)
128 * @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.
130 * @par Sync (or) Async : Synchronous API.
132 * @param[out] filter a pointer to a filter which is newly created
134 * @return 0 if success, negative value(<0) if fail\n
135 * @retval AIL_ERROR_OK success
136 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
137 * @retval AIL_ERROR_OUT_OF_MEMORY out of memory
140 * @post If the filter is no longer used, it should be freed with ail_filter_destroy()
142 * @see ail_filter_destroy()
144 * @par Prospective Clients:
150 * ail_filter_h filter;
154 * ret = ail_filter_new(&filter);
155 * if (ret != AIL_ERROR_OK)
158 * ret = ail_filter_add_bool(filter, AIL_PROP_NODISPLAY_BOOL, false);
159 * if (ret != AIL_ERROR_OK)
162 * ret = ail_filter_add_str(filter, AIL_PROP_MIMETYPE_STR, "audio/wav");
163 * if (ret != AIL_ERROR_OK)
166 * ret = ail_filter_count_appinfo(filter, &n);
167 * if (ret != AIL_ERROR_OK)
170 * ret = ail_filter_destroy(filter);
171 * printf("N of apps not to be displayed and supporting 'audo/wav' mime type = %d\n", n);
177 ail_error_e ail_filter_new(ail_filter_h *filter);
180 * @fn ail_error_e ail_error_e ail_filter_add_int(ail_filter_h filter, const char *property, const int value)
182 * @brief Add integer condition to filter
184 * @par Sync (or) Async : Synchronous API
186 * @param[in] filter a filter handle which can be create with ail_filter_new()
187 * @param[in] property a property type of integer
188 * @param[in] value the value to filter by
190 * @return 0 if success, negative value(<0) if fail\n
191 * @retval AIL_ERROR_OK success
192 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
193 * @retval AIL_ERROR_OUT_OF_MEMORY out of memory
195 * @pre The filter should be valid handle which was created by ail_filter_new()
197 * @see ail_filter_new()
199 * @par Prospective Clients:
205 * ail_filter_h filter;
209 * ret = ail_filter_new(&filter);
210 * if (ret != AIL_ERROR_OK)
213 * ret = ail_filter_add_int(filter, AIL_PROP_X_SLP_BASELAYOUTWIDTH_INT, 480);
214 * if (ret != AIL_ERROR_OK)
217 * ret = ail_filter_count_appinfo(filter, &n);
218 * if (ret != AIL_ERROR_OK)
221 * printf("N of apps = %d\n", n);
227 ail_error_e ail_filter_add_int(ail_filter_h filter, const char *property, const int value);
231 * @fn ail_error_e ail_error_e ail_filter_add_bool(ail_filter_h filter, const char *property, const bool value)
233 * @brief Add boolean condition to filter by. The value can be true/false only
235 * @par Sync (or) Async : Synchronous API
237 * @param[in] filter a filter handle which can be create with ail_filter_new()
238 * @param[in] property a property type of boolean
239 * @param[in] value the value to filter by
241 * @return 0 if success, negative value(<0) if fail\n
242 * @retval AIL_ERROR_OK success
243 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
244 * @retval AIL_ERROR_OUT_OF_MEMORY out of memory
246 * @pre The filter should be valid handle which was created by ail_filter_new()
248 * @see ail_filter_new()
250 * @par Prospective Clients:
256 * ail_filter_h filter;
260 * ret = ail_filter_new(&filter);
261 * if (ret != AIL_ERROR_OK)
264 * ret = ail_filter_add_bool(filter, AIL_PROP_X_SLP_REMOVABLE_BOOL, true);
265 * if (ret != AIL_ERROR_OK)
268 * ret = ail_filter_count_appinfo(filter, &n);
269 * if (ret != AIL_ERROR_OK)
272 * fprintf(stderr, "N of apps = %d\n", n);
278 ail_error_e ail_filter_add_bool(ail_filter_h filter, const char *property, bool value);
281 * @fn ail_error_e ail_error_e ail_filter_add_str(ail_filter_h filter, const char *property, const char *value)
283 * @brief Add string condition to filter by. The string is case-sensitive.
285 * @par Sync (or) Async : Synchronous API
287 * @param[in] filter a filter handle which can be create with ail_filter_new()
288 * @param[in] property a property type of string
289 * @param[in] value the value to filter by
291 * @return 0 if success, negative value(<0) if fail\n
292 * @retval AIL_ERROR_OK success
293 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
294 * @retval AIL_ERROR_OUT_OF_MEMORY out of memory
296 * @pre The filter should be valid handle which was created by ail_filter_new()
298 * @see ail_filter_new()
300 * @par Prospective Clients:
306 * ail_filter_h filter;
310 * ret = ail_filter_new(&filter);
311 * if (ret != AIL_ERROR_OK)
314 * ret = ail_filter_add_str(filter, AIL_PROP_PACKAGE_STR, "com.samsung.memo");
315 * if (ret != AIL_ERROR_OK)
318 * ret = ail_filter_count_appinfo(filter, &n);
319 * if (ret != AIL_ERROR_OK)
322 * fprintf(stderr, "N of apps = %d\n", n);
328 ail_error_e ail_filter_add_str(ail_filter_h filter, const char *property, const char *value);
332 * @fn ail_error_e ail_filter_destroy(ail_filter_h filter)
334 * @brief Destroy a filter which is not used any longer.
336 * @par Sync (or) Async : Synchronous API
338 * @param[in] filter filter handle
340 * @return 0 if success, negative value(<0) if fail\n
341 * @retval AIL_ERROR_OK success
342 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
344 * @post If the filter is no longer used, it should be freed with ail_filter_destroy()
346 * @see ail_filter_new()
348 * @par Prospective Clients:
354 * ail_filter_h filter;
358 * ret = ail_filter_new(&filter);
359 * if (ret != AIL_ERROR_OK)
362 * ret = ail_filter_add_bool(filter, AIL_PROP_X_SLP_REMOVABLE_BOOL, true);
363 * if (ret != AIL_ERROR_OK)
366 * ret = ail_filter_count_appinfo(filter, &n);
367 * if (ret != AIL_ERROR_OK)
370 * printf("N of removable apps = %d\n", n);
372 * ret = ail_filter_add_str(filter, AIL_PROP_MIMETYPE_STR, "audio/wav");
373 * if (ret != AIL_ERROR_OK)
376 * ret = ail_filter_count_appinfo(filter, &n);
377 * if (ret != AIL_ERROR_OK)
380 * printf("N of apps removable and supporting 'audo/wav' mime type = %d\n", n);
382 * ail_filter_destroy(filter);
388 ail_error_e ail_filter_destroy(ail_filter_h filter);
391 * @brief return value type of ail_list_appinfo_cb
394 AIL_CB_RET_CONTINUE = 1, /**< continue */
395 AIL_CB_RET_CANCEL = 0, /**< cancel */
399 * @fn ail_cb_ret_e (*ail_list_appinfo_cb) (const ail_appinfo_h appinfo_h, void *user_data)
401 * @breif Specifies the type of functions passed to ail_filter_list_appinfo_foreach().
403 * @param[in] appinfo_h the appinfo's handle
404 * @param[in] user_data user data passed to ail_filtet_list_appinfo_foreach()
406 * @return 0 if success, negative value(<0) if fail\n
407 * @retval AIL_CB_RET_CONTINUE return if you continue iteration
408 * @retval AIL_CB_RET_CANCEL return if you cancel iteration
410 * @see ail_filter_list_appinfo_foreach()
412 typedef ail_cb_ret_e (*ail_list_appinfo_cb)(const ail_appinfo_h appinfo_h, void *user_data, uid_t uid);
415 * @fn ail_error_e ail_error_e ail_filter_list_appinfo_foreach(ail_filter_h filter, ail_list_appinfo_cb func, void *user_data)
416 * @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)
417 * @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.
419 * @par Sync (or) Async : Synchronous API
421 * @param[in] filter a filter handle
422 * @param[in] func the function to call with each app's appinfo
423 * @param[in] user_data user_data to pass to the function
424 * @param[in] uid ID of the owner of the application
426 * @return 0 if success, negative value(<0) if fail\n
427 * @retval AIL_ERROR_OK success
428 * @retval AIL_ERROR_DB_FAILED database error
429 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
431 * @see ail_list_appinfo_cb
432 * @see ail_filter_add_bool()
433 * @see ail_filter_add_int()
434 * @see ail_filter_add_str()
436 * @par Prospective Clients:
440 * ail_cb_ret_e appinfo_func(const ail_appinfo_h appinfo, void *user_data)
442 * int *i = (int *)user_data;
445 * ail_appinfo_get_str(appinfo, AIL_PROP_PACKAGE_STR, &appid);
446 * printf("i=%d %s\n", (*i)++, appid);
449 * return AIL_CB_RET_CANCEL;
451 * return AIL_CB_RET_CONTINUE;
456 * ail_filter_h filter;
460 * ret = ail_filter_new(&filter);
461 * if (ret != AIL_ERROR_OK)
464 * ret = ail_filter_add_bool(filter, AIL_PROP_X_SLP_REMOVABLE_BOOL, true);
465 * if (ret != AIL_ERROR_OK)
468 * ret = ail_filter_add_str(filter, AIL_PROP_TYPE_STR, "Application");
469 * if (ret != AIL_ERROR_OK)
472 * printf("List apps which are removable and 'Application' typed\n");
473 * ail_filter_list_appinfo_foreach(filter, appinfo_func, (void *)&i);
474 * ail_filter_destroy(filter);
480 ail_error_e ail_filter_list_appinfo_foreach(ail_filter_h filter,
481 ail_list_appinfo_cb appinfo_func, void *user_data);
482 ail_error_e ail_filter_list_usr_appinfo_foreach(ail_filter_h filter,
483 ail_list_appinfo_cb appinfo_func, void *user_data, uid_t uid);
486 * @fn ail_error_e ail_error_e ail_filter_count_appinfo(ail_filter_h filter, int *count, uid_t uid)
487 * @fn ail_error_e ail_error_e ail_filter_count_usr_appinfo(ail_filter_h filter, int *count)
488 * @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.
490 * @par Sync (or) Async : Synchronous API
492 * @param[in] filter a filter handle
493 * @param[in] count the number of appinfo which is filtered
494 * @param[in] uid ID of the owner of the application
496 * @return 0 if success, negative value(<0) if fail\n
497 * @retval AIL_ERROR_OK success
498 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
499 * @retval AIL_ERROR_OUT_OF_MEMORY out of memory
504 * @see ail_filter_new()
505 * @see ail_filter_add_bool()
506 * @see ail_filter_add_int()
507 * @see ail_filter_add_str()
509 * @par Prospective Clients:
515 * ail_filter_h filter;
519 * ret = ail_filter_new(&filter);
520 * if (ret != AIL_ERROR_OK)
523 * ret = ail_filter_add_bool(filter, AIL_PROP_NODISPLAY_BOOL, true);
524 * if (ret != AIL_ERROR_OK)
527 * ret = ail_filter_count_appinfo(filter, &n);
528 * if (ret != AIL_ERROR_OK)
531 * printf("N of app not to be displayed = %d", n);
533 * ret = ail_filter_count_appinfo(NULL, &n);
534 * if (ret != AIL_ERROR_OK)
537 * printf("N of all app = %d\n", n);
543 ail_error_e ail_filter_count_appinfo(ail_filter_h filter, int *count);
544 ail_error_e ail_filter_count_usr_appinfo(ail_filter_h filter, int *count, uid_t uid);
547 * @fn ail_error_e ail_package_get_appinfo(const char *package, ail_appinfo_h *handle)
548 * @fn ail_error_e ail_package_get_appinfo(const char *package, uid_t uid, ail_appinfo_h *handle)
549 * @brief get an application information related to a package.
550 * This API just retrieves all the information of the package from Application Information Database.
551 * All data related to the package are loaded in the memory after calling this function.
552 * If you want to read a value from the retrieving data, you have to use the functions of ail_appinfo_get_xxx.
553 * @par Sync (or) Async : Synchronous API.
555 * @param[in] package package name what you want to know about.
556 * @param[in] uid ID of the owner of the application
557 * @param[out] handle handle will be used with the functions of ail_appinfo_get_xxx. If no data, it will be NULL.
559 * @return 0 if success, negative value(<0) if fail\n
560 * @retval AIL_ERROR_OK success
561 * @retval AIL_ERROR_FAIL internal error
562 * @retval AIL_ERROR_DB_FAILED database error
563 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
564 * @retval AIL_ERROR_NO_DATA no data. cannot find the package.
566 * @pre declare a handle before calling this function. The handle is used as a second argument of this API.
567 * @post destroy the handle with the function of ail_package_destroy_appinfo after using it all.
569 * @see ail_package_destroy_appinfo(), ail_appinfo_get_bool(), ail_appinfo_get_int(), ail_appinfo_get_str()
571 * @par Prospective Clients:
575 * static ail_error_e _get_name(const char *package)
577 * ail_appinfo_h handle;
581 * ret = ail_package_get_appinfo(package, &handle);
582 * if (ret != AIL_ERROR_OK)
583 * return AIL_ERROR_FAIL;
585 * ret = ail_appinfo_get_str(handle, AIL_PROP_NAME_STR, &str);
586 * if (ret != AIL_ERROR_OK)
587 * return AIL_ERROR_FAIL;
589 * fprintf(stderr, "Package[%s], Property[%s] : %s\n", package, property, str);
591 * ret = ail_package_destroy_appinfo(handle);
592 * if (ret != AIL_ERROR_OK)
593 * return AIL_ERROR_FAIL;
595 * return AIL_ERROR_OK;
599 ail_error_e ail_package_get_appinfo(const char *package, ail_appinfo_h *handle) __attribute__((deprecated));
600 ail_error_e ail_package_get_usr_appinfo(const char *package, uid_t uid, ail_appinfo_h *handle) __attribute__((deprecated));
603 * @fn ail_error_e ail_get_appinfo(const char *appid, ail_appinfo_h *handle)
604 * @fn ail_error_e ail_get_usr_appinfo(const char *appid, uid_t uid, ail_appinfo_h *handle)
605 * @brief get an application information related to a appid.
606 * This API just retrieves all the information of the application from Application Information Database.
607 * All data related to the appid are loaded in the memory after calling this function.
608 * If you want to read a value from the retrieving data, you have to use the functions of ail_appinfo_get_xxx.
610 * @par Sync (or) Async : Synchronous API.
612 * @param[in] appid appid what you want to know about.
613 * @param[out] handle handle will be used with the functions of ail_appinfo_get_xxx. If no data, it will be NULL.
615 * @return 0 if success, negative value(<0) if fail\n
616 * @retval AIL_ERROR_OK success
617 * @retval AIL_ERROR_FAIL internal error
618 * @retval AIL_ERROR_DB_FAILED database error
619 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
620 * @retval AIL_ERROR_NO_DATA no data. cannot find the app.
622 * @pre declare a handle before calling this function. The handle is used as a second argument of this API.
623 * @post destroy the handle with the function of ail_get_appinfo after using it all.
625 * @see ail_get_appinfo(), ail_appinfo_get_bool(), ail_appinfo_get_int(), ail_appinfo_get_str()
627 * @par Prospective Clients:
631 * static ail_error_e _get_name(const char *appid)
633 * ail_appinfo_h handle;
637 * ret = ail_get_appinfo(appid, &handle);
638 * if (ret != AIL_ERROR_OK)
639 * return AIL_ERROR_FAIL;
641 * ret = ail_appinfo_get_str(handle, AIL_PROP_NAME_STR, &str);
642 * if (ret != AIL_ERROR_OK)
643 * return AIL_ERROR_FAIL;
645 * fprintf(stderr, "Package[%s], Property[%s] : %s\n", appid, property, str);
647 * ret = ail_destroy_appinfo(handle);
648 * if (ret != AIL_ERROR_OK)
649 * return AIL_ERROR_FAIL;
651 * return AIL_ERROR_OK;
655 ail_error_e ail_get_appinfo(const char *appid, ail_appinfo_h *handle);
656 ail_error_e ail_get_usr_appinfo(const char *appid, uid_t uid, ail_appinfo_h *handle);
659 * @fn ail_error_e ail_appinfo_get_bool(const ail_appinfo_h handle, const char *property, bool *value)
661 * @brief get a boolean value related to the property.
662 * Before using this API, the handle is defined by calling ail_get_appinfo.
663 * This function needs a out-parameter for the value.
665 * @par Sync (or) Async : Synchronous API.
667 * @param[in] handle the handle is defined by calling ail_get_appinfo.
668 * @param[in] property a property type of boolean
669 * @param[out] value a out-parameter value that is mapped with the property.
671 * @return 0 if success, negative value(<0) if fail\n
672 * @retval AIL_ERROR_OK success
673 * @retval AIL_ERROR_DB_FAILED database error
674 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
676 * @pre define a handle using ail_get_appinfo. The handle is used as a first argument of this API.
677 * @post destroy the handle with the function of ail_destroy_appinfo after using it all.
679 * @see ail_get_appinfo(), ail_destroy_appinfo(), ail_appinfo_get_int(), ail_appinfo_get_str()
681 * @par Prospective Clients:
685 * static ail_error_e _get_nodisplay(const char *appid)
687 * ail_appinfo_h handle;
691 * ret = ail_get_appinfo(appid, &handle);
692 * if (ret != AIL_ERROR_OK)
693 * return AIL_ERROR_FAIL;
695 * ret = ail_appinfo_get_bool(handle, AIL_PROP_NODISPLAY_BOOL, &value);
696 * if (ret != AIL_ERROR_OK)
697 * return AIL_ERROR_FAIL;
699 * fprintf(stderr, "appid[%s] : %d\n", appid, value);
701 * ret = ail_destroy_appinfo(handle);
702 * if (ret != AIL_ERROR_OK)
703 * return AIL_ERROR_FAIL;
705 * return AIL_ERROR_OK;
709 ail_error_e ail_appinfo_get_bool(const ail_appinfo_h handle, const char *property, bool *value);
712 * @fn ail_error_e ail_appinfo_get_int(const ail_appinfo_h handle, const char *property, int *value)
714 * @brief get a integer value related to the property.
715 * Before using this API, the handle is defined by calling ail_get_appinfo.
716 * This function needs a out-parameter for the value.
718 * @par Sync (or) Async : Synchronous API.
720 * @param[in] handle the handle is defined by calling ail_get_appinfo.
721 * @param[in] property a property type of integer.
722 * @param[out] value a out-parameter value that is mapped with the property.
724 * @return 0 if success, negative value(<0) if fail\n
725 * @retval AIL_ERROR_OK success
726 * @retval AIL_ERROR_DB_FAILED database error
727 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
729 * @pre define a handle using ail_get_appinfo. The handle is used as a first argument of this API.
730 * @post destroy the handle with the function of ail_destroy_appinfo after using it all.
732 * @see ail_get_appinfo(), ail_destroy_appinfo(), ail_appinfo_get_bool(), ail_appinfo_get_str()
734 * @par Prospective Clients:
738 * static ail_error_e _get_x_slp_baselayoutwidth(const char *appid)
740 * ail_appinfo_h handle;
744 * ret = ail_get_appinfo(appid, &handle);
745 * if (ret != AIL_ERROR_OK)
746 * return AIL_ERROR_FAIL;
748 * ret = ail_appinfo_get_int(handle, AIL_PROP_X_SLP_BASELAYOUTWIDTH_INT, &value);
749 * if (ret != AIL_ERROR_OK)
750 * return AIL_ERROR_FAIL;
752 * fprintf(stderr, "Package[%s] : %d\n", appid, value);
754 * ret = ail_destroy_appinfo(handle);
755 * if (ret != AIL_ERROR_OK)
756 * return AIL_ERROR_FAIL;
758 * return AIL_ERROR_OK;
762 ail_error_e ail_appinfo_get_int(const ail_appinfo_h handle, const char *property, int *value);
765 * @fn ail_error_e ail_appinfo_get_str(const ail_appinfo_h handle, const char *property, uid_t uid, char **str)
766 * @fn ail_error_e ail_appinfo_get_usr_str(const ail_appinfo_h handle, const char *property, char **str)
767 * @brief get a string related to the property.
768 * Before using this API, the handle is defined by calling ail_get_appinfo.
769 * This function needs a out-parameter for the value.
771 * @par Sync (or) Async : Synchronous API.
773 * @param[in] handle the handle is defined by calling ail_get_appinfo.
774 * @param[in] property a property type of string.
775 * @param[in] uid the addressee user id of the instruction
776 * @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.
778 * @return 0 if success, negative value(<0) if fail\n
779 * @retval AIL_ERROR_OK success
780 * @retval AIL_ERROR_DB_FAILED database error
781 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
783 * @pre define a handle using ail_get_appinfo. The handle is used as a first argument of this API.
784 * @post str doesn't need to be freed. It will be freed by calling ail_destroy_appinfo.
786 * @see ail_get_appinfo(), ail_destroy_appinfo(), ail_appinfo_get_bool(), ail_appinfo_get_int()
788 * @par Prospective Clients:
792 * static ail_error_e _get_nodisplay(const char *appid)
794 * ail_appinfo_h handle;
798 * ret = ail_get_appinfo(appid, &handle);
799 * if (ret != AIL_ERROR_OK)
800 * return AIL_ERROR_FAIL;
802 * ret = ail_appinfo_get_str(handle, AIL_PROP_NAME_STR, &value);
803 * if (ret != AIL_ERROR_OK)
804 * return AIL_ERROR_FAIL;
806 * fprintf(stderr, "Package[%s] : %d\n", appid, value);
808 * ret = ail_destroy_appinfo(handle);
809 * if (ret != AIL_ERROR_OK)
810 * return AIL_ERROR_FAIL;
812 * return AIL_ERROR_OK;
816 ail_error_e ail_appinfo_get_str(const ail_appinfo_h handle, const char *property, char **str);
817 ail_error_e ail_appinfo_get_usr_str(const ail_appinfo_h handle, const char *property, uid_t uid, char **str);
820 * @fn ail_error_e ail_package_destroy_appinfo(const ail_appinfo_h handle)
822 * @brief destroy a handle what you get with the function of ail_package_get_appinfo.
824 * @par Sync (or) Async : Synchronous API.
826 * @param[in] handle destroy all resources related to the handle.
828 * @return 0 if success, negative value(<0) if fail\n
829 * @retval AIL_ERROR_OK success
830 * @retval AIL_ERROR_DB_FAILED database error
831 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
833 * @pre need a handle that you don't need anymore.
834 * @post cannot use the handle after destroying.
836 * @see ail_package_get_appinfo(), ail_appinfo_get_bool(), ail_appinfo_get_int(), ail_appinfo_get_str()
838 * @par Prospective Clients:
842 * static ail_error_e _get_name(const char *package)
844 * ail_appinfo_h handle;
848 * ret = ail_package_get_appinfo(package, &handle);
849 * if (ret != AIL_ERROR_OK)
850 * return AIL_ERROR_FAIL;
852 * ret = ail_appinfo_get_str(handle, AIL_PROP_NAME_STR, &str);
853 * if (ret != AIL_ERROR_OK)
854 * return AIL_ERROR_FAIL;
856 * fprintf(stderr, "Package[%s], Property[%s] : %s\n", package, property, str);
858 * ret = ail_package_destroy_appinfo(handle);
859 * if (ret != AIL_ERROR_OK)
860 * return AIL_ERROR_FAIL;
862 * return AIL_ERROR_OK;
866 ail_error_e ail_package_destroy_appinfo(const ail_appinfo_h handle) __attribute__((deprecated));
869 * @fn ail_error_e ail_destroy_appinfo(const ail_appinfo_h handle)
871 * @brief destroy a handle what you get with the function of ail_get_appinfo.
873 * @par Sync (or) Async : Synchronous API.
875 * @param[in] handle destroy all resources related to the handle.
877 * @return 0 if success, negative value(<0) if fail\n
878 * @retval AIL_ERROR_OK success
879 * @retval AIL_ERROR_DB_FAILED database error
880 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
882 * @pre need a handle that you don't need anymore.
883 * @post cannot use the handle after destroying.
885 * @see ail_get_appinfo(), ail_appinfo_get_bool(), ail_appinfo_get_int(), ail_appinfo_get_str()
887 * @par Prospective Clients:
891 * static ail_error_e _get_name(const char *appid)
893 * ail_appinfo_h handle;
897 * ret = ail_get_appinfo(appid, &handle);
898 * if (ret != AIL_ERROR_OK)
899 * return AIL_ERROR_FAIL;
901 * ret = ail_appinfo_get_str(handle, AIL_PROP_NAME_STR, &str);
902 * if (ret != AIL_ERROR_OK)
903 * return AIL_ERROR_FAIL;
905 * fprintf(stderr, "Package[%s], Property[%s] : %s\n", appid, property, str);
907 * ret = ail_destroy_appinfo(handle);
908 * if (ret != AIL_ERROR_OK)
909 * return AIL_ERROR_FAIL;
911 * return AIL_ERROR_OK;
915 ail_error_e ail_destroy_appinfo(const ail_appinfo_h handle);
918 * @fn ail_error_e ail_close_appinfo_db(void)
920 * @brief close appinfo db.
922 * @par Sync (or) Async : Synchronous API.
924 * @return 0 if success, negative value(<0) if fail\n
925 * @retval AIL_ERROR_OK success
926 * @retval AIL_ERROR_DB_FAILED database error
927 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
929 * @pre need a handle that you don't need anymore.
930 * @post cannot use the handle after destroying.
932 * @see ail_get_appinfo(), ail_appinfo_get_bool(), ail_appinfo_get_int(), ail_appinfo_get_str()
934 * @par Prospective Clients:
938 * static ail_error_e _get_name(const char *appid)
940 * ail_appinfo_h handle;
944 * ret = ail_get_appinfo(appid, &handle);
945 * if (ret != AIL_ERROR_OK)
946 * return AIL_ERROR_FAIL;
948 * ret = ail_appinfo_get_str(handle, AIL_PROP_NAME_STR, &str);
949 * if (ret != AIL_ERROR_OK)
950 * return AIL_ERROR_FAIL;
952 * fprintf(stderr, "Package[%s], Property[%s] : %s\n", appid, property, str);
954 * ret = ail_destroy_appinfo(handle);
955 * if (ret != AIL_ERROR_OK)
956 * return AIL_ERROR_FAIL;
958 * ret = ail_close_appinfo_db();
959 * if (ret != AIL_ERROR_OK)
960 * return AIL_ERROR_FAIL;
962 * return AIL_ERROR_OK;
966 ail_error_e ail_close_appinfo_db(void);
969 * @fn ail_error_e ail_desktop_add(const char *appid, )
970 * @fn ail_error_e ail_usr_desktop_add(const char *appid, uid_t uid)
971 * @brief add a app information into Application Information Database.
972 * A desktop file for this app has to be installed in the desktop directory before using this API.
973 * If there is no database for Application Information Database, this API will create the DB.
974 * If there is a DB, this function adds information for the app into the DB.
975 * And a notification is published to the applications who want to know about changing DB.
977 * @par Sync (or) Async : Synchronous API.
980 * @param[in] uid the addressee user id of the instruction
982 * @return 0 if success, negative value(<0) if fail\n
983 * @retval AIL_ERROR_OK success
984 * @retval AIL_ERROR_FAIL internal error
985 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
987 * @pre a desktop file for the app has to be installed in the desktop directory before using this API.
988 * @post app information is added into the Application Information Database.
990 * @see ail_desktop_update(), ail_desktop_remove()
992 * @par Prospective Clients:
996 * static ail_error_e _add_desktop(const char *appid)
1001 * return AIL_ERROR_FAIL;
1003 * ret = ail_desktop_add(appid);
1004 * if (ret != AIL_ERROR_OK)
1005 * return AIL_ERROR_FAIL;
1007 * return AIL_ERROR_OK;
1011 ail_error_e ail_desktop_add(const char *appid);
1012 ail_error_e ail_usr_desktop_add(const char *appid, uid_t uid);
1015 * @fn ail_error_e ail_desktop_update(const char *appid)
1016 * @fn ail_error_e ail_usr_desktop_update(const char *appid, uid_t uid)
1017 * @brief update a app information in the Application Information Database.
1018 * A desktop file for this app has to be installed in the desktop directory before using this API.
1019 * And a notification is published to the applications who want to know about changing DB.
1021 * @par Sync (or) Async : Synchronous API.
1024 * @param[in] uid ID of the owner of the application
1026 * @return 0 if success, negative value(<0) if fail\n
1027 * @retval AIL_ERROR_OK success
1028 * @retval AIL_ERROR_FAIL internal error
1029 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
1031 * @pre a desktop file for the app has to be installed in the desktop directory before using this API.
1032 * @post update a app information in the Application Information Database.
1034 * @see ail_desktop_add(), ail_desktop_remove()
1036 * @par Prospective Clients:
1040 * static ail_error_e _update_desktop(const char *appid)
1045 * return AIL_ERROR_FAIL;
1047 * ret = ail_desktop_update(appid);
1048 * if (ret != AIL_ERROR_OK)
1049 * return AIL_ERROR_FAIL;
1051 * return AIL_ERROR_OK;
1055 ail_error_e ail_desktop_update(const char *appid);
1056 ail_error_e ail_usr_desktop_update(const char *appid, uid_t uid);
1059 * @fn ail_error_e ail_desktop_remove(const char *appid)
1060 * @fn ail_error_e ail_usr_desktop_remove(const char *appid, uid_t uid)
1061 * @brief remove a app information in the Application Information Database.
1062 * And a notification is published to the applications who want to know about changing DB.
1064 * @par Sync (or) Async : Synchronous API.
1067 * @param[in] uid the addressee user id of the instruction
1069 * @return 0 if success, negative value(<0) if fail\n
1070 * @retval AIL_ERROR_OK success
1071 * @retval AIL_ERROR_FAIL internal error
1072 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
1074 * @pre no pre-condition.
1075 * @post app information is removed in the Application Information Database.
1077 * @see ail_desktop_add(), ail_desktop_update()
1079 * @par Prospective Clients:
1083 * static ail_error_e _remove_desktop(const char *appid)
1088 * return AIL_ERROR_FAIL;
1090 * ret = ail_desktop_remove(appid);
1091 * if (ret != AIL_ERROR_OK)
1092 * return AIL_ERROR_FAIL;
1094 * return AIL_ERROR_OK;
1098 ail_error_e ail_desktop_remove(const char *appid);
1099 ail_error_e ail_usr_desktop_remove(const char *appid, uid_t uid);
1102 * @fn ail_error_e ail_desktop_clean(const char *pkgid)
1103 * @fn ail_error_e ail_usr_desktop_clean(const char *pkgid, uid_t uid))
1104 * @brief clean a pkg information in the Application Information Database.
1106 * @par Sync (or) Async : Synchronous API.
1109 * @param[in] uid ID of the owner of the application
1111 * @return 0 if success, negative value(<0) if fail\n
1112 * @retval AIL_ERROR_OK success
1113 * @retval AIL_ERROR_FAIL internal error
1114 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
1116 * @pre no pre-condition.
1117 * @post app information is removed in the Application Information Database.
1119 * @see ail_desktop_add(), ail_desktop_update()
1121 * @par Prospective Clients:
1125 * static ail_error_e _clean_desktop(const char *pkgid)
1130 * return AIL_ERROR_FAIL;
1132 * ret = ail_desktop_clean(pkgid);
1133 * if (ret != AIL_ERROR_OK)
1134 * return AIL_ERROR_FAIL;
1136 * return AIL_ERROR_OK;
1140 ail_error_e ail_desktop_clean(const char *pkgid);
1141 ail_error_e ail_usr_desktop_clean(const char *pkgid, uid_t uid);
1144 * @fn ail_error_e ail_desktop_fota(const char *appid)
1145 * @fn ail_error_e ail_usr_desktop_fota(const char *appid, uid_t uid)
1146 * @brief add a app information into Application Information Database.
1147 * A desktop file for this app has to be installed in the desktop directory before using this API.
1148 * If there is no database for Application Information Database, this API will create the DB.
1149 * If there is a DB, this function adds information for the app into the DB.
1150 * And a notification is not published to the applications who want to know about changing DB.
1152 * @par Sync (or) Async : Synchronous API.
1155 * @param[in] uid the addressee user id of the instruction
1157 * @return 0 if success, negative value(<0) if fail\n
1158 * @retval AIL_ERROR_OK success
1159 * @retval AIL_ERROR_FAIL internal error
1160 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
1162 * @pre a desktop file for the app has to be installed in the desktop directory before using this API.
1163 * @post app information is added into the Application Information Database.
1165 * @see ail_desktop_update(), ail_desktop_remove()
1167 * @par Prospective Clients:
1171 * static ail_error_e _add_desktop_fota(const char *appid)
1176 * return AIL_ERROR_FAIL;
1178 * ret = ail_desktop_fota(appid);
1179 * if (ret != AIL_ERROR_OK)
1180 * return AIL_ERROR_FAIL;
1182 * return AIL_ERROR_OK;
1186 ail_error_e ail_desktop_fota(const char *appid);
1187 ail_error_e ail_usr_desktop_fota(const char *appid, uid_t uid);
1190 *@fn ail_error_e ail_desktop_appinfo_modify_str(const char *appid, const char *property, const char *value, bool broadcast)
1191 * @fn ail_error_e ail_desktop_appinfo_modify_usr_str(const char *appid, uid_t uid, const char *property, const char *value, bool broadcast)
1192 * @brief update a app information db.
1193 * And a notification is published to the applications who want to know about changing DB.
1195 * @par Sync (or) Async : Synchronous API.
1198 * @param[in] uid ID of the owner of the application
1200 * @return 0 if success, negative value(<0) if fail\n
1201 * @retval AIL_ERROR_OK success
1202 * @retval AIL_ERROR_FAIL internal error
1203 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
1205 * @pre no pre-condition.
1206 * @post app information is removed in the Application Information Database.
1209 * @par Prospective Clients:
1213 * static ail_error_e _appinfo_modify_str(const char *appid, uid_t uid, const char *property, const char *value, bool broadcast)
1218 * return AIL_ERROR_FAIL;
1221 * return AIL_ERROR_FAIL;
1224 * return AIL_ERROR_FAIL;
1226 * ret = ail_desktop_appinfo_modify_str(appid, property, value, broadcast);
1227 * if (ret != AIL_ERROR_OK)
1228 * return AIL_ERROR_FAIL;
1230 * return AIL_ERROR_OK;
1234 ail_error_e ail_desktop_appinfo_modify_str(const char *appid, const char *property, const char *value, bool broadcast);
1235 ail_error_e ail_desktop_appinfo_modify_usr_str(const char *appid, uid_t uid, const char *property, const char *value, bool broadcast);
1240 #endif /* __cplusplus */
1242 #endif /* __AIL_H__ */