summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt10
-rwxr-xr-xTC/build.sh20
-rwxr-xr-xTC/execute.sh19
-rwxr-xr-xTC/tet_code12
-rwxr-xr-xTC/tet_scen7
-rwxr-xr-xTC/tetbuild.cfg2
-rwxr-xr-xTC/tetclean.cfg2
-rwxr-xr-xTC/tetexec.cfg1
-rwxr-xr-xTC/unit/Makefile37
-rwxr-xr-xTC/unit/tc_gen.sh28
-rwxr-xr-xTC/unit/tslist15
-rwxr-xr-xTC/unit/utc_ApplicationFW_ail_appinfo_get_bool_func.c188
-rwxr-xr-xTC/unit/utc_ApplicationFW_ail_appinfo_get_int_func.c191
-rwxr-xr-xTC/unit/utc_ApplicationFW_ail_appinfo_get_str_func.c191
-rwxr-xr-xTC/unit/utc_ApplicationFW_ail_desktop_add_func.c93
-rwxr-xr-xTC/unit/utc_ApplicationFW_ail_desktop_remove_func.c95
-rwxr-xr-xTC/unit/utc_ApplicationFW_ail_desktop_update_func.c95
-rwxr-xr-xTC/unit/utc_ApplicationFW_ail_filter_add_bool_func.c165
-rwxr-xr-xTC/unit/utc_ApplicationFW_ail_filter_add_int_func.c165
-rwxr-xr-xTC/unit/utc_ApplicationFW_ail_filter_add_str_func.c166
-rwxr-xr-xTC/unit/utc_ApplicationFW_ail_filter_count_appinfo_func.c122
-rwxr-xr-xTC/unit/utc_ApplicationFW_ail_filter_destroy_func.c101
-rwxr-xr-xTC/unit/utc_ApplicationFW_ail_filter_list_appinfo_foreach_func.c133
-rwxr-xr-xTC/unit/utc_ApplicationFW_ail_filter_new_func.c97
-rwxr-xr-xTC/unit/utc_ApplicationFW_ail_package_destroy_appinfo_func.c107
-rwxr-xr-xTC/unit/utc_ApplicationFW_ail_package_get_appinfo_func.c141
-rwxr-xr-xTC/unit/utc_MODULE_API_func.c.in76
-rw-r--r--ail.manifest17
-rw-r--r--doc/images/SLP_AIL_add.pngbin0 -> 37733 bytes
-rw-r--r--doc/images/SLP_AIL_desktop.pngbin0 -> 11824 bytes
-rw-r--r--doc/images/SLP_AIL_get.pngbin0 -> 37930 bytes
-rw-r--r--doc/images/SLP_AIL_logical_view.pngbin0 -> 66723 bytes
-rwxr-xr-xinclude/SLP_AIL_PG.h270
-rwxr-xr-xinclude/ail.h338
-rwxr-xr-xinitdb/CMakeLists.txt17
-rwxr-xr-x[-rw-r--r--]packaging/ail.spec36
-rwxr-xr-xsrc/ail_convert.c13
-rwxr-xr-xsrc/ail_db.c63
-rwxr-xr-xsrc/ail_db.h4
-rwxr-xr-xsrc/ail_desktop.c738
-rwxr-xr-xsrc/ail_filter.c146
-rwxr-xr-xsrc/ail_package.c874
-rwxr-xr-xsrc/ail_package.h1
-rwxr-xr-xsrc/ail_private.h18
-rwxr-xr-xsrc/ail_sql.c53
-rwxr-xr-xsrc/ail_sql.h94
-rwxr-xr-xtest/CMakeLists.txt17
-rw-r--r--test/src/ail_test.c783
-rwxr-xr-xtool/CMakeLists.txt47
-rw-r--r--tool/src/ail_desktop.c132
-rw-r--r--tool/src/ail_filter.c315
-rw-r--r--tool/src/ail_package.c177
-rwxr-xr-xtool/src/initdb.c (renamed from initdb/src/initdb.c)73
-rw-r--r--tool/src/main.c.head22
-rw-r--r--tool/src/main.c.tail121
55 files changed, 6197 insertions, 451 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ae99411..08590a7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -6,7 +6,7 @@ PROJECT(ail C)
SET(LIBNAME "lib${PROJECT_NAME}")
SET(PREFIX ${CMAKE_INSTALL_PREFIX})
SET(BINDIR "${PREFIX}/bin")
-SET(LIBDIR "${PREFIX}/lib")
+SET(LIBDIR "${LIB_INSTALL_DIR}")
SET(INCLUDEDIR "${PREFIX}/include")
SET(VERSION_MAJOR 0)
SET(VERSION "${VERSION_MAJOR}.1.0")
@@ -46,11 +46,11 @@ SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES SOVERSION ${VERSION_MAJOR})
CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pc @ONLY)
# Install
-INSTALL(TARGETS ${LIBNAME} DESTINATION lib)
-INSTALL(FILES ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION lib/pkgconfig)
+INSTALL(TARGETS ${LIBNAME} DESTINATION ${LIB_INSTALL_DIR})
+INSTALL(FILES ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
INSTALL(FILES ${CMAKE_SOURCE_DIR}/include/ail.h DESTINATION include)
INSTALL(FILES ${CMAKE_SOURCE_DIR}/desktop.conf DESTINATION share/install-info)
# AIL init database
-ADD_SUBDIRECTORY(initdb)
-
+ADD_SUBDIRECTORY(tool)
+ADD_SUBDIRECTORY(test)
diff --git a/TC/build.sh b/TC/build.sh
new file mode 100755
index 0000000..e7a9432
--- /dev/null
+++ b/TC/build.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+export TET_INSTALL_PATH=$HOME/git/tetware/TETware # local tetware path
+export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target
+export PATH=$TET_TARGET_PATH/bin:$PATH
+export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH
+export TET_ROOT=$TET_TARGET_PATH
+
+export TET_SUITE_ROOT=`pwd`
+FILE_NAME_EXTENSION=`date +%s`
+
+RESULT_DIR=results
+HTML_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.html
+JOURNAL_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.journal
+
+mkdir -p $RESULT_DIR
+
+tcc -c -p ./
+tcc -b -j $JOURNAL_RESULT -p ./
+grw -c 3 -f chtml -o $HTML_RESULT $JOURNAL_RESULT
diff --git a/TC/execute.sh b/TC/execute.sh
new file mode 100755
index 0000000..a119011
--- /dev/null
+++ b/TC/execute.sh
@@ -0,0 +1,19 @@
+#!/bin/sh
+export TET_INSTALL_PATH=/mnt/nfs/git/tetware/TETware
+export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target
+export PATH=$TET_TARGET_PATH/bin:$PATH
+export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH
+
+export TET_ROOT=$TET_TARGET_PATH
+
+export TET_SUITE_ROOT=`pwd`
+FILE_NAME_EXTENSION=`date +%s`
+
+RESULT_DIR=results
+HTML_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.html
+JOURNAL_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.journal
+
+mkdir -p $RESULT_DIR
+
+tcc -e -j $JOURNAL_RESULT -p ./
+grw -c 3 -f chtml -o $HTML_RESULT $JOURNAL_RESULT
diff --git a/TC/tet_code b/TC/tet_code
new file mode 100755
index 0000000..a2cf6c1
--- /dev/null
+++ b/TC/tet_code
@@ -0,0 +1,12 @@
+# TET reserved codes
+0 "PASS"
+1 "FAIL"
+2 "UNRESOLVED"
+3 "NOTINUSE"
+4 "UNSUPPORTED"
+5 "UNTESTED"
+6 "UNINITIATED"
+7 "NORESULT"
+
+# Test suite additional codes
+33 "INSPECT"
diff --git a/TC/tet_scen b/TC/tet_scen
new file mode 100755
index 0000000..43cbc9b
--- /dev/null
+++ b/TC/tet_scen
@@ -0,0 +1,7 @@
+all
+ ^TEST
+##### Scenarios for TEST #####
+
+# Test scenario
+TEST
+ :include:/unit/tslist
diff --git a/TC/tetbuild.cfg b/TC/tetbuild.cfg
new file mode 100755
index 0000000..a584acd
--- /dev/null
+++ b/TC/tetbuild.cfg
@@ -0,0 +1,2 @@
+TET_OUTPUT_CAPTURE=False
+TET_BUILD_TOOL=make
diff --git a/TC/tetclean.cfg b/TC/tetclean.cfg
new file mode 100755
index 0000000..c66eda4
--- /dev/null
+++ b/TC/tetclean.cfg
@@ -0,0 +1,2 @@
+TET_OUTPUT_CAPTURE=False
+TET_CLEAN_TOOL=make clean
diff --git a/TC/tetexec.cfg b/TC/tetexec.cfg
new file mode 100755
index 0000000..0d9d39a
--- /dev/null
+++ b/TC/tetexec.cfg
@@ -0,0 +1 @@
+TET_OUTPUT_CAPTURE=False
diff --git a/TC/unit/Makefile b/TC/unit/Makefile
new file mode 100755
index 0000000..7528d06
--- /dev/null
+++ b/TC/unit/Makefile
@@ -0,0 +1,37 @@
+CC ?= gcc
+
+TARGETS = utc_ApplicationFW_ail_filter_new_func \
+ utc_ApplicationFW_ail_filter_destroy_func \
+ utc_ApplicationFW_ail_filter_add_str_func \
+ utc_ApplicationFW_ail_filter_add_int_func \
+ utc_ApplicationFW_ail_filter_add_bool_func \
+ utc_ApplicationFW_ail_filter_count_appinfo_func \
+ utc_ApplicationFW_ail_filter_list_appinfo_foreach_func \
+ utc_ApplicationFW_ail_package_get_appinfo_func \
+ utc_ApplicationFW_ail_package_destroy_appinfo_func \
+ utc_ApplicationFW_ail_appinfo_get_bool_func \
+ utc_ApplicationFW_ail_appinfo_get_str_func \
+ utc_ApplicationFW_ail_appinfo_get_int_func \
+ utc_ApplicationFW_ail_desktop_add_func \
+ utc_ApplicationFW_ail_desktop_remove_func \
+ utc_ApplicationFW_ail_desktop_update_func
+
+PKGS = glib-2.0 dlog ail
+
+LDFLAGS = `pkg-config --libs $(PKGS)`
+LDFLAGS += $(TET_ROOT)/lib/tet3/tcm_s.o
+LDFLAGS += -L$(TET_ROOT)/lib/tet3 -ltcm_s
+LDFLAGS += -L$(TET_ROOT)/lib/tet3 -lapi_s
+LDFLAGS += -L/usr/lib -lpthread
+
+CFLAGS = -I. `pkg-config --cflags $(PKGS)`
+CFLAGS += -I$(TET_ROOT)/inc/tet3
+CFLAGS += -Wall
+
+all: $(TARGETS)
+
+$(TARGETS): %: %.c
+ $(CC) -o $@ $< $(CFLAGS) $(LDFLAGS)
+
+clean:
+ rm -f $(TARGETS)
diff --git a/TC/unit/tc_gen.sh b/TC/unit/tc_gen.sh
new file mode 100755
index 0000000..54f482d
--- /dev/null
+++ b/TC/unit/tc_gen.sh
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+TMPSTR=$0
+SCRIPT=${TMPSTR##*/}
+
+if [ $# -lt 2 ]; then
+ echo "Usage) $SCRIPT module_name api_name"
+ exit 1
+fi
+
+MODULE=$1
+API=$2
+TEMPLATE=utc_MODULE_API_func.c.in
+TESTCASE=utc_${MODULE}_${API}_func
+
+sed -e '
+ s^@API@^'"$API"'^g
+ s^@MODULE@^'"$MODULE"'^g
+ ' $TEMPLATE > $TESTCASE.c
+
+if [ ! -e "$TESTCASE.c" ]; then
+ echo "Failed"
+ exit 1
+fi
+echo "Testcase file is $TESTCASE.c"
+echo "Done"
+echo "please put \"$TESTCASE\" as Target in Makefile"
+echo "please put \"/unit/$TESTCASE\" in tslist"
diff --git a/TC/unit/tslist b/TC/unit/tslist
new file mode 100755
index 0000000..d8bceb6
--- /dev/null
+++ b/TC/unit/tslist
@@ -0,0 +1,15 @@
+/unit/utc_ApplicationFW_ail_filter_new_func
+/unit/utc_ApplicationFW_ail_filter_destroy_func
+/unit/utc_ApplicationFW_ail_filter_add_str_func
+/unit/utc_ApplicationFW_ail_filter_add_int_func
+/unit/utc_ApplicationFW_ail_filter_add_bool_func
+/unit/utc_ApplicationFW_ail_filter_count_appinfo_func
+/unit/utc_ApplicationFW_ail_filter_list_appinfo_foreach_func
+/unit/utc_ApplicationFW_ail_package_get_appinfo_func
+/unit/utc_ApplicationFW_ail_package_destroy_appinfo_func
+/unit/utc_ApplicationFW_ail_appinfo_get_bool_func
+/unit/utc_ApplicationFW_ail_appinfo_get_str_func
+/unit/utc_ApplicationFW_ail_appinfo_get_int_func
+/unit/utc_ApplicationFW_ail_desktop_remove_func
+/unit/utc_ApplicationFW_ail_desktop_add_func
+/unit/utc_ApplicationFW_ail_desktop_update_func
diff --git a/TC/unit/utc_ApplicationFW_ail_appinfo_get_bool_func.c b/TC/unit/utc_ApplicationFW_ail_appinfo_get_bool_func.c
new file mode 100755
index 0000000..41f5189
--- /dev/null
+++ b/TC/unit/utc_ApplicationFW_ail_appinfo_get_bool_func.c
@@ -0,0 +1,188 @@
+/*
+ * ail
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+#include <tet_api.h>
+#include <ail.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_ail_appinfo_get_bool_func_01(void);
+static void utc_ApplicationFW_ail_appinfo_get_bool_func_02(void);
+static void utc_ApplicationFW_ail_appinfo_get_bool_func_03(void);
+static void utc_ApplicationFW_ail_appinfo_get_bool_func_04(void);
+static void utc_ApplicationFW_ail_appinfo_get_bool_func_05(void);
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_ail_appinfo_get_bool_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_ail_appinfo_get_bool_func_02, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_ail_appinfo_get_bool_func_03, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_ail_appinfo_get_bool_func_04, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_ail_appinfo_get_bool_func_05, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * API Prototype
+ * ail_error_e ail_appinfo_get_bool(const ail_appinfo_h handle,
+ * ail_prop_bool_e prop, bool *value)
+ *
+ * @param[in] handle the handle is defined by calling ail_package_get_appinfo.
+ * @param[in] prop use a property among the enumeration of ail_prop_bool_e.
+ * @param[out] value a out-parameter value that is mapped with the property.
+ *
+ * @return 0 if success, negative value(<0) if fail\n
+ * @retval AIL_ERROR_OK success
+ * @retval AIL_ERROR_DB_FAILED database error
+ * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
+ *
+
+ */
+
+/**
+ * @brief Positive test case of ail_appinfo_get_bool()
+ */
+static void utc_ApplicationFW_ail_appinfo_get_bool_func_01(void)
+{
+ ail_appinfo_h handle;
+ ail_error_e r;
+ bool value = 0;
+ r = ail_package_get_appinfo("com.samsung.calculator", &handle);
+ if (r != AIL_ERROR_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = ail_appinfo_get_bool(handle, AIL_PROP_NODISPLAY_BOOL, &value);
+ if (r != AIL_ERROR_OK) {
+ tet_infoline
+ ("ail_appinfo_get_bool() failed in positive test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ ail_package_destroy_appinfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case 01 of ail_appinfo_get_bool()
+ */
+static void utc_ApplicationFW_ail_appinfo_get_bool_func_02(void)
+{
+ ail_appinfo_h handle;
+ ail_error_e r;
+ ail_prop_bool_e prop = AIL_PROP_BOOL_MIN - 1;
+ bool value = 0;
+ r = ail_package_get_appinfo("com.samsung.calculator", &handle);
+ if (r != AIL_ERROR_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = ail_appinfo_get_bool(handle, prop, &value);
+ if (r != AIL_ERROR_INVALID_PARAMETER) {
+ tet_infoline
+ ("ail_appinfo_get_bool() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ ail_package_destroy_appinfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case 02 of ail_appinfo_get_bool()
+ */
+static void utc_ApplicationFW_ail_appinfo_get_bool_func_03(void)
+{
+ ail_appinfo_h handle;
+ ail_error_e r;
+ ail_prop_bool_e prop = AIL_PROP_BOOL_MAX + 1;
+ bool value = 0;
+ r = ail_package_get_appinfo("com.samsung.calculator", &handle);
+ if (r != AIL_ERROR_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = ail_appinfo_get_bool(handle, prop, &value);
+ if (r != AIL_ERROR_INVALID_PARAMETER) {
+ tet_infoline
+ ("ail_appinfo_get_bool() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ ail_package_destroy_appinfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case 03 of ail_appinfo_get_bool()
+ */
+static void utc_ApplicationFW_ail_appinfo_get_bool_func_04(void)
+{
+ ail_appinfo_h handle;
+ ail_error_e r;
+ r = ail_package_get_appinfo("com.samsung.calculator", &handle);
+ if (r != AIL_ERROR_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = ail_appinfo_get_bool(handle, AIL_PROP_NODISPLAY_BOOL, NULL);
+ if (r != AIL_ERROR_INVALID_PARAMETER) {
+ tet_infoline
+ ("ail_appinfo_get_bool() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ ail_package_destroy_appinfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case 04 of ail_appinfo_get_bool()
+ */
+static void utc_ApplicationFW_ail_appinfo_get_bool_func_05(void)
+{
+ ail_error_e r;
+ bool value = 0;
+ r = ail_appinfo_get_bool(NULL, AIL_PROP_NODISPLAY_BOOL, &value);
+ if (r != AIL_ERROR_INVALID_PARAMETER) {
+ tet_infoline
+ ("ail_appinfo_get_bool() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
diff --git a/TC/unit/utc_ApplicationFW_ail_appinfo_get_int_func.c b/TC/unit/utc_ApplicationFW_ail_appinfo_get_int_func.c
new file mode 100755
index 0000000..78b17b7
--- /dev/null
+++ b/TC/unit/utc_ApplicationFW_ail_appinfo_get_int_func.c
@@ -0,0 +1,191 @@
+/*
+ * ail
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+#include <tet_api.h>
+#include <ail.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_ail_appinfo_get_int_func_01(void);
+static void utc_ApplicationFW_ail_appinfo_get_int_func_02(void);
+static void utc_ApplicationFW_ail_appinfo_get_int_func_03(void);
+static void utc_ApplicationFW_ail_appinfo_get_int_func_04(void);
+static void utc_ApplicationFW_ail_appinfo_get_int_func_05(void);
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_ail_appinfo_get_int_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_ail_appinfo_get_int_func_02, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_ail_appinfo_get_int_func_03, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_ail_appinfo_get_int_func_04, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_ail_appinfo_get_int_func_05, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * API Prototype
+ * ail_error_e ail_appinfo_get_int(const ail_appinfo_h handle,
+ * ail_prop_int_e prop, int *value)
+ *
+ * @param[in] handle the handle is defined by calling ail_package_get_appinfo.
+ * @param[in] prop use a property among the enumeration of ail_prop_bool_e.
+ * @param[out] value a out-parameter value that is mapped with the property.
+ *
+ * @return 0 if success, negative value(<0) if fail\n
+ * @retval AIL_ERROR_OK success
+ * @retval AIL_ERROR_DB_FAILED database error
+ * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
+ *
+
+ */
+
+/**
+ * @brief Positive test case of ail_appinfo_get_int()
+ */
+static void utc_ApplicationFW_ail_appinfo_get_int_func_01(void)
+{
+ ail_appinfo_h handle;
+ ail_error_e r;
+ int value = -1;
+ r = ail_package_get_appinfo("com.samsung.calculator", &handle);
+ if (r != AIL_ERROR_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = ail_appinfo_get_int(handle, AIL_PROP_X_SLP_INSTALLEDTIME_INT,
+ &value);
+ if (r != AIL_ERROR_OK) {
+ tet_infoline
+ ("ail_appinfo_get_int() failed in positive test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ ail_package_destroy_appinfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case 01 of ail_appinfo_get_int()
+ */
+static void utc_ApplicationFW_ail_appinfo_get_int_func_02(void)
+{
+ ail_appinfo_h handle;
+ ail_error_e r;
+ ail_prop_int_e prop = AIL_PROP_INT_MIN - 1;
+ int value = -1;
+ r = ail_package_get_appinfo("com.samsung.calculator", &handle);
+ if (r != AIL_ERROR_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = ail_appinfo_get_int(handle, prop, &value);
+ if (r != AIL_ERROR_INVALID_PARAMETER) {
+ tet_infoline
+ ("ail_appinfo_get_int() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ ail_package_destroy_appinfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case 02 of ail_appinfo_get_int()
+ */
+static void utc_ApplicationFW_ail_appinfo_get_int_func_03(void)
+{
+ ail_appinfo_h handle;
+ ail_error_e r;
+ ail_prop_int_e prop = AIL_PROP_INT_MAX + 1;
+ int value = -1;
+ r = ail_package_get_appinfo("com.samsung.calculator", &handle);
+ if (r != AIL_ERROR_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = ail_appinfo_get_int(handle, prop, &value);
+ if (r != AIL_ERROR_INVALID_PARAMETER) {
+ tet_infoline
+ ("ail_appinfo_get_int() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ ail_package_destroy_appinfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case 03 of ail_appinfo_get_int()
+ */
+static void utc_ApplicationFW_ail_appinfo_get_int_func_04(void)
+{
+ ail_appinfo_h handle;
+ ail_error_e r;
+ r = ail_package_get_appinfo("com.samsung.calculator", &handle);
+ if (r != AIL_ERROR_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = ail_appinfo_get_int(handle, AIL_PROP_X_SLP_INSTALLEDTIME_INT,
+ NULL);
+ if (r != AIL_ERROR_INVALID_PARAMETER) {
+ tet_infoline
+ ("ail_appinfo_get_int() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ ail_package_destroy_appinfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case 04 of ail_appinfo_get_int()
+ */
+static void utc_ApplicationFW_ail_appinfo_get_int_func_05(void)
+{
+ ail_error_e r;
+ int value = -1;
+ r = ail_appinfo_get_int(NULL, AIL_PROP_X_SLP_INSTALLEDTIME_INT,
+ &value);
+ if (r != AIL_ERROR_INVALID_PARAMETER) {
+ tet_infoline
+ ("ail_appinfo_get_int() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
diff --git a/TC/unit/utc_ApplicationFW_ail_appinfo_get_str_func.c b/TC/unit/utc_ApplicationFW_ail_appinfo_get_str_func.c
new file mode 100755
index 0000000..dc729aa
--- /dev/null
+++ b/TC/unit/utc_ApplicationFW_ail_appinfo_get_str_func.c
@@ -0,0 +1,191 @@
+/*
+ * ail
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+#include <tet_api.h>
+#include <ail.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_ail_appinfo_get_str_func_01(void);
+static void utc_ApplicationFW_ail_appinfo_get_str_func_02(void);
+static void utc_ApplicationFW_ail_appinfo_get_str_func_03(void);
+static void utc_ApplicationFW_ail_appinfo_get_str_func_04(void);
+static void utc_ApplicationFW_ail_appinfo_get_str_func_05(void);
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_ail_appinfo_get_str_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_ail_appinfo_get_str_func_02, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_ail_appinfo_get_str_func_03, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_ail_appinfo_get_str_func_04, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_ail_appinfo_get_str_func_05, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * API Prototype
+ * ail_error_e ail_appinfo_get_str(const ail_appinfo_h handle,
+ * ail_prop_str_e prop, char **str)
+ *
+ * @param[in] handle the handle is defined by calling ail_package_get_appinfo.
+ * @param[in] prop use a property among the enumeration of ail_prop_bool_e.
+ * @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.
+ *
+ * @return 0 if success, negative value(<0) if fail\n
+ * @retval AIL_ERROR_OK success
+ * @retval AIL_ERROR_DB_FAILED database error
+ * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
+ *
+
+ */
+
+
+/**
+ * @brief Positive test case of ail_appinfo_get_str()
+ */
+static void utc_ApplicationFW_ail_appinfo_get_str_func_01(void)
+{
+ ail_appinfo_h handle;
+ ail_error_e r;
+ char *value;
+ r = ail_package_get_appinfo("com.samsung.calculator", &handle);
+ if (r != AIL_ERROR_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = ail_appinfo_get_str(handle, AIL_PROP_NAME_STR, &value);
+ if (r != AIL_ERROR_OK) {
+ tet_infoline
+ ("ail_appinfo_get_str() failed in positive test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ ail_package_destroy_appinfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case 01 of ail_appinfo_get_str()
+ */
+static void utc_ApplicationFW_ail_appinfo_get_str_func_02(void)
+{
+ ail_appinfo_h handle;
+ ail_error_e r;
+ ail_prop_str_e prop = AIL_PROP_STR_MIN - 1;
+ char *value;
+ r = ail_package_get_appinfo("com.samsung.calculator", &handle);
+ if (r != AIL_ERROR_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = ail_appinfo_get_str(handle, prop, &value);
+ if (r != AIL_ERROR_INVALID_PARAMETER) {
+ tet_infoline
+ ("ail_appinfo_get_str() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ ail_package_destroy_appinfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case 02 of ail_appinfo_get_str()
+ */
+static void utc_ApplicationFW_ail_appinfo_get_str_func_03(void)
+{
+ ail_appinfo_h handle;
+ ail_error_e r;
+ ail_prop_str_e prop = AIL_PROP_STR_MAX + 1;
+ char *value;
+ r = ail_package_get_appinfo("com.samsung.calculator", &handle);
+ if (r != AIL_ERROR_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = ail_appinfo_get_str(handle, prop, &value);
+ if (r != AIL_ERROR_INVALID_PARAMETER) {
+ tet_infoline
+ ("ail_appinfo_get_str() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ ail_package_destroy_appinfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case 03 of ail_appinfo_get_str()
+ */
+static void utc_ApplicationFW_ail_appinfo_get_str_func_04(void)
+{
+ ail_appinfo_h handle;
+ ail_error_e r;
+ r = ail_package_get_appinfo("com.samsung.calculator", &handle);
+ if (r != AIL_ERROR_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = ail_appinfo_get_str(handle, AIL_PROP_NAME_STR, NULL);
+ if (r != AIL_ERROR_INVALID_PARAMETER) {
+ tet_infoline
+ ("ail_appinfo_get_str() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ ail_package_destroy_appinfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case 04 of ail_appinfo_get_str()
+ */
+static void utc_ApplicationFW_ail_appinfo_get_str_func_05(void)
+{
+ ail_error_e r;
+ char *value;
+ r = ail_appinfo_get_str(NULL, AIL_PROP_NAME_STR, &value);
+ if (r != AIL_ERROR_INVALID_PARAMETER) {
+ tet_infoline
+ ("ail_appinfo_get_str() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
diff --git a/TC/unit/utc_ApplicationFW_ail_desktop_add_func.c b/TC/unit/utc_ApplicationFW_ail_desktop_add_func.c
new file mode 100755
index 0000000..887d85c
--- /dev/null
+++ b/TC/unit/utc_ApplicationFW_ail_desktop_add_func.c
@@ -0,0 +1,93 @@
+/*
+ * ail
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+#include <tet_api.h>
+#include <ail.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_ail_desktop_add_func_01(void);
+static void utc_ApplicationFW_ail_desktop_add_func_02(void);
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_ail_desktop_add_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_ail_desktop_add_func_02, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * API Prototype
+ * ail_error_e ail_desktop_add(const char *package)
+ * @param[in] package package name
+ *
+ * @return 0 if success, negative value(<0) if fail\n
+ * @retval AIL_ERROR_OK success
+ * @retval AIL_ERROR_FAIL internal error
+ * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
+ *
+ */
+
+/**
+ * @brief Positive test case of ail_desktop_add()
+ */
+static void utc_ApplicationFW_ail_desktop_add_func_01(void)
+{
+ ail_error_e r;
+ r = ail_desktop_add("com.samsung.calculator");
+ if (r != AIL_ERROR_OK) {
+ tet_infoline("ail_desktop_add() failed in positive test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of ail_desktop_add()
+ */
+static void utc_ApplicationFW_ail_desktop_add_func_02(void)
+{
+ ail_error_e r;
+ r = ail_desktop_add(NULL);
+ if (r != AIL_ERROR_INVALID_PARAMETER) {
+ tet_infoline("ail_desktop_add() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
diff --git a/TC/unit/utc_ApplicationFW_ail_desktop_remove_func.c b/TC/unit/utc_ApplicationFW_ail_desktop_remove_func.c
new file mode 100755
index 0000000..e6e79c0
--- /dev/null
+++ b/TC/unit/utc_ApplicationFW_ail_desktop_remove_func.c
@@ -0,0 +1,95 @@
+/*
+ * ail
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+#include <tet_api.h>
+#include <ail.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_ail_desktop_remove_func_01(void);
+static void utc_ApplicationFW_ail_desktop_remove_func_02(void);
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_ail_desktop_remove_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_ail_desktop_remove_func_02, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * API Prototype
+ * ail_error_e ail_desktop_remove(const char *package)
+ * @param[in] package package name
+ *
+ * @return 0 if success, negative value(<0) if fail\n
+ * @retval AIL_ERROR_OK success
+ * @retval AIL_ERROR_FAIL internal error
+ * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
+ *
+ */
+
+/**
+ * @brief Positive test case of ail_desktop_remove()
+ */
+static void utc_ApplicationFW_ail_desktop_remove_func_01(void)
+{
+ ail_error_e r;
+ r = ail_desktop_remove("com.samsung.calculator");
+ if (r != AIL_ERROR_OK) {
+ tet_infoline
+ ("ail_desktop_remove() failed in positive test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of ail_desktop_remove()
+ */
+static void utc_ApplicationFW_ail_desktop_remove_func_02(void)
+{
+ ail_error_e r;
+ r = ail_desktop_remove(NULL);
+ if (r != AIL_ERROR_INVALID_PARAMETER) {
+ tet_infoline
+ ("ail_desktop_remove() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
diff --git a/TC/unit/utc_ApplicationFW_ail_desktop_update_func.c b/TC/unit/utc_ApplicationFW_ail_desktop_update_func.c
new file mode 100755
index 0000000..235b3eb
--- /dev/null
+++ b/TC/unit/utc_ApplicationFW_ail_desktop_update_func.c
@@ -0,0 +1,95 @@
+/*
+ * ail
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+#include <tet_api.h>
+#include <ail.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_ail_desktop_update_func_01(void);
+static void utc_ApplicationFW_ail_desktop_update_func_02(void);
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_ail_desktop_update_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_ail_desktop_update_func_02, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * API Prototype
+ * ail_error_e ail_desktop_update(const char *package)
+ * @param[in] package package name
+ *
+ * @return 0 if success, negative value(<0) if fail\n
+ * @retval AIL_ERROR_OK success
+ * @retval AIL_ERROR_FAIL internal error
+ * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
+ *
+ */
+
+/**
+ * @brief Positive test case of ail_desktop_update()
+ */
+static void utc_ApplicationFW_ail_desktop_update_func_01(void)
+{
+ ail_error_e r;
+ r = ail_desktop_update("com.samsung.calculator");
+ if (r != AIL_ERROR_OK) {
+ tet_infoline
+ ("ail_desktop_update() failed in positive test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of ail_desktop_update()
+ */
+static void utc_ApplicationFW_ail_desktop_update_func_02(void)
+{
+ ail_error_e r;
+ r = ail_desktop_update(NULL);
+ if (r != AIL_ERROR_INVALID_PARAMETER) {
+ tet_infoline
+ ("ail_desktop_update() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
diff --git a/TC/unit/utc_ApplicationFW_ail_filter_add_bool_func.c b/TC/unit/utc_ApplicationFW_ail_filter_add_bool_func.c
new file mode 100755
index 0000000..febf7fd
--- /dev/null
+++ b/TC/unit/utc_ApplicationFW_ail_filter_add_bool_func.c
@@ -0,0 +1,165 @@
+/*
+ * ail
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+#include <tet_api.h>
+#include <ail.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_ail_filter_add_bool_func_01(void);
+static void utc_ApplicationFW_ail_filter_add_bool_func_02(void);
+static void utc_ApplicationFW_ail_filter_add_bool_func_03(void);
+static void utc_ApplicationFW_ail_filter_add_bool_func_04(void);
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_ail_filter_add_bool_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_ail_filter_add_bool_func_02, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_ail_filter_add_bool_func_03, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_ail_filter_add_bool_func_04, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * API Prototype
+ * ail_error_e ail_filter_add_bool(ail_filter_h filter,
+ * ail_prop_bool_e prop, const bool value)
+ *
+ * @param[in] filter a filter handle which can be create with ail_filter_new()
+ * @param[in] prop a property type in ail_prop_bool_e
+ * @param[in] value the value to filter by
+ *
+ * @return 0 if success, negative value(<0) if fail\n
+ * @retval AIL_ERROR_OK success
+ * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
+ * @retval AIL_ERROR_OUT_OF_MEMORY out of memory
+ *
+ */
+
+/**
+ * @brief Positive test case of ail_filter_add_bool()
+ */
+static void utc_ApplicationFW_ail_filter_add_bool_func_01(void)
+{
+ ail_filter_h filter;
+ ail_error_e r;
+ r = ail_filter_new(&filter);
+ if (r != AIL_ERROR_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = ail_filter_add_bool(filter, AIL_PROP_X_SLP_REMOVABLE_BOOL, 1);
+ if (r != AIL_ERROR_OK) {
+ tet_infoline
+ ("ail_filter_add_bool() failed in positive test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ ail_filter_destroy(filter);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case 01 of ail_filter_add_bool()
+ */
+static void utc_ApplicationFW_ail_filter_add_bool_func_02(void)
+{
+ ail_filter_h filter;
+ ail_error_e r;
+ ail_prop_bool_e prop = AIL_PROP_BOOL_MIN - 1;
+ r = ail_filter_new(&filter);
+ if (r != AIL_ERROR_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = ail_filter_add_bool(filter, prop, 0);
+ if (r != AIL_ERROR_INVALID_PARAMETER) {
+ tet_infoline
+ ("ail_filter_add_bool() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ ail_filter_destroy(filter);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case 02 of ail_filter_add_bool()
+ */
+static void utc_ApplicationFW_ail_filter_add_bool_func_03(void)
+{
+ ail_filter_h filter;
+ ail_error_e r;
+ ail_prop_bool_e prop = AIL_PROP_BOOL_MAX + 1;
+ r = ail_filter_new(&filter);
+ if (r != AIL_ERROR_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = ail_filter_add_bool(filter, prop, 0);
+ if (r != AIL_ERROR_INVALID_PARAMETER) {
+ tet_infoline
+ ("ail_filter_add_bool() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ ail_filter_destroy(filter);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case 03 of ail_filter_add_bool()
+ */
+static void utc_ApplicationFW_ail_filter_add_bool_func_04(void)
+{
+ ail_filter_h filter;
+ ail_error_e r;
+ r = ail_filter_new(&filter);
+ if (r != AIL_ERROR_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = ail_filter_add_bool(NULL, AIL_PROP_X_SLP_REMOVABLE_BOOL, 1);
+ if (r != AIL_ERROR_INVALID_PARAMETER) {
+ tet_infoline
+ ("ail_filter_add_bool() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ ail_filter_destroy(filter);
+ tet_result(TET_PASS);
+}
diff --git a/TC/unit/utc_ApplicationFW_ail_filter_add_int_func.c b/TC/unit/utc_ApplicationFW_ail_filter_add_int_func.c
new file mode 100755
index 0000000..80358f8
--- /dev/null
+++ b/TC/unit/utc_ApplicationFW_ail_filter_add_int_func.c
@@ -0,0 +1,165 @@
+/*
+ * ail
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+#include <tet_api.h>
+#include <ail.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_ail_filter_add_int_func_01(void);
+static void utc_ApplicationFW_ail_filter_add_int_func_02(void);
+static void utc_ApplicationFW_ail_filter_add_int_func_03(void);
+static void utc_ApplicationFW_ail_filter_add_int_func_04(void);
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_ail_filter_add_int_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_ail_filter_add_int_func_02, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_ail_filter_add_int_func_03, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_ail_filter_add_int_func_04, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * API Prototype
+ * ail_error_e ail_filter_add_int(ail_filter_h filter,
+ * ail_prop_int_e prop, const int value)
+ *
+ *@param[in] filter a filter handle which can be create with ail_filter_new()
+ * @param[in] prop a property type in ail_prop_int_e
+ * @param[in] value the value to filter by
+ *
+ * @return 0 if success, negative value(<0) if fail\n
+ * @retval AIL_ERROR_OK success
+ * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
+ * @retval AIL_ERROR_OUT_OF_MEMORY out of memory
+ *
+ */
+
+/**
+ * @brief Positive test case of ail_filter_add_int()
+ */
+static void utc_ApplicationFW_ail_filter_add_int_func_01(void)
+{
+ ail_filter_h filter;
+ ail_error_e r;
+ r = ail_filter_new(&filter);
+ if (r != AIL_ERROR_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = ail_filter_add_int(filter, AIL_PROP_X_SLP_INSTALLEDTIME_INT, 480);
+ if (r != AIL_ERROR_OK) {
+ tet_infoline
+ ("ail_filter_add_int() failed in positive test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ ail_filter_destroy(filter);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case 01 of ail_filter_add_int()
+ */
+static void utc_ApplicationFW_ail_filter_add_int_func_02(void)
+{
+ ail_filter_h filter;
+ ail_error_e r;
+ ail_prop_int_e prop = AIL_PROP_INT_MIN - 1;
+ r = ail_filter_new(&filter);
+ if (r != AIL_ERROR_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = ail_filter_add_int(filter, prop, 480);
+ if (r != AIL_ERROR_INVALID_PARAMETER) {
+ tet_infoline
+ ("ail_filter_add_int() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ ail_filter_destroy(filter);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case 02 of ail_filter_add_int()
+ */
+static void utc_ApplicationFW_ail_filter_add_int_func_03(void)
+{
+ ail_filter_h filter;
+ ail_error_e r;
+ ail_prop_int_e prop = AIL_PROP_INT_MAX + 1;
+ r = ail_filter_new(&filter);
+ if (r != AIL_ERROR_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = ail_filter_add_int(filter, prop, 480);
+ if (r != AIL_ERROR_INVALID_PARAMETER) {
+ tet_infoline
+ ("ail_filter_add_int() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ ail_filter_destroy(filter);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case 03 of ail_filter_add_int()
+ */
+static void utc_ApplicationFW_ail_filter_add_int_func_04(void)
+{
+ ail_filter_h filter;
+ ail_error_e r;
+ r = ail_filter_new(&filter);
+ if (r != AIL_ERROR_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = ail_filter_add_int(NULL, AIL_PROP_X_SLP_INSTALLEDTIME_INT, 480);
+ if (r != AIL_ERROR_INVALID_PARAMETER) {
+ tet_infoline
+ ("ail_filter_add_int() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ ail_filter_destroy(filter);
+ tet_result(TET_PASS);
+}
diff --git a/TC/unit/utc_ApplicationFW_ail_filter_add_str_func.c b/TC/unit/utc_ApplicationFW_ail_filter_add_str_func.c
new file mode 100755
index 0000000..669ab0f
--- /dev/null
+++ b/TC/unit/utc_ApplicationFW_ail_filter_add_str_func.c
@@ -0,0 +1,166 @@
+/*
+ * ail
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+#include <tet_api.h>
+#include <ail.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_ail_filter_add_str_func_01(void);
+static void utc_ApplicationFW_ail_filter_add_str_func_02(void);
+static void utc_ApplicationFW_ail_filter_add_str_func_03(void);
+static void utc_ApplicationFW_ail_filter_add_str_func_04(void);
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_ail_filter_add_str_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_ail_filter_add_str_func_02, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_ail_filter_add_str_func_03, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_ail_filter_add_str_func_04, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * API Prototype
+ * ail_error_e ail_filter_add_str(ail_filter_h filter,
+ * ail_prop_str_e prop, const char *value)
+ *
+ * @param[in] filter a filter handle which can be create with ail_filter_new()
+ * @param[in] prop a property type in ail_prop_bool_e
+ * @param[in] value the value to filter by
+ *
+ * @return 0 if success, negative value(<0) if fail\n
+ * @retval AIL_ERROR_OK success
+ * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
+ * @retval AIL_ERROR_OUT_OF_MEMORY out of memory
+ *
+ */
+
+/**
+ * @brief Positive test case of ail_filter_add_str()
+ */
+static void utc_ApplicationFW_ail_filter_add_str_func_01(void)
+{
+ ail_filter_h filter;
+ ail_error_e r;
+ r = ail_filter_new(&filter);
+ if (r != AIL_ERROR_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = ail_filter_add_str(filter, AIL_PROP_PACKAGE_STR,
+ "com.samsung.memo");
+ if (r != AIL_ERROR_OK) {
+ tet_infoline
+ ("ail_filter_add_str() failed in positive test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ ail_filter_destroy(filter);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case 01 of ail_filter_add_str()
+ */
+static void utc_ApplicationFW_ail_filter_add_str_func_02(void)
+{
+ ail_filter_h filter;
+ ail_error_e r;
+ ail_prop_str_e prop = AIL_PROP_STR_MIN - 1;
+ r = ail_filter_new(&filter);
+ if (r != AIL_ERROR_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = ail_filter_add_str(filter, prop, "com.samsung.memo");
+ if (r != AIL_ERROR_INVALID_PARAMETER) {
+ tet_infoline
+ ("ail_filter_add_str() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ ail_filter_destroy(filter);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case 02 of ail_filter_add_str()
+ */
+static void utc_ApplicationFW_ail_filter_add_str_func_03(void)
+{
+ ail_filter_h filter;
+ ail_error_e r;
+ ail_prop_str_e prop = AIL_PROP_STR_MAX + 1;
+ r = ail_filter_new(&filter);
+ if (r != AIL_ERROR_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = ail_filter_add_str(filter, prop, "com.samsung.memo");
+ if (r != AIL_ERROR_INVALID_PARAMETER) {
+ tet_infoline
+ ("ail_filter_add_str() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ ail_filter_destroy(filter);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case 03 of ail_filter_add_str()
+ */
+static void utc_ApplicationFW_ail_filter_add_str_func_04(void)
+{
+ ail_filter_h filter;
+ ail_error_e r;
+ r = ail_filter_new(&filter);
+ if (r != AIL_ERROR_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = ail_filter_add_str(NULL, AIL_PROP_PACKAGE_STR, "com.samsung.memo");
+ if (r != AIL_ERROR_INVALID_PARAMETER) {
+ tet_infoline
+ ("ail_filter_add_str() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ ail_filter_destroy(filter);
+ tet_result(TET_PASS);
+}
diff --git a/TC/unit/utc_ApplicationFW_ail_filter_count_appinfo_func.c b/TC/unit/utc_ApplicationFW_ail_filter_count_appinfo_func.c
new file mode 100755
index 0000000..299aedc
--- /dev/null
+++ b/TC/unit/utc_ApplicationFW_ail_filter_count_appinfo_func.c
@@ -0,0 +1,122 @@
+/*
+ * ail
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+#include <tet_api.h>
+#include <ail.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_ail_filter_count_appinfo_func_01(void);
+static void utc_ApplicationFW_ail_filter_count_appinfo_func_02(void);
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_ail_filter_count_appinfo_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_ail_filter_count_appinfo_func_02, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * API Prototype
+ * ail_error_e ail_filter_count_appinfo(ail_filter_h filter, int *count)
+ *
+ * @param[in] filter a filter handle
+ * @param[in] count the number of appinfo which is filtered
+ *
+ * @return 0 if success, negative value(<0) if fail\n
+ * @retval AIL_ERROR_OK success
+ * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
+ * @retval AIL_ERROR_OUT_OF_MEMORY out of memory
+ *
+ */
+
+/**
+ * @brief Positive test case of ail_filter_count_appinfo()
+ */
+static void utc_ApplicationFW_ail_filter_count_appinfo_func_01(void)
+{
+ ail_filter_h filter;
+ ail_error_e r;
+ int n = 0;
+ r = ail_filter_new(&filter);
+ if (r != AIL_ERROR_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = ail_filter_add_bool(filter, AIL_PROP_NODISPLAY_BOOL, 1);
+ if (r != AIL_ERROR_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = ail_filter_count_appinfo(filter, &n);
+ if (r != AIL_ERROR_OK) {
+ tet_infoline
+ ("ail_filter_count_appinfo() failed in positive test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ ail_filter_destroy(filter);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of ail_filter_count_appinfo()
+ */
+static void utc_ApplicationFW_ail_filter_count_appinfo_func_02(void)
+{
+ ail_filter_h filter;
+ ail_error_e r;
+ r = ail_filter_new(&filter);
+ if (r != AIL_ERROR_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = ail_filter_add_bool(filter, AIL_PROP_NODISPLAY_BOOL, 1);
+ if (r != AIL_ERROR_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = ail_filter_count_appinfo(filter, NULL);
+ if (r != AIL_ERROR_INVALID_PARAMETER) {
+ tet_infoline
+ ("ail_filter_count_appinfo() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ ail_filter_destroy(filter);
+ tet_result(TET_PASS);
+}
diff --git a/TC/unit/utc_ApplicationFW_ail_filter_destroy_func.c b/TC/unit/utc_ApplicationFW_ail_filter_destroy_func.c
new file mode 100755
index 0000000..6987b1b
--- /dev/null
+++ b/TC/unit/utc_ApplicationFW_ail_filter_destroy_func.c
@@ -0,0 +1,101 @@
+/*
+ * ail
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+#include <tet_api.h>
+#include <ail.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_ail_filter_destroy_func_01(void);
+static void utc_ApplicationFW_ail_filter_destroy_func_02(void);
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_ail_filter_destroy_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_ail_filter_destroy_func_02, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * API Prototype
+ * ail_error_e ail_filter_destroy(ail_filter_h filter)
+ *
+ * @param[in] filter filter handle
+ *
+ * @return 0 if success, negative value(<0) if fail\n
+ * @retval AIL_ERROR_OK success
+ * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
+ *
+ */
+
+/**
+ * @brief Positive test case of ail_filter_destroy()
+ */
+static void utc_ApplicationFW_ail_filter_destroy_func_01(void)
+{
+ ail_filter_h filter;
+ ail_error_e r;
+ r = ail_filter_new(&filter);
+ if (r != AIL_ERROR_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = ail_filter_destroy(filter);
+ if (r != AIL_ERROR_OK) {
+ tet_infoline
+ ("ail_filter_destroy() failed in positive test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of ail_filter_destroy()
+ */
+static void utc_ApplicationFW_ail_filter_destroy_func_02(void)
+{
+ ail_error_e r;
+ r = ail_filter_destroy(NULL);
+ if (r != AIL_ERROR_INVALID_PARAMETER) {
+ tet_infoline
+ ("ail_filter_destroy() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
diff --git a/TC/unit/utc_ApplicationFW_ail_filter_list_appinfo_foreach_func.c b/TC/unit/utc_ApplicationFW_ail_filter_list_appinfo_foreach_func.c
new file mode 100755
index 0000000..b11afc4
--- /dev/null
+++ b/TC/unit/utc_ApplicationFW_ail_filter_list_appinfo_foreach_func.c
@@ -0,0 +1,133 @@
+/*
+ * ail
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+#include <tet_api.h>
+#include <ail.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_ail_filter_list_appinfo_foreach_func_01(void);
+static void utc_ApplicationFW_ail_filter_list_appinfo_foreach_func_02(void);
+static ail_cb_ret_e appinfo_func(const ail_appinfo_h appinfo, void *user_data);
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_ail_filter_list_appinfo_foreach_func_01,
+ POSITIVE_TC_IDX},
+ {utc_ApplicationFW_ail_filter_list_appinfo_foreach_func_02,
+ NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * API Prototype
+ * ail_error_e ail_filter_list_appinfo_foreach(ail_filter_h filter,
+ * ail_list_appinfo_cb func, void *user_data)
+ *
+ * @param[in] filter a filter handle
+ * @param[in] func the function to call with each package's appinfo
+ * @param[in] user_data user_data to pass to the function
+ *
+ * @return 0 if success, negative value(<0) if fail\n
+ * @retval AIL_ERROR_OK success
+ * @retval AIL_ERROR_DB_FAILED database error
+ * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
+ *
+ */
+
+static ail_cb_ret_e appinfo_func(const ail_appinfo_h appinfo, void *user_data)
+{
+ return AIL_CB_RET_CONTINUE;
+}
+
+/**
+ * @brief Positive test case of ail_filter_list_appinfo_foreach()
+ */
+static void utc_ApplicationFW_ail_filter_list_appinfo_foreach_func_01(void)
+{
+ ail_filter_h filter;
+ ail_error_e r;
+ r = ail_filter_new(&filter);
+ if (r != AIL_ERROR_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = ail_filter_add_bool(filter, AIL_PROP_NODISPLAY_BOOL, 1);
+ if (r != AIL_ERROR_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = ail_filter_list_appinfo_foreach(filter, appinfo_func, NULL);
+ if (r != AIL_ERROR_OK) {
+ tet_infoline
+ ("ail_filter_list_appinfo_foreach()"
+ " failed in positive test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ ail_filter_destroy(filter);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of ail_filter_list_appinfo_foreach()
+ */
+static void utc_ApplicationFW_ail_filter_list_appinfo_foreach_func_02(void)
+{
+ ail_filter_h filter;
+ ail_error_e r;
+ r = ail_filter_new(&filter);
+ if (r != AIL_ERROR_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = ail_filter_add_bool(filter, AIL_PROP_NODISPLAY_BOOL, 1);
+ if (r != AIL_ERROR_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = ail_filter_list_appinfo_foreach(filter, NULL, NULL);
+ if (r != AIL_ERROR_INVALID_PARAMETER) {
+ tet_infoline
+ ("ail_filter_list_appinfo_foreach()"
+ " failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ ail_filter_destroy(filter);
+ tet_result(TET_PASS);
+}
diff --git a/TC/unit/utc_ApplicationFW_ail_filter_new_func.c b/TC/unit/utc_ApplicationFW_ail_filter_new_func.c
new file mode 100755
index 0000000..efe3c8b
--- /dev/null
+++ b/TC/unit/utc_ApplicationFW_ail_filter_new_func.c
@@ -0,0 +1,97 @@
+/*
+ * ail
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+#include <tet_api.h>
+#include <ail.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_ail_filter_new_func_01(void);
+static void utc_ApplicationFW_ail_filter_new_func_02(void);
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_ail_filter_new_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_ail_filter_new_func_02, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * API Prototype
+ * ail_error_e ail_filter_new(ail_filter_h *filter)
+ *
+ * @param[out] filter a pointer to a filter which is newly created
+ *
+ * @return 0 if success, negative value(<0) if fail\n
+ * @retval AIL_ERROR_OK success
+ * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
+ * @retval AIL_ERROR_OUT_OF_MEMORY out of memory
+ *
+ */
+
+
+/**
+ * @brief Positive test case of ail_filter_new()
+ */
+static void utc_ApplicationFW_ail_filter_new_func_01(void)
+{
+ ail_filter_h filter;
+ ail_error_e r;
+ r = ail_filter_new(&filter);
+ if (r != AIL_ERROR_OK) {
+ tet_infoline("ail_filter_new() failed in positive test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ ail_filter_destroy(filter);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of ail_filter_new()
+ */
+static void utc_ApplicationFW_ail_filter_new_func_02(void)
+{
+ ail_error_e r;
+ r = ail_filter_new(NULL);
+ if (r == AIL_ERROR_OK) {
+ tet_infoline("ail_filter_new() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
diff --git a/TC/unit/utc_ApplicationFW_ail_package_destroy_appinfo_func.c b/TC/unit/utc_ApplicationFW_ail_package_destroy_appinfo_func.c
new file mode 100755
index 0000000..a1adc8f
--- /dev/null
+++ b/TC/unit/utc_ApplicationFW_ail_package_destroy_appinfo_func.c
@@ -0,0 +1,107 @@
+/*
+ *
+ * ail
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+#include <tet_api.h>
+#include <ail.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_ail_package_destroy_appinfo_func_01(void);
+static void utc_ApplicationFW_ail_package_destroy_appinfo_func_02(void);
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_ail_package_destroy_appinfo_func_01,
+ POSITIVE_TC_IDX},
+ {utc_ApplicationFW_ail_package_destroy_appinfo_func_02,
+ NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * API Prototype
+ * ail_error_e ail_package_destroy_appinfo(const ail_appinfo_h handle)
+ *
+ * @param[in] handle destroy all resources related to the handle.
+ *
+ * @return 0 if success, negative value(<0) if fail\n
+ * @retval AIL_ERROR_OK success
+ * @retval AIL_ERROR_DB_FAILED database error
+ * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
+ *
+ */
+
+/**
+ * @brief Positive test case of ail_package_destroy_appinfo()
+ */
+static void utc_ApplicationFW_ail_package_destroy_appinfo_func_01(void)
+{
+ ail_error_e r;
+ ail_appinfo_h handle;
+ r = ail_package_get_appinfo("com.samsung.calculator", &handle);
+ if (r != AIL_ERROR_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = ail_package_destroy_appinfo(handle);
+ if (r != AIL_ERROR_OK) {
+ tet_infoline
+ ("ail_package_destroy_appinfo()"
+ " failed in positive test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of ail_package_destroy_appinfo()
+ */
+static void utc_ApplicationFW_ail_package_destroy_appinfo_func_02(void)
+{
+ ail_error_e r;
+ r = ail_package_destroy_appinfo(NULL);
+ if (r != AIL_ERROR_INVALID_PARAMETER) {
+ tet_infoline
+ ("ail_package_destroy_appinfo()"
+ " failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
diff --git a/TC/unit/utc_ApplicationFW_ail_package_get_appinfo_func.c b/TC/unit/utc_ApplicationFW_ail_package_get_appinfo_func.c
new file mode 100755
index 0000000..cda4f7d
--- /dev/null
+++ b/TC/unit/utc_ApplicationFW_ail_package_get_appinfo_func.c
@@ -0,0 +1,141 @@
+/*
+ *
+ * ail
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+#include <tet_api.h>
+#include <ail.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_ail_package_get_appinfo_func_01(void);
+static void utc_ApplicationFW_ail_package_get_appinfo_func_02(void);
+static void utc_ApplicationFW_ail_package_get_appinfo_func_03(void);
+static void utc_ApplicationFW_ail_package_get_appinfo_func_04(void);
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_ail_package_get_appinfo_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_ail_package_get_appinfo_func_02, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_ail_package_get_appinfo_func_03, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_ail_package_get_appinfo_func_04, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * API Prototype
+ * ail_error_e ail_package_get_appinfo(const char *package,
+ * ail_appinfo_h *handle)
+ *
+ * @param[in] package package name what you want to know about.
+ * @param[out] handle handle will be used with the functions of ail_appinfo_get_xxx.
+ * If no data, it will be NULL.
+ *
+ * @return 0 if success, negative value(<0) if fail\n
+ * @retval AIL_ERROR_OK success
+ * @retval AIL_ERROR_FAIL internal error
+ * @retval AIL_ERROR_DB_FAILED database error
+ * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
+ * @retval AIL_ERROR_NO_DATA no data. cannot find the package.
+ *
+ */
+
+/**
+ * @brief Positive test case of ail_package_get_appinfo()
+ */
+static void utc_ApplicationFW_ail_package_get_appinfo_func_01(void)
+{
+ ail_error_e r;
+ ail_appinfo_h handle;
+ r = ail_package_get_appinfo("com.samsung.calculator", &handle);
+ if (r != AIL_ERROR_OK) {
+ tet_infoline
+ ("ail_package_get_appinfo() failed in positive test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ ail_package_destroy_appinfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case 01 of ail_package_get_appinfo()
+ */
+static void utc_ApplicationFW_ail_package_get_appinfo_func_02(void)
+{
+ ail_error_e r;
+ ail_appinfo_h handle;
+ r = ail_package_get_appinfo(NULL, &handle);
+ if (r != AIL_ERROR_INVALID_PARAMETER) {
+ tet_infoline
+ ("ail_package_get_appinfo() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case 02 of ail_package_get_appinfo()
+ */
+static void utc_ApplicationFW_ail_package_get_appinfo_func_03(void)
+{
+ ail_error_e r;
+ r = ail_package_get_appinfo("com.samsung.calculator", NULL);
+ if (r != AIL_ERROR_INVALID_PARAMETER) {
+ tet_infoline
+ ("ail_package_get_appinfo() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case 03 of ail_package_get_appinfo()
+ */
+static void utc_ApplicationFW_ail_package_get_appinfo_func_04(void)
+{
+ ail_error_e r;
+ r = ail_package_get_appinfo(NULL, NULL);
+ if (r != AIL_ERROR_INVALID_PARAMETER) {
+ tet_infoline
+ ("ail_package_get_appinfo() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
diff --git a/TC/unit/utc_MODULE_API_func.c.in b/TC/unit/utc_MODULE_API_func.c.in
new file mode 100755
index 0000000..2899c28
--- /dev/null
+++ b/TC/unit/utc_MODULE_API_func.c.in
@@ -0,0 +1,76 @@
+#include <tet_api.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void utc_@MODULE@_@API@_func_01(void);
+static void utc_@MODULE@_@API@_func_02(void);
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ { utc_@MODULE@_@API@_func_01, POSITIVE_TC_IDX },
+ { utc_@MODULE@_@API@_func_02, NEGATIVE_TC_IDX },
+};
+
+static void startup(void)
+{
+ int r;
+/*
+ char *err;
+ r = initailze...;
+ if (r) {
+ err = "Error message.......";
+ tet_infoline(err);
+ tet_delete(POSITIVE_TC_IDX, err);
+ tet_delete(NEGATIVE_TC_IDX, err);
+ }
+*/
+
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of @API@()
+ */
+static void utc_@MODULE@_@API@_func_01(void)
+{
+ int r = 0;
+
+/*
+ r = @API@(...);
+*/
+ if (r) {
+ tet_infoline("@API@() failed in positive test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of ug_init @API@()
+ */
+static void utc_@MODULE@_@API@_func_02(void)
+{
+ int r = 0;
+
+/*
+ r = @API@(...);
+*/
+ if (!r) {
+ tet_infoline("@API@() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
diff --git a/ail.manifest b/ail.manifest
new file mode 100644
index 0000000..29c687a
--- /dev/null
+++ b/ail.manifest
@@ -0,0 +1,17 @@
+<manifest>
+ <define>
+ <domain name="ail"/>
+ <provide>
+ <label name="ail::db"/>
+ </provide>
+ </define>
+ <request>
+ <domain name="_"/>
+ </request>
+ <assign>
+ <filesystem path="/usr/bin/ail_desktop" label="_" exec_label="none"/>
+ <filesystem path="/usr/bin/ail_filter" label="_" exec_label="none"/>
+ <filesystem path="/usr/bin/ail_initdb" label="_" exec_label="none"/>
+ <filesystem path="/usr/bin/ail_package" label="_" exec_label="none"/>
+ </assign>
+</manifest>
diff --git a/doc/images/SLP_AIL_add.png b/doc/images/SLP_AIL_add.png
new file mode 100644
index 0000000..01454df
--- /dev/null
+++ b/doc/images/SLP_AIL_add.png
Binary files differ
diff --git a/doc/images/SLP_AIL_desktop.png b/doc/images/SLP_AIL_desktop.png
new file mode 100644
index 0000000..6cc625a
--- /dev/null
+++ b/doc/images/SLP_AIL_desktop.png
Binary files differ
diff --git a/doc/images/SLP_AIL_get.png b/doc/images/SLP_AIL_get.png
new file mode 100644
index 0000000..7004611
--- /dev/null
+++ b/doc/images/SLP_AIL_get.png
Binary files differ
diff --git a/doc/images/SLP_AIL_logical_view.png b/doc/images/SLP_AIL_logical_view.png
new file mode 100644
index 0000000..1c6452a
--- /dev/null
+++ b/doc/images/SLP_AIL_logical_view.png
Binary files differ
diff --git a/include/SLP_AIL_PG.h b/include/SLP_AIL_PG.h
new file mode 100755
index 0000000..a45be1d
--- /dev/null
+++ b/include/SLP_AIL_PG.h
@@ -0,0 +1,270 @@
+/*
+ * ail
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>, Jaeho Lee <jaeho81.lee@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+
+
+/**
+ @ingroup SLP_PG
+ @defgroup SLP_PG_APPLICATION INFORMATION LIBRARY AIL
+ @{
+
+<h1 class="pg">Introduction</h1>
+
+<h2 class="pg">Purpose of this document</h2>
+ The purpose of this document is to describe how applications can use Application information library APIs to store/retrive the application's informations. This document gives programming guidelines to the application engineers.
+
+<h2 class="pg">Scope</h2>
+The scope of this document is limited to AIL API usage.
+
+
+<h1 class="pg">Architecture</h1>
+
+<h2 class="pg">Architecture overview</h2>
+Application information library manages the application information such as application name, type, icon path, exe path etc.
+
+@image html SLP_ail_logical_view.png
+
+<h2 class="pg">SLP Features</h2>
+- The Application information library provides installed applications informations.
+- The Application information library exposes the APIs to filter the applcation based on certain fields.
+- The Application information library uses DB to store the informations of the application.
+- The Application information library can process the desktop file to store/retrive the informations.
+
+
+<h1 class="pg">Application information library properties</h1>
+
+<h2 class="pg">AIL Functionality</h2>
+There are three types of API's provided by AIL
+- ail_appinfo_xxx
+ - Get the informations of the given package.
+- ail_filter_xxx
+ - Get the Application informations matched to filter condition.
+- ail_desktop_xxx
+ - add, update or remove package informations in DB.
+
+<h2 class="pg">Software Components</h2>
+- Query Requester
+ - It provides the interface to the DB. It is responsible for forming the query and excute the query in db.
+- Desktop file Reader/parser
+ - It can read the application's desktop file from the file system (/opt/share/application/).
+- Filter
+ - It can filter the query based on the given condition and it returns the filtered output to the application.
+- Get App info
+ - It can get the information of the application using appid.
+
+<h1 class="pg"> Software module Details </h2>
+
+<h2 class="pg"> Query Requester </h2>
+ - Query Requester module is provides the interface to sql DB in AIL.
+ - It is responsible for creating connection to the DB, form the sql query and execute the query in DB.
+ - It uses the libsql API to access the DB. (Eg) db_xx() API.
+
+@code
+
+@brief string type properties
+
+#define AIL_PROP_PACKAGE_STR "AIL_PROP_PACKAGE_STR"
+#define AIL_PROP_EXEC_STR "AIL_PROP_EXEC_STR"
+#define AIL_PROP_NAME_STR "AIL_PROP_NAME_STR"
+#define AIL_PROP_TYPE_STR "AIL_PROP_TYPE_STR"
+#define AIL_PROP_ICON_STR "AIL_PROP_ICON_STR"
+#define AIL_PROP_CATEGORIES_STR "AIL_PROP_CATEGORIES_STR"
+#define AIL_PROP_VERSION_STR "AIL_PROP_VERSION_STR"
+#define AIL_PROP_MIMETYPE_STR "AIL_PROP_MIMETYPE_STR"
+#define AIL_PROP_X_SLP_SERVICE_STR "AIL_PROP_X_SLP_SERVICE_STR"
+#define AIL_PROP_X_SLP_PACKAGETYPE_STR "AIL_PROP_X_SLP_PACKAGETYPE_STR"
+#define AIL_PROP_X_SLP_PACKAGECATEGORIES_STR "AIL_PROP_X_SLP_PACKAGECATEGORIES_STR"
+#define AIL_PROP_X_SLP_PACKAGEID_STR "AIL_PROP_X_SLP_PACKAGEID_STR"
+#define AIL_PROP_X_SLP_SVC_STR "AIL_PROP_X_SLP_SVC_STR"
+#define AIL_PROP_X_SLP_EXE_PATH "AIL_PROP_X_SLP_EXE_PATH"
+#define AIL_PROP_X_SLP_APPID_STR "AIL_PROP_X_SLP_APPID_STR"
+
+
+@brief integer type properties
+
+#define AIL_PROP_X_SLP_TEMP_INT "AIL_PROP_X_SLP_TEMP_INT"
+#define AIL_PROP_X_SLP_INSTALLEDTIME_INT "AIL_PROP_X_SLP_INSTALLEDTIME_INT"
+
+@brief boolean type properties
+
+#define AIL_PROP_NODISPLAY_BOOL "AIL_PROP_NODISPLAY_BOOL"
+#define AIL_PROP_X_SLP_TASKMANAGE_BOOL "AIL_PROP_X_SLP_TASKMANAGE_BOOL"
+#define AIL_PROP_X_SLP_MULTIPLE_BOOL "AIL_PROP_X_SLP_MULTIPLE_BOOL"
+#define AIL_PROP_X_SLP_REMOVABLE_BOOL "AIL_PROP_X_SLP_REMOVABLE_BOOL"
+#define AIL_PROP_X_SLP_ENABLED_BOOL "AIL_PROP_X_SLP_ENABLED_BOOL"
+
+
+@brief A handle for filters
+
+typedef struct ail_filter *ail_filter_h;
+
+@brief A handle for appinfos
+
+typedef struct ail_appinfo *ail_appinfo_h;
+
+@endcode
+
+
+<h2 class="pg">Desktop file Reader/parser</h2>
+ - This module provides set of APIs to add update delete application's desktop files contents in DB.
+ - It is responsible for validate the desktop file contents are in standard format.
+ - The major functionality of this module is add, update and delete desktop file contents in DB Eg.(ail_desktop_xxx())
+ <h3 class="pg"> Desktop file specification </h3>
+ - http://standards.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#introduction
+ - Desktop entry files should have the .desktop extension
+ - Entries in the file are {key,value} pairs in the format: Key=Value
+ - Standard Keys
+ - Type, Version, Name, NoDisplay, Icon, Hidden, Exec, Path, MimeType, Categories, URL, etc
+ - The Exec key must contain a command line. A command line consists of an executable program optionally followed by one or more arguments.
+ - The executable program can either be specified with its full path or with the name of the executable only.
+ - If no full path is provided the executable is looked up in the $PATH environment variable used by the desktop environment.
+ - The name or path of the executable program may not contain the equal sign ("="). Arguments are separated by a space.
+
+@image html SLP_AIL_desktop.png
+
+<h2 class="pg"> Adding desktop file to DB </h2>
+@image html SLP_AIL_add.png
+<h2 class="pg" > Sample code </h2>
+@code
+static ail_error_e _add_desktop(const char *package)
+{
+ ail_error_e ret;
+
+ if (!package) {
+ return AIL_ERROR_FAIL;
+ }
+
+ ret = ail_desktop_add(package);
+ if (ret != AIL_ERROR_OK) {
+ return AIL_ERROR_FAIL;
+ }
+
+ return AIL_ERROR_OK;
+}
+
+static ail_error_e _remove_desktop(const char *package)
+{
+ ail_error_e ret;
+
+ if (!package) {
+ return AIL_ERROR_FAIL;
+ }
+
+ ret = ail_desktop_remove(package);
+ if (ret != AIL_ERROR_OK) {
+ return AIL_ERROR_FAIL;
+ }
+
+ return AIL_ERROR_OK;
+}
+
+@endcode
+
+<h2 class="pg">Filter</h2>
+This module provides set of APIs to get the information from the DB based on the given matched condtion.
+It is reponsbile for giving the filtered output to the applications. Eg.(ail_filter_xxx()) These following are some of the filtering condition.
+ - Filter integer type only
+ - Filter string type only
+ - Filter bool type only
+
+<h3 class="pg" > Filter sample code </h3>
+@code
+ail_cb_ret_e appinfo_func(const ail_appinfo_h appinfo, void *user_data)
+{
+ int *i = (int *)user_data;
+ char *package;
+
+ ail_appinfo_get_str(appinfo, AIL_PROP_PACKAGE_STR, &package);
+ printf("i=%d %s\n", (*i)++, package);
+
+ if (*i > 30)
+ return AIL_CB_RET_CANCEL;
+
+ return AIL_CB_RET_CONTINUE;
+}
+
+int list_packages()
+{
+ ail_filter_h filter;
+ ail_error_e ret;
+ int i=0;
+
+ ret = ail_filter_new(&filter);
+ if (ret != AIL_ERROR_OK) {
+ return -1;
+ }
+
+ ret = ail_filter_add_bool(filter, AIL_PROP_X_SLP_REMOVABLE_BOOL, true);
+ if (ret != AIL_ERROR_OK) {
+ return -1;
+ }
+
+ ret = ail_filter_add_str(filter, AIL_PROP_TYPE_STR, "Application");
+ if (ret != AIL_ERROR_OK) {
+ return -1;
+ }
+
+ printf("List packages which are removable and 'Application' typed\n");
+ ail_filter_list_appinfo_foreach(filter, appinfo_func, (void *)&i);
+
+ ail_filter_destroy(filter);
+
+ return 0;
+}
+
+@endcode
+
+<h2 class="pg">Get Application info</h2>
+ - This module provides set of APIs to get informations of the installed packages.
+ - This module internally uses the query Requester module to get the information of the requested packages in DB. Eg.(ail_appinfo_xxx())
+@image html SLP_AIL_get.png
+
+@code
+static ail_error_e _get_name(const char *package)
+{
+ ail_appinfo_h handle;
+ ail_error_e ret;
+ char *str;
+
+ ret = ail_package_get_appinfo(package, &handle);
+ if (ret != AIL_ERROR_OK) {
+ return AIL_ERROR_FAIL;
+ }
+
+ ret = ail_appinfo_get_str(handle, AIL_PROP_NAME_STR, &str);
+ if (ret != AIL_ERROR_OK) {
+ return AIL_ERROR_FAIL;
+ }
+ fprintf(stderr, "Package[%s], Property[%s] : %s\n", package, property, str);
+
+ ret = ail_package_destroy_appinfo(handle);
+ if (ret != AIL_ERROR_OK) {
+ return AIL_ERROR_FAIL;
+ }
+
+ return AIL_ERROR_OK;
+}
+
+@endcode
+
+
+ @}
+**/
diff --git a/include/ail.h b/include/ail.h
index 03c7fa0..f08d7e0 100755
--- a/include/ail.h
+++ b/include/ail.h
@@ -67,10 +67,14 @@ extern "C" {
#define AIL_PROP_X_SLP_PACKAGETYPE_STR "AIL_PROP_X_SLP_PACKAGETYPE_STR"
#define AIL_PROP_X_SLP_PACKAGECATEGORIES_STR "AIL_PROP_X_SLP_PACKAGECATEGORIES_STR"
#define AIL_PROP_X_SLP_PACKAGEID_STR "AIL_PROP_X_SLP_PACKAGEID_STR"
+#define AIL_PROP_X_SLP_URI_STR "AIL_PROP_X_SLP_URI_STR"
#define AIL_PROP_X_SLP_SVC_STR "AIL_PROP_X_SLP_SVC_STR"
#define AIL_PROP_X_SLP_EXE_PATH "AIL_PROP_X_SLP_EXE_PATH"
#define AIL_PROP_X_SLP_APPID_STR "AIL_PROP_X_SLP_APPID_STR"
-
+#define AIL_PROP_X_SLP_PKGID_STR "AIL_PROP_X_SLP_PKGID_STR"
+#define AIL_PROP_X_SLP_DOMAIN_STR "AIL_PROP_X_SLP_DOMAIN_STR"
+#define AIL_PROP_X_SLP_SUBMODEMAINID_STR "AIL_PROP_X_SLP_SUBMODEMAINID_STR"
+#define AIL_PROP_X_SLP_INSTALLEDSTORAGE_STR "AIL_PROP_X_SLP_INSTALLEDSTORAGE_STR"
/**
* @brief integer type properties
@@ -85,8 +89,9 @@ extern "C" {
#define AIL_PROP_X_SLP_TASKMANAGE_BOOL "AIL_PROP_X_SLP_TASKMANAGE_BOOL"
#define AIL_PROP_X_SLP_MULTIPLE_BOOL "AIL_PROP_X_SLP_MULTIPLE_BOOL"
#define AIL_PROP_X_SLP_REMOVABLE_BOOL "AIL_PROP_X_SLP_REMOVABLE_BOOL"
-#define AIL_PROP_X_SLP_INACTIVATED_BOOL "AIL_PROP_X_SLP_INACTIVATED_BOOL"
-
+#define AIL_PROP_X_SLP_ISHORIZONTALSCALE_BOOL "AIL_PROP_X_SLP_ISHORIZONTALSCALE_BOOL"
+#define AIL_PROP_X_SLP_ENABLED_BOOL "AIL_PROP_X_SLP_ENABLED_BOOL"
+#define AIL_PROP_X_SLP_SUBMODE_BOOL "AIL_PROP_X_SLP_SUBMODE_BOOL"
/**
* @brief A handle for filters
@@ -99,7 +104,7 @@ typedef struct ail_filter *ail_filter_h;
typedef struct ail_appinfo *ail_appinfo_h;
/**
- * @brief return values
+ * @brief return values
*/
typedef enum {
AIL_ERROR_OK = 0, /**< General success */
@@ -133,7 +138,7 @@ typedef enum {
* External Apps.
*
* @code
-int count_packages()
+int count_apps()
{
ail_filter_h filter;
ail_error_e ret;
@@ -160,7 +165,7 @@ int count_packages()
}
ret = ail_filter_destroy(filter);
- printf("N of packages not to be displayed and supporting 'audo/wav' mime type = %d\n", n);
+ printf("N of apps not to be displayed and supporting 'audo/wav' mime type = %d\n", n);
return n;
}
@@ -194,7 +199,7 @@ ail_error_e ail_filter_new(ail_filter_h *filter);
* External Apps.
*
* @code
-int count_packages()
+int count_apps()
{
ail_filter_h filter;
ail_error_e ret;
@@ -215,7 +220,7 @@ int count_packages()
return -1;
}
- printf("N of packages = %d\n", n);
+ printf("N of apps = %d\n", n);
return n;
}
@@ -248,7 +253,7 @@ ail_error_e ail_filter_add_int(ail_filter_h filter, const char *property, const
* External Apps.
*
* @code
-int count_packages()
+int count_apps()
{
ail_filter_h filter;
ail_error_e ret;
@@ -269,7 +274,7 @@ int count_packages()
return -1;
}
- fprintf(stderr, "N of packages = %d\n", n);
+ fprintf(stderr, "N of apps = %d\n", n);
return n;
}
@@ -303,7 +308,7 @@ ail_error_e ail_filter_add_bool(ail_filter_h filter, const char *property, bool
* External Apps.
*
* @code
-int count_packages()
+int count_apps()
{
ail_filter_h filter;
ail_error_e ret;
@@ -314,7 +319,7 @@ int count_packages()
return -1;
}
- ret = ail_filter_add_str(filter, AIL_PROP_PACKAGE_STR, "org.tizen.memo");
+ ret = ail_filter_add_str(filter, AIL_PROP_PACKAGE_STR, "com.samsung.memo");
if (ret != AIL_ERROR_OK) {
return -1;
}
@@ -324,7 +329,7 @@ int count_packages()
return -1;
}
- fprintf(stderr, "N of packages = %d\n", n);
+ fprintf(stderr, "N of apps = %d\n", n);
return n;
}
@@ -355,7 +360,7 @@ ail_error_e ail_filter_add_str(ail_filter_h filter, const char *property, const
* External Apps.
*
* @code
-int count_packages()
+int count_apps()
{
ail_filter_h filter;
ail_error_e ret;
@@ -376,7 +381,7 @@ int count_packages()
return -1;
}
- printf("N of removable packages = %d\n", n);
+ printf("N of removable apps = %d\n", n);
ret = ail_filter_add_str(filter, AIL_PROP_MIMETYPE_STR, "audio/wav");
if (ret != AIL_ERROR_OK) {
@@ -388,7 +393,7 @@ int count_packages()
return -1;
}
- printf("N of packages removable and supporting 'audo/wav' mime type = %d\n", n);
+ printf("N of apps removable and supporting 'audo/wav' mime type = %d\n", n);
ret = ail_filter_destroy(filter);
@@ -427,12 +432,12 @@ typedef ail_cb_ret_e (*ail_list_appinfo_cb) (const ail_appinfo_h appinfo_h, void
/**
* @fn ail_error_e ail_error_e ail_filter_list_appinfo_foreach(ail_filter_h filter, ail_list_appinfo_cb func, void *user_data)
*
- * @brief Calls the callback function for each package filtered by given filter. If the filter is not given (i.e filter handle is NULL), it is invoked for all packages.
+ * @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.
*
* @par Sync (or) Async : Synchronous API
*
* @param[in] filter a filter handle
- * @param[in] func the function to call with each package's appinfo
+ * @param[in] func the function to call with each app's appinfo
* @param[in] user_data user_data to pass to the function
*
* @return 0 if success, negative value(<0) if fail\n
@@ -453,10 +458,10 @@ typedef ail_cb_ret_e (*ail_list_appinfo_cb) (const ail_appinfo_h appinfo_h, void
ail_cb_ret_e appinfo_func(const ail_appinfo_h appinfo, void *user_data)
{
int *i = (int *)user_data;
- char *package;
+ char *appid;
- ail_appinfo_get_str(appinfo, AIL_PROP_PACKAGE_STR, &package);
- printf("i=%d %s\n", (*i)++, package);
+ ail_appinfo_get_str(appinfo, AIL_PROP_PACKAGE_STR, &appid);
+ printf("i=%d %s\n", (*i)++, appid);
if (*i > 30)
return AIL_CB_RET_CANCEL;
@@ -464,7 +469,7 @@ ail_cb_ret_e appinfo_func(const ail_appinfo_h appinfo, void *user_data)
return AIL_CB_RET_CONTINUE;
}
-int list_packages()
+int list_apps()
{
ail_filter_h filter;
ail_error_e ret;
@@ -485,11 +490,11 @@ int list_packages()
return -1;
}
- printf("List packages which are removable and 'Application' typed\n");
+ printf("List apps which are removable and 'Application' typed\n");
ail_filter_list_appinfo_foreach(filter, appinfo_func, (void *)&i);
ail_filter_destroy(filter);
-
+
return 0;
}
* @endcode
@@ -503,7 +508,7 @@ ail_error_e ail_filter_list_appinfo_foreach(ail_filter_h filter,
/**
* @fn ail_error_e ail_error_e ail_filter_count_appinfo(ail_filter_h filter, int *count)
*
- * @brief Gets the number of package which is filtered by the given filter. If the filter is not given (i.e filter handle is NULL), all package are counted.
+ * @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.
*
* @par Sync (or) Async : Synchronous API
*
@@ -527,7 +532,7 @@ ail_error_e ail_filter_list_appinfo_foreach(ail_filter_h filter,
* External Apps.
*
* @code
-int count_packages()
+int count_apps()
{
ail_filter_h filter;
ail_error_e ret;
@@ -548,14 +553,14 @@ int count_packages()
return -1;
}
- printf("N of package not to be displayed = %d", n);
+ printf("N of app not to be displayed = %d", n);
ret = ail_filter_count_appinfo(NULL, &n);
if (ret != AIL_ERROR_OK) {
return -1;
}
- printf("N of all package = %d\n", n);
+ printf("N of all app = %d\n", n);
return n;
}
@@ -620,7 +625,7 @@ static ail_error_e _get_name(const char *package)
}
* @endcode
*/
-ail_error_e ail_package_get_appinfo(const char *package, ail_appinfo_h *handle);
+ail_error_e ail_package_get_appinfo(const char *package, ail_appinfo_h *handle) __attribute__((deprecated));
/**
@@ -641,7 +646,7 @@ ail_error_e ail_package_get_appinfo(const char *package, ail_appinfo_h *handle);
* @retval AIL_ERROR_FAIL internal error
* @retval AIL_ERROR_DB_FAILED database error
* @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
- * @retval AIL_ERROR_NO_DATA no data. cannot find the package.
+ * @retval AIL_ERROR_NO_DATA no data. cannot find the app.
*
* @pre declare a handle before calling this function. The handle is used as a second argument of this API.
* @post destroy the handle with the function of ail_get_appinfo after using it all.
@@ -708,13 +713,13 @@ ail_error_e ail_get_appinfo(const char *appid, ail_appinfo_h *handle);
* External Apps.
*
* @code
-static ail_error_e _get_nodisplay(const char *package)
+static ail_error_e _get_nodisplay(const char *appid)
{
ail_appinfo_h handle;
ail_error_e ret;
bool value;
- ret = ail_get_appinfo(package, &handle);
+ ret = ail_get_appinfo(appid, &handle);
if (ret != AIL_ERROR_OK) {
return AIL_ERROR_FAIL;
}
@@ -723,7 +728,7 @@ static ail_error_e _get_nodisplay(const char *package)
if (ret != AIL_ERROR_OK) {
return AIL_ERROR_FAIL;
}
- fprintf(stderr, "Package[%s] : %d\n", package, value);
+ fprintf(stderr, "appid[%s] : %d\n", appid, value);
ret = ail_destroy_appinfo(handle);
if (ret != AIL_ERROR_OK) {
@@ -765,13 +770,13 @@ ail_error_e ail_appinfo_get_bool(const ail_appinfo_h handle, const char *propert
* External Apps.
*
* @code
-static ail_error_e _get_x_slp_baselayoutwidth(const char *package)
+static ail_error_e _get_x_slp_baselayoutwidth(const char *appid)
{
ail_appinfo_h handle;
ail_error_e ret;
int value;
- ret = ail_get_appinfo(package, &handle);
+ ret = ail_get_appinfo(appid, &handle);
if (ret != AIL_ERROR_OK) {
return AIL_ERROR_FAIL;
}
@@ -780,7 +785,7 @@ static ail_error_e _get_x_slp_baselayoutwidth(const char *package)
if (ret != AIL_ERROR_OK) {
return AIL_ERROR_FAIL;
}
- fprintf(stderr, "Package[%s] : %d\n", package, value);
+ fprintf(stderr, "Package[%s] : %d\n", appid, value);
ret = ail_destroy_appinfo(handle);
if (ret != AIL_ERROR_OK) {
@@ -822,13 +827,13 @@ ail_error_e ail_appinfo_get_int(const ail_appinfo_h handle, const char *property
* External Apps.
*
* @code
-static ail_error_e _get_nodisplay(const char *package)
+static ail_error_e _get_nodisplay(const char *appid)
{
ail_appinfo_h handle;
ail_error_e ret;
char* value;
- ret = ail_get_appinfo(package, &handle);
+ ret = ail_get_appinfo(appid, &handle);
if (ret != AIL_ERROR_OK) {
return AIL_ERROR_FAIL;
}
@@ -837,7 +842,7 @@ static ail_error_e _get_nodisplay(const char *package)
if (ret != AIL_ERROR_OK) {
return AIL_ERROR_FAIL;
}
- fprintf(stderr, "Package[%s] : %d\n", package, value);
+ fprintf(stderr, "Package[%s] : %d\n", appid, value);
ret = ail_destroy_appinfo(handle);
if (ret != AIL_ERROR_OK) {
@@ -901,7 +906,7 @@ static ail_error_e _get_name(const char *package)
}
* @endcode
*/
-ail_error_e ail_package_destroy_appinfo(const ail_appinfo_h handle);
+ail_error_e ail_package_destroy_appinfo(const ail_appinfo_h handle) __attribute__((deprecated));
/**
@@ -953,29 +958,84 @@ static ail_error_e _get_name(const char *appid)
}
* @endcode
*/
-ail_error_e ail_destroy_appinfo(const ail_appinfo_h handle);
+ail_error_e ail_destroy_appinfo(ail_appinfo_h ai);
/**
- * @fn ail_error_e ail_desktop_add(const char *package)
+ * @fn ail_error_e ail_close_appinfo_db(void)
+ *
+ * @brief close appinfo db.
+ *
+ * @par Sync (or) Async : Synchronous API.
+ *
+ * @return 0 if success, negative value(<0) if fail\n
+ * @retval AIL_ERROR_OK success
+ * @retval AIL_ERROR_DB_FAILED database error
+ * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
+ *
+ * @pre need a handle that you don't need anymore.
+ * @post cannot use the handle after destroying.
+ *
+ * @see ail_get_appinfo(), ail_appinfo_get_bool(), ail_appinfo_get_int(), ail_appinfo_get_str()
+ *
+ * @par Prospective Clients:
+ * External Apps.
*
- * @brief add a package information into Application Information Database.
- A desktop file for this package has to be installed in the desktop directory before using this API.
+ * @code
+static ail_error_e _get_name(const char *appid)
+{
+ ail_appinfo_h handle;
+ ail_error_e ret;
+ char *str;
+
+ ret = ail_get_appinfo(appid, &handle);
+ if (ret != AIL_ERROR_OK) {
+ return AIL_ERROR_FAIL;
+ }
+
+ ret = ail_appinfo_get_str(handle, AIL_PROP_NAME_STR, &str);
+ if (ret != AIL_ERROR_OK) {
+ return AIL_ERROR_FAIL;
+ }
+ fprintf(stderr, "Package[%s], Property[%s] : %s\n", appid, property, str);
+
+ ret = ail_destroy_appinfo(handle);
+ if (ret != AIL_ERROR_OK) {
+ return AIL_ERROR_FAIL;
+ }
+
+ ret = ail_close_appinfo_db();
+ if (ret != AIL_ERROR_OK) {
+ return AIL_ERROR_FAIL;
+ }
+
+ return AIL_ERROR_OK;
+}
+ * @endcode
+ */
+ail_error_e ail_close_appinfo_db(void);
+
+
+/**
+ * @fn ail_error_e ail_desktop_add(const char *appid)
+ *
+ * @brief add a app information into Application Information Database.
+ A desktop file for this app has to be installed in the desktop directory before using this API.
If there is no database for Application Information Database, this API will create the DB.
- If there is a DB, this function adds information for the package into the DB.
+ If there is a DB, this function adds information for the app into the DB.
And a notification is published to the applications who want to know about changing DB.
*
* @par Sync (or) Async : Synchronous API.
*
- * @param[in] package package name
+ * @param[in] appid
*
* @return 0 if success, negative value(<0) if fail\n
* @retval AIL_ERROR_OK success
* @retval AIL_ERROR_FAIL internal error
* @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
*
- * @pre a desktop file for the package has to be installed in the desktop directory before using this API.
- * @post package information is added into the Application Information Database.
+ * @pre a desktop file for the app has to be installed in the desktop directory before using this API.
+ * @post app information is added into the Application Information Database.
*
* @see ail_desktop_update(), ail_desktop_remove()
*
@@ -983,15 +1043,15 @@ ail_error_e ail_destroy_appinfo(const ail_appinfo_h handle);
* External Apps.
*
* @code
-static ail_error_e _add_desktop(const char *package)
+static ail_error_e _add_desktop(const char *appid)
{
ail_error_e ret;
- if (!package) {
+ if (!appid) {
return AIL_ERROR_FAIL;
}
- ret = ail_desktop_add(package);
+ ret = ail_desktop_add(appid);
if (ret != AIL_ERROR_OK) {
return AIL_ERROR_FAIL;
}
@@ -1000,28 +1060,28 @@ static ail_error_e _add_desktop(const char *package)
}
* @endcode
*/
-ail_error_e ail_desktop_add(const char *package);
+ail_error_e ail_desktop_add(const char *appid);
/**
- * @fn ail_error_e ail_desktop_update(const char *package)
+ * @fn ail_error_e ail_desktop_update(const char *appid)
*
- * @brief update a package information in the Application Information Database.
- A desktop file for this package has to be installed in the desktop directory before using this API.
+ * @brief update a app information in the Application Information Database.
+ A desktop file for this app has to be installed in the desktop directory before using this API.
And a notification is published to the applications who want to know about changing DB.
*
* @par Sync (or) Async : Synchronous API.
*
- * @param[in] package package name
+ * @param[in] appid
*
* @return 0 if success, negative value(<0) if fail\n
* @retval AIL_ERROR_OK success
* @retval AIL_ERROR_FAIL internal error
* @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
*
- * @pre a desktop file for the package has to be installed in the desktop directory before using this API.
- * @post update a package information in the Application Information Database.
+ * @pre a desktop file for the app has to be installed in the desktop directory before using this API.
+ * @post update a app information in the Application Information Database.
*
* @see ail_desktop_add(), ail_desktop_remove()
*
@@ -1029,15 +1089,15 @@ ail_error_e ail_desktop_add(const char *package);
* External Apps.
*
* @code
-static ail_error_e _update_desktop(const char *package)
+static ail_error_e _update_desktop(const char *appid)
{
ail_error_e ret;
- if (!package) {
+ if (!appid) {
return AIL_ERROR_FAIL;
}
- ret = ail_desktop_update(package);
+ ret = ail_desktop_update(appid);
if (ret != AIL_ERROR_OK) {
return AIL_ERROR_FAIL;
}
@@ -1046,19 +1106,19 @@ static ail_error_e _update_desktop(const char *package)
}
* @endcode
*/
-ail_error_e ail_desktop_update(const char *package);
+ail_error_e ail_desktop_update(const char *appid);
/**
- * @fn ail_error_e ail_desktop_remove(const char *package)
+ * @fn ail_error_e ail_desktop_remove(const char *appid)
*
- * @brief remove a package information in the Application Information Database.
+ * @brief remove a app information in the Application Information Database.
And a notification is published to the applications who want to know about changing DB.
*
* @par Sync (or) Async : Synchronous API.
*
- * @param[in] package package name
+ * @param[in] appid
*
* @return 0 if success, negative value(<0) if fail\n
* @retval AIL_ERROR_OK success
@@ -1066,7 +1126,7 @@ ail_error_e ail_desktop_update(const char *package);
* @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
*
* @pre no pre-condition.
- * @post package information is removed in the Application Information Database.
+ * @post app information is removed in the Application Information Database.
*
* @see ail_desktop_add(), ail_desktop_update()
*
@@ -1074,15 +1134,15 @@ ail_error_e ail_desktop_update(const char *package);
* External Apps.
*
* @code
-static ail_error_e _remove_desktop(const char *package)
+static ail_error_e _remove_desktop(const char *appid)
{
ail_error_e ret;
- if (!package) {
+ if (!appid) {
return AIL_ERROR_FAIL;
}
- ret = ail_desktop_remove(package);
+ ret = ail_desktop_remove(appid);
if (ret != AIL_ERROR_OK) {
return AIL_ERROR_FAIL;
}
@@ -1091,7 +1151,145 @@ static ail_error_e _remove_desktop(const char *package)
}
* @endcode
*/
-ail_error_e ail_desktop_remove(const char *package);
+ail_error_e ail_desktop_remove(const char *appid);
+
+/**
+ * @fn ail_error_e ail_desktop_clean(const char *pkgid)
+ *
+ * @brief clean a pkg information in the Application Information Database.
+ *
+ * @par Sync (or) Async : Synchronous API.
+ *
+ * @param[in] pkgid
+ *
+ * @return 0 if success, negative value(<0) if fail\n
+ * @retval AIL_ERROR_OK success
+ * @retval AIL_ERROR_FAIL internal error
+ * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
+ *
+ * @pre no pre-condition.
+ * @post app information is removed in the Application Information Database.
+ *
+ * @see ail_desktop_add(), ail_desktop_update()
+ *
+ * @par Prospective Clients:
+ * External Apps.
+ *
+ * @code
+static ail_error_e _clean_desktop(const char *pkgid)
+{
+ ail_error_e ret;
+
+ if (!appid) {
+ return AIL_ERROR_FAIL;
+ }
+
+ ret = ail_desktop_clean(pkgid);
+ if (ret != AIL_ERROR_OK) {
+ return AIL_ERROR_FAIL;
+ }
+
+ return AIL_ERROR_OK;
+}
+ * @endcode
+ */
+ail_error_e ail_desktop_clean(const char *pkgid);
+
+
+/**
+ * @fn ail_error_e ail_desktop_fota(const char *appid)
+ *
+ * @brief add a app information into Application Information Database.
+ A desktop file for this app has to be installed in the desktop directory before using this API.
+ If there is no database for Application Information Database, this API will create the DB.
+ If there is a DB, this function adds information for the app into the DB.
+ And a notification is not published to the applications who want to know about changing DB.
+ *
+ * @par Sync (or) Async : Synchronous API.
+ *
+ * @param[in] appid
+ *
+ * @return 0 if success, negative value(<0) if fail\n
+ * @retval AIL_ERROR_OK success
+ * @retval AIL_ERROR_FAIL internal error
+ * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
+ *
+ * @pre a desktop file for the app has to be installed in the desktop directory before using this API.
+ * @post app information is added into the Application Information Database.
+ *
+ * @see ail_desktop_update(), ail_desktop_remove()
+ *
+ * @par Prospective Clients:
+ * External Apps.
+ *
+ * @code
+static ail_error_e _add_desktop_fota(const char *appid)
+{
+ ail_error_e ret;
+
+ if (!appid) {
+ return AIL_ERROR_FAIL;
+ }
+
+ ret = ail_desktop_fota(appid);
+ if (ret != AIL_ERROR_OK) {
+ return AIL_ERROR_FAIL;
+ }
+
+ return AIL_ERROR_OK;
+}
+ * @endcode
+ */
+ail_error_e ail_desktop_fota(const char *appid);
+
+/**
+ * @fn ail_error_e ail_desktop_appinfo_modify_str(const char *appid, const char *property, const char *value, bool broadcast)
+ *
+ * @brief update a app information db.
+ And a notification is published to the applications who want to know about changing DB.
+ *
+ * @par Sync (or) Async : Synchronous API.
+ *
+ * @param[in] appid
+ *
+ * @return 0 if success, negative value(<0) if fail\n
+ * @retval AIL_ERROR_OK success
+ * @retval AIL_ERROR_FAIL internal error
+ * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
+ *
+ * @pre no pre-condition.
+ * @post app information is removed in the Application Information Database.
+ *
+ *
+ * @par Prospective Clients:
+ * External Apps.
+ *
+ * @code
+static ail_error_e _appinfo_modify_str(const char *appid, const char *property, const char *value, bool broadcast)
+{
+ ail_error_e ret;
+
+ if (!appid) {
+ return AIL_ERROR_FAIL;
+ }
+ if (!property) {
+ return AIL_ERROR_FAIL;
+ }
+ if (!value) {
+ return AIL_ERROR_FAIL;
+ }
+
+ ret = ail_desktop_appinfo_modify_str(appid, property, value, broadcast);
+ if (ret != AIL_ERROR_OK) {
+ return AIL_ERROR_FAIL;
+ }
+
+ return AIL_ERROR_OK;
+}
+ * @endcode
+ */
+
+ail_error_e ail_desktop_appinfo_modify_str(const char *appid, const char *property, const char *value, bool broadcast);
/** @} */
diff --git a/initdb/CMakeLists.txt b/initdb/CMakeLists.txt
deleted file mode 100755
index 73474d8..0000000
--- a/initdb/CMakeLists.txt
+++ /dev/null
@@ -1,17 +0,0 @@
-#AIL init DB build script
-
-SET(INITDB ail_initdb)
-SET(SRCS src/initdb.c)
-
-pkg_check_modules(INITDB_PKGS REQUIRED vconf dlog db-util sqlite3)
-INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
-INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src)
-
-STRING(REPLACE ";" " " EXTRA_CFLAGS "${INITDB_PKGS_CFLAGS}")
-
-ADD_EXECUTABLE(${INITDB} ${SRCS})
-TARGET_LINK_LIBRARIES(${INITDB} ${LIBNAME} ${INITDB_PKGS_LIBRARIES})
-SET_TARGET_PROPERTIES(${INITDB} PROPERTIES COMPILE_FLAGS "${EXTRA_CFLAGS}")
-SET_TARGET_PROPERTIES(${INITDB} PROPERTIES SKIP_BUILD_RPATH true)
-
-INSTALL(TARGETS ${INITDB} DESTINATION ${BINDIR})
diff --git a/packaging/ail.spec b/packaging/ail.spec
index 843f8c0..47c010c 100644..100755
--- a/packaging/ail.spec
+++ b/packaging/ail.spec
@@ -1,7 +1,7 @@
#sbs-git:slp/pkgs/a/ail ail 0.2.22 29ac1f2c98453cad647cca6a92abc7da3dbb047b
Name: ail
Summary: Application Information Library
-Version: 0.2.44
+Version: 0.2.95
Release: 1
Group: System/Libraries
License: Apache License, Version 2.0
@@ -16,7 +16,6 @@ BuildRequires: pkgconfig(vconf)
BuildRequires: pkgconfig(db-util)
BuildRequires: pkgconfig(xdgmime)
-
%description
Application Information Library
@@ -33,15 +32,26 @@ Application Information Library (devel)
%build
CFLAGS+=" -fpic"
-cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DBUILD_PKGTYPE=rpm
+
+%if 0%{?tizen_build_binary_release_type_eng}
+export CFLAGS="$CFLAGS -DTIZEN_ENGINEER_MODE"
+export CXXFLAGS="$CXXFLAGS ?DTIZEN_ENGINEER_MODE"
+export FFLAGS="$FFLAGS -DTIZEN_ENGINEER_MODE"
+%endif
+
+%cmake . -DBUILD_PKGTYPE=rpm
make %{?jobs:-j%jobs}
%install
-rm -rf %{buildroot}
%make_install
+mkdir -p %{buildroot}/usr/share/license
+cp LICENSE %{buildroot}/usr/share/license/%{name}
+
%post
+vconftool set -t string db/ail/ail_info "0" -f -s system::vconf_inhouse
+vconftool set -t string db/menuscreen/desktop "0" -f -s system::vconf_inhouse
CHDBGID="6010"
@@ -60,20 +70,28 @@ update_DAC_for_db_file()
echo "Failed to change the perms of $@"
fi
}
+mkdir -p /usr/share/applications
+mkdir -p /opt/share/applications
mkdir -p /opt/dbspace/
-ail_initdb
+
update_DAC_for_db_file /opt/dbspace/.app_info.db
update_DAC_for_db_file /opt/dbspace/.app_info.db-journal
%postun
%files
-/usr/lib/libail.so.0
-/usr/lib/libail.so.0.1.0
+%manifest ail.manifest
+%{_libdir}/libail.so.0
+%{_libdir}/libail.so.0.1.0
/usr/bin/ail_initdb
+/usr/bin/ail_desktop
+/usr/bin/ail_filter
+/usr/bin/ail_test
+/usr/bin/ail_package
/usr/share/install-info/*
+/usr/share/license/%{name}
%files devel
/usr/include/ail.h
-/usr/lib/libail.so
-/usr/lib/pkgconfig/ail.pc
+%{_libdir}/libail.so
+%{_libdir}/pkgconfig/ail.pc
diff --git a/src/ail_convert.c b/src/ail_convert.c
index ef69cf0..fb2820b 100755
--- a/src/ail_convert.c
+++ b/src/ail_convert.c
@@ -47,10 +47,14 @@ static struct _ail_str_map_t str_prop_map[] = {
{E_AIL_PROP_X_SLP_PACKAGETYPE_STR, AIL_PROP_X_SLP_PACKAGETYPE_STR},
{E_AIL_PROP_X_SLP_PACKAGECATEGORIES_STR, AIL_PROP_X_SLP_PACKAGECATEGORIES_STR},
{E_AIL_PROP_X_SLP_PACKAGEID_STR, AIL_PROP_X_SLP_PACKAGEID_STR},
-/* {E_AIL_PROP_X_SLP_URI_STR, AIL_PROP_X_SLP_URI_STR}, */
+ {E_AIL_PROP_X_SLP_URI_STR, AIL_PROP_X_SLP_URI_STR},
{E_AIL_PROP_X_SLP_SVC_STR, AIL_PROP_X_SLP_SVC_STR},
{E_AIL_PROP_X_SLP_EXE_PATH, AIL_PROP_X_SLP_EXE_PATH},
- {E_AIL_PROP_X_SLP_APPID_STR, AIL_PROP_X_SLP_APPID_STR}
+ {E_AIL_PROP_X_SLP_APPID_STR, AIL_PROP_X_SLP_APPID_STR},
+ {E_AIL_PROP_X_SLP_PKGID_STR, AIL_PROP_X_SLP_PKGID_STR},
+ {E_AIL_PROP_X_SLP_DOMAIN_STR, AIL_PROP_X_SLP_DOMAIN_STR},
+ {E_AIL_PROP_X_SLP_SUBMODEMAINID_STR, AIL_PROP_X_SLP_SUBMODEMAINID_STR},
+ {E_AIL_PROP_X_SLP_INSTALLEDSTORAGE_STR, AIL_PROP_X_SLP_INSTALLEDSTORAGE_STR}
};
@@ -75,8 +79,9 @@ static struct _ail_bool_map_t bool_prop_map[] = {
{E_AIL_PROP_X_SLP_TASKMANAGE_BOOL, AIL_PROP_X_SLP_TASKMANAGE_BOOL},
{E_AIL_PROP_X_SLP_MULTIPLE_BOOL, AIL_PROP_X_SLP_MULTIPLE_BOOL},
{E_AIL_PROP_X_SLP_REMOVABLE_BOOL, AIL_PROP_X_SLP_REMOVABLE_BOOL},
-/* {E_AIL_PROP_X_SLP_ISHORIZONTALSCALE_BOOL, AIL_PROP_X_SLP_ISHORIZONTALSCALE_BOOL}, */
- {E_AIL_PROP_X_SLP_INACTIVATED_BOOL, AIL_PROP_X_SLP_INACTIVATED_BOOL}
+ {E_AIL_PROP_X_SLP_ISHORIZONTALSCALE_BOOL, AIL_PROP_X_SLP_ISHORIZONTALSCALE_BOOL},
+ {E_AIL_PROP_X_SLP_ENABLED_BOOL, AIL_PROP_X_SLP_ENABLED_BOOL},
+ {E_AIL_PROP_X_SLP_SUBMODE_BOOL, AIL_PROP_X_SLP_SUBMODE_BOOL}
};
diff --git a/src/ail_db.c b/src/ail_db.c
index 5580a58..d5135b1 100755
--- a/src/ail_db.c
+++ b/src/ail_db.c
@@ -21,7 +21,7 @@
-
+#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <db-util.h>
@@ -31,8 +31,14 @@
#define retv_with_dbmsg_if(expr, val) do { \
if (expr) { \
- _E("db_info.dbro: %s", sqlite3_errmsg(db_info.dbro)); \
- _E("db_info.dbrw: %s", sqlite3_errmsg(db_info.dbrw)); \
+ if (access(APP_INFO_DB, R_OK) == 0) { \
+ _E("db_info.dbro: %s", sqlite3_errmsg(db_info.dbro)); \
+ _E("db_info.dbrw: %s", sqlite3_errmsg(db_info.dbrw)); \
+ _E("db_info.dbro errcode: %d", sqlite3_extended_errcode(db_info.dbro)); \
+ _E("db_info.dbrw errcode: %d", sqlite3_extended_errcode(db_info.dbrw)); \
+ } else { \
+ _E("db_info.db can not access by smack"); \
+ } \
return (val); \
} \
} while (0)
@@ -48,21 +54,40 @@ static __thread struct {
ail_error_e db_open(db_open_mode mode)
{
- int ret;
- int changed = 0;
+ int ret = AIL_ERROR_OK;
if(mode & DB_OPEN_RO) {
if (!db_info.dbro) {
- ret = db_util_open_with_options(APP_INFO_DB, &db_info.dbro, SQLITE_OPEN_READONLY, NULL);
- _E("db_open_ro ret=%d", ret);
+ ret = db_util_open(APP_INFO_DB, &db_info.dbro, 0);
retv_with_dbmsg_if(ret != SQLITE_OK, AIL_ERROR_DB_FAILED);
}
}
if(mode & DB_OPEN_RW) {
if (!db_info.dbrw) {
- ret = db_util_open(APP_INFO_DB, &db_info.dbrw, DB_UTIL_REGISTER_HOOK_METHOD);
- _E("db_open_rw ret=%d", ret);
+ ret = db_util_open(APP_INFO_DB, &db_info.dbrw, 0);
+ retv_with_dbmsg_if(ret != SQLITE_OK, AIL_ERROR_DB_FAILED);
+ }
+ }
+
+ return AIL_ERROR_OK;
+}
+
+
+ail_error_e db_open_pkg_mgr(db_open_mode mode)
+{
+ int ret = AIL_ERROR_OK;
+
+ if(mode & DB_OPEN_RO) {
+ if (!db_info.dbro) {
+ ret = db_util_open(PKGMGR_PARSER_DB, &db_info.dbro, 0);
+ retv_with_dbmsg_if(ret != SQLITE_OK, AIL_ERROR_DB_FAILED);
+ }
+ }
+
+ if(mode & DB_OPEN_RW) {
+ if (!db_info.dbrw) {
+ ret = db_util_open(PKGMGR_PARSER_DB, &db_info.dbrw, 0);
retv_with_dbmsg_if(ret != SQLITE_OK, AIL_ERROR_DB_FAILED);
}
}
@@ -83,8 +108,9 @@ ail_error_e db_prepare(const char *query, sqlite3_stmt **stmt)
ret = sqlite3_prepare_v2(db_info.dbro, query, strlen(query), stmt, NULL);
if (ret != SQLITE_OK) {
_E("%s\n", sqlite3_errmsg(db_info.dbro));
+ _E("%d\n", sqlite3_extended_errcode(db_info.dbro));
return AIL_ERROR_DB_FAILED;
- } else
+ } else
return AIL_ERROR_OK;
}
@@ -215,8 +241,8 @@ ail_error_e db_exec(const char *query)
ret = sqlite3_exec(db_info.dbrw, query, NULL, NULL, &errmsg);
if (ret != SQLITE_OK) {
- _E("Cannot execute this query - %s. because %s",
- query, errmsg? errmsg:"uncatched error");
+ _E("Cannot execute because %s", errmsg? errmsg:"uncatched error");
+ _E("query - %s", query);
sqlite3_free(errmsg);
return AIL_ERROR_DB_FAILED;
}
@@ -251,5 +277,18 @@ EXPORT_API ail_error_e ail_db_close(void)
return db_close();
}
+int db_exec_sqlite_query(char *query, sqlite_query_callback callback, void *data)
+{
+ char *error_message = NULL;
+ if (SQLITE_OK !=
+ sqlite3_exec(db_info.dbro, query, callback, data, &error_message)) {
+ _E("Don't execute query = %s error message = %s\n", query,
+ error_message);
+ sqlite3_free(error_message);
+ return -1;
+ }
+ sqlite3_free(error_message);
+ return 0;
+}
// End of file.
diff --git a/src/ail_db.h b/src/ail_db.h
index 32c26c4..1058e5e 100755
--- a/src/ail_db.h
+++ b/src/ail_db.h
@@ -34,8 +34,10 @@ typedef enum {
DB_OPEN_RO = 0x0001,
DB_OPEN_RW = 0x0002,
} db_open_mode;
+typedef int (*sqlite_query_callback)(void *data, int ncols, char **coltxt, char **colname);
ail_error_e db_open(db_open_mode mode);
+ail_error_e db_open_pkg_mgr(db_open_mode mode);
ail_error_e db_prepare(const char *query, sqlite3_stmt **stmt);
ail_error_e db_bind_bool(sqlite3_stmt *stmt, int idx, bool value);
@@ -53,6 +55,6 @@ ail_error_e db_finalize(sqlite3_stmt *stmt);
ail_error_e db_exec(const char *query);
ail_error_e db_close(void);
-
+int db_exec_sqlite_query(char *query, sqlite_query_callback callback, void *data);
#endif
// End of file
diff --git a/src/ail_desktop.c b/src/ail_desktop.c
index ecdee72..dd9157a 100755
--- a/src/ail_desktop.c
+++ b/src/ail_desktop.c
@@ -36,7 +36,9 @@
#include "ail_private.h"
#include "ail_db.h"
+#include "ail_sql.h"
#include "ail.h"
+#include "ail_convert.h"
#define OPT_DESKTOP_DIRECTORY "/opt/share/applications"
#define USR_DESKTOP_DIRECTORY "/usr/share/applications"
@@ -100,6 +102,10 @@ typedef struct {
char* x_slp_svc;
char* x_slp_exe_path;
char* x_slp_appid;
+ char* x_slp_pkgid;
+ char* x_slp_domain;
+ char* x_slp_submodemainid;
+ char* x_slp_installedstorage;
int x_slp_baselayoutwidth;
int x_slp_installedtime;
int nodisplay;
@@ -107,7 +113,8 @@ typedef struct {
int x_slp_multiple;
int x_slp_removable;
int x_slp_ishorizontalscale;
- int x_slp_inactivated;
+ int x_slp_enabled;
+ int x_slp_submode;
char* desktop;
GSList* localname;
} desktop_info_s;
@@ -134,13 +141,14 @@ static ail_error_e _read_exec(void *data, char *tag, char *value)
}
token_exe_path = strtok_r(temp_exec, argsdelimiter, &save_ptr);
-
- info->x_slp_exe_path = strdup(token_exe_path);
- if(!info->x_slp_exe_path) {
- free(info->exec);
- info->exec = NULL;
- free(temp_exec);
- return AIL_ERROR_OUT_OF_MEMORY;
+ if (token_exe_path) {
+ info->x_slp_exe_path = strdup(token_exe_path);
+ if(!info->x_slp_exe_path) {
+ free(info->exec);
+ info->exec = NULL;
+ free(temp_exec);
+ return AIL_ERROR_OUT_OF_MEMORY;
+ }
}
free(temp_exec);
@@ -240,6 +248,8 @@ _get_icon_with_path(char* icon)
package = _get_package_from_icon(icon);
retv_if(!package, NULL);
+/* "db/setting/theme" is not exist */
+#if 0
theme = vconf_get_str("db/setting/theme");
if (!theme) {
theme = strdup("default");
@@ -248,6 +258,13 @@ _get_icon_with_path(char* icon)
return NULL;
}
}
+#else
+ theme = strdup("default");
+ if (!theme) {
+ free(package);
+ return NULL;
+ }
+#endif
len = (0x01 << 7) + strlen(icon) + strlen(package) + strlen(theme);
icon_with_path = malloc(len);
@@ -260,27 +277,27 @@ _get_icon_with_path(char* icon)
memset(icon_with_path, 0, len);
- snprintf(icon_with_path, len, "/opt/share/icons/%s/small/%s", theme, icon);
+ sqlite3_snprintf( len, icon_with_path,"/opt/share/icons/%q/small/%q", theme, icon);
do {
if (access(icon_with_path, R_OK) == 0) break;
- snprintf(icon_with_path, len, "/usr/share/icons/%s/small/%s", theme, icon);
+ sqlite3_snprintf( len, icon_with_path,"/usr/share/icons/%q/small/%q", theme, icon);
if (access(icon_with_path, R_OK) == 0) break;
_D("cannot find icon %s", icon_with_path);
- snprintf(icon_with_path, len, "/opt/share/icons/default/small/%s", icon);
+ sqlite3_snprintf( len, icon_with_path, "/opt/share/icons/default/small/%q", icon);
if (access(icon_with_path, R_OK) == 0) break;
- snprintf(icon_with_path, len, "/usr/share/icons/default/small/%s", icon);
+ sqlite3_snprintf( len, icon_with_path, "/usr/share/icons/default/small/%q", icon);
if (access(icon_with_path, R_OK) == 0) break;
#if 1 /* this will be remove when finish the work for moving icon path */
_E("icon file must be moved to %s", icon_with_path);
- snprintf(icon_with_path, len, "/opt/apps/%s/res/icons/%s/small/%s", package, theme, icon);
+ sqlite3_snprintf( len, icon_with_path, "/opt/apps/%q/res/icons/%q/small/%q", package, theme, icon);
if (access(icon_with_path, R_OK) == 0) break;
- snprintf(icon_with_path, len, "/usr/apps/%s/res/icons/%s/small/%s", package, theme, icon);
+ sqlite3_snprintf( len, icon_with_path, "/usr/apps/%q/res/icons/%q/small/%q", package, theme, icon);
if (access(icon_with_path, R_OK) == 0) break;
_D("cannot find icon %s", icon_with_path);
- snprintf(icon_with_path, len, "/opt/apps/%s/res/icons/default/small/%s", package, icon);
+ sqlite3_snprintf( len, icon_with_path, "/opt/apps/%q/res/icons/default/small/%q", package, icon);
if (access(icon_with_path, R_OK) == 0) break;
- snprintf(icon_with_path, len, "/usr/apps/%s/res/icons/default/small/%s", package, icon);
+ sqlite3_snprintf( len, icon_with_path, "/usr/apps/%q/res/icons/default/small/%q", package, icon);
if (access(icon_with_path, R_OK) == 0) break;
#endif
} while (0);
@@ -351,7 +368,10 @@ static ail_error_e _read_mimetype(void *data, char *tag, char *value)
{
desktop_info_s *info = data;
int size, total_len = 0;
- char *mimes_origin, *mimes_changed, *token_unalias, *save_ptr;
+ char *mimes_origin = NULL;
+ char *mimes_changed = NULL;
+ char *token_unalias = NULL;
+ char *save_ptr = NULL;
retv_if(!data, AIL_ERROR_INVALID_PARAMETER);
retv_if(!value, AIL_ERROR_INVALID_PARAMETER);
@@ -387,6 +407,10 @@ static ail_error_e _read_mimetype(void *data, char *tag, char *value)
tmp = realloc(mimes_changed, size);
if(!tmp) {
free(mimes_changed);
+
+ if (mimes_origin)
+ free(mimes_origin);
+
return AIL_ERROR_OUT_OF_MEMORY;
}
mimes_changed = tmp;
@@ -404,6 +428,9 @@ static ail_error_e _read_mimetype(void *data, char *tag, char *value)
SAFE_FREE(info->mimetype);
info->mimetype = mimes_changed;
+ if (mimes_origin)
+ free(mimes_origin);
+
return AIL_ERROR_OK;
}
@@ -481,7 +508,31 @@ static ail_error_e _read_x_slp_packageid(void *data, char *tag, char *value)
return AIL_ERROR_OK;
}
+static ail_error_e _read_x_slp_submodemainid(void *data, char *tag, char *value)
+{
+ desktop_info_s *info = data;
+
+ retv_if(!data, AIL_ERROR_INVALID_PARAMETER);
+ retv_if(!value, AIL_ERROR_INVALID_PARAMETER);
+
+ SAFE_FREE_AND_STRDUP(value, info->x_slp_submodemainid);
+ retv_if(!info->x_slp_submodemainid, AIL_ERROR_OUT_OF_MEMORY);
+
+ return AIL_ERROR_OK;
+}
+
+static ail_error_e _read_x_slp_installedstorage(void *data, char *tag, char *value)
+{
+ desktop_info_s *info = data;
+ retv_if(!data, AIL_ERROR_INVALID_PARAMETER);
+ retv_if(!value, AIL_ERROR_INVALID_PARAMETER);
+
+ SAFE_FREE_AND_STRDUP(value, info->x_slp_installedstorage);
+ retv_if(!info->x_slp_installedstorage, AIL_ERROR_OUT_OF_MEMORY);
+
+ return AIL_ERROR_OK;
+}
static ail_error_e _read_x_slp_uri(void *data, char *tag, char *value)
{
@@ -554,6 +605,18 @@ static ail_error_e _read_x_slp_removable(void *data, char *tag, char *value)
}
+static ail_error_e _read_x_slp_submode(void *data, char *tag, char *value)
+{
+ desktop_info_s *info = data;
+
+ retv_if(!data, AIL_ERROR_INVALID_PARAMETER);
+ retv_if(!value, AIL_ERROR_INVALID_PARAMETER);
+
+ info->x_slp_submode = !strcasecmp(value, "true");
+
+ return AIL_ERROR_OK;
+}
+
static ail_error_e _read_x_slp_appid(void *data, char *tag, char *value)
{
desktop_info_s *info = data;
@@ -567,6 +630,48 @@ static ail_error_e _read_x_slp_appid(void *data, char *tag, char *value)
return AIL_ERROR_OK;
}
+
+static ail_error_e _read_x_slp_pkgid(void *data, char *tag, char *value)
+{
+ desktop_info_s *info = data;
+
+ retv_if(!data, AIL_ERROR_INVALID_PARAMETER);
+ retv_if(!value, AIL_ERROR_INVALID_PARAMETER);
+
+ SAFE_FREE_AND_STRDUP(value, info->x_slp_pkgid);
+ retv_if(!info->x_slp_pkgid, AIL_ERROR_OUT_OF_MEMORY);
+
+ return AIL_ERROR_OK;
+}
+
+
+static ail_error_e _read_x_slp_domain(void *data, char *tag, char *value)
+{
+ desktop_info_s *info = data;
+
+ retv_if(!data, AIL_ERROR_INVALID_PARAMETER);
+ retv_if(!value, AIL_ERROR_INVALID_PARAMETER);
+
+ SAFE_FREE_AND_STRDUP(value, info->x_slp_domain);
+ retv_if(!info->x_slp_appid, AIL_ERROR_OUT_OF_MEMORY);
+
+ return AIL_ERROR_OK;
+}
+
+
+static ail_error_e _read_x_slp_enabled(void *data, char *tag, char *value)
+{
+ desktop_info_s *info = data;
+
+ retv_if(!data, AIL_ERROR_INVALID_PARAMETER);
+ retv_if(!value, AIL_ERROR_INVALID_PARAMETER);
+
+ info->x_slp_enabled = !strcasecmp(value, "true");
+
+ return AIL_ERROR_OK;
+}
+
+
static struct entry_parser entry_parsers[] = {
{
.field = "exec",
@@ -613,6 +718,14 @@ static struct entry_parser entry_parsers[] = {
.value_cb = _read_x_slp_packageid,
},
{
+ .field = "x-tizen-submodemainid",
+ .value_cb = _read_x_slp_submodemainid,
+ },
+ {
+ .field = "x-tizen-installedstorage",
+ .value_cb = _read_x_slp_installedstorage,
+ },
+ {
.field = "x-tizen-uri",
.value_cb = _read_x_slp_uri,
},
@@ -629,6 +742,14 @@ static struct entry_parser entry_parsers[] = {
.value_cb = _read_x_slp_taskmanage,
},
{
+ .field = "x-tizen-enabled",
+ .value_cb = _read_x_slp_enabled,
+ },
+ {
+ .field = "x-tizen-submode",
+ .value_cb = _read_x_slp_submode,
+ },
+ {
.field = "x-tizen-multiple",
.value_cb = _read_x_slp_multiple,
},
@@ -641,6 +762,18 @@ static struct entry_parser entry_parsers[] = {
.value_cb = _read_x_slp_appid,
},
{
+ .field = "x-tizen-pkgid",
+ .value_cb = _read_x_slp_pkgid,
+ },
+ {
+ .field = "x-tizen-domain",
+ .value_cb = _read_x_slp_domain,
+ },
+ {
+ .field = "x-tizen-enabled",
+ .value_cb = _read_x_slp_domain,
+ },
+ {
.field = NULL,
.value_cb = NULL,
},
@@ -713,6 +846,8 @@ static inline int _strlen_desktop_info(desktop_info_s* info)
if (info->x_slp_exe_path) len += strlen(info->x_slp_exe_path);
if (info->x_slp_appid) len += strlen(info->x_slp_appid);
if (info->desktop) len += strlen(info->desktop);
+ if (info->x_slp_submodemainid) len += strlen(info->x_slp_submodemainid);
+ if (info->x_slp_installedstorage) len += strlen(info->x_slp_installedstorage);
return len;
}
@@ -744,6 +879,7 @@ static ail_error_e _init_desktop_info(desktop_info_s *info, const char *package)
info->x_slp_taskmanage = 1;
info->x_slp_removable = 1;
+ info->x_slp_submode = 0;
if(is_initdb)
info->x_slp_installedtime = 0;
@@ -762,6 +898,8 @@ static ail_error_e _init_desktop_info(desktop_info_s *info, const char *package)
info->x_slp_appid = strdup(package);
retv_if(!info->x_slp_appid, AIL_ERROR_OUT_OF_MEMORY);
+ info->x_slp_enabled = 1;
+
info->desktop = _pkgname_to_desktop(package);
retv_if(!info->desktop, AIL_ERROR_FAIL);
@@ -797,7 +935,7 @@ static ail_error_e _read_desktop_info(desktop_info_s* info)
tag = calloc(1, len);
value = calloc(1, len);
- if (!field || !field || !tag || !value) {
+ if (!field || !field_name || !tag || !value) {
goto NEXT;
}
@@ -812,7 +950,7 @@ static ail_error_e _read_desktop_info(desktop_info_s* info)
}
for (idx = 0; entry_parsers[idx].field; idx ++) {
- if (!strcasecmp(entry_parsers[idx].field, field_name) && entry_parsers[idx].value_cb) {
+ if (!g_ascii_strcasecmp(entry_parsers[idx].field, field_name) && entry_parsers[idx].value_cb) {
if (entry_parsers[idx].value_cb(info, tag, tmp) != AIL_ERROR_OK) {
_E("field - [%s] is wrong.", field_name);
}
@@ -833,13 +971,124 @@ NEXT:
}
+static ail_error_e _retrieve_all_column_to_desktop_info(desktop_info_s* info, sqlite3_stmt *stmt)
+{
+ int i, j;
+ ail_error_e err;
+ char **values;
+ char *col;
+
+ retv_if(!info, AIL_ERROR_INVALID_PARAMETER);
+
+ values = calloc(NUM_OF_PROP, sizeof(char *));
+ retv_if(!values, AIL_ERROR_OUT_OF_MEMORY);
+
+ for (i = 0; i < NUM_OF_PROP; i++) {
+ err = db_column_str(stmt, i, &col);
+ if (AIL_ERROR_OK != err)
+ break;
+
+ if (!col) {
+ values[i] = AIL_EMPTY_STR;
+ } else {
+ values[i] = strdup(col);
+ if (!values[i]) {
+ err = AIL_ERROR_OUT_OF_MEMORY;
+ goto NEXT;
+ }
+ }
+ }
+
+ SAFE_FREE_AND_STRDUP(values[E_AIL_PROP_EXEC_STR], info->exec);
+ SAFE_FREE_AND_STRDUP(values[E_AIL_PROP_NAME_STR], info->name);
+ SAFE_FREE_AND_STRDUP(values[E_AIL_PROP_TYPE_STR], info->type);
+ SAFE_FREE_AND_STRDUP(values[E_AIL_PROP_ICON_STR], info->icon);
+ SAFE_FREE_AND_STRDUP(values[E_AIL_PROP_CATEGORIES_STR], info->categories);
+ SAFE_FREE_AND_STRDUP(values[E_AIL_PROP_VERSION_STR], info->version);
+ SAFE_FREE_AND_STRDUP(values[E_AIL_PROP_MIMETYPE_STR], info->mimetype);
+ SAFE_FREE_AND_STRDUP(values[E_AIL_PROP_X_SLP_SERVICE_STR], info->x_slp_service);
+ SAFE_FREE_AND_STRDUP(values[E_AIL_PROP_X_SLP_PACKAGETYPE_STR], info->x_slp_packagetype);
+ SAFE_FREE_AND_STRDUP(values[E_AIL_PROP_X_SLP_PACKAGECATEGORIES_STR], info->x_slp_packagecategories);
+ SAFE_FREE_AND_STRDUP(values[E_AIL_PROP_X_SLP_PACKAGEID_STR], info->x_slp_packageid);
+ SAFE_FREE_AND_STRDUP(values[E_AIL_PROP_X_SLP_URI_STR], info->x_slp_uri);
+ SAFE_FREE_AND_STRDUP(values[E_AIL_PROP_X_SLP_SVC_STR], info->x_slp_svc);
+ SAFE_FREE_AND_STRDUP(values[E_AIL_PROP_X_SLP_EXE_PATH], info->x_slp_exe_path);
+ SAFE_FREE_AND_STRDUP(values[E_AIL_PROP_X_SLP_APPID_STR], info->x_slp_appid);
+ SAFE_FREE_AND_STRDUP(values[E_AIL_PROP_X_SLP_PKGID_STR], info->x_slp_pkgid);
+ SAFE_FREE_AND_STRDUP(values[E_AIL_PROP_X_SLP_DOMAIN_STR], info->x_slp_domain);
+ SAFE_FREE_AND_STRDUP(values[E_AIL_PROP_X_SLP_SUBMODEMAINID_STR], info->x_slp_submodemainid);
+ SAFE_FREE_AND_STRDUP(values[E_AIL_PROP_X_SLP_INSTALLEDSTORAGE_STR], info->x_slp_installedstorage);
+
+ info->x_slp_installedtime = atoi(values[E_AIL_PROP_X_SLP_INSTALLEDTIME_INT]);
+
+ info->nodisplay = atoi(values[E_AIL_PROP_NODISPLAY_BOOL]);
+ info->x_slp_taskmanage = atoi(values[E_AIL_PROP_X_SLP_TASKMANAGE_BOOL]);
+ info->x_slp_multiple = atoi(values[E_AIL_PROP_X_SLP_MULTIPLE_BOOL]);
+ info->x_slp_removable = atoi(values[E_AIL_PROP_X_SLP_REMOVABLE_BOOL]);
+ info->x_slp_ishorizontalscale = atoi(values[E_AIL_PROP_X_SLP_ISHORIZONTALSCALE_BOOL]);
+ info->x_slp_enabled = atoi(values[E_AIL_PROP_X_SLP_ENABLED_BOOL]);
+ info->x_slp_submode = atoi(values[E_AIL_PROP_X_SLP_SUBMODE_BOOL]);
+
+ err = AIL_ERROR_OK;
+
+NEXT:
+ for (j = 0; j < i; ++j) {
+ if (strcmp(values[j], AIL_EMPTY_STR) != 0)
+ free(values[j]);
+ }
+ if (values)
+ free(values);
+ return err;
+}
+
+
+static ail_error_e _load_desktop_info(desktop_info_s* info)
+{
+ ail_error_e ret;
+ char query[AIL_SQL_QUERY_MAX_LEN];
+ sqlite3_stmt *stmt = NULL;
+
+ retv_if(!info, AIL_ERROR_INVALID_PARAMETER);
+
+ char *w = sqlite3_mprintf("app_info.X_SLP_APPID=%Q", info->package);
+
+ snprintf(query, sizeof(query), "SELECT %s FROM %s WHERE %s",SQL_FLD_APP_INFO, SQL_TBL_APP_INFO, w);
+
+ do {
+ ret = db_open(DB_OPEN_RO);
+ if (ret < 0) break;
+
+ ret = db_prepare(query, &stmt);
+ if (ret < 0) break;
+
+ ret = db_step(stmt);
+ if (ret < 0) {
+ db_finalize(stmt);
+ break;
+ }
+
+ ret = _retrieve_all_column_to_desktop_info(info, stmt);
+ if (ret < 0) {
+ db_finalize(stmt);
+ break;
+ }
+
+ ret = db_finalize(stmt);
+ if (ret < 0) break;
+
+ ret = AIL_ERROR_OK;
+ break;
+ } while(0);
+
+ sqlite3_free(w);
+ return ret;
+}
static ail_error_e _modify_desktop_info_bool(desktop_info_s* info,
const char *property,
bool value)
{
ail_prop_bool_e prop;
- int val;
retv_if(!info, AIL_ERROR_INVALID_PARAMETER);
retv_if(!property, AIL_ERROR_INVALID_PARAMETER);
@@ -850,10 +1099,46 @@ static ail_error_e _modify_desktop_info_bool(desktop_info_s* info,
return AIL_ERROR_INVALID_PARAMETER;
switch (prop) {
- case E_AIL_PROP_X_SLP_INACTIVATED_BOOL:
- info->x_slp_inactivated = (int)value;
+ case E_AIL_PROP_X_SLP_ENABLED_BOOL:
+ info->x_slp_enabled = (int)value;
+ break;
+ default:
+ return AIL_ERROR_FAIL;
+ }
+
+ return AIL_ERROR_OK;
+}
+
+
+static ail_error_e _modify_desktop_info_str(desktop_info_s* info,
+ const char *property,
+ const char *value)
+{
+ ail_prop_str_e prop;
+
+ retv_if(!info, AIL_ERROR_INVALID_PARAMETER);
+ retv_if(!property, AIL_ERROR_INVALID_PARAMETER);
+
+ prop = _ail_convert_to_prop_str(property);
+
+ if (prop < E_AIL_PROP_STR_MIN || prop > E_AIL_PROP_STR_MAX)
+ return AIL_ERROR_INVALID_PARAMETER;
+
+ switch (prop) {
+ case E_AIL_PROP_NAME_STR:
+ SAFE_FREE_AND_STRDUP(value, info->name);
+ retv_if (!info->name, AIL_ERROR_OUT_OF_MEMORY);
+ break;
+ case E_AIL_PROP_X_SLP_SVC_STR:
+ SAFE_FREE_AND_STRDUP(value, info->x_slp_svc);
+ retv_if (!info->x_slp_svc, AIL_ERROR_OUT_OF_MEMORY);
+ break;
+ case E_AIL_PROP_X_SLP_INSTALLEDSTORAGE_STR:
+ SAFE_FREE_AND_STRDUP(value, info->x_slp_installedstorage);
+ retv_if (!info->x_slp_installedstorage, AIL_ERROR_OUT_OF_MEMORY);
break;
default:
+ _E("prop[%d] is not defined\n", prop);
return AIL_ERROR_FAIL;
}
@@ -862,6 +1147,7 @@ static ail_error_e _modify_desktop_info_bool(desktop_info_s* info,
+
static ail_error_e _create_table(void)
{
int i;
@@ -884,6 +1170,10 @@ static ail_error_e _create_table(void)
"x_slp_svc TEXT, "
"x_slp_exe_path TEXT, "
"x_slp_appid TEXT, "
+ "x_slp_pkgid TEXT, "
+ "x_slp_domain TEXT, "
+ "x_slp_submodemainid TEXT, "
+ "x_slp_installedstorage TEXT, "
"x_slp_baselayoutwidth INTEGER DEFAULT 0, "
"x_slp_installedtime INTEGER DEFAULT 0, "
"nodisplay INTEGER DEFAULT 0, "
@@ -891,11 +1181,14 @@ static ail_error_e _create_table(void)
"x_slp_multiple INTEGER DEFAULT 0, "
"x_slp_removable INTEGER DEFAULT 1, "
"x_slp_ishorizontalscale INTEGER DEFAULT 0, "
- "x_slp_inactivated INTEGER DEFAULT 0, "
+ "x_slp_enabled INTEGER DEFAULT 1, "
+ "x_slp_submode INTEGER DEFAULT 0, "
"desktop TEXT UNIQUE NOT NULL);",
"CREATE TABLE localname (package TEXT NOT NULL, "
"locale TEXT NOT NULL, "
- "name TEXT NOT NULL, PRIMARY KEY (package, locale));",
+ "name TEXT NOT NULL, "
+ "x_slp_pkgid TEXT NOT NULL, PRIMARY KEY (package, locale));",
+
NULL
};
@@ -913,29 +1206,25 @@ static ail_error_e _create_table(void)
static inline void _insert_localname(gpointer data, gpointer user_data)
{
- char query[512];
-
struct name_item *item = (struct name_item *)data;
desktop_info_s *info = (desktop_info_s *)user_data;
- snprintf(query, sizeof(query), "insert into localname (package, locale, name) "
- "values ('%s', '%s', '%s');",
- info->package, item->locale, item->name);
+ char *query = sqlite3_mprintf("insert into localname (package, locale, name, x_slp_pkgid) "
+ "values (%Q, %Q, %Q, %Q);",
+ info->package, item->locale, item->name, info->x_slp_pkgid);
+
if (db_exec(query) < 0)
_E("Failed to insert local name of package[%s]",info->package);
+
+ sqlite3_free(query);
}
static ail_error_e _insert_desktop_info(desktop_info_s *info)
{
- char *query;
- int len;
ail_error_e ret;
- len = _strlen_desktop_info(info) + (0x01 << 10);
- query = calloc(1, len);
- retv_if(!query, AIL_ERROR_OUT_OF_MEMORY);
- snprintf(query, len, "insert into app_info ("
+ char *query = sqlite3_mprintf("insert into app_info ("
"package, "
"exec, name, "
"type, "
@@ -951,6 +1240,10 @@ static ail_error_e _insert_desktop_info(desktop_info_s *info)
"x_slp_svc, "
"x_slp_exe_path, "
"x_slp_appid, "
+ "x_slp_pkgid, "
+ "x_slp_domain, "
+ "x_slp_submodemainid, "
+ "x_slp_installedstorage, "
"x_slp_baselayoutwidth, "
"x_slp_installedtime, "
"nodisplay, "
@@ -958,15 +1251,17 @@ static ail_error_e _insert_desktop_info(desktop_info_s *info)
"x_slp_multiple, "
"x_slp_removable, "
"x_slp_ishorizontalscale, "
- "x_slp_inactivated, "
+ "x_slp_enabled, "
+ "x_slp_submode, "
"desktop) "
"values "
- "('%s', '%s', '%s', '%s', '%s', "
- "'%s', '%s', '%s', '%s', '%s', "
- "'%s', '%s', '%s', '%s', '%s', '%s', "
- "%d, %d, %d, %d, %d, %d, "
+ "(%Q, %Q, %Q, %Q, %Q, "
+ "%Q, %Q, %Q, %Q, %Q, "
+ "%Q, %Q, %Q, %Q, %Q, "
+ "%Q, %Q, %Q, %Q, %Q, "
+ "%d, %d, %d, %d, %d, %d, %d,"
"%d, %d, "
- "'%s');",
+ "%Q);",
info->package,
info->exec,
info->name,
@@ -983,6 +1278,10 @@ static ail_error_e _insert_desktop_info(desktop_info_s *info)
info->x_slp_svc,
info->x_slp_exe_path,
info->x_slp_appid,
+ info->x_slp_pkgid,
+ info->x_slp_domain,
+ info->x_slp_submodemainid,
+ info->x_slp_installedstorage,
info->x_slp_baselayoutwidth,
info->x_slp_installedtime,
info->nodisplay,
@@ -990,24 +1289,30 @@ static ail_error_e _insert_desktop_info(desktop_info_s *info)
info->x_slp_multiple,
info->x_slp_removable,
info->x_slp_ishorizontalscale,
- info->x_slp_inactivated,
+ info->x_slp_enabled,
+ info->x_slp_submode,
info->desktop
);
ret = db_open(DB_OPEN_RW);
if(ret != AIL_ERROR_OK) {
_E("(tmp == NULL) return\n");
- free(query);
+ sqlite3_free(query);
return AIL_ERROR_DB_FAILED;
}
ret = db_exec(query);
- retv_if(ret != AIL_ERROR_OK, AIL_ERROR_DB_FAILED);
+ if(ret != AIL_ERROR_OK) {
+ _E("db_exec fail\n");
+ sqlite3_free(query);
+ return AIL_ERROR_DB_FAILED;
+ }
if (info->localname)
g_slist_foreach(info->localname, _insert_localname, info);
_D("Add (%s).", info->package);
+ sqlite3_free(query);
return AIL_ERROR_OK;
}
@@ -1016,35 +1321,35 @@ static ail_error_e _insert_desktop_info(desktop_info_s *info)
static ail_error_e _update_desktop_info(desktop_info_s *info)
{
- char *query;
- int len;
retv_if (NULL == info, AIL_ERROR_INVALID_PARAMETER);
if (db_open(DB_OPEN_RW) < 0) {
+ _E("db_open fail\n");
return AIL_ERROR_DB_FAILED;
}
- len = _strlen_desktop_info(info) + (0x01 << 10);
- query = calloc(1, len);
- retv_if(!query, AIL_ERROR_OUT_OF_MEMORY);
-
- snprintf (query, len, "update app_info set "
- "exec='%s', "
- "name='%s', "
- "type='%s', "
- "icon='%s', "
- "categories='%s', "
- "version='%s', "
- "mimetype='%s', "
- "x_slp_service='%s', "
- "x_slp_packagetype='%s', "
- "x_slp_packagecategories='%s', "
- "x_slp_packageid='%s', "
- "x_slp_uri='%s', "
- "x_slp_svc='%s', "
- "x_slp_exe_path='%s', "
- "x_slp_appid='%s', "
+
+ char *query = sqlite3_mprintf("update app_info set "
+ "exec=%Q, "
+ "name=%Q, "
+ "type=%Q, "
+ "icon=%Q, "
+ "categories=%Q, "
+ "version=%Q, "
+ "mimetype=%Q, "
+ "x_slp_service=%Q, "
+ "x_slp_packagetype=%Q, "
+ "x_slp_packagecategories=%Q, "
+ "x_slp_packageid=%Q, "
+ "x_slp_uri=%Q, "
+ "x_slp_svc=%Q, "
+ "x_slp_exe_path=%Q, "
+ "x_slp_appid=%Q, "
+ "x_slp_pkgid=%Q, "
+ "x_slp_domain=%Q, "
+ "x_slp_submodemainid=%Q, "
+ "x_slp_installedstorage=%Q, "
"x_slp_baselayoutwidth=%d, "
"x_slp_installedtime=%d, "
"nodisplay=%d, "
@@ -1052,9 +1357,10 @@ static ail_error_e _update_desktop_info(desktop_info_s *info)
"x_slp_multiple=%d, "
"x_slp_removable=%d, "
"x_slp_ishorizontalscale=%d, "
- "x_slp_inactivated=%d, "
- "desktop='%s'"
- "where package='%s'",
+ "x_slp_enabled=%d, "
+ "x_slp_submode=%d, "
+ "desktop=%Q"
+ "where package=%Q",
info->exec,
info->name,
info->type,
@@ -1070,6 +1376,10 @@ static ail_error_e _update_desktop_info(desktop_info_s *info)
info->x_slp_svc,
info->x_slp_exe_path,
info->x_slp_appid,
+ info->x_slp_pkgid,
+ info->x_slp_domain,
+ info->x_slp_submodemainid,
+ info->x_slp_installedstorage,
info->x_slp_baselayoutwidth,
info->x_slp_installedtime,
info->nodisplay,
@@ -1077,19 +1387,22 @@ static ail_error_e _update_desktop_info(desktop_info_s *info)
info->x_slp_multiple,
info->x_slp_removable,
info->x_slp_ishorizontalscale,
- info->x_slp_inactivated,
+ info->x_slp_enabled,
+ info->x_slp_submode,
info->desktop,
info->package);
if (db_exec(query) < 0) {
- free (query);
+ _E("db_exec fail\n");
+ sqlite3_free(query);
return AIL_ERROR_DB_FAILED;
}
- snprintf(query, len, "delete from localname where package = '%s'", info->package);
-
+ sqlite3_free(query);
+ query = sqlite3_mprintf("delete from localname where package = %Q", info->package);
if (db_exec(query) < 0) {
- free (query);
+ _E("db_exec fail\n");
+ sqlite3_free(query);
return AIL_ERROR_DB_FAILED;
}
@@ -1098,7 +1411,7 @@ static ail_error_e _update_desktop_info(desktop_info_s *info)
_D("Update (%s).", info->package);
- free(query);
+ sqlite3_free(query);
return AIL_ERROR_OK;
}
@@ -1107,8 +1420,7 @@ static ail_error_e _update_desktop_info(desktop_info_s *info)
static ail_error_e _remove_package(const char* package)
{
- char *query;
- int size;
+ char *query = NULL;
retv_if(!package, AIL_ERROR_INVALID_PARAMETER);
@@ -1116,31 +1428,63 @@ static ail_error_e _remove_package(const char* package)
return AIL_ERROR_DB_FAILED;
}
- size = strlen(package) + (0x01 << 10);
- query = calloc(1, size);
- retv_if(!query, AIL_ERROR_OUT_OF_MEMORY);
- snprintf(query, size, "delete from app_info where package = '%s'", package);
+ query = sqlite3_mprintf("delete from app_info where package = %Q", package);
if (db_exec(query) < 0) {
- free(query);
+ _E("db_exec fail\n");
+ sqlite3_free(query);
return AIL_ERROR_DB_FAILED;
}
+ sqlite3_free(query);
- snprintf(query, size, "delete from localname where package = '%s'", package);
- _D("query=%s",query);
+ query = sqlite3_mprintf("delete from localname where package = %Q", package);
+// _D("query=%s",query);
if (db_exec(query) < 0) {
- free(query);
+ _E("db_exec fail\n");
+ sqlite3_free(query);
return AIL_ERROR_DB_FAILED;
}
_D("Remove (%s).", package);
- free(query);
+ sqlite3_free(query);
return AIL_ERROR_OK;
}
+static ail_error_e _clean_pkgid_data(const char* pkgid)
+{
+ char *query = NULL;
+
+ retv_if(!pkgid, AIL_ERROR_INVALID_PARAMETER);
+
+ if (db_open(DB_OPEN_RW) < 0) {
+ return AIL_ERROR_DB_FAILED;
+ }
+
+
+ query = sqlite3_mprintf("delete from app_info where x_slp_pkgid = %Q", pkgid);
+ if (db_exec(query) < 0) {
+ sqlite3_free(query);
+ return AIL_ERROR_DB_FAILED;
+ }
+ sqlite3_free(query);
+
+ query = sqlite3_mprintf("delete from localname where x_slp_pkgid = %Q", pkgid);
+// _D("query=%s",query);
+
+ if (db_exec(query) < 0) {
+ _E("db_exec fail\n");
+ sqlite3_free(query);
+ return AIL_ERROR_DB_FAILED;
+ }
+
+ _D("Clean pkgid data (%s).", pkgid);
+ sqlite3_free(query);
+
+ return AIL_ERROR_OK;
+}
static ail_error_e _send_db_done_noti(noti_type type, const char *package)
@@ -1169,7 +1513,8 @@ static ail_error_e _send_db_done_noti(noti_type type, const char *package)
retv_if(!noti_string, AIL_ERROR_OUT_OF_MEMORY);
snprintf(noti_string, size, "%s:%s", type_string, package);
- vconf_set_str("memory/menuscreen/desktop", noti_string);
+ vconf_set_str(VCONFKEY_AIL_INFO_STATE, noti_string);
+ vconf_set_str(VCONFKEY_MENUSCREEN_DESKTOP, noti_string); // duplicate, will be removed
_D("Noti : %s", noti_string);
free(noti_string);
@@ -1207,6 +1552,10 @@ static void _fini_desktop_info(desktop_info_s *info)
SAFE_FREE(info->x_slp_svc);
SAFE_FREE(info->x_slp_exe_path);
SAFE_FREE(info->x_slp_appid);
+ SAFE_FREE(info->x_slp_pkgid);
+ SAFE_FREE(info->x_slp_domain);
+ SAFE_FREE(info->x_slp_submodemainid);
+ SAFE_FREE(info->x_slp_installedstorage);
SAFE_FREE(info->desktop);
if (info->localname) {
g_slist_free_full(info->localname, _name_item_free_func);
@@ -1216,117 +1565,262 @@ static void _fini_desktop_info(desktop_info_s *info)
return;
}
+static int __is_authorized()
+{
+ uid_t uid = getuid();
+ if ((uid_t) 0 == uid )
+ return 1;
+ else
+ return 0;
+}
/* Public functions */
-EXPORT_API ail_error_e ail_desktop_add(const char *package)
+EXPORT_API ail_error_e ail_desktop_add(const char *appid)
{
desktop_info_s info = {0,};
- ail_error_e ret;
- int count;
+ ail_error_e ret = AIL_ERROR_OK;
+ int count = 0;
- retv_if(!package, AIL_ERROR_INVALID_PARAMETER);
+ retv_if(!appid, AIL_ERROR_INVALID_PARAMETER);
+ if (!__is_authorized()) {
+ _E("You are not an authorized user on adding!\n");
+ return -1;
+ }
count = _count_all();
- if (count <= 0) {
+ if (count >= 0) {
ret = _create_table();
if (ret != AIL_ERROR_OK) {
_D("Cannot create a table. Maybe there is already a table.");
}
}
- ret = _init_desktop_info(&info, package);
- retv_if(ret != AIL_ERROR_OK, AIL_ERROR_FAIL);
+ ret = _init_desktop_info(&info, appid);
+ if(ret != AIL_ERROR_OK) {
+ goto err_check;
+ }
ret = _read_desktop_info(&info);
- retv_if(ret != AIL_ERROR_OK, AIL_ERROR_FAIL);
+ if(ret != AIL_ERROR_OK) {
+ goto err_check;
+ }
ret = _insert_desktop_info(&info);
- retv_if(ret != AIL_ERROR_OK, AIL_ERROR_FAIL);
+ if(ret != AIL_ERROR_OK) {
+ goto err_check;
+ }
- ret = _send_db_done_noti(NOTI_ADD, package);
- retv_if(ret != AIL_ERROR_OK, AIL_ERROR_FAIL);
+ ret = _send_db_done_noti(NOTI_ADD, appid);
+ if(ret != AIL_ERROR_OK) {
+ goto err_check;
+ }
+err_check:
_fini_desktop_info(&info);
+ retv_if(ret != AIL_ERROR_OK, AIL_ERROR_FAIL);
return AIL_ERROR_OK;
}
-EXPORT_API ail_error_e ail_desktop_update(const char *package)
+EXPORT_API ail_error_e ail_desktop_update(const char *appid)
{
desktop_info_s info = {0,};
- ail_error_e ret;
+ ail_error_e ret = AIL_ERROR_OK;
- retv_if(!package, AIL_ERROR_INVALID_PARAMETER);
+ retv_if(!appid, AIL_ERROR_INVALID_PARAMETER);
+ if (!__is_authorized()) {
+ _E("You are not an authorized user on updating!\n");
+ return -1;
+ }
- ret = _init_desktop_info(&info, package);
- retv_if(ret != AIL_ERROR_OK, AIL_ERROR_FAIL);
+ ret = _init_desktop_info(&info, appid);
+ if(ret != AIL_ERROR_OK) {
+ goto err_check;
+ }
ret = _read_desktop_info(&info);
- retv_if(ret != AIL_ERROR_OK, AIL_ERROR_FAIL);
+ if(ret != AIL_ERROR_OK) {
+ goto err_check;
+ }
ret = _update_desktop_info(&info);
- retv_if(ret != AIL_ERROR_OK, AIL_ERROR_FAIL);
+ if(ret != AIL_ERROR_OK) {
+ goto err_check;
+ }
- ret = _send_db_done_noti(NOTI_UPDATE, package);
- retv_if(ret != AIL_ERROR_OK, AIL_ERROR_FAIL);
+ ret = _send_db_done_noti(NOTI_UPDATE, appid);
+ if(ret != AIL_ERROR_OK) {
+ goto err_check;
+ }
+err_check:
_fini_desktop_info(&info);
+ retv_if(ret != AIL_ERROR_OK, AIL_ERROR_FAIL);
return AIL_ERROR_OK;
}
-EXPORT_API ail_error_e ail_desktop_remove(const char *package)
+EXPORT_API ail_error_e ail_desktop_remove(const char *appid)
{
ail_error_e ret;
- retv_if(!package, AIL_ERROR_INVALID_PARAMETER);
+ retv_if(!appid, AIL_ERROR_INVALID_PARAMETER);
+ if (!__is_authorized()) {
+ _E("You are not an authorized user on removing!\n");
+ return -1;
+ }
- ret = _remove_package(package);
+ ret = _remove_package(appid);
retv_if(ret != AIL_ERROR_OK, AIL_ERROR_FAIL);
- ret = _send_db_done_noti(NOTI_REMOVE, package);
+ ret = _send_db_done_noti(NOTI_REMOVE, appid);
retv_if(ret != AIL_ERROR_OK, AIL_ERROR_FAIL);
return AIL_ERROR_OK;
}
+EXPORT_API ail_error_e ail_desktop_clean(const char *pkgid)
+{
+ ail_error_e ret;
+
+ retv_if(!pkgid, AIL_ERROR_INVALID_PARAMETER);
+ if (!__is_authorized()) {
+ _E("You are not an authorized user on removing!\n");
+ return -1;
+ }
+
+ _D("ail_desktop_clean=%s",pkgid);
+
+ ret = _clean_pkgid_data(pkgid);
+ retv_if(ret != AIL_ERROR_OK, AIL_ERROR_FAIL);
+
+ return AIL_ERROR_OK;
+}
+
+
+EXPORT_API ail_error_e ail_desktop_fota(const char *appid)
+{
+ desktop_info_s info = {0,};
+ ail_error_e ret;
+ int count;
+
+ retv_if(!appid, AIL_ERROR_INVALID_PARAMETER);
+ if (!__is_authorized()) {
+ _E("You are not an authorized user on adding!\n");
+ return -1;
+ }
+
+ count = _count_all();
+ if (count <= 0) {
+ ret = _create_table();
+ if (ret != AIL_ERROR_OK) {
+ _D("Cannot create a table. Maybe there is already a table.");
+ }
+ }
+
+ ret = _init_desktop_info(&info, appid);
+ if(ret != AIL_ERROR_OK) {
+ goto err_check;
+ }
+
+ ret = _read_desktop_info(&info);
+ if(ret != AIL_ERROR_OK) {
+ goto err_check;
+ }
+
+ ret = _insert_desktop_info(&info);
+ if(ret != AIL_ERROR_OK) {
+ goto err_check;
+ }
+
+err_check:
+ _fini_desktop_info(&info);
+ retv_if(ret != AIL_ERROR_OK, AIL_ERROR_FAIL);
+
+ return AIL_ERROR_OK;
+}
-EXPORT_API ail_error_e ail_desktop_appinfo_modify_bool(const char *package,
+EXPORT_API ail_error_e ail_desktop_appinfo_modify_bool(const char *appid,
const char *property,
- bool value)
+ bool value,
+ bool broadcast)
{
desktop_info_s info = {0,};
ail_error_e ret;
- ail_prop_bool_e prop;
- retv_if(!package, AIL_ERROR_INVALID_PARAMETER);
+ retv_if(!appid, AIL_ERROR_INVALID_PARAMETER);
- retv_if(strcmp(property, AIL_PROP_X_SLP_INACTIVATED_BOOL),
+ retv_if(strcmp(property, AIL_PROP_X_SLP_ENABLED_BOOL),
AIL_ERROR_INVALID_PARAMETER);
- ret = _init_desktop_info(&info, package);
- retv_if(ret != AIL_ERROR_OK, AIL_ERROR_FAIL);
+ ret = _init_desktop_info(&info, appid);
+ if(ret != AIL_ERROR_OK) {
+ goto err_check;
+ }
+
+ ret = _load_desktop_info(&info);
+ if(ret != AIL_ERROR_OK) {
+ goto err_check;
+ }
ret = _modify_desktop_info_bool(&info, property, value);
- retv_if(ret != AIL_ERROR_OK, AIL_ERROR_FAIL);
+ if(ret != AIL_ERROR_OK) {
+ goto err_check;
+ }
ret = _update_desktop_info(&info);
- retv_if(ret != AIL_ERROR_OK, AIL_ERROR_FAIL);
+ if(ret != AIL_ERROR_OK) {
+ goto err_check;
+ }
- ret = _send_db_done_noti(NOTI_UPDATE, package);
- retv_if(ret != AIL_ERROR_OK, AIL_ERROR_FAIL);
+ if (broadcast) {
+ ret = _send_db_done_noti(NOTI_UPDATE, appid);
+ if(ret != AIL_ERROR_OK) {
+ goto err_check;
+ }
+ }
+err_check:
_fini_desktop_info(&info);
+ retv_if(ret != AIL_ERROR_OK, AIL_ERROR_FAIL);
return AIL_ERROR_OK;
}
+EXPORT_API ail_error_e ail_desktop_appinfo_modify_str(const char *appid,
+ const char *property,
+ const char *value,
+ bool broadcast)
+{
+ retv_if(!appid, AIL_ERROR_INVALID_PARAMETER);
+
+ ail_error_e ret = 0;
+ sqlite3_stmt *stmt = NULL;
+ sqlite3 *appinfo_db = NULL;
+
+ _D("appinfo_modify_str : %s, %s", appid, value);
+
+ ret = db_util_open(PKGMGR_PARSER_DB, &appinfo_db, 0);
+ retv_if(ret != AIL_ERROR_OK, AIL_ERROR_DB_FAILED);
+ char *query = sqlite3_mprintf("delete from package_app_app_control where app_id=%Q", appid);
+ ret = sqlite3_exec(appinfo_db, query, NULL, NULL, NULL);
+ sqlite3_free(query);
+
+ query = sqlite3_mprintf("insert into package_app_app_control(app_id, app_control) values('%s', '%s')", appid, value);
+ ret = sqlite3_exec(appinfo_db, query, NULL, NULL, NULL);
+ sqlite3_free(query);
+ retv_if(ret != AIL_ERROR_OK, AIL_ERROR_DB_FAILED);
+
+ sqlite3_close(appinfo_db);
+
+ return AIL_ERROR_OK;
+}
// End of File
diff --git a/src/ail_filter.c b/src/ail_filter.c
index 2451996..da593b8 100755
--- a/src/ail_filter.c
+++ b/src/ail_filter.c
@@ -25,6 +25,7 @@
#include <glib.h>
#include <string.h>
#include <stdio.h>
+#include <ctype.h>
#include "ail.h"
#include "ail_private.h"
#include "ail_convert.h"
@@ -86,6 +87,7 @@ EXPORT_API ail_error_e ail_filter_destroy(ail_filter_h filter)
}
free(filter);
+ db_close();
return AIL_ERROR_OK;
}
@@ -173,23 +175,32 @@ EXPORT_API ail_error_e ail_filter_add_str(ail_filter_h filter, const char *prope
static void _get_condition(gpointer data, char **condition)
{
struct element *e = (struct element *)data;
- const char *f;
- char buf[AIL_SQL_QUERY_MAX_LEN];
+ const char *f = NULL;
+ char buf[AIL_SQL_QUERY_MAX_LEN] = {0};
+ char *b_value = NULL;
+ int t = 0;
f = sql_get_filter(e->prop);
- int t;
+ if (!f)
+ return;
+
ELEMENT_TYPE(e, t);
switch (t) {
case VAL_TYPE_BOOL:
- snprintf(buf, sizeof(buf), f, ELEMENT_BOOL(e)->value);
+ if(ELEMENT_BOOL(e)->value)
+ b_value = strdup("true");
+ else
+ b_value = strdup("false");
+
+ snprintf(buf, sizeof(buf), f, b_value);
break;
case VAL_TYPE_INT:
snprintf(buf, sizeof(buf), f, ELEMENT_INT(e)->value);
break;
case VAL_TYPE_STR:
if (E_AIL_PROP_NAME_STR == e->prop) {
- snprintf(buf, sizeof(buf), f, ELEMENT_STR(e)->value, ELEMENT_STR(e)->value);
+ snprintf(buf, sizeof(buf), f, ELEMENT_STR(e)->value);
} else {
snprintf(buf, sizeof(buf), f, ELEMENT_STR(e)->value);
}
@@ -199,6 +210,8 @@ static void _get_condition(gpointer data, char **condition)
*condition = NULL;
return;
}
+ if(b_value)
+ free(b_value);
*condition = strdup(buf);
@@ -207,12 +220,12 @@ static void _get_condition(gpointer data, char **condition)
char *_get_where_clause(ail_filter_h filter)
{
- char *c;
+ char *c = NULL;
char w[AIL_SQL_QUERY_MAX_LEN] = {0,};
c = NULL;
GSList *l;
-
+
snprintf(w, AIL_SQL_QUERY_MAX_LEN, " WHERE ");
for (l = filter->list; l; l = g_slist_next(l)) {
@@ -225,7 +238,10 @@ char *_get_where_clause(ail_filter_h filter)
strncat(w, c, sizeof(w)-strlen(w)-1);
w[sizeof(w)-1] = '\0';
- if(c) free(c);
+ if (c) {
+ free(c);
+ c = NULL;
+ }
if (g_slist_next(l)) {
strncat(w, " and ", sizeof(w)-strlen(w)-1);
@@ -233,27 +249,26 @@ char *_get_where_clause(ail_filter_h filter)
}
}
- _D("where = %s", w);
-
return strdup(w);
}
EXPORT_API ail_error_e ail_filter_count_appinfo(ail_filter_h filter, int *cnt)
{
- char q[AIL_SQL_QUERY_MAX_LEN];
- char *w;
- char *tmp_q;
- char *l;
- int r;
- int n;
- sqlite3_stmt *stmt;
+ char q[AIL_SQL_QUERY_MAX_LEN] = {0};
+ char *w = NULL;
+ char *tmp_q = NULL;
+ char *l = NULL;
+ sqlite3_stmt *stmt = NULL;
+ ail_appinfo_h ai = NULL;
+ int filter_count = 0;
+ char *locale = NULL;
retv_if(!cnt, AIL_ERROR_INVALID_PARAMETER);
- if (db_open(DB_OPEN_RO) != AIL_ERROR_OK)
+ if (db_open_pkg_mgr(DB_OPEN_RO) != AIL_ERROR_OK)
return AIL_ERROR_DB_FAILED;
- snprintf(q, sizeof(q), "SELECT COUNT (*) FROM %s", SQL_TBL_APP_INFO_WITH_LOCALNAME);
+ snprintf(q, sizeof(q), "SELECT * FROM (SELECT %s FROM %s)", SQL_FLD_PKG_APP_INFO_FILTER, SQL_TBL_APP_INFO_FILTER);
tmp_q = strdup(q);
retv_if (NULL == tmp_q, AIL_ERROR_OUT_OF_MEMORY);
@@ -263,53 +278,79 @@ EXPORT_API ail_error_e ail_filter_count_appinfo(ail_filter_h filter, int *cnt)
free(tmp_q);
return AIL_ERROR_FAIL;
}
- snprintf(q, sizeof(q), tmp_q, l);
+ locale = (char*) calloc(strlen(l)+1,1);
+ if(locale == NULL) {
+ free(tmp_q);
+ free(l);
+ return AIL_ERROR_OUT_OF_MEMORY;
+ }
+ strncpy(locale ,l, 2);
+ strncat(locale,"-",1);
+ locale[3] = tolower(l[3]);
+ locale[4] = tolower(l[4]);
free(l);
+
+ snprintf(q, sizeof(q), tmp_q, locale);
+ free(locale);
free(tmp_q);
- if (filter && filter->list) {
+ if (filter && filter->list) {
w = _get_where_clause(filter);
retv_if (NULL == w, AIL_ERROR_FAIL);
+
strncat(q, w, sizeof(q)-strlen(q)-1);
q[sizeof(q)-1] = '\0';
free(w);
}
-
- _D("Query = %s",q);
+ else
+ _D("No filter exists. All records are retreived");
if (db_prepare(q, &stmt) != AIL_ERROR_OK) {
+ _E("db_prepare fail for query = %s",q);
return AIL_ERROR_DB_FAILED;
}
- r = db_step(stmt);
- if (r == AIL_ERROR_OK) {
- db_column_int(stmt, 0, &n);
- *cnt = n;
+ ai = appinfo_create();
+ if (ai == NULL) {
+ _E("failed to create appinfo");
+ db_finalize(stmt);
+ return AIL_ERROR_OUT_OF_MEMORY;
}
- db_finalize(stmt);
+ appinfo_set_stmt(ai, stmt);
- return r;
-}
+ while (db_step(stmt) == AIL_ERROR_OK) {
+ if(_appinfo_check_installed_storage(ai) != AIL_ERROR_OK)
+ continue;
+
+ filter_count++;
+ }
+ db_finalize(stmt);
+ appinfo_destroy(ai);
+ *cnt = filter_count;
+
+ return AIL_ERROR_OK;
+}
EXPORT_API ail_error_e ail_filter_list_appinfo_foreach(ail_filter_h filter, ail_list_appinfo_cb cb, void *user_data)
{
- char q[AIL_SQL_QUERY_MAX_LEN];
- char *tmp_q;
- char *w;
- char *l;
+ char q[AIL_SQL_QUERY_MAX_LEN] = {0};
+ char *tmp_q = NULL;
+ char *w = NULL;
+ char *l = NULL;
ail_cb_ret_e r;
- sqlite3_stmt *stmt;
- ail_appinfo_h ai;
+ sqlite3_stmt *stmt = NULL;
+ ail_appinfo_h ai = NULL;
+ char *locale = NULL;
retv_if (NULL == cb, AIL_ERROR_INVALID_PARAMETER);
- if (db_open(DB_OPEN_RO) != AIL_ERROR_OK)
+ if (db_open_pkg_mgr(DB_OPEN_RO) != AIL_ERROR_OK)
return AIL_ERROR_DB_FAILED;
- snprintf(q, sizeof(q), "SELECT %s FROM %s", SQL_FLD_APP_INFO_WITH_LOCALNAME, SQL_TBL_APP_INFO_WITH_LOCALNAME);
+ snprintf(q, sizeof(q), "SELECT * FROM (SELECT %s FROM %s)", SQL_FLD_PKG_APP_INFO_FILTER, SQL_TBL_APP_INFO_FILTER);
tmp_q = strdup(q);
retv_if (NULL == tmp_q, AIL_ERROR_OUT_OF_MEMORY);
@@ -319,8 +360,21 @@ EXPORT_API ail_error_e ail_filter_list_appinfo_foreach(ail_filter_h filter, ail_
free(tmp_q);
return AIL_ERROR_FAIL;
}
- snprintf(q, sizeof(q), tmp_q, l);
+
+ locale = (char*) calloc(strlen(l)+1,1);
+ if(locale == NULL) {
+ free(tmp_q);
+ free(l);
+ return AIL_ERROR_OUT_OF_MEMORY;
+ }
+ strncpy(locale ,l, 2);
+ strncat(locale,"-",1);
+ locale[3] = tolower(l[3]);
+ locale[4] = tolower(l[4]);
free(l);
+
+ snprintf(q, sizeof(q), tmp_q, locale);
+ free(locale);
free(tmp_q);
if (filter && filter->list) {
@@ -328,32 +382,30 @@ EXPORT_API ail_error_e ail_filter_list_appinfo_foreach(ail_filter_h filter, ail_
retv_if (NULL == w, AIL_ERROR_FAIL);
strncat(q, w, sizeof(q)-strlen(q)-1);
q[sizeof(q)-1] = '\0';
- strncat(q, " order by app_info.package", sizeof(q)-strlen(q)-1);
- q[sizeof(q)-1] = '\0';
free(w);
}
else
_D("No filter exists. All records are retreived");
- _D("Query = %s",q);
-
if (db_prepare(q, &stmt) != AIL_ERROR_OK) {
+ _E("db_prepare fail for query = %s",q);
return AIL_ERROR_DB_FAILED;
}
ai = appinfo_create();
+ if (ai == NULL)
+ return AIL_ERROR_OUT_OF_MEMORY;
appinfo_set_stmt(ai, stmt);
while (db_step(stmt) == AIL_ERROR_OK) {
+ if(_appinfo_check_installed_storage(ai) != AIL_ERROR_OK)
+ continue;
r = cb(ai, user_data);
if (AIL_CB_RET_CANCEL == r)
break;
}
- appinfo_destroy(ai);
-
db_finalize(stmt);
-
+ appinfo_destroy(ai);
return AIL_ERROR_OK;
}
-
diff --git a/src/ail_package.c b/src/ail_package.c
index bcdc912..5f86276 100755
--- a/src/ail_package.c
+++ b/src/ail_package.c
@@ -23,6 +23,7 @@
#include <string.h>
#include <stdlib.h>
+#include <ctype.h>
#include <db-util.h>
#include <vconf.h>
#include "ail.h"
@@ -31,41 +32,305 @@
#include "ail_db.h"
#include "ail_sql.h"
#include "ail_package.h"
+#include <assert.h>
+#include <unistd.h>
+#define LANGUAGE_LENGTH 2
+#define DEFAULT_LOCALE "No Locale"
+#define MAX_QUERY_LEN 4096
+#define PKG_SD_PATH "/opt/storage/sdcard/app2sd/"
+#define QUERY_GET_LOCALNAME "select name from localname where package='%s' and locale='%s'"
+#define MAX_SIZE 80000
struct ail_appinfo {
char **values;
sqlite3_stmt *stmt;
};
-void appinfo_set_stmt(ail_appinfo_h ai, sqlite3_stmt *stmt)
+typedef struct _pkgmgr_locale_x {
+ char *locale;
+} pkgmgr_locale_x;
+
+static char * __get_package(const char *appid);
+
+char* _get_icon_from_package_localized_info(const char *appid)
{
- ai->stmt = stmt;
+ if (db_open_pkg_mgr(DB_OPEN_RO) < 0) {
+ _E("pkg_mgr_db_open fail [%s]",appid);
+ return NULL;
+ }
+ sqlite3_stmt *stmt = NULL;
+ char *str = NULL;
+ char *icon = NULL;
+ char *package = NULL;
+ package = __get_package(appid);
+
+ char *query = sqlite3_mprintf("select package_localized_info.package_icon from package_localized_info where package_localized_info.package=%Q and package_localized_info.package_locale='No Locale'", package);
+ if (NULL == query){
+ _E("Memory allocation failed");
+ free(package);
+ return NULL;
+ }
+ free(package);
+
+ retv_if (db_prepare(query, &stmt) < 0, NULL);
+
+ do {
+ if (db_step(stmt) < 0){
+ goto end;
+ }
+ if (db_column_str(stmt, 0, &str) < 0)
+ goto end;
+ if (str)
+ icon = strdup(str);
+ else
+ icon = NULL;
+
+
+ } while(0);
+
+end:
+ db_finalize(stmt);
+ sqlite3_free(query);
+ return icon;
+
}
-ail_appinfo_h appinfo_create(void)
+char* _get_icon_from_package_app_localized_info(const char *appid)
{
- ail_appinfo_h ai;
- ai = calloc(1, sizeof(struct ail_appinfo));
- retv_if (NULL == ai, NULL);
- ai->stmt = NULL;
+ if (db_open_pkg_mgr(DB_OPEN_RO) < 0) {
+ _E("pkg_mgr_db_open fail [%s]",appid);
+ return NULL;
+ }
+ sqlite3_stmt *stmt = NULL;
+ char *str = NULL;
+ char *icon = NULL;
+
+
+ char *query = sqlite3_mprintf("select package_app_localized_info.app_icon from package_app_localized_info where package_app_localized_info.app_id=%Q and package_app_localized_info.app_locale='No Locale'", appid);
+ if (NULL == query){
+ _E("Memory allocation failed");
+ return NULL;
+ }
+
+ retv_if (db_prepare(query, &stmt) < 0, NULL);
+
+ do {
+ if (db_step(stmt) < 0){
+ goto end;
+ }
+ if (db_column_str(stmt, 0, &str) < 0)
+ goto end;
+ if (str)
+ icon = strdup(str);
+ else
+ icon = NULL;
+
+
+ } while(0);
+
+end:
+ db_finalize(stmt);
+ sqlite3_free(query);
+ return icon;
- return ai;
}
-void appinfo_destroy(ail_appinfo_h ai)
+char* _get_mimetype_from_package_app_app_svc(const char *appid)
{
- if (ai)
- free(ai);
+
+ if (db_open_pkg_mgr(DB_OPEN_RO) < 0) {
+ _E("pkg_mgr_db_open fail [%s]",appid);
+ return NULL;
+ }
+ sqlite3_stmt *stmt = NULL;
+ int col = 0;
+ char *val = NULL;
+ char *ptr = NULL;
+ char *del = ";";
+ char tmp_mime[MAX_SIZE] = {0};
+ int len = 0;
+ char *mime = NULL;
+
+ char *query = sqlite3_mprintf("select package_app_app_svc.mime_type from package_app_app_svc where package_app_app_svc.app_id=%Q", appid);
+ if (NULL == query){
+ _E("Memory allocation failed");
+ return NULL;
+ }
+ retv_if (db_prepare(query, &stmt) < 0, NULL);
+
+ while (db_step(stmt) == AIL_ERROR_OK){
+ val = (char*)sqlite3_column_text(stmt, col);
+
+ if (!strlen(val) )
+ continue;
+
+ strcat(tmp_mime, val);
+ if(strlen(tmp_mime))
+ strcat(tmp_mime, del);
+ }
+
+ len = strlen(tmp_mime);
+ ptr = tmp_mime;
+ ptr[len -1] = '\0';
+
+ db_finalize(stmt);
+ sqlite3_free(query);
+ if(len >0){
+ mime = strdup(tmp_mime);
+ if(NULL == mime){
+ _E("Memory Allocation Failed");
+ return NULL;
+ }else{
+ return mime;
+ }
+ }else{
+ return NULL;
+ }
}
+/* get the first locale value*/
+static int __fallback_locale_cb(void *data, int ncols, char **coltxt, char **colname)
+{
+ pkgmgr_locale_x *info = (pkgmgr_locale_x *)data;
+
+ if (ncols >= 1)
+ info->locale = strdup(coltxt[0]);
+ else
+ info->locale = NULL;
-static ail_error_e _retrieve_all_column(ail_appinfo_h ai)
+ return 0;
+}
+
+static int __check_validation_of_qurey_cb(void *data, int ncols, char **coltxt, char **colname)
{
- int i, j;
- ail_error_e err;
- char *col;
+ int *p = (int*)data;
+ *p = atoi(coltxt[0]);
+ return 0;
+}
+
+static int __check_app_locale_from_app_localized_info_by_exact(const char *appid, const char *locale)
+{
+ int result_query = -1;
+
+ char *query = sqlite3_mprintf("select exists(select app_locale from package_app_localized_info where app_id=%Q and app_locale=%Q)", appid, locale);
+ if (NULL == query){
+ _E("Memory allocation failed");
+ return AIL_ERROR_OUT_OF_MEMORY;
+ }
+
+ db_exec_sqlite_query(query, __check_validation_of_qurey_cb, (void *)&result_query);
+ sqlite3_free(query);
+
+ return result_query;
+}
+
+static int __check_app_locale_from_app_localized_info_by_fallback(const char *appid, const char *locale)
+{
+ int result_query = -1;
+ char lang[3] = {'\0'};
+ strncpy(lang, locale, LANGUAGE_LENGTH);
+
+ char *query = sqlite3_mprintf("select exists(select app_locale from package_app_localized_info where app_id=%Q and app_locale like %Q%Q)", appid, lang, locale);
+ if (NULL == query){
+ _E("Memory allocation failed");
+ return AIL_ERROR_OUT_OF_MEMORY;
+ }
+
+ db_exec_sqlite_query(query, __check_validation_of_qurey_cb, (void *)&result_query);
+ sqlite3_free(query);
+
+ return result_query;
+}
+
+static char* __get_app_locale_from_app_localized_info_by_fallback(const char *appid, const char *locale)
+{
+ char wildcard[2] = {'%','\0'};
+ char lang[3] = {'\0'};
+ char *locale_new = NULL;
+ pkgmgr_locale_x *info = NULL;
+
+ info = (pkgmgr_locale_x *)malloc(sizeof(pkgmgr_locale_x));
+ if (info == NULL) {
+ _E("Out of Memory!!!\n");
+ return NULL;
+ }
+ memset(info, 0, sizeof(*info));
+
+ strncpy(lang, locale, 2);
+ char *query = sqlite3_mprintf("select app_locale from package_app_localized_info where app_id=%Q and app_locale like %Q%Q", appid, lang, wildcard);
+ if (NULL == query){
+ _E("Memory allocation failed");
+ free(info);
+ return NULL;
+ }
+ db_exec_sqlite_query(query, __fallback_locale_cb, (void *)info);
+ locale_new = info->locale;
+ free(info);
+ sqlite3_free(query);
+
+ return locale_new;
+}
+
+static char* __convert_syslocale_to_manifest_locale(char *syslocale)
+{
+ char *locale = malloc(6);
+ if (!locale) {
+ _E("Malloc Failed\n");
+ return NULL;
+ }
+
+ sprintf(locale, "%c%c-%c%c", syslocale[0], syslocale[1], tolower(syslocale[3]), tolower(syslocale[4]));
+ return locale;
+}
+
+static char* __get_app_locale_by_fallback(const char *appid, const char *syslocale)
+{
+ assert(appid);
+
+ char *locale = NULL;
+ char *locale_new = NULL;
+ int check_result = 0;
+
+ if(syslocale == NULL) {
+ return strdup(DEFAULT_LOCALE);
+ }
+
+ locale = __convert_syslocale_to_manifest_locale((char*)syslocale);
+
+ /*check exact matching */
+ check_result = __check_app_locale_from_app_localized_info_by_exact(appid, locale);
+
+ /* Exact found */
+ if (check_result == 1) {
+ _D("%s find exact locale(%s)\n", appid, locale);
+ return locale;
+ }
+
+ /* fallback matching */
+ check_result = __check_app_locale_from_app_localized_info_by_fallback(appid, locale);
+ if(check_result == 1) {
+ locale_new = __get_app_locale_from_app_localized_info_by_fallback(appid, locale);
+ _D("%s found (%s) language-locale in DB by fallback!\n", appid, locale_new);
+ free(locale);
+ if (locale_new == NULL)
+ locale_new = strdup(DEFAULT_LOCALE);
+ return locale_new;
+ }
+
+ /* default locale */
+ free(locale);
+ _D("%s DEFAULT_LOCALE)\n", appid);
+ return strdup(DEFAULT_LOCALE);
+}
+
+static ail_error_e __retrieve_all_column(ail_appinfo_h ai)
+{
+ int i = 0;
+ int j = 0;
+ ail_error_e err = AIL_ERROR_OK;
+ char *col = NULL;
retv_if(!ai, AIL_ERROR_INVALID_PARAMETER);
retv_if(!ai->stmt, AIL_ERROR_INVALID_PARAMETER);
@@ -75,11 +340,11 @@ static ail_error_e _retrieve_all_column(ail_appinfo_h ai)
for (i = 0; i < NUM_OF_PROP; i++) {
err = db_column_str(ai->stmt, i, &col);
- if (AIL_ERROR_OK != err)
+ if (AIL_ERROR_OK != err)
break;
if (!col) {
- ai->values[i] = NULL;
+ ai->values[i] = AIL_EMPTY_STR;
} else {
ai->values[i] = strdup(col);
if (!ai->values[i]) {
@@ -91,7 +356,7 @@ static ail_error_e _retrieve_all_column(ail_appinfo_h ai)
if (err < 0) {
for (j = 0; j < i; ++j) {
- if (ai->values[j])
+ if (strcmp(ai->values[j], AIL_EMPTY_STR) != 0)
free(ai->values[j]);
}
if (ai->values)
@@ -101,6 +366,67 @@ static ail_error_e _retrieve_all_column(ail_appinfo_h ai)
return AIL_ERROR_OK;
}
+int _appinfo_check_installed_storage(ail_appinfo_h ai)
+{
+ int index = 0;
+ ail_prop_str_e prop = -1;
+ char *pkgid = NULL;
+ char *installed_storage = NULL;
+ char buf[AIL_SQL_QUERY_MAX_LEN] = {'\0'};
+
+ retv_if(!ai, AIL_ERROR_OK);
+
+ if (ai->stmt) {
+ prop = _ail_convert_to_prop_str(AIL_PROP_X_SLP_INSTALLEDSTORAGE_STR);
+ index = sql_get_app_info_idx(prop);
+ if (db_column_str(ai->stmt, index, &installed_storage) < 0){
+ return AIL_ERROR_OK;
+ }
+
+ prop = _ail_convert_to_prop_str(AIL_PROP_X_SLP_PKGID_STR);
+ index = sql_get_app_info_idx(prop);
+ if (db_column_str(ai->stmt, index, &pkgid) < 0){
+ return AIL_ERROR_OK;
+ }
+ } else {
+ prop = _ail_convert_to_prop_str(AIL_PROP_X_SLP_INSTALLEDSTORAGE_STR);
+ installed_storage = ai->values[prop];
+
+ prop = _ail_convert_to_prop_str(AIL_PROP_X_SLP_PKGID_STR);
+ pkgid = ai->values[prop];
+ }
+
+ if (strcmp(installed_storage, "installed_external") == 0) {
+ snprintf(buf, AIL_SQL_QUERY_MAX_LEN - 1, "%s%s", PKG_SD_PATH, pkgid);
+ if (access(buf, R_OK) != 0) {
+ _E("can not access [%s]", buf);
+ return AIL_ERROR_FAIL;
+ }
+ }
+
+ return AIL_ERROR_OK;
+}
+
+void appinfo_set_stmt(ail_appinfo_h ai, sqlite3_stmt *stmt)
+{
+ ai->stmt = stmt;
+}
+
+ail_appinfo_h appinfo_create(void)
+{
+ ail_appinfo_h ai;
+ ai = calloc(1, sizeof(struct ail_appinfo));
+ retv_if (NULL == ai, NULL);
+ ai->stmt = NULL;
+
+ return ai;
+}
+
+void appinfo_destroy(ail_appinfo_h ai)
+{
+ if (ai)
+ free(ai);
+}
EXPORT_API ail_error_e ail_package_destroy_appinfo(ail_appinfo_h ai)
{
@@ -109,19 +435,27 @@ EXPORT_API ail_error_e ail_package_destroy_appinfo(ail_appinfo_h ai)
EXPORT_API ail_error_e ail_destroy_appinfo(ail_appinfo_h ai)
{
- int i;
+ int i = 0;
retv_if(!ai, AIL_ERROR_INVALID_PARAMETER);
retv_if(!ai->values, AIL_ERROR_INVALID_PARAMETER);
for (i = 0; i < NUM_OF_PROP; i++) {
- if (ai->values[i]) {
+ if ( ai->values[i] && strcmp(ai->values[i], AIL_EMPTY_STR) != 0){
free(ai->values[i]);
+ ai->values[i] = NULL;
}
}
+ if(ai->values[E_AIL_PROP_MIMETYPE_STR]){
+ free((void*)ai->values[E_AIL_PROP_MIMETYPE_STR]);
+ ai->values[E_AIL_PROP_MIMETYPE_STR] = NULL;
+ }
+
+ if(ai->values)
+ free(ai->values);
- free(ai->values);
free(ai);
+ db_close();
return AIL_ERROR_OK;
}
@@ -129,60 +463,181 @@ EXPORT_API ail_error_e ail_destroy_appinfo(ail_appinfo_h ai)
EXPORT_API ail_error_e ail_package_get_appinfo(const char *package, ail_appinfo_h *ai)
{
- ail_error_e ret;
- char query[AIL_SQL_QUERY_MAX_LEN];
+ return ail_get_appinfo(package, ai);
+}
+
+static char * __get_package(const char *appid)
+{
+ retv_if(!appid, NULL);
+
sqlite3_stmt *stmt = NULL;
- char w[AIL_SQL_QUERY_MAX_LEN];
+ char *str = NULL;
+ char *package = NULL;
+ char *query = NULL;
- retv_if(!package, AIL_ERROR_INVALID_PARAMETER);
+ query = sqlite3_mprintf("SELECT package_app_info.PACKAGE FROM package_app_info WHERE package_app_info.APP_ID=%Q", appid);
+ if (NULL == query){
+ _E("Memory allocation failed");
+ return NULL;
+ }
+
+ retv_if (db_prepare(query, &stmt) < 0, NULL);
+ do {
+ if (db_step(stmt) < 0)
+ goto end;
+ if (db_column_str(stmt, 0, &str) < 0)
+ goto end;
+ if (str)
+ {
+ package = strdup(str);
+ if (!package){
+ _E("Memory allocation failed");
+ return NULL;
+ }
+ }
+ else
+ package = NULL;
+
+ } while(0);
+
+end:
+ sqlite3_free(query);
+ db_finalize(stmt);
+ return package;
+
+}
+
+static ail_error_e __ail_get_appinfo_new_icon(const char *appid, ail_appinfo_h ai)
+{
+
+ char query[AIL_SQL_QUERY_MAX_LEN] = {0};
+ sqlite3_stmt *stmt = NULL;
+ char *val = NULL;
+ int ret = AIL_ERROR_OK;
+ char *package = NULL;
+ char *w = NULL;
+
+ retv_if(!appid, AIL_ERROR_INVALID_PARAMETER);
retv_if(!ai, AIL_ERROR_INVALID_PARAMETER);
+ package = __get_package(appid);
- *ai = appinfo_create();
- retv_if(!*ai, AIL_ERROR_OUT_OF_MEMORY);
- snprintf(w, sizeof(w), sql_get_filter(E_AIL_PROP_PACKAGE_STR), package);
+ w = sqlite3_mprintf("package_localized_info.PACKAGE=%Q and package_localized_info.package_locale='No Locale'", package);
+ if (NULL == w){
+ _E("Memory allocation failed");
+ free(package);
+ return AIL_ERROR_OUT_OF_MEMORY;
+ }
- snprintf(query, sizeof(query), "SELECT %s FROM %s WHERE %s",SQL_FLD_APP_INFO, SQL_TBL_APP_INFO, w);
+ free(package);
- do {
- ret = db_open(DB_OPEN_RO);
- if (ret < 0) break;
+ snprintf(query, AIL_SQL_QUERY_MAX_LEN, "SELECT %s FROM %s WHERE %s",SQL_FLD_PKG_APP_INFO_ICON, SQL_TBL_PKG_APP_INFO_ICON, w);
- ret = db_prepare(query, &stmt);
- if (ret < 0) break;
+ if (db_prepare(query, &stmt) != AIL_ERROR_OK) {
+ _E("db_prepare fail for query = %s",query);
+ ret = AIL_ERROR_DB_FAILED;
+ goto end;
+ }
+ appinfo_set_stmt(ai, stmt);
- ret = db_step(stmt);
- if (ret < 0) {
- db_finalize(stmt);
+ if(ai->values[E_AIL_PROP_ICON_STR]){
+ free((void*)ai->values[E_AIL_PROP_ICON_STR]);
+ ai->values[E_AIL_PROP_ICON_STR] = NULL;
+ }
+
+ do{
+ if (db_step(stmt) < 0)
+ break;
+ if (db_column_str(stmt, 0, &val) < 0)
break;
+ if (strcmp(val, "(NULL)")){
+ ai->values[E_AIL_PROP_ICON_STR] = strdup(val);
+ if (!ai->values[E_AIL_PROP_ICON_STR]){
+ _E("Memory allocation failed");
+ return AIL_ERROR_OUT_OF_MEMORY;
+ }
+ }
+ else{
+ ai->values[E_AIL_PROP_ICON_STR] = strdup(AIL_EMPTY_STR);
}
+ }while(0);
- (*ai)->stmt = stmt;
+ if (db_finalize(ai->stmt) != AIL_ERROR_OK){
+ ret = AIL_ERROR_DB_FAILED;
+ goto end;
+ }
+end:
+ (ai)->stmt = NULL;
+ sqlite3_free(w);
+ return ret;
+}
- ret = _retrieve_all_column(*ai);
- if (ret < 0) {
- db_finalize((*ai)->stmt);
- break;
- }
+static ail_error_e __ail_get_appinfo_new_mimetype(const char *appid, ail_appinfo_h ai)
+{
+ char query[AIL_SQL_QUERY_MAX_LEN] = {0};
+ sqlite3_stmt *stmt = NULL;
+ int col = 0;
+ char *val = NULL;
+ char *del = ";" ;
+ int ret = AIL_ERROR_OK;
- ret = db_finalize((*ai)->stmt);
- if (ret < 0) break;
- (*ai)->stmt = NULL;
+ retv_if(!appid, AIL_ERROR_INVALID_PARAMETER);
+ retv_if(!ai, AIL_ERROR_INVALID_PARAMETER);
- return AIL_ERROR_OK;
- } while(0);
+ char *w = sqlite3_mprintf("package_app_app_svc.APP_ID=%Q", appid);
+ if (NULL == w){
+ _E("Memory allocation failed");
+ return AIL_ERROR_OUT_OF_MEMORY;
+ }
- appinfo_destroy(*ai);
+ snprintf(query, AIL_SQL_QUERY_MAX_LEN, "SELECT %s FROM %s WHERE %s",SQL_FLD_PKG_APP_INFO_MIME, SQL_TBL_PKG_APP_INFO_SVC, w);
+ if (db_prepare(query, &stmt) != AIL_ERROR_OK) {
+ _E("db_prepare fail for query = %s",query);
+ ret = AIL_ERROR_DB_FAILED;
+ goto end;
+ }
+
+ appinfo_set_stmt(ai, stmt);
+ if(ai->values[E_AIL_PROP_MIMETYPE_STR]){
+ free((void*)ai->values[E_AIL_PROP_MIMETYPE_STR]);
+ ai->values[E_AIL_PROP_MIMETYPE_STR] = NULL;
+ }
+ ai->values[E_AIL_PROP_MIMETYPE_STR] = (char*) calloc(MAX_SIZE,1);
+ if (NULL == ai->values[E_AIL_PROP_MIMETYPE_STR]){
+ _E("Memory allocation failed");
+ ret = AIL_ERROR_OUT_OF_MEMORY;
+ goto end;
+ }
+
+ while (db_step(stmt) == AIL_ERROR_OK){
+ val = (char*)sqlite3_column_text(stmt, col);
+
+ if (!strlen(val) )
+ continue;
+
+ strcat(ai->values[E_AIL_PROP_MIMETYPE_STR], val);
+ if(strlen(ai->values[E_AIL_PROP_MIMETYPE_STR]))
+ strcat(ai->values[E_AIL_PROP_MIMETYPE_STR], del);
+ }
+
+ if (db_finalize(ai->stmt) != AIL_ERROR_OK){
+ ret = AIL_ERROR_DB_FAILED;
+ goto end;
+ }
+
+end:
+ (ai)->stmt = NULL;
+ sqlite3_free(w);
return ret;
}
EXPORT_API ail_error_e ail_get_appinfo(const char *appid, ail_appinfo_h *ai)
{
- ail_error_e ret;
- char query[AIL_SQL_QUERY_MAX_LEN];
+ ail_error_e ret = AIL_ERROR_OK;
+ char query[AIL_SQL_QUERY_MAX_LEN] = {0};
sqlite3_stmt *stmt = NULL;
- char w[AIL_SQL_QUERY_MAX_LEN];
+ char *w = NULL;
retv_if(!appid, AIL_ERROR_INVALID_PARAMETER);
retv_if(!ai, AIL_ERROR_INVALID_PARAMETER);
@@ -190,12 +645,18 @@ EXPORT_API ail_error_e ail_get_appinfo(const char *appid, ail_appinfo_h *ai)
*ai = appinfo_create();
retv_if(!*ai, AIL_ERROR_OUT_OF_MEMORY);
- snprintf(w, sizeof(w), sql_get_filter(E_AIL_PROP_X_SLP_APPID_STR), appid);
+ w = sqlite3_mprintf("PACKAGE=%Q", appid);
+ if (NULL == w){
+ _E("Memory allocation failed");
+ if (*ai)
+ appinfo_destroy(*ai);
+ return AIL_ERROR_OUT_OF_MEMORY;
+ }
- snprintf(query, sizeof(query), "SELECT %s FROM %s WHERE %s",SQL_FLD_APP_INFO, SQL_TBL_APP_INFO, w);
+ snprintf(query, AIL_SQL_QUERY_MAX_LEN, "SELECT * FROM (SELECT %s FROM %s) WHERE %s", SQL_FLD_PKG_APP_INFO_FILTER, SQL_TBL_APP_INFO_PKG, w);
do {
- ret = db_open(DB_OPEN_RO);
+ ret = db_open_pkg_mgr(DB_OPEN_RO);
if (ret < 0) break;
ret = db_prepare(query, &stmt);
@@ -209,7 +670,13 @@ EXPORT_API ail_error_e ail_get_appinfo(const char *appid, ail_appinfo_h *ai)
(*ai)->stmt = stmt;
- ret = _retrieve_all_column(*ai);
+ ret = _appinfo_check_installed_storage(*ai);
+ if (ret < 0) {
+ db_finalize((*ai)->stmt);
+ break;
+ }
+
+ ret = __retrieve_all_column(*ai);
if (ret < 0) {
db_finalize((*ai)->stmt);
break;
@@ -219,19 +686,37 @@ EXPORT_API ail_error_e ail_get_appinfo(const char *appid, ail_appinfo_h *ai)
if (ret < 0) break;
(*ai)->stmt = NULL;
- return AIL_ERROR_OK;
+ ret = AIL_ERROR_OK;
+ break;
} while(0);
- appinfo_destroy(*ai);
+ sqlite3_free(w);
+ if(ret != AIL_ERROR_OK){
+ appinfo_destroy(*ai);
+ }else{
+ if (!(strcmp((*ai)->values[E_AIL_PROP_ICON_STR], "(NULL)"))){
+ ret = __ail_get_appinfo_new_icon(appid, *ai);
+ if (ret != AIL_ERROR_OK) {
+ _E("icon not retrieved");
+ appinfo_destroy(*ai);
+ return ret;
+ }
+ }
+
+ ret = __ail_get_appinfo_new_mimetype(appid, *ai);
+ if (ret != AIL_ERROR_OK) {
+ _E("Mimetype not retrieved");
+ appinfo_destroy(*ai);
+ }
+ }
return ret;
}
-
EXPORT_API ail_error_e ail_appinfo_get_bool(const ail_appinfo_h ai, const char *property, bool *value)
{
- ail_prop_bool_e prop;
- int val;
+ ail_prop_bool_e prop = 0;
+ int index = 0;
retv_if(!ai, AIL_ERROR_INVALID_PARAMETER);
retv_if(!property, AIL_ERROR_INVALID_PARAMETER);
@@ -241,15 +726,16 @@ EXPORT_API ail_error_e ail_appinfo_get_bool(const ail_appinfo_h ai, const char *
if (prop < E_AIL_PROP_BOOL_MIN || prop > E_AIL_PROP_BOOL_MAX)
return AIL_ERROR_INVALID_PARAMETER;
-
+
if (ai->stmt) {
- int index;
index = sql_get_app_info_idx(prop);
if (db_column_bool(ai->stmt, index, value) < 0)
return AIL_ERROR_DB_FAILED;
} else {
- val = atoi(ai->values[prop]);
- *value = (val == 0? false : true);
+ if (strncmp(ai->values[prop], "true", strlen("true")) == 0 || strncmp(ai->values[prop], "True", strlen("True")) == 0 || strncmp(ai->values[prop], "TRUE", strlen("TRUE")) == 0)
+ *value = true;
+ else
+ *value = false;
}
return AIL_ERROR_OK;
}
@@ -258,7 +744,8 @@ EXPORT_API ail_error_e ail_appinfo_get_bool(const ail_appinfo_h ai, const char *
EXPORT_API ail_error_e ail_appinfo_get_int(const ail_appinfo_h ai, const char *property, int *value)
{
- ail_prop_int_e prop;
+ ail_prop_int_e prop = 0;
+ int index = 0;
retv_if(!ai, AIL_ERROR_INVALID_PARAMETER);
retv_if(!property, AIL_ERROR_INVALID_PARAMETER);
@@ -270,58 +757,91 @@ EXPORT_API ail_error_e ail_appinfo_get_int(const ail_appinfo_h ai, const char *p
return AIL_ERROR_INVALID_PARAMETER;
if (ai->stmt) {
- int index;
index = sql_get_app_info_idx(prop);
- if (db_column_int(ai->stmt, index, value) < 0)
+ if (db_column_int(ai->stmt, index, value) < 0){
return AIL_ERROR_DB_FAILED;
- } else
+ }
+ } else{
*value = atoi(ai->values[prop]);
+ }
return AIL_ERROR_OK;
}
-#define QUERY_GET_LOCALNAME "select name from localname where package='%s' and locale='%s'"
-
char *appinfo_get_localname(const char *package, char *locale)
{
- db_open(DB_OPEN_RO);
- sqlite3_stmt *stmt;
+ if (db_open_pkg_mgr(DB_OPEN_RO) < 0) {
+ _E("db_open fail %s",package);
+ return NULL;
+ }
+ sqlite3_stmt *stmt = NULL;
char *str = NULL;
- char *localname;
- char query[512];
-
- snprintf(query, sizeof(query), QUERY_GET_LOCALNAME, package, locale);
+ char *localname = NULL;
+ char del;
+
+ if(locale == NULL)
+ {
+ locale = strdup("No Locale");
+ if(locale == NULL)
+ {
+ _E("Malloc failed!!");
+ return NULL;
+ }
+ }
+
+ /*
+ Change locale format if it is not correct.
+ Example change 'ko_KR' to 'ko-kr'.
+ */
+ if(strncmp(locale,"No Locale",strlen("No Locale")))
+ {
+ del = locale[2];
+ if(del == '_')
+ {
+ locale[2] = '-';
+ locale[3] = tolower(locale[3]);
+ locale[4] = tolower(locale[4]);
+ }
+ }
+
+ char *query = sqlite3_mprintf("select app_label from package_app_localized_info where app_id=%Q and app_locale=%Q", package, locale);
+ if (NULL == query){
+ _E("Memory allocation failed");
+ return NULL;
+ }
- _D("Query = %s",query);
retv_if (db_prepare(query, &stmt) < 0, NULL);
do {
- if (db_step(stmt) < 0)
- break;
+ if (db_step(stmt) < 0){
+ goto end;
+ }
if (db_column_str(stmt, 0, &str) < 0)
- break;
+ goto end;
if (str)
localname = strdup(str);
else
localname = NULL;
- db_finalize(stmt);
- return localname;
} while(0);
+end:
db_finalize(stmt);
- return NULL;
+ sqlite3_free(query);
+ return localname;
}
-
EXPORT_API ail_error_e ail_appinfo_get_str(const ail_appinfo_h ai, const char *property, char **str)
{
- int index;
- char *value;
- char *pkg;
- char *locale, *localname;
- ail_prop_str_e prop;
+ int index = 0;
+ char *value = NULL;
+ char *pkg = NULL;
+ char *pkg_type = NULL;
+ char *locale = NULL;
+ char *localname = NULL;
+ ail_prop_str_e prop = 0;
+ char *locale_new = NULL;
retv_if(!ai, AIL_ERROR_INVALID_PARAMETER);
retv_if(!property, AIL_ERROR_INVALID_PARAMETER);
@@ -332,46 +852,160 @@ EXPORT_API ail_error_e ail_appinfo_get_str(const ail_appinfo_h ai, const char *p
if (prop < E_AIL_PROP_STR_MIN || prop > E_AIL_PROP_STR_MAX)
return AIL_ERROR_INVALID_PARAMETER;
- localname = NULL;
- if (E_AIL_PROP_NAME_STR == prop) {
- if (ai->stmt) {
- if (db_column_str(ai->stmt, SQL_LOCALNAME_IDX, &localname) < 0)
- return AIL_ERROR_DB_FAILED;
- } else {
- pkg = ai->values[E_AIL_PROP_PACKAGE_STR];
+ switch(prop){
+ case E_AIL_PROP_NAME_STR:
+ if(ai->stmt){
+ if (db_column_str(ai->stmt, E_AIL_PROP_X_SLP_PACKAGETYPE_STR, &pkg_type) < 0)
+ return AIL_ERROR_DB_FAILED;
+ if(pkg_type && (strcasecmp(pkg_type, "tpk") ==0))
+ {
+ locale = sql_get_locale();
+ retv_if (NULL == locale, AIL_ERROR_FAIL);
+
+ if (db_column_str(ai->stmt, E_AIL_PROP_PACKAGE_STR, &pkg) < 0){
+ free(locale);
+ return AIL_ERROR_DB_FAILED;
+ }
+ if (pkg == NULL){
+ free(locale);
+ return AIL_ERROR_DB_FAILED;
+ }
+ locale_new = __get_app_locale_by_fallback(pkg, locale);
+ localname = (char *)appinfo_get_localname(pkg,locale_new);
+ free(locale);
+ free(locale_new);
+ } else {
+ if (db_column_str(ai->stmt, E_AIL_PROP_NAME_STR, &localname) < 0)
+ return AIL_ERROR_DB_FAILED;
+ if(!localname){
+ if (db_column_str(ai->stmt, E_AIL_PROP_PACKAGE_STR, &pkg) < 0){
+ return AIL_ERROR_DB_FAILED;
+ }
+ if (pkg == NULL){
+ return AIL_ERROR_DB_FAILED;
+ }
+ locale_new = strdup(DEFAULT_LOCALE);
+ if(locale_new == NULL){
+ _E("STRDUP: OUT OF MEMORY");
+ return AIL_ERROR_OUT_OF_MEMORY;
+ }
+ localname = (char*)appinfo_get_localname(pkg,locale_new);
+ free(locale_new);
+ }
+ }
+ }else{
+ pkg_type = ai->values[E_AIL_PROP_X_SLP_PACKAGETYPE_STR];
+ pkg = ai->values[E_AIL_PROP_PACKAGE_STR];
+ retv_if (NULL == pkg, AIL_ERROR_FAIL);
+
+ locale = sql_get_locale();
+ retv_if (NULL == locale, AIL_ERROR_FAIL);
+
+ if(pkg_type && (strcasecmp(pkg_type, "tpk") ==0))
+ {
+ locale_new = __get_app_locale_by_fallback(pkg, locale);
+ localname = (char *)appinfo_get_localname(pkg,locale_new);
+ free(locale);
+ free(locale_new);
+ } else {
+ localname = (char *)appinfo_get_localname(pkg,locale);
+ free(locale);
+ if(!localname){
+ localname = (char*) appinfo_get_localname(pkg,DEFAULT_LOCALE);
+ }
+ }
- retv_if (NULL == pkg, AIL_ERROR_FAIL);
- locale = sql_get_locale();
- retv_if (NULL == locale, AIL_ERROR_FAIL);
- localname = (char *)appinfo_get_localname(pkg,locale);
- free(locale);
- }
+ }
- if (localname) {
- if (!ai->stmt) {
- if (ai->values) {
- if (ai->values[prop])
- free(ai->values[prop]);
- ai->values[prop] = localname;
+ if (localname) {
+ if (!ai->stmt) {
+ if (ai->values) {
+ if (strcmp(ai->values[prop], AIL_EMPTY_STR) != 0)
+ free(ai->values[prop]);
+ ai->values[prop] = localname;
+ }
}
+ *str = localname;
+ return AIL_ERROR_OK;
}
- *str = localname;
- return AIL_ERROR_OK;
- }
- }
- if (ai->stmt) {
- index = sql_get_app_info_idx(prop);
- if (db_column_str(ai->stmt, index, &value) < 0){
- return AIL_ERROR_DB_FAILED;
+ break;
+
+ case E_AIL_PROP_ICON_STR:
+ if(ai->stmt){
+ index = sql_get_app_info_idx(prop);
+ if (db_column_str(ai->stmt, index, &value) < 0){
+ return AIL_ERROR_DB_FAILED;
+ }
+ if((value == NULL) || (strcmp(value,AIL_EMPTY_STR) == 0)){
+ if (db_column_str(ai->stmt, E_AIL_PROP_PACKAGE_STR, &pkg) < 0){
+ free(locale);
+ return AIL_ERROR_DB_FAILED;
+ }
+ if (pkg == NULL){
+ free(locale);
+ return AIL_ERROR_DB_FAILED;
+ }
+ value = _get_icon_from_package_app_localized_info(pkg);
+ if((value == NULL) || (strcmp(value,AIL_EMPTY_STR) == 0)){
+ if(value != NULL){
+ free(value);
+ value = NULL;
+ }
+ value = _get_icon_from_package_localized_info(pkg);
+ }
+ }
+ *str = value;
+
+ }else{
+ *str = ai->values[prop];
+ }
+ break;
+
+ case E_AIL_PROP_MIMETYPE_STR:
+ if(ai->stmt){
+ index = sql_get_app_info_idx(prop);
+ if (db_column_str(ai->stmt, index, &value) < 0){
+ return AIL_ERROR_DB_FAILED;
+ }
+ if ((value == NULL) || (strcmp(value,AIL_EMPTY_STR) == 0)){
+ if (db_column_str(ai->stmt, E_AIL_PROP_PACKAGE_STR, &pkg) < 0){
+ free(locale);
+ return AIL_ERROR_DB_FAILED;
+ }
+ if (pkg == NULL){
+ free(locale);
+ return AIL_ERROR_DB_FAILED;
+ }
+ value = _get_mimetype_from_package_app_app_svc(pkg);
+ }
+ *str = value;
+
+ }else{
+ *str = ai->values[prop];
+ }
+ break;
+
+ default:
+ if(ai->stmt){
+ index = sql_get_app_info_idx(prop);
+ if (db_column_str(ai->stmt, index, &value) < 0){
+ return AIL_ERROR_DB_FAILED;
+ }
+ *str = value;
+ }else{
+ *str = ai->values[prop];
+
+ }
}
- *str = value;
- } else
- *str = ai->values[prop];
return AIL_ERROR_OK;
}
+EXPORT_API ail_error_e ail_close_appinfo_db(void)
+{
+ return db_close();
+}
// End of file
diff --git a/src/ail_package.h b/src/ail_package.h
index 9270334..c4326c8 100755
--- a/src/ail_package.h
+++ b/src/ail_package.h
@@ -31,5 +31,6 @@
ail_appinfo_h appinfo_create(void);
void appinfo_destroy(ail_appinfo_h ai);
void appinfo_set_stmt(ail_appinfo_h ai, sqlite3_stmt *stmt);
+int _appinfo_check_installed_storage(ail_appinfo_h ai);
#endif /* __AIL_PACKAGE_H__ */
diff --git a/src/ail_private.h b/src/ail_private.h
index cc428e1..af4d1fe 100755
--- a/src/ail_private.h
+++ b/src/ail_private.h
@@ -37,14 +37,16 @@
#if 1
#include <dlog.h>
-#define _E(fmt, arg...) LOGE("[%s,%d] "fmt,__FUNCTION__,__LINE__,##arg)
-#define _D(fmt, arg...) LOGD("[%s,%d] "fmt,__FUNCTION__,__LINE__,##arg)
+#define _E(fmt, arg...) LOGE(fmt,##arg)
+#define _D(fmt, arg...) LOGD(fmt,##arg)
#else
#include <stdio.h>
#define _E(fmt, arg...) fprintf(stderr, "[%s,%d] "fmt,__FUNCTION__,__LINE__,##arg)
#define _D(fmt, arg...) fprintf(stderr, "[%s,%d] "fmt,__FUNCTION__,__LINE__,##arg)
#endif
+#define AIL_EMPTY_STR ""
+
#define retv_if(expr, val) do { \
if(expr) { \
_E("(%s) -> %s() return\n", #expr, __FUNCTION__); \
@@ -92,6 +94,7 @@ enum {
#define AIL_SQL_QUERY_MAX_LEN 2048
#define APP_INFO_DB "/opt/dbspace/.app_info.db"
+#define PKGMGR_PARSER_DB "/opt/dbspace/.pkgmgr_parser.db"
#define ELEMENT_TYPE(e, t) do { \
if(e->prop >= E_AIL_PROP_STR_MIN && e->prop <= E_AIL_PROP_STR_MAX) t= (int)VAL_TYPE_STR; \
@@ -130,7 +133,11 @@ typedef enum {
E_AIL_PROP_X_SLP_SVC_STR,
E_AIL_PROP_X_SLP_EXE_PATH,
E_AIL_PROP_X_SLP_APPID_STR,
- E_AIL_PROP_STR_MAX = E_AIL_PROP_X_SLP_APPID_STR,
+ E_AIL_PROP_X_SLP_PKGID_STR,
+ E_AIL_PROP_X_SLP_DOMAIN_STR,
+ E_AIL_PROP_X_SLP_SUBMODEMAINID_STR,
+ E_AIL_PROP_X_SLP_INSTALLEDSTORAGE_STR,
+ E_AIL_PROP_STR_MAX = E_AIL_PROP_X_SLP_INSTALLEDSTORAGE_STR,
} ail_prop_str_e;
@@ -155,8 +162,9 @@ typedef enum {
E_AIL_PROP_X_SLP_MULTIPLE_BOOL,
E_AIL_PROP_X_SLP_REMOVABLE_BOOL,
E_AIL_PROP_X_SLP_ISHORIZONTALSCALE_BOOL,
- E_AIL_PROP_X_SLP_INACTIVATED_BOOL,
- E_AIL_PROP_BOOL_MAX = E_AIL_PROP_X_SLP_INACTIVATED_BOOL,
+ E_AIL_PROP_X_SLP_ENABLED_BOOL,
+ E_AIL_PROP_X_SLP_SUBMODE_BOOL,
+ E_AIL_PROP_BOOL_MAX = E_AIL_PROP_X_SLP_SUBMODE_BOOL,
} ail_prop_bool_e;
#define NUM_OF_PROP E_AIL_PROP_BOOL_MAX + 1
diff --git a/src/ail_sql.c b/src/ail_sql.c
index 8161ba5..877792c 100755
--- a/src/ail_sql.c
+++ b/src/ail_sql.c
@@ -31,30 +31,35 @@
#include "ail_private.h"
static const char *filter[] = {
- "app_info.PACKAGE='%s'",
- "app_info.EXEC='%s'",
- "((localname.name is NULL and app_info.name like '%%%s%%') or (localname.name like '%%%s%%'))",
- "app_info.TYPE like '%%%s%%'",
- "app_info.ICON='%s'",
- "app_info.CATEGORIES like '%%%s%%'",
- "app_info.VERSION='%s'",
- "app_info.MIMETYPE like '%%%s%%'",
- "app_info.X_SLP_SERVICE like '%%%s%%'",
- "app_info.X_SLP_PACKAGETYPE='%s'",
- "app_info.X_SLP_PACKAGECATEGORIES like '%%%s%%'",
- "app_info.X_SLP_PACKAGEID='%s'",
- "app_info.X_SLP_URI='%s'",
- "app_info.X_SLP_SVC like '%%%s%%'",
- "app_info.X_SLP_EXE_PATH='%s'",
- "app_info.X_SLP_APPID='%s'",
- "app_info.X_SLP_BASELAYOUTWIDTH=%d",
- "app_info.X_SLP_INSTALLEDTIME=%d",
- "app_info.NODISPLAY=%d",
- "app_info.X_SLP_TASKMANAGE=%d",
- "app_info.X_SLP_MULTIPLE=%d",
- "app_info.X_SLP_REMOVABLE=%d",
- "app_info.X_SLP_ISHORIZONTALSCALE=%d",
- "app_info.X_SLP_INACTIVATED=%d",
+ "PACKAGE='%s'",
+ "EXEC='%s'",
+ "NAME like '%%%s%%'",
+ "TYPE like '%%%s%%'",
+ "ICON='%s'",
+ "CATEGORIES like '%%%s%%'",
+ "VERSION='%s'",
+ "MIMETYPE like '%%%s%%'",
+ "X_SLP_SERVICE like '%%%s%%'",
+ "X_SLP_PACKAGETYPE='%s'",
+ "X_SLP_PACKAGECATEGORIES like '%%%s%%'",
+ "X_SLP_PACKAGEID='%s'",
+ "X_SLP_URI='%s'",
+ "X_SLP_SVC like '%%%s%%'",
+ "X_SLP_EXE_PATH='%s'",
+ "X_SLP_APPID='%s'",
+ "X_SLP_PKGID='%s'",
+ "X_SLP_DOMAIN='%s'",
+ "X_SLP_SUBMODEMAINID='%s'",
+ "X_SLP_INSTALLEDSTORAGE='%s'",
+ "X_SLP_BASELAYOUTWIDTH=%d",
+ "X_SLP_INSTALLEDTIME=%d",
+ "NODISPLAY like '%s'",
+ "X_SLP_TASKMANAGE like '%s'",
+ "X_SLP_MULTIPLE like '%s'",
+ "X_SLP_REMOVABLE like '%s'",
+ "X_SLP_ISHORIZONTALSCALE=%d",
+ "X_SLP_ENABLED like '%s'",
+ "X_SLP_SUBMODE like '%s'",
NULL,
};
diff --git a/src/ail_sql.h b/src/ail_sql.h
index ca95ac7..f7521c9 100755
--- a/src/ail_sql.h
+++ b/src/ail_sql.h
@@ -27,10 +27,23 @@
#include "ail.h"
#define SQL_TBL_APP_INFO "app_info"
+#define SQL_TBL_PKG_APP_INFO "package_app_info,package_app_localized_info,package_info"
+#define SQL_TBL_PKG_APP_INFO_SVC "package_app_app_svc"
+#define SQL_TBL_PKG_APP_INFO_ICON "package_localized_info"
#define SQL_TBL_APP_INFO_WITH_LOCALNAME "app_info LEFT OUTER JOIN localname " \
"ON app_info.package=localname.package " \
"and locale='%s'"
+#define SQL_TBL_APP_INFO_FILTER "package_info a LEFT OUTER JOIN package_app_info b ON a.package = b.package LEFT OUTER JOIN package_app_localized_info c ON c.app_id = b.app_id and c.app_locale='%s' LEFT OUTER JOIN package_app_app_control d ON d.app_id = b.app_id"
+
+#define SQL_TBL_APP_INFO_PKG "package_info a LEFT OUTER JOIN package_app_info b ON a.package = b.package LEFT OUTER JOIN package_app_localized_info c ON c.app_id = b.app_id and c.app_locale='No Locale' LEFT OUTER JOIN package_app_app_control d ON d.app_id = b.app_id"
+
+#define SQL_TBL_PKG_APP_INFO_WITH_LOCALNAME "package_app_info LEFT OUTER JOIN package_app_localized_info" \
+ "ON package_app_info.app_id=package_app_localized_info.app_id" \
+ "and package_app_localized_info.locale='%s'" \
+ "LEFT OUTER JOIN package_info" \
+ "ON package_app_info.package=package_info.package"
+
#define SQL_FLD_APP_INFO "app_info.PACKAGE," \
"app_info.EXEC," \
"app_info.NAME," \
@@ -47,6 +60,10 @@
"app_info.X_SLP_SVC," \
"app_info.X_SLP_EXE_PATH," \
"app_info.X_SLP_APPID," \
+ "app_info.X_SLP_PKGID," \
+ "app_info.X_SLP_DOMAIN," \
+ "app_info.X_SLP_SUBMODEMAINID," \
+ "app_info.X_SLP_INSTALLEDSTORAGE," \
"app_info.X_SLP_BASELAYOUTWIDTH," \
"app_info.X_SLP_INSTALLEDTIME," \
"app_info.NODISPLAY," \
@@ -54,7 +71,82 @@
"app_info.X_SLP_MULTIPLE," \
"app_info.X_SLP_REMOVABLE," \
"app_info.X_SLP_ISHORIZONTALSCALE," \
- "app_info.X_SLP_INACTIVATED"
+ "app_info.X_SLP_ENABLED," \
+ "app_info.X_SLP_SUBMODE" \
+
+#define SQL_FLD_PKG_APP_INFO_FILTER "b.app_id as package," \
+ "b.app_exec as exec," \
+ "c.app_label as name," \
+ "'Application' as type," \
+ "c.app_icon as icon," \
+ "'' as categories," \
+ "a.package_version as version," \
+ "'' as mimetype," \
+ "'' as x_slp_service," \
+ "a.package_type as x_slp_packagetype," \
+ "'' as x_slp_package_categories," \
+ "b.app_id as x_slp_packageid," \
+ "'' as x_slp_uri," \
+ "d.app_control as x_slp_svc," \
+ "b.app_exec as x_slp_exe_path," \
+ "b.app_id as x_slp_appid," \
+ "b.package as x_slp_pkgid," \
+ "'' as x_slp_domain," \
+ "b.app_submode_mainid as x_slp_submodemainid," \
+ "b.app_installed_storage as x_slp_installedstorage," \
+ "0 as x_slp_baselayoutwidth," \
+ "a.installed_time as x_slp_installedtime," \
+ "b.app_nodisplay as nodisplay," \
+ "b.app_taskmanage as x_slp_taskmanage," \
+ "b.app_multiple as x_slp_muliple," \
+ "a.package_removable as x_slp_removable," \
+ "0 as x_slp_ishorizontalscale," \
+ "b.app_enabled as x_slp_enabled," \
+ "b.app_submode as x_slp_submode" \
+
+#define SQL_FLD_PKG_APP_INFO "package_app_info.APP_ID," \
+ "package_app_info.APP_EXEC," \
+ "package_app_localized_info.APP_LABEL," \
+ "package_app_info.APP_SUBMODE_MAINID," \
+ "package_app_localized_info.APP_ICON," \
+ "package_app_info.APP_SUBMODE_MAINID," \
+ "package_info.PACKAGE_VERSION," \
+ "package_app_info.APP_SUBMODE_MAINID," \
+ "package_app_info.APP_SUBMODE_MAINID," \
+ "package_info.PACKAGE_TYPE," \
+ "package_app_info.APP_SUBMODE_MAINID," \
+ "package_app_info.APP_ID," \
+ "package_app_info.APP_SUBMODE_MAINID," \
+ "package_app_info.APP_SUBMODE_MAINID," \
+ "package_app_info.APP_EXEC," \
+ "package_app_info.APP_ID," \
+ "package_app_info.PACKAGE," \
+ "package_app_info.APP_SUBMODE_MAINID," \
+ "package_app_info.APP_SUBMODE_MAINID," \
+ "package_app_info.APP_INSTALLED_STORAGE," \
+ "package_app_info.APP_SUBMODE_MAINID," \
+ "package_info.INSTALLED_TIME," \
+ "package_app_info.APP_NODISPLAY," \
+ "package_app_info.APP_TASKMANAGE," \
+ "package_app_info.APP_MULTIPLE," \
+ "package_info.PACKAGE_REMOVABLE," \
+ "package_app_info.APP_SUBMODE_MAINID," \
+ "package_app_info.APP_ENABLED," \
+ "package_app_info.APP_SUBMODE" \
+
+#define FILTER_QUERY_LIST_PACKAGE_APP_INFO "select DISTINCT package_info.package " \
+ "from package_info LEFT OUTER JOIN package_localized_info " \
+ "ON package_info.package=package_localized_info.package " \
+ "and package_localized_info.package_locale='%s'"
+
+#define SQL_FLD_PKG_APP_INFO_MIME "package_app_app_svc.MIME_TYPE" \
+
+#define SQL_FLD_PKG_APP_INFO_ICON "package_localized_info.PACKAGE_ICON" \
+
+#define SQL_FLD_PKG_APP_INFO_SVC "package_app_app_svc.OPERATION," \
+ "package_app_app_svc.URI_SCHEME," \
+ "package_app_app_svc.MIME_TYPE," \
+ "package_app_app_svc.SUBAPP_NAME" \
#define SQL_FLD_APP_INFO_WITH_LOCALNAME SQL_FLD_APP_INFO",""localname.name"
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
new file mode 100755
index 0000000..236fd55
--- /dev/null
+++ b/test/CMakeLists.txt
@@ -0,0 +1,17 @@
+#AIL init DB build script
+
+SET(AILTEST ail_test)
+SET(SRCS src/ail_test.c)
+
+pkg_check_modules(AILTEST_PKGS REQUIRED vconf dlog db-util sqlite3)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src)
+
+STRING(REPLACE ";" " " EXTRA_CFLAGS "${AILTEST_PKGS_CFLAGS}")
+
+ADD_EXECUTABLE(${AILTEST} ${SRCS})
+TARGET_LINK_LIBRARIES(${AILTEST} ${LIBNAME} ${AILTEST_PKGS_LIBRARIES} "-pie")
+SET_TARGET_PROPERTIES(${AILTEST} PROPERTIES COMPILE_FLAGS "${EXTRA_CFLAGS} -pie")
+SET_TARGET_PROPERTIES(${AILTEST} PROPERTIES SKIP_BUILD_RPATH true)
+
+INSTALL(TARGETS ${AILTEST} DESTINATION ${BINDIR})
diff --git a/test/src/ail_test.c b/test/src/ail_test.c
new file mode 100644
index 0000000..63e5b80
--- /dev/null
+++ b/test/src/ail_test.c
@@ -0,0 +1,783 @@
+/*
+ * ail
+ *
+ * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <fcntl.h>
+
+#include <ail.h>
+#include "ail_private.h"
+
+struct _ail_map_t {
+ int prop;
+ const char *property;
+};
+
+
+
+static ail_cb_ret_e appinfo_func(const ail_appinfo_h appinfo, void *user_data)
+{
+ char *rs = NULL;
+ ail_cb_ret_e ret = AIL_CB_RET_CONTINUE;
+
+ ret = AIL_CB_RET_CONTINUE;
+
+ ail_appinfo_get_str(appinfo, AIL_PROP_PACKAGE_STR, &rs);
+ printf("%s|", rs);
+ printf("\n");
+ return ret;
+}
+
+int main(int argc, char** argv)
+{
+ ail_error_e ret = AIL_ERROR_OK;
+ ail_appinfo_h handle;
+ ail_filter_h filter;
+ int i;
+ int retval;
+
+ int ivalue = -1;
+ bool bvalue = false;
+ char *svalue = NULL;
+ char *appid=NULL;
+ char line[256] = {0,};
+
+ FILE *fp = NULL;
+
+ if (argc != 3){
+ fprintf(stdout, "Usage: ail_test <api_type> <file_name>\n");
+ fprintf(stdout, "api_type : 1 for get_appinfo APIs, 2 for filter APIs\n");
+ fprintf(stdout,"file_name: file containing list of APPs\n");
+ return -1;
+ }
+
+ fp = fopen(argv[2], "r");
+ if (!fp){
+ fprintf(stderr, "Unable to file containing app-id list\n");
+ return -1;
+ }
+
+
+ while (fgets(line, sizeof(line), fp)) {
+ appid = line;
+ line[strlen(appid)-1] = '\0';
+
+ switch(atoi(argv[1])){
+ case 1:
+ /*****************ail_get_appinfo start******************/
+ fprintf(stdout, "Test ail_get_appinfo Begin for appid=%s\n",appid);
+ /*****************ail_get_appinfo_new end******************/
+
+ ret = ail_get_appinfo(appid, &handle);
+ if (ret != AIL_ERROR_OK) {
+ fprintf(stderr, "Test ail_get_appinfo failed\n");
+ return AIL_ERROR_FAIL;
+ }else{
+ fprintf(stdout, "Test ail_get_appinfo Pass\n");
+ }
+ fprintf(stdout, "Test ail_get_appinfo End\n");
+
+ ret = ail_appinfo_get_int(handle, AIL_PROP_X_SLP_INSTALLEDTIME_INT, &ivalue);
+ if (ret != AIL_ERROR_OK) {
+ fprintf(stderr, "Test ail_appinfo_get_int failed\n");
+ return AIL_ERROR_FAIL;
+ }
+ fprintf(stdout, "AIL_PROP_X_SLP_INSTALLEDTIME_INT [%s] : %d\n", appid, ivalue);
+
+ ret = ail_appinfo_get_str(handle, AIL_PROP_NAME_STR, &svalue);
+ if (ret != AIL_ERROR_OK) {
+ fprintf(stderr, "Test ail_appinfo_get_str failed\n");
+ return AIL_ERROR_FAIL;
+ }
+ fprintf(stdout, "AIL_PROP_NAME_STR[%s] : %s\n", appid, svalue);
+
+ ret = ail_appinfo_get_str(handle, AIL_PROP_PACKAGE_STR, &svalue);
+ if (ret != AIL_ERROR_OK) {
+ fprintf(stderr, "Test ail_appinfo_get_str failed\n");
+ return AIL_ERROR_FAIL;
+ }
+ fprintf(stdout, "AIL_PROP_PACKAGE_STR [%s] : %s\n", appid, svalue);
+
+ ret = ail_appinfo_get_str(handle, AIL_PROP_EXEC_STR, &svalue);
+ if (ret != AIL_ERROR_OK) {
+ fprintf(stderr, "Test ail_appinfo_get_str failed\n");
+ return AIL_ERROR_FAIL;
+ }
+ fprintf(stdout, "AIL_PROP_EXEC_STR [%s] : %s\n", appid, svalue);
+
+ ret = ail_appinfo_get_str(handle, AIL_PROP_TYPE_STR, &svalue);
+ if (ret != AIL_ERROR_OK) {
+ fprintf(stderr, "Test ail_appinfo_get_str failed\n");
+ return AIL_ERROR_FAIL;
+ }
+ fprintf(stdout, "AIL_PROP_TYPE_STR [%s] : %s\n", appid, svalue);
+
+ ret = ail_appinfo_get_str(handle, AIL_PROP_ICON_STR, &svalue);
+ if (ret != AIL_ERROR_OK) {
+ fprintf(stderr, "Test ail_appinfo_get_str failed\n");
+ return AIL_ERROR_FAIL;
+ }
+ fprintf(stdout, "AIL_PROP_ICON_STR [%s] : %s\n", appid, svalue);
+
+ ret = ail_appinfo_get_str(handle, AIL_PROP_VERSION_STR, &svalue);
+ if (ret != AIL_ERROR_OK) {
+ fprintf(stderr, "Test ail_appinfo_get_str failed\n");
+ return AIL_ERROR_FAIL;
+ }
+ fprintf(stdout, "AIL_PROP_VERSION_STR [%s] : %s\n", appid, svalue);
+
+ ret = ail_appinfo_get_str(handle, AIL_PROP_MIMETYPE_STR, &svalue);
+ if (ret != AIL_ERROR_OK) {
+ fprintf(stderr, "Test ail_appinfo_get_str failed\n");
+ return AIL_ERROR_FAIL;
+ }
+ fprintf(stdout, "AIL_PROP_MIMETYPE_STR Type [%s] : %s\n", appid, svalue);
+
+ ret = ail_appinfo_get_str(handle, AIL_PROP_X_SLP_SERVICE_STR, &svalue);
+ if (ret != AIL_ERROR_OK) {
+ fprintf(stderr, "Test ail_appinfo_get_str failed\n");
+ return AIL_ERROR_FAIL;
+ }
+ fprintf(stdout, "AIL_PROP_X_SLP_SERVICE_STR [%s] : %s\n", appid, svalue);
+
+ ret = ail_appinfo_get_str(handle, AIL_PROP_X_SLP_PACKAGETYPE_STR, &svalue);
+ if (ret != AIL_ERROR_OK) {
+ fprintf(stderr, "Test ail_appinfo_get_str failed\n");
+ return AIL_ERROR_FAIL;
+ }
+ fprintf(stdout, "AIL_PROP_X_SLP_PACKAGECATEGORIES_STR [%s] : %s\n", appid, svalue);
+
+ ret = ail_appinfo_get_str(handle, AIL_PROP_X_SLP_PACKAGECATEGORIES_STR, &svalue);
+ if (ret != AIL_ERROR_OK) {
+ fprintf(stderr, "Test ail_appinfo_get_str failed\n");
+ return AIL_ERROR_FAIL;
+ }
+ fprintf(stdout, "AIL_PROP_X_SLP_PACKAGECATEGORIES_STR [%s] : %s\n", appid, svalue);
+
+ ret = ail_appinfo_get_str(handle, AIL_PROP_X_SLP_PACKAGEID_STR, &svalue);
+ if (ret != AIL_ERROR_OK) {
+ fprintf(stderr, "Test ail_appinfo_get_str failed\n");
+ return AIL_ERROR_FAIL;
+ }
+ fprintf(stdout, "AIL_PROP_X_SLP_PACKAGEID_STR [%s] : %s\n", appid, svalue);
+
+ ret = ail_appinfo_get_str(handle, AIL_PROP_X_SLP_SVC_STR, &svalue);
+ if (ret != AIL_ERROR_OK) {
+ fprintf(stderr, "Test ail_appinfo_get_str failed\n");
+ return AIL_ERROR_FAIL;
+ }
+ fprintf(stdout, "AIL_PROP_X_SLP_SVC_STR [%s] : %s\n", appid, svalue);
+
+ ret = ail_appinfo_get_str(handle, AIL_PROP_X_SLP_EXE_PATH, &svalue);
+ if (ret != AIL_ERROR_OK) {
+ fprintf(stderr, "Test ail_appinfo_get_str failed\n");
+ return AIL_ERROR_FAIL;
+ }
+ fprintf(stdout, "AIL_PROP_X_SLP_EXE_PATH [%s] : %s\n", appid, svalue);
+
+ ret = ail_appinfo_get_str(handle, AIL_PROP_X_SLP_APPID_STR, &svalue);
+ if (ret != AIL_ERROR_OK) {
+ fprintf(stderr, "Test ail_appinfo_get_str failed\n");
+ return AIL_ERROR_FAIL;
+ }
+ fprintf(stdout, "AIL_PROP_X_SLP_APPID_STR [%s] : %s\n", appid, svalue);
+
+ ret = ail_appinfo_get_str(handle, AIL_PROP_X_SLP_PKGID_STR, &svalue);
+ if (ret != AIL_ERROR_OK) {
+ fprintf(stderr, "Test ail_appinfo_get_str failed\n");
+ return AIL_ERROR_FAIL;
+ }
+ fprintf(stdout, "AIL_PROP_X_SLP_PKGID_STR [%s] : %s\n", appid, svalue);
+
+ ret = ail_appinfo_get_str(handle, AIL_PROP_X_SLP_DOMAIN_STR, &svalue);
+ if (ret != AIL_ERROR_OK) {
+ fprintf(stderr, "Test ail_appinfo_get_str failed\n");
+ return AIL_ERROR_FAIL;
+ }
+ fprintf(stdout, "AIL_PROP_X_SLP_DOMAIN_STR [%s] : %s\n", appid, svalue);
+
+ ret = ail_appinfo_get_str(handle, AIL_PROP_X_SLP_SUBMODEMAINID_STR, &svalue);
+ if (ret != AIL_ERROR_OK) {
+ fprintf(stderr, "Test ail_appinfo_get_str failed\n");
+ return AIL_ERROR_FAIL;
+ }
+ fprintf(stdout, "AIL_PROP_X_SLP_SUBMODEMAINID_STR, [%s] : %s\n", appid, svalue);
+
+ ret = ail_appinfo_get_str(handle, AIL_PROP_X_SLP_INSTALLEDSTORAGE_STR, &svalue);
+ if (ret != AIL_ERROR_OK) {
+ fprintf(stderr, "Test ail_appinfo_get_str failed\n");
+ return AIL_ERROR_FAIL;
+ }
+ fprintf(stdout, "AIL_PROP_X_SLP_INSTALLEDSTORAGE_STR [%s] : %s\n", appid, svalue);
+
+ ret = ail_appinfo_get_bool(handle, AIL_PROP_X_SLP_TASKMANAGE_BOOL, &bvalue);
+ if (ret != AIL_ERROR_OK) {
+ fprintf(stderr, "Test ail_appinfo_get_str failed\n");
+ return AIL_ERROR_FAIL;
+ }
+ fprintf(stdout, "AIL_PROP_X_SLP_TASKMANAGE_BOOL [%s] : %d\n", appid, bvalue);
+
+ ret = ail_appinfo_get_bool(handle, AIL_PROP_X_SLP_MULTIPLE_BOOL, &bvalue);
+ if (ret != AIL_ERROR_OK) {
+ fprintf(stderr, "Test ail_appinfo_get_str failed\n");
+ return AIL_ERROR_FAIL;
+ }
+ fprintf(stdout, "AIL_PROP_X_SLP_MULTIPLE_BOOL [%s] : %d\n", appid, bvalue);
+
+ ret = ail_appinfo_get_bool(handle, AIL_PROP_X_SLP_REMOVABLE_BOOL, &bvalue);
+ if (ret != AIL_ERROR_OK) {
+ fprintf(stderr, "Test ail_appinfo_get_str failed\n");
+ return AIL_ERROR_FAIL;
+ }
+ fprintf(stdout, "AIL_PROP_X_SLP_REMOVABLE_BOOL [%s] : %d\n", appid, bvalue);
+
+ ret = ail_appinfo_get_bool(handle, AIL_PROP_X_SLP_SUBMODE_BOOL, &bvalue);
+ if (ret != AIL_ERROR_OK) {
+ fprintf(stderr, "Test ail_appinfo_get_str failed\n");
+ return AIL_ERROR_FAIL;
+ }
+ fprintf(stdout, "AIL_PROP_X_SLP_SUBMODE_BOOL [%s] : %d\n", appid, bvalue);
+
+ ret = ail_appinfo_get_bool(handle, AIL_PROP_X_SLP_ISHORIZONTALSCALE_BOOL, &bvalue);
+ if (ret != AIL_ERROR_OK) {
+ fprintf(stderr, "Test ail_appinfo_get_str failed\n");
+ return AIL_ERROR_FAIL;
+ }
+ fprintf(stdout, "AIL_PROP_X_SLP_ISHORIZONTALSCALE_BOOL [%s] : %d\n", appid, bvalue);
+
+ ret = ail_appinfo_get_bool(handle, AIL_PROP_X_SLP_ENABLED_BOOL, &bvalue);
+ if (ret != AIL_ERROR_OK) {
+ fprintf(stderr, "Test ail_appinfo_get_bool failed\n");
+ return AIL_ERROR_FAIL;
+ }
+ fprintf(stdout, "AIL_PROP_X_SLP_ENABLED_BOOL [%s] : %d\n", appid, bvalue);
+
+ ret = ail_appinfo_get_int(handle, AIL_PROP_X_SLP_TEMP_INT, &ivalue);
+ if (ret != AIL_ERROR_OK) {
+ fprintf(stderr, "Test ail_appinfo_get_int failed\n");
+ return AIL_ERROR_FAIL;
+ }
+ fprintf(stdout, "AIL_PROP_X_SLP_TEMP_INT [%s] : %d\n", appid, ivalue);
+ ail_destroy_appinfo(handle);
+ break;
+ case 2:
+ ret = ail_get_appinfo(appid, &handle);
+ if (ret != AIL_ERROR_OK) {
+ fprintf(stderr, "Test ail_get_appinfo failed\n");
+ return AIL_ERROR_FAIL;
+ }else{
+ fprintf(stdout, "Test ail_get_appinfo Pass\n");
+ }
+
+ ret = ail_filter_new(&filter);
+ if (ret != AIL_ERROR_OK) {
+ return -1;
+ }
+
+
+ ret = ail_appinfo_get_int(handle, AIL_PROP_X_SLP_INSTALLEDTIME_INT, &ivalue);
+ if (ret != AIL_ERROR_OK) {
+ fprintf(stderr, "Test ail_appinfo_get_int failed\n");
+ return AIL_ERROR_FAIL;
+ }
+ fprintf(stdout, "AIL_PROP_X_SLP_INSTALLEDTIME_INT [%s] : %d\n", appid, ivalue);
+ ret = ail_filter_add_int(filter, AIL_PROP_X_SLP_INSTALLEDTIME_INT, ivalue);
+ if (ret != AIL_ERROR_OK) {
+ return -1;
+ }
+
+ ret = ail_filter_list_appinfo_foreach(filter, appinfo_func, (void *)&i);
+ if (ret != AIL_ERROR_OK){
+ return -1;
+ }
+ ail_filter_destroy(filter);
+ ret = ail_filter_new(&filter);
+ if (ret != AIL_ERROR_OK) {
+ return -1;
+ }
+
+
+ ret = ail_appinfo_get_str(handle, AIL_PROP_PACKAGE_STR, &svalue);
+ if (ret != AIL_ERROR_OK) {
+ fprintf(stderr, "Test ail_appinfo_get_str failed\n");
+ return AIL_ERROR_FAIL;
+ }
+ fprintf(stdout, "AIL_PROP_PACKAGE_STR [%s] : %s\n", appid, svalue);
+ ret = ail_filter_add_str(filter, AIL_PROP_PACKAGE_STR, svalue);
+ if (ret != AIL_ERROR_OK) {
+ return -1;
+ }
+
+ ret = ail_filter_list_appinfo_foreach(filter, appinfo_func, (void *)&i);
+ if (ret != AIL_ERROR_OK){
+ return -1;
+ }
+ ail_filter_destroy(filter);
+ ret = ail_filter_new(&filter);
+ if (ret != AIL_ERROR_OK) {
+ return -1;
+ }
+
+/* ret = ail_appinfo_get_str(handle, AIL_PROP_EXEC_STR, &svalue);
+ if (ret != AIL_ERROR_OK) {
+ fprintf(stderr, "Test ail_appinfo_get_str failed\n");
+ return AIL_ERROR_FAIL;
+ }
+ fprintf(stdout, "AIL_PROP_EXEC_STR [%s] : %s\n", appid, svalue);
+ ret = ail_filter_add_str(filter, AIL_PROP_EXEC_STR, svalue);
+ if (ret != AIL_ERROR_OK) {
+ return -1;
+ }
+
+ ret = ail_filter_list_appinfo_foreach(filter, appinfo_func, (void *)&i);
+ if (ret != AIL_ERROR_OK){
+ return -1;
+ }
+ ail_filter_destroy(filter);
+ ret = ail_filter_new(&filter);
+ if (ret != AIL_ERROR_OK) {
+ return -1;
+ }
+
+ ret = ail_appinfo_get_str(handle, AIL_PROP_TYPE_STR, &svalue);
+ if (ret != AIL_ERROR_OK) {
+ fprintf(stderr, "Test ail_appinfo_get_str failed\n");
+ return AIL_ERROR_FAIL;
+ }
+ fprintf(stdout, "AIL_PROP_TYPE_STR [%s] : %s\n", appid, svalue);
+ ret = ail_filter_add_str(filter, AIL_PROP_TYPE_STR, svalue);
+ if (ret != AIL_ERROR_OK) {
+ return -1;
+ }
+
+ ret = ail_filter_list_appinfo_foreach(filter, appinfo_func, (void *)&i);
+ if (ret != AIL_ERROR_OK){
+ return -1;
+ }
+ ail_filter_destroy(filter);
+ ret = ail_filter_new(&filter);
+ if (ret != AIL_ERROR_OK) {
+ return -1;
+ }*/
+ /* ret = ail_appinfo_get_str(handle, AIL_PROP_ICON_STR, &svalue);
+ if (ret != AIL_ERROR_OK) {
+ fprintf(stderr, "Test ail_appinfo_get_str failed\n");
+ return AIL_ERROR_FAIL;
+ }
+ fprintf(stdout, "AIL_PROP_ICON_STR [%s] : %s\n", appid, svalue);
+ ret = ail_filter_add_str(filter, AIL_PROP_ICON_STR, svalue);
+ if (ret != AIL_ERROR_OK) {
+ return -1;
+ }
+
+ ret = ail_filter_list_appinfo_foreach(filter, appinfo_func, (void *)&i);
+ if (ret != AIL_ERROR_OK){
+ return -1;
+ }
+ ail_filter_destroy(filter); */
+ /* ret = ail_filter_new(&filter);
+ if (ret != AIL_ERROR_OK) {
+ return -1;
+ }
+ ret = ail_appinfo_get_str(handle, AIL_PROP_VERSION_STR, &svalue);
+ if (ret != AIL_ERROR_OK) {
+ fprintf(stderr, "Test ail_appinfo_get_str failed\n");
+ return AIL_ERROR_FAIL;
+ }
+ fprintf(stdout, "AIL_PROP_VERSION_STR [%s] : %s\n", appid, svalue);
+ ret = ail_filter_add_str(filter, AIL_PROP_VERSION_STR, svalue);
+ if (ret != AIL_ERROR_OK) {
+ return -1;
+ }
+
+ ret = ail_filter_list_appinfo_foreach(filter, appinfo_func, (void *)&i);
+ if (ret != AIL_ERROR_OK){
+ return -1;
+ }
+ ail_filter_destroy(filter);
+ ret = ail_filter_new(&filter);
+ if (ret != AIL_ERROR_OK) {
+ return -1;
+ }
+
+ ret = ail_appinfo_get_str(handle, AIL_PROP_X_SLP_PACKAGETYPE_STR, &svalue);
+ if (ret != AIL_ERROR_OK) {
+ fprintf(stderr, "Test ail_appinfo_get_str failed\n");
+ return AIL_ERROR_FAIL;
+ }
+ fprintf(stdout, "AIL_PROP_X_SLP_PACKAGETYPE_STR [%s] : %s\n", appid, svalue);
+
+ ret = ail_filter_add_str(filter, AIL_PROP_X_SLP_PACKAGETYPE_STR, svalue);
+ if (ret != AIL_ERROR_OK) {
+ return -1;
+ }
+
+ ret = ail_filter_list_appinfo_foreach(filter, appinfo_func, (void *)&i);
+ if (ret != AIL_ERROR_OK){
+ return -1;
+ }
+
+ ail_filter_destroy(filter);
+
+ ret = ail_filter_new(&filter);
+ if (ret != AIL_ERROR_OK) {
+ return -1;
+ }
+
+ ret = ail_appinfo_get_str(handle, AIL_PROP_X_SLP_PACKAGEID_STR, &svalue);
+ if (ret != AIL_ERROR_OK) {
+ fprintf(stderr, "Test ail_appinfo_get_str failed\n");
+ return AIL_ERROR_FAIL;
+ }
+ fprintf(stdout, "AIL_PROP_X_SLP_PACKAGEID_STR [%s] : %s\n", appid, svalue);
+
+ ret = ail_filter_add_str(filter, AIL_PROP_X_SLP_PACKAGEID_STR, svalue);
+ if (ret != AIL_ERROR_OK) {
+ return -1;
+ }
+
+ ret = ail_filter_list_appinfo_foreach(filter, appinfo_func, (void *)&i);
+ if (ret != AIL_ERROR_OK){
+ return -1;
+ }
+
+ ail_filter_destroy(filter);
+
+ ret = ail_filter_new(&filter);
+ if (ret != AIL_ERROR_OK) {
+ return -1;
+ }
+
+ ret = ail_appinfo_get_str(handle, AIL_PROP_X_SLP_EXE_PATH, &svalue);
+ if (ret != AIL_ERROR_OK) {
+ fprintf(stderr, "Test ail_appinfo_get_str failed\n");
+ return AIL_ERROR_FAIL;
+ }
+ fprintf(stdout, "AIL_PROP_X_SLP_EXE_PATH [%s] : %s\n", appid, svalue);
+
+ ret = ail_filter_add_str(filter, AIL_PROP_X_SLP_EXE_PATH, svalue);
+ if (ret != AIL_ERROR_OK) {
+ return -1;
+ }
+
+ ret = ail_filter_list_appinfo_foreach(filter, appinfo_func, (void *)&i);
+ if (ret != AIL_ERROR_OK){
+ return -1;
+ }
+
+ ail_filter_destroy(filter);
+
+ ret = ail_filter_new(&filter);
+ if (ret != AIL_ERROR_OK) {
+ return -1;
+ }
+ ret = ail_appinfo_get_str(handle, AIL_PROP_X_SLP_APPID_STR, &svalue);
+ if (ret != AIL_ERROR_OK) {
+ fprintf(stderr, "Test ail_appinfo_get_str failed\n");
+ return AIL_ERROR_FAIL;
+ }
+ fprintf(stdout, "AIL_PROP_X_SLP_APPID_STR [%s] : %s\n", appid, svalue);
+
+ ret = ail_filter_add_str(filter, AIL_PROP_X_SLP_APPID_STR, svalue);
+ if (ret != AIL_ERROR_OK) {
+ return -1;
+ }
+
+ ret = ail_filter_list_appinfo_foreach(filter, appinfo_func, (void *)&i);
+ if (ret != AIL_ERROR_OK){
+ return -1;
+ }
+
+ ail_filter_destroy(filter);
+
+ ret = ail_filter_new(&filter);
+ if (ret != AIL_ERROR_OK) {
+ return -1;
+ }
+ ret = ail_appinfo_get_str(handle, AIL_PROP_X_SLP_PKGID_STR, &svalue);
+ if (ret != AIL_ERROR_OK) {
+ fprintf(stderr, "Test ail_appinfo_get_str failed\n");
+ return AIL_ERROR_FAIL;
+ }
+ fprintf(stdout, "AIL_PROP_X_SLP_PKGID_STR [%s] : %s\n", appid, svalue);
+
+ ret = ail_filter_add_str(filter, AIL_PROP_X_SLP_PKGID_STR, svalue);
+ if (ret != AIL_ERROR_OK) {
+ return -1;
+ }
+
+ ret = ail_filter_list_appinfo_foreach(filter, appinfo_func, (void *)&i);
+ if (ret != AIL_ERROR_OK){
+ return -1;
+ }
+
+ ail_filter_destroy(filter);
+
+ ret = ail_filter_new(&filter);
+ if (ret != AIL_ERROR_OK) {
+ return -1;
+ }*/
+/* ret = ail_appinfo_get_str(handle, AIL_PROP_X_SLP_DOMAIN_STR, &svalue);
+ if (ret != AIL_ERROR_OK) {
+ fprintf(stderr, "Test ail_appinfo_get_str failed\n");
+ return AIL_ERROR_FAIL;
+ }
+ fprintf(stdout, "AIL_PROP_X_SLP_DOMAIN_STR [%s] : %s\n", appid, svalue);
+
+ ret = ail_filter_add_str(filter, AIL_PROP_X_SLP_DOMAIN_STR, svalue);
+ if (ret != AIL_ERROR_OK) {
+ return -1;
+ }
+
+ ret = ail_filter_list_appinfo_foreach(filter, appinfo_func, (void *)&i);
+ if (ret != AIL_ERROR_OK){
+ return -1;
+ }
+
+ ail_filter_destroy(filter);
+
+ ret = ail_filter_new(&filter);
+ if (ret != AIL_ERROR_OK) {
+ return -1;
+ }
+ ret = ail_appinfo_get_str(handle, AIL_PROP_X_SLP_SUBMODEMAINID_STR, &svalue);
+ if (ret != AIL_ERROR_OK) {
+ fprintf(stderr, "Test ail_appinfo_get_str failed\n");
+ return AIL_ERROR_FAIL;
+ }
+ fprintf(stdout, "AIL_PROP_X_SLP_SUBMODEMAINID_STR, [%s] : %s\n", appid, svalue);
+
+ ret = ail_filter_add_str(filter, AIL_PROP_X_SLP_SUBMODEMAINID_STR, svalue);
+ if (ret != AIL_ERROR_OK) {
+ return -1;
+ }
+
+ ret = ail_filter_list_appinfo_foreach(filter, appinfo_func, (void *)&i);
+ if (ret != AIL_ERROR_OK){
+ return -1;
+ }
+
+ ail_filter_destroy(filter);
+
+ ret = ail_filter_new(&filter);
+ if (ret != AIL_ERROR_OK) {
+ return -1;
+ }
+*/ /* ret = ail_appinfo_get_str(handle, AIL_PROP_X_SLP_INSTALLEDSTORAGE_STR, &svalue);
+ if (ret != AIL_ERROR_OK) {
+ fprintf(stderr, "Test ail_appinfo_get_str failed\n");
+ return AIL_ERROR_FAIL;
+ }
+ fprintf(stdout, "AIL_PROP_X_SLP_INSTALLEDSTORAGE_STR [%s] : %s\n", appid, svalue);
+
+ ret = ail_filter_add_str(filter, AIL_PROP_X_SLP_INSTALLEDSTORAGE_STR, svalue);
+ if (ret != AIL_ERROR_OK) {
+ return -1;
+ }
+
+ ret = ail_filter_list_appinfo_foreach(filter, appinfo_func, (void *)&i);
+ if (ret != AIL_ERROR_OK){
+ return -1;
+ }
+
+ ail_filter_destroy(filter);
+
+ ret = ail_filter_new(&filter);
+ if (ret != AIL_ERROR_OK) {
+ return -1;
+ }*/
+/* ret = ail_appinfo_get_bool(handle, AIL_PROP_X_SLP_TASKMANAGE_BOOL, &bvalue);
+ if (ret != AIL_ERROR_OK) {
+ fprintf(stderr, "Test ail_appinfo_get_str failed\n");
+ return AIL_ERROR_FAIL;
+ }
+ fprintf(stdout, "AIL_PROP_X_SLP_TASKMANAGE_BOOL [%s] : %d\n", appid, bvalue);
+
+ ail_filter_add_bool(filter, AIL_PROP_X_SLP_TASKMANAGE_BOOL, bvalue);
+ if (ret != AIL_ERROR_OK) {
+ return -1;
+ }
+
+ ret = ail_filter_list_appinfo_foreach(filter, appinfo_func, (void *)&i);
+ if (ret != AIL_ERROR_OK){
+ return -1;
+ }
+
+ ail_filter_destroy(filter);
+
+ ret = ail_filter_new(&filter);
+ if (ret != AIL_ERROR_OK) {
+ return -1;
+ }
+ ret = ail_appinfo_get_bool(handle, AIL_PROP_X_SLP_MULTIPLE_BOOL, &bvalue);
+ if (ret != AIL_ERROR_OK) {
+ fprintf(stderr, "Test ail_appinfo_get_str failed\n");
+ return AIL_ERROR_FAIL;
+ }
+ fprintf(stdout, "AIL_PROP_X_SLP_MULTIPLE_BOOL [%s] : %d\n", appid, bvalue);
+
+ ret = ail_filter_add_bool(filter, AIL_PROP_X_SLP_MULTIPLE_BOOL, bvalue);
+ if (ret != AIL_ERROR_OK) {
+ return -1;
+ }
+
+ ret = ail_filter_list_appinfo_foreach(filter, appinfo_func, (void *)&i);
+ if (ret != AIL_ERROR_OK){
+ return -1;
+ }
+
+ ail_filter_destroy(filter);
+
+ ret = ail_filter_new(&filter);
+ if (ret != AIL_ERROR_OK) {
+ return -1;
+ }
+*/ ret = ail_appinfo_get_bool(handle, AIL_PROP_X_SLP_REMOVABLE_BOOL, &bvalue);
+ if (ret != AIL_ERROR_OK) {
+ fprintf(stderr, "Test ail_appinfo_get_str failed\n");
+ return AIL_ERROR_FAIL;
+ }
+ fprintf(stdout, "AIL_PROP_X_SLP_REMOVABLE_BOOL [%s] : %d\n", appid, bvalue);
+
+ ret = ail_filter_add_bool(filter, AIL_PROP_X_SLP_REMOVABLE_BOOL, bvalue);
+ if (ret != AIL_ERROR_OK) {
+ return -1;
+ }
+
+ ret = ail_filter_list_appinfo_foreach(filter, appinfo_func, (void *)&i);
+ if (ret != AIL_ERROR_OK){
+ return -1;
+ }
+
+ ail_filter_destroy(filter);
+
+ /* ret = ail_filter_new(&filter);
+ if (ret != AIL_ERROR_OK) {
+ return -1;
+ }
+ ret = ail_appinfo_get_bool(handle, AIL_PROP_X_SLP_SUBMODE_BOOL, &bvalue);
+ if (ret != AIL_ERROR_OK) {
+ fprintf(stderr, "Test ail_appinfo_get_str failed\n");
+ return AIL_ERROR_FAIL;
+ }
+ fprintf(stdout, "AIL_PROP_X_SLP_SUBMODE_BOOL [%s] : %d\n", appid, bvalue);
+
+ ret = ail_filter_add_bool(filter, AIL_PROP_X_SLP_SUBMODE_BOOL, bvalue);
+ if (ret != AIL_ERROR_OK) {
+ return -1;
+ }
+
+ ret = ail_filter_list_appinfo_foreach(filter, appinfo_func, (void *)&i);
+ if (ret != AIL_ERROR_OK){
+ return -1;
+ }
+
+ ail_filter_destroy(filter);
+
+ ret = ail_filter_new(&filter);
+ if (ret != AIL_ERROR_OK) {
+ return -1;
+ }
+ ret = ail_appinfo_get_bool(handle, AIL_PROP_X_SLP_ISHORIZONTALSCALE_BOOL, &bvalue);
+ if (ret != AIL_ERROR_OK) {
+ fprintf(stderr, "Test ail_appinfo_get_str failed\n");
+ return AIL_ERROR_FAIL;
+ }
+ fprintf(stdout, "AIL_PROP_X_SLP_ISHORIZONTALSCALE_BOOL [%s] : %d\n", appid, bvalue);
+
+ ret = ail_filter_add_bool(filter, AIL_PROP_X_SLP_ISHORIZONTALSCALE_BOOL, bvalue);
+ if (ret != AIL_ERROR_OK) {
+ return -1;
+ }
+
+ ret = ail_filter_list_appinfo_foreach(filter, appinfo_func, (void *)&i);
+ if (ret != AIL_ERROR_OK){
+ return -1;
+ }
+
+ ail_filter_destroy(filter);
+
+ ret = ail_filter_new(&filter);
+ if (ret != AIL_ERROR_OK) {
+ return -1;
+ }
+ ret = ail_appinfo_get_bool(handle, AIL_PROP_X_SLP_ENABLED_BOOL, &bvalue);
+ if (ret != AIL_ERROR_OK) {
+ fprintf(stderr, "Test ail_appinfo_get_bool failed\n");
+ return AIL_ERROR_FAIL;
+ }
+ fprintf(stdout, "AIL_PROP_X_SLP_ENABLED_BOOL [%s] : %d\n", appid, bvalue);
+
+ ret = ail_filter_add_bool(filter, AIL_PROP_X_SLP_ENABLED_BOOL, bvalue);
+ if (ret != AIL_ERROR_OK) {
+ return -1;
+ }
+
+ ret = ail_filter_list_appinfo_foreach(filter, appinfo_func, (void *)&i);
+ if (ret != AIL_ERROR_OK){
+ return -1;
+ }
+
+ ail_filter_destroy(filter);
+
+ ret = ail_filter_new(&filter);
+ if (ret != AIL_ERROR_OK) {
+ return -1;
+ }
+ ret = ail_appinfo_get_int(handle, AIL_PROP_X_SLP_TEMP_INT, &ivalue);
+ if (ret != AIL_ERROR_OK) {
+ fprintf(stderr, "Test ail_appinfo_get_int failed\n");
+ return AIL_ERROR_FAIL;
+ }
+ fprintf(stdout, "AIL_PROP_X_SLP_TEMP_INT [%s] : %d\n", appid, ivalue);
+
+ ret = ail_filter_add_int(filter, AIL_PROP_X_SLP_TEMP_INT, ivalue);
+ if (ret != AIL_ERROR_OK) {
+ return -1;
+ }
+
+ ret = ail_filter_list_appinfo_foreach(filter, appinfo_func, (void *)&i);
+ if (ret != AIL_ERROR_OK){
+ return -1;
+ }
+
+ ail_filter_destroy(filter);
+*/
+ ail_destroy_appinfo(handle);
+
+
+
+
+
+
+ break;
+ default:
+ return -1;
+ }
+ memset(line, '\0', 256);
+ }
+ retval = fclose(fp);
+ if (retval)
+ printf("Closing of file failed");
+ return EXIT_SUCCESS;
+}
diff --git a/tool/CMakeLists.txt b/tool/CMakeLists.txt
new file mode 100755
index 0000000..a3cdb74
--- /dev/null
+++ b/tool/CMakeLists.txt
@@ -0,0 +1,47 @@
+#AIL init DB build script
+
+SET(INITDB ail_initdb)
+SET(SRCS src/initdb.c)
+
+SET(DESKTOP ail_desktop)
+SET(DESKSRCS src/ail_desktop.c)
+
+SET(FILTER ail_filter)
+SET(FILTERSRCS src/ail_filter.c)
+
+SET(PKG ail_package)
+SET(PKGSRCS src/ail_package.c)
+
+pkg_check_modules(INITDB_PKGS REQUIRED vconf dlog db-util sqlite3)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src)
+
+STRING(REPLACE ";" " " EXTRA_CFLAGS "${INITDB_PKGS_CFLAGS}")
+
+ADD_EXECUTABLE(${INITDB} ${SRCS})
+TARGET_LINK_LIBRARIES(${INITDB} ${LIBNAME} ${INITDB_PKGS_LIBRARIES} "-pie")
+SET_TARGET_PROPERTIES(${INITDB} PROPERTIES COMPILE_FLAGS "${EXTRA_CFLAGS} -pie")
+SET_TARGET_PROPERTIES(${INITDB} PROPERTIES SKIP_BUILD_RPATH true)
+
+INSTALL(TARGETS ${INITDB} DESTINATION ${BINDIR})
+
+ADD_EXECUTABLE(${DESKTOP} ${DESKSRCS})
+TARGET_LINK_LIBRARIES(${DESKTOP} ${LIBNAME} ${INITDB_PKGS_LIBRARIES} "-pie")
+SET_TARGET_PROPERTIES(${DESKTOP} PROPERTIES COMPILE_FLAGS "${EXTRA_CFLAGS} -pie")
+SET_TARGET_PROPERTIES(${DESKTOP} PROPERTIES SKIP_BUILD_RPATH true)
+
+INSTALL(TARGETS ${DESKTOP} DESTINATION ${BINDIR})
+
+ADD_EXECUTABLE(${FILTER} ${FILTERSRCS})
+TARGET_LINK_LIBRARIES(${FILTER} ${LIBNAME} ${INITDB_PKGS_LIBRARIES} "-pie")
+SET_TARGET_PROPERTIES(${FILTER} PROPERTIES COMPILE_FLAGS "${EXTRA_CFLAGS} -pie")
+SET_TARGET_PROPERTIES(${FILTER} PROPERTIES SKIP_BUILD_RPATH true)
+
+INSTALL(TARGETS ${FILTER} DESTINATION ${BINDIR})
+
+ADD_EXECUTABLE(${PKG} ${PKGSRCS})
+TARGET_LINK_LIBRARIES(${PKG} ${LIBNAME} ${INITDB_PKGS_LIBRARIES} "-pie")
+SET_TARGET_PROPERTIES(${PKG} PROPERTIES COMPILE_FLAGS "${EXTRA_CFLAGS} -pie")
+SET_TARGET_PROPERTIES(${PKG} PROPERTIES SKIP_BUILD_RPATH true)
+
+INSTALL(TARGETS ${PKG} DESTINATION ${BINDIR})
diff --git a/tool/src/ail_desktop.c b/tool/src/ail_desktop.c
new file mode 100644
index 0000000..9d7ed84
--- /dev/null
+++ b/tool/src/ail_desktop.c
@@ -0,0 +1,132 @@
+/*
+Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+PROPRIETARY/CONFIDENTIAL
+This software is the confidential and proprietary information of
+SAMSUNG ELECTRONICS ("Confidential Information"). You agree and acknowledge that
+this software is owned by Samsung and you
+shall not disclose such Confidential Information and shall
+use it only in accordance with the terms of the license agreement
+you entered into with SAMSUNG ELECTRONICS. SAMSUNG make no
+representations or warranties about the suitability
+of the software, either express or implied, including but not
+limited to the implied warranties of merchantability, fitness for
+a particular purpose, or non-infringement.
+SAMSUNG shall not be liable for any damages suffered by licensee arising out of or
+related to this software.
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <fcntl.h>
+
+#include <ail.h>
+
+
+static void _print_help(const char *cmd)
+{
+ fprintf(stderr, "Usage:\n");
+ fprintf(stderr, "\n");
+ fprintf(stderr, "[Add a desktop]\n");
+ fprintf(stderr, " %s add <PACKAGE NAME>\n", cmd);
+ fprintf(stderr, "\n");
+ fprintf(stderr, " Ex) %s add com.samsung.menu-screen\n", cmd);
+ fprintf(stderr, "\n");
+ fprintf(stderr, "[Update a desktop]\n");
+ fprintf(stderr, " %s update <PACKAGE NAME>\n", cmd);
+ fprintf(stderr, "\n");
+ fprintf(stderr, " Ex) %s update com.samsung.menu-screen\n", cmd);
+ fprintf(stderr, "\n");
+ fprintf(stderr, "[Remove a desktop]\n");
+ fprintf(stderr, " %s remove <PACKAGE NAME>\n", cmd);
+ fprintf(stderr, "\n");
+ fprintf(stderr, " Ex) %s remove com.samsung.menu-screen\n", cmd);
+ fprintf(stderr, "\n");
+}
+
+
+
+static ail_error_e _add_desktop(const char *package)
+{
+ ail_error_e ret;
+
+ if (!package) {
+ return AIL_ERROR_FAIL;
+ }
+
+ ret = ail_desktop_add(package);
+ if (ret != AIL_ERROR_OK) {
+ return AIL_ERROR_FAIL;
+ }
+
+ return AIL_ERROR_OK;
+}
+
+
+
+static ail_error_e _update_desktop(const char *package)
+{
+ ail_error_e ret;
+
+ if (!package) {
+ return AIL_ERROR_FAIL;
+ }
+
+ ret = ail_desktop_update(package);
+ if (ret != AIL_ERROR_OK) {
+ return AIL_ERROR_FAIL;
+ }
+
+ return AIL_ERROR_OK;
+}
+
+
+
+static ail_error_e _remove_desktop(const char *package)
+{
+ ail_error_e ret;
+
+ if (!package) {
+ return AIL_ERROR_FAIL;
+ }
+
+ ret = ail_desktop_remove(package);
+ if (ret != AIL_ERROR_OK) {
+ return AIL_ERROR_FAIL;
+ }
+
+ return AIL_ERROR_OK;
+}
+
+
+
+int main(int argc, char** argv)
+{
+ ail_error_e ret = AIL_ERROR_OK;
+
+ if (3 == argc) {
+ if (!strncmp(argv[1], "add", 3)) {
+ ret = _add_desktop(argv[2]);
+ } else if (!strncmp(argv[1], "update", 6)) {
+ ret = _update_desktop(argv[2]);
+ } else if (!strncmp(argv[1], "remove", 6)) {
+ ret = _remove_desktop(argv[2]);
+ } else {
+ fprintf(stderr, "%s is a invalid command\n", argv[1]);
+ }
+ }
+ else {
+ _print_help(argv[0]);
+ return EXIT_FAILURE;
+ }
+
+ if (ret != AIL_ERROR_OK) {
+ fprintf(stderr, "There are some problems\n");
+ }
+
+ return EXIT_SUCCESS;
+}
+
diff --git a/tool/src/ail_filter.c b/tool/src/ail_filter.c
new file mode 100644
index 0000000..39bb15f
--- /dev/null
+++ b/tool/src/ail_filter.c
@@ -0,0 +1,315 @@
+/*
+Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+PROPRIETARY/CONFIDENTIAL
+This software is the confidential and proprietary information of
+SAMSUNG ELECTRONICS ("Confidential Information"). You agree and acknowledge that
+this software is owned by Samsung and you
+shall not disclose such Confidential Information and shall
+use it only in accordance with the terms of the license agreement
+you entered into with SAMSUNG ELECTRONICS. SAMSUNG make no
+representations or warranties about the suitability
+of the software, either express or implied, including but not
+limited to the implied warranties of merchantability, fitness for
+a particular purpose, or non-infringement.
+SAMSUNG shall not be liable for any damages suffered by licensee arising out of or
+related to this software.
+*/
+
+
+#include <stdio.h>
+#include <getopt.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+#include "ail.h"
+#include "ail_private.h"
+
+enum {
+ _CMD_UNKNOWN,
+ _CMD_COUNT,
+ _CMD_FILTER,
+};
+
+static void usage(const char *name)
+{
+ fprintf(stderr, "\n");
+ fprintf(stderr, " Usage: %s -c command [options]\n", name);
+ fprintf(stderr, " command:\n");
+ fprintf(stderr, " c : count appinfos by option\n");
+ fprintf(stderr, " f : filter appinfos by option\n");
+ fprintf(stderr, "\n");
+ fprintf(stderr, " option:\n");
+ fprintf(stderr, " --package=<pacakge name>\n");
+ fprintf(stderr, " --exec=<exec file>\n");
+ fprintf(stderr, " --name=<title name>\n");
+ fprintf(stderr, " --type=<type>\n");
+ fprintf(stderr, " --icon=<icon file>\n");
+ fprintf(stderr, " --category=<category>\n");
+ fprintf(stderr, " --version=<version>\n");
+ fprintf(stderr, " --mimetype=<mimetype>\n");
+ fprintf(stderr, " --nodisplay=<{0|1}>\n");
+ fprintf(stderr, " --service=<service>\n");
+ fprintf(stderr, " --packagetype=<package type>\n");
+ fprintf(stderr, " --packagecategories=<package category>\n");
+ fprintf(stderr, " --packageid=<package id>\n");
+ fprintf(stderr, " --svc=<action:scheme:mime>\n");
+ fprintf(stderr, " --taskmanage=<{true|false}>\n");
+ fprintf(stderr, " --multiple=<{true|false}>\n");
+ fprintf(stderr, " --removable=<{true|false}>\n");
+ fprintf(stderr, "\n");
+ fprintf(stderr, " Example:\n");
+ fprintf(stderr, " %s -n menu-screen -r 1\n", name);
+ fprintf(stderr, "\n");
+}
+
+struct _ail_map_t {
+ int prop;
+ const char *property;
+};
+
+static struct _ail_map_t prop_map[] = {
+ {E_AIL_PROP_PACKAGE_STR, AIL_PROP_PACKAGE_STR},
+ {E_AIL_PROP_EXEC_STR, AIL_PROP_EXEC_STR},
+ {E_AIL_PROP_NAME_STR, AIL_PROP_NAME_STR},
+ {E_AIL_PROP_TYPE_STR, AIL_PROP_TYPE_STR},
+ {E_AIL_PROP_ICON_STR, AIL_PROP_ICON_STR},
+ {E_AIL_PROP_CATEGORIES_STR, AIL_PROP_CATEGORIES_STR},
+ {E_AIL_PROP_VERSION_STR, AIL_PROP_VERSION_STR},
+ {E_AIL_PROP_MIMETYPE_STR, AIL_PROP_MIMETYPE_STR},
+ {E_AIL_PROP_X_SLP_SERVICE_STR, AIL_PROP_X_SLP_SERVICE_STR},
+ {E_AIL_PROP_X_SLP_PACKAGETYPE_STR, AIL_PROP_X_SLP_PACKAGETYPE_STR},
+ {E_AIL_PROP_X_SLP_PACKAGECATEGORIES_STR, AIL_PROP_X_SLP_PACKAGECATEGORIES_STR},
+ {E_AIL_PROP_X_SLP_PACKAGEID_STR, AIL_PROP_X_SLP_PACKAGEID_STR},
+ {E_AIL_PROP_X_SLP_URI_STR, AIL_PROP_X_SLP_URI_STR},
+ {E_AIL_PROP_X_SLP_SVC_STR, AIL_PROP_X_SLP_SVC_STR},
+ {E_AIL_PROP_X_SLP_EXE_PATH, AIL_PROP_X_SLP_EXE_PATH},
+ {E_AIL_PROP_X_SLP_APPID_STR, AIL_PROP_X_SLP_APPID_STR},
+ {E_AIL_PROP_X_SLP_PKGID_STR, AIL_PROP_X_SLP_PKGID_STR},
+ {E_AIL_PROP_X_SLP_DOMAIN_STR, AIL_PROP_X_SLP_DOMAIN_STR},
+ {E_AIL_PROP_X_SLP_SUBMODEMAINID_STR, AIL_PROP_X_SLP_SUBMODEMAINID_STR},
+ {E_AIL_PROP_X_SLP_INSTALLEDSTORAGE_STR, AIL_PROP_X_SLP_INSTALLEDSTORAGE_STR},
+ {E_AIL_PROP_X_SLP_TEMP_INT, AIL_PROP_X_SLP_TEMP_INT},
+ {E_AIL_PROP_X_SLP_INSTALLEDTIME_INT, AIL_PROP_X_SLP_INSTALLEDTIME_INT},
+ {E_AIL_PROP_NODISPLAY_BOOL, AIL_PROP_NODISPLAY_BOOL},
+ {E_AIL_PROP_X_SLP_TASKMANAGE_BOOL, AIL_PROP_NODISPLAY_BOOL},
+ {E_AIL_PROP_X_SLP_MULTIPLE_BOOL, AIL_PROP_X_SLP_MULTIPLE_BOOL},
+ {E_AIL_PROP_X_SLP_REMOVABLE_BOOL, AIL_PROP_X_SLP_REMOVABLE_BOOL},
+ {E_AIL_PROP_X_SLP_ISHORIZONTALSCALE_BOOL, AIL_PROP_X_SLP_ISHORIZONTALSCALE_BOOL},
+ {E_AIL_PROP_X_SLP_ENABLED_BOOL, AIL_PROP_X_SLP_ENABLED_BOOL},
+ {E_AIL_PROP_X_SLP_SUBMODE_BOOL, AIL_PROP_X_SLP_SUBMODE_BOOL}
+};
+
+
+static const char *_ail_convert_to_property(int prop)
+{
+ int i = 0;
+
+ if (prop < E_AIL_PROP_STR_MIN || prop > E_AIL_PROP_BOOL_MAX)
+ return NULL;
+
+ for (i=0 ; i < (E_AIL_PROP_BOOL_MAX + 1) ; i++) {
+ if (prop == prop_map[i].prop) {
+ return prop_map[i].property;
+ }
+ }
+
+ return NULL;
+}
+
+
+
+static int _get_cmd(const char *arg)
+{
+ int r;
+ int a;
+
+ if(!arg)
+ a = 0;
+ else
+ a = (int)*arg;
+
+ switch (a) {
+ case 'c':
+ case 'C':
+ r = _CMD_COUNT;
+ break;
+ case 'f':
+ case 'F':
+ r = _CMD_FILTER;
+ break;
+ default:
+ r = _CMD_UNKNOWN;
+ break;
+ }
+
+ return r;
+}
+
+ail_cb_ret_e appinfo_list_func(const ail_appinfo_h appinfo, void *user_data)
+{
+ char *rs = NULL;
+ int t=-1;
+ bool b = 0;
+ int n = 0;
+ struct element e;
+ int i=0;
+ struct element *p;
+ ail_error_e error = AIL_ERROR_OK;
+ ail_cb_ret_e ret = AIL_CB_RET_CONTINUE;
+ p = &e;
+
+ bool err = false;
+ ret = AIL_CB_RET_CONTINUE;
+ for(i = 0; i< E_AIL_PROP_BOOL_MAX+1 && err==false; i ++) {
+ e.prop = i;
+ ELEMENT_TYPE(p, t);
+ switch(t) {
+ case VAL_TYPE_BOOL:
+ error = ail_appinfo_get_bool(appinfo, _ail_convert_to_property(i), &b);
+ if (error != AIL_ERROR_OK) ret = AIL_CB_RET_CANCEL;
+ printf("%s|",b?"true":"false");
+ break;
+ case VAL_TYPE_INT:
+ error = ail_appinfo_get_int(appinfo, _ail_convert_to_property(i), &n);
+ if (error != AIL_ERROR_OK) ret = AIL_CB_RET_CANCEL;
+ printf("%d|", n);
+ break;
+ case VAL_TYPE_STR:
+ error = ail_appinfo_get_str(appinfo, _ail_convert_to_property(i), &rs);
+ if (error != AIL_ERROR_OK) ret = AIL_CB_RET_CANCEL;
+ printf("%s|", rs);
+ break;
+ default:
+ fprintf(stderr, "$$$\n");
+ err = true;
+ break;
+ }
+ }
+ printf("\n");
+ return ret;
+}
+
+
+
+int main(int argc, char *argv[])
+{
+ int o;
+ bool err;
+ ail_filter_h f;
+ int oi;
+ int c;
+ static struct element e;
+ int t;
+
+ f = NULL;
+ oi = -1;
+ c = _CMD_UNKNOWN;
+
+ static const struct option longopts[] = {
+ { "help", 0, NULL, 'h' },
+ { "command", 1, NULL, 'c' },
+ { "package", 1, &(e.prop), E_AIL_PROP_PACKAGE_STR},
+ { "name", 1, &(e.prop), E_AIL_PROP_NAME_STR },
+ { "mimetype", 1, &(e.prop), E_AIL_PROP_MIMETYPE_STR},
+ { "removable", 1, &(e.prop), E_AIL_PROP_X_SLP_REMOVABLE_BOOL },
+ { "exec", 1, &(e.prop), E_AIL_PROP_EXEC_STR},
+ { "type", 1, &(e.prop), E_AIL_PROP_TYPE_STR},
+ { "icon", 1, &(e.prop), E_AIL_PROP_ICON_STR},
+ { "categories", 1, &(e.prop), E_AIL_PROP_CATEGORIES_STR},
+ { "version", 1, &(e.prop), E_AIL_PROP_VERSION_STR},
+ { "mimetype", 1, &(e.prop), E_AIL_PROP_MIMETYPE_STR},
+ { "nodisplay", 1, &(e.prop), E_AIL_PROP_NODISPLAY_BOOL},
+ { "service", 1, &(e.prop), E_AIL_PROP_X_SLP_SERVICE_STR},
+ { "packagetype", 1, &(e.prop), E_AIL_PROP_X_SLP_PACKAGETYPE_STR},
+ { "packagecategories", 1, &(e.prop), E_AIL_PROP_X_SLP_PACKAGECATEGORIES_STR},
+ { "packageid", 1, &(e.prop), E_AIL_PROP_X_SLP_PACKAGEID_STR},
+ { "svc", 1, &(e.prop), E_AIL_PROP_X_SLP_SVC_STR},
+ { "taskmanage", 1, &(e.prop), E_AIL_PROP_X_SLP_TASKMANAGE_BOOL},
+ { "multiple", 1, &(e.prop), E_AIL_PROP_X_SLP_MULTIPLE_BOOL},
+ { "removable", 1, &(e.prop), E_AIL_PROP_X_SLP_REMOVABLE_BOOL},
+ { "appid", 1, &(e.prop), E_AIL_PROP_X_SLP_APPID_STR},
+ { "pkgid", 1, &(e.prop), E_AIL_PROP_X_SLP_PKGID_STR},
+ { "submode", 1, &(e.prop), E_AIL_PROP_X_SLP_SUBMODE_BOOL},
+ { "submodemainid", 1, &(e.prop), E_AIL_PROP_X_SLP_SUBMODEMAINID_STR},
+ { "installedstorage", 1, &(e.prop), E_AIL_PROP_X_SLP_INSTALLEDSTORAGE_STR},
+ { "domain", 1, &(e.prop), E_AIL_PROP_X_SLP_DOMAIN_STR},
+ { 0, 0, 0, 0 },
+ };
+
+ if (ail_filter_new(&f) != AIL_ERROR_OK)
+ return -1;
+
+ err = false;
+
+ while (!err && (o = getopt_long(argc, argv, "c:", longopts, &oi)) >= 0) {
+ bool b;
+ struct element *p = &e;
+
+ ELEMENT_TYPE(p, t);
+
+ switch (o) {
+ case 'c':
+ c = _get_cmd(optarg);
+ break;
+ case 0:
+ switch (t) {
+ case VAL_TYPE_BOOL:
+ if(!strcasecmp(optarg, "true") || !strcasecmp(optarg, "1"))
+ b = true;
+ else if (!strcasecmp(optarg, "false") || !strcasecmp(optarg, "0"))
+ b = false;
+ else {
+ err = true;
+ break;
+ }
+ if (ail_filter_add_bool(f, _ail_convert_to_property(e.prop), b) != AIL_ERROR_OK)
+ err = true;
+ break;
+
+ case VAL_TYPE_INT:
+ if (ail_filter_add_int(f, _ail_convert_to_property(e.prop), atoi(optarg)) != AIL_ERROR_OK)
+ err = true;
+ break;
+
+ case VAL_TYPE_STR:
+ if (ail_filter_add_str(f, _ail_convert_to_property(e.prop), optarg) != AIL_ERROR_OK)
+ err = true;
+ break;
+
+ default:
+ err = true;
+ break;
+ }
+ break;
+ default:
+ err = true;
+ break;
+ }
+ }
+
+ if (err) {
+ usage(argv[0]);
+ }
+ else {
+ int n = -1;
+ switch (c) {
+ case _CMD_COUNT:
+ if (ail_filter_count_appinfo(f, &n) != AIL_ERROR_OK){
+ fprintf(stderr, "Error: failed to count appinfo\n");
+ }
+ else
+ fprintf(stderr, "count=%d\n", n);
+ break;
+ case _CMD_FILTER:
+ ail_filter_list_appinfo_foreach(f, appinfo_list_func, NULL);
+ break;
+ default:
+ break;
+ }
+ }
+
+ if (f)
+ ail_filter_destroy(f);
+
+ return 0;
+}
diff --git a/tool/src/ail_package.c b/tool/src/ail_package.c
new file mode 100644
index 0000000..b0fdf18
--- /dev/null
+++ b/tool/src/ail_package.c
@@ -0,0 +1,177 @@
+/*
+Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+PROPRIETARY/CONFIDENTIAL
+This software is the confidential and proprietary information of
+SAMSUNG ELECTRONICS ("Confidential Information"). You agree and acknowledge that
+this software is owned by Samsung and you
+shall not disclose such Confidential Information and shall
+use it only in accordance with the terms of the license agreement
+you entered into with SAMSUNG ELECTRONICS. SAMSUNG make no
+representations or warranties about the suitability
+of the software, either express or implied, including but not
+limited to the implied warranties of merchantability, fitness for
+a particular purpose, or non-infringement.
+SAMSUNG shall not be liable for any damages suffered by licensee arising out of or
+related to this software.
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <fcntl.h>
+
+#include <ail.h>
+#include "ail_private.h"
+
+char *prop_tbl[] = {
+ AIL_PROP_PACKAGE_STR,
+ AIL_PROP_EXEC_STR,
+ AIL_PROP_NAME_STR,
+ AIL_PROP_TYPE_STR,
+ AIL_PROP_ICON_STR,
+ AIL_PROP_CATEGORIES_STR,
+ AIL_PROP_VERSION_STR,
+ AIL_PROP_MIMETYPE_STR,
+ AIL_PROP_X_SLP_SERVICE_STR,
+ AIL_PROP_X_SLP_PACKAGETYPE_STR,
+ AIL_PROP_X_SLP_PACKAGECATEGORIES_STR,
+ AIL_PROP_X_SLP_PACKAGEID_STR,
+ AIL_PROP_X_SLP_SVC_STR,
+ AIL_PROP_X_SLP_EXE_PATH,
+ AIL_PROP_X_SLP_APPID_STR,
+ AIL_PROP_X_SLP_PKGID_STR,
+ AIL_PROP_X_SLP_DOMAIN_STR,
+ AIL_PROP_X_SLP_SUBMODEMAINID_STR,
+ AIL_PROP_X_SLP_INSTALLEDSTORAGE_STR,
+ AIL_PROP_NODISPLAY_BOOL,
+ AIL_PROP_X_SLP_TASKMANAGE_BOOL,
+ AIL_PROP_X_SLP_MULTIPLE_BOOL,
+ AIL_PROP_X_SLP_REMOVABLE_BOOL,
+ AIL_PROP_X_SLP_SUBMODE_BOOL,
+ NULL
+};
+
+
+static void _print_help(const char *cmd)
+{
+ int i;
+
+ fprintf(stderr, "Usage:\n");
+ fprintf(stderr, "\n");
+ fprintf(stderr, "[Get appinfo value]\n");
+ fprintf(stderr, " %s get <PACKAGE NAME> <COLUMN NAME>\n", cmd);
+ fprintf(stderr, "\n");
+ fprintf(stderr, " <COLUMN NAME>\n");
+
+ for (i = 0; prop_tbl[i]; i++) {
+ fprintf(stderr, " %s\n", prop_tbl[i]);
+ }
+
+ fprintf(stderr, "\n");
+ fprintf(stderr, " Ex) %s get com.samsung.menu-screen X_SLP_SERVICE\n", cmd);
+ fprintf(stderr, "\n");
+}
+
+
+
+static int _get_property(const char *property)
+{
+ int i;
+
+ if (!property) {
+ return 0;
+ }
+
+ for (i = 0; prop_tbl[i]; i++) {
+ if (!strcasecmp(prop_tbl[i], property)) {
+ return i;
+ }
+ }
+
+ fprintf(stderr, "%s is not found\n", property);
+
+ return -1;
+}
+
+
+
+static ail_error_e _get_appinfo(const char *package, const char *property)
+{
+ ail_appinfo_h handle;
+ ail_error_e ret;
+ int prop, ival;
+ bool bval;
+ char *str;
+ struct element e;
+ struct element *p;
+ int t;
+
+ ret = ail_package_get_appinfo(package, &handle);
+ if (ret != AIL_ERROR_OK) {
+ goto END;
+ }
+
+ prop = _get_property(property);
+ if (prop < 0) {
+ goto END;
+ }
+
+ e.prop = prop;
+ p = &e;
+ ELEMENT_TYPE(p,t);
+
+ if (t == VAL_TYPE_STR) {
+ ret = ail_appinfo_get_str(handle, property, &str);
+ if (ret != AIL_ERROR_OK) {
+ goto END;
+ }
+ fprintf(stderr, "Package[%s], Property[%s] : %s\n", package, property, str);
+ } else if (t == VAL_TYPE_INT) {
+ ret = ail_appinfo_get_int(handle, property, &ival);
+ if (ret != AIL_ERROR_OK) {
+ goto END;
+ }
+ fprintf(stderr, "Package[%s], Property[%s] : %d\n", package, property, ival);
+ } else if (t == VAL_TYPE_BOOL) {
+ ret = ail_appinfo_get_bool(handle, property, &bval);
+ if (ret != AIL_ERROR_OK) {
+ goto END;
+ }
+ fprintf(stderr, "Package[%s], Property[%s] : %d\n", package, property, bval);
+ }
+
+END:
+ ret = ail_package_destroy_appinfo(handle);
+ if (ret != AIL_ERROR_OK) {
+ return AIL_ERROR_FAIL;
+ }
+
+ return AIL_ERROR_OK;
+}
+
+int main(int argc, char** argv)
+{
+ ail_error_e ret = AIL_ERROR_OK;
+
+
+ if (4 == argc) {
+ if (!strncmp(argv[1], "get", 3)) {
+ ret = _get_appinfo(argv[2], argv[3]);
+ }
+ }
+ else {
+ _print_help(argv[0]);
+ return EXIT_FAILURE;
+ }
+
+ if (ret != AIL_ERROR_OK) {
+ fprintf(stderr, "There are some problems\n");
+ }
+
+ return EXIT_SUCCESS;
+}
+
+
diff --git a/initdb/src/initdb.c b/tool/src/initdb.c
index 160d08b..94805ef 100755
--- a/initdb/src/initdb.c
+++ b/tool/src/initdb.c
@@ -27,6 +27,8 @@
#include <dirent.h>
#include <unistd.h>
#include <sys/stat.h>
+#include <sys/types.h>
+#include <sys/wait.h>
#include <errno.h>
#include "ail.h"
@@ -38,6 +40,8 @@
#define OPT_DESKTOP_DIRECTORY "/opt/share/applications"
#define USR_DESKTOP_DIRECTORY "/usr/share/applications"
#define APP_INFO_DB_FILE "/opt/dbspace/.app_info.db"
+#define APP_INFO_DB_FILE_JOURNAL "/opt/dbspace/.app_info.db-journal"
+#define APP_INFO_DB_LABEL "ail::db"
#ifdef _E
#undef _E
@@ -90,7 +94,7 @@ char* _desktop_to_package(const char* desktop)
tmp = strrchr(package, '.');
if(tmp == NULL) {
- _E("(tmp == NULL) return\n");
+ _E("[%s] is not a desktop file", package);
free(package);
return NULL;
}
@@ -112,8 +116,10 @@ int initdb_load_directory(const char *directory)
{
DIR *dir;
struct dirent entry, *result;
- int len, ret;
+ int ret;
char buf[BUFSZE];
+ int total_cnt = 0;
+ int ok_cnt = 0;
// desktop file
dir = opendir(directory);
@@ -123,8 +129,7 @@ int initdb_load_directory(const char *directory)
return AIL_ERROR_FAIL;
}
- len = strlen(directory) + 1;
- _D("Loading desktop files from %s\n", directory);
+ _D("Loading desktop files from %s", directory);
for (ret = readdir_r(dir, &entry, &result);
ret == 0 && result != NULL;
@@ -132,20 +137,22 @@ int initdb_load_directory(const char *directory)
char *package;
if (entry.d_name[0] == '.') continue;
-
+ total_cnt++;
package = _desktop_to_package(entry.d_name);
if (!package) {
- _E("Failed to convert file to package[%s]\n", entry.d_name);
+ _E("Failed to convert file to package[%s]", entry.d_name);
continue;
}
if (ail_desktop_add(package) != AIL_ERROR_OK) {
- _E("Failed to add a package[%s]\n", package);
+ _E("Failed to add a package[%s]", package);
+ } else {
+ ok_cnt++;
}
-
free(package);
}
+ _D("Application-Desktop process : Success [%d], fail[%d], total[%d] \n", ok_cnt, total_cnt-ok_cnt, total_cnt);
closedir(dir);
return AIL_ERROR_OK;
@@ -169,10 +176,10 @@ static int initdb_change_perm(const char *db_file)
snprintf(journal_file, sizeof(journal_file), "%s%s", db_file, "-journal");
for (i = 0; files[i]; i++) {
- ret = chown(files[i], OWNER_ROOT, GROUP_MENU);
+ ret = chown(files[i], OWNER_ROOT, OWNER_ROOT);
if (ret == -1) {
strerror_r(errno, buf, sizeof(buf));
- _E("FAIL : chown %s %d.%d, because %s", db_file, OWNER_ROOT, GROUP_MENU, buf);
+ _E("FAIL : chown %s %d.%d, because %s", db_file, OWNER_ROOT, OWNER_ROOT, buf);
return AIL_ERROR_FAIL;
}
@@ -199,6 +206,38 @@ static int __is_authorized()
return 0;
}
+int xsystem(const char *argv[])
+{
+ int status = 0;
+ pid_t pid;
+ pid = fork();
+ switch (pid) {
+ case -1:
+ perror("fork failed");
+ return -1;
+ case 0:
+ /* child */
+ execvp(argv[0], (char *const *)argv);
+ _exit(-1);
+ default:
+ /* parent */
+ break;
+ }
+ if (waitpid(pid, &status, 0) == -1) {
+ perror("waitpid failed");
+ return -1;
+ }
+ if (WIFSIGNALED(status)) {
+ perror("signal");
+ return -1;
+ }
+ if (!WIFEXITED(status)) {
+ /* shouldn't happen */
+ perror("should not happen");
+ return -1;
+ }
+ return WEXITSTATUS(status);
+}
int main(int argc, char *argv[])
{
@@ -210,33 +249,39 @@ int main(int argc, char *argv[])
return AIL_ERROR_FAIL;
}
+ const char *argv_rm[] = { "/bin/rm", APP_INFO_DB_FILE, NULL };
+ xsystem(argv_rm);
+ const char *argv_rmjn[] = { "/bin/rm", APP_INFO_DB_FILE_JOURNAL, NULL };
+ xsystem(argv_rmjn);
+
ret = setenv("AIL_INITDB", "1", 1);
_D("AIL_INITDB : %d", ret);
ret = initdb_count_app();
if (ret > 0) {
_D("Some Apps in the App Info DB.");
- return AIL_ERROR_OK;
}
ret = initdb_load_directory(OPT_DESKTOP_DIRECTORY);
if (ret == AIL_ERROR_FAIL) {
_E("cannot load opt desktop directory.");
- return AIL_ERROR_FAIL;
}
ret = initdb_load_directory(USR_DESKTOP_DIRECTORY);
if (ret == AIL_ERROR_FAIL) {
_E("cannot load usr desktop directory.");
- return AIL_ERROR_FAIL;
}
ret = initdb_change_perm(APP_INFO_DB_FILE);
if (ret == AIL_ERROR_FAIL) {
_E("cannot chown.");
- return AIL_ERROR_FAIL;
}
+ const char *argv_smack[] = { "/usr/bin/chsmack", "-a", APP_INFO_DB_LABEL, APP_INFO_DB_FILE, NULL };
+ xsystem(argv_smack);
+ const char *argv_smackjn[] = { "/usr/bin/chsmack", "-a", APP_INFO_DB_LABEL, APP_INFO_DB_FILE_JOURNAL, NULL };
+ xsystem(argv_smackjn);
+
return AIL_ERROR_OK;
}
diff --git a/tool/src/main.c.head b/tool/src/main.c.head
new file mode 100644
index 0000000..fd2da68
--- /dev/null
+++ b/tool/src/main.c.head
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2011 Samsung Electronics, Inc.
+ * All rights reserved.
+ *
+ * This software is a confidential and proprietary information
+ * of Samsung Electronics, Inc. ("Confidential Information"). You
+ * shall not disclose such Confidential Information and shall use
+ * it only in accordance with the terms of the license agreement
+ * you entered into with Samsung Electronics.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <fcntl.h>
+
+#include <ail.h>
+#include "ail_private.h"
+
diff --git a/tool/src/main.c.tail b/tool/src/main.c.tail
new file mode 100644
index 0000000..271f1ad
--- /dev/null
+++ b/tool/src/main.c.tail
@@ -0,0 +1,121 @@
+
+
+static void _print_help(const char *cmd)
+{
+ int i;
+
+ fprintf(stderr, "Usage:\n");
+ fprintf(stderr, "\n");
+ fprintf(stderr, "[Get appinfo value]\n");
+ fprintf(stderr, " %s get <PACKAGE NAME> <COLUMN NAME>\n", cmd);
+ fprintf(stderr, "\n");
+ fprintf(stderr, " <COLUMN NAME>\n");
+
+ for (i = 0; prop_tbl[i]; i++) {
+ fprintf(stderr, " %s\n", prop_tbl[i]);
+ }
+
+ fprintf(stderr, "\n");
+ fprintf(stderr, " Ex) %s get com.samsung.menu-screen X_SLP_SERVICE\n", cmd);
+ fprintf(stderr, "\n");
+}
+
+
+
+static int _get_property(const char *property)
+{
+ int i;
+
+ if (!property) {
+ return 0;
+ }
+
+ for (i = 0; prop_tbl[i]; i++) {
+ if (!strcasecmp(prop_tbl[i], property)) {
+ return i;
+ }
+ }
+
+ fprintf(stderr, "%s is not found\n", property);
+
+ return -1;
+}
+
+
+
+static ail_error_e _get_appinfo(const char *package, const char *property)
+{
+ ail_appinfo_h handle;
+ ail_error_e ret;
+ int prop, ival;
+ bool bval;
+ char *str;
+ struct element e;
+ struct element *p;
+ int t;
+
+ ret = ail_package_get_appinfo(package, &handle);
+ if (ret != AIL_ERROR_OK) {
+ return AIL_ERROR_FAIL;
+ }
+
+ prop = _get_property(property);
+ if (prop < 0) {
+ return AIL_ERROR_FAIL;
+ }
+
+ e.prop = prop;
+ p = &e;
+ ELEMENT_TYPE(p,t);
+
+ if (t == VAL_TYPE_STR) {
+ ret = ail_appinfo_get_str(handle, prop, &str);
+ if (ret != AIL_ERROR_OK) {
+ return AIL_ERROR_FAIL;
+ }
+ fprintf(stderr, "Package[%s], Property[%s] : %s\n", package, property, str);
+ } else if (t == VAL_TYPE_INT) {
+ ret = ail_appinfo_get_int(handle, prop, &ival);
+ if (ret != AIL_ERROR_OK) {
+ return AIL_ERROR_FAIL;
+ }
+ fprintf(stderr, "Package[%s], Property[%s] : %d\n", package, property, ival);
+ } else if (t == VAL_TYPE_BOOL) {
+ ret = ail_appinfo_get_bool(handle, prop, &bval);
+ if (ret != AIL_ERROR_OK) {
+ return AIL_ERROR_FAIL;
+ }
+ fprintf(stderr, "Package[%s], Property[%s] : %d\n", package, property, bval);
+ }
+
+ ret = ail_package_destroy_appinfo(handle);
+ if (ret != AIL_ERROR_OK) {
+ return AIL_ERROR_FAIL;
+ }
+
+ return AIL_ERROR_OK;
+}
+
+int main(int argc, char** argv)
+{
+ ail_error_e ret = AIL_ERROR_OK;
+
+
+ if (4 == argc) {
+ if (!strncmp(argv[1], "get", 3)) {
+ ret = _get_appinfo(argv[2], argv[3]);
+ }
+ }
+ else {
+ _print_help(argv[0]);
+ return EXIT_FAILURE;
+ }
+
+ if (ret != AIL_ERROR_OK) {
+ fprintf(stderr, "There are some problems\n");
+ }
+
+ return EXIT_SUCCESS;
+}
+
+