summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHyunho Kang <hhstark.kang@samsung.com>2017-07-10 21:38:23 +0900
committerHwanKyu Jhun <h.jhun@samsung.com>2017-07-25 00:59:52 +0000
commit6b582837437a2aa2f36cc1690d5dec68eea4f26e (patch)
tree80576629b603bc19a7281338cf167cdd1da291dd
parenta8ccea27bc2befbe77a35cd92fda116ee37d0fa7 (diff)
downloadapplication-6b582837437a2aa2f36cc1690d5dec68eea4f26e.tar.gz
application-6b582837437a2aa2f36cc1690d5dec68eea4f26e.tar.bz2
application-6b582837437a2aa2f36cc1690d5dec68eea4f26e.zip
Seperate packages
Requires: - https://review.tizen.org/gerrit/#/c/132065/ [app-common] - https://review.tizen.org/gerrit/#/c/132066/ [app-control] - https://review.tizen.org/gerrit/#/c/132073/ [app-event] - https://review.tizen.org/gerrit/#/c/132080/ [preference] - https://review.tizen.org/gerrit/#/c/132144/ [application] Change-Id: I5413ed4847818a0864671ff5842070ee7fd751f4 Signed-off-by: Hyunho Kang <hhstark.kang@samsung.com> Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
-rw-r--r--CMakeLists.txt4
-rw-r--r--app_common/CMakeLists.txt70
-rw-r--r--app_common/app_error.c59
-rwxr-xr-xapp_common/app_event.c180
-rw-r--r--app_common/app_finalizer.c100
-rw-r--r--app_common/app_package.c173
-rw-r--r--app_common/app_path.c102
-rw-r--r--app_common/app_resource_manager.c34
-rw-r--r--app_control/CMakeLists.txt65
-rwxr-xr-xapp_control/app_control.c1286
-rw-r--r--capi-appfw-application.pc.in (renamed from capi-appfw-module.pc.in)0
-rwxr-xr-xdoc/appfw_app_control_doc.h2
-rw-r--r--event/CMakeLists.txt65
-rw-r--r--event/event.c284
-rw-r--r--include/app_common.h423
-rw-r--r--include/app_control.h1177
-rw-r--r--include/app_control_internal.h242
-rw-r--r--include/app_event.h1084
-rw-r--r--include/app_internal.h15
-rw-r--r--include/app_preference.h322
-rw-r--r--include/app_preference_internal.h151
-rw-r--r--include/app_preference_log.h93
-rw-r--r--include/app_resource_manager.h123
-rw-r--r--include/app_types.h52
-rw-r--r--packaging/capi-appfw-application.spec123
-rw-r--r--preference/CMakeLists.txt66
-rwxr-xr-xpreference/preference.c1578
-rwxr-xr-xpreference/preference_db.c795
-rwxr-xr-xpreference/preference_inoti.c440
-rw-r--r--src/CMakeLists.txt6
-rwxr-xr-xsrc/app_main.c1
-rwxr-xr-xsrc/app_main_legacy.c1
32 files changed, 9 insertions, 9107 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index fee558f..085faf4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2,10 +2,6 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
SET(INC_DIR include)
-ADD_SUBDIRECTORY(app_control)
-ADD_SUBDIRECTORY(app_common)
-ADD_SUBDIRECTORY(preference)
-ADD_SUBDIRECTORY(event)
ADD_SUBDIRECTORY(src)
INSTALL(
diff --git a/app_common/CMakeLists.txt b/app_common/CMakeLists.txt
deleted file mode 100644
index 0c2506a..0000000
--- a/app_common/CMakeLists.txt
+++ /dev/null
@@ -1,70 +0,0 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-SET(fw_name "capi-appfw-app-common")
-
-PROJECT(${fw_name})
-
-SET(CMAKE_INSTALL_PREFIX /usr)
-SET(PREFIX ${CMAKE_INSTALL_PREFIX})
-
-SET(INC_DIR ${CMAKE_SOURCE_DIR}/include)
-INCLUDE_DIRECTORIES(${INC_DIR})
-
-SET(requires "dlog aul pkgmgr-info capi-base-common appcore-common libtzplatform-config")
-SET(pc_requires "capi-base-common")
-
-INCLUDE(FindPkgConfig)
-pkg_check_modules(${fw_name} REQUIRED ${requires})
-FOREACH(flag ${${fw_name}_CFLAGS})
- SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
-ENDFOREACH(flag)
-
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC ")
-SET(CMAKE_C_FLAGS_DEBUG "-O0 -g -Wall -Werror -Wno-error=deprecated-declarations")
-
-IF("${ARCH}" STREQUAL "arm")
- ADD_DEFINITIONS("-DTARGET")
-ENDIF("${ARCH}" STREQUAL "arm")
-
-ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
-ADD_DEFINITIONS("-DSLP_DEBUG")
-
-SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=${LIB_INSTALL_DIR}")
-
-add_library(${fw_name} SHARED
- app_package.c
- app_path.c
- app_error.c
- app_finalizer.c
- app_event.c
- app_resource_manager.c
- )
-
-TARGET_LINK_LIBRARIES(${fw_name} ${${fw_name}_LDFLAGS})
-
-SET_TARGET_PROPERTIES(${fw_name}
- PROPERTIES
- VERSION ${FULLVER}
- SOVERSION ${MAJORVER}
- CLEAN_DIRECT_OUTPUT 1
-)
-
-INSTALL(TARGETS ${fw_name} DESTINATION ${LIB_INSTALL_DIR})
-INSTALL(
- DIRECTORY ${INC_DIR}/ DESTINATION include/appfw
- FILES_MATCHING
- PATTERN "*_private.h" EXCLUDE
- PATTERN "${INC_DIR}/*.h"
- )
-
-SET(PC_NAME ${fw_name})
-SET(PC_REQUIRED ${pc_requires})
-SET(PC_LDFLAGS -l${fw_name})
-
-CONFIGURE_FILE(
- ${CMAKE_SOURCE_DIR}/capi-appfw-module.pc.in
- ${CMAKE_SOURCE_DIR}/${fw_name}.pc
- @ONLY
-)
-INSTALL(FILES ${CMAKE_SOURCE_DIR}/${fw_name}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
-
-
diff --git a/app_common/app_error.c b/app_common/app_error.c
deleted file mode 100644
index bd25122..0000000
--- a/app_common/app_error.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2011 - 2016 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 <libintl.h>
-#include <dlog.h>
-#include <app_internal.h>
-
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-
-#define LOG_TAG "CAPI_APPFW_APPLICATION"
-
-static const char *app_error_to_string(app_error_e error)
-{
- switch (error) {
- case APP_ERROR_NONE:
- return "NONE";
- case APP_ERROR_INVALID_PARAMETER:
- return "INVALID_PARAMETER";
- case APP_ERROR_OUT_OF_MEMORY:
- return "OUT_OF_MEMORY";
- case APP_ERROR_INVALID_CONTEXT:
- return "INVALID_CONTEXT";
- case APP_ERROR_NO_SUCH_FILE:
- return "NO_SUCH_FILE";
- case APP_ERROR_ALREADY_RUNNING:
- return "ALREADY_RUNNING";
- default:
- return "UNKNOWN";
- }
-}
-
-int app_error(app_error_e error, const char *function, const char *description)
-{
- if (description)
- LOGE("[%s] %s(0x%08x) : %s", function, app_error_to_string(error), error, description);
- else
- LOGE("[%s] %s(0x%08x)", function, app_error_to_string(error), error);
-
- return error;
-}
-
diff --git a/app_common/app_event.c b/app_common/app_event.c
deleted file mode 100755
index d64227a..0000000
--- a/app_common/app_event.c
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * Copyright (c) 2011 - 2016 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 <string.h>
-
-#include <vconf-internal-keys.h>
-#include <app_common.h>
-#include <appcore_base.h>
-#include <app_internal.h>
-
-struct app_event_info {
- app_event_type_e type;
- void *value;
-};
-
-enum appcore_rm {
- APPCORE_RM_UNKNOWN,
- APPCORE_RM_PORTRAIT_NORMAL,
- APPCORE_RM_PORTRAIT_REVERSE,
- APPCORE_RM_LANDSCAPE_NORMAL,
- APPCORE_RM_LANDSCAPE_REVERSE,
-};
-
-app_device_orientation_e app_convert_appcore_rm(enum appcore_rm rm)
-{
- app_device_orientation_e dev_orientation;
-
- switch (rm) {
- case APPCORE_RM_PORTRAIT_NORMAL:
- dev_orientation = APP_DEVICE_ORIENTATION_0;
- break;
- case APPCORE_RM_PORTRAIT_REVERSE:
- dev_orientation = APP_DEVICE_ORIENTATION_180;
- break;
- case APPCORE_RM_LANDSCAPE_NORMAL:
- dev_orientation = APP_DEVICE_ORIENTATION_270;
- break;
- case APPCORE_RM_LANDSCAPE_REVERSE:
- dev_orientation = APP_DEVICE_ORIENTATION_90;
- break;
- default:
- dev_orientation = APP_DEVICE_ORIENTATION_0;
- break;
- }
-
- return dev_orientation;
-}
-
-static int __app_convert_low_memory(void *val)
-{
- switch (*(int *)val) {
- case VCONFKEY_SYSMAN_LOW_MEMORY_NORMAL:
- return APP_EVENT_LOW_MEMORY_NORMAL;
- case VCONFKEY_SYSMAN_LOW_MEMORY_SOFT_WARNING:
- return APP_EVENT_LOW_MEMORY_SOFT_WARNING;
- case VCONFKEY_SYSMAN_LOW_MEMORY_HARD_WARNING:
- return APP_EVENT_LOW_MEMORY_HARD_WARNING;
- default:
- return -1;
- }
-}
-
-static int __app_convert_low_battery(void *val)
-{
- switch (*(int *)val) {
- case VCONFKEY_SYSMAN_BAT_POWER_OFF:
- return APP_EVENT_LOW_BATTERY_POWER_OFF;
- case VCONFKEY_SYSMAN_BAT_CRITICAL_LOW:
- return APP_EVENT_LOW_BATTERY_CRITICAL_LOW;
- default:
- return -1;
- }
-}
-
-int app_event_get_low_memory_status(app_event_info_h event_info, app_event_low_memory_status_e *status)
-{
- int ret;
-
- if (event_info == NULL || status == NULL)
- return app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, "null parameter");
-
- if (event_info->type != APP_EVENT_LOW_MEMORY)
- return app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, "event type mismatching");
-
- ret = __app_convert_low_memory(event_info->value);
- if (ret < 0)
- return app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, "invalid event info");
-
- *status = ret;
-
- return APP_ERROR_NONE;
-}
-
-int app_event_get_low_battery_status(app_event_info_h event_info, app_event_low_battery_status_e *status)
-{
- int ret;
-
- if (event_info == NULL || status == NULL)
- return app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, "null parameter");
-
- if (event_info->type != APP_EVENT_LOW_BATTERY)
- return app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, "event type mismatching");
-
- ret = __app_convert_low_battery(event_info->value);
- if (ret < 0)
- return app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, "invalid event info");
-
- *status = ret;
-
- return APP_ERROR_NONE;
-}
-
-int app_event_get_language(app_event_info_h event_info, char **lang)
-{
- if (event_info == NULL || event_info->value == NULL || lang == NULL)
- return app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, "null parameter");
-
- if (event_info->type != APP_EVENT_LANGUAGE_CHANGED)
- return app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, "event type mismatching");
-
- *lang = strdup(event_info->value);
-
- return APP_ERROR_NONE;
-}
-
-int app_event_get_region_format(app_event_info_h event_info, char **region)
-{
- if (event_info == NULL || event_info->value == NULL || region == NULL)
- return app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, "null parameter");
-
- if (event_info->type != APP_EVENT_REGION_FORMAT_CHANGED)
- return app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, "event type mismatching");
-
- *region = strdup(event_info->value);
-
- return APP_ERROR_NONE;
-}
-
-int app_event_get_device_orientation(app_event_info_h event_info, app_device_orientation_e *orientation)
-{
- if (event_info == NULL || orientation == NULL)
- return app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, "null parameter");
-
- if (event_info->type != APP_EVENT_DEVICE_ORIENTATION_CHANGED)
- return app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, "event type mismatching");
-
- *orientation = app_convert_appcore_rm(*(enum appcore_base_rm *)(event_info->value));
-
- return APP_ERROR_NONE;
-}
-
-int app_event_get_suspended_state(app_event_info_h event_info, app_suspended_state_e *state)
-{
- if (event_info == NULL || state == NULL)
- return app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, "null parameter");
-
- if (event_info->type != APP_EVENT_SUSPENDED_STATE_CHANGED)
- return app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, "event type mismatching");
-
- if (*(enum appcore_base_suspended_state *)(event_info->value) == APPCORE_BASE_SUSPENDED_STATE_WILL_ENTER_SUSPEND)
- *state = APP_SUSPENDED_STATE_WILL_ENTER;
- else if (*(enum appcore_base_suspended_state *)(event_info->value) == APPCORE_BASE_SUSPENDED_STATE_DID_EXIT_FROM_SUSPEND)
- *state = APP_SUSPENDED_STATE_DID_EXIT;
-
- return APP_ERROR_NONE;
-}
-
diff --git a/app_common/app_finalizer.c b/app_common/app_finalizer.c
deleted file mode 100644
index 2e840ea..0000000
--- a/app_common/app_finalizer.c
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright (c) 2011 - 2016 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 <libintl.h>
-
-#include <app_internal.h>
-
-typedef struct _app_finalizer_s_ {
- app_finalizer_cb callback;
- void *data;
- struct _app_finalizer_s_ *next;
-} app_finalizer_s;
-
-typedef app_finalizer_s *app_finalizer_h;
-
-static app_finalizer_s finalizer_head = {
- .callback = NULL,
- .data = NULL,
- .next = NULL
-};
-
-int app_finalizer_add(app_finalizer_cb callback, void *data)
-{
- app_finalizer_h finalizer_tail = &finalizer_head;
- app_finalizer_h finalizer_new;
-
- finalizer_new = malloc(sizeof(app_finalizer_s));
- if (finalizer_new == NULL)
- return app_error(APP_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
-
- finalizer_new->callback = callback;
- finalizer_new->data = data;
- finalizer_new->next = NULL;
-
- while (finalizer_tail->next)
- finalizer_tail = finalizer_tail->next;
-
- finalizer_tail->next = finalizer_new;
-
- return APP_ERROR_NONE;
-}
-
-int app_finalizer_remove(app_finalizer_cb callback)
-{
- app_finalizer_h finalizer_node = &finalizer_head;
-
- while (finalizer_node->next) {
- if (finalizer_node->next->callback == callback) {
- app_finalizer_h removed_node = finalizer_node->next;
- finalizer_node->next = removed_node->next;
- free(removed_node);
- return APP_ERROR_NONE;
- }
-
- finalizer_node = finalizer_node->next;
- }
-
- return APP_ERROR_INVALID_PARAMETER;
-}
-
-void app_finalizer_execute(void)
-{
- app_finalizer_h finalizer_node = &finalizer_head;
- app_finalizer_h finalizer_executed;
- app_finalizer_cb finalizer_cb = NULL;
-
- if (finalizer_node)
- finalizer_node = finalizer_node->next;
-
- while (finalizer_node) {
- finalizer_cb = finalizer_node->callback;
-
- finalizer_cb(finalizer_node->data);
-
- finalizer_executed = finalizer_node;
-
- finalizer_node = finalizer_node->next;
-
- free(finalizer_executed);
- }
-
- finalizer_head.next = NULL;
-}
-
diff --git a/app_common/app_package.c b/app_common/app_package.c
deleted file mode 100644
index 8a7cbfa..0000000
--- a/app_common/app_package.c
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * Copyright (c) 2011 - 2016 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 <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-
-#include <aul.h>
-#include <pkgmgr-info.h>
-#include <dlog.h>
-
-#include <app_internal.h>
-
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-
-#define LOG_TAG "CAPI_APPFW_APPLICATION"
-
-int app_get_package_app_name(const char *appid, char **name)
-{
- char *name_token = NULL;
-
- if (appid == NULL)
- return app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-
- /* com.vendor.name -> name */
- name_token = strrchr(appid, '.');
- if (name_token == NULL)
- return app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, NULL);
-
- name_token++;
-
- *name = strdup(name_token);
- if (*name == NULL)
- return app_error(APP_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
-
- return APP_ERROR_NONE;
-}
-
-int app_get_package(char **package)
-{
- return app_get_id(package);
-}
-
-int app_get_id(char **id)
-{
- static char id_buf[TIZEN_PATH_MAX] = {0, };
- int ret = -1;
-
- if (id == NULL)
- return app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-
- if (id_buf[0] == '\0') {
- ret = aul_app_get_appid_bypid(getpid(), id_buf, sizeof(id_buf));
- if (ret < 0)
- return app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, "failed to get the application ID");
- }
-
- if (id_buf[0] == '\0')
- return app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, "failed to get the application ID");
-
- *id = strdup(id_buf);
- if (*id == NULL)
- return app_error(APP_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
-
- return APP_ERROR_NONE;
-}
-
-int app_get_name(char **name)
-{
- int retval = 0;
- char *appid = NULL;
- char *label = NULL;
- pkgmgrinfo_appinfo_h appinfo = NULL;
-
- if (name == NULL)
- return app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-
- if (app_get_id(&appid) != 0)
- return app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, "failed to get the package");
-
- retval = pkgmgrinfo_appinfo_get_usr_appinfo(appid, getuid(), &appinfo);
- if (retval != 0) {
- free(appid);
- return app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
-
- retval = pkgmgrinfo_appinfo_get_label(appinfo, &label);
- if (retval != 0) {
- free(appid);
- pkgmgrinfo_appinfo_destroy_appinfo(appinfo);
- return app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
-
- *name = strdup(label);
- pkgmgrinfo_appinfo_destroy_appinfo(appinfo);
- free(appid);
-
- if (*name == NULL)
- return app_error(APP_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
-
- return APP_ERROR_NONE;
-}
-
-int app_get_version(char **version)
-{
- int retval = 0;
- char *appid = NULL;
- char *pkgid = NULL;
- char *pkg_version = NULL;
- pkgmgrinfo_pkginfo_h pkginfo = NULL;
- pkgmgrinfo_appinfo_h appinfo = NULL;
-
- if (version == NULL)
- return app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-
- if (app_get_id(&appid) != 0)
- return app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, "failed to get the package");
-
- retval = pkgmgrinfo_appinfo_get_usr_appinfo(appid, getuid(), &appinfo);
- if (retval != 0) {
- free(appid);
- return app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
-
- retval = pkgmgrinfo_appinfo_get_pkgid(appinfo, &pkgid);
- if (retval != 0) {
- free(appid);
- pkgmgrinfo_appinfo_destroy_appinfo(appinfo);
- return app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
-
- retval = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &pkginfo);
- if (retval != 0) {
- free(appid);
- pkgmgrinfo_appinfo_destroy_appinfo(appinfo);
- return app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
-
- retval = pkgmgrinfo_pkginfo_get_version(pkginfo, &pkg_version);
- if (retval != 0) {
- free(appid);
- pkgmgrinfo_appinfo_destroy_appinfo(appinfo);
- pkgmgrinfo_pkginfo_destroy_pkginfo(pkginfo);
- return app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
-
- *version = strdup(pkg_version);
- pkgmgrinfo_pkginfo_destroy_pkginfo(pkginfo);
- pkgmgrinfo_appinfo_destroy_appinfo(appinfo);
- free(appid);
-
- if (*version == NULL)
- return app_error(APP_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
-
- return APP_ERROR_NONE;
-}
-
diff --git a/app_common/app_path.c b/app_common/app_path.c
deleted file mode 100644
index 24ccde3..0000000
--- a/app_common/app_path.c
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright (c) 2014 - 2016 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 <string.h>
-#include <aul.h>
-#include <tizen_error.h>
-#include <dlog.h>
-
-#include "app_types.h"
-
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-
-#define LOG_TAG "CAPI_APPFW_APPLICATION"
-
-#define _STRDUP(s) ((s) ? strdup(s) : NULL)
-
-char *app_get_data_path(void)
-{
- const char *buf = aul_get_app_data_path();
- return _STRDUP(buf);
-}
-
-char *app_get_cache_path(void)
-{
- const char *buf = aul_get_app_cache_path();
- return _STRDUP(buf);
-}
-
-char *app_get_resource_path(void)
-{
- const char *buf = aul_get_app_resource_path();
- return _STRDUP(buf);
-}
-
-char *app_get_shared_data_path(void)
-{
- int ret;
- char *path = NULL;
-
- ret = aul_get_app_shared_data_path(&path);
- if (ret == AUL_R_OK && path)
- set_last_result(APP_ERROR_NONE);
- else if (ret == AUL_R_EREJECTED)
- set_last_result(APP_ERROR_PERMISSION_DENIED);
- else
- set_last_result(APP_ERROR_OUT_OF_MEMORY);
-
- return path;
-}
-
-char *app_get_shared_resource_path(void)
-{
- const char *buf = aul_get_app_shared_resource_path();
- return _STRDUP(buf);
-}
-
-char *app_get_shared_trusted_path(void)
-{
- const char *buf = aul_get_app_shared_trusted_path();
- return _STRDUP(buf);
-}
-
-char *app_get_external_data_path(void)
-{
- const char *buf = aul_get_app_external_data_path();
- return _STRDUP(buf);
-}
-
-char *app_get_external_cache_path(void)
-{
- const char *buf = aul_get_app_external_cache_path();
- return _STRDUP(buf);
-}
-
-char *app_get_external_shared_data_path(void)
-{
- dlog_print(DLOG_WARN, LOG_TAG, "DEPRECATION WARNING: app_get_external_shared_data_path() is deprecated and will be removed from next release.");
- const char *buf = aul_get_app_external_shared_data_path();
- return _STRDUP(buf);
-}
-
-char *app_get_tep_resource_path(void)
-{
- const char *buf = aul_get_app_tep_resource_path();
- return _STRDUP(buf);
-}
-
diff --git a/app_common/app_resource_manager.c b/app_common/app_resource_manager.c
deleted file mode 100644
index f7f5ba0..0000000
--- a/app_common/app_resource_manager.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2015 - 2016 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 <aul_rsc_mgr.h>
-#include "app_resource_manager.h"
-
-int app_resource_manager_init()
-{
- return aul_resource_manager_init();
-}
-
-int app_resource_manager_get(app_resource_e type, const char *id, char **path)
-{
- return aul_resource_manager_get((aul_resource_e)type, id, path);
-}
-
-int app_resource_manager_release()
-{
- return aul_resource_manager_release();
-}
-
diff --git a/app_control/CMakeLists.txt b/app_control/CMakeLists.txt
deleted file mode 100644
index 4df198f..0000000
--- a/app_control/CMakeLists.txt
+++ /dev/null
@@ -1,65 +0,0 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-SET(fw_name "capi-appfw-app-control")
-
-PROJECT(${fw_name})
-
-SET(CMAKE_INSTALL_PREFIX /usr)
-SET(PREFIX ${CMAKE_INSTALL_PREFIX})
-
-SET(INC_DIR ${CMAKE_SOURCE_DIR}/include)
-INCLUDE_DIRECTORIES(${INC_DIR})
-
-SET(requires "dlog bundle aul capi-base-common")
-SET(pc_requires "capi-base-common")
-
-INCLUDE(FindPkgConfig)
-pkg_check_modules(${fw_name} REQUIRED ${requires})
-FOREACH(flag ${${fw_name}_CFLAGS})
- SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
-ENDFOREACH(flag)
-
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror")
-SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
-
-IF("${ARCH}" STREQUAL "arm")
- ADD_DEFINITIONS("-DTARGET")
-ENDIF("${ARCH}" STREQUAL "arm")
-
-ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
-ADD_DEFINITIONS("-DSLP_DEBUG")
-
-SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=${LIB_INSTALL_DIR}")
-
-add_library(${fw_name} SHARED
- app_control.c
- )
-
-TARGET_LINK_LIBRARIES(${fw_name} ${${fw_name}_LDFLAGS})
-
-SET_TARGET_PROPERTIES(${fw_name}
- PROPERTIES
- VERSION ${FULLVER}
- SOVERSION ${MAJORVER}
- CLEAN_DIRECT_OUTPUT 1
-)
-
-INSTALL(TARGETS ${fw_name} DESTINATION ${LIB_INSTALL_DIR})
-INSTALL(
- DIRECTORY ${INC_DIR}/ DESTINATION include/appfw
- FILES_MATCHING
- PATTERN "*_private.h" EXCLUDE
- PATTERN "${INC_DIR}/*.h"
- )
-
-SET(PC_NAME ${fw_name})
-SET(PC_REQUIRED ${pc_requires})
-SET(PC_LDFLAGS -l${fw_name})
-
-CONFIGURE_FILE(
- ${CMAKE_SOURCE_DIR}/capi-appfw-module.pc.in
- ${CMAKE_SOURCE_DIR}/${fw_name}.pc
- @ONLY
-)
-INSTALL(FILES ${CMAKE_SOURCE_DIR}/${fw_name}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
-
-
diff --git a/app_control/app_control.c b/app_control/app_control.c
deleted file mode 100755
index 6d51d44..0000000
--- a/app_control/app_control.c
+++ /dev/null
@@ -1,1286 +0,0 @@
-/*
- * Copyright (c) 2011 - 2016 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 <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <errno.h>
-
-#include <bundle.h>
-#include <bundle_internal.h>
-#include <aul.h>
-#include <aul_svc.h>
-#include <dlog.h>
-
-#include <app_control.h>
-#include <app_control_internal.h>
-
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-
-#define LOG_TAG "CAPI_APPFW_APP_CONTROL"
-
-#ifndef TIZEN_PATH_MAX
-#define TIZEN_PATH_MAX 1024
-#endif
-
-#define BUNDLE_KEY_PREFIX_AUL "__AUL_"
-#define BUNDLE_KEY_PREFIX_SERVICE "__APP_SVC_"
-
-#define BUNDLE_KEY_OPERATION "__APP_SVC_OP_TYPE__"
-#define BUNDLE_KEY_URI "__APP_SVC_URI__"
-#define BUNDLE_KEY_MIME "__APP_SVC_MIME_TYPE__"
-#define BUNDLE_KEY_DATA "__APP_SVC_DATA__"
-#define BUNDLE_KEY_PACKAGE "__APP_SVC_PKG_NAME__"
-#define BUNDLE_KEY_WINDOW "__APP_SVC_K_WIN_ID__"
-#define BUNDLE_KEY_CATEGORY "__APP_SVC_CATEGORY__"
-
-#define LAUNCH_MODE_SIZE 8
-#define LAUNCH_MODE_SINGLE "single"
-#define LAUNCH_MODE_GROUP "group"
-
-typedef enum {
- APP_CONTROL_TYPE_REQUEST,
- APP_CONTROL_TYPE_EVENT,
- APP_CONTROL_TYPE_REPLY,
-} app_control_type_e;
-
-struct app_control_s {
- int id;
- app_control_type_e type;
- bundle *data;
- int launch_pid;
-};
-
-typedef struct app_control_request_context_s {
- app_control_h app_control;
- app_control_reply_cb reply_cb;
- void *user_data;
-} *app_control_request_context_h;
-
-static int app_control_create_reply(bundle *data, struct app_control_s **app_control);
-
-static const char *app_control_error_to_string(app_control_error_e error)
-{
- switch (error) {
- case APP_CONTROL_ERROR_NONE:
- return "NONE";
- case APP_CONTROL_ERROR_INVALID_PARAMETER:
- return "INVALID_PARAMETER";
- case APP_CONTROL_ERROR_OUT_OF_MEMORY:
- return "OUT_OF_MEMORY";
- case APP_CONTROL_ERROR_APP_NOT_FOUND:
- return "APP_NOT_FOUND";
- case APP_CONTROL_ERROR_KEY_NOT_FOUND:
- return "KEY_NOT_FOUND";
- case APP_CONTROL_ERROR_KEY_REJECTED:
- return "KEY_REJECTED";
- case APP_CONTROL_ERROR_INVALID_DATA_TYPE:
- return "INVALID_DATA_TYPE";
- case APP_CONTROL_ERROR_LAUNCH_REJECTED:
- return "LAUNCH_REJECTED";
- case APP_CONTROL_ERROR_PERMISSION_DENIED:
- return "PERMISSION_DENIED";
- case APP_CONTROL_ERROR_LAUNCH_FAILED:
- return "LAUNCH_FAILED";
- case APP_CONTROL_ERROR_TIMED_OUT:
- return "TIMED_OUT";
- case APP_CONTROL_ERROR_IO_ERROR:
- return "IO ERROR";
- default:
- return "UNKNOWN";
- }
-}
-
-int app_control_error(app_control_error_e error, const char *function, const char *description)
-{
- if (description)
- LOGE("[%s] %s(0x%08x) : %s", function, app_control_error_to_string(error), error, description);
- else {
- if (error == APP_CONTROL_ERROR_KEY_NOT_FOUND)
- LOGW("[%s] %s(0x%08x)", function, app_control_error_to_string(error), error);
- else
- LOGE("[%s] %s(0x%08x)", function, app_control_error_to_string(error), error);
- }
-
- return error;
-}
-
-static int app_control_validate_extra_data(const char *data)
-{
- if (data == NULL || data[0] == '\0')
- return APP_CONTROL_ERROR_INVALID_PARAMETER;
-
- return APP_CONTROL_ERROR_NONE;
-}
-
-static int app_control_validate(app_control_h app_control)
-{
- if (app_control == NULL || app_control->data == NULL)
- return APP_CONTROL_ERROR_INVALID_PARAMETER;
-
- return APP_CONTROL_ERROR_NONE;
-}
-
-static int app_control_new_id()
-{
- static int sid = 0;
- return sid++;
-}
-
-int app_control_validate_internal_key(const char *key)
-{
- if (strncmp(BUNDLE_KEY_PREFIX_AUL, key, strlen(BUNDLE_KEY_PREFIX_AUL)) == 0)
- return -1;
-
- if (strncmp(BUNDLE_KEY_PREFIX_SERVICE, key, strlen(BUNDLE_KEY_PREFIX_SERVICE)) == 0)
- return -1;
-
- return 0;
-}
-
-/* LCOV_EXCL_START */
-static void app_control_request_result_broker(bundle *appsvc_bundle, int appsvc_request_code, aul_svc_result_val appsvc_result, void *appsvc_data)
-{
- app_control_request_context_h request_context;
- app_control_h request;
- app_control_h reply = NULL;
- app_control_result_e result;
- void *user_data;
- app_control_reply_cb reply_cb;
-
- if (appsvc_data == NULL) {
- app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, "invalid app_control reply");
- return;
- }
-
- if (app_control_create_reply(appsvc_bundle, &reply) != 0) {
- app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, "failed to create app_control reply");
- return;
- }
-
- request_context = appsvc_data;
- request = request_context->app_control;
-
- switch (appsvc_result) {
- case AUL_SVC_RES_OK:
- result = APP_CONTROL_RESULT_SUCCEEDED;
- break;
- case AUL_SVC_RES_NOT_OK:
- result = APP_CONTROL_RESULT_FAILED;
- break;
- case AUL_SVC_RES_CANCEL:
- result = APP_CONTROL_RESULT_CANCELED;
- break;
- default:
- result = APP_CONTROL_RESULT_CANCELED;
- break;
- }
-
- user_data = request_context->user_data;
- reply_cb = request_context->reply_cb;
-
- if (reply_cb != NULL)
- reply_cb(request, reply, result, user_data);
- else
- app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, "invalid callback ");
-
- app_control_destroy(reply);
-
- if (request_context->app_control != NULL)
- app_control_destroy(request_context->app_control);
-
- free(request_context);
-}
-/* LCOV_EXCL_STOP */
-
-int app_control_create_request(bundle *data, app_control_h *app_control)
-{
- struct app_control_s *app_control_request;
-
- if (app_control == NULL)
- return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-
- app_control_request = malloc(sizeof(struct app_control_s));
- if (app_control_request == NULL)
- return app_control_error(APP_CONTROL_ERROR_OUT_OF_MEMORY, __FUNCTION__, "failed to create a app_control handle");
-
- app_control_request->type = APP_CONTROL_TYPE_REQUEST;
-
- if (data != NULL)
- app_control_request->data = bundle_dup(data);
- else
- app_control_request->data = bundle_create();
-
- if (app_control_request->data == NULL) {
- free(app_control_request);
- return app_control_error(APP_CONTROL_ERROR_OUT_OF_MEMORY, __FUNCTION__, "failed to create a bundle");
- }
-
- app_control_request->id = app_control_new_id();
- app_control_request->launch_pid = -1;
-
- *app_control = app_control_request;
-
- return APP_CONTROL_ERROR_NONE;
-}
-
-int app_control_create(app_control_h *app_control)
-{
- return app_control_create_request(NULL, app_control);
-}
-
-int app_control_create_event(bundle *data, struct app_control_s **app_control)
-{
- struct app_control_s *app_control_event;
-
- const char *operation;
-
- if (data == NULL || app_control == NULL)
- return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-
- app_control_event = malloc(sizeof(struct app_control_s));
- if (app_control_event == NULL)
- return app_control_error(APP_CONTROL_ERROR_OUT_OF_MEMORY, __FUNCTION__, "failed to create a app_control handle");
-
- app_control_event->type = APP_CONTROL_TYPE_EVENT;
- app_control_event->data = bundle_dup(data);
- app_control_event->id = app_control_new_id();
-
- operation = aul_svc_get_operation(app_control_event->data);
- if (operation == NULL)
- aul_svc_set_operation(app_control_event->data, APP_CONTROL_OPERATION_DEFAULT);
-
- *app_control = app_control_event;
-
- return APP_CONTROL_ERROR_NONE;
-}
-
-/* LCOV_EXCL_START */
-static int app_control_create_reply(bundle *data, struct app_control_s **app_control)
-{
- struct app_control_s *app_control_reply;
-
- if (data == NULL || app_control == NULL)
- return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-
- app_control_reply = malloc(sizeof(struct app_control_s));
- if (app_control_reply == NULL)
- return app_control_error(APP_CONTROL_ERROR_OUT_OF_MEMORY, __FUNCTION__, "failed to create a app_control handle");
-
- app_control_reply->type = APP_CONTROL_TYPE_REPLY;
- app_control_reply->data = bundle_dup(data);
- app_control_reply->id = app_control_new_id();
-
- *app_control = app_control_reply;
-
- return APP_CONTROL_ERROR_NONE;
-}
-/* LCOV_EXCL_STOP */
-
-int app_control_destroy(app_control_h app_control)
-{
- if (app_control_validate(app_control))
- return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-
- if (app_control->type == APP_CONTROL_TYPE_REQUEST && app_control->launch_pid > 0
- && bundle_get_val(app_control->data, AUL_SVC_K_LAUNCH_RESULT_APP_STARTED) == NULL)
- aul_remove_caller_cb(app_control->launch_pid, app_control);
-
- bundle_free(app_control->data);
- app_control->data = NULL;
- free(app_control);
-
- return APP_CONTROL_ERROR_NONE;
-}
-
-int app_control_to_bundle(app_control_h app_control, bundle **data)
-{
- if (app_control_validate(app_control) || data == NULL)
- return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-
- *data = app_control->data;
-
- return APP_CONTROL_ERROR_NONE;
-}
-
-int app_control_set_operation(app_control_h app_control, const char *operation)
-{
- if (app_control_validate(app_control))
- return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-
- if (operation != NULL) {
- if (aul_svc_set_operation(app_control->data, operation) != 0)
- return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, "invalid operation");
- } else {
- bundle_del(app_control->data, BUNDLE_KEY_OPERATION);
- }
-
- return APP_CONTROL_ERROR_NONE;
-}
-
-int app_control_get_operation(app_control_h app_control, char **operation)
-{
- const char *operation_value;
-
- if (app_control_validate(app_control) || operation == NULL)
- return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-
- operation_value = aul_svc_get_operation(app_control->data);
- if (operation_value) {
- *operation = strdup(operation_value);
- if (*operation == NULL)
- return app_control_error(APP_CONTROL_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
- } else {
- *operation = NULL;
- }
-
- return APP_CONTROL_ERROR_NONE;
-}
-
-int app_control_set_uri(app_control_h app_control, const char *uri)
-{
- if (app_control_validate(app_control))
- return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-
- if (uri != NULL) {
- if (aul_svc_set_uri(app_control->data, uri) != 0)
- return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, "invalid URI");
- } else {
- bundle_del(app_control->data, BUNDLE_KEY_URI);
- }
-
- return APP_CONTROL_ERROR_NONE;
-}
-
-int app_control_get_uri(app_control_h app_control, char **uri)
-{
- const char *uri_value;
-
- if (app_control_validate(app_control) || uri == NULL)
- return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-
- uri_value = aul_svc_get_uri(app_control->data);
- if (uri_value) {
- *uri = strdup(uri_value);
- if (*uri == NULL)
- return app_control_error(APP_CONTROL_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
- } else {
- *uri = NULL;
- }
-
- return APP_CONTROL_ERROR_NONE;
-}
-
-int app_control_set_mime(app_control_h app_control, const char *mime)
-{
- if (app_control_validate(app_control))
- return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-
- if (mime != NULL) {
- if (aul_svc_set_mime(app_control->data, mime) != 0)
- return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, "invalid MIME type");
- } else {
- bundle_del(app_control->data, BUNDLE_KEY_MIME);
- }
-
- return APP_CONTROL_ERROR_NONE;
-}
-
-int app_control_get_mime(app_control_h app_control, char **mime)
-{
- const char *mime_value;
-
- if (app_control_validate(app_control) || mime == NULL)
- return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-
- mime_value = aul_svc_get_mime(app_control->data);
- if (mime_value) {
- *mime = strdup(mime_value);
- if (*mime == NULL)
- return app_control_error(APP_CONTROL_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
- } else {
- *mime = NULL;
- }
-
- return APP_CONTROL_ERROR_NONE;
-}
-
-int app_control_set_category(app_control_h app_control, const char *category)
-{
- if (app_control_validate(app_control))
- return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-
- if (category != NULL) {
- if (aul_svc_set_category(app_control->data, category) != 0)
- return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, "invalid Category");
- } else {
- bundle_del(app_control->data, BUNDLE_KEY_CATEGORY);
- }
-
- return APP_CONTROL_ERROR_NONE;
-}
-
-int app_control_get_category(app_control_h app_control, char **category)
-{
- const char *category_value;
-
- if (app_control_validate(app_control) || category == NULL)
- return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-
- category_value = aul_svc_get_category(app_control->data);
- if (category_value) {
- *category = strdup(category_value);
- if (*category == NULL)
- return app_control_error(APP_CONTROL_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
- } else {
- *category = NULL;
- }
-
- return APP_CONTROL_ERROR_NONE;
-}
-
-int app_control_set_package(app_control_h app_control, const char *package)
-{
- /* TODO: this function must be deprecated */
- return app_control_set_app_id(app_control, package);
-}
-
-int app_control_get_package(app_control_h app_control, char **package)
-{
- /* TODO: this function must be deprecated */
- return app_control_get_app_id(app_control, package);
-}
-
-int app_control_set_app_id(app_control_h app_control, const char *app_id)
-{
- if (app_control_validate(app_control))
- return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-
- if (app_id != NULL) {
- if (aul_svc_set_appid(app_control->data, app_id) != 0)
- return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, "invalid application ID");
- } else {
- bundle_del(app_control->data, BUNDLE_KEY_PACKAGE);
- }
-
- return APP_CONTROL_ERROR_NONE;
-}
-
-int app_control_get_app_id(app_control_h app_control, char **app_id)
-{
- const char *app_id_value;
-
- if (app_control_validate(app_control) || app_id == NULL)
- return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-
- app_id_value = aul_svc_get_appid(app_control->data);
- if (app_id_value) {
- *app_id = strdup(app_id_value);
- if (*app_id == NULL)
- return app_control_error(APP_CONTROL_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
- } else {
- *app_id = NULL;
- }
-
- return APP_CONTROL_ERROR_NONE;
-}
-
-int app_control_set_window(app_control_h app_control, unsigned int id)
-{
- if (app_control_validate(app_control))
- return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-
- if (id > 0) {
- if (aul_svc_allow_transient_app(app_control->data, id) != 0)
- return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, "invalid id");
- } else {
- bundle_del(app_control->data, BUNDLE_KEY_WINDOW);
- }
-
- return APP_CONTROL_ERROR_NONE;
-}
-
-int app_control_get_window(app_control_h app_control, unsigned int *id)
-{
- const char *window_id;
-
- if (app_control_validate(app_control) || id == NULL)
- return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-
- window_id = bundle_get_val(app_control->data, BUNDLE_KEY_WINDOW);
- if (window_id != NULL)
- *id = atoi(window_id);
- else
- *id = 0;
-
- return APP_CONTROL_ERROR_NONE;
-}
-
-int app_control_clone(app_control_h *clone, app_control_h app_control)
-{
- app_control_h app_control_clone;
-
- if (app_control_validate(app_control) || clone == NULL)
- return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-
- app_control_clone = malloc(sizeof(struct app_control_s));
- if (app_control_clone == NULL)
- return app_control_error(APP_CONTROL_ERROR_OUT_OF_MEMORY, __FUNCTION__, "failed to create a app_control handle");
-
- app_control_clone->id = app_control_new_id();
- app_control_clone->type = app_control->type;
- app_control_clone->data = bundle_dup(app_control->data);
-
- *clone = app_control_clone;
-
- return APP_CONTROL_ERROR_NONE;
-}
-
-int app_control_set_launch_mode(app_control_h app_control,
- app_control_launch_mode_e mode)
-{
- const char *launch_mode;
-
- if (app_control_validate(app_control)) {
- return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER,
- __FUNCTION__, NULL);
- }
-
- switch (mode) {
- case APP_CONTROL_LAUNCH_MODE_SINGLE:
- launch_mode = LAUNCH_MODE_SINGLE;
- break;
- case APP_CONTROL_LAUNCH_MODE_GROUP:
- launch_mode = LAUNCH_MODE_GROUP;
- break;
- default:
- return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER,
- __FUNCTION__, "invalid mode");
- }
-
- return aul_svc_set_launch_mode(app_control->data, launch_mode);
-}
-
-int app_control_get_launch_mode(app_control_h app_control,
- app_control_launch_mode_e *mode)
-{
- const char *launch_mode;
-
- if (app_control_validate(app_control)) {
- return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER,
- __FUNCTION__, NULL);
- }
-
- launch_mode = aul_svc_get_launch_mode(app_control->data);
- if (launch_mode == NULL) {
- *mode = APP_CONTROL_LAUNCH_MODE_SINGLE;
- } else {
- if (!strcmp(launch_mode, LAUNCH_MODE_SINGLE)) {
- *mode = APP_CONTROL_LAUNCH_MODE_SINGLE;
- } else if (!strcmp(launch_mode, LAUNCH_MODE_GROUP)) {
- *mode = APP_CONTROL_LAUNCH_MODE_GROUP;
- } else {
- *mode = APP_CONTROL_LAUNCH_MODE_SINGLE;
- return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER,
- __FUNCTION__, "launch_mode is not matched");
- }
- }
-
- return APP_CONTROL_ERROR_NONE;
-}
-
-int app_control_set_defapp(app_control_h app_control, const char *app_id)
-{
- int ret;
-
- if (app_control_validate(app_control) || app_id == NULL)
- return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-
- ret = aul_svc_set_appid(app_control->data, app_id);
- if (ret < 0)
- return app_control_error(APP_CONTROL_ERROR_IO_ERROR, __FUNCTION__, NULL);
-
- ret = aul_set_default_app_by_operation(app_control->data);
- if (ret < 0) {
- if (ret == AUL_R_EILLACC)
- return app_control_error(APP_CONTROL_ERROR_PERMISSION_DENIED, __FUNCTION__, NULL);
- else
- return app_control_error(APP_CONTROL_ERROR_IO_ERROR, __FUNCTION__, NULL);
- }
-
- return APP_CONTROL_ERROR_NONE;
-}
-
-int app_control_unset_defapp(const char *app_id)
-{
- int ret;
-
- if (app_id == NULL)
- return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-
- ret = aul_unset_default_app_by_operation(app_id);
- if (ret < 0) {
- if (ret == AUL_R_EILLACC)
- return app_control_error(APP_CONTROL_ERROR_PERMISSION_DENIED, __FUNCTION__, NULL);
- else
- return app_control_error(APP_CONTROL_ERROR_IO_ERROR, __FUNCTION__, NULL);
- }
-
- return APP_CONTROL_ERROR_NONE;
-}
-
-/* LCOV_EXCL_START */
-static void __update_launch_pid(int launched_pid, void *data)
-{
- app_control_h app_control;
-
- if (data == NULL)
- return;
-
- app_control = data;
-
- app_control->launch_pid = launched_pid;
-}
-/* LCOV_EXCL_STOP */
-
-static void __handle_launch_result(int launched_pid, void *data)
-{
- app_control_request_context_h request_context;
- app_control_h reply = NULL;
- app_control_h request;
- app_control_result_e result;
- app_control_reply_cb reply_cb;
- void *user_data;
- char callee[255] = {0, };
- char instance_id[256] = {0,};
- int ret;
-
- if (data == NULL)
- return;
-
- request_context = (app_control_request_context_h)data;
-
- if (app_control_create_event(request_context->app_control->data, &reply) != 0) {
- app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, "failed to create app_control event");
- return;
- }
-
- ret = aul_app_get_appid_bypid(launched_pid, callee, sizeof(callee));
- if (ret < 0)
- LOGE("aul_app_get_appid_bypid failed: %d", launched_pid);
-
- app_control_set_app_id(reply, callee);
- LOGI("app control async result callback callee pid:%d", launched_pid);
-
- ret = aul_app_get_instance_id_bypid(launched_pid, instance_id,
- sizeof(instance_id));
- if (ret == AUL_R_OK) {
- app_control_set_instance_id(reply, instance_id);
- LOGI("instance id(%s)", instance_id);
- }
-
- result = APP_CONTROL_RESULT_APP_STARTED;
- request = request_context->app_control;
- user_data = request_context->user_data;
- reply_cb = request_context->reply_cb;
-
- if (reply_cb != NULL)
- reply_cb(request, reply, result, user_data);
- else
- app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, "invalid callback ");
-
- app_control_destroy(reply);
-}
-
-int app_control_send_launch_request(app_control_h app_control, app_control_reply_cb callback, void *user_data)
-{
- const char *operation;
- bool implicit_default_operation = false;
- int launch_pid;
- app_control_request_context_h request_context = NULL;
- int ret;
-
- if (app_control_validate(app_control))
- return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-
- operation = aul_svc_get_operation(app_control->data);
- if (operation == NULL) {
- implicit_default_operation = true;
- operation = APP_CONTROL_OPERATION_DEFAULT;
- }
-
- if (!strcmp(operation, APP_CONTROL_OPERATION_LAUNCH_ON_EVENT))
- return app_control_error(APP_CONTROL_ERROR_LAUNCH_REJECTED, __FUNCTION__,
- "Not supported operation value");
-
- /* TODO: Check the privilege for call operation */
-
- /* operation : default */
- if (!strcmp(operation, APP_CONTROL_OPERATION_DEFAULT)) {
- const char *appid = aul_svc_get_appid(app_control->data);
- if (appid == NULL)
- return app_control_error(APP_CONTROL_ERROR_APP_NOT_FOUND, __FUNCTION__, "package must be specified if the operation is default value");
- }
-
- if (callback != NULL) {
- app_control_h request_clone = NULL;
-
- request_context = calloc(1, sizeof(struct app_control_request_context_s));
- if (request_context == NULL)
- return app_control_error(APP_CONTROL_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
-
- request_context->reply_cb = callback;
-
- ret = app_control_clone(&request_clone, app_control);
- if (ret != APP_CONTROL_ERROR_NONE) {
- free(request_context);
- return app_control_error(ret, __FUNCTION__, "failed to clone the app_control request handle");
- }
-
- request_context->app_control = request_clone;
- request_context->user_data = user_data;
- }
-
- if (implicit_default_operation == true)
- aul_svc_set_operation(app_control->data, APP_CONTROL_OPERATION_DEFAULT);
-
- launch_pid = aul_svc_run_service_for_uid(app_control->data, app_control->id, callback ? app_control_request_result_broker : NULL, request_context, getuid());
- if (implicit_default_operation == true)
- bundle_del(app_control->data, BUNDLE_KEY_OPERATION);
-
- if (launch_pid < 0) {
- if (request_context) {
- if (request_context->app_control)
- app_control_destroy(request_context->app_control);
-
- free(request_context);
- }
-
- if (launch_pid == AUL_SVC_RET_ENOMATCH)
- return app_control_error(APP_CONTROL_ERROR_APP_NOT_FOUND, __FUNCTION__, NULL);
- else if (launch_pid == AUL_SVC_RET_EILLACC)
- return app_control_error(APP_CONTROL_ERROR_PERMISSION_DENIED, __FUNCTION__, NULL);
- else if (launch_pid == AUL_SVC_RET_EINVAL)
- return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- else
- return app_control_error(APP_CONTROL_ERROR_LAUNCH_REJECTED, __FUNCTION__, NULL);
- }
-
- app_control->launch_pid = launch_pid;
- /* app_control_enable_app_started_result_event called */
- if (bundle_get_val(app_control->data, AUL_SVC_K_LAUNCH_RESULT_APP_STARTED)) {
- char callee[255] = {0,};
- if (aul_app_get_appid_bypid(launch_pid, callee, sizeof(callee)) != AUL_R_OK)
- LOGE("aul_app_get_appid_bypid failed: %d", launch_pid);
-
- if (request_context && request_context->app_control)
- request_context->app_control->launch_pid = launch_pid;
-
- aul_add_caller_cb(launch_pid, __handle_launch_result, request_context);
-
- /* launched without app selector */
- if ((strcmp(callee, APP_SELECTOR) != 0) &&
- (strcmp(callee, SHARE_PANEL) != 0))
-
- aul_invoke_caller_cb(request_context);
-
- } else { /* default case */
- aul_add_caller_cb(launch_pid, __update_launch_pid, app_control);
- }
-
- return APP_CONTROL_ERROR_NONE;
-}
-
-int app_control_send_terminate_request(app_control_h app_control)
-{
- if (app_control_validate(app_control))
- return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-
- if (app_control->type != APP_CONTROL_TYPE_REQUEST || app_control->launch_pid < 0)
- return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-
- aul_svc_subapp_terminate_request_pid(app_control->launch_pid);
-
- return APP_CONTROL_ERROR_NONE;
-}
-
-/* LCOV_EXCL_START */
-static bool app_control_copy_reply_data_cb(app_control_h app_control, const char *key, void *user_data)
-{
- bundle *reply_data = user_data;
- char *value = NULL;
- char **value_array = NULL;
- int value_array_length = 0;
- int value_array_index = 0;
-
- if (reply_data == NULL) {
- app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- return false;
- }
-
- if (aul_svc_data_is_array(app_control->data, key)) {
- app_control_get_extra_data_array(app_control, key, &value_array, &value_array_length);
- aul_svc_add_data_array(reply_data, key, (const char **)value_array, value_array_length);
-
- for (value_array_index = 0; value_array_index < value_array_length; value_array_index++)
- free(value_array[value_array_index]);
-
- free(value_array);
- } else {
- app_control_get_extra_data(app_control, key, &value);
- aul_svc_add_data(reply_data, key, value);
- free(value);
- }
-
- return true;
-}
-/* LCOV_EXCL_STOP */
-
-int app_control_reply_to_launch_request(app_control_h reply, app_control_h request, app_control_result_e result)
-{
- bundle *reply_data;
- int appsvc_result;
- int ret = 0;
-
- if (app_control_validate(reply) || app_control_validate(request))
- return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-
- if (result == APP_CONTROL_RESULT_APP_STARTED)
- return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, "APP_CONTROL_RESULT_APP_STARTED is not allowed to use");
-
- if (aul_svc_create_result_bundle(request->data, &reply_data) != 0)
- return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, "failed to create a result bundle");
-
- app_control_foreach_extra_data(reply, app_control_copy_reply_data_cb, reply_data);
-
- switch (result) {
- case APP_CONTROL_RESULT_SUCCEEDED:
- appsvc_result = AUL_SVC_RES_OK;
- break;
- case APP_CONTROL_RESULT_FAILED:
- appsvc_result = AUL_SVC_RES_NOT_OK;
- break;
- case APP_CONTROL_RESULT_CANCELED:
- appsvc_result = AUL_SVC_RES_CANCEL;
- break;
- default:
- appsvc_result = AUL_SVC_RES_CANCEL;
- break;
- }
-
- ret = aul_svc_send_result(reply_data, appsvc_result);
- bundle_free(reply_data);
- if (ret < 0) {
- if (ret == AUL_SVC_RET_EINVAL)
- return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- else
- return app_control_error(APP_CONTROL_ERROR_LAUNCH_REJECTED, __FUNCTION__, NULL);
- }
-
- return APP_CONTROL_ERROR_NONE;
-}
-
-
-int app_control_add_extra_data(app_control_h app_control, const char *key, const char *value)
-{
- if (app_control_validate(app_control) || app_control_validate_extra_data(key) || app_control_validate_extra_data(value))
- return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-
- if (app_control_validate_internal_key(key))
- return app_control_error(APP_CONTROL_ERROR_KEY_REJECTED, __FUNCTION__, "the given key is reserved as internal use");
-
- if (aul_svc_get_data(app_control->data, key) != NULL) {
- /* overwrite any existing value */
- bundle_del(app_control->data, key);
- }
-
- if (aul_svc_add_data(app_control->data, key, value) != 0)
- return app_control_error(APP_CONTROL_ERROR_KEY_REJECTED, __FUNCTION__, "failed to add data to the appsvc handle");
-
- return APP_CONTROL_ERROR_NONE;
-}
-
-
-int app_control_add_extra_data_array(app_control_h app_control, const char *key, const char* value[], int length)
-{
- if (app_control_validate(app_control) || app_control_validate_extra_data(key))
- return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-
- if (value == NULL || length <= 0)
- return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, "invalid array");
-
- if (app_control_validate_internal_key(key))
- return app_control_error(APP_CONTROL_ERROR_KEY_REJECTED, __FUNCTION__, "the given key is reserved as internal use");
-
- if (aul_svc_get_data_array(app_control->data, key, NULL) != NULL) {
- /* overwrite any existing value */
- bundle_del(app_control->data, key);
- }
-
- if (aul_svc_add_data_array(app_control->data, key, value, length) != 0)
- return app_control_error(APP_CONTROL_ERROR_KEY_REJECTED, __FUNCTION__, "failed to add array data to the appsvc handle");
-
- return APP_CONTROL_ERROR_NONE;
-}
-
-int app_control_remove_extra_data(app_control_h app_control, const char *key)
-{
- if (app_control_validate(app_control) || app_control_validate_extra_data(key))
- return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-
- if (app_control_validate_internal_key(key))
- return app_control_error(APP_CONTROL_ERROR_KEY_REJECTED, __FUNCTION__, "the given key is reserved as internal use");
-
- if (bundle_del(app_control->data, key))
- return app_control_error(APP_CONTROL_ERROR_KEY_NOT_FOUND, __FUNCTION__, NULL);
-
- return APP_CONTROL_ERROR_NONE;
-}
-
-int app_control_get_extra_data(app_control_h app_control, const char *key, char **value)
-{
- const char *data_value;
-
- if (app_control_validate(app_control) || app_control_validate_extra_data(key) || value == NULL)
- return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-
- if (app_control_validate_internal_key(key))
- return app_control_error(APP_CONTROL_ERROR_KEY_REJECTED, __FUNCTION__, "the given key is reserved as internal use");
-
- data_value = aul_svc_get_data(app_control->data, key);
- if (data_value == NULL) {
- if (errno == ENOTSUP)
- return app_control_error(APP_CONTROL_ERROR_INVALID_DATA_TYPE, __FUNCTION__, NULL);
- else
- return app_control_error(APP_CONTROL_ERROR_KEY_NOT_FOUND, __FUNCTION__, NULL);
- }
-
- *value = strdup(data_value);
- if (*value == NULL)
- return app_control_error(APP_CONTROL_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
-
- return APP_CONTROL_ERROR_NONE;
-}
-
-int app_control_get_extra_data_array(app_control_h app_control, const char *key, char ***value, int *length)
-{
- const char **array_data;
- int array_data_length;
- char **array_data_clone;
- int i;
-
- if (app_control_validate(app_control) || app_control_validate_extra_data(key))
- return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-
- if (value == NULL || length == 0)
- return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-
- if (app_control_validate_internal_key(key))
- return app_control_error(APP_CONTROL_ERROR_KEY_REJECTED, __FUNCTION__, "the given key is reserved as internal use");
-
- array_data = aul_svc_get_data_array(app_control->data, key, &array_data_length);
- if (array_data == NULL) {
- if (errno == ENOTSUP)
- return app_control_error(APP_CONTROL_ERROR_INVALID_DATA_TYPE, __FUNCTION__, NULL);
- else
- return app_control_error(APP_CONTROL_ERROR_KEY_NOT_FOUND, __FUNCTION__, NULL);
- }
-
- array_data_clone = calloc(array_data_length, sizeof(char *));
- if (array_data_clone == NULL)
- return app_control_error(APP_CONTROL_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
-
- for (i = 0; i < array_data_length; i++) {
- if (array_data[i] != NULL) {
- array_data_clone[i] = strdup(array_data[i]);
- if (array_data_clone[i] == NULL)
- goto error_oom;
- }
- }
-
- *value = array_data_clone;
- *length = array_data_length;
-
- return APP_CONTROL_ERROR_NONE;
-
-error_oom:
- for (i = 0; i < array_data_length; i++) {
- if (array_data_clone[i])
- free(array_data_clone[i]);
- }
- free(array_data_clone);
-
- return app_control_error(APP_CONTROL_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
-}
-
-int app_control_is_extra_data_array(app_control_h app_control, const char *key, bool *array)
-{
- if (app_control_validate(app_control) || app_control_validate_extra_data(key) || array == NULL)
- return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-
- if (app_control_validate_internal_key(key))
- return app_control_error(APP_CONTROL_ERROR_KEY_REJECTED, __FUNCTION__, "the given key is reserved as internal use");
-
- if (!aul_svc_data_is_array(app_control->data, key))
- *array = false;
- else
- *array = true;
-
- return APP_CONTROL_ERROR_NONE;
-}
-
-typedef struct {
- app_control_h app_control;
- app_control_extra_data_cb callback;
- void *user_data;
- bool foreach_break;
-} foreach_context_extra_data_t;
-
-static void app_control_cb_broker_bundle_iterator(const char *key, const int type, const bundle_keyval_t *kv, void *user_data)
-{
- foreach_context_extra_data_t *foreach_context = NULL;
- app_control_extra_data_cb extra_data_cb;
-
- if (key == NULL || !(type == BUNDLE_TYPE_STR || type == BUNDLE_TYPE_STR_ARRAY))
- return;
-
- foreach_context = (foreach_context_extra_data_t *)user_data;
- if (foreach_context->foreach_break == true)
- return;
-
- if (app_control_validate_internal_key(key))
- return;
-
- extra_data_cb = foreach_context->callback;
-
- if (extra_data_cb != NULL) {
- bool stop_foreach = false;
-
- stop_foreach = !extra_data_cb(foreach_context->app_control, key, foreach_context->user_data);
-
- foreach_context->foreach_break = stop_foreach;
- }
-}
-
-int app_control_foreach_extra_data(app_control_h app_control, app_control_extra_data_cb callback, void *user_data)
-{
- foreach_context_extra_data_t foreach_context = {
- .app_control = app_control,
- .callback = callback,
- .user_data = user_data,
- .foreach_break = false
- };
-
- if (app_control_validate(app_control) || callback == NULL)
- return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-
- bundle_foreach(app_control->data, app_control_cb_broker_bundle_iterator, &foreach_context);
-
- return APP_CONTROL_ERROR_NONE;
-}
-
-typedef struct {
- app_control_h app_control;
- app_control_app_matched_cb callback;
- void *user_data;
- bool foreach_break;
-} foreach_context_launchable_app_t;
-
-/* LCOV_EXCL_START */
-int app_control_cb_broker_foreach_app_matched(const char *package, void *data)
-{
- foreach_context_launchable_app_t *foreach_context;
- app_control_app_matched_cb app_matched_cb;
-
- if (package == NULL || data == NULL) {
- app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- return -1;
- }
-
- foreach_context = (foreach_context_launchable_app_t *)data;
- if (foreach_context->foreach_break == true)
- return -1;
-
- app_matched_cb = foreach_context->callback;
- if (app_matched_cb != NULL) {
- bool stop_foreach = false;
-
- stop_foreach = !app_matched_cb(foreach_context->app_control, package, foreach_context->user_data);
-
- foreach_context->foreach_break = stop_foreach;
- }
-
- return 0;
-}
-/* LCOV_EXCL_STOP */
-
-int app_control_foreach_app_matched(app_control_h app_control, app_control_app_matched_cb callback, void *user_data)
-{
- foreach_context_launchable_app_t foreach_context = {
- .app_control = app_control,
- .callback = callback,
- .user_data = user_data,
- .foreach_break = false
- };
-
- if (app_control_validate(app_control) || callback == NULL)
- return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-
- aul_svc_get_list_for_uid(app_control->data, app_control_cb_broker_foreach_app_matched, &foreach_context, getuid());
-
- return APP_CONTROL_ERROR_NONE;
-}
-
-int app_control_get_caller(app_control_h app_control, char **package)
-{
- const char *bundle_value;
- char *package_dup;
-
- if (app_control_validate(app_control) || package == NULL)
- return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-
- if (app_control->type != APP_CONTROL_TYPE_EVENT)
- return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, "invalid app_control handle type");
-
- bundle_value = bundle_get_val(app_control->data, AUL_K_CALLER_APPID);
- if (bundle_value == NULL)
- return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, "failed to retrieve the appid of the caller");
-
- package_dup = strdup(bundle_value);
- if (package_dup == NULL)
- return app_control_error(APP_CONTROL_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
-
- *package = package_dup;
-
- return APP_CONTROL_ERROR_NONE;
-}
-
-int app_control_is_reply_requested(app_control_h app_control, bool *requested)
-{
- const char *bundle_value;
-
- if (app_control_validate(app_control) || requested == NULL)
- return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-
- if (app_control->type != APP_CONTROL_TYPE_EVENT)
- return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, "invalid app_control handle type");
-
- bundle_value = bundle_get_val(app_control->data, AUL_K_WAIT_RESULT);
- if (bundle_value != NULL)
- *requested = true;
- else
- *requested = false;
-
- return APP_CONTROL_ERROR_NONE;
-}
-
-int app_control_import_from_bundle(app_control_h app_control, bundle *data)
-{
- bundle *data_dup = NULL;
-
- if (app_control_validate(app_control) || data == NULL)
- return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-
- data_dup = bundle_dup(data);
- if (data_dup == NULL)
- return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, "failed to duplicate the bundle");
-
- if (app_control->data != NULL)
- bundle_free(app_control->data);
-
- app_control->data = data_dup;
-
- return APP_CONTROL_ERROR_NONE;
-}
-
-int app_control_export_as_bundle(app_control_h app_control, bundle **data)
-{
- bundle *data_dup = NULL;
-
- if (app_control_validate(app_control) || data == NULL)
- return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-
- data_dup = bundle_dup(app_control->data);
- if (data_dup == NULL)
- return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, "failed to duplicate the bundle");
-
- *data = data_dup;
-
- return APP_CONTROL_ERROR_NONE;
-}
-
-int app_control_request_transient_app(app_control_h app_control, unsigned int callee_id, app_control_host_res_fn cbfunc, void *data)
-{
- int ret;
-
- if (app_control_validate(app_control))
- return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-
- ret = aul_svc_request_transient_app(app_control->data, callee_id, (aul_svc_host_res_fn)cbfunc, data);
- if (ret < 0)
- return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-
- return APP_CONTROL_ERROR_NONE;
-}
-
-int app_control_enable_app_started_result_event(app_control_h app_control)
-{
- int ret;
-
- if (app_control_validate(app_control))
- return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-
- ret = aul_svc_subscribe_launch_result(app_control->data, AUL_SVC_K_LAUNCH_RESULT_APP_STARTED);
- if (ret < 0)
- return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-
- return APP_CONTROL_ERROR_NONE;
-}
-
-int app_control_set_instance_id(app_control_h app_control, const char *instance_id)
-{
- int ret;
-
- if (app_control_validate(app_control) || instance_id == NULL)
- return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-
- ret = aul_svc_set_instance_id(app_control->data, instance_id);
- if (ret < 0)
- return app_control_error(APP_CONTROL_ERROR_OUT_OF_MEMORY, __FUNCTION__, "Out of memory");
-
- return APP_CONTROL_ERROR_NONE;
-}
-
-int app_control_get_instance_id(app_control_h app_control, char **instance_id)
-{
- const char *id;
-
- if (app_control_validate(app_control) || instance_id == NULL)
- return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-
- id = aul_svc_get_instance_id(app_control->data);
- if (id == NULL)
- return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, "Failed to get the instance id");
-
- *instance_id = strdup(id);
- if (*instance_id == NULL)
- return app_control_error(APP_CONTROL_ERROR_OUT_OF_MEMORY, __FUNCTION__, "Failed to duplicate the instance id");
-
- return APP_CONTROL_ERROR_NONE;
-}
diff --git a/capi-appfw-module.pc.in b/capi-appfw-application.pc.in
index f4504d4..f4504d4 100644
--- a/capi-appfw-module.pc.in
+++ b/capi-appfw-application.pc.in
diff --git a/doc/appfw_app_control_doc.h b/doc/appfw_app_control_doc.h
index caad900..2241492 100755
--- a/doc/appfw_app_control_doc.h
+++ b/doc/appfw_app_control_doc.h
@@ -26,7 +26,7 @@
* \#include <app_control.h>
*
* @section CAPI_APP_CONTROLMODULE_OVERVIEW Overview
- * <a href="https://developer.tizen.org/development/guides/native-application/application-management/application-controls/common-application-controls">Platform Application Controls</a>
+ * <a href="https://developer.tizen.org/development/guides/native-application/application-framework/application#platform_appcontrol">Platform Application Controls</a>
*/
#endif /* __TIZEN_APPFW_APP_CONTROL_DOC_H__ */
diff --git a/event/CMakeLists.txt b/event/CMakeLists.txt
deleted file mode 100644
index da32ca0..0000000
--- a/event/CMakeLists.txt
+++ /dev/null
@@ -1,65 +0,0 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-SET(fw_name "capi-appfw-event")
-
-PROJECT(${fw_name})
-
-SET(CMAKE_INSTALL_PREFIX /usr)
-SET(PREFIX ${CMAKE_INSTALL_PREFIX})
-
-SET(INC_DIR ${CMAKE_SOURCE_DIR}/include)
-INCLUDE_DIRECTORIES(${INC_DIR})
-
-SET(requires "glib-2.0 dlog bundle eventsystem capi-base-common appcore-common")
-SET(pc_requires "capi-base-common")
-
-INCLUDE(FindPkgConfig)
-pkg_check_modules(${fw_name} REQUIRED ${requires})
-FOREACH(flag ${${fw_name}_CFLAGS})
- SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
-ENDFOREACH(flag)
-
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC")
-SET(CMAKE_C_FLAGS_DEBUG "-O0 -g -Wall -Werror")
-
-IF("${ARCH}" STREQUAL "arm")
- ADD_DEFINITIONS("-DTARGET")
-ENDIF("${ARCH}" STREQUAL "arm")
-
-ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
-ADD_DEFINITIONS("-DSLP_DEBUG")
-
-SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=${LIB_INSTALL_DIR}")
-
-add_library(${fw_name} SHARED
- event.c
- )
-
-TARGET_LINK_LIBRARIES(${fw_name} ${${fw_name}_LDFLAGS})
-
-SET_TARGET_PROPERTIES(${fw_name}
- PROPERTIES
- VERSION ${FULLVER}
- SOVERSION ${MAJORVER}
- CLEAN_DIRECT_OUTPUT 1
-)
-
-INSTALL(TARGETS ${fw_name} DESTINATION ${LIB_INSTALL_DIR})
-INSTALL(
- DIRECTORY ${INC_DIR}/ DESTINATION include/appfw
- FILES_MATCHING
- PATTERN "*_private.h" EXCLUDE
- PATTERN "${INC_DIR}/*.h"
- )
-
-SET(PC_NAME ${fw_name})
-SET(PC_REQUIRED ${pc_requires})
-SET(PC_LDFLAGS -l${fw_name})
-
-CONFIGURE_FILE(
- ${CMAKE_SOURCE_DIR}/capi-appfw-module.pc.in
- ${CMAKE_SOURCE_DIR}/${fw_name}.pc
- @ONLY
-)
-INSTALL(FILES ${CMAKE_SOURCE_DIR}/${fw_name}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
-
-
diff --git a/event/event.c b/event/event.c
deleted file mode 100644
index edb6c16..0000000
--- a/event/event.c
+++ /dev/null
@@ -1,284 +0,0 @@
-/*
- * Copyright (c) 2015 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 <stdlib.h>
-#include <glib.h>
-#include <tizen.h>
-#include <dlog.h>
-#include <app_event.h>
-#include <eventsystem.h>
-#include <app_internal.h>
-
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-
-#define LOG_TAG "CAPI_APPFW_EVENT"
-
-typedef struct event_handler {
- char *event_name;
- int event_type;
- unsigned int reg_id;
- event_cb cb;
- void *user_data;
-} event_handler_s;
-
-typedef struct event_cb_data {
- bundle *event_data;
- void *user_data;
-} event_cb_data_s;
-
-static GHashTable *interested_event_table;
-static int _initialized;
-static event_cb earlier_callback;
-static pthread_mutex_t register_sync_lock = PTHREAD_MUTEX_INITIALIZER;
-
-static const char *event_error_to_string(event_error_e error)
-{
- switch (error) {
- case EVENT_ERROR_NONE:
- return "NONE";
- case EVENT_ERROR_INVALID_PARAMETER:
- return "INVALID_PARAMETER";
- case EVENT_ERROR_OUT_OF_MEMORY:
- return "OUT_OF_MEMORY";
- case EVENT_ERROR_TIMED_OUT:
- return "TIMED_OUT";
- case EVENT_ERROR_IO_ERROR:
- return "IO ERROR";
- case EVENT_ERROR_PERMISSION_DENIED:
- return "PERMISSION DENIED";
- default:
- return "UNKNOWN";
- }
-}
-
-int event_error(event_error_e error, const char *function, const char *description)
-{
- if (description) {
- LOGE("[%s] %s(0x%08x) : %s", function, event_error_to_string(error),
- error, description);
- } else {
- LOGE("[%s] %s(0x%08x)", function, event_error_to_string(error), error);
- }
-
- return error;
-}
-
-static void event_do_cb(gpointer data, gpointer user_data)
-{
- event_handler_h handler = (event_handler_h)data;
- event_cb_data_s *cb_data = (event_cb_data_s *)user_data;
-
- if (handler->cb) {
- handler->cb(handler->event_name,
- cb_data->event_data, cb_data->user_data);
- }
-}
-
-static void event_eventsystem_callback(const char *event_name,
- bundle_raw *event_data, int len, void *user_data)
-{
- bundle *b_to = NULL;
- bundle *b = NULL;
-
- LOGD("event_name(%s)", event_name);
-
- if (earlier_callback != NULL) {
- b_to = bundle_decode(event_data, len);
- if (b_to == NULL) {
- LOGE("bundle_decode failed");
- return;
- }
- earlier_callback(event_name, b_to, user_data);
- bundle_free(b_to);
- return;
- }
-
- GList *handler_list = (GList *)g_hash_table_lookup(interested_event_table,
- event_name);
- if (handler_list) {
- event_cb_data_s *cb_data = NULL;
- cb_data = calloc(1, sizeof(event_cb_data_s));
- if (cb_data == NULL) {
- LOGE("memory alloc failed");
- return;
- }
- b_to = bundle_decode(event_data, len);
- if (b_to == NULL) {
- LOGE("bundle_decode failed");
- free(cb_data);
- return;
- }
- b = bundle_dup(b_to);
- bundle_free(b_to);
-
- cb_data->event_data = b;
- cb_data->user_data = user_data;
-
- g_list_foreach(handler_list, event_do_cb, cb_data);
-
- bundle_free(b);
- }
-}
-
-int event_add_event_handler(const char *event_name, event_cb callback, void *user_data,
- event_handler_h *event_handler)
-{
- int ret = 0;
- int event_type = 0;
- unsigned int reg_id = 0;
- event_handler_h handler = NULL;
-
- if (!_initialized) {
- if (interested_event_table == NULL) {
- interested_event_table = g_hash_table_new(g_str_hash, g_str_equal);
- if (interested_event_table == NULL) {
- return event_error(EVENT_ERROR_OUT_OF_MEMORY,
- __FUNCTION__, NULL);
- }
- }
- _initialized = 1;
- }
-
- if (event_handler == NULL || event_name == NULL || callback == NULL)
- return event_error(EVENT_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-
- handler = calloc(1, sizeof(event_handler_s));
- if (handler == NULL)
- return event_error(EVENT_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
-
- pthread_mutex_lock(&register_sync_lock);
- earlier_callback = callback;
- ret = eventsystem_register_application_event(event_name, &reg_id, &event_type,
- (eventsystem_cb)event_eventsystem_callback, user_data);
- earlier_callback = NULL;
- pthread_mutex_unlock(&register_sync_lock);
- if (ret < 0) {
- free(handler);
- if (ret == ES_R_ENOTPERMITTED)
- return event_error(EVENT_ERROR_PERMISSION_DENIED, __FUNCTION__, NULL);
- else
- return event_error(EVENT_ERROR_IO_ERROR, __FUNCTION__, NULL);
- }
-
- handler->event_name = strdup(event_name);
- if (handler->event_name == NULL) {
- free(handler);
- return event_error(EVENT_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
- }
-
- handler->reg_id = reg_id;
- handler->event_type = event_type;
- handler->cb = callback;
- handler->user_data = user_data;
-
- *event_handler = handler;
-
- GList *handler_list = (GList *)g_hash_table_lookup(interested_event_table,
- handler->event_name);
- if (handler_list) {
- LOGD("add new handler");
- handler_list = g_list_append(handler_list, handler);
- } else {
- LOGD("add new table item");
- GList *ehl = NULL;
- ehl = g_list_append(ehl, handler);
- g_hash_table_insert(interested_event_table, handler->event_name, ehl);
- }
-
- return EVENT_ERROR_NONE;
-}
-
-int event_remove_event_handler(event_handler_h event_handler)
-{
- int ret = 0;
-
- if (!_initialized) {
- LOGI("handler list is not initialized");
- return EVENT_ERROR_NONE;
- }
-
- if (event_handler == NULL)
- return event_error(EVENT_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-
- ret = eventsystem_unregister_application_event(event_handler->reg_id);
- if (ret < 0)
- return event_error(EVENT_ERROR_IO_ERROR, __FUNCTION__, NULL);
-
- GList *handler_list = (GList *)g_hash_table_lookup(interested_event_table,
- event_handler->event_name);
- if (handler_list) {
- GList *list = NULL;
- list = g_list_find(handler_list, event_handler);
- if (list) {
- LOGD("remove match handler");
- handler_list = g_list_remove_all(handler_list, event_handler);
- GList *first_list = NULL;
- first_list = g_list_first(handler_list);
- if (first_list == NULL) {
- LOGD("remove table item");
- g_hash_table_remove(interested_event_table,
- event_handler->event_name);
- }
- }
- }
-
- free(event_handler->event_name);
- free(event_handler);
-
- return EVENT_ERROR_NONE;
-}
-
-int event_publish_app_event(const char *event_name, bundle *event_data)
-{
- if (event_data == NULL || event_name == NULL)
- return event_error(EVENT_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-
- if (eventsystem_send_user_event(event_name, event_data, false) < 0)
- return event_error(EVENT_ERROR_IO_ERROR, __FUNCTION__, NULL);
-
- return EVENT_ERROR_NONE;
-}
-
-int event_publish_trusted_app_event(const char *event_name, bundle *event_data)
-{
- if (event_data == NULL || event_name == NULL)
- return event_error(EVENT_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-
- if (eventsystem_send_user_event(event_name, event_data, true) < 0)
- return event_error(EVENT_ERROR_IO_ERROR, __FUNCTION__, NULL);
-
- return EVENT_ERROR_NONE;
-}
-
-int event_keep_last_event_data(const char *event_name)
-{
- int ret;
-
- if (event_name == NULL)
- return event_error(EVENT_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-
- ret = eventsystem_keep_last_event_data(event_name);
- if (ret < 0) {
- if (ret == ES_R_ENOMEM)
- return event_error(EVENT_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
- else
- return event_error(EVENT_ERROR_IO_ERROR, __FUNCTION__, NULL);
- }
-
- return EVENT_ERROR_NONE;
-}
diff --git a/include/app_common.h b/include/app_common.h
deleted file mode 100644
index 5f30490..0000000
--- a/include/app_common.h
+++ /dev/null
@@ -1,423 +0,0 @@
-/*
- * Copyright (c) 2014 - 2016 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.
- */
-
-
-#ifndef __TIZEN_APPFW_APP_COMMON_H__
-#define __TIZEN_APPFW_APP_COMMON_H__
-
-#include <app_types.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/**
- * @file app_common.h
- */
-
-/**
- * @addtogroup CAPI_APP_COMMON_MODULE
- * @{
- */
-
-
-/**
- * @brief Enumeration for system events.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-typedef enum {
- APP_EVENT_LOW_MEMORY, /**< The low memory event */
- APP_EVENT_LOW_BATTERY, /**< The low battery event */
- APP_EVENT_LANGUAGE_CHANGED, /**< The system language changed event */
- APP_EVENT_DEVICE_ORIENTATION_CHANGED, /**< The device orientation changed event */
- APP_EVENT_REGION_FORMAT_CHANGED, /**< The region format changed event */
- APP_EVENT_SUSPENDED_STATE_CHANGED, /**< The suspended state changed event of the application (since @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif)
- @see app_event_get_suspended_state */
- APP_EVENT_UPDATE_REQUESTED, /**< The update requested event (Since 3.0)
- This event can occur when an app needs to be updated.
- It is dependent on target devices. */
-} app_event_type_e;
-
-
-/**
- * @brief Enumeration for device orientation.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-typedef enum {
- APP_DEVICE_ORIENTATION_0 = 0, /**< The device is oriented in a natural position */
- APP_DEVICE_ORIENTATION_90 = 90, /**< The device's left side is at the top */
- APP_DEVICE_ORIENTATION_180 = 180, /**< The device is upside down */
- APP_DEVICE_ORIENTATION_270 = 270, /**< The device's right side is at the top */
-} app_device_orientation_e;
-
-
-/**
- * @brief Enumeration for low memory status.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-typedef enum {
- APP_EVENT_LOW_MEMORY_NORMAL = 0x01, /**< Normal status */
- APP_EVENT_LOW_MEMORY_SOFT_WARNING = 0x02, /**< Soft warning status */
- APP_EVENT_LOW_MEMORY_HARD_WARNING = 0x04, /**< Hard warning status */
-} app_event_low_memory_status_e;
-
-
-/**
- * @brief Enumeration for battery status.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-typedef enum {
- APP_EVENT_LOW_BATTERY_POWER_OFF = 1, /**< The battery status is under 1% */
- APP_EVENT_LOW_BATTERY_CRITICAL_LOW, /**< The battery status is under 5% */
-} app_event_low_battery_status_e;
-
-
-/**
- * @brief Enumeration for suspended state.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- */
-typedef enum {
- APP_SUSPENDED_STATE_WILL_ENTER = 0, /**< Application will enter the suspended state */
- APP_SUSPENDED_STATE_DID_EXIT, /**< Application did exit from the suspended state */
-} app_suspended_state_e;
-
-
-/**
- * @brief The event handler that returned from add event handler function to handle.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @see app_event_type_e
- * @see app_add_event_handler
- * @see app_remove_event_handler
- * @see app_event_info_h
- */
-typedef struct app_event_handler *app_event_handler_h;
-
-
-/**
- * @brief The system event information handle.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @see app_event_get_low_memory_status
- * @see app_event_get_low_battery_status
- * @see app_event_get_language
- * @see app_event_get_region_format
- * @see app_event_get_device_orientation
- * @see app_event_get_suspended_state
- */
-typedef struct app_event_info *app_event_info_h;
-
-
-/**
- * @brief The system event callback function.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @param[in] event_info The system event information
- * @param[in] user_data The user data passed from the add event handler function
- * @see app_add_event_handler
- * @see app_event_info_h
- * @remarks If the given @a event_info has #APP_SUSPENDED_STATE_WILL_ENTER value,
- * the application should not call any asynchronous operations in this callback.
- * After the callback returns, process of the application will be changed to suspended
- * state immediately. Thus, asynchronous operations may work incorrectly. (since @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif)
- */
-typedef void (*app_event_cb)(app_event_info_h event_info, void *user_data);
-
-
-/**
- * @brief Gets the low memory status from the given event info.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @param[in] event_info The system event info
- * @param[out] status The low memory status
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #APP_ERROR_NONE Successful
- * @retval #APP_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #APP_ERROR_INVALID_CONTEXT Invalid event context
- * @see app_event_info_h
- * @see app_event_low_memory_status_e
- */
-int app_event_get_low_memory_status(app_event_info_h event_info, app_event_low_memory_status_e *status);
-
-
-/**
- * @brief Gets the low battery status from given event info.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @param[in] event_info The system event info
- * @param[out] status The low battery status
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #APP_ERROR_NONE Successful
- * @retval #APP_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #APP_ERROR_INVALID_CONTEXT Invalid event context
- * @see app_event_info_h
- * @see app_event_low_battery_status_e
- */
-int app_event_get_low_battery_status(app_event_info_h event_info, app_event_low_battery_status_e *status);
-
-
-/**
- * @brief Gets the language from the given event info.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @remarks @a lang must be released using free().
- * @param[in] event_info The system event info
- * @param[out] lang The language changed
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #APP_ERROR_NONE Successful
- * @retval #APP_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #APP_ERROR_INVALID_CONTEXT Invalid event context
- * @see app_event_info_h
- */
-int app_event_get_language(app_event_info_h event_info, char **lang);
-
-
-/**
- * @brief Gets the region format from the given event info.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @remarks @a region must be released using free().
- * @param[in] event_info The system event info
- * @param[out] region The region format changed
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #APP_ERROR_NONE Successful
- * @retval #APP_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #APP_ERROR_INVALID_CONTEXT Invalid event context
- * @see app_event_info_h
- */
-int app_event_get_region_format(app_event_info_h event_info, char **region);
-
-
-/**
- * @brief Gets the device orientation from the given event info.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @param[in] event_info The system event info
- * @param[out] orientation The device orientation changed
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #APP_ERROR_NONE Successful
- * @retval #APP_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #APP_ERROR_INVALID_CONTEXT Invalid event context
- * @see app_event_info_h
- * @see app_device_orientation_e
- */
-int app_event_get_device_orientation(app_event_info_h event_info, app_device_orientation_e *orientation);
-
-
-/**
- * @brief Gets the suspended state of the application from the given event info.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @remarks The application should not use any asynchronous operations in #APP_SUSPENDED_STATE_WILL_ENTER event.
- * Because applications will be changed to suspended state just after #APP_SUSPENDED_STATE_WILL_ENTER, asynchronous calls are not guaranteed to work properly.
- * @param[in] event_info The handle for getting the suspended state
- * @param[out] state The suspended state of the application
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #APP_ERROR_NONE Successful
- * @retval #APP_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #APP_ERROR_INVALID_CONTEXT Invalid event context
- */
-int app_event_get_suspended_state(app_event_info_h event_info, app_suspended_state_e *state);
-
-
-/**
- * @brief Gets the ID of the application.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @remarks @a id must be released using free().
- * @param[out] id The ID of the application
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #APP_ERROR_NONE Successful
- * @retval #APP_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #APP_ERROR_INVALID_CONTEXT The application is launched illegally, not launched by the launch system
- * @retval #APP_ERROR_OUT_OF_MEMORY Out of memory
- */
-int app_get_id(char **id);
-
-
-/**
- * @brief Gets the localized name of the application.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @remarks @a name must be released using free().
- * @param[out] name The name of the application
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #APP_ERROR_NONE Successful
- * @retval #APP_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #APP_ERROR_INVALID_CONTEXT The application is launched illegally, not launched by the launch system
- * @retval #APP_ERROR_OUT_OF_MEMORY Out of memory
- */
-int app_get_name(char **name);
-
-
-/**
- * @brief Gets the version of the application package.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @remarks @a version must be released using free().
- * @param[out] version The version of the application
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #APP_ERROR_NONE Successful
- * @retval #APP_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #APP_ERROR_INVALID_CONTEXT The application is launched illegally, not launched by the launch system
- * @retval #APP_ERROR_OUT_OF_MEMORY Out of memory
- */
-int app_get_version(char **version);
-
-
-/**
- * @brief Gets the absolute path to the application's data directory which is used to store private data of the application.
- * @details An application can read and write its own files in the application's data directory.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @remarks The returned path should be released.
- * @return The absolute path to the application's data directory, @n
- * otherwise a null pointer if the memory is insufficient
- */
-char *app_get_data_path(void);
-
-
-/**
- * @brief Gets the absolute path to the application's cache directory which is used to store temporary data of the application.
- * @details An application can read and write its own files in the application's cache directory.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @remarks The returned path should be released. @n
- * The files stored in the application's cache directory can be removed by setting application or platform while the application is running.
- * @return The absolute path to the application's cache directory, @n
- * otherwise a null pointer if the memory is insufficient
- */
-char *app_get_cache_path(void);
-
-
-/**
- * @brief Gets the absolute path to the application resource directory. The resource files are delivered with the application package.
- * @details An application can only read its own files in the application's resource directory.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @remarks The returned path should be released.
- * @return The absolute path to the application's resource directory, @n
- * otherwise a null pointer if the memory is insufficient
- */
-char *app_get_resource_path(void);
-
-
-/**
- * @brief Gets the absolute path to the application's shared data directory which is used to share data with other applications.
- * @details An application can read and write its own files in the application's shared data directory and others can only read the files.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @privlevel public
- * @privilege %http://tizen.org/privilege/appdir.shareddata
- * @remarks The returned path should be released. @n
- * Since Tizen 3.0, an application that want to use shared/data directory must declare http://tizen.org/privilege/appdir.shareddata privilege. If the application doesn't declare the privilege, the framework will not create shared/data directory for the application.
- * Carefully consider the privacy implications when deciding whether to use the shared/data directory, since the application cannot control access to this directory by other applications.
- * If you want to share files with other applications, consider passing path via @ref CAPI_APP_CONTROL_MODULE API.
- * The @ref CAPI_APP_CONTROL_MODULE API supports giving permission to other applications by passing path via app_control. @n
- * The specific error code can be obtained using the get_last_result(). Error codes are described in Exception section.
- *
- * @return The absolute path to the application's shared data directory, @n
- * otherwise a null pointer if the memory is insufficient. It will return NULL for applications with api-version 3.0 or later, and set #APP_ERROR_PERMISSION_DENIED if the application does not declare the shareddata privilege.
- * @exception APP_ERROR_NONE Success
- * @exception APP_ERROR_OUT_OF_MEMORY Out of memory
- * @exception APP_ERROR_PERMISSION_DENIED Permission denied
- */
-char *app_get_shared_data_path(void);
-
-
-/**
- * @brief Gets the absolute path to the application's shared resource directory which is used to share resources with other applications.
- * @details An application can read its own files in the application's shared resource directory, and others can only read the files.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @remarks The returned path should be released.
- * @return The absolute path to the application's shared resource directory, @n
- * otherwise a null pointer if the memory is insufficient
- */
-char *app_get_shared_resource_path(void);
-
-
-/**
- * @brief Gets the absolute path to the application's shared trusted directory which is used to share data with a family of trusted applications.
- * @details An application can read and write its own files in the application's shared trusted directory
- * and the family applications signed with the same certificate can read and write the files in the shared trusted directory.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @remarks The returned path should be released.
- * @return The absolute path to the application's shared trusted directory, @n
- * otherwise a null pointer if the memory is insufficient
- */
-char *app_get_shared_trusted_path(void);
-
-
-/**
- * @brief Gets the absolute path to the application's external data directory which is used to store data of the application.
- * @details An application can read and write its own files in the application's external data directory.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @remarks The returned path should be released. @n
- * The important files stored in the application's external data directory should be encrypted because they can be exported via the external sdcard.
- * To access the path returned by this function requires the privilege
- * that is "http://tizen.org/privilege/externalstorage.appdata".
- * @return The absolute path to the application's external data directory, @n
- * otherwise a null pointer if the memory is insufficient
- */
-char *app_get_external_data_path(void);
-
-
-/**
- * @brief Gets the absolute path to the application's external cache directory which is used to store temporary data of the application.
- * @details An application can read and write its own files in the application's external cache directory.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @remarks The returned path should be released. @n
- * The files stored in the application's external cache directory can be removed by
- * setting application while the application is running. @n
- * The important files stored in the application's external cache directory should be
- * encrypted because they can be exported via the external sdcard.
- * To access the path returned by this function requires the privilege
- * that is "http://tizen.org/privilege/externalstorage.appdata".
- * @return The absolute path to the application's external cache directory, @n
- * otherwise a null pointer if the memory is insufficient
- */
-char *app_get_external_cache_path(void);
-
-
-/**
- * @deprecated Deprecated since @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif.
- * @brief Gets the absolute path to the application's external shared data directory which is used to share data with other applications.
- * @details An application can read and write its own files in the application's external shared data directory, and others can only read the files.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @remarks The specified @a path should be released.
- * To access the path returned by this function requires the privilege
- * that is "http://tizen.org/privilege/externalstorage.appdata".
- * The function may not work as intended in certain devices due to some implementation issues.
- * @return The absolute path to the application's external shared data directory, @n
- * otherwise a null pointer if the memory is insufficient
- */
-char *app_get_external_shared_data_path(void) TIZEN_DEPRECATED_API;
-
-
-/**
- * @brief Gets the absolute path to the application's TEP(Tizen Expansion Package) directory. The resource files are delivered with the expansion package.
- * @details An application can only read its own files in the application's TEP(Tizen Expansion Package) directory.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @remarks The returned path should be released.
- * @return The absolute path to the application's TEP(Tizen Expansion Package) directory, @n
- * otherwise a null pointer if the memory is insufficient
- **/
-char *app_get_tep_resource_path(void);
-
-/**
- * @}
- */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __TIZEN_APPFW_APP_H__ */
-
diff --git a/include/app_control.h b/include/app_control.h
deleted file mode 100644
index 1ba1372..0000000
--- a/include/app_control.h
+++ /dev/null
@@ -1,1177 +0,0 @@
-/*
- * Copyright (c) 2014 - 2016 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.
- */
-
-
-#ifndef __TIZEN_APPFW_APP_CONTROL_H__
-#define __TIZEN_APPFW_APP_CONTROL_H__
-
-#include <tizen.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @file app_control.h
- */
-
-/**
- * @addtogroup CAPI_APP_CONTROL_MODULE
- * @{
- */
-
-
-typedef struct _bundle_t bundle;
-typedef unsigned char bundle_raw;
-
-/**
- * @brief App Control handle.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-typedef struct app_control_s *app_control_h;
-
-
-/**
- * @brief Enumeration for App Control Error.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-typedef enum {
- APP_CONTROL_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
- APP_CONTROL_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
- APP_CONTROL_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
- APP_CONTROL_ERROR_APP_NOT_FOUND = TIZEN_ERROR_APPLICATION | 0x21, /**< The application is not found */
- APP_CONTROL_ERROR_KEY_NOT_FOUND = TIZEN_ERROR_KEY_NOT_AVAILABLE, /**< Specified key is not found */
- APP_CONTROL_ERROR_KEY_REJECTED = TIZEN_ERROR_KEY_REJECTED, /**< Key is not available */
- APP_CONTROL_ERROR_INVALID_DATA_TYPE = TIZEN_ERROR_APPLICATION | 0x22, /**< Invalid data type */
- APP_CONTROL_ERROR_LAUNCH_REJECTED = TIZEN_ERROR_APPLICATION | 0x23, /**< The application cannot be launched now*/
- APP_CONTROL_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */
- APP_CONTROL_ERROR_LAUNCH_FAILED = TIZEN_ERROR_APPLICATION | 0x24, /**< Internal launch error */
- APP_CONTROL_ERROR_TIMED_OUT = TIZEN_ERROR_TIMED_OUT, /**< Time out */
- APP_CONTROL_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR /**< IO error */
-} app_control_error_e;
-
-
-/**
- * @brief Enumeration for App Control Result.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @see app_control_enable_app_started_result_event()
- */
-typedef enum {
- APP_CONTROL_RESULT_APP_STARTED = 1, /**< Callee application launched actually (Since @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif) */
- APP_CONTROL_RESULT_SUCCEEDED = 0, /**< Operation succeeded */
- APP_CONTROL_RESULT_FAILED = -1, /**< Operation failed by the callee */
- APP_CONTROL_RESULT_CANCELED = -2, /**< Operation canceled by the platform */
-} app_control_result_e;
-
-
-/**
- * @brief Enumeration for App Control Launch Mode.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- */
-typedef enum {
- APP_CONTROL_LAUNCH_MODE_SINGLE = 0, /**< Prefer to launch an application as single mode */
- APP_CONTROL_LAUNCH_MODE_GROUP, /**< Prefer to launch an application as group mode */
-} app_control_launch_mode_e;
-
-
-/**
- * @brief Definition for the app_control operation: An explicit launch for a homescreen application.
- * @details Input: Nothing\n
- * Output: Nothing\n
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define APP_CONTROL_OPERATION_MAIN "http://tizen.org/appcontrol/operation/main"
-
-
-/**
- * @brief Definition for the app_control operation: An explicit launch for an application that excludes a homescreen application.
- * @details Input: Nothing\n
- * Output: Nothing\n
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define APP_CONTROL_OPERATION_DEFAULT "http://tizen.org/appcontrol/operation/default"
-
-
-/**
- * @brief Definition for the app_control operation: Provides an editable access to the given data.
- * @details Input: It depends on application scenario/configuration.\n
- * Output: It depends on application scenario/configuration.\n
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define APP_CONTROL_OPERATION_EDIT "http://tizen.org/appcontrol/operation/edit"
-
-
-/**
- * @brief Definition for the app_control operation: Displays the data.
- * @details Input: URI is usually used to inform the path to show. In some cases, some other data in Extra can be used (e.g., VIEW operation for viewing Contact, Calendar data).\n
- * Output: Nothing\n
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define APP_CONTROL_OPERATION_VIEW "http://tizen.org/appcontrol/operation/view"
-
-
-/**
- * @brief Definition for the app_control operation: Picks item.
- * @details Input: It depends on application scenario/configuration.\n
- * Output: APP_CONTROL_DATA_SELECTED in Extra\n
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define APP_CONTROL_OPERATION_PICK "http://tizen.org/appcontrol/operation/pick"
-
-
-/**
- * @brief Definition for the app_control operation: Creates contents.
- * @details Input: It depends on application scenario/configuration.\n
- * Output: APP_CONTROL_DATA_SELECTED in Extra\n
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define APP_CONTROL_OPERATION_CREATE_CONTENT "http://tizen.org/appcontrol/operation/create_content"
-
-
-/**
- * @brief Definition for the app_control operation: Performs a call to someone.
- * @details Input: URI is the number to be dialed. This is a mandatory field.\n
- * Output: Nothing\n
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @privlevel public
- * @privilege %http://tizen.org/privilege/call
- * @remarks When you request this operation, you must declare this privilege.
- */
-#define APP_CONTROL_OPERATION_CALL "http://tizen.org/appcontrol/operation/call"
-
-
-/**
- * @brief Definition for the app_control operation: Delivers some data to someone else.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @deprecated Deprecated since @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif. Use #APP_CONTROL_OPERATION_SHARE instead.
- */
-#define APP_CONTROL_OPERATION_SEND "http://tizen.org/appcontrol/operation/send"
-
-
-/**
- * @brief Definition for the app_control operation: Delivers text data to someone else.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @deprecated Deprecated since @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif. Use #APP_CONTROL_OPERATION_SHARE_TEXT instead.
- */
-#define APP_CONTROL_OPERATION_SEND_TEXT "http://tizen.org/appcontrol/operation/send_text"
-
-
-/**
- * @brief Definition for the app_control operation: Shares an item with someone else.
- * @details Input: URI is usually used to inform the path to share. In some cases, some other data in Extra can be used (e.g., SHARE operation for sharing Contact data, SHARE operation for sharing an item through Message, Email applications).\n
- * Output: Nothing\n
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define APP_CONTROL_OPERATION_SHARE "http://tizen.org/appcontrol/operation/share"
-
-
-/**
- * @brief Definition for the app_control operation: Shares multiple items with someone else.
- * @details Input: APP_CONTROL_DATA_PATH in Extra is usually used to inform the data to share. In some cases, some other data in Extra can be used (e.g., MULTI_SHARE opeation for sharing Contact data).\n
- * Output: Nothing\n
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define APP_CONTROL_OPERATION_MULTI_SHARE "http://tizen.org/appcontrol/operation/multi_share"
-
-
-/**
- * @brief Definition for the app_control operation: Shares text data with someone else.
- * @details Input: APP_CONTROL_DATA_TEXT in Extra is the text to share\n
- * Output: Nothing\n
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define APP_CONTROL_OPERATION_SHARE_TEXT "http://tizen.org/appcontrol/operation/share_text"
-
-
-/**
- * @brief Definition for the app_control operation: Dials a number. This shows a UI with the number to be dialed, allowing the user to explicitly initiate the call.
- * @details Input: URI is the number to be dialed. If empty, show a UI without number.\n
- * Output: Nothing\n
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define APP_CONTROL_OPERATION_DIAL "http://tizen.org/appcontrol/operation/dial"
-
-
-/**
- * @brief Definition for the app_control operation: Performs a search.
- * @details Input: APP_CONTROL_DATA_TEXT in Extra is the text to search for. If empty, show a search UI.\n
- * Output: Nothing\n
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define APP_CONTROL_OPERATION_SEARCH "http://tizen.org/appcontrol/operation/search"
-
-
-/**
- * @brief Definition for the app_control operation: Downloads item.
- * @details Input: It depends on application scenario/configuration.\n
- * Output: It depends on application scenario/configuration.\n
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @privlevel public
- * @privilege %http://tizen.org/privilege/download (Since @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif)
- * @remarks When you request this operation, you must declare this privilege. (Since @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif)
- */
-#define APP_CONTROL_OPERATION_DOWNLOAD "http://tizen.org/appcontrol/operation/download"
-
-
-/**
- * @brief Definition for the app_control operation: Prints content.
- * @details Input: It depends on application scenario/configuration.\n
- * Output: It depends on application scenario/configuration.\n
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define APP_CONTROL_OPERATION_PRINT "http://tizen.org/appcontrol/operation/print"
-
-
-/**
- * @brief Definition for the app_control operation: Composes a message.
- * @details Input: It depends on application scenario/configuration.\n
- * Output: Nothing\n
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define APP_CONTROL_OPERATION_COMPOSE "http://tizen.org/appcontrol/operation/compose"
-
-
-/**
- * @brief Definition for the app_control operation: Can be launched by interested System-Event.
- * @details Input : URI and extras data defined in Event module.\n
- * Output: Nothing\n
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @remarks This operation is for handling event from the platform. This operation cannot be requested through app_control_send_launch_request().
- * @remarks Refer to Launch-On-Event section of Event module.
- */
-#define APP_CONTROL_OPERATION_LAUNCH_ON_EVENT "http://tizen.org/appcontrol/operation/launch_on_event"
-
-
-/**
- * @brief Definition for the app_control operation: Adds an item.
- * @details Input: It depends on application scenario/configuration.\n
- * Output: It depends on application scenario/configuration.\n
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- */
-#define APP_CONTROL_OPERATION_ADD "http://tizen.org/appcontrol/operation/add"
-
-
-/**
- * @brief Definition for the app_control operation: Captures images by camera applications.
- * @details Input: Nothing\n
- * Output: APP_CONTROL_DATA_SELECTED in Extra\n
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- */
-#define APP_CONTROL_OPERATION_IMAGE_CAPTURE "http://tizen.org/appcontrol/operation/image_capture"
-
-
-/**
- * @brief Definition for the app_control operation: Captures videos by camera applications.
- * @details Input: Nothing\n
- * Output: APP_CONTROL_DATA_SELECTED in Extra\n
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- */
-#define APP_CONTROL_OPERATION_VIDEO_CAPTURE "http://tizen.org/appcontrol/operation/video_capture"
-
-
-/**
- * @brief Definition for the app_control operation: Shows settings to enable Bluetooth.
- * @details Input: Nothing\n
- * Output: Nothing\n
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- */
-#define APP_CONTROL_OPERATION_SETTING_BT_ENABLE "http://tizen.org/appcontrol/operation/setting/bt_enable"
-
-
-/**
- * @brief Definition for the app_control operation: Shows settings to configure Bluetooth visibility.
- * @details Input: Nothing\n
- * Output: Nothing\n
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- */
-#define APP_CONTROL_OPERATION_SETTING_BT_VISIBILITY "http://tizen.org/appcontrol/operation/setting/bt_visibility"
-
-
-/**
- * @brief Definition for the app_control operation: Shows settings to allow configuration of current location sources.
- * @details Input: Nothing\n
- * Output: Nothing\n
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- */
-#define APP_CONTROL_OPERATION_SETTING_LOCATION "http://tizen.org/appcontrol/operation/setting/location"
-
-
-/**
- * @brief Definition for the app_control operation: Shows NFC settings.
- * @details Input: APP_CONTROL_DATA_TYPE in Extra (Since 3.0).\n
- * Output: Nothing\n
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @remarks Prior to Tizen 3.0, no input value was needed.
- */
-#define APP_CONTROL_OPERATION_SETTING_NFC "http://tizen.org/appcontrol/operation/setting/nfc"
-
-
-/**
- * @brief Definition for the app_control operation: Shows system settings.
- * @details Input: Nothing\n
- * Output: Nothing\n
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- */
-#define APP_CONTROL_OPERATION_SETTING "http://tizen.org/appcontrol/operation/setting"
-
-
-/**
- * @brief Definition for the app_control operation: Shows settings to allow configuration of Wi-Fi.
- * @details Input: Nothing\n
- * Output: Nothing\n
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- */
-#define APP_CONTROL_OPERATION_SETTING_WIFI "http://tizen.org/appcontrol/operation/setting/wifi"
-
-
-/**
- * @brief Definition for the app control operation: Shows VPN service settings.
- * @details Input: Nothing\n
- * Output: Nothing\n
- * @since_tizen 3.0
- */
-#define APP_CONTROL_OPERATION_SETTING_VPN "http://tizen.org/appcontrol/operation/setting/vpn"
-
-
-/**
- * @brief Definition for the app control operation: Select the type of input method to receive input from user.
- * @details Input: It depends on application scenario/configuration.\n
- * Output: APP_CONTROL_DATA_TEXT in Extra.\n
- * @since_tizen @if WEARABLE 2.3.2 @elseif MOBILE 3.0 @endif
- */
-#define APP_CONTROL_OPERATION_GET_INPUT "http://tizen.org/appcontrol/operation/get_input"
-
-
-/**
- * @brief Definition for app_control data: Subject
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define APP_CONTROL_DATA_SUBJECT "http://tizen.org/appcontrol/data/subject"
-
-
-/**
- * @brief Definition for app_control data: Recipients
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define APP_CONTROL_DATA_TO "http://tizen.org/appcontrol/data/to"
-
-
-/**
- * @brief Definition for app_control data: E-mail addresses that should be carbon copied.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define APP_CONTROL_DATA_CC "http://tizen.org/appcontrol/data/cc"
-
-
-/**
- * @brief Definition for app_control data: E-mail addresses that should be blind carbon copied.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define APP_CONTROL_DATA_BCC "http://tizen.org/appcontrol/data/bcc"
-
-
-/**
- * @brief Definition for app_control data: Text
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define APP_CONTROL_DATA_TEXT "http://tizen.org/appcontrol/data/text"
-
-
-/**
- * @brief Definition for app_control data: Title
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define APP_CONTROL_DATA_TITLE "http://tizen.org/appcontrol/data/title"
-
-
-/**
- * @brief Definition for app_control data: Selected items
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @remarks Since Tizen 3.0, if all added paths with this key are under the caller application's data path which can be obtained by calling app_get_data_path() function, those will be shared to the callee application. Framework will grant a temporary permission to the callee application for those files and revoke it when the callee application is terminated. Paths should be regular files. The callee application can just read them. Note that the callee application doesn't have read permission of the directory that is obtained by caller's app_get_data_path(), you should open the file path with read only mode directly. For example, access() call to the file path will return error because access() needs the read permission of the directory. The callee application can call open() with O_RDONLY mode for the passed file path, because framework grants read permission to the passed file path.
- */
-#define APP_CONTROL_DATA_SELECTED "http://tizen.org/appcontrol/data/selected"
-
-
-/**
- * @brief Definition for app_control data: Paths of items
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @remarks Since Tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif, if all added paths with this key are under the caller application's data path which can be obtained by calling app_get_data_path() function, those will be shared to the callee application. Framework will grant a temporary permission to the callee application for those files and revoke it when the callee application is terminated. Paths should be regular files. The callee application can just read them. Note that the callee application doesn't have read permission of the directory that is obtained by caller's app_get_data_path(), you should open the file path with read only mode directly. For example, access() call to the file path will return error because access() needs the read permission of the directory. The callee application can call open() with O_RDONLY mode for the passed file path, because framework grants read permission to the passed file path.
- */
-#define APP_CONTROL_DATA_PATH "http://tizen.org/appcontrol/data/path"
-
-
-/**
- * @brief Definition for app_control data: Selection mode ("single" or "multiple")
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define APP_CONTROL_DATA_SELECTION_MODE "http://tizen.org/appcontrol/data/selection_mode"
-
-
-/**
- * @brief Definition for app_control data: All-day mode of event ("true" or "false")
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- */
-#define APP_CONTROL_DATA_CALENDAR_ALL_DAY "http://tizen.org/appcontrol/data/calendar/all_day"
-
-
-/**
- * @brief Definition for app_control data: Start time of event (format: YYYY-MM-DD HH:MM:SS)
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- */
-#define APP_CONTROL_DATA_CALENDAR_START_TIME "http://tizen.org/appcontrol/data/calendar/start_time"
-
-
-/**
- * @brief Definition for app_control data: End time of event (format: YYYY-MM-DD HH:MM:SS)
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- */
-#define APP_CONTROL_DATA_CALENDAR_END_TIME "http://tizen.org/appcontrol/data/calendar/end_time"
-
-
-/**
- * @brief Definition for app_control data: E-mail addresses
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- */
-#define APP_CONTROL_DATA_EMAIL "http://tizen.org/appcontrol/data/email"
-
-
-/**
- * @brief Definition for app_control data: Phone numbers
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- */
-#define APP_CONTROL_DATA_PHONE "http://tizen.org/appcontrol/data/phone"
-
-
-/**
- * @brief Definition for app_control data: URLs
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- */
-#define APP_CONTROL_DATA_URL "http://tizen.org/appcontrol/data/url"
-
-
-/**
- * @brief Definition for app_control data: IDs
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- */
-#define APP_CONTROL_DATA_ID "http://tizen.org/appcontrol/data/id"
-
-
-/**
- * @brief Definition for app_control data: Type
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 2.3.2 @endif
- */
-#define APP_CONTROL_DATA_TYPE "http://tizen.org/appcontrol/data/type"
-
-
-/**
- * @brief Definition for app_control data: Total count
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- */
-#define APP_CONTROL_DATA_TOTAL_COUNT "http://tizen.org/appcontrol/data/total_count"
-
-
-/**
- * @brief Definition for app_control data: Total size (unit : bytes)
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- */
-#define APP_CONTROL_DATA_TOTAL_SIZE "http://tizen.org/appcontrol/data/total_size"
-
-
-/**
- * @brief Definition for app_control data: Name
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- */
-#define APP_CONTROL_DATA_NAME "http://tizen.org/appcontrol/data/name"
-
-
-/**
- * @brief Definition for app_control data: Location
- * @since_tizen 3.0
- */
-#define APP_CONTROL_DATA_LOCATION "http://tizen.org/appcontrol/data/location"
-
-
-/**
- * @brief Definition for app_control data: Select the type of input method.
- * @details Type: "input_voice" Launch input method with voice type.
- * "input_emoticon" Launch input method with emoticon type.
- * "input_keyboard" Launch input method with keyboard type.
- * @since_tizen @if WEARABLE 2.3.2 @elseif MOBILE 3.0 @endif
- */
-#define APP_CONTROL_DATA_INPUT_TYPE "http://tizen.org/appcontrol/data/input_type"
-
-
-/**
- * @brief Definition for app_control data: Send the pre input text such as "http://" in web.
- * @since_tizen @if WEARABLE 2.3.2 @elseif MOBILE 3.0 @endif
- */
-#define APP_CONTROL_DATA_INPUT_DEFAULT_TEXT "http://tizen.org/appcontrol/data/input_default_text"
-
-
-/**
- * @brief Definition for app_control data: Send guide text to show the user such as "Input user name".
- * @since_tizen @if WEARABLE 2.3.2 @elseif MOBILE 3.0 @endif
- */
-#define APP_CONTROL_DATA_INPUT_GUIDE_TEXT "http://tizen.org/appcontrol/data/input_guide_text"
-
-
-/**
- * @brief Definition for app_control data: Send text to receive the result from smart reply.
- * @since_tizen @if WEARABLE 2.3.2 @elseif MOBILE 3.0 @endif
- */
-#define APP_CONTROL_DATA_INPUT_PREDICTION_HINT "http://tizen.org/appcontrol/data/input_prediction_hint"
-
-
-/**
- * @brief Definition for app_control data: Send widget instance id to widget setup app.
- * @details The value is the id of the widget instance.
- * @since_tizen 4.0
- */
-#define APP_CONTROL_DATA_WIDGET_INSTANCE_ID "http://tizen.org/appcontrol/data/widget_instance_id"
-
-
-/**
- * @brief Definition for app_control data: Send widget content to widget setup app.
- * @details The value is the content info of the widget instance.
- * @since_tizen 4.0
- */
-#define APP_CONTROL_DATA_WIDGET_CONTENT "http://tizen.org/appcontrol/data/widget_content"
-
-
-/**
- * @brief Definition for app_control data: Send widget appid to widget setup app.
- * @details The value is the appid declared in the widget application manifest file.
- * @since_tizen 4.0
- */
-#define APP_CONTROL_DATA_WIDGET_APP_ID "http://tizen.org/appcontrol/data/widget_app_id"
-
-
-/**
- * @brief Called when the reply of the launch request is delivered.
- *
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @remarks The @a request and @a reply must not be deallocated by the application.
- * @param[in] request The app_control handle of the launch request that has been sent
- * @param[in] reply The app_control handle in which the results of the callee are contained
- * @param[in] result The result code of the launch request
- * @param[in] user_data The user data passed from the callback registration function
- * @pre When the callee replies to the launch request, this callback will be invoked.
- * @pre Since @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif, if #APP_CONTROL_RESULT_APP_STARTED event is enabled,
- * this callback will also be invoked when the callee app actually launched.
- * @see app_control_send_launch_request()
- * @see app_control_reply_to_launch_request()
- * @see app_control_enable_app_started_result_event()
- * @see #APP_CONTROL_RESULT_APP_STARTED
- */
-typedef void (*app_control_reply_cb) (app_control_h request, app_control_h reply, app_control_result_e result, void *user_data);
-
-
-/**
- * @brief Called to retrieve the extra data contained in the app_control.
- *
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @remarks The @a key must not be deallocated by the application.
- * @param[in] app_control The app_control handle
- * @param[in] key The key of the value contained in the app_control
- * @param[in] user_data The user data passed from the foreach function
- * @return @c true to continue with the next iteration of the loop,
- * otherwise @c false to break out of the loop
- * @pre app_control_foreach_extra_data() will invoke this callback.
- * @see app_control_foreach_extra_data()
- */
-typedef bool (*app_control_extra_data_cb)(app_control_h app_control, const char *key, void *user_data);
-
-
-/**
- * @brief Called once for each matched application that can be launched to handle the given app_control request.
- *
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @param[in] app_control The app_control handle
- * @param[in] package The package name of the application that can handle the launch request of the given app_control
- * @param[in] user_data The user data passed from the foreach function
- * @return @c true to continue with the next iteration of the loop,
- * otherwise @c false to break out of the loop
- * @pre app_control_foreach_app_matched() will invoke this callback.
- * @see app_control_foreach_app_matched()
- */
-typedef bool (*app_control_app_matched_cb)(app_control_h app_control, const char *appid, void *user_data);
-
-
-typedef int (*app_control_host_res_fn)(void *data);
-
-/**
- * @brief Creates an app_control handle.
- *
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @remarks The @a app_control must be released using app_control_destroy().
- * @param[out] app_control The app_control handle to be newly created on success
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #APP_CONTROL_ERROR_NONE Successful
- * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
- * @see app_control_destroy()
- */
-int app_control_create(app_control_h *app_control);
-
-
-/**
- * @brief Destroys the app_control handle and releases all its resources.
- *
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @param[in] app_control The app_control handle
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #APP_CONTROL_ERROR_NONE Successful
- * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
- * @see app_control_create()
- */
-int app_control_destroy(app_control_h app_control);
-
-
-/**
- * @brief Sets the operation to be performed.
- *
- * @details The @a operation is the mandatory information for the launch request.
- * If the operation is not specified, #APP_CONTROL_OPERATION_DEFAULT is used for the launch request.
- * If the operation is #APP_CONTROL_OPERATION_DEFAULT, the package information is mandatory to explicitly launch the application.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @param[in] app_control The app_control handle
- * @param[in] operation The operation to be performed (if the @a operation is @c NULL, it clears the previous value)
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #APP_CONTROL_ERROR_NONE Successful
- * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
- * @see app_control_get_operation()
- * @see APP_CONTROL_OPERATION_DEFAULT
- * @see APP_CONTROL_OPERATION_EDIT
- * @see APP_CONTROL_OPERATION_VIEW
- * @see APP_CONTROL_OPERATION_PICK
- * @see APP_CONTROL_OPERATION_CREATE_CONTENT
- * @see APP_CONTROL_OPERATION_CALL
- * @see APP_CONTROL_OPERATION_SEND
- * @see APP_CONTROL_OPERATION_SEND_TEXT
- * @see APP_CONTROL_OPERATION_DIAL
- * @see APP_CONTROL_OPERATION_SEARCH
- */
-int app_control_set_operation(app_control_h app_control, const char *operation);
-
-
-/**
- * @brief Gets the operation to be performed.
- *
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @remarks The @a operation must be released using free().
- * @param[in] app_control The app_control handle
- * @param[out] operation The operation to be performed
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #APP_CONTROL_ERROR_NONE Successful
- * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
- * @see app_control_set_operation()
- */
-int app_control_get_operation(app_control_h app_control, char **operation);
-
-
-/**
- * @brief Sets the URI of the data.
- *
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @remarks Since Tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif, if the parameter 'uri' is started with 'file://' and it is a regular file in this application's data path which can be obtained by calling app_get_data_path() function, it will be shared to the callee application. Framework will grant a temporary permission to the callee application for this file and revoke it when the callee application is terminated. The callee application can just read it.
- * @param[in] app_control The app_control handle
- * @param[in] uri The URI of the data this app_control is operating on (if the @a uri is @c NULL, it clears the previous value)
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #APP_CONTROL_ERROR_NONE Successful
- * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
- * @see app_control_get_uri()
- */
-int app_control_set_uri(app_control_h app_control, const char *uri);
-
-
-/**
- * @brief Gets the URI of the data.
- *
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @remarks The @a uri must be released using free().
- * @param[in] app_control The app_control handle
- * @param[out] uri The URI of the data this app_control is operating on
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #APP_CONTROL_ERROR_NONE Successful
- * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
- * @see app_control_set_uri()
- */
-int app_control_get_uri(app_control_h app_control, char **uri);
-
-
-/**
- * @brief Sets the explicit MIME type of the data.
- *
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @param[in] app_control The app_control handle
- * @param[in] mime The explicit MIME type of the data this app_control is operating on (if the @a mime is @c NULL, it clears the previous value)
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #APP_CONTROL_ERROR_NONE Successful
- * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
- * @see app_control_get_mime()
- */
-int app_control_set_mime(app_control_h app_control, const char *mime);
-
-
-/**
- * @brief Gets the explicit MIME type of the data.
- *
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @remarks The @a uri must be released using free().
- * @param[in] app_control The app_control handle
- * @param[out] mime The explicit MIME type of the data this app_control is operating on
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #APP_CONTROL_ERROR_NONE Successful
- * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
- * @see app_control_set_mime()
- */
-int app_control_get_mime(app_control_h app_control, char **mime);
-
-
-/**
- * @brief Sets the explicit category.
- *
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @param[in] app_control The app_control handle
- * @param[in] category The explicit category (if the @a category is @c NULL, it clears the previous value)
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #APP_CONTROL_ERROR_NONE Successful
- * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
- * @see app_control_get_category()
- */
-int app_control_set_category(app_control_h app_control, const char *category);
-
-
-/**
- * @brief Gets the explicit category.
- *
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @remarks The @a category must be released using free().
- * @param[in] app_control The app_control handle
- * @param[out] category The explicit category
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #APP_CONTROL_ERROR_NONE Successful
- * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
- * @see app_control_set_category()
- */
-int app_control_get_category(app_control_h app_control, char **category);
-
-
-/**
- * @brief Sets the ID of the application to explicitly launch.
- *
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @param[in] app_control The app_control handle
- * @param[in] app_id The ID of the application to explicitly launch (if the @a app_id is @c NULL, it clears the previous value)
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #APP_CONTROL_ERROR_NONE Successful
- * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
- * @see app_control_get_app_id()
- */
-int app_control_set_app_id(app_control_h app_control, const char *app_id);
-
-
-/**
- * @brief Gets the ID of the application to explicitly launch.
- *
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @remarks The @a app_id must be released with free().
- * @param[in] app_control The app_control handle
- * @param[out] app_id The ID of the application to explicitly launch
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #APP_CONTROL_ERROR_NONE Successful
- * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
- * @see app_control_set_app_id()
- */
-int app_control_get_app_id(app_control_h app_control, char **app_id);
-
-/**
- * @brief Adds extra data to the app_control.
- *
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @remarks The function replaces any existing value for the given key.
- * @remarks The function returns #APP_CONTROL_ERROR_INVALID_PARAMETER if @a key or @a value is a zero-length string.
- * @remarks The function returns #APP_CONTROL_ERROR_KEY_REJECTED if the application tries to use the same key with system-defined key.
- * @param[in] app_control The app_control handle
- * @param[in] key The name of the extra data
- * @param[in] value The value associated with the given key
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #APP_CONTROL_ERROR_NONE Successful
- * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #APP_CONTROL_ERROR_KEY_REJECTED Key not available
- * @see app_control_add_extra_data_array()
- * @see app_control_remove_extra_data()
- * @see app_control_get_extra_data()
- */
-int app_control_add_extra_data(app_control_h app_control, const char *key, const char *value);
-
-
-/**
- * @brief Adds the extra data array to the app_control.
- *
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @remarks The function replaces any existing value for the given key.
- * @remarks The function returns #APP_CONTROL_ERROR_INVALID_PARAMETER if @a key is a zero-length string.
- * @remarks The function returns #APP_CONTROL_ERROR_KEY_REJECTED if the application tries to use the same key with system-defined key.
- * @param[in] app_control The app_control handle
- * @param[in] key The name of the extra data
- * @param[in] value The array value associated with the given key
- * @param[in] length The length of the array
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #APP_CONTROL_ERROR_NONE Successful
- * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #APP_CONTROL_ERROR_KEY_REJECTED Key not available
- * @see app_control_add_extra_data()
- * @see app_control_remove_extra_data()
- * @see app_control_get_extra_data()
- */
-int app_control_add_extra_data_array(app_control_h app_control, const char *key, const char* value[], int length);
-
-
-/**
- * @brief Removes the extra data from the app_control.
- *
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @param[in] app_control The app_control handle
- * @param[in] key The name of the extra data
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #APP_CONTROL_ERROR_NONE Successful
- * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #APP_CONTROL_ERROR_KEY_NOT_FOUND Specified key not found
- * @retval #APP_CONTROL_ERROR_KEY_REJECTED Key not available
- * @see app_control_add_extra_data()
- * @see app_control_add_extra_data_array()
- * @see app_control_get_extra_data()
- */
-int app_control_remove_extra_data(app_control_h app_control, const char *key);
-
-
-/**
- * @brief Gets the extra data from the app_control.
- *
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @remarks The @a value must be released using free().
- * @remarks The function returns #APP_CONTROL_ERROR_INVALID_DATA_TYPE if @a value is of array data type.
- * @param[in] app_control The app_control handle
- * @param[in] key The name of the extra data
- * @param[out] value The value associated with the given key
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #APP_CONTROL_ERROR_NONE Successful
- * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #APP_CONTROL_ERROR_KEY_NOT_FOUND Specified key not found
- * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #APP_CONTROL_ERROR_INVALID_DATA_TYPE Invalid data type
- * @retval #APP_CONTROL_ERROR_KEY_REJECTED Key not available
- * @see app_control_add_extra_data()
- * @see app_control_add_extra_data_array()
- * @see app_control_get_extra_data()
- * @see app_control_remove_extra_data()
- * @see app_control_foreach_extra_data()
- */
-int app_control_get_extra_data(app_control_h app_control, const char *key, char **value);
-
-
-/**
- * @brief Gets the extra data array from the app_control.
- *
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @remarks The @a value must be released using free().
- * @remarks The function returns #APP_CONTROL_ERROR_INVALID_DATA_TYPE if @a value is not of array data type.
- * @param[in] app_control The app_control handle
- * @param[in] key The name of the extra data
- * @param[out] value The array value associated with the given key
- * @param[out] length The length of the array
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #APP_CONTROL_ERROR_NONE Successful
- * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #APP_CONTROL_ERROR_KEY_NOT_FOUND Specified key not found
- * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #APP_CONTROL_ERROR_INVALID_DATA_TYPE Invalid data type
- * @retval #APP_CONTROL_ERROR_KEY_REJECTED Key not available
- * @see app_control_add_extra_data()
- * @see app_control_add_extra_data_array()
- * @see app_control_remove_extra_data()
- * @see app_control_foreach_extra_data()
- */
-int app_control_get_extra_data_array(app_control_h app_control, const char *key, char ***value, int *length);
-
-
-/**
- * @brief Checks whether the extra data associated with the given @a key is of array data type.
- *
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @param[in] app_control The app_control handle
- * @param[in] key The name of the extra data
- * @param[out] array If @c true the extra data is of array data type,
- * otherwise @c false
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #APP_CONTROL_ERROR_NONE Successful
- * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
- * @see app_control_add_extra_data()
- * @see app_control_add_extra_data_array()
- * @see app_control_remove_extra_data()
- * @see app_control_foreach_extra_data()
- */
-int app_control_is_extra_data_array(app_control_h app_control, const char *key, bool *array);
-
-
-/**
- * @brief Retrieves all extra data contained in app_control.
- * @details This function calls app_control_extra_data_cb() once for each key-value pair for extra data contained in app_control. \n
- * If the app_control_extra_data_cb() callback function returns @c false, then iteration will be finished.
- *
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @param[in] app_control The app_control handle
- * @param[in] callback The iteration callback function
- * @param[in] user_data The user data to be passed to the callback function
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #APP_CONTROL_ERROR_NONE Successful
- * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
- * @post This function invokes app_control_extra_data_cb().
- * @see app_control_extra_data_cb()
- */
-int app_control_foreach_extra_data(app_control_h app_control, app_control_extra_data_cb callback, void *user_data);
-
-
-/**
- * @brief Retrieves all applications that can be launched to handle the given app_control request.
- *
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @param[in] app_control The app_control handle
- * @param[in] callback The iteration callback function
- * @param[in] user_data The user data to be passed to the callback function
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #APP_CONTROL_ERROR_NONE Success
- * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
- * @post This function invokes app_control_app_matched_cb().
- * @see app_control_app_matched_cb()
- */
-int app_control_foreach_app_matched(app_control_h app_control, app_control_app_matched_cb callback, void *user_data);
-
-
-/**
- * @brief Sends the launch request.
- *
- * @details The operation is mandatory information for the launch request. \n
- * If the operation is not specified, #APP_CONTROL_OPERATION_DEFAULT is used by default.
- * If the operation is #APP_CONTROL_OPERATION_DEFAULT, the application ID is mandatory to explicitly launch the application.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @privlevel public
- * @privilege %http://tizen.org/privilege/appmanager.launch
- * @remarks The function returns #APP_CONTROL_ERROR_LAUNCH_REJECTED if the operation value is #APP_CONTROL_OPERATION_LAUNCH_ON_EVENT which is only for handling the event from the platform or other application, refer to @a Event module.
- * @remarks Since Tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif, the launch request of the service application over out of packages is restricted by the platform. Also, implicit launch requests are NOT delivered to service applications since @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif. To launch a service application, an explicit launch request with application ID given by app_control_set_app_id() MUST be sent.
- * @param[in] app_control The app_control handle
- * @param[in] callback The callback function to be called when the reply is delivered
- * @param[in] user_data The user data to be passed to the callback function
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #APP_CONTROL_ERROR_NONE Successful
- * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #APP_CONTROL_ERROR_APP_NOT_FOUND The application to run the given launch request is not found
- * @retval #APP_CONTROL_ERROR_LAUNCH_REJECTED The application cannot be launched in current context
- * @retval #APP_CONTROL_ERROR_LAUNCH_FAILED Failed to launch the application
- * @retval #APP_CONTROL_ERROR_TIMED_OUT Failed due to timeout. The application that handles @a app_control may be busy
- * @retval #APP_CONTROL_ERROR_PERMISSION_DENIED Permission denied
- * @post If the launch request is sent for the result, the result will come back through app_control_reply_cb() from the callee application. Additional replies may be delivered on app_control_enable_app_started_result_event() called.
- * @see app_control_reply_to_launch_request()
- * @see app_control_reply_cb()
- * @see app_control_enable_app_started_result_event()
- */
-int app_control_send_launch_request(app_control_h app_control, app_control_reply_cb callback, void *user_data);
-
-
-/**
- * @brief Sends the terminate request to the application that is launched by app_control. This API is only effective for some applications that are provided by default for handling platform default app_controls. You are not allowed to terminate other general applications using this API.
- *
- * @remarks Since Tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif, this API can be used to terminate sub-applications which were launched as group mode by caller application.
- * Once callee application is being terminated by this API, other applications which were launched by callee application as group mode will be terminated as well.
- *
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @param[in] app_control The app_control handle
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #APP_CONTROL_ERROR_NONE Successful
- * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #APP_CONTROL_ERROR_PERMISSION_DENIED Permission denied
- * @see app_control_send_launch_request()
- * @see app_control_set_launch_mode()
- */
-int app_control_send_terminate_request(app_control_h app_control);
-
-
-/**
- * @brief Replies to the launch request sent by the caller.
- * @details If the caller application sent the launch request to receive the result, the callee application can return the result back to the caller.
- *
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @remarks The function is not allowed to send reply #APP_CONTROL_RESULT_APP_STARTED as @a result which is reserved for platform developers.
- * @param[in] reply The app_control handle in which the results of the callee are contained
- * @param[in] request The app_control handle sent by the caller
- * @param[in] result The result code of the launch request
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #APP_CONTROL_ERROR_NONE Successful
- * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
- * @see app_control_send_launch_request()
- */
-int app_control_reply_to_launch_request(app_control_h reply, app_control_h request, app_control_result_e result);
-
-
-/**
- * @brief Creates and returns a copy of the given app_control handle.
- *
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @remarks A newly created app_control should be destroyed by calling app_control_destroy() if it is no longer needed.
- *
- * @param[out] clone If successful, a newly created app_control handle will be returned
- * @param[in] app_control The app_control handle
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #APP_CONTROL_ERROR_NONE Successful
- * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
- * @see app_control_destroy()
- */
-int app_control_clone(app_control_h *clone, app_control_h app_control);
-
-
-/**
- * @brief Gets the application ID of the caller from the launch request.
- *
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @remarks The @a app_control must be the launch request from app_control_cb().
- * @remarks This function returns #APP_CONTROL_ERROR_INVALID_PARAMETER if the given app_control is not the launch request.
- * @remarks The @a id must be released using free().
- * @param[in] app_control The app_control handle from app_control_cb()
- * @param[out] id The application ID of the caller
- * @return @a 0 on success,
- * otherwise a negative error value
- * @retval #APP_CONTROL_ERROR_NONE Successful
- * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
- */
-int app_control_get_caller(app_control_h app_control, char **id);
-
-
-/**
- * @brief Checks whether the caller is requesting a reply from the launch request.
- *
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @remarks The @a app_control must be the launch request from app_control_cb().
- * @remarks This function returns #APP_CONTROL_ERROR_INVALID_PARAMETER if the given app_control is not the launch request.
- * @param[in] app_control The app_control handle from app_control_cb()
- * @param[out] requested If @c true a reply is requested by the caller,
- * otherwise @c false
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #APP_CONTROL_ERROR_NONE Successful
- * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
- */
-int app_control_is_reply_requested(app_control_h app_control, bool *requested);
-
-/**
- * @brief Sets the launch mode of the application.
- *
- * @details This function allows callee application to be launched as group or single mode.
- * @remarks Although launch_mode were set as #APP_CONTROL_LAUNCH_MODE_GROUP, callee application would be launched as single mode if the manifest file of callee application defined the launch mode as "single".
- * This function can just set the preference of caller application to launch an application.
- * @remarks Sub-applications which were launched as group mode always have own process.
- *
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @param[in] app_control The app_control handle
- * @param[in] mode The launch mode of app
- * @return 0 on success, otherwise a negative error value
- * @retval #APP_CONTROL_ERROR_NONE Successful
- * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
- * @see app_control_set_launch_mode()
- * @see app_control_launch_mode_e
- */
-int app_control_set_launch_mode(app_control_h app_control,
- app_control_launch_mode_e mode);
-
-/**
- * @brief Gets the launch mode of the application.
- *
- * @remarks Since Tizen 3.0, if launch mode not set in the caller app control,
- * the function returns #APP_CONTROL_LAUNCH_MODE_SINGLE launch mode.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @param[in] app_control The app_control handle
- * @param[out] mode The launch mode of app
- * @return 0 on success, otherwise a negative error value
- * @retval #APP_CONTROL_ERROR_NONE Successful
- * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
- * @see app_control_get_launch_mode()
- * @see app_control_launch_mode_e
- */
-int app_control_get_launch_mode(app_control_h app_control,
- app_control_launch_mode_e *mode);
-
-/**
- * @brief Enables additional launch result event on launch request.
- *
- * @details The function allows to receive #APP_CONTROL_RESULT_APP_STARTED event on\n
- * application get launched by app_control.
- * @remarks app_control_reply_cb() will be called on APP_CONTROL_RESULT_APP_STARTED event received.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @param[in] app_control The app_control handle
- * @return 0 on success, otherwise a negative error value
- * @retval #APP_CONTROL_ERROR_NONE Successful
- * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
- * @see app_control_send_launch_request()
- * @see #APP_CONTROL_RESULT_APP_STARTED
- */
-int app_control_enable_app_started_result_event(app_control_h app_control);
-
-/**
- * @}
- */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __TIZEN_APPFW_APP_CONTROL_H__ */
-
diff --git a/include/app_control_internal.h b/include/app_control_internal.h
deleted file mode 100644
index afd8399..0000000
--- a/include/app_control_internal.h
+++ /dev/null
@@ -1,242 +0,0 @@
-/*
- * Copyright (c) 2014 - 2016 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.
- */
-
-#ifndef __TIZEN_APPFW_APP_CONTROL_INTERNAL_H__
-#define __TIZEN_APPFW_APP_CONTROL_INTERNAL_H__
-
-#include <bundle.h>
-
-#include <app_control.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @file app_control_internal.h
- */
-
-/**
- * @addtogroup CAPI_APP_CONTROL_MODULE
- * @{
- */
-
-/**
- * @brief Definition for app_control data: Connect the previous app with the next app when the sub-app is terminated.
- * @details If a sub-app is terminated, framework will connect the previous app with the next app.
- * By default, this flag is 'false'
- */
-#define APP_CONTROL_DATA_REROUTE "__K_REROUTE__"
-
-/**
- * @brief Definition for app_control data: The flag for attaching app.
- * @details If this flag is set, callee app will be attached to caller app for a while and it will be detached when callee app is lowered.
- * By default, this flag is 'false'
- */
-#define APP_CONTROL_DATA_SHIFT_WINDOW "__K_SHIFT_WINDOW"
-
-/**
- * @brief Definition for app_control data : The flag for supporting recycling processes.
- * @details By default, this flag is 'false'. Once it is set to 'true', launched sub-app process will be reused even if it was lowered later.
- *
- */
-#define APP_CONTROL_DATA_RECYCLE "__K_RECYCLE"
-
-/**
- * @brief Definition for app_control data : The value for supporting relocating launched app under the callee app.
- * @details By default, this value is NULL. Once it is set to app ID, that application will be relocated under the callee app after callee app is resumed.
- * @remarks The value should be an app ID for main app which has been launched before, otherwise it will be ignored.
- */
-#define APP_CONTROL_DATA_RELOCATE_BELOW "__K_RELOCATE_BELOW"
-
-/**
- * @brief Definition for app_control data: The value for supporting background launch mode.
- * @details By default, this flag is 'disable'. Once it is set to 'enable', A window of callee app doesn't appear on the screen.
- */
-#define APP_CONTROL_DATA_BACKGROUND_LAUNCH "__K_BG_LAUNCH"
-
-/**
- * @brief Replaces all data in the app_control with the bundle
- *
- * @remarks This function clears all data in the app_control and adds all key-value pairs in the bundle into the app_control
- * @param [in] app_control The app_control handle
- * @param [in] data The bundle handle
- * @return 0 on success, otherwise a negative error value.
- * @retval #APP_CONTROL_ERROR_NONE Successful
- * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
- * @see app_control_export_as_bundle()
- * @code
- *
- * #include <bundle.h>
- * #include <app_control.h>
- *
- * app_control_h app_control = NULL;
- * app_control_create(&app_control);
- * app_control_import_from_bundle(app_control, b);
- *
- * @endcode
- *
- */
-int app_control_import_from_bundle(app_control_h app_control, bundle *data);
-
-/**
- * @brief Returns a new bundle containing all data contained int the app_control
- *
- * @remarks The @a data must be released with bundle_free() by you.
- * @param [in] app_control The app_control handle
- * @param [out] data The bundle handle
- * @return 0 on success, otherwise a negative error value.
- * @retval #APP_CONTROL_ERROR_NONE Successful
- * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
- * @see app_control_import_from_bundle()
- * @code
- *
- * #include <bundle.h>
- * #include <app_control.h>
- *
- * bundle* b = NULL;
- * app_control_export_as_bundle(app_control, &b);
- *
- * @endcode
- */
-int app_control_export_as_bundle(app_control_h app_control, bundle **data);
-
-int app_control_create_request(bundle *data, app_control_h *app_control);
-
-int app_control_create_event(bundle *data, app_control_h *app_control);
-
-int app_control_to_bundle(app_control_h app_control, bundle **data);
-
-/**
- * @brief Sets the window ID of the application.
- *
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @param[in] app_control The app_control handle
- * @param[in] id The window ID of the caller application (if the @a id is not positive, it clears the previous value)
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #APP_CONTROL_ERROR_NONE Successful
- * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
- * @see app_control_get_window()
- */
-int app_control_set_window(app_control_h app_control, unsigned int id);
-
-/**
- * @brief Gets the window ID of the application.
- *
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @param[in] app_control The app_control handle
- * @param[out] id The window ID of the caller application
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #APP_CONTROL_ERROR_NONE Successful
- * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
- * @see app_control_set_app_id()
- */
-int app_control_get_window(app_control_h app_control, unsigned int *id);
-
-/**
- * @brief Requests the specified callee window to be transient for the caller window.
- *
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @remarks The @a callee_id window is transient for the top-level caller window and should be handled accordingly.
- * @param[in] app_control The app_control handle
- * @param[in] callee_id The callee window ID
- * @param[in] cbfunc The callback function to be called when the transient is requested
- * @param[in] data A data pointer to pass to the callback function
- * @return @c 0 on success,
- * otherwise a negative error value.
- * @retval #APP_CONTROL_ERROR_NONE Successful
- * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
- */
-int app_control_request_transient_app(app_control_h app_control, unsigned int callee_id, app_control_host_res_fn cbfunc, void *data);
-
-/**
- * @platform
- * @brief Sets the ID of default application associated with operation, mime-type and uri.
- *
- * @since_tizen 3.0
- * @privlevel platform
- * @privilege %http://tizen.org/privilege/systemsettings.admin
- * @param[in] app_control The app_control handle
- * @param[in] app_id The ID of the application
- *
- * @return 0 on success, otherwise a negative error value
- * @retval #APP_CONTROL_ERROR_NONE Successful
- * @retval #APP_CONTROL_ERROR_PERMISSION_DENIED Permission denied
- * @retval #APP_CONTROL_ERROR_IO_ERROR IO error
- * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
- *
- */
-int app_control_set_defapp(app_control_h app_control, const char *app_id);
-
-/**
- * @platform
- * @brief Unsets default application control setting of an application.
- *
- * @details When an user call this API, all the default application settings for the app_id are unset.
- *
- * @since_tizen 3.0
- * @privlevel platform
- * @privilege %http://tizen.org/privilege/systemsettings.admin
- * @param[in] app_id The ID of the application
- *
- * @return 0 on success, otherwise a negative error value
- * @retval #APP_CONTROL_ERROR_NONE Successful
- * @retval #APP_CONTROL_ERROR_PERMISSION_DENIED Permission denied
- * @retval #APP_CONTROL_ERROR_IO_ERROR IO error
- * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
- *
- */
-int app_control_unset_defapp(const char *app_id);
-
-/**
- * @brief Sets the instance ID of the application
- *
- * @since_tizen tizen_3.0
- * @param[in] app_control The app_control handle
- * @param[in] instance_id The instance ID of the application
- * @return 0 on success, otherwise a negative error value
- * @retval #APP_CONTROL_ERROR_NONE Successful
- * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #APP_CONTROL_OUT_OF_MEMORY Out of memory
- */
-int app_control_set_instance_id(app_control_h app_control, const char *instance_id);
-
-/**
- * @brief Gets the instance ID of the application
- *
- * @since_tizen tizen_3.0
- * @param[in] app_control The app_control handle
- * @param[out] instance_id The instance ID of the application
- * @return 0 on success, otherwise a negative error value
- * @retval #APP_CONTROL_ERROR_NONE Successful
- * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #APP_CONTROL_OUT_OF_MEMORY Out of memory
- */
-int app_control_get_instance_id(app_control_h app_control, char **instance_id);
-
-/**
- * @}
- */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __TIZEN_APPFW_APP_CONTROL_INTERNAL_H__ */
diff --git a/include/app_event.h b/include/app_event.h
deleted file mode 100644
index 5d5ef83..0000000
--- a/include/app_event.h
+++ /dev/null
@@ -1,1084 +0,0 @@
-/*
- * Copyright (c) 2015 - 2016 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.
- */
-
-
-#ifndef __TIZEN_APPFW_EVENT_H__
-#define __TIZEN_APPFW_EVENT_H__
-
-#include <bundle.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @file app_event.h
- */
-
-/**
- * @addtogroup CAPI_EVENT_MODULE
- * @{
- */
-
-
-/**
- * @brief Event handle.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- */
-typedef struct event_handler *event_handler_h;
-
-
-/**
- * @brief Event callback.
- *
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @param[in] event_name The interested event name
- * @param[in] event_data The data of interested event
- * @param[in] user_data The user data set by event_add_event_handler()
- * @see event_add_event_handler
- */
-typedef void (*event_cb)(const char *event_name, bundle *event_data, void *user_data);
-
-
-/**
- * @brief Enumeration for Event Error.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- */
-typedef enum {
- EVENT_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
- EVENT_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
- EVENT_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
- EVENT_ERROR_TIMED_OUT = TIZEN_ERROR_TIMED_OUT, /**< Time out */
- EVENT_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR, /**< IO error */
- EVENT_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED /**< Permisiion denied */
-} event_error_e;
-
-
-/**
- * @brief Definition for system-event of battery : charger status.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @remarks If there is earlier occurrence regarding this event, you will receive the event as soon as you register event handler for this event. You can use this earlier event-data as initial value.
- * @see EVENT_KEY_BATTERY_CHARGER_STATUS
- */
-#define SYSTEM_EVENT_BATTERY_CHARGER_STATUS "tizen.system.event.battery_charger_status"
-
-
-/**
- * @brief Definition for key of SYSTEM_EVENT_BATTERY_CHARGER_STATUS.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @see EVENT_VAL_BATTERY_CHARGER_DISCONNECTED
- * @see EVENT_VAL_BATTERY_CHARGER_CONNECTED
- * @see EVENT_VAL_BATTERY_CHARGER_CHARGING
- * @see EVENT_VAL_BATTERY_CHARGER_DISCHARGING
- */
-#define EVENT_KEY_BATTERY_CHARGER_STATUS "battery_charger_status"
-
-
-/**
- * @brief Definition for value of EVENT_KEY_BATTERY_CHARGER_STATUS.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @remarks charger disconnected
- */
-#define EVENT_VAL_BATTERY_CHARGER_DISCONNECTED "disconnected"
-
-
-/**
- * @brief Definition for value of EVENT_KEY_BATTERY_CHARGER_STATUS.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @remarks charger connected
- */
-#define EVENT_VAL_BATTERY_CHARGER_CONNECTED "connected"
-
-
-/**
- * @brief Definition for value of EVENT_KEY_BATTERY_CHARGER_STATUS.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @remarks charging is enabled
- */
-#define EVENT_VAL_BATTERY_CHARGER_CHARGING "charging"
-
-
-/**
- * @brief Definition for value of EVENT_KEY_BATTERY_CHARGER_STATUS.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @remarks charging is disabled
- */
-#define EVENT_VAL_BATTERY_CHARGER_DISCHARGING "discharging"
-
-
-/**
- * @brief Definition for system-event of battery : level status.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @see EVENT_KEY_BATTERY_LEVEL_STATUS
- */
-#define SYSTEM_EVENT_BATTERY_LEVEL_STATUS "tizen.system.event.battery_level_status"
-
-
-/**
- * @brief Definition for key of SYSTEM_EVENT_BATTERY_LEVEL_STATUS.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @see EVENT_VAL_BATTERY_LEVEL_EMPTY
- * @see EVENT_VAL_BATTERY_LEVEL_CRITICAL
- * @see EVENT_VAL_BATTERY_LEVEL_LOW
- * @see EVENT_VAL_BATTERY_LEVEL_HIGH
- * @see EVENT_VAL_BATTERY_LEVEL_FULL
- */
-#define EVENT_KEY_BATTERY_LEVEL_STATUS "battery_level_status"
-
-
-/**
- * @brief Definition for value of EVENT_KEY_BATTERY_LEVEL_STATUS.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- */
-#define EVENT_VAL_BATTERY_LEVEL_EMPTY "empty"
-
-
-/**
- * @brief Definition for value of EVENT_KEY_BATTERY_LEVEL_STATUS.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- */
-#define EVENT_VAL_BATTERY_LEVEL_CRITICAL "critical"
-
-
-/**
- * @brief Definition for value of EVENT_KEY_BATTERY_LEVEL_STATUS.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- */
-#define EVENT_VAL_BATTERY_LEVEL_LOW "low"
-
-
-/**
- * @brief Definition for value of EVENT_KEY_BATTERY_LEVEL_STATUS.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- */
-#define EVENT_VAL_BATTERY_LEVEL_HIGH "high"
-
-
-/**
- * @brief Definition for value of EVENT_KEY_BATTERY_LEVEL_STATUS.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- */
-#define EVENT_VAL_BATTERY_LEVEL_FULL "full"
-
-
-/**
- * @brief Definition for system-event of usb : status of usb connection.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @see EVENT_KEY_USB_STATUS
- */
-#define SYSTEM_EVENT_USB_STATUS "tizen.system.event.usb_status"
-
-
-/**
- * @brief Definition for key of SYSTEM_EVENT_USB_STATUS.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @see EVENT_VAL_USB_DISCONNECTED
- * @see EVENT_VAL_USB_CONNECTED
- * @see EVENT_VAL_USB_AVAILABLE
- */
-#define EVENT_KEY_USB_STATUS "usb_status"
-
-
-/**
- * @brief Definition for value of EVENT_KEY_USB_STATUS.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- */
-#define EVENT_VAL_USB_DISCONNECTED "disconnected"
-
-
-/**
- * @brief Definition for value of EVENT_KEY_USB_STATUS.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @remarks Connected but not-available.
- */
-#define EVENT_VAL_USB_CONNECTED "connected"
-
-
-/**
- * @brief Definition for value of EVENT_KEY_USB_STATUS.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- */
-#define EVENT_VAL_USB_AVAILABLE "available"
-
-
-/**
- * @brief Definition for system-event of ear-jack : status of ear-jack connection.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @see EVENT_KEY_EARJACK_STATUS
- */
-#define SYSTEM_EVENT_EARJACK_STATUS "tizen.system.event.earjack_status"
-
-
-/**
- * @brief Definition for key of SYSTEM_EVENT_EARJACK_STATUS.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @see EVENT_VAL_EARJACK_DISCONNECTED
- * @see EVENT_VAL_EARJACK_CONNECTED
- */
-#define EVENT_KEY_EARJACK_STATUS "earjack_status"
-
-
-/**
- * @brief Definition for value of EVENT_KEY_EARJACK_STATUS.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- */
-#define EVENT_VAL_EARJACK_DISCONNECTED "disconnected"
-
-
-/**
- * @brief Definition for value of EVENT_KEY_EARJACK_STATUS.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- */
-#define EVENT_VAL_EARJACK_CONNECTED "connected"
-
-
-/**
- * @brief Definition for system-event of display : state of display.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @privilege %http://tizen.org/privilege/display
- * @remarks If you want to receive this event, you must declare this privilege.
- * @see EVENT_KEY_DISPLAY_STATE
- */
-#define SYSTEM_EVENT_DISPLAY_STATE "tizen.system.event.display_state"
-
-
-/**
- * @brief Definition for key of SYSTEM_EVENT_DISPLAY_STATE.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @see EVENT_VAL_DISPLAY_NORMAL
- * @see EVENT_VAL_DISPLAY_DIM
- * @see EVENT_VAL_DISPLAY_OFF
- */
-#define EVENT_KEY_DISPLAY_STATE "display_state"
-
-
-/**
- * @brief Definition for value of EVENT_KEY_DISPLAY_STATE.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- */
-#define EVENT_VAL_DISPLAY_NORMAL "normal"
-
-
-/**
- * @brief Definition for value of EVENT_KEY_DISPLAY_STATE.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- */
-#define EVENT_VAL_DISPLAY_DIM "dim"
-
-
-/**
- * @brief Definition for value of EVENT_KEY_DISPLAY_STATE.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- */
-#define EVENT_VAL_DISPLAY_OFF "off"
-
-
-/**
- * @brief Definition for system-event of system : boot completion.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @remarks There is no corresponding key/value.
- * @remarks You can treat the initial value as "false" before you receive this event.
- * @remarks If it's already boot-completed state before you regiser event handler, you can receive the event as soon as you register the event handler.
- */
-#define SYSTEM_EVENT_BOOT_COMPLETED "tizen.system.event.boot_completed"
-
-
-/**
- * @brief Definition for system-event of system : shutdown.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @remarks There is no corresponding key/value.
- * @remarks You can treat the inital value as "false" before you receive this event.
- * @remarks If it's already shutting-down state before you regiser event handler, you can receive the event as soon as you register the event handler.
-*/
-#define SYSTEM_EVENT_SYSTEM_SHUTDOWN "tizen.system.event.system_shutdown"
-
-
-/**
- * @brief Definition for system-event of system : low memory.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @see EVENT_KEY_LOW_MEMORY
- */
-#define SYSTEM_EVENT_LOW_MEMORY "tizen.system.event.low_memory"
-
-
-/**
- * @brief Definition for key of SYSTEM_EVENT_LOW_MEMORY.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @remarks If there is earlier occurrence regarding this event, you will receive the event as soon as you register event handler for this event. You can use this earlier event-data as initial value.
- * @see EVENT_VAL_MEMORY_NORMAL
- * @see EVENT_VAL_MEMORY_SOFT_WARNING
- * @see EVENT_VAL_MEMORY_HARD_WARNING
- */
-#define EVENT_KEY_LOW_MEMORY "low_memory"
-
-
-/**
- * @brief Definition for value of EVENT_KEY_LOW_MEMORY.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- */
-#define EVENT_VAL_MEMORY_NORMAL "normal"
-
-
-/**
- * @brief Definition for value of EVENT_KEY_LOW_MEMORY.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- */
-#define EVENT_VAL_MEMORY_SOFT_WARNING "soft_warning"
-
-
-/**
- * @brief Definition for value of EVENT_KEY_LOW_MEMORY.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- */
-#define EVENT_VAL_MEMORY_HARD_WARNING "hard_warning"
-
-
-/**
- * @brief Definition for system-event of wifi : state of wifi.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @privilege %http://tizen.org/privilege/network.get
- * @remarks If you want to receive this event, you must declare this privilege.
- * @see EVENT_KEY_WIFI_STATE
- */
-#define SYSTEM_EVENT_WIFI_STATE "tizen.system.event.wifi_state"
-
-
-/**
- * @brief Definition for key of SYSTEM_EVENT_WIFI_STATE.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @see EVENT_VAL_WIFI_OFF
- * @see EVENT_VAL_WIFI_ON
- * @see EVENT_VAL_WIFI_CONNECTED
- */
-#define EVENT_KEY_WIFI_STATE "wifi_state"
-
-
-/**
- * @brief Definition for value of EVENT_KEY_WIFI_STATE.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- */
-#define EVENT_VAL_WIFI_OFF "off"
-
-
-/**
- * @brief Definition for value of EVENT_KEY_WIFI_STATE.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- */
-#define EVENT_VAL_WIFI_ON "on"
-
-
-/**
- * @brief Definition for value of EVENT_KEY_WIFI_STATE.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- */
-#define EVENT_VAL_WIFI_CONNECTED "connected"
-
-
-/**
- * @brief Definition for system-event of bluetooth : status of bluetooth.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @see EVENT_KEY_BT_STATE
- * @see EVENT_KEY_BT_LE_STATE
- * @see EVENT_KEY_BT_TRANSFERING_STATE
- */
-#define SYSTEM_EVENT_BT_STATE "tizen.system.event.bt_state"
-
-
-/**
- * @brief Definition for key of SYSTEM_EVENT_BT_STATE.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @see EVENT_VAL_BT_STATE_OFF
- * @see EVENT_VAL_BT_STATE_ON
- */
-#define EVENT_KEY_BT_STATE "bt_state"
-
-
-/**
- * @brief Definition for value of EVENT_KEY_BT_STATE.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- */
-#define EVENT_VAL_BT_OFF "off"
-
-
-/**
- * @brief Definition for value of EVENT_KEY_BT_STATE.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- */
-#define EVENT_VAL_BT_ON "on"
-
-
-/**
- * @brief Definition for key of SYSTEM_EVENT_BT_STATE.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @see EVENT_VAL_BT_LE_STATE_OFF
- * @see EVENT_VAL_BT_LE_STATE_ON
- */
-#define EVENT_KEY_BT_LE_STATE "bt_le_state"
-
-
-/**
- * @brief Definition for value of EVENT_KEY_BT_LE_STATE.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- */
-#define EVENT_VAL_BT_LE_OFF "off"
-
-
-/**
- * @brief Definition for value of EVENT_KEY_BT_LE_STATE.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- */
-#define EVENT_VAL_BT_LE_ON "on"
-
-
-/**
- * @brief Definition for key of SYSTEM_EVENT_BT_STATE.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @remarks If it's already transfering state before you register this event, you can't receive the event regarding current transfer but you can receive the following transfers.
- * @see EVENT_VAL_BT_NON_TRANSFERING
- * @see EVENT_VAL_BT_TRANSFERING
- */
-#define EVENT_KEY_BT_TRANSFERING_STATE "bt_transfering_state"
-
-
-/**
- * @brief Definition for value of EVENT_KEY_BT_TRANSFERING_STATE.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- */
-#define EVENT_VAL_BT_NON_TRANSFERING "non_transfering"
-
-
-/**
- * @brief Definition for value of EVENT_KEY_BT_TRANSFERING_STATE.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- */
-#define EVENT_VAL_BT_TRANSFERING "transfering"
-
-
-/**
- * @brief Definition for system-event of location : enable state of location.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @see EVENT_KEY_LOCATION_ENABLE_STATE
- */
-#define SYSTEM_EVENT_LOCATION_ENABLE_STATE "tizen.system.event.location_enable_state"
-
-
-/**
- * @brief Definition for key of SYSTEM_EVENT_LOCATION_ENABLE_STATE.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @see EVENT_VAL_LOCATION_DISABLED
- * @see EVENT_VAL_LOCATION_ENABLED
- */
-#define EVENT_KEY_LOCATION_ENABLE_STATE "location_enable_state"
-
-
-/**
- * @brief Definition for value of EVENT_KEY_LOCATION_ENABLE_STATE.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- */
-#define EVENT_VAL_LOCATION_DISABLED "disabled"
-
-
-/**
- * @brief Definition for value of EVENT_KEY_LOCATION_ENABLE_STATE.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- */
-#define EVENT_VAL_LOCATION_ENABLED "enabled"
-
-
-/**
- * @brief Definition for system-event of location : enable state of gps.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @see EVENT_KEY_GPS_ENABLE_STATE
- */
-#define SYSTEM_EVENT_GPS_ENABLE_STATE "tizen.system.event.gps_enable_state"
-
-
-/**
- * @brief Definition for key of SYSTEM_EVENT_GPS_ENABLE_STATE.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @see EVENT_VAL_GPS_DISABLED
- * @see EVENT_VAL_GPS_ENABLED
- */
-#define EVENT_KEY_GPS_ENABLE_STATE "gps_enable_state"
-
-
-/**
- * @brief Definition for value of EVENT_KEY_GPS_ENABLE_STATE.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- */
-#define EVENT_VAL_GPS_DISABLED "disabled"
-
-
-/**
- * @brief Definition for value of EVENT_KEY_GPS_ENABLE_STATE.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- */
-#define EVENT_VAL_GPS_ENABLED "enabled"
-
-
-/**
- * @brief Definition for system-event of location : enable state of nps.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @see EVENT_KEY_NPS_ENABLE_STATE
- */
-#define SYSTEM_EVENT_NPS_ENABLE_STATE "tizen.system.event.nps_enable_state"
-
-
-/**
- * @brief Definition for key of SYSTEM_EVENT_NPS_ENABLE_STATE.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @see EVENT_VAL_NPS_DISABLED
- * @see EVENT_VAL_NPS_ENABLED
- */
-#define EVENT_KEY_NPS_ENABLE_STATE "nps_enable_state"
-
-
-/**
- * @brief Definition for value of EVENT_KEY_NPS_ENABLE_STATE.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- */
-#define EVENT_VAL_NPS_DISABLED "disabled"
-
-
-/**
- * @brief Definition for value of EVENT_KEY_NPS_ENABLE_STATE.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- */
-#define EVENT_VAL_NPS_ENABLED "enabled"
-
-
-/**
- * @brief Definition for system-event of message : incoming msg.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @privilege %http://tizen.org/privilege/message.read
- * @remarks If you want to receive this event, you must declare this privilege.
- * @see EVENT_KEY_MSG_TYPE
- * @see EVENT_KEY_MSG_ID
- */
-#define SYSTEM_EVENT_INCOMING_MSG "tizen.system.event.incoming_msg"
-
-
-/**
- * @brief Definition for key of SYSTEM_EVENT_INCOMING_MSG.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @see EVENT_VAL_SMS
- * @see EVENT_VAL_PUSH
- * @see EVENT_VAL_CB
- */
-#define EVENT_KEY_MSG_TYPE "msg_type"
-
-
-/**
- * @brief Definition for value of EVENT_KEY_MSG_TYPE.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- */
-#define EVENT_VAL_SMS "sms"
-
-
-/**
- * @brief Definition for value of EVENT_KEY_MSG_TYPE.
- * @since_tizen 3.0
- */
-#define EVENT_VAL_MMS "mms"
-
-
-/**
- * @brief Definition for value of EVENT_KEY_MSG_TYPE.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- */
-#define EVENT_VAL_PUSH "push"
-
-
-/**
- * @brief Definition for value of EVENT_KEY_MSG_TYPE.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- */
-#define EVENT_VAL_CB "cb"
-
-
-/**
- * @brief Definition for key of SYSTEM_EVENT_INCOMING_MSG.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @remarks The value of this key is a string of unsigned int value : new message id.
- */
-#define EVENT_KEY_MSG_ID "msg_id"
-
-
-/**
- * @brief Definition for system-event of message : outgoing msg.
- * @since_tizen 3.0
- * @privilege %http://tizen.org/privilege/message.read
- * @remarks If you want to receive this event, you must declare this privilege.
- * @see EVENT_KEY_OUT_MSG_TYPE
- * @see EVENT_KEY_OUT_MSG_ID
- */
-#define SYSTEM_EVENT_OUTGOING_MSG "tizen.system.event.outgoing_msg"
-
-
-/**
- * @brief Definition for key of SYSTEM_EVENT_OUTGOING_MSG.
- * @since_tizen 3.0
- * @see EVENT_VAL_OUT_MSG_SMS
- * @see EVENT_VAL_OUT_MSG_MMS
- */
-#define EVENT_KEY_OUT_MSG_TYPE "msg_type"
-
-
-/**
- * @brief Definition for value of EVENT_KEY_OUT_MSG_TYPE.
- * @since_tizen 3.0
- */
-#define EVENT_VAL_SMS "sms"
-
-
-/**
- * @brief Definition for value of EVENT_KEY_OUT_MSG_TYPE.
- * @since_tizen 3.0
- */
-#define EVENT_VAL_MMS "mms"
-
-
-/**
- * @brief Definition for key of SYSTEM_EVENT_OUTGOING_MSG.
- * @since_tizen 3.0
- * @remarks The value of this key is a string of unsigned int value : new message id.
- */
-#define EVENT_KEY_OUT_MSG_ID "msg_id"
-
-
-/**
- * @brief Definition for system-event of setting : time changed.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @remarks There is no corresponding key/value.
- * @remarks You can use a @a alarm_get_current_time() API for checking new time after receiving this event.
- */
-#define SYSTEM_EVENT_TIME_CHANGED "tizen.system.event.time_changed"
-
-
-/**
- * @brief Definition for system-event of setting : timezone setting.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @see EVENT_KEY_TIME_ZONE
- */
-#define SYSTEM_EVENT_TIME_ZONE "tizen.system.event.time_zone"
-
-
-/**
- * @brief Definition for key of SYSTEM_EVENT_TIME_ZONE.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @remarks The value of this key is timezone value of tz database, for example, "Asia/Seoul", "America/New_York", refer to the Time Zone Database of IANA.
- */
-#define EVENT_KEY_TIME_ZONE "time_zone"
-
-
-/**
- * @brief Definition for system-event of setting : hour format.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @see EVENT_KEY_HOUR_FORMAT
- */
-#define SYSTEM_EVENT_HOUR_FORMAT "tizen.system.event.hour_format"
-
-
-/**
- * @brief Definition for key of SYSTEM_EVENT_HOUR_FORMAT.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @see EVENT_VAL_HOURFORMAT_12
- * @see EVENT_VAL_HOURFORMAT_24
- */
-#define EVENT_KEY_HOUR_FORMAT "hour_format"
-
-
-/**
- * @brief Definition for value of EVENT_KEY_HOUR_FORMAT.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- */
-#define EVENT_VAL_HOURFORMAT_12 "12"
-
-
-/**
- * @brief Definition for value of EVENT_KEY_HOUR_FORMAT.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- */
-#define EVENT_VAL_HOURFORMAT_24 "24"
-
-
-/**
- * @brief Definition for system-event of setting : language setting.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @see EVENT_KEY_LANGUAGE_SET
- */
-#define SYSTEM_EVENT_LANGUAGE_SET "tizen.system.event.language_set"
-
-
-/**
- * @brief Definition for key of SYSTEM_EVENT_LANGUAGE_SET.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @remarks The value of this key is full name of locale, for example,
- * "ko_KR.UTF8" : in case of Korean language
- * "en_US.UTF8" : in case of USA language,
- * refer to linux locale info.
- */
-#define EVENT_KEY_LANGUAGE_SET "language_set"
-
-
-/**
- * @brief Definition for system-event of setting : region format.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @see EVENT_KEY_REGION_FORMAT
- */
-#define SYSTEM_EVENT_REGION_FORMAT "tizen.system.event.region_format"
-
-
-/**
- * @brief Definition for key of SYSTEM_EVENT_REGION_FORMAT.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @remarks The value of this key is full name of locale, for example,
- * "ko_KR.UTF8" : in case of Korean region format
- * "en_US.UTF8" : in case of USA region format,
- * refer to linux locale info.
- */
-#define EVENT_KEY_REGION_FORMAT "region_format"
-
-
-/**
- * @brief Definition for system-event of setting : silent_mode.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @see EVENT_KEY_SILENT_MODE
- */
-#define SYSTEM_EVENT_SILENT_MODE "tizen.system.event.silent_mode"
-
-
-/**
- * @brief Definition for key of SYSTEM_EVENT_SILENT_MODE.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @see EVENT_VAL_SILENTMODE_ON
- * @see EVENT_VAL_SILENTMODE_OFF
- */
-#define EVENT_KEY_SILENT_MODE "silent_mode"
-
-
-/**
- * @brief Definition for value of EVENT_KEY_SILENT_MODE.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- */
-#define EVENT_VAL_SILENTMODE_ON "on"
-
-
-/**
- * @brief Definition for value of EVENT_KEY_SILENT_MODE.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- */
-#define EVENT_VAL_SILENTMODE_OFF "off"
-
-
-/**
- * @brief Definition for system-event of setting : state of vibration.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @see EVENT_KEY_VIBRATION_STATE
- */
-#define SYSTEM_EVENT_VIBRATION_STATE "tizen.system.event.vibration_state"
-
-
-/**
- * @brief Definition for key of SYSTEM_EVENT_VIBRATION_STATE.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @see EVENT_VAL_VIBRATION_ON
- * @see EVENT_VAL_VIBRATION_OFF
- */
-#define EVENT_KEY_VIBRATION_STATE "vibration_state"
-
-
-/**
- * @brief Definition for value of EVENT_KEY_VIBRATION_STATE.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- */
-#define EVENT_VAL_VIBRATION_ON "on"
-
-
-/**
- * @brief Definition for value of EVENT_KEY_VIBRATION_STATE.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- */
-#define EVENT_VAL_VIBRATION_OFF "off"
-
-
-/**
- * @brief Definition for system-event of setting : state of screen's auto-rotation.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @see EVENT_KEY_SCREEN_AUTOROTATE_STATE
- */
-#define SYSTEM_EVENT_SCREEN_AUTOROTATE_STATE "tizen.system.event.screen_autorotate_state"
-
-
-/**
- * @brief Definition for key of SYSTEM_EVENT_SCREEN_AUTOROTATE_STATE.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @see EVENT_VAL_SCREEN_AUTOROTATE_ON
- * @see EVENT_VAL_SCREEN_AUTOROTATE_OFF
- */
-#define EVENT_KEY_SCREEN_AUTOROTATE_STATE "screen_autorotate_state"
-
-
-/**
- * @brief Definition for value of EVENT_KEY_SCREEN_AUTOROTATE_STATE.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- */
-#define EVENT_VAL_SCREEN_AUTOROTATE_ON "on"
-
-
-/**
- * @brief Definition for value of EVENT_KEY_SCREEN_AUTOROTATE_STATE.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- */
-#define EVENT_VAL_SCREEN_AUTOROTATE_OFF "off"
-
-
-/**
- * @brief Definition for system-event of setting : state of mobile data.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @see EVENT_KEY_MOBILE_DATA_STATE
- */
-#define SYSTEM_EVENT_MOBILE_DATA_STATE "tizen.system.event.mobile_data_state"
-
-
-/**
- * @brief Definition for key of SYSTEM_EVENT_MOBILE_DATA_STATE.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @see EVENT_VAL_MOBILE_DATA_OFF
- * @see EVENT_VAL_MOBILE_DATA_ON
- */
-#define EVENT_KEY_MOBILE_DATA_STATE "mobile_data_state"
-
-
-/**
- * @brief Definition for value of EVENT_KEY_MOBILE_DATA_STATE.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- */
-#define EVENT_VAL_MOBILE_DATA_OFF "off"
-
-
-/**
- * @brief Definition for value of EVENT_KEY_MOBILE_DATA_STATE.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- */
-#define EVENT_VAL_MOBILE_DATA_ON "on"
-
-
-/**
- * @brief Definition for system-event of setting : state of data roaming.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @see EVENT_KEY_DATA_ROAMING_STATE
- */
-#define SYSTEM_EVENT_DATA_ROAMING_STATE "tizen.system.event.data_roaming_state"
-
-
-/**
- * @brief Definition for key of SYSTEM_EVENT_DATA_ROAMING_STATE.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @see EVENT_VAL_DATA_ROAMING_OFF
- * @see EVENT_VAL_DATA_ROAMING_ON
- */
-#define EVENT_KEY_DATA_ROAMING_STATE "data_roaming_state"
-
-
-/**
- * @brief Definition for value of EVENT_KEY_DATA_ROAMING_STATE.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- */
-#define EVENT_VAL_DATA_ROAMING_OFF "off"
-
-
-/**
- * @brief Definition for value of EVENT_KEY_DATA_ROAMING_STATE.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- */
-#define EVENT_VAL_DATA_ROAMING_ON "on"
-
-
-/**
- * @brief Definition for system-event of setting : font setting.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @see EVENT_KEY_FONT_SET
- */
-#define SYSTEM_EVENT_FONT_SET "tizen.system.event.font_set"
-
-
-/**
- * @brief Definition for key of SYSTEM_EVENT_FONT_SET.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @remarks The value of this key is font name of string type by font-config.
- */
-#define EVENT_KEY_FONT_SET "font_set"
-
-
-/**
- * @brief Definition for system-event of network : status of network.
- * @since_tizen 3.0
- * @see EVENT_KEY_NETWORK_STATUS
- */
-#define SYSTEM_EVENT_NETWORK_STATUS "tizen.system.event.network_status"
-
-
-/**
- * @brief Definition for key of SYSTEM_EVENT_NETWORK_STATUS.
- * @since_tizen 3.0
- * @remarks The values of this event indicate the type of the current profile for data connection.
- * @see EVENT_VAL_NETWORK_DISCONNECTED
- * @see EVENT_VAL_NETWORK_WIFI
- * @see EVENT_VAL_NETWORK_CELLULAR
- * @see EVENT_VAL_NETWORK_ETHERNET
- * @see EVENT_VAL_NETWORK_BT
- * @see EVENT_VAL_NETWORK_NET_PROXY
- */
-#define EVENT_KEY_NETWORK_STATUS "network_status"
-
-
-/**
- * @brief Definition for value of EVENT_KEY_NETWORK_STATUS.
- * @since_tizen 3.0
- */
-#define EVENT_VAL_NETWORK_DISCONNECTED "disconnected"
-
-
-/**
- * @brief Definition for value of EVENT_KEY_NETWORK_STATUS.
- * @since_tizen 3.0
- */
-#define EVENT_VAL_NETWORK_WIFI "wifi"
-
-
-/**
- * @brief Definition for value of EVENT_KEY_NETWORK_STATUS.
- * @since_tizen 3.0
- */
-#define EVENT_VAL_NETWORK_CELLULAR "cellular"
-
-
-/**
- * @brief Definition for value of EVENT_KEY_NETWORK_STATUS.
- * @since_tizen 3.0
- */
-#define EVENT_VAL_NETWORK_ETHERNET "ethernet"
-
-
-/**
- * @brief Definition for value of EVENT_KEY_NETWORK_STATUS.
- * @since_tizen 3.0
- */
-#define EVENT_VAL_NETWORK_BT "bt"
-
-
-/**
- * @brief Definition for value of EVENT_KEY_NETWORK_STATUS.
- * @since_tizen 3.0
- */
-#define EVENT_VAL_NETWORK_NET_PROXY "net_proxy"
-
-
-/**
- * @brief Adds the event handler for receiving event-data of interested events.
- *
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @remarks If you want to add the privileged event, you MUST declare right privilge first. Unless that, this function returns #EVENT_ERROR_PERMISSION_DENIED. The privileged events are commented on remarks of it's definitions.
- * @param[in] event_name The interested event name
- * @param[in] callback The event callback called when the event occurs
- * @param[in] user_data The user data for passing to callback
- * @param[out] event_handler The event handler
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #EVENT_ERROR_NONE Successful
- * @retval #EVENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #EVENT_ERROR_PERMISSION_DENIED Permission denied
- * @retval #EVENT_ERROR_IO_ERROR Adding handler failed
- * @retval #EVENT_ERROR_OUT_OF_MEMORY Out of memory
- */
-int event_add_event_handler(const char *event_name, event_cb callback, void *user_data, event_handler_h *event_handler);
-
-
-/**
- * @brief Removes the registered event handler.
- *
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @param[in] event_handler The event handler
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #EVENT_ERROR_NONE Successful
- * @retval #EVENT_ERROR_INVALID_PARAMETER Invalid parameter
- */
-int event_remove_event_handler(event_handler_h event_handler);
-
-
-/**
- * @brief Sends the User-Event to receiver applications.
- *
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @remarks The format of User-Event's name MUST be "event.{sender's appid}.{user-defined name}", refer to 'The name-format of User-Event' section, If the event_name is invalid, the function returns #EVENT_ERROR_IO_ERROR.
- * @param[in] event_name The event's name to send
- * @param[in] event_data The event's data to send
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #EVENT_ERROR_NONE Successful
- * @retval #EVENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #EVENT_ERROR_IO_ERROR Sending operation failed
- */
-int event_publish_app_event(const char *event_name, bundle *event_data);
-
-
-/**
- * @brief Sends the User-Event to trusted receiver-applications.
- *
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @remarks The application which has same certification with sender can receive the event.
- * @remarks The format of User-Event's name MUST be "event.{sender's appid}.{user-defined name}", refer to 'The name-format of User-Event' section, If the event_name is invalid, the function returns #EVENT_ERROR_IO_ERROR.
- * @param[in] event_name The event's name to send
- * @param[in] event_data The event's data to send
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #EVENT_ERROR_NONE Successful
- * @retval #EVENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #EVENT_ERROR_IO_ERROR Sending operation failed
- */
-int event_publish_trusted_app_event(const char *event_name, bundle *event_data);
-
-
-/**
- * @brief Keeps last User-Event data for receiver applications.
- *
- * @since_tizen 3.0
- * @remarks The receiver applications will receive this last event data after adding their new handlers via event_add_event_handler() API since the sender application called this API.
- * @remarks If a sender application sends same event via trusted API and non-trusted API, then a trusted receiver will get latest data regardless of trusted or non-trusted, but non-trusted receiver will get the last data only from non-trusted API.
- * @remarks The effect of this API continues during runtime. That means when the sender application process restarts, the sender application needs to call this api again to make the event to keep the last event.
- * @param[in] event_name The event's name to keep last event data
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #EVENT_ERROR_NONE Successful
- * @retval #EVENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #EVENT_ERROR_IO_ERROR Sending operation failed
- * @retval #EVENT_ERROR_OUT_OF_MEMORY Out of memory
- */
-int event_keep_last_event_data(const char *event_name);
-
-
-/**
- * @}
- */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __TIZEN_APPFW_EVENT_H__ */
-
diff --git a/include/app_internal.h b/include/app_internal.h
index f0624d8..17f846d 100644
--- a/include/app_internal.h
+++ b/include/app_internal.h
@@ -30,7 +30,7 @@
extern "C" {
#endif
-#define TIZEN_PATH_MAX 1024
+//#define TIZEN_PATH_MAX 1024
#define PATH_FMT_APP_ROOT tzplatform_getenv(TZ_USER_APP)
#define PATH_FMT_RES_DIR "/res"
@@ -41,21 +41,8 @@ extern "C" {
#define PATH_FMT_RO_RES_DIR "/res"
#define PATH_FMT_RO_LOCALE_DIR "/local"
-typedef void (*app_finalizer_cb) (void *data);
typedef void *appcore_context_h;
-int app_error(app_error_e error, const char *function, const char *description);
-
-int app_get_package_app_name(const char *package, char **name);
-
-int app_finalizer_add(app_finalizer_cb callback, void *data);
-
-int app_finalizer_remove(app_finalizer_cb callback);
-
-void app_finalizer_execute(void);
-
-int app_get_package(char **package);
-
/**
* @internal
* @brief Called when the system memory is running low.
diff --git a/include/app_preference.h b/include/app_preference.h
deleted file mode 100644
index 478793a..0000000
--- a/include/app_preference.h
+++ /dev/null
@@ -1,322 +0,0 @@
-/*
- * Copyright (c) 2011 - 2016 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.
- */
-
-
-#ifndef __TIZEN_APPFW_PREFERENCE_H__
-#define __TIZEN_APPFW_PREFERENCE_H__
-
-#include <tizen.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/**
- * @file app_preference.h
- */
-
-/**
- * @addtogroup CAPI_PREFERENCE_MODULE
- * @{
- */
-
-
-/**
- * @brief Enumeration for Preference Error.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-typedef enum {
- PREFERENCE_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
- PREFERENCE_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
- PREFERENCE_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
- PREFERENCE_ERROR_NO_KEY = TIZEN_ERROR_APPLICATION | 0x30, /**< Required key not available */
- PREFERENCE_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR , /**< Internal I/O Error */
-} preference_error_e;
-
-
-/**
- * @brief Called when the given key's value in the preference changes.
- * @details When the @a key is added or removed, this callback function is skipped(only update can be handled).
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @param[in] key The name of the key in the preference
- * @param[in] user_data The user data passed from the callback registration function
- * @pre This function is invoked when the value of the key is overwritten after you register this callback using preference_set_changed_cb().
- * @see preference_set_changed_cb()
- * @see preference_unset_changed_cb()
- * @see preference_set_boolean()
- * @see preference_set_int()
- * @see preference_set_string()
- * @see preference_set_double()
- */
-typedef void (*preference_changed_cb) (const char *key, void *user_data);
-
-
-/**
- * @brief Called to get key string, once for each key-value pair in the preference.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @remarks You should not free the @a key returned by this function.
- * @param[in] key The key of the value added to the preference
- * @param[in] value The value associated with the key
- * @param[in] user_data The user data passed from the foreach function
- * @return @c true to continue with the next iteration of the loop,
- * otherwise @c false to break out of the loop
- * @pre preference_foreach_item() will invoke this callback function.
- * @see preference_foreach_item()
- */
-typedef bool (*preference_item_cb)(const char *key, void *user_data);
-
-
-/**
- * @brief Sets an integer value in the preference.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @param[in] key The name of the key to modify
- * @param[in] value The new @c int value for the given key
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #PREFERENCE_ERROR_NONE Successful
- * @retval #PREFERENCE_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #PREFERENCE_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #PREFERENCE_ERROR_IO_ERROR Internal I/O Error
- * @see preference_get_int()
- */
-int preference_set_int(const char *key, int value);
-
-
-/**
- * @brief Gets an integer value from the preference.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @param[in] key The name of the key to retrieve
- * @param[out] value The @c int value for the given key
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #PREFERENCE_ERROR_NONE Successful
- * @retval #PREFERENCE_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #PREFERENCE_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #PREFERENCE_ERROR_NO_KEY Required key not available
- * @retval #PREFERENCE_ERROR_IO_ERROR Internal I/O Error
- * @see preference_set_int()
- */
-int preference_get_int(const char *key, int *value);
-
-
-/**
- * @brief Sets a double value in the preference.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @param[in] key The name of the key to modify
- * @param[in] value The new @c double value associated with the given key
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #PREFERENCE_ERROR_NONE Successful
- * @retval #PREFERENCE_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #PREFERENCE_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #PREFERENCE_ERROR_IO_ERROR Internal I/O Error
- * @see preference_get_double()
- */
-int preference_set_double(const char *key, double value);
-
-
-/**
- * @brief Gets a double value from the preference.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @param[in] key The name of the key to retrieve
- * @param[out] value The @c double value associated with the given key
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #PREFERENCE_ERROR_NONE Successful
- * @retval #PREFERENCE_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #PREFERENCE_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #PREFERENCE_ERROR_NO_KEY Required key not available
- * @retval #PREFERENCE_ERROR_IO_ERROR Internal I/O Error
- * @see preference_set_double()
- */
-int preference_get_double(const char *key, double *value);
-
-
-/**
- * @brief Sets a string value in the preference.
- * @details It makes a deep copy of the added string value.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @param[in] key The name of the key to modify
- * @param[in] value The new @c string value associated with the given key
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #PREFERENCE_ERROR_NONE Successful
- * @retval #PREFERENCE_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #PREFERENCE_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #PREFERENCE_ERROR_IO_ERROR Internal I/O Error
- * @see preference_get_string()
- */
-int preference_set_string(const char *key, const char *value);
-
-
-/**
- * @brief Gets a string value from the preference.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @remarks @a value must be released using free().
- * @param[in] key The name of the key to retrieve
- * @param[out] value The @c string value associated with the given key
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #PREFERENCE_ERROR_NONE Successful
- * @retval #PREFERENCE_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #PREFERENCE_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #PREFERENCE_ERROR_NO_KEY Required key not available
- * @retval #PREFERENCE_ERROR_IO_ERROR Internal I/O Error
- * @see preference_set_string()
- */
-int preference_get_string(const char *key, char **value);
-
-
-/**
- * @brief Sets a boolean value in the preference.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @param[in] key The name of the key to modify
- * @param[in] value The new @c boolean value associated with the given key
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #PREFERENCE_ERROR_NONE Successful
- * @retval #PREFERENCE_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #PREFERENCE_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #PREFERENCE_ERROR_IO_ERROR Internal I/O Error
- * @see preference_get_boolean()
- */
-int preference_set_boolean(const char *key, bool value);
-
-
-/**
- * @brief Gets a boolean value from the preference.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @param[in] key The name of the key to retrieve
- * @param[out] value The @c boolean value associated with the given key
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #PREFERENCE_ERROR_NONE Successful
- * @retval #PREFERENCE_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #PREFERENCE_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #PREFERENCE_ERROR_NO_KEY Required key not available
- * @retval #PREFERENCE_ERROR_IO_ERROR Internal I/O Error
- * @see preference_set_boolean()
- */
-int preference_get_boolean(const char *key, bool *value);
-
-
-/**
- * @brief Removes any value with the given @a key from the preference.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @param[in] key The name of the key to remove
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #PREFERENCE_ERROR_NONE Successful
- * @retval #PREFERENCE_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #PREFERENCE_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #PREFERENCE_ERROR_NO_KEY Required key not available
- * @retval #PREFERENCE_ERROR_IO_ERROR Internal I/O Error
- */
-int preference_remove(const char *key);
-
-
-/**
- * @brief Checks whether the given @a key exists in the preference.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @param[in] key The name of the key to check
- * @param[out] existing If @c true the @a key exists in the preference,
- * otherwise @c false
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #PREFERENCE_ERROR_NONE Successful
- * @retval #PREFERENCE_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #PREFERENCE_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #PREFERENCE_ERROR_IO_ERROR Internal I/O Error
- */
-int preference_is_existing(const char *key, bool *existing);
-
-
-/**
- * @brief Removes all key-value pairs from the preference.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #PREFERENCE_ERROR_NONE Successful
- * @retval #PREFERENCE_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #PREFERENCE_ERROR_IO_ERROR Internal I/O Error
- * @see preference_remove()
- */
-int preference_remove_all(void);
-
-
-/**
- * @brief Registers a callback function to be invoked when value of the given key in the preference changes.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @param[in] key The name of the key to monitor
- * @param[in] callback The callback function to register
- * @param[in] user_data The user data to be passed to the callback function
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #PREFERENCE_ERROR_NONE Successful
- * @retval #PREFERENCE_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #PREFERENCE_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #PREFERENCE_ERROR_NO_KEY Required key not available
- * @retval #PREFERENCE_ERROR_IO_ERROR Internal I/O Error
- * @post preference_changed_cb() will be invoked.
- * @see preference_unset_changed_cb()
- * @see preference_changed_cb()
- */
-int preference_set_changed_cb(const char *key, preference_changed_cb callback, void *user_data);
-
-
-/**
- * @brief Unregisters the callback function.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @param[in] key The name of the key to monitor
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #PREFERENCE_ERROR_NONE Successful
- * @retval #PREFERENCE_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #PREFERENCE_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #PREFERENCE_ERROR_NO_KEY Required key not available
- * @retval #PREFERENCE_ERROR_IO_ERROR Internal I/O Error
- * @see preference_set_changed_cb()
- */
-int preference_unset_changed_cb(const char *key);
-
-
-/**
- * @brief Retrieves all key-value pairs in the preference by invoking the callback function.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @param[in] callback The callback function to get key value once for each key-value pair in the preference
- * @param[in] user_data The user data to be passed to the callback function
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #PREFERENCE_ERROR_NONE Successful
- * @retval #PREFERENCE_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #PREFERENCE_ERROR_IO_ERROR Internal I/O Error
- * @post This function invokes preference_item_cb() repeatedly to get each key-value pair in the preference.
- * @see preference_item_cb()
- */
-int preference_foreach_item(preference_item_cb callback, void *user_data);
-
-
-/**
- * @}
- */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __TIZEN_APPFW_PREFERENCE_H__ */
-
diff --git a/include/app_preference_internal.h b/include/app_preference_internal.h
deleted file mode 100644
index 478efb7..0000000
--- a/include/app_preference_internal.h
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Copyright (c) 2011 - 2016 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.
- */
-
-
-#ifndef __TIZEN_APPFW_PREFERENCE_INTERNAL_H__
-#define __TIZEN_APPFW_PREFERENCE_INTERNAL_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "app_preference_log.h"
-#include "linux/limits.h"
-
-#define BUF_LEN (4096)
-#define PREF_DIR ".pref/"
-
-#define PREFERENCE_KEY_PATH_LEN 1024
-#define ERR_LEN 1024
-
-#define PREF_DB_NAME ".pref.db"
-#define PREF_TBL_NAME "pref"
-#define PREF_F_KEY_NAME "pref_key"
-#define PREF_F_TYPE_NAME "pref_type"
-#define PREF_F_DATA_NAME "pref_data"
-
-/* ASCII VALUE */
-#define PREF_KEYNAME_C_PAD '='
-#define PREF_KEYNAME_C_PLUS '+'
-#define PREF_KEYNAME_C_SLASH '/'
-
-#define PREF_KEYNAME_C_DOT '.'
-#define PREF_KEYNAME_C_UNDERSCORE '_'
-#define PREF_KEYNAME_C_HYPHEN '-'
-
-/**
- * @brief Definition for PREFERENCE_ERROR_WRONG_PREFIX.
- */
-#define PREFERENCE_ERROR_WRONG_PREFIX -2
-
-/**
- * @brief Definition for PREFERENCE_ERROR_WRONG_TYPE.
- */
-#define PREFERENCE_ERROR_WRONG_TYPE -3
-
-/**
- * @brief Definition for PREFERENCE_ERROR_FILE_OPEN.
- */
-#define PREFERENCE_ERROR_FILE_OPEN -21
-
-/**
- * @brief Definition for PREFERENCE_ERROR_FILE_FREAD.
- */
-#define PREFERENCE_ERROR_FILE_FREAD -22
-
-/**
- * @brief Definition for PREFERENCE_ERROR_FILE_FGETS.
- */
-#define PREFERENCE_ERROR_FILE_FGETS -23
-
-/**
- * @brief Definition for PREFERENCE_ERROR_FILE_WRITE.
- */
-#define PREFERENCE_ERROR_FILE_WRITE -24
-
-/**
- * @brief Definition for PREFERENCE_ERROR_FILE_SYNC.
- */
-#define PREFERENCE_ERROR_FILE_SYNC -25
-
-/**
- * @brief Definition for PREFERENCE_ERROR_FILE_CHMOD.
- */
-#define PREFERENCE_ERROR_FILE_CHMOD -28
-
-/**
- * @brief Definition for PREFERENCE_ERROR_FILE_LOCK.
- */
-#define PREFERENCE_ERROR_FILE_LOCK -29
-
-typedef enum {
- PREFERENCE_TYPE_NONE = 0,
- PREFERENCE_TYPE_STRING,
- PREFERENCE_TYPE_INT,
- PREFERENCE_TYPE_DOUBLE,
- PREFERENCE_TYPE_BOOLEAN,
-} preference_type_e;
-
-typedef struct _pref_changed_cb_node_t {
- char *key;
- preference_changed_cb cb;
- void *user_data;
- struct _pref_changed_cb_node_t *prev;
- struct _pref_changed_cb_node_t *next;
-} pref_changed_cb_node_t;
-
-typedef struct _keynode_t {
- char *keyname; /**< Keyname for keynode */
- int type; /**< Keynode type */
- union {
- int i; /**< Integer type */
- int b; /**< Bool type */
- double d; /**< Double type */
- char *s; /**< String type */
- } value; /**< Value for keynode */
- struct _keynode_t *next; /**< Next keynode */
-} keynode_t;
-
-/**
- * @brief The structure type for opaque type. It must be used via accessor functions.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-typedef struct _keylist_t {
- int num; /**< Number of list */
- keynode_t *head; /**< Head node */
- keynode_t *cursor; /**< Cursor node */
-} keylist_t;
-
-
-int _preference_kdb_add_notify
- (keynode_t *keynode, preference_changed_cb cb, void *data);
-int _preference_kdb_del_notify
- (keynode_t *keynode);
-
-int _preference_get_key_path(keynode_t *keynode, char *path);
-int _preference_get_key(keynode_t *keynode);
-
-int _preference_keynode_set_keyname(keynode_t *keynode, const char *keyname);
-__attribute__ ((gnu_inline)) inline keynode_t *_preference_keynode_new(void);
-__attribute__ ((gnu_inline)) inline void _preference_keynode_free(keynode_t *keynode);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __TIZEN_APPFW_PREFERENCE_INTERNAL_H__ */
-
diff --git a/include/app_preference_log.h b/include/app_preference_log.h
deleted file mode 100644
index 5aa8144..0000000
--- a/include/app_preference_log.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (c) 2015 - 2016 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.
- */
-
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-
-#define LOG_TAG "CAPI_APPFW_APPLICATION_PREFERENCE"
-#define DBG_MODE (1)
-
-#ifndef __PREFERENCE_LOG_H__
-#define __PREFERENCE_LOG_H__
-
-#include <stdio.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <dlog.h>
-
-
-#define INFO(fmt, arg...)
-#define DBG(fmt, arg...) SECURE_SLOGI(fmt, ##arg)
-#define ERR(fmt, arg...) LOGE(fmt, ##arg)
-#define SECURE_ERR(fmt, arg...) SECURE_SLOGE(fmt, ##arg)
-#define FATAL(fmt, arg...) SECURE_SLOGF(fmt, ##arg)
-#define WARN(fmt, arg...) SECURE_SLOGW(fmt, ##arg)
-
-
-/************** Return ***************/
-#define ret_if(expr) \
- do { \
- if (expr) { \
- ERR("(%s) -> %s() return", #expr, __FUNCTION__); \
- return; \
- } \
- } while (0)
-#define retv_if(expr, val) \
- do { \
- if (expr) { \
- ERR("(%s) -> %s() return", #expr, __FUNCTION__); \
- return (val); \
- } \
- } while (0)
-#define retm_if(expr, fmt, arg...) \
- do { \
- if (expr) { \
- ERR(fmt, ##arg); \
- return; \
- } \
- } while (0)
-#define retvm_if(expr, val, fmt, arg...) \
- do { \
- if (expr) { \
- ERR(fmt, ##arg); \
- return (val); \
- } \
- } while (0)
-#define retex_if(expr, fmt, arg...) \
- do { \
- if (expr) { \
- ERR(fmt, ##arg); \
- goto CATCH; \
- } \
- } while (0)
-
-
-/************** TimeCheck ***************/
-#ifdef PREFERENCE_TIMECHECK
-#define START_TIME_CHECK \
- init_time();\
- startT = set_start_time();
-#define END_TIME_CHECK \
- PREFERENCE_DEBUG("time = %f ms\n", exec_time(startT));
-#else
-#define START_TIME_CHECK
-#define END_TIME_CHECK
-#endif
-
-
-#endif /* __PREFERENCE_LOG_H__ */
-
diff --git a/include/app_resource_manager.h b/include/app_resource_manager.h
deleted file mode 100644
index 927f00b..0000000
--- a/include/app_resource_manager.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright (c) 2011 - 2016 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.
- */
-
-#ifndef __TIZEN_APPFW_RESOURCE_MANAGER_H__
-#define __TIZEN_APPFW_RESOURCE_MANAGER_H__
-
-#include <tizen.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @file app_resource_manager.h
- */
-
-/**
- * @addtogroup CAPI_RESOURCE_MANAGER_MODULE
- * @{
- */
-
-/**
- * @brief Enumeration for Resource Types
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- */
-typedef enum {
- APP_RESOURCE_TYPE_IMAGE = 0, /**<Image*/
- APP_RESOURCE_TYPE_LAYOUT, /**<Edje*/
- APP_RESOURCE_TYPE_SOUND, /**<Sound*/
- APP_RESOURCE_TYPE_BIN, /**<Bin*/
- APP_RESOURCE_TYPE_MIN = APP_RESOURCE_TYPE_IMAGE,
- APP_RESOURCE_TYPE_MAX = APP_RESOURCE_TYPE_BIN,
-/*add values between APP_RESOURCE_TYPE_MIN and APP_RESOURCE_TYPE_MAX*/
-} app_resource_e;
-
-
-/**
- * @brief Enumeration for App Resource Manager Error.
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- */
-typedef enum {
- APP_RESOURCE_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
- APP_RESOURCE_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
- APP_RESOURCE_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
- APP_RESOURCE_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR, /**< I/O error */
-} app_resource_error_e;
-
-
-/**
- * @brief Creates resource manager and get from db.
- *
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @remarks If resource manager already exists,
- * It will just return APP_RESOURCE_ERROR_NONE
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #APP_RESOURCE_ERROR_NONE Successful
- * @retval #APP_RESOURCE_ERROR_IO_ERROR IO Internal I/O Error
- * @retval #APP_RESOURCE_ERROR_OUT_OF_MEMORY Out of memeory
- * @see app_resource_manager_release()
- */
-int app_resource_manager_init(void);
-
-
-/**
- * @brief Converts resource ID to path name
- *
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @remarks If resource manager is not created yet,
- * app_resource_manager_init() will be invoked automatically.
- * Caller should free the returned pointer.
- * @param[in] type Resource type @see app_resource_e
- * @param[in] id Resource ID
- * @param[out] path The name of requested resource on success, otherwise NULL
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #APP_RESOURCE_ERROR_NONE Successful
- * @retval #APP_RESOURCE_ERROR_INVALID_PARAMETER Invalid Parameter
- * @retval #APP_RESOURCE_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #APP_RESOURCE_ERROR_IO_ERROR Internal I/O Error or failed to find valid resource
- * @see app_resource_manager_init()
- */
-int app_resource_manager_get(app_resource_e type, const char *id, char **path);
-
-
-/**
- * @brief Destroys resource manager.
- *
- * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @remarks Please note that the instance of resource manager should only be released when the application is closing.
- * It is a highly recommended way to improve run-time performance.
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #APP_RESOURCE_ERROR_NONE Successful
- * @see app_resource_manager_init()
- */
-int app_resource_manager_release(void);
-
-
-/**
- * @}
- */
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __TIZEN_APPFW_RESOURCE_MANAGER_H__ */
-
diff --git a/include/app_types.h b/include/app_types.h
deleted file mode 100644
index a939615..0000000
--- a/include/app_types.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2011 - 2016 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.
-*/
-
-
-#ifndef __TIZEN_APPFW_APP_TYPES_H__
-#define __TIZEN_APPFW_APP_TYPES_H__
-
-#include <tizen.h>
-
-/**
- * @file app_types.h
- */
-
-/**
- * @addtogroup CAPI_APPLICATION_MODULE
- * @{
- */
-
-/**
- * @brief Enumeration for application error.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-typedef enum {
- APP_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
- APP_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
- APP_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
- APP_ERROR_INVALID_CONTEXT = TIZEN_ERROR_APPLICATION | 0x01, /**< Invalid application context */
- APP_ERROR_NO_SUCH_FILE = TIZEN_ERROR_NO_SUCH_FILE, /**< No such file or directory */
- APP_ERROR_ALREADY_RUNNING = TIZEN_ERROR_ALREADY_IN_PROGRESS, /**< Application is already running */
- APP_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied @if MOBILE (Since 2.3.1) @endif */
-} app_error_e;
-
-
-/**
- * @}
- */
-
-#endif /* __TIZEN_APPFW_APP_TYPES_H__ */
-
diff --git a/packaging/capi-appfw-application.spec b/packaging/capi-appfw-application.spec
index 28c406f..1d185d7 100644
--- a/packaging/capi-appfw-application.spec
+++ b/packaging/capi-appfw-application.spec
@@ -15,6 +15,8 @@ BuildRequires: pkgconfig(aul)
BuildRequires: pkgconfig(appsvc)
BuildRequires: pkgconfig(elementary)
BuildRequires: pkgconfig(capi-base-common)
+BuildRequires: pkgconfig(capi-appfw-app-control)
+BuildRequires: pkgconfig(capi-appfw-app-common)
BuildRequires: pkgconfig(sqlite3)
BuildRequires: pkgconfig(libtzplatform-config)
BuildRequires: pkgconfig(vconf-internal-keys)
@@ -25,34 +27,6 @@ BuildRequires: pkgconfig(glib-2.0)
%description
An Application library in SLP C API package.
-%package -n capi-appfw-app-control
-Summary: An Application Control library in Tizen C API
-Group: System/API
-
-%description -n capi-appfw-app-control
-An Application Control library in Tizen C API package.
-
-%package -n capi-appfw-app-common
-Summary: An Application Common library in Tizen C API
-Group: System/API
-
-%description -n capi-appfw-app-common
-An Application Common library in Tizen C API package.
-
-%package -n capi-appfw-preference
-Summary: An Application Preference library in Tizen C API
-Group: System/API
-
-%description -n capi-appfw-preference
-An Application Preference library in Tizen C API package.
-
-%package -n capi-appfw-event
-Summary: An Application Event library in Tizen C API
-Group: System/API
-
-%description -n capi-appfw-event
-An Application Event library in Tizen C API package.
-
%package devel
Summary: An Application library in SLP C API (Development)
Group: System/API
@@ -61,38 +35,6 @@ Requires: %{name} = %{version}-%{release}
%description devel
An Application library in SLP C API (Development) package.
-%package -n capi-appfw-app-control-devel
-Summary: An Application Control library in Tizen C API (Development)
-Group: System/API
-Requires: capi-appfw-app-control = %{version}-%{release}
-
-%description -n capi-appfw-app-control-devel
-An Application Control library in Tizen C API (Development) package.
-
-%package -n capi-appfw-app-common-devel
-Summary: An Application Common library in Tizen C API (Development)
-Group: System/API
-Requires: capi-appfw-app-common = %{version}-%{release}
-
-%description -n capi-appfw-app-common-devel
-An Application Common library in Tizen C API (Development) package.
-
-%package -n capi-appfw-preference-devel
-Summary: An Application Preference library in Tizen C API (Development)
-Group: System/API
-Requires: capi-appfw-preference = %{version}-%{release}
-
-%description -n capi-appfw-preference-devel
-An Application Preference library in Tizen C API (Development) package.
-
-%package -n capi-appfw-event-devel
-Summary: An Application Event library in Tizen C API (Development)
-Group: System/API
-Requires: capi-appfw-event = %{version}-%{release}
-
-%description -n capi-appfw-event-devel
-An Application Event library in Tizen C API (Development) package.
-
%prep
%setup -q
@@ -110,43 +52,11 @@ rm -rf %{buildroot}
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
-%post -n capi-appfw-app-control -p /sbin/ldconfig
-%postun -n capi-appfw-app-control -p /sbin/ldconfig
-
-%post -n capi-appfw-app-common -p /sbin/ldconfig
-%postun -n capi-appfw-app-common -p /sbin/ldconfig
-
-%post -n capi-appfw-preference -p /sbin/ldconfig
-%postun -n capi-appfw-preference -p /sbin/ldconfig
-
-%post -n capi-appfw-event -p /sbin/ldconfig
-%postun -n capi-appfw-event -p /sbin/ldconfig
-
%files
%manifest %{name}.manifest
%{_libdir}/libcapi-appfw-application.so.*
%license LICENSE
-%files -n capi-appfw-app-control
-%manifest %{name}.manifest
-%{_libdir}/libcapi-appfw-app-control.so.*
-%license LICENSE
-
-%files -n capi-appfw-app-common
-%manifest %{name}.manifest
-%{_libdir}/libcapi-appfw-app-common.so.*
-%license LICENSE
-
-%files -n capi-appfw-preference
-%manifest %{name}.manifest
-%{_libdir}/libcapi-appfw-preference.so.*
-%license LICENSE
-
-%files -n capi-appfw-event
-%manifest %{name}.manifest
-%{_libdir}/libcapi-appfw-event.so.*
-%license LICENSE
-
%files devel
%manifest %{name}.manifest
%{_includedir}/appfw/app.h
@@ -155,32 +65,3 @@ rm -rf %{buildroot}
%{_includedir}/appfw/app_i18n.h
%{_libdir}/pkgconfig/capi-appfw-application.pc
%{_libdir}/libcapi-appfw-application.so
-
-%files -n capi-appfw-app-control-devel
-%manifest %{name}.manifest
-%{_includedir}/appfw/app_control.h
-%{_includedir}/appfw/app_control_internal.h
-%{_libdir}/pkgconfig/capi-appfw-app-control.pc
-%{_libdir}/libcapi-appfw-app-control.so
-
-%files -n capi-appfw-app-common-devel
-%manifest %{name}.manifest
-%{_includedir}/appfw/app_common.h
-%{_includedir}/appfw/app_types.h
-%{_includedir}/appfw/app_resource_manager.h
-%{_libdir}/pkgconfig/capi-appfw-app-common.pc
-%{_libdir}/libcapi-appfw-app-common.so
-
-%files -n capi-appfw-preference-devel
-%manifest %{name}.manifest
-%{_includedir}/appfw/app_preference.h
-%{_includedir}/appfw/app_preference_internal.h
-%{_includedir}/appfw/app_preference_log.h
-%{_libdir}/pkgconfig/capi-appfw-preference.pc
-%{_libdir}/libcapi-appfw-preference.so
-
-%files -n capi-appfw-event-devel
-%manifest %{name}.manifest
-%{_includedir}/appfw/app_event.h
-%{_libdir}/pkgconfig/capi-appfw-event.pc
-%{_libdir}/libcapi-appfw-event.so
diff --git a/preference/CMakeLists.txt b/preference/CMakeLists.txt
deleted file mode 100644
index ef5c08b..0000000
--- a/preference/CMakeLists.txt
+++ /dev/null
@@ -1,66 +0,0 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-SET(fw_name "capi-appfw-preference")
-
-PROJECT(${fw_name})
-
-SET(CMAKE_INSTALL_PREFIX /usr)
-SET(PREFIX ${CMAKE_INSTALL_PREFIX})
-
-SET(INC_DIR ${CMAKE_SOURCE_DIR}/include)
-INCLUDE_DIRECTORIES(${INC_DIR})
-
-SET(requires "dlog capi-base-common sqlite3 glib-2.0")
-SET(pc_requires "capi-base-common capi-appfw-app-common")
-
-INCLUDE(FindPkgConfig)
-pkg_check_modules(${fw_name} REQUIRED ${requires})
-FOREACH(flag ${${fw_name}_CFLAGS})
- SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
-ENDFOREACH(flag)
-
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror")
-SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
-
-IF("${ARCH}" STREQUAL "arm")
- ADD_DEFINITIONS("-DTARGET")
-ENDIF("${ARCH}" STREQUAL "arm")
-
-ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
-ADD_DEFINITIONS("-DSLP_DEBUG")
-
-SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=${LIB_INSTALL_DIR}")
-
-add_library(${fw_name} SHARED
- preference.c
- preference_inoti.c
- )
-
-TARGET_LINK_LIBRARIES(${fw_name} capi-appfw-app-common ${${fw_name}_LDFLAGS})
-
-SET_TARGET_PROPERTIES(${fw_name}
- PROPERTIES
- VERSION ${FULLVER}
- SOVERSION ${MAJORVER}
- CLEAN_DIRECT_OUTPUT 1
-)
-
-INSTALL(TARGETS ${fw_name} DESTINATION ${LIB_INSTALL_DIR})
-INSTALL(
- DIRECTORY ${INC_DIR}/ DESTINATION include/appfw
- FILES_MATCHING
- PATTERN "*_private.h" EXCLUDE
- PATTERN "${INC_DIR}/*.h"
- )
-
-SET(PC_NAME ${fw_name})
-SET(PC_REQUIRED ${pc_requires})
-SET(PC_LDFLAGS -l${fw_name})
-
-CONFIGURE_FILE(
- ${CMAKE_SOURCE_DIR}/capi-appfw-module.pc.in
- ${CMAKE_SOURCE_DIR}/${fw_name}.pc
- @ONLY
-)
-INSTALL(FILES ${CMAKE_SOURCE_DIR}/${fw_name}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
-
-
diff --git a/preference/preference.c b/preference/preference.c
deleted file mode 100755
index 246f011..0000000
--- a/preference/preference.c
+++ /dev/null
@@ -1,1578 +0,0 @@
-/*
- * Copyright (c) 2011 - 2016 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 <stdlib.h>
-#include <limits.h>
-#include <string.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <sys/stat.h>
-#include <sys/xattr.h>
-#include <ctype.h>
-#include <string.h>
-#include <execinfo.h>
-#include <glib.h>
-
-#include <app_preference.h>
-#include <app_preference_internal.h>
-#include <app_common.h>
-
-#include <sys/syscall.h>
-
-#ifdef PREFERENCE_TIMECHECK
-#include <sys/time.h>
-#endif
-
-#ifndef API
-#define API __attribute__ ((visibility("default")))
-#endif
-
-#define PREFERENCE_ERROR_RETRY_CNT 7
-#define PREFERENCE_ERROR_RETRY_SLEEP_UTIME 10000
-
-#define DELIMITER 29
-
-static int g_posix_errno;
-static int g_preference_errno;
-static char *g_pref_dir_path = NULL;
-
-enum preference_op_t {
- PREFERENCE_OP_GET = 0,
- PREFERENCE_OP_SET = 1
-};
-
-#ifdef PREFERENCE_TIMECHECK
-double correction, startT;
-
-double set_start_time(void)
-{
- struct timeval tv;
- double curtime;
-
- gettimeofday(&tv, NULL);
- curtime = tv.tv_sec * 1000 + (double)tv.tv_usec / 1000;
- return curtime;
-}
-
-double exec_time(double start)
-{
- double end = set_start_time();
- return (end - start - correction);
-}
-
-int init_time(void)
-{
- double temp_t;
- temp_t = set_start_time();
- correction = exec_time(temp_t);
-
- return 0;
-}
-#endif
-
-char *_preference_get_pref_dir_path()
-{
- char *app_data_path = NULL;
-
- if (!g_pref_dir_path) {
- g_pref_dir_path = (char *)malloc(PREFERENCE_KEY_PATH_LEN + 1);
-
- if ((app_data_path = app_get_data_path()) == NULL) {
- /* LCOV_EXCL_START */
- ERR("IO_ERROR(0x%08x) : fail to get data directory", PREFERENCE_ERROR_IO_ERROR);
- free(g_pref_dir_path);
- g_pref_dir_path = NULL;
- return NULL;
- /* LCOV_EXCL_STOP */
- }
-
- snprintf(g_pref_dir_path, PREFERENCE_KEY_PATH_LEN, "%s%s", app_data_path, PREF_DIR);
- INFO("pref_dir_path: %s", g_pref_dir_path);
- free(app_data_path);
- }
- return g_pref_dir_path;
-}
-
-int _preference_keynode_set_keyname(keynode_t *keynode, const char *keyname)
-{
- if (keynode->keyname) free(keynode->keyname);
- keynode->keyname = strndup(keyname, PREFERENCE_KEY_PATH_LEN);
- retvm_if(keynode->keyname == NULL, PREFERENCE_ERROR_IO_ERROR, "strndup Fails");
- return PREFERENCE_ERROR_NONE;
-}
-
-static inline void _preference_keynode_set_value_int(keynode_t *keynode, const int value)
-{
- keynode->type = PREFERENCE_TYPE_INT;
- keynode->value.i = value;
-}
-
-static inline void _preference_keynode_set_value_boolean(keynode_t *keynode, const int value)
-{
- keynode->type = PREFERENCE_TYPE_BOOLEAN;
- keynode->value.b = !!value;
-}
-
-static inline void _preference_keynode_set_value_double(keynode_t *keynode, const double value)
-{
- keynode->type = PREFERENCE_TYPE_DOUBLE;
- keynode->value.d = value;
-}
-
-static inline void _preference_keynode_set_value_string(keynode_t *keynode, const char *value)
-{
- keynode->type = PREFERENCE_TYPE_STRING;
- keynode->value.s = strdup(value);
-}
-
-__attribute__ ((gnu_inline)) inline keynode_t *_preference_keynode_new(void)
-{
- keynode_t *keynode;
- keynode = calloc(1, sizeof(keynode_t));
-
- return keynode;
-}
-
-__attribute__ ((gnu_inline)) inline void _preference_keynode_free(keynode_t *keynode)
-{
- if (keynode) {
- if (keynode->keyname)
- free(keynode->keyname);
- if (keynode->type == PREFERENCE_TYPE_STRING && keynode->value.s)
- free(keynode->value.s);
- free(keynode);
- }
-}
-
-int _preference_get_key_name(const char *path, char **keyname)
-{
- int read_size = 0;
- size_t keyname_len = 0;
- char *convert_key = NULL;
- FILE *fp = NULL;
-
- if ((fp = fopen(path, "r")) == NULL)
- return PREFERENCE_ERROR_FILE_OPEN;
-
- read_size = fread((void *)&keyname_len, sizeof(int), 1, fp);
- if (read_size <= 0 || keyname_len > PREFERENCE_KEY_PATH_LEN) {
- fclose(fp);
- return PREFERENCE_ERROR_FILE_FREAD;
- }
-
- convert_key = (char *)calloc(1, keyname_len+1);
- if (convert_key == NULL) {
- LOGE("memory alloc failed");
- fclose(fp);
- return PREFERENCE_ERROR_OUT_OF_MEMORY;
- }
-
- read_size = fread((void *)convert_key, keyname_len, 1, fp);
- if (read_size <= 0) {
- free(convert_key);
- fclose(fp);
- return PREFERENCE_ERROR_FILE_FREAD;
- }
-
- *keyname = convert_key;
-
- fclose(fp);
-
- return PREFERENCE_ERROR_NONE;
-}
-
-int _preference_get_key_path(keynode_t *keynode, char *path)
-{
- const char *key = NULL;
- char *pref_dir_path = NULL;
- gchar *convert_key;
- char *keyname = keynode->keyname;
-
- if (!keyname) {
- LOGE("keyname is null");
- return PREFERENCE_ERROR_WRONG_PREFIX;
- }
-
- pref_dir_path = _preference_get_pref_dir_path();
- if (!pref_dir_path) {
- LOGE("_preference_get_pref_dir_path() failed.");
- return PREFERENCE_ERROR_IO_ERROR;
- }
-
- convert_key = g_compute_checksum_for_string(G_CHECKSUM_SHA1,
- keyname,
- strlen(keyname));
- if (convert_key == NULL) {
- LOGE("fail to convert");
- return PREFERENCE_ERROR_IO_ERROR;
- }
-
- key = (const char *)convert_key;
-
- snprintf(path, PATH_MAX-1, "%s%s", pref_dir_path, key);
-
- g_free(convert_key);
-
- return PREFERENCE_ERROR_NONE;
-}
-
-static int _preference_set_key_check_pref_dir()
-{
- char *pref_dir_path = NULL;
- mode_t dir_mode = 0664 | 0111;
- char err_buf[ERR_LEN] = {0,};
-
- pref_dir_path = _preference_get_pref_dir_path();
- if (!pref_dir_path) {
- LOGE("_preference_get_pref_dir_path() failed.");
- return PREFERENCE_ERROR_IO_ERROR;
- }
-
- if (access(pref_dir_path, F_OK) < 0) {
- if (mkdir(pref_dir_path, dir_mode) < 0) {
- strerror_r(errno, err_buf, sizeof(err_buf));
- ERR("mkdir() failed(%d/%s)", errno, err_buf);
- return PREFERENCE_ERROR_IO_ERROR;
- }
- }
-
- return PREFERENCE_ERROR_NONE;
-}
-
-static int _preference_set_key_creation(const char *path)
-{
- int fd;
- mode_t temp;
- char err_buf[ERR_LEN] = {0,};
-
- temp = umask(0000);
- fd = open(path, O_RDWR|O_CREAT, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP);
- umask(temp);
-
- if (fd == -1) {
- strerror_r(errno, err_buf, sizeof(err_buf));
- ERR("open(rdwr,create) error: %d(%s)", errno, err_buf);
- return PREFERENCE_ERROR_IO_ERROR;
- }
- close(fd);
-
- return PREFERENCE_ERROR_NONE;
-}
-
-static int _preference_set_file_lock(int fd, short type)
-{
- struct flock l;
-
- l.l_type = type;
- l.l_start = 0; /*Start at begin*/
- l.l_whence = SEEK_SET;
- l.l_len = 0; /*Do it with whole file*/
-
- return fcntl(fd, F_SETLK, &l);
-}
-
-/* LCOV_EXCL_START */
-static int _preference_get_pid_of_file_lock_owner(int fd, short type)
-{
- struct flock l;
-
- l.l_type = type;
- l.l_start = 0; /*Start at begin*/
- l.l_whence = SEEK_SET;
- l.l_len = 0; /*Do it with whole file*/
-
- if (fcntl(fd, F_GETLK, &l) < 0) {
- WARN("error in getting lock info");
- return -1;
- }
-
- if (l.l_type == F_UNLCK)
- return 0;
- else
- return l.l_pid;
-}
-/* LCOV_EXCL_STOP */
-
-static int _preference_set_read_lock(int fd)
-{
- return _preference_set_file_lock(fd, F_RDLCK);
-}
-
-static int _preference_set_write_lock(int fd)
-{
- return _preference_set_file_lock(fd, F_WRLCK);
-}
-
-static int _preference_set_unlock(int fd)
-{
- return _preference_set_file_lock(fd, F_UNLCK);
-}
-
-/* LCOV_EXCL_START */
-static void _preference_log_subject_label(void)
-{
- int fd;
- int ret;
- char smack_label[256] = {0,};
- char curren_path[256] = {0,};
- int tid;
- char err_buf[ERR_LEN] = {0,};
-
- tid = (int)syscall(SYS_gettid);
- snprintf(curren_path, sizeof(curren_path)-1, "/proc/%d/attr/current", tid);
- fd = open(curren_path, O_RDONLY);
- if (fd < 0) {
- strerror_r(errno, err_buf, sizeof(err_buf));
- LOGE("fail to open self current attr (err: %s)", err_buf);
- return;
- }
-
- ret = read(fd, smack_label, sizeof(smack_label)-1);
- if (ret < 0) {
- close(fd);
- strerror_r(errno, err_buf, sizeof(err_buf));
- LOGE("fail to open self current attr (err: %s)", err_buf);
- return;
- }
-
- ERR("current(%d) subject label : %s", tid, smack_label);
-
- close(fd);
-}
-/* LCOV_EXCL_STOP */
-
-static int _preference_check_retry_err(keynode_t *keynode, int preference_errno, int io_errno, int op_type)
-{
- int is_busy_err = 0;
- int rc = 0;
- char path[PATH_MAX] = {0,};
- char err_buf[ERR_LEN] = {0,};
-
- if (preference_errno == PREFERENCE_ERROR_FILE_OPEN) {
- switch (io_errno) {
- case ENOENT:
- if (op_type == PREFERENCE_OP_SET) {
- rc = _preference_get_key_path(keynode, path);
- if (rc != PREFERENCE_ERROR_NONE) {
- /* LCOV_EXCL_START */
- ERR("_preference_get_key_path error");
- _preference_log_subject_label();
- break;
- /* LCOV_EXCL_STOP */
- }
-
- rc = _preference_set_key_check_pref_dir();
- if (rc != PREFERENCE_ERROR_NONE) {
- /* LCOV_EXCL_START */
- ERR("_preference_set_key_check_pref_dir() failed.");
- _preference_log_subject_label();
- break;
- /* LCOV_EXCL_STOP */
- }
-
- rc = _preference_set_key_creation(path);
- if (rc != PREFERENCE_ERROR_NONE) {
- /* LCOV_EXCL_START */
- ERR("_preference_set_key_creation error : %s", path);
- _preference_log_subject_label();
- break;
- /* LCOV_EXCL_STOP */
- }
- INFO("%s key is created", keynode->keyname);
-
- is_busy_err = 1;
- }
- break;
- case EACCES:
- _preference_log_subject_label();
- break;
- case EAGAIN:
- case EMFILE:
- case ENFILE:
- case ETXTBSY:
- is_busy_err = 1;
- }
- } else if (preference_errno == PREFERENCE_ERROR_FILE_CHMOD) {
- switch (io_errno) {
- case EINTR:
- case EBADF:
- is_busy_err = 1;
- }
- } else if (preference_errno == PREFERENCE_ERROR_FILE_LOCK) {
- switch (io_errno) {
- case EBADF:
- case EAGAIN:
- case ENOLCK:
- is_busy_err = 1;
- }
- } else if (preference_errno == PREFERENCE_ERROR_FILE_WRITE) {
- switch (io_errno) {
- case 0:
- case EAGAIN:
- case EINTR:
- case EIO:
- case ENOMEM:
- is_busy_err = 1;
- }
- } else if (preference_errno == PREFERENCE_ERROR_FILE_FREAD) {
- switch (io_errno) {
- case EAGAIN:
- case EINTR:
- case EIO:
- is_busy_err = 1;
- }
- } else {
- is_busy_err = 0;
- }
-
- if (is_busy_err == 1) {
- return 1;
- } else {
- strerror_r(errno, err_buf, sizeof(err_buf));
- ERR("key(%s), check retry err: %d/(%d/%s).", keynode->keyname, preference_errno, io_errno, err_buf);
- return 0;
- }
-}
-
-static int _preference_set_key_filesys(keynode_t *keynode, int *io_errno)
-{
- char path[PATH_MAX] = {0,};
- FILE *fp = NULL;
- int ret = -1;
- int func_ret = PREFERENCE_ERROR_NONE;
- int err_no = 0;
- char err_buf[100] = { 0, };
- int is_write_error = 0;
- int retry_cnt = 0;
- size_t keyname_len = 0;
-
-retry_open:
- errno = 0;
- err_no = 0;
- func_ret = PREFERENCE_ERROR_NONE;
-
- ret = _preference_get_key_path(keynode, path);
- retv_if(ret != PREFERENCE_ERROR_NONE, ret);
-
- if ((fp = fopen(path, "r+")) == NULL) {
- func_ret = PREFERENCE_ERROR_FILE_OPEN;
- err_no = errno;
- goto out_return;
- }
-
-retry:
- errno = 0;
- err_no = 0;
- func_ret = PREFERENCE_ERROR_NONE;
-
- ret = _preference_set_write_lock(fileno(fp));
- if (ret == -1) {
- /* LCOV_EXCL_START */
- func_ret = PREFERENCE_ERROR_FILE_LOCK;
- err_no = errno;
- ERR("file(%s) lock owner(%d)",
- keynode->keyname,
- _preference_get_pid_of_file_lock_owner(fileno(fp), F_WRLCK));
- goto out_return;
- /* LCOV_EXCL_STOP */
- }
-
- /* write keyname and size */
- keyname_len = strlen(keynode->keyname);
-
- ret = fwrite((void *)&keyname_len, sizeof(int), 1, fp);
- if (ret <= 0) {
- /* LCOV_EXCL_START */
- if (!errno) {
- LOGW("number of written items is 0. try again");
- errno = EAGAIN;
- }
- err_no = errno;
- func_ret = PREFERENCE_ERROR_FILE_WRITE;
- goto out_unlock;
- /* LCOV_EXCL_STOP */
- }
-
- ret = fwrite((void *)keynode->keyname, keyname_len, 1, fp);
- if (ret <= 0) {
- /* LCOV_EXCL_START */
- if (!errno) {
- LOGW("number of written items is 0. try again");
- errno = EAGAIN;
- }
- err_no = errno;
- func_ret = PREFERENCE_ERROR_FILE_WRITE;
- goto out_unlock;
- /* LCOV_EXCL_STOP */
- }
-
- /* write key type */
- ret = fwrite((void *)&(keynode->type), sizeof(int), 1, fp);
- if (ret <= 0) {
- /* LCOV_EXCL_START */
- if (!errno) {
- LOGW("number of written items is 0. try again");
- errno = EAGAIN;
- }
- err_no = errno;
- func_ret = PREFERENCE_ERROR_FILE_WRITE;
- goto out_unlock;
- /* LCOV_EXCL_STOP */
- }
-
- /* write key value */
- switch (keynode->type) {
- case PREFERENCE_TYPE_INT:
- ret = fwrite((void *)&(keynode->value.i), sizeof(int), 1, fp);
- if (ret <= 0) is_write_error = 1;
- break;
- case PREFERENCE_TYPE_DOUBLE:
- ret = fwrite((void *)&(keynode->value.d), sizeof(double), 1, fp);
- if (ret <= 0) is_write_error = 1;
- break;
- case PREFERENCE_TYPE_BOOLEAN:
- ret = fwrite((void *)&(keynode->value.b), sizeof(int), 1, fp);
- if (ret <= 0) is_write_error = 1;
- break;
- case PREFERENCE_TYPE_STRING:
- ret = fprintf(fp, "%s", keynode->value.s);
- if (ret < strlen(keynode->value.s))
- is_write_error = 1;
- if (ftruncate(fileno(fp), ret) == -1)
- is_write_error = 1;
- break;
- default:
- func_ret = PREFERENCE_ERROR_WRONG_TYPE;
- goto out_unlock;
- }
-
- if (is_write_error) {
- /* LCOV_EXCL_START */
- if (!errno) {
- LOGW("number of written items is 0. try again");
- errno = EAGAIN;
- }
- err_no = errno;
- func_ret = PREFERENCE_ERROR_FILE_WRITE;
- goto out_unlock;
- /* LCOV_EXCL_STOP */
- }
-
- fflush(fp);
-
-out_unlock:
- ret = _preference_set_unlock(fileno(fp));
- if (ret == -1) {
- func_ret = PREFERENCE_ERROR_FILE_LOCK;
- err_no = errno;
- goto out_return;
- }
-
-out_return:
- if (func_ret != PREFERENCE_ERROR_NONE) {
- strerror_r(err_no, err_buf, 100);
- if (_preference_check_retry_err(keynode, func_ret, err_no, PREFERENCE_OP_SET)) {
- if (retry_cnt < PREFERENCE_ERROR_RETRY_CNT) {
- WARN("_preference_set_key_filesys(%d-%s) step(%d) failed(%d / %s) retry(%d)", keynode->type, keynode->keyname, func_ret, err_no, err_buf, retry_cnt);
- retry_cnt++;
- usleep((retry_cnt)*PREFERENCE_ERROR_RETRY_SLEEP_UTIME);
-
- if (fp)
- goto retry;
- else
- goto retry_open;
- } else {
- ERR("_preference_set_key_filesys(%d-%s) step(%d) faild(%d / %s) over the retry count.",
- keynode->type, keynode->keyname, func_ret, err_no, err_buf);
- }
- } else {
- ERR("_preference_set_key_filesys(%d-%s) step(%d) failed(%d / %s)\n", keynode->type, keynode->keyname, func_ret, err_no, err_buf);
- }
- } else if (retry_cnt > 0) {
- DBG("_preference_set_key_filesys ok with retry cnt(%d)", retry_cnt);
- }
-
- if (fp) {
- if (func_ret == PREFERENCE_ERROR_NONE) {
- ret = fdatasync(fileno(fp));
- if (ret == -1) {
- err_no = errno;
- func_ret = PREFERENCE_ERROR_FILE_SYNC;
- }
- }
- fclose(fp);
- }
- *io_errno = err_no;
-
- return func_ret;
-}
-
-static int _preference_set_key(keynode_t *keynode)
-{
- int ret = 0;
- int io_errno = 0;
- char err_buf[100] = { 0, };
-
- ret = _preference_set_key_filesys(keynode, &io_errno);
- if (ret == PREFERENCE_ERROR_NONE) {
- g_posix_errno = PREFERENCE_ERROR_NONE;
- g_preference_errno = PREFERENCE_ERROR_NONE;
- } else {
- /* LCOV_EXCL_START */
- strerror_r(io_errno, err_buf, 100);
- ERR("_preference_set_key(%s) step(%d) failed(%d / %s)", keynode->keyname, ret, io_errno, err_buf);
- g_posix_errno = io_errno;
- g_preference_errno = ret;
- /* LCOV_EXCL_STOP */
- }
-
- return ret;
-}
-
-
-/*
- * This function set the integer value of given key
- * @param[in] key key
- * @param[in] intval integer value to set
- * @return 0 on success, -1 on error
- */
-API int preference_set_int(const char *key, int intval)
-{
- int func_ret = PREFERENCE_ERROR_NONE;
- keynode_t *pKeyNode;
-
- START_TIME_CHECK
-
- retvm_if(key == NULL, PREFERENCE_ERROR_INVALID_PARAMETER, "Invalid argument: key is NULL");
-
- pKeyNode = _preference_keynode_new();
- retvm_if(pKeyNode == NULL, PREFERENCE_ERROR_OUT_OF_MEMORY, "key malloc fail");
-
- func_ret = _preference_keynode_set_keyname(pKeyNode, key);
- if (func_ret != PREFERENCE_ERROR_NONE) {
- /* LCOV_EXCL_START */
- ERR("set key name error");
- _preference_keynode_free(pKeyNode);
- return PREFERENCE_ERROR_IO_ERROR;
- /* LCOV_EXCL_STOP */
- }
- _preference_keynode_set_value_int(pKeyNode, intval);
-
- if (_preference_set_key(pKeyNode) != PREFERENCE_ERROR_NONE) {
- ERR("preference_set_int(%d) : key(%s/%d) error", getpid(), key, intval);
- func_ret = PREFERENCE_ERROR_IO_ERROR;
- } else {
- INFO("%s(%d) success", key, intval);
- }
-
- _preference_keynode_free(pKeyNode);
-
- END_TIME_CHECK
-
- return func_ret;
-}
-
-/*
-* This function set the boolean value of given key
-* @param[in] key key
-* @param[in] boolval boolean value to set
- (Integer value 1 is 'True', and 0 is 'False')
-* @return 0 on success, -1 on error
-*/
-API int preference_set_boolean(const char *key, bool boolval)
-{
- int func_ret = PREFERENCE_ERROR_NONE;
- keynode_t *pKeyNode;
-
- START_TIME_CHECK
-
- retvm_if(key == NULL, PREFERENCE_ERROR_INVALID_PARAMETER, "Invalid argument: key is NULL");
-
- pKeyNode = _preference_keynode_new();
- retvm_if(pKeyNode == NULL, PREFERENCE_ERROR_OUT_OF_MEMORY, "key malloc fail");
-
- func_ret = _preference_keynode_set_keyname(pKeyNode, key);
- if (func_ret != PREFERENCE_ERROR_NONE) {
- /* LCOV_EXCL_START */
- ERR("set key name error");
- _preference_keynode_free(pKeyNode);
- return PREFERENCE_ERROR_IO_ERROR;
- /* LCOV_EXCL_STOP */
- }
- _preference_keynode_set_value_boolean(pKeyNode, boolval);
-
- if (_preference_set_key(pKeyNode) != PREFERENCE_ERROR_NONE) {
- ERR("preference_set_boolean(%d) : key(%s/%d) error", getpid(), key, boolval);
- func_ret = PREFERENCE_ERROR_IO_ERROR;
- } else {
- INFO("%s(%d) success", key, boolval);
- }
-
- _preference_keynode_free(pKeyNode);
-
- END_TIME_CHECK
-
- return func_ret;
-}
-
-/*
- * This function set the double value of given key
- * @param[in] key key
- * @param[in] dblval double value to set
- * @return 0 on success, -1 on error
- */
-API int preference_set_double(const char *key, double dblval)
-{
- int func_ret = PREFERENCE_ERROR_NONE;
- keynode_t *pKeyNode;
-
- START_TIME_CHECK
-
- retvm_if(key == NULL, PREFERENCE_ERROR_INVALID_PARAMETER, "Invalid argument: key is NULL");
-
- pKeyNode = _preference_keynode_new();
- retvm_if(pKeyNode == NULL, PREFERENCE_ERROR_OUT_OF_MEMORY, "key malloc fail");
-
- func_ret = _preference_keynode_set_keyname(pKeyNode, key);
- if (func_ret != PREFERENCE_ERROR_NONE) {
- /* LCOV_EXCL_START */
- ERR("set key name error");
- _preference_keynode_free(pKeyNode);
- return PREFERENCE_ERROR_IO_ERROR;
- /* LCOV_EXCL_STOP */
- }
- _preference_keynode_set_value_double(pKeyNode, dblval);
-
- if (_preference_set_key(pKeyNode) != PREFERENCE_ERROR_NONE) {
- ERR("preference_set_double(%d) : key(%s/%f) error", getpid(), key, dblval);
- func_ret = PREFERENCE_ERROR_IO_ERROR;
- } else {
- INFO("%s(%f) success", key, dblval);
- }
-
- _preference_keynode_free(pKeyNode);
-
- END_TIME_CHECK
-
- return func_ret;
-}
-
-/*
- * This function set the string value of given key
- * @param[in] key key
- * @param[in] strval string value to set
- * @return 0 on success, -1 on error
- */
-API int preference_set_string(const char *key, const char *strval)
-{
- int func_ret = PREFERENCE_ERROR_NONE;
- keynode_t *pKeyNode;
-
- START_TIME_CHECK
-
- retvm_if(key == NULL, PREFERENCE_ERROR_INVALID_PARAMETER, "Invalid argument: key is NULL");
- retvm_if(strval == NULL, PREFERENCE_ERROR_INVALID_PARAMETER, "Invalid argument: value is NULL");
-
- pKeyNode = _preference_keynode_new();
- retvm_if(pKeyNode == NULL, PREFERENCE_ERROR_OUT_OF_MEMORY, "key malloc fail");
-
- func_ret = _preference_keynode_set_keyname(pKeyNode, key);
- if (func_ret != PREFERENCE_ERROR_NONE) {
- /* LCOV_EXCL_START */
- ERR("set key name error");
- _preference_keynode_free(pKeyNode);
- return PREFERENCE_ERROR_IO_ERROR;
- /* LCOV_EXCL_STOP */
- }
- _preference_keynode_set_value_string(pKeyNode, strval);
-
- if (_preference_set_key(pKeyNode) != PREFERENCE_ERROR_NONE) {
- ERR("preference_set_string(%d) : key(%s/%s) error", getpid(), key, strval);
- func_ret = PREFERENCE_ERROR_IO_ERROR;
- } else {
- INFO("%s(%s) success", key, strval);
- }
-
- _preference_keynode_free(pKeyNode);
-
- END_TIME_CHECK
-
- return func_ret;
-}
-
-static int _preference_get_key_filesys(keynode_t *keynode, int* io_errno)
-{
- char path[PATH_MAX] = {0,};
- int ret = -1;
- int func_ret = PREFERENCE_ERROR_NONE;
- char err_buf[100] = { 0, };
- int err_no = 0;
- int type = 0;
- FILE *fp = NULL;
- int retry_cnt = 0;
- int read_size = 0;
- size_t keyname_len = 0;
- int value_int = 0;
- double value_dbl = 0;
- char file_buf[BUF_LEN] = {0,};
- char *value = NULL;
- char *tmp_value;
- int value_size = 0;
-
-retry_open:
- errno = 0;
- func_ret = PREFERENCE_ERROR_NONE;
-
- ret = _preference_get_key_path(keynode, path);
- retv_if(ret != PREFERENCE_ERROR_NONE, ret);
-
- if ((fp = fopen(path, "r")) == NULL) {
- func_ret = PREFERENCE_ERROR_FILE_OPEN;
- err_no = errno;
- goto out_return;
- }
-
-retry:
- err_no = 0;
- func_ret = PREFERENCE_ERROR_NONE;
-
- ret = _preference_set_read_lock(fileno(fp));
- if (ret == -1) {
- /* LCOV_EXCL_START */
- func_ret = PREFERENCE_ERROR_FILE_LOCK;
- err_no = errno;
- goto out_return;
- /* LCOV_EXCL_STOP */
- }
-
- read_size = fread((void *)&keyname_len, sizeof(int), 1, fp);
- if ((read_size <= 0) || (read_size > sizeof(int))) {
- /* LCOV_EXCL_START */
- if (!ferror(fp))
- errno = ENODATA;
-
- err_no = errno;
- func_ret = PREFERENCE_ERROR_FILE_FREAD;
- goto out_unlock;
- /* LCOV_EXCL_STOP */
- }
-
- ret = fseek(fp, keyname_len, SEEK_CUR);
- if (ret) {
- /* LCOV_EXCL_START */
- if (!ferror(fp))
- errno = ENODATA;
-
- err_no = errno;
- func_ret = PREFERENCE_ERROR_FILE_FREAD;
- goto out_unlock;
- /* LCOV_EXCL_STOP */
- }
-
- read_size = fread((void *)&type, sizeof(int), 1, fp);
- if (read_size <= 0) {
- /* LCOV_EXCL_START */
- if (!ferror(fp))
- errno = ENODATA;
-
- err_no = errno;
- func_ret = PREFERENCE_ERROR_FILE_FREAD;
- goto out_unlock;
- /* LCOV_EXCL_STOP */
- }
-
- /* read data value */
- switch (type) {
- case PREFERENCE_TYPE_INT:
- read_size = fread((void *)&value_int, sizeof(int), 1, fp);
- if ((read_size <= 0) || (read_size > sizeof(int))) {
- /* LCOV_EXCL_START */
- if (!ferror(fp))
- LOGW("number of read items for value is wrong. err : %d", errno);
-
- err_no = errno;
- func_ret = PREFERENCE_ERROR_FILE_FREAD;
- goto out_unlock;
- /* LCOV_EXCL_STOP */
- } else {
- _preference_keynode_set_value_int(keynode, value_int);
- }
-
- break;
- case PREFERENCE_TYPE_DOUBLE:
- read_size = fread((void *)&value_dbl, sizeof(double), 1, fp);
- if ((read_size <= 0) || (read_size > sizeof(double))) {
- /* LCOV_EXCL_START */
- if (!ferror(fp))
- LOGW("number of read items for value is wrong. err : %d", errno);
-
- err_no = errno;
- func_ret = PREFERENCE_ERROR_FILE_FREAD;
- goto out_unlock;
- /* LCOV_EXCL_STOP */
- } else {
- _preference_keynode_set_value_double(keynode, value_dbl);
- }
-
- break;
- case PREFERENCE_TYPE_BOOLEAN:
- read_size = fread((void *)&value_int, sizeof(int), 1, fp);
- if ((read_size <= 0) || (read_size > sizeof(int))) {
- /* LCOV_EXCL_START */
- if (!ferror(fp))
- LOGW("number of read items for value is wrong. err : %d", errno);
-
- err_no = errno;
- func_ret = PREFERENCE_ERROR_FILE_FREAD;
- goto out_unlock;
- /* LCOV_EXCL_STOP */
- } else {
- _preference_keynode_set_value_boolean(keynode, value_int);
- }
-
- break;
- case PREFERENCE_TYPE_STRING:
- while (fgets(file_buf, sizeof(file_buf), fp)) {
- if (value) {
- value_size = value_size + strlen(file_buf);
- tmp_value = (char *) realloc(value, value_size);
- if (tmp_value == NULL) {
- func_ret = PREFERENCE_ERROR_OUT_OF_MEMORY;
- free(value);
- value = NULL;
- break;
- }
- value = tmp_value;
- strncat(value, file_buf, strlen(file_buf));
- } else {
- value_size = strlen(file_buf) + 1;
- value = (char *)malloc(value_size);
- if (value == NULL) {
- func_ret = PREFERENCE_ERROR_OUT_OF_MEMORY;
- break;
- }
- memset(value, 0x00, value_size);
- strncpy(value, file_buf, strlen(file_buf));
- }
- }
-
- if (ferror(fp)) {
- err_no = errno;
- func_ret = PREFERENCE_ERROR_FILE_FGETS;
- } else {
- if (value)
- _preference_keynode_set_value_string(keynode, value);
- else
- _preference_keynode_set_value_string(keynode, "");
- }
- if (value)
- free(value);
-
- break;
- default:
- func_ret = PREFERENCE_ERROR_WRONG_TYPE;
- }
-
-out_unlock:
- ret = _preference_set_unlock(fileno(fp));
- if (ret == -1) {
- func_ret = PREFERENCE_ERROR_FILE_LOCK;
- err_no = errno;
- goto out_return;
- }
-
-
-out_return:
- if (func_ret != PREFERENCE_ERROR_NONE) {
- strerror_r(err_no, err_buf, 100);
-
- if (_preference_check_retry_err(keynode, func_ret, err_no, PREFERENCE_OP_GET)) {
- /* LCOV_EXCL_START */
- if (retry_cnt < PREFERENCE_ERROR_RETRY_CNT) {
- retry_cnt++;
- usleep((retry_cnt)*PREFERENCE_ERROR_RETRY_SLEEP_UTIME);
-
- if (fp)
- goto retry;
- else
- goto retry_open;
- } else {
- ERR("_preference_get_key_filesys(%s) step(%d) faild(%d / %s) over the retry count.",
- keynode->keyname, func_ret, err_no, err_buf);
- }
- /* LCOV_EXCL_STOP */
- }
- }
-
- if (fp)
- fclose(fp);
-
- *io_errno = err_no;
-
- return func_ret;
-}
-
-int _preference_get_key(keynode_t *keynode)
-{
- int ret = 0;
- int io_errno = 0;
- char err_buf[100] = {0,};
-
- ret = _preference_get_key_filesys(keynode, &io_errno);
- if (ret == PREFERENCE_ERROR_NONE) {
- g_posix_errno = PREFERENCE_ERROR_NONE;
- g_preference_errno = PREFERENCE_ERROR_NONE;
- } else {
- if (io_errno == ENOENT)
- ret = PREFERENCE_ERROR_NO_KEY;
- else
- ret = PREFERENCE_ERROR_IO_ERROR;
-
- strerror_r(io_errno, err_buf, 100);
- ERR("_preference_get_key(%s) step(%d) failed(%d / %s)\n", keynode->keyname, ret, io_errno, err_buf);
- g_posix_errno = io_errno;
- g_preference_errno = ret;
- }
-
- return ret;
-}
-
-
-/*
- * This function get the integer value of given key
- * @param[in] key key
- * @param[out] intval output buffer
- * @return 0 on success, -1 on error
- */
-API int preference_get_int(const char *key, int *intval)
-{
- int func_ret = PREFERENCE_ERROR_IO_ERROR;
- keynode_t *pKeyNode;
-
- START_TIME_CHECK
-
- retvm_if(key == NULL, PREFERENCE_ERROR_INVALID_PARAMETER, "Invalid argument: key is null");
- retvm_if(intval == NULL, PREFERENCE_ERROR_INVALID_PARAMETER, "Invalid argument: output buffer is null");
-
- pKeyNode = _preference_keynode_new();
- retvm_if(pKeyNode == NULL, PREFERENCE_ERROR_OUT_OF_MEMORY, "key malloc fail");
-
- func_ret = _preference_keynode_set_keyname(pKeyNode, key);
- if (func_ret != PREFERENCE_ERROR_NONE) {
- ERR("set key name error");
- _preference_keynode_free(pKeyNode);
- return PREFERENCE_ERROR_IO_ERROR;
- }
-
- func_ret = _preference_get_key(pKeyNode);
- if (func_ret != PREFERENCE_ERROR_NONE) {
- ERR("preference_get_int(%d) : key(%s) error", getpid(), key);
- } else {
- *intval = pKeyNode->value.i;
- if (pKeyNode->type == PREFERENCE_TYPE_INT) {
- INFO("%s(%d) success", key, *intval);
- func_ret = PREFERENCE_ERROR_NONE;
- } else {
- ERR("The type(%d) of keynode(%s) is not INT", pKeyNode->type, pKeyNode->keyname);
- func_ret = PREFERENCE_ERROR_INVALID_PARAMETER;
- }
- }
-
- _preference_keynode_free(pKeyNode);
-
- END_TIME_CHECK
-
- return func_ret;
-}
-
-/*
- * This function get the boolean value of given key
- * @param[in] key key
- * @param[out] boolval output buffer
- * @return 0 on success, -1 on error
- */
-API int preference_get_boolean(const char *key, bool *boolval)
-{
- int func_ret = PREFERENCE_ERROR_IO_ERROR;
- keynode_t *pKeyNode;
-
- START_TIME_CHECK
-
- retvm_if(key == NULL, PREFERENCE_ERROR_INVALID_PARAMETER, "Invalid argument: key is null");
- retvm_if(boolval == NULL, PREFERENCE_ERROR_INVALID_PARAMETER, "Invalid argument: output buffer is null");
-
- pKeyNode = _preference_keynode_new();
- retvm_if(pKeyNode == NULL, PREFERENCE_ERROR_OUT_OF_MEMORY, "key malloc fail");
-
- func_ret = _preference_keynode_set_keyname(pKeyNode, key);
- if (func_ret != PREFERENCE_ERROR_NONE) {
- ERR("set key name error");
- _preference_keynode_free(pKeyNode);
- return PREFERENCE_ERROR_IO_ERROR;
- }
-
- func_ret = _preference_get_key(pKeyNode);
-
- if (func_ret != PREFERENCE_ERROR_NONE) {
- ERR("preference_get_boolean(%d) : %s error", getpid(), key);
- } else {
- *boolval = !!(pKeyNode->value.b);
- if (pKeyNode->type == PREFERENCE_TYPE_BOOLEAN) {
- INFO("%s(%d) success", key, *boolval);
- func_ret = PREFERENCE_ERROR_NONE;
- } else {
- ERR("The type(%d) of keynode(%s) is not BOOL", pKeyNode->type, pKeyNode->keyname);
- func_ret = PREFERENCE_ERROR_INVALID_PARAMETER;
- }
- }
-
- _preference_keynode_free(pKeyNode);
-
- END_TIME_CHECK
-
- return func_ret;
-}
-
-/*
- * This function get the double value of given key
- * @param[in] key key
- * @param[out] dblval output buffer
- * @return 0 on success, -1 on error
- */
-API int preference_get_double(const char *key, double *dblval)
-{
- int func_ret = PREFERENCE_ERROR_IO_ERROR;
- keynode_t *pKeyNode;
-
- START_TIME_CHECK
-
- retvm_if(key == NULL, PREFERENCE_ERROR_INVALID_PARAMETER, "Invalid argument: key is null");
- retvm_if(dblval == NULL, PREFERENCE_ERROR_INVALID_PARAMETER, "Invalid argument: output buffer is null");
-
- pKeyNode = _preference_keynode_new();
- retvm_if(pKeyNode == NULL, PREFERENCE_ERROR_OUT_OF_MEMORY, "key malloc fail");
-
- func_ret = _preference_keynode_set_keyname(pKeyNode, key);
- if (func_ret != PREFERENCE_ERROR_NONE) {
- ERR("set key name error");
- _preference_keynode_free(pKeyNode);
- return PREFERENCE_ERROR_IO_ERROR;
- }
-
- func_ret = _preference_get_key(pKeyNode);
-
- if (func_ret != PREFERENCE_ERROR_NONE) {
- ERR("preference_get_double(%d) : %s error", getpid(), key);
- } else {
- *dblval = pKeyNode->value.d;
- if (pKeyNode->type == PREFERENCE_TYPE_DOUBLE) {
- INFO("%s(%f) success", key, *dblval);
- func_ret = PREFERENCE_ERROR_NONE;
- } else {
- ERR("The type(%d) of keynode(%s) is not DBL", pKeyNode->type, pKeyNode->keyname);
- func_ret = PREFERENCE_ERROR_INVALID_PARAMETER;
- }
- }
-
- _preference_keynode_free(pKeyNode);
-
- END_TIME_CHECK
-
- return func_ret;
-}
-
-/*
- * This function get the string value of given key
- * @param[in] key key
- * @param[out] value output buffer
- * @return 0 on success, -1 on error
- */
-API int preference_get_string(const char *key, char **value)
-{
- int func_ret = PREFERENCE_ERROR_IO_ERROR;
- keynode_t *pKeyNode;
- char *tempstr = NULL;
-
- START_TIME_CHECK
-
- retvm_if(key == NULL, PREFERENCE_ERROR_INVALID_PARAMETER, "Invalid argument: key is null");
- retvm_if(value == NULL, PREFERENCE_ERROR_INVALID_PARAMETER, "Invalid argument: output buffer is null");
-
- pKeyNode = _preference_keynode_new();
- retvm_if(pKeyNode == NULL, PREFERENCE_ERROR_OUT_OF_MEMORY, "key malloc fail");
-
- func_ret = _preference_keynode_set_keyname(pKeyNode, key);
- if (func_ret != PREFERENCE_ERROR_NONE) {
- ERR("set key name error");
- _preference_keynode_free(pKeyNode);
- return PREFERENCE_ERROR_IO_ERROR;
- }
-
- func_ret = _preference_get_key(pKeyNode);
- if (func_ret != PREFERENCE_ERROR_NONE) {
- ERR("preference_get_string(%d) : %s error", getpid(), key);
- } else {
- if (pKeyNode->type == PREFERENCE_TYPE_STRING) {
- tempstr = pKeyNode->value.s;
- } else {
- ERR("The type(%d) of keynode(%s) is not STR", pKeyNode->type, pKeyNode->keyname);
- func_ret = PREFERENCE_ERROR_INVALID_PARAMETER;
- }
-
- if (tempstr) {
- *value = strdup(tempstr);
- INFO("%s(%s) success", key, value);
- }
- }
-
- _preference_keynode_free(pKeyNode);
-
- END_TIME_CHECK
-
- return func_ret;
-}
-
-/*
- * This function unset given key
- * @param[in] key key
- * @return 0 on success, -1 on error
- */
-API int preference_remove(const char *key)
-{
- char path[PATH_MAX] = {0,};
- int ret = -1;
- int err_retry = PREFERENCE_ERROR_RETRY_CNT;
- int func_ret = PREFERENCE_ERROR_NONE;
- char err_buf[ERR_LEN] = {0,};
-
- START_TIME_CHECK
-
- retvm_if(key == NULL, PREFERENCE_ERROR_INVALID_PARAMETER, "Invalid argument: key is null");
-
- keynode_t *pKeyNode = _preference_keynode_new();
- retvm_if(pKeyNode == NULL, PREFERENCE_ERROR_OUT_OF_MEMORY, "key malloc fail");
-
- ret = _preference_keynode_set_keyname(pKeyNode, key);
- if (ret != PREFERENCE_ERROR_NONE) {
- ERR("set key name error");
- _preference_keynode_free(pKeyNode);
- return PREFERENCE_ERROR_IO_ERROR;
- }
-
- ret = _preference_get_key_path(pKeyNode, path);
- if (ret != PREFERENCE_ERROR_NONE) {
- ERR("Invalid argument: key is not valid");
- _preference_keynode_free(pKeyNode);
- return PREFERENCE_ERROR_INVALID_PARAMETER;
- }
-
- if (access(path, F_OK) == -1) {
- ERR("Error : key(%s) is not exist", key);
- _preference_keynode_free(pKeyNode);
- return PREFERENCE_ERROR_NO_KEY;
- }
-
- do {
- ret = remove(path);
- if (ret == -1) {
- strerror_r(errno, err_buf, sizeof(err_buf));
- ERR("preference_remove() failed. ret=%d(%s), key(%s)", errno, err_buf, key);
- func_ret = PREFERENCE_ERROR_IO_ERROR;
- } else {
- func_ret = PREFERENCE_ERROR_NONE;
- break;
- }
- } while (err_retry--);
-
- END_TIME_CHECK;
-
- _preference_keynode_free(pKeyNode);
-
- return func_ret;
-}
-
-API int preference_remove_all(void)
-{
- int ret = -1;
- int err_retry = PREFERENCE_ERROR_RETRY_CNT;
- int func_ret = PREFERENCE_ERROR_NONE;
- DIR *dir;
- struct dirent *dent = NULL;
- char *pref_dir_path = NULL;
- char err_buf[ERR_LEN] = {0,};
- const char *entry;
- char *keyname = NULL;
- char path[PATH_MAX] = {0,};
-
- START_TIME_CHECK
-
- pref_dir_path = _preference_get_pref_dir_path();
- if (!pref_dir_path) {
- LOGE("_preference_get_pref_dir_path() failed.");
- return PREFERENCE_ERROR_IO_ERROR;
- }
-
- dir = opendir(pref_dir_path);
- if (dir == NULL) {
- if (errno == ENOENT)
- return PREFERENCE_ERROR_NONE;
- strerror_r(errno, err_buf, sizeof(err_buf));
- LOGE("opendir() failed. pref_path: %s, error: %d(%s)", pref_dir_path, errno, err_buf);
- return PREFERENCE_ERROR_IO_ERROR;
- }
-
- keynode_t *pKeyNode = _preference_keynode_new();
- if (pKeyNode == NULL) {
- ERR("key malloc fail");
- closedir(dir);
- return PREFERENCE_ERROR_OUT_OF_MEMORY;
- }
-
- while ((dent = readdir(dir)) != NULL) {
- entry = dent->d_name;
- if (entry[0] == '.')
- continue;
-
- snprintf(path, PATH_MAX-1, "%s%s", pref_dir_path, entry);
-
- ret = _preference_get_key_name(path, &keyname);
- if (ret != PREFERENCE_ERROR_NONE) {
- /* LCOV_EXCL_START */
- ERR("_preference_get_key_name() failed(%d)", ret);
- _preference_keynode_free(pKeyNode);
- closedir(dir);
- return PREFERENCE_ERROR_IO_ERROR;
- /* LCOV_EXCL_STOP */
- }
-
- ret = preference_unset_changed_cb(keyname);
- if (ret != PREFERENCE_ERROR_NONE) {
- /* LCOV_EXCL_START */
- if (ret == PREFERENCE_ERROR_NO_KEY) {
- ERR("can't find %s's cb()", keyname);
- } else {
- ERR("preference_unset_changed_cb() failed(%d)", ret);
- _preference_keynode_free(pKeyNode);
- closedir(dir);
- free(keyname);
- return PREFERENCE_ERROR_IO_ERROR;
- }
- /* LCOV_EXCL_STOP */
- }
-
- do {
- ret = remove(path);
- if (ret == -1) {
- /* LCOV_EXCL_START */
- strerror_r(errno, err_buf, sizeof(err_buf));
- ERR("preference_remove_all error: %d(%s)", errno, err_buf);
- func_ret = PREFERENCE_ERROR_IO_ERROR;
- /* LCOV_EXCL_STOP */
- } else {
- func_ret = PREFERENCE_ERROR_NONE;
- break;
- }
- } while (err_retry--);
-
- free(keyname);
- }
-
- _preference_keynode_free(pKeyNode);
- closedir(dir);
-
- END_TIME_CHECK
-
- return func_ret;
-}
-
-int preference_is_existing(const char *key, bool *exist)
-{
- char path[PATH_MAX] = {0,};
- int ret = -1;
- int func_ret = PREFERENCE_ERROR_NONE;
- keynode_t *pKeyNode;
-
- START_TIME_CHECK
-
- retvm_if(key == NULL, PREFERENCE_ERROR_INVALID_PARAMETER, "Invalid argument: key is null");
- retvm_if(exist == NULL, PREFERENCE_ERROR_INVALID_PARAMETER, "Invalid argument: key is null");
-
- pKeyNode = _preference_keynode_new();
- retvm_if(pKeyNode == NULL, PREFERENCE_ERROR_OUT_OF_MEMORY, "key malloc fail");
-
- ret = _preference_keynode_set_keyname(pKeyNode, key);
- if (ret != PREFERENCE_ERROR_NONE) {
- ERR("set key name error");
- _preference_keynode_free(pKeyNode);
- return PREFERENCE_ERROR_IO_ERROR;
- }
-
- ret = _preference_get_key_path(pKeyNode, path);
- if (ret != PREFERENCE_ERROR_NONE) {
- _preference_keynode_free(pKeyNode);
- return ret;
- }
-
- ret = access(path, F_OK);
- if (ret == -1) {
- ERR("Error : key(%s) is not exist", key);
- *exist = 0;
- } else {
- *exist = 1;
- }
-
- _preference_keynode_free(pKeyNode);
-
- END_TIME_CHECK
-
- return func_ret;
-}
-
-API int preference_set_changed_cb(const char *key, preference_changed_cb callback, void *user_data)
-{
- int func_ret = PREFERENCE_ERROR_IO_ERROR;
- keynode_t *pKeyNode;
-
- START_TIME_CHECK
-
- retvm_if(key == NULL, PREFERENCE_ERROR_INVALID_PARAMETER, "Invalid argument: key is null");
- retvm_if(callback == NULL, PREFERENCE_ERROR_INVALID_PARAMETER, "Invalid argument: cb(%p)", callback);
-
- pKeyNode = _preference_keynode_new();
- retvm_if(pKeyNode == NULL, PREFERENCE_ERROR_OUT_OF_MEMORY, "key malloc fail");
-
- func_ret = _preference_keynode_set_keyname(pKeyNode, key);
- if (func_ret != PREFERENCE_ERROR_NONE) {
- ERR("set key name error");
- _preference_keynode_free(pKeyNode);
- return PREFERENCE_ERROR_IO_ERROR;
- }
-
- if (_preference_kdb_add_notify(pKeyNode, callback, user_data)) {
- if (errno == ENOENT) {
- LOGE("NO_KEY(0x%08x) : fail to find given key(%s)", PREFERENCE_ERROR_NO_KEY, key);
- _preference_keynode_free(pKeyNode);
- return PREFERENCE_ERROR_NO_KEY;
- } else if (errno != 0) {
- ERR("preference_notify_key_changed : key(%s) add notify fail", key);
- _preference_keynode_free(pKeyNode);
- return PREFERENCE_ERROR_IO_ERROR;
- }
- }
- INFO("%s noti is added", key);
- _preference_keynode_free(pKeyNode);
-
- END_TIME_CHECK
-
- return PREFERENCE_ERROR_NONE;
-}
-
-API int preference_unset_changed_cb(const char *key)
-{
- int func_ret = PREFERENCE_ERROR_IO_ERROR;
- keynode_t *pKeyNode;
- char err_buf[ERR_LEN] = {0,};
-
- START_TIME_CHECK
-
- retvm_if(key == NULL, PREFERENCE_ERROR_INVALID_PARAMETER, "Invalid argument: key is null");
-
- pKeyNode = _preference_keynode_new();
- retvm_if(pKeyNode == NULL, PREFERENCE_ERROR_OUT_OF_MEMORY, "key malloc fail");
-
- func_ret = _preference_keynode_set_keyname(pKeyNode, key);
- if (func_ret != PREFERENCE_ERROR_NONE) {
- ERR("set key name error");
- _preference_keynode_free(pKeyNode);
- return PREFERENCE_ERROR_IO_ERROR;
- }
-
- if (_preference_kdb_del_notify(pKeyNode)) {
- if (errno == ENOENT) {
- LOGE("NO_KEY(0x%08x) : fail to find given key(%s)", PREFERENCE_ERROR_NO_KEY, key);
- _preference_keynode_free(pKeyNode);
- return PREFERENCE_ERROR_NO_KEY;
- } else if (errno != 0) {
- strerror_r(errno, err_buf, sizeof(err_buf));
- ERR("preference_unset_changed_cb() failed: key(%s) error(%d/%s)", key, errno, err_buf);
- _preference_keynode_free(pKeyNode);
- return PREFERENCE_ERROR_IO_ERROR;
- }
- }
- INFO("%s noti removed", key);
- _preference_keynode_free(pKeyNode);
-
- END_TIME_CHECK
-
- return PREFERENCE_ERROR_NONE;
-}
-
-
-API int preference_foreach_item(preference_item_cb callback, void *user_data)
-{
- int ret = 0;
- DIR *dir;
- struct dirent *dent = NULL;
- char *pref_dir_path = NULL;
- char err_buf[ERR_LEN] = {0,};
- const char *entry;
- char *keyname = NULL;
- char path[PATH_MAX] = {0,};
-
-
- START_TIME_CHECK
- retvm_if(callback == NULL, PREFERENCE_ERROR_INVALID_PARAMETER, "Invalid argument: cb(%p)", callback);
-
- pref_dir_path = _preference_get_pref_dir_path();
- if (!pref_dir_path) {
- LOGE("_preference_get_pref_dir_path() failed.");
- return PREFERENCE_ERROR_IO_ERROR;
- }
-
- dir = opendir(pref_dir_path);
- if (dir == NULL) {
- if (errno == ENOENT)
- return PREFERENCE_ERROR_NONE;
- strerror_r(errno, err_buf, sizeof(err_buf));
- LOGE("opendir() failed. path: %s, error: %d(%s)", pref_dir_path, errno, err_buf);
- return PREFERENCE_ERROR_IO_ERROR;
- }
-
- while ((dent = readdir(dir)) != NULL) {
- entry = dent->d_name;
- if (entry[0] == '.')
- continue;
-
- snprintf(path, PATH_MAX-1, "%s%s", pref_dir_path, entry);
-
- ret = _preference_get_key_name(path, &keyname);
- if (ret != PREFERENCE_ERROR_NONE) {
- ERR("_preference_get_key_name() failed(%d)", ret);
- closedir(dir);
- return PREFERENCE_ERROR_IO_ERROR;
- }
-
- callback(keyname, user_data);
- free(keyname);
- }
-
- closedir(dir);
- END_TIME_CHECK
-
- return PREFERENCE_ERROR_NONE;
-}
-
diff --git a/preference/preference_db.c b/preference/preference_db.c
deleted file mode 100755
index e87b34a..0000000
--- a/preference/preference_db.c
+++ /dev/null
@@ -1,795 +0,0 @@
-/*
- * Copyright (c) 2015 - 2016 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 <unistd.h>
-#include <string.h>
-#include <sqlite3.h>
-
-#include <app_internal.h>
-
-#include <app_preference.h>
-#include <app_preference_internal.h>
-
-#include <dlog.h>
-
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-
-#define LOG_TAG "CAPI_APPFW_APPLICATION_PREFERENCE"
-#define DBG_MODE (1)
-
-static sqlite3 *pref_db = NULL;
-static bool is_update_hook_registered = false;
-static pref_changed_cb_node_t *head = NULL;
-
-static void _finish(void *data)
-{
- if (pref_db != NULL) {
- sqlite3_close(pref_db);
- pref_db = NULL;
- }
-}
-
-static int _busy_handler(void *pData, int count)
-{
- if (5 - count > 0) {
- LOGD("Busy Handler Called! : PID(%d) / CNT(%d)\n", getpid(), count + 1);
- usleep((count + 1) * 100000);
- return 1;
- } else {
- LOGD("Busy Handler will be returned SQLITE_BUSY error : PID(%d) \n", getpid());
- return 0;
- }
-}
-
-static int _initialize(void)
-{
- char *data_path = NULL;
- char db_path[TIZEN_PATH_MAX] = {0, };
- int ret;
- char *errmsg;
-
- if ((data_path = app_get_data_path()) == NULL) {
- LOGE("IO_ERROR(0x%08x) : fail to get data directory", PREFERENCE_ERROR_IO_ERROR);
- return PREFERENCE_ERROR_IO_ERROR;
- }
- snprintf(db_path, sizeof(db_path), "%s/%s", data_path, PREF_DB_NAME);
- free(data_path);
-
- ret = sqlite3_open(db_path, &pref_db);
- if (ret != SQLITE_OK) {
- LOGE("IO_ERROR(0x%08x) : fail to open db(%s)", PREFERENCE_ERROR_IO_ERROR, sqlite3_errmsg(pref_db));
- pref_db = NULL;
- return PREFERENCE_ERROR_IO_ERROR;
- }
-
- ret = sqlite3_busy_handler(pref_db, _busy_handler, NULL);
- if (ret != SQLITE_OK)
- LOGW("IO_ERROR(0x%08x) : fail to register busy handler(%s)\n", PREFERENCE_ERROR_IO_ERROR, sqlite3_errmsg(pref_db));
-
- ret = sqlite3_exec(pref_db, "CREATE TABLE IF NOT EXISTS pref ( pref_key TEXT PRIMARY KEY, pref_type TEXT, pref_data TEXT)",
- NULL, NULL, &errmsg);
- if (ret != SQLITE_OK) {
- LOGE("IO_ERROR(0x%08x) : fail to create db table(%s)", PREFERENCE_ERROR_IO_ERROR, errmsg);
- sqlite3_free(errmsg);
- sqlite3_close(pref_db);
- pref_db = NULL;
- return PREFERENCE_ERROR_IO_ERROR;
- }
-
- app_finalizer_add(_finish, NULL);
-
- return PREFERENCE_ERROR_NONE;
-}
-
-static int _write_data(const char *key, const char *type, const char *data)
-{
- int ret;
- char *buf = NULL;
- bool exist = false;
- sqlite3_stmt *stmt;
-
- if (key == NULL || key[0] == '\0' || data == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", PREFERENCE_ERROR_INVALID_PARAMETER);
- return PREFERENCE_ERROR_INVALID_PARAMETER;
- }
-
- /* insert data or update data if data already exist */
- ret = preference_is_existing(key, &exist);
- if (ret != PREFERENCE_ERROR_NONE)
- return ret;
-
- /* to use sqlite3_update_hook, we have to use INSERT/UPDATE operation instead of REPLACE operation */
- if (exist)
- buf = sqlite3_mprintf("UPDATE %s SET %s=?, %s=? WHERE %s=?;",
- PREF_TBL_NAME, PREF_F_TYPE_NAME, PREF_F_DATA_NAME, PREF_F_KEY_NAME);
- else
- buf = sqlite3_mprintf("INSERT INTO %s (%s, %s, %s) values (?, ?, ?);",
- PREF_TBL_NAME, PREF_F_KEY_NAME, PREF_F_TYPE_NAME, PREF_F_DATA_NAME);
-
- if (buf == NULL) {
- LOGE("IO_ERROR(0x%08x) : fail to create query string", PREFERENCE_ERROR_IO_ERROR);
- return PREFERENCE_ERROR_IO_ERROR;
- }
-
- ret = sqlite3_prepare(pref_db, buf, strlen(buf), &stmt, NULL);
- if (ret != SQLITE_OK) {
- LOGE("IO_ERROR(0x%08x) : fail to prepare query (%d/%s)",
- PREFERENCE_ERROR_IO_ERROR,
- sqlite3_extended_errcode(pref_db),
- sqlite3_errmsg(pref_db));
- return PREFERENCE_ERROR_IO_ERROR;
- }
-
- if (exist) {
- ret = sqlite3_bind_text(stmt, 1, type, strlen(type), SQLITE_STATIC);
- if (ret != SQLITE_OK) {
- LOGE("IO_ERROR(0x%08x) : fail to bind(1) query (%d/%s)",
- PREFERENCE_ERROR_IO_ERROR,
- sqlite3_extended_errcode(pref_db),
- sqlite3_errmsg(pref_db));
- sqlite3_finalize(stmt);
- return PREFERENCE_ERROR_IO_ERROR;
- }
- ret = sqlite3_bind_text(stmt, 2, data, strlen(data), SQLITE_STATIC);
- if (ret != SQLITE_OK) {
- LOGE("IO_ERROR(0x%08x) : fail to bind(2) query (%d/%s)",
- PREFERENCE_ERROR_IO_ERROR,
- sqlite3_extended_errcode(pref_db),
- sqlite3_errmsg(pref_db));
- sqlite3_finalize(stmt);
- return PREFERENCE_ERROR_IO_ERROR;
- }
- ret = sqlite3_bind_text(stmt, 3, key, strlen(key), SQLITE_STATIC);
- if (ret != SQLITE_OK) {
- LOGE("IO_ERROR(0x%08x) : fail to bind(3) query (%d/%s)",
- PREFERENCE_ERROR_IO_ERROR,
- sqlite3_extended_errcode(pref_db),
- sqlite3_errmsg(pref_db));
- sqlite3_finalize(stmt);
- return PREFERENCE_ERROR_IO_ERROR;
- }
- } else {
- ret = sqlite3_bind_text(stmt, 1, key, strlen(key), SQLITE_STATIC);
- if (ret != SQLITE_OK) {
- LOGE("IO_ERROR(0x%08x) : fail to bind(1) query (%d/%s)",
- PREFERENCE_ERROR_IO_ERROR,
- sqlite3_extended_errcode(pref_db),
- sqlite3_errmsg(pref_db));
- sqlite3_finalize(stmt);
- return PREFERENCE_ERROR_IO_ERROR;
- }
- ret = sqlite3_bind_text(stmt, 2, type, strlen(type), SQLITE_STATIC);
- if (ret != SQLITE_OK) {
- LOGE("IO_ERROR(0x%08x) : fail to bind(2) query (%d/%s)",
- PREFERENCE_ERROR_IO_ERROR,
- sqlite3_extended_errcode(pref_db),
- sqlite3_errmsg(pref_db));
- sqlite3_finalize(stmt);
- return PREFERENCE_ERROR_IO_ERROR;
- }
- ret = sqlite3_bind_text(stmt, 3, data, strlen(data), SQLITE_STATIC);
- if (ret != SQLITE_OK) {
- LOGE("IO_ERROR(0x%08x) : fail to bind(3) query (%d/%s)",
- PREFERENCE_ERROR_IO_ERROR,
- sqlite3_extended_errcode(pref_db),
- sqlite3_errmsg(pref_db));
- sqlite3_finalize(stmt);
- return PREFERENCE_ERROR_IO_ERROR;
- }
- }
-
- ret = sqlite3_step(stmt);
- if (ret != SQLITE_DONE) {
- LOGE("IO_ERROR(0x%08x): fail to write data(%d/%s)",
- PREFERENCE_ERROR_IO_ERROR,
- sqlite3_extended_errcode(pref_db),
- sqlite3_errmsg(pref_db));
- sqlite3_finalize(stmt);
- return PREFERENCE_ERROR_IO_ERROR;
- }
-
- sqlite3_finalize(stmt);
- if (buf) {
- sqlite3_free(buf);
- buf = NULL;
- }
-
- return PREFERENCE_ERROR_NONE;
-}
-
-/* static int _read_data(const char *key, preference_type_e *type, char *data) */
-static int _read_data(const char *key, char *type, char *data)
-{
- int ret;
- char *buf;
- char **result;
- int rows;
- int columns;
- char *errmsg;
-
- if (key == NULL || key[0] == '\0' || data == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", PREFERENCE_ERROR_INVALID_PARAMETER);
- return PREFERENCE_ERROR_INVALID_PARAMETER;
- }
-
- if (pref_db == NULL) {
- if (_initialize() != PREFERENCE_ERROR_NONE) {
- LOGE("IO_ERROR(0x%08x) : fail to initialize db", PREFERENCE_ERROR_IO_ERROR);
- return PREFERENCE_ERROR_IO_ERROR;
- }
- }
-
- buf = sqlite3_mprintf("SELECT %s, %s, %s FROM %s WHERE %s=%Q;",
- PREF_F_KEY_NAME, PREF_F_TYPE_NAME, PREF_F_DATA_NAME, PREF_TBL_NAME, PREF_F_KEY_NAME, key);
- if (buf == NULL) {
- LOGE("IO_ERROR(0x%08x) : fail to create query string", PREFERENCE_ERROR_IO_ERROR);
- return PREFERENCE_ERROR_IO_ERROR;
- }
-
- ret = sqlite3_get_table(pref_db, buf, &result, &rows, &columns, &errmsg);
- sqlite3_free(buf);
- if (ret != SQLITE_OK) {
- LOGE("IO_ERROR(0x%08x) : fail to read data (%s)", PREFERENCE_ERROR_IO_ERROR, errmsg);
- sqlite3_free(errmsg);
- return PREFERENCE_ERROR_IO_ERROR;
- }
-
- if (rows == 0) {
- LOGE("NO_KEY(0x%08x) : fail to find given key(%s)", PREFERENCE_ERROR_NO_KEY, key);
- sqlite3_free_table(result);
- return PREFERENCE_ERROR_NO_KEY;
- }
-
- snprintf(type, 2, "%s", result[4]); /* get type value */
- snprintf(data, BUF_LEN, "%s", result[5]); /* get data value */
-
- sqlite3_free_table(result);
-
- return PREFERENCE_ERROR_NONE;
-}
-
-
-int preference_set_int(const char *key, int value)
-{
- char type[2];
- char data[BUF_LEN];
- snprintf(type, 2, "%d", PREFERENCE_TYPE_INT);
- snprintf(data, BUF_LEN, "%d", value);
- return _write_data(key, type, data);
-}
-
-int preference_get_int(const char *key, int *value)
-{
- char type[2];
- char data[BUF_LEN];
- int ret;
-
- if (value == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", PREFERENCE_ERROR_INVALID_PARAMETER);
- return PREFERENCE_ERROR_INVALID_PARAMETER;
- }
-
- ret = _read_data(key, type, data);
- if (ret == PREFERENCE_ERROR_NONE) {
- if (atoi(type) == PREFERENCE_TYPE_INT)
- *value = atoi(data);
- else {
- LOGE("INVALID_PARAMETER(0x%08x) : param type(%d)", PREFERENCE_ERROR_INVALID_PARAMETER, atoi(type));
- return PREFERENCE_ERROR_INVALID_PARAMETER;
- }
- }
-
- return ret;
-}
-
-int preference_set_double(const char *key, double value)
-{
- char type[2];
- char data[BUF_LEN];
-
- locale_t loc = newlocale(LC_NUMERIC_MASK, "C", NULL);
- uselocale(loc);
-
- snprintf(type, 2, "%d", PREFERENCE_TYPE_DOUBLE);
- snprintf(data, BUF_LEN, "%f", value);
-
- freelocale(loc);
- uselocale(LC_GLOBAL_LOCALE);
-
- return _write_data(key, type, data);
-}
-
-int preference_get_double(const char *key, double *value)
-{
- char type[2];
- char data[BUF_LEN];
- int ret;
-
- if (value == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", PREFERENCE_ERROR_INVALID_PARAMETER);
- return PREFERENCE_ERROR_INVALID_PARAMETER;
- }
-
- ret = _read_data(key, type, data);
- if (ret == PREFERENCE_ERROR_NONE) {
- if (atoi(type) == PREFERENCE_TYPE_DOUBLE) {
- locale_t loc = newlocale(LC_NUMERIC_MASK, "C", NULL);
- uselocale(loc);
-
- *value = atof(data);
-
- freelocale(loc);
- uselocale(LC_GLOBAL_LOCALE);
- } else {
- LOGE("INVALID_PARAMETER(0x%08x) : param type(%d)", PREFERENCE_ERROR_INVALID_PARAMETER, atoi(type));
- return PREFERENCE_ERROR_INVALID_PARAMETER;
- }
- }
-
- return ret;
-}
-
-int preference_set_string(const char *key, const char *value)
-{
- char type[2];
-
- snprintf(type, 2, "%d", PREFERENCE_TYPE_STRING);
- if (strlen(value) > (BUF_LEN-1)) {
- LOGE("INVALID_PARAMETER(0x%08x) : param type(%d)", PREFERENCE_ERROR_INVALID_PARAMETER, atoi(type));
- return PREFERENCE_ERROR_INVALID_PARAMETER;
- }
- return _write_data(key, type, value);
-}
-
-int preference_get_string(const char *key, char **value)
-{
- char type[2];
- char data[BUF_LEN];
- int ret;
-
- if (value == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", PREFERENCE_ERROR_INVALID_PARAMETER);
- return PREFERENCE_ERROR_INVALID_PARAMETER;
- }
-
- ret = _read_data(key, type, data);
- if (ret == PREFERENCE_ERROR_NONE) {
- if (atoi(type) == PREFERENCE_TYPE_STRING) {
- *value = strdup(data);
- if (value == NULL) {
- LOGE("OUT_OF_MEMORY(0x%08x)", PREFERENCE_ERROR_OUT_OF_MEMORY);
- return PREFERENCE_ERROR_OUT_OF_MEMORY;
- }
- } else {
- LOGE("INVALID_PARAMETER(0x%08x) : param type(%d)", PREFERENCE_ERROR_INVALID_PARAMETER, atoi(type));
- return PREFERENCE_ERROR_INVALID_PARAMETER;
- }
- }
-
- return ret;
-}
-
-int preference_set_boolean(const char *key, bool value)
-{
- char type[2];
- char data[BUF_LEN];
-
- snprintf(type, 2, "%d", PREFERENCE_TYPE_BOOLEAN);
- snprintf(data, BUF_LEN, "%d", value);
-
- return _write_data(key, type, data);
-}
-
-int preference_get_boolean(const char *key, bool *value)
-{
- char type[2];
- char data[BUF_LEN];
- int ret;
-
- if (value == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", PREFERENCE_ERROR_INVALID_PARAMETER);
- return PREFERENCE_ERROR_INVALID_PARAMETER;
- }
-
- ret = _read_data(key, type, data);
- if (ret == PREFERENCE_ERROR_NONE) {
- if (atoi(type) == PREFERENCE_TYPE_BOOLEAN)
- *value = (bool)atoi(data);
- else {
- LOGE("INVALID_PARAMETER(0x%08x) : param type(%d)", PREFERENCE_ERROR_INVALID_PARAMETER, atoi(type));
- return PREFERENCE_ERROR_INVALID_PARAMETER;
- }
- }
-
- return ret;
-}
-
-/* TODO: below operation is too heavy, let's find the light way to check. */
-int preference_is_existing(const char *key, bool *exist)
-{
- int ret;
- char *buf;
- char **result;
- int rows;
- int columns;
- char *errmsg;
-
- if (key == NULL || key[0] == '\0' || exist == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", PREFERENCE_ERROR_INVALID_PARAMETER);
- return PREFERENCE_ERROR_INVALID_PARAMETER;
- }
-
- if (pref_db == NULL) {
- if (_initialize() != PREFERENCE_ERROR_NONE) {
- LOGE("IO_ERROR(0x%08x) : fail to initialize db", PREFERENCE_ERROR_IO_ERROR);
- return PREFERENCE_ERROR_IO_ERROR;
- }
- }
-
- /* check data is exist */
- buf = sqlite3_mprintf("SELECT %s FROM %s WHERE %s=%Q;", PREF_F_KEY_NAME, PREF_TBL_NAME, PREF_F_KEY_NAME, key);
- if (buf == NULL) {
- LOGE("IO_ERROR(0x%08x) : fail to create query string", PREFERENCE_ERROR_IO_ERROR);
- return PREFERENCE_ERROR_IO_ERROR;
- }
-
- ret = sqlite3_get_table(pref_db, buf, &result, &rows, &columns, &errmsg);
- sqlite3_free(buf);
- if (ret != SQLITE_OK) {
- LOGE("IO_ERROR(0x%08x) : fail to read data(%s)", PREFERENCE_ERROR_IO_ERROR, errmsg);
- sqlite3_free(errmsg);
- return PREFERENCE_ERROR_IO_ERROR;
- }
-
- if (rows > 0)
- *exist = true;
- else
- *exist = false;
-
- sqlite3_free_table(result);
- return PREFERENCE_ERROR_NONE;
-}
-
-static pref_changed_cb_node_t *_find_node(const char *key)
-{
- pref_changed_cb_node_t *tmp_node;
-
- if (key == NULL || key[0] == '\0')
- return NULL;
-
- tmp_node = head;
- while (tmp_node) {
- if (strcmp(tmp_node->key, key) == 0)
- break;
-
- tmp_node = tmp_node->next;
- }
-
- return tmp_node;
-}
-
-static int _add_node(const char *key, preference_changed_cb cb, void *user_data)
-{
- pref_changed_cb_node_t *tmp_node;
-
- if (key == NULL || key[0] == '\0' || cb == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", PREFERENCE_ERROR_INVALID_PARAMETER);
- return PREFERENCE_ERROR_INVALID_PARAMETER;
- }
-
- tmp_node = _find_node(key);
- if (tmp_node != NULL) {
- tmp_node->cb = cb;
- tmp_node->user_data = user_data;
- } else {
- tmp_node = (pref_changed_cb_node_t *)malloc(sizeof(pref_changed_cb_node_t));
- if (tmp_node == NULL) {
- LOGE("OUT_OF_MEMORY(0x%08x)", PREFERENCE_ERROR_OUT_OF_MEMORY);
- return PREFERENCE_ERROR_OUT_OF_MEMORY;
- }
-
- tmp_node->key = strdup(key);
- if (tmp_node->key == NULL) {
- free(tmp_node);
- LOGE("OUT_OF_MEMORY(0x%08x)", PREFERENCE_ERROR_OUT_OF_MEMORY);
- return PREFERENCE_ERROR_OUT_OF_MEMORY;
- }
-
- if (head != NULL)
- head->prev = tmp_node;
- tmp_node->cb = cb;
- tmp_node->user_data = user_data;
- tmp_node->prev = NULL;
- tmp_node->next = head;
- head = tmp_node;
- }
-
- return PREFERENCE_ERROR_NONE;
-}
-
-static int _remove_node(const char *key)
-{
- pref_changed_cb_node_t *tmp_node;
-
- if (key == NULL || key[0] == '\0') {
- LOGE("INVALID_PARAMETER(0x%08x)", PREFERENCE_ERROR_INVALID_PARAMETER);
- return PREFERENCE_ERROR_INVALID_PARAMETER;
- }
-
- tmp_node = _find_node(key);
- if (tmp_node == NULL)
- return PREFERENCE_ERROR_NONE;
-
- if (tmp_node->prev != NULL)
- tmp_node->prev->next = tmp_node->next;
- else
- head = tmp_node->next;
-
- if (tmp_node->next != NULL)
- tmp_node->next->prev = tmp_node->prev;
-
- if (tmp_node->key)
- free(tmp_node->key);
-
- free(tmp_node);
-
- return PREFERENCE_ERROR_NONE;
-}
-
-static void _remove_all_node(void)
-{
- pref_changed_cb_node_t *tmp_node;
-
- while (head) {
- tmp_node = head;
- head = tmp_node->next;
-
- if (tmp_node->key)
- free(tmp_node->key);
-
- free(tmp_node);
- }
-}
-
-static void _update_cb(void *data, int action, char const *db_name, char const *table_name, sqlite_int64 rowid)
-{
- int ret;
- char *buf;
- char **result;
- int rows;
- int columns;
- char *errmsg;
- pref_changed_cb_node_t *tmp_node;
-
- /* skip INSERT/DELETE event */
- if (action != SQLITE_UPDATE)
- return;
-
- if (strcmp(table_name, PREF_TBL_NAME) != 0) {
- SECURE_LOGE("given table name (%s) is not same", table_name);
- return;
- }
-
- buf = sqlite3_mprintf("SELECT %s FROM %s WHERE rowid='%lld';", PREF_F_KEY_NAME, PREF_TBL_NAME, rowid);
- if (buf == NULL)
- return;
-
- ret = sqlite3_get_table(pref_db, buf, &result, &rows, &columns, &errmsg);
- sqlite3_free(buf);
- if (ret != SQLITE_OK) {
- LOGI("fail to read data(%s)", errmsg);
- sqlite3_free(errmsg);
- return;
- }
-
- if (rows == 0) {
- sqlite3_free_table(result);
- return;
- }
-
- tmp_node = _find_node(result[1]);
- if (tmp_node != NULL && tmp_node->cb != NULL)
- tmp_node->cb(result[1], tmp_node->user_data);
-
- sqlite3_free_table(result);
-}
-
-int preference_remove(const char *key)
-{
- int ret;
- char *buf;
- bool exist;
- sqlite3_stmt *stmt;
-
- ret = preference_is_existing(key, &exist);
- if (ret != PREFERENCE_ERROR_NONE)
- return ret;
-
- if (!exist)
- return PREFERENCE_ERROR_NO_KEY;
-
- /* insert data or update data if data already exist */
- buf = sqlite3_mprintf("DELETE FROM %s WHERE %s = ?",
- PREF_TBL_NAME, PREF_F_KEY_NAME, key);
- if (buf == NULL) {
- LOGE("IO_ERROR(0x%08x) : fail to create query string", PREFERENCE_ERROR_IO_ERROR);
- return PREFERENCE_ERROR_IO_ERROR;
- }
-
- ret = sqlite3_prepare(pref_db, buf, strlen(buf), &stmt, NULL);
- if (ret != SQLITE_OK) {
- LOGE("IO_ERROR(0x%08x) : fail to prepare query (%d/%s)",
- PREFERENCE_ERROR_IO_ERROR,
- sqlite3_extended_errcode(pref_db),
- sqlite3_errmsg(pref_db));
- return PREFERENCE_ERROR_IO_ERROR;
- }
-
- ret = sqlite3_bind_text(stmt, 1, key, strlen(key), SQLITE_STATIC);
- if (ret != SQLITE_OK) {
- LOGE("IO_ERROR(0x%08x) : fail to bind(1) query (%d/%s)",
- PREFERENCE_ERROR_IO_ERROR,
- sqlite3_extended_errcode(pref_db),
- sqlite3_errmsg(pref_db));
- sqlite3_finalize(stmt);
- return PREFERENCE_ERROR_IO_ERROR;
- }
-
- ret = sqlite3_step(stmt);
- if (ret != SQLITE_DONE) {
- LOGE("IO_ERROR(0x%08x): fail to delete data(%d/%s)",
- PREFERENCE_ERROR_IO_ERROR,
- sqlite3_extended_errcode(pref_db),
- sqlite3_errmsg(pref_db));
- sqlite3_finalize(stmt);
- return PREFERENCE_ERROR_IO_ERROR;
- }
-
- sqlite3_finalize(stmt);
- if (buf) {
- sqlite3_free(buf);
- buf = NULL;
- }
-
- /* if exist, remove changed cb */
- _remove_node(key);
-
- return PREFERENCE_ERROR_NONE;
-}
-
-int preference_remove_all(void)
-{
- int ret;
- char *buf;
- char *errmsg;
-
- if (pref_db == NULL) {
- if (_initialize() != PREFERENCE_ERROR_NONE) {
- LOGE("IO_ERROR(0x%08x) : fail to initialize db", PREFERENCE_ERROR_IO_ERROR);
- return PREFERENCE_ERROR_IO_ERROR;
- }
- }
-
- /* insert data or update data if data already exist */
- buf = sqlite3_mprintf("DELETE FROM %s;", PREF_TBL_NAME);
- if (buf == NULL) {
- LOGE("IO_ERROR(0x%08x) : fail to create query string", PREFERENCE_ERROR_IO_ERROR);
- return PREFERENCE_ERROR_IO_ERROR;
- }
-
- ret = sqlite3_exec(pref_db, buf, NULL, NULL, &errmsg);
- sqlite3_free(buf);
- if (ret != SQLITE_OK) {
- LOGE("IO_ERROR(0x%08x) : fail to delete data (%s)", PREFERENCE_ERROR_IO_ERROR, errmsg);
- sqlite3_free(errmsg);
- return PREFERENCE_ERROR_IO_ERROR;
- }
-
- /* if exist, remove changed cb */
- _remove_all_node();
-
- return PREFERENCE_ERROR_NONE;
-}
-
-int preference_set_changed_cb(const char *key, preference_changed_cb callback, void *user_data)
-{
- int ret;
- bool exist;
-
- ret = preference_is_existing(key, &exist);
- if (ret != PREFERENCE_ERROR_NONE)
- return ret;
-
- if (!exist) {
- LOGE("NO_KEY(0x%08x) : fail to find given key(%s)", PREFERENCE_ERROR_NO_KEY, key);
- return PREFERENCE_ERROR_NO_KEY;
- }
-
- if (!is_update_hook_registered) {
- sqlite3_update_hook(pref_db, _update_cb, NULL);
- is_update_hook_registered = true;
- }
-
- return _add_node(key, callback, user_data);
-}
-
-int preference_unset_changed_cb(const char *key)
-{
- int ret;
- bool exist;
-
- ret = preference_is_existing(key, &exist);
- if (ret != PREFERENCE_ERROR_NONE)
- return ret;
-
- if (!exist) {
- LOGE("NO_KEY(0x%08x) : fail to find given key(%s)", PREFERENCE_ERROR_NO_KEY, key);
- return PREFERENCE_ERROR_NO_KEY;
- }
-
- return _remove_node(key);
-}
-
-int preference_foreach_item(preference_item_cb callback, void *user_data)
-{
- int ret;
- char *buf;
- char **result;
- int rows;
- int columns;
- char *errmsg;
- int i;
-
- if (callback == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", PREFERENCE_ERROR_INVALID_PARAMETER);
- return PREFERENCE_ERROR_INVALID_PARAMETER;
- }
-
- if (pref_db == NULL) {
- if (_initialize() != PREFERENCE_ERROR_NONE) {
- LOGE("IO_ERROR(0x%08x) : fail to initialize db", PREFERENCE_ERROR_IO_ERROR);
- return PREFERENCE_ERROR_IO_ERROR;
- }
- }
-
- buf = sqlite3_mprintf("SELECT %s FROM %s;", PREF_F_KEY_NAME, PREF_TBL_NAME);
- if (buf == NULL) {
- LOGE("IO_ERROR(0x%08x) : fail to create query string", PREFERENCE_ERROR_IO_ERROR);
- return PREFERENCE_ERROR_IO_ERROR;
- }
-
- ret = sqlite3_get_table(pref_db, buf, &result, &rows, &columns, &errmsg);
- sqlite3_free(buf);
- if (ret != SQLITE_OK) {
- LOGE("IO_ERROR(0x%08x) : fail to read data (%s)", PREFERENCE_ERROR_IO_ERROR, errmsg);
- sqlite3_free(errmsg);
- return PREFERENCE_ERROR_IO_ERROR;
- }
-
- for (i = 1; i <= rows; i++) {
- if (callback(result[i], user_data) != true)
- break;
- }
-
- sqlite3_free_table(result);
-
- return PREFERENCE_ERROR_NONE;
-}
-
diff --git a/preference/preference_inoti.c b/preference/preference_inoti.c
deleted file mode 100755
index 77bccda..0000000
--- a/preference/preference_inoti.c
+++ /dev/null
@@ -1,440 +0,0 @@
-/*
- * Copyright (c) 2015 - 2016 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 <sys/types.h>
-#include <sys/inotify.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <string.h>
-#include <linux/version.h>
-#include <stdlib.h>
-#include <pthread.h>
-#include <glib.h>
-
-#include <app_preference.h>
-#include <app_preference_internal.h>
-
-#include <glib.h>
-
-#define INOTY_EVENT_MASK (IN_CLOSE_WRITE | IN_DELETE_SELF)
-
-/* inotify */
-struct noti_node {
- int wd;
- char *keyname;
- preference_changed_cb cb;
- void *cb_data;
- struct noti_node *next;
-};
-typedef struct noti_node noti_node_s;
-static GList *g_notilist;
-
-static int _preference_inoti_comp_with_wd(gconstpointer a, gconstpointer b)
-{
- int r;
-
- noti_node_s *key1 = (noti_node_s *) a;
- noti_node_s *key2 = (noti_node_s *) b;
-
- r = key1->wd - key2->wd;
- return r;
-}
-
-static int _kdb_inoti_fd;
-
-static pthread_mutex_t _kdb_inoti_fd_mutex = PTHREAD_MUTEX_INITIALIZER;
-static pthread_mutex_t _kdb_g_ns_mutex = PTHREAD_MUTEX_INITIALIZER;
-
-static GSource *_kdb_handler;
-
-static GList *_preference_copy_noti_list(GList *orig_notilist)
-{
- GList *copy_notilist = NULL;
- struct noti_node *n = NULL;
- struct noti_node *t = NULL;
- char err_buf[ERR_LEN] = {0,};
-
- if (!orig_notilist)
- return NULL;
-
- orig_notilist = g_list_first(orig_notilist);
- if (!orig_notilist)
- return NULL;
-
- while (orig_notilist) {
- do {
- t = orig_notilist->data;
- if (t == NULL) {
- WARN("noti item data is null");
- break;
- }
-
- if ((t->keyname == NULL) || (strlen(t->keyname) == 0)) {
- WARN("noti item data key name is null");
- break;
- }
-
- n = calloc(1, sizeof(noti_node_s));
- if (n == NULL) {
- ERR("_preference_copy_noti_list : calloc failed. memory full");
- break;
- }
-
- n->keyname = strndup(t->keyname, PREFERENCE_KEY_PATH_LEN);
- if (n->keyname == NULL) {
- /* LCOV_EXCL_START */
- strerror_r(errno, err_buf, sizeof(err_buf));
- ERR("The memory is insufficient, errno: %d (%s)", errno, err_buf);
- free(n);
- break;
- /* LCOV_EXCL_STOP */
- }
- n->wd = t->wd;
- n->cb_data = t->cb_data;
- n->cb = t->cb;
-
- copy_notilist = g_list_append(copy_notilist, n);
- } while (0);
-
- orig_notilist = g_list_next(orig_notilist);
- }
- return copy_notilist;
-}
-
-static void _preference_free_noti_node(gpointer data)
-{
- struct noti_node *n = (struct noti_node *)data;
- g_free(n->keyname);
- g_free(n);
-}
-
-static void _preference_free_noti_list(GList *noti_list)
-{
- g_list_free_full(noti_list, _preference_free_noti_node);
-}
-
-
-static gboolean _preference_kdb_gio_cb(GIOChannel *src, GIOCondition cond, gpointer data)
-{
- int fd, r, res;
- struct inotify_event ie;
- GList *l_notilist = NULL;
- struct noti_node *t = NULL;
- GList *noti_list = NULL;
- keynode_t *keynode;
-
- fd = g_io_channel_unix_get_fd(src);
- r = read(fd, &ie, sizeof(ie));
-
- while (r > 0) {
- if (ie.mask & INOTY_EVENT_MASK) {
-
- INFO("read event from GIOChannel. wd : %d", ie.wd);
-
- pthread_mutex_lock(&_kdb_g_ns_mutex);
- l_notilist = _preference_copy_noti_list(g_notilist);
- pthread_mutex_unlock(&_kdb_g_ns_mutex);
-
- if (l_notilist) {
- noti_list = g_list_first(l_notilist);
- while (noti_list) {
- t = noti_list->data;
-
- keynode = _preference_keynode_new();
- if (keynode == NULL) {
- ERR("key malloc fail");
- break;
- }
-
- if ((t) && (t->wd == ie.wd) && (t->keyname)) {
- res = _preference_keynode_set_keyname(keynode, t->keyname);
- if (res != PREFERENCE_ERROR_NONE) {
- ERR("_preference_keynode_set_keyname() failed(%d)", res);
- goto out_func;
- }
-
- if ((ie.mask & IN_DELETE_SELF)) {
- res = _preference_kdb_del_notify(keynode);
- if (res != PREFERENCE_ERROR_NONE)
- ERR("_preference_kdb_del_notify() failed(%d)", res);
- } else {
- res = _preference_get_key(keynode);
- if (res != PREFERENCE_ERROR_NONE)
- ERR("_preference_get_key() failed(%d)", res);
-
- INFO("key(%s) is changed. cb(%p) called", t->keyname, t->cb);
- t->cb(t->keyname, t->cb_data);
- }
- } else if ((t) && (t->keyname == NULL)) { /* for debugging */
- ERR("preference keyname is null.");
- }
-out_func:
- _preference_keynode_free(keynode);
-
- noti_list = g_list_next(noti_list);
- }
-
- _preference_free_noti_list(l_notilist);
- }
- }
-
- if (ie.len > 0)
- (void) lseek(fd, ie.len, SEEK_CUR);
-
- r = read(fd, &ie, sizeof(ie));
- }
- return TRUE;
-}
-
-static int _preference_kdb_noti_init(void)
-{
- GIOChannel *gio;
- int ret = 0;
- char err_buf[ERR_LEN] = { 0, };
-
- pthread_mutex_lock(&_kdb_inoti_fd_mutex);
-
- if (0 < _kdb_inoti_fd) {
- /* LCOV_EXCL_START */
- ERR("Error: invalid _kdb_inoti_fd");
- pthread_mutex_unlock(&_kdb_inoti_fd_mutex);
- return PREFERENCE_ERROR_IO_ERROR;
- /* LCOV_EXCL_STOP */
- }
- _kdb_inoti_fd = inotify_init();
- if (_kdb_inoti_fd == -1) {
- /* LCOV_EXCL_START */
- strerror_r(errno, err_buf, sizeof(err_buf));
- ERR("inotify init: %s", err_buf);
- pthread_mutex_unlock(&_kdb_inoti_fd_mutex);
- return PREFERENCE_ERROR_IO_ERROR;
- /* LCOV_EXCL_STOP */
- }
-
- ret = fcntl(_kdb_inoti_fd, F_SETFD, FD_CLOEXEC);
- if (ret < 0) {
- /* LCOV_EXCL_START */
- strerror_r(errno, err_buf, sizeof(err_buf));
- ERR("inotify init: %s", err_buf);
- pthread_mutex_unlock(&_kdb_inoti_fd_mutex);
- return PREFERENCE_ERROR_IO_ERROR;
- /* LCOV_EXCL_STOP */
- }
-
- ret = fcntl(_kdb_inoti_fd, F_SETFL, O_NONBLOCK);
- if (ret < 0) {
- /* LCOV_EXCL_START */
- strerror_r(errno, err_buf, sizeof(err_buf));
- ERR("inotify init: %s", err_buf);
- pthread_mutex_unlock(&_kdb_inoti_fd_mutex);
- return PREFERENCE_ERROR_IO_ERROR;
- /* LCOV_EXCL_STOP */
- }
-
- pthread_mutex_unlock(&_kdb_inoti_fd_mutex);
-
- gio = g_io_channel_unix_new(_kdb_inoti_fd);
- retvm_if(gio == NULL, -1, "Error: create a new GIOChannel");
-
- g_io_channel_set_flags(gio, G_IO_FLAG_NONBLOCK, NULL);
-
- _kdb_handler = g_io_create_watch(gio, G_IO_IN);
- g_source_set_callback(_kdb_handler, (GSourceFunc) _preference_kdb_gio_cb, NULL, NULL);
- g_source_attach(_kdb_handler, NULL);
- g_io_channel_unref(gio);
- g_source_unref(_kdb_handler);
-
- return PREFERENCE_ERROR_NONE;
-}
-
-int _preference_kdb_add_notify(keynode_t *keynode, preference_changed_cb cb, void *data)
-{
- char path[PATH_MAX];
- int wd;
- struct noti_node t, *n, *node;
- char err_buf[ERR_LEN] = { 0, };
- int ret = 0;
- GList *list = NULL;
- int func_ret = PREFERENCE_ERROR_NONE;
- char *keyname = keynode->keyname;
-
- retvm_if((keyname == NULL || cb == NULL), PREFERENCE_ERROR_INVALID_PARAMETER,
- "_preference_kdb_add_notify : Invalid argument - keyname(%s) cb(%p)",
- keyname, cb);
-
- if (_kdb_inoti_fd <= 0)
- if (_preference_kdb_noti_init())
- return PREFERENCE_ERROR_IO_ERROR;
-
- ret = _preference_get_key_path(keynode, path);
- if (ret != PREFERENCE_ERROR_NONE) {
- ERR("Invalid argument: key is not valid");
- return PREFERENCE_ERROR_INVALID_PARAMETER;
- }
-
- if (access(path, F_OK) != 0) {
- if (errno == ENOENT) {
- ERR("_preference_kdb_add_notify : Key(%s) does not exist", keyname);
- return PREFERENCE_ERROR_IO_ERROR;
- }
- }
-
- wd = inotify_add_watch(_kdb_inoti_fd, path, INOTY_EVENT_MASK);
- if (wd == -1) {
- strerror_r(errno, err_buf, sizeof(err_buf));
- ERR("_preference_kdb_add_notify : add noti(%s)", err_buf);
- return PREFERENCE_ERROR_IO_ERROR;
- }
-
- t.wd = wd;
-
- pthread_mutex_lock(&_kdb_g_ns_mutex);
-
- list = g_list_find_custom(g_notilist, &t, (GCompareFunc)_preference_inoti_comp_with_wd);
- if (list) {
- /* LCOV_EXCL_START */
- WARN("_preference_kdb_add_notify : key(%s) change callback(%p)", keyname, cb);
-
- node = list->data;
- node->wd = wd;
- node->cb_data = data;
- node->cb = cb;
-
- goto out_func;
- /* LCOV_EXCL_STOP */
- }
-
- n = calloc(1, sizeof(noti_node_s));
- if (n == NULL) {
- /* LCOV_EXCL_START */
- strerror_r(errno, err_buf, sizeof(err_buf));
- ERR("_preference_kdb_add_notify : add noti(%s)", err_buf);
- func_ret = PREFERENCE_ERROR_IO_ERROR;
- goto out_func;
- /* LCOV_EXCL_STOP */
- }
-
- n->keyname = strndup(keyname, PREFERENCE_KEY_PATH_LEN);
- if (n->keyname == NULL) {
- /* LCOV_EXCL_START */
- strerror_r(errno, err_buf, sizeof(err_buf));
- ERR("The memory is insufficient, errno: %d (%s)", errno, err_buf);
- free(n);
- goto out_func;
- /* LCOV_EXCL_STOP */
- }
- n->wd = wd;
- n->cb_data = data;
- n->cb = cb;
-
- g_notilist = g_list_append(g_notilist, n);
- if (!g_notilist)
- ERR("g_list_append fail");
-
- INFO("cb(%p) is added for %s. tot cb cnt : %d\n", cb, n->keyname, g_list_length(g_notilist));
-
-out_func:
- pthread_mutex_unlock(&_kdb_g_ns_mutex);
-
- return func_ret;
-}
-
-int _preference_kdb_del_notify(keynode_t *keynode)
-{
- int wd = 0;
- int r = 0;
- struct noti_node *n = NULL;
- struct noti_node t;
- char path[PATH_MAX] = { 0, };
- char err_buf[ERR_LEN] = { 0, };
- int del = 0;
- int ret = 0;
- char *keyname = keynode->keyname;
- int func_ret = PREFERENCE_ERROR_NONE;
- GList *noti_list;
-
- retvm_if(keyname == NULL, PREFERENCE_ERROR_INVALID_PARAMETER, "Invalid argument: keyname(%s)", keyname);
-
- ret = _preference_get_key_path(keynode, path);
- if (ret != PREFERENCE_ERROR_NONE) {
- ERR("Invalid argument: key is not valid");
- return PREFERENCE_ERROR_INVALID_PARAMETER;
- }
-
- if (access(path, F_OK) != 0) {
- if (errno == ENOENT) {
- ERR("_preference_kdb_del_notify : Key(%s) does not exist", keyname);
- return PREFERENCE_ERROR_IO_ERROR;
- }
- }
-
- retvm_if(_kdb_inoti_fd == 0, PREFERENCE_ERROR_NONE, "Invalid operation: not exist anything for inotify");
-
- /* get wd */
- wd = inotify_add_watch(_kdb_inoti_fd, path, INOTY_EVENT_MASK);
- if (wd == -1) {
- strerror_r(errno, err_buf, sizeof(err_buf));
- ERR("Error: inotify_add_watch() [%s]: %s", path, err_buf);
- return PREFERENCE_ERROR_IO_ERROR;
- }
-
- pthread_mutex_lock(&_kdb_g_ns_mutex);
-
- t.wd = wd;
-
- noti_list = g_list_find_custom(g_notilist, &t, (GCompareFunc)_preference_inoti_comp_with_wd);
- if (noti_list) {
- del++;
-
- n = noti_list->data;
- g_notilist = g_list_remove(g_notilist, n);
- g_free(n->keyname);
- g_free(n);
-
- r = inotify_rm_watch(_kdb_inoti_fd, wd);
- if (r == -1) {
- strerror_r(errno, err_buf, sizeof(err_buf));
- ERR("Error: inotify_rm_watch [%s]: %s", keyname, err_buf);
- func_ret = PREFERENCE_ERROR_IO_ERROR;
- }
-
- INFO("key(%s) cb is removed. remained noti list total length(%d)",
- keyname, g_list_length(g_notilist));
- }
-
- if (g_list_length(g_notilist) == 0) {
- close(_kdb_inoti_fd);
- _kdb_inoti_fd = 0;
-
- g_source_destroy(_kdb_handler);
- _kdb_handler = NULL;
-
- g_list_free(g_notilist);
- g_notilist = NULL;
-
- INFO("all noti list is freed");
- }
-
- pthread_mutex_unlock(&_kdb_g_ns_mutex);
-
- if (del == 0) {
- errno = ENOENT;
- func_ret = PREFERENCE_ERROR_IO_ERROR;
- }
-
- return func_ret;
-}
-
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 426b997..8162301 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -9,8 +9,8 @@ SET(PREFIX ${CMAKE_INSTALL_PREFIX})
SET(INC_DIR ${CMAKE_SOURCE_DIR}/include)
INCLUDE_DIRECTORIES(${INC_DIR})
-SET(requires "dlog bundle appcore-common appcore-efl aul capi-base-common libtzplatform-config pkgmgr-info glib-2.0")
-SET(pc_requires "capi-base-common vconf-internal-keys capi-appfw-app-control capi-appfw-app-common appcore-common libtzplatform-config")
+SET(requires "dlog bundle appcore-common appcore-efl aul capi-base-common capi-appfw-app-common capi-appfw-app-control libtzplatform-config pkgmgr-info glib-2.0")
+SET(pc_requires "capi-base-common vconf-internal-keys capi-appfw-app-control capi-appfw-app-common libtzplatform-config")
INCLUDE(FindPkgConfig)
pkg_check_modules(${fw_name} REQUIRED ${requires})
@@ -60,7 +60,7 @@ SET(PC_REQUIRED ${pc_requires})
SET(PC_LDFLAGS -l${fw_name})
CONFIGURE_FILE(
- ${CMAKE_SOURCE_DIR}/capi-appfw-module.pc.in
+ ${CMAKE_SOURCE_DIR}/${fw_name}.pc.in
${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc
@ONLY
)
diff --git a/src/app_main.c b/src/app_main.c
index b8aad27..4d9c7b9 100755
--- a/src/app_main.c
+++ b/src/app_main.c
@@ -28,6 +28,7 @@
#include <app_internal.h>
#include <app_control_internal.h>
+#include <app_common_internal.h>
#include <tizen_error.h>
#include "app_extension.h"
diff --git a/src/app_main_legacy.c b/src/app_main_legacy.c
index e803535..32cb232 100755
--- a/src/app_main_legacy.c
+++ b/src/app_main_legacy.c
@@ -18,6 +18,7 @@
#include <stdlib.h>
#include <dlog.h>
+#include <app_common_internal.h>
#include <app_internal.h>
#include <tizen_error.h>