From b1eee2124d3e634449c79ae26e8e2ba728c49622 Mon Sep 17 00:00:00 2001 From: Sungwook Park Date: Fri, 28 Aug 2020 14:46:33 +0900 Subject: [PATCH 01/16] Fix issue that detected by static analysis tool Change-Id: I5144129783cfb8acf6f654ea8e2730c4ce6ccc93 Signed-off-by: Sungwook Park --- client/gesture.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/client/gesture.c b/client/gesture.c index 17065d1..f333dea 100644 --- a/client/gesture.c +++ b/client/gesture.c @@ -77,8 +77,8 @@ static int _check_privilege(const char *uid, const char *privilege) if (!p_cynara) { return -1; } - - strcpy(smack_label, _get_smack_label()); + char * sl = _get_smack_label(); + memcpy(smack_label, sl, strlen(sl) + 1); pid_t pid = getpid(); char *session = cynara_session_from_pid(pid); @@ -143,7 +143,8 @@ EXPORT_API int hand_gesture_create(hand_gesture_h *handle) /* get uid and smack label */ snprintf(_struct->uid, 16, "%d", getuid()); - strcpy(_struct->smack_label, _get_smack_label()); + char *sl = _get_smack_label(); + memcpy(_struct->smack_label, sl, strlen(sl) + 1); LOGI("uid(%s), smack(%s)", _struct->uid, _struct->smack_label); -- 2.7.4 From a81b00b30707820c9f3d1e1fb59268409958469b Mon Sep 17 00:00:00 2001 From: "sooyeon.kim" Date: Tue, 1 Sep 2020 14:37:29 +0900 Subject: [PATCH 02/16] Add line coverage options Change-Id: I658f93c800d2823f4e83a8c84ee220baeb04324e Signed-off-by: sooyeon.kim --- client/gesture.c | 12 ++++++------ packaging/capi-ui-gesture.spec | 10 ++++++++++ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/client/gesture.c b/client/gesture.c index f333dea..84d291d 100644 --- a/client/gesture.c +++ b/client/gesture.c @@ -213,7 +213,7 @@ EXPORT_API int hand_gesture_is_supported_type(hand_gesture_h handle, hand_gestur return HAND_GESTURE_ERROR_NONE; } - +//LCOV_EXCL_START EXPORT_API int hand_gesture_set_handtype(hand_gesture_h handle, hand_gesture_handtype_e hand_type) { LOGD("hand_gesture_set_handtype"); @@ -249,7 +249,7 @@ EXPORT_API int hand_gesture_set_workmode(hand_gesture_h handle, hand_gesture_wor return ret; } - +//LCOV_EXCL_STOP EXPORT_API int hand_gesture_set_option(hand_gesture_h handle, hand_gesture_option_e option) { LOGD("hand_gesture_set_option"); @@ -267,7 +267,7 @@ EXPORT_API int hand_gesture_set_option(hand_gesture_h handle, hand_gesture_optio return ret; } - +//LCOV_EXCL_START EXPORT_API int hand_gesture_set_sensitivity(hand_gesture_h handle, int sensitivity) { LOGD("hand_gesture_set_sensitivity"); @@ -285,7 +285,7 @@ EXPORT_API int hand_gesture_set_sensitivity(hand_gesture_h handle, int sensitivi return ret; } - +//LCOV_EXCL_STOP EXPORT_API int hand_gesture_start_recognition(hand_gesture_h handle, hand_gesture_type_e gesture_type, hand_gesture_recognition_cb callback, void *user_data) { LOGD("hand_gesture_start_recognition"); @@ -338,7 +338,7 @@ EXPORT_API int hand_gesture_stop_recognition(hand_gesture_h handle) return HAND_GESTURE_ERROR_NONE; } - +//LCOV_EXCL_START EXPORT_API int hand_gesture_get_event(const hand_gesture_data_h data, hand_gesture_event_e *event) { CHECK_GESTURE_FEATURE(); @@ -349,7 +349,7 @@ EXPORT_API int hand_gesture_get_event(const hand_gesture_data_h data, hand_gestu return HAND_GESTURE_ERROR_NONE; } - +//LCOV_EXCL_STOP EXPORT_API int hand_gesture_get_engine_info(hand_gesture_h handle, char** engine_app_id, char** engine_name) { LOGD("[engineInfo] hand_gesture_get_engine_info"); diff --git a/packaging/capi-ui-gesture.spec b/packaging/capi-ui-gesture.spec index 7fb84c2..7aa6b55 100644 --- a/packaging/capi-ui-gesture.spec +++ b/packaging/capi-ui-gesture.spec @@ -28,6 +28,11 @@ Requires(post): /sbin/ldconfig Requires(post): dbus Requires(postun): /sbin/ldconfig +%if 0%{?gcov:1} +BuildRequires: lcov +BuildRequires: zip +%endif + %description Gesture client library and daemon @@ -91,6 +96,11 @@ mkdir -p %{buildroot}%{_datadir}/gcov/obj install -m 0644 gcov-obj/* %{buildroot}%{_datadir}/gcov/obj %endif +#%if 0%{?gcov:1} +#lcov -c --ignore-errors graph --no-external -q -d . -o gcov.info +#genhtml gcov.info +#%endif + mkdir -p %{buildroot}/etc/dbus-1/system.d/ cp %{SOURCE3} %{buildroot}/etc/dbus-1/system.d/capi-ui-gesture.conf -- 2.7.4 From 8a30d4e2d0910de34f6a756c5390992a1bfa18a2 Mon Sep 17 00:00:00 2001 From: Suyeon Hwang Date: Tue, 25 Aug 2020 19:40:39 +0900 Subject: [PATCH 03/16] Refactor gdbus interface of gesture FW This patch includes these changes. - Extract gdbus interface definition xml from source code to .xml file. - Create invocation manager class to manager gdbus method call session. - Synchronize API behavior(hand_gesture_is_supported_type, hand_gesture_get_engine_info). Change-Id: Ied0b8a766d4b07634b31f6dc9f5325d057471936 Signed-off-by: Suyeon Hwang --- CMakeLists.txt | 2 + capi-ui-gesture-gdbus.xml | 65 ++++++++ client/gesture.c | 1 + client/gesture_client_dbus.c | 43 +++++- engine/gesture_engine_dbus.c | 52 +++++-- include/gesture_defs.h | 7 +- manager/gestured_invocation_manager.cpp | 71 +++++++++ manager/gestured_invocation_manager.h | 20 +++ packaging/capi-ui-gesture.spec | 1 + server/CMakeLists.txt | 1 + server/gestured_dbus.c | 260 ++++++++++++++++++++------------ server/gestured_dbus.h | 8 +- 12 files changed, 418 insertions(+), 113 deletions(-) create mode 100644 capi-ui-gesture-gdbus.xml create mode 100644 manager/gestured_invocation_manager.cpp create mode 100644 manager/gestured_invocation_manager.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 5ccea7d..c3e0afd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,3 +46,5 @@ ADD_SUBDIRECTORY(client) ## Gesture manager ## #ADD_SUBDIRECTORY(manager) + +INSTALL(FILES ${CMAKE_SOURCE_DIR}/capi-ui-gesture-gdbus.xml DESTINATION ${TZ_SYS_RO_SHARE}/gesture) diff --git a/capi-ui-gesture-gdbus.xml b/capi-ui-gesture-gdbus.xml new file mode 100644 index 0000000..4adff75 --- /dev/null +++ b/capi-ui-gesture-gdbus.xml @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/client/gesture.c b/client/gesture.c index f333dea..3872631 100644 --- a/client/gesture.c +++ b/client/gesture.c @@ -201,6 +201,7 @@ EXPORT_API int hand_gesture_is_supported_type(hand_gesture_h handle, hand_gestur LOGD("hand_gesture_is_supported_type"); CHECK_GESTURE_FEATURE(); + ASSERT_NOT_NULL(handle); ASSERT_NOT_NULL(supported); int ret; diff --git a/client/gesture_client_dbus.c b/client/gesture_client_dbus.c index 532ac88..0c58dad 100644 --- a/client/gesture_client_dbus.c +++ b/client/gesture_client_dbus.c @@ -623,10 +623,21 @@ int gesture_client_dbus_is_support_gesture_type(GDBusConnection *gdbus_connectio GDBusMessage *reply = NULL; GVariant *body = NULL; - body = g_variant_new("()"); + body = g_variant_new("(i)", gesture); ret = gdbus_send_message_with_sync(gdbus_connection, body, &reply, GESTURE_CLIENT_MSG_IS_SUPPORT_GESTURE_TYPE); - if (ret != HAND_GESTURE_ERROR_NONE) + if (ret != HAND_GESTURE_ERROR_NONE || NULL == reply) { LOGE("failed to is_supported_gesture_type"); + } else { + LOGD("Check reply from server"); + GVariant *reply_body = g_dbus_message_get_body(reply); + if (NULL == reply_body) { + LOGE("There is no return value"); + ret = HAND_GESTURE_ERROR_OPERATION_FAILED; + } else { + g_variant_get(reply_body, "(b)", supported); + LOGD("supported(%d)", *supported); + } + } if (body) g_variant_unref(body); @@ -643,13 +654,35 @@ int gesture_client_dbus_get_engine_info(GDBusConnection *gdbus_connection, char* int ret; GDBusMessage *reply = NULL; GVariant *body = NULL; - g_engine_app_id = *engine_app_id; - g_engine_name = *engine_name; body = g_variant_new("()"); ret = gdbus_send_message_with_sync(gdbus_connection, body, &reply, GESTURE_CLIENT_MSG_ENGINE_GET_INFO); if (ret != HAND_GESTURE_ERROR_NONE) - LOGE("failed to engine_get_info"); + LOGE("Fail to send message"); + + GVariant *reply_body = g_dbus_message_get_body(reply); + if (NULL == reply_body) { + LOGE("There is no return value"); + ret = HAND_GESTURE_ERROR_OPERATION_FAILED; + } else { + g_variant_get(reply_body, "(ss)", engine_app_id, engine_name); + if (NULL == engine_app_id || NULL == engine_name) { + LOGE("Fail to get engine info"); + ret = HAND_GESTURE_ERROR_OPERATION_FAILED; + } else { + if (NULL != g_engine_app_id) { + free(g_engine_app_id); + } + + if (NULL != g_engine_name) { + free(g_engine_name); + } + + g_engine_app_id = *engine_app_id; + g_engine_name = *engine_name; + LOGD("APP ID(%s), Name(%s)", *engine_app_id, *engine_name); + } + } if (body) g_variant_unref(body); diff --git a/engine/gesture_engine_dbus.c b/engine/gesture_engine_dbus.c index 3eeb674..a0ec977 100644 --- a/engine/gesture_engine_dbus.c +++ b/engine/gesture_engine_dbus.c @@ -29,6 +29,8 @@ static int is_server_started = 0; static gesture_engine_request_callback_s g_basic_engine_callback; static GDBusConnection *mgdbus_connection; +static int gdbus_send_message_with_async(GDBusConnection *gdbus_connection, GVariant *body, char *cmd); + static void _server_appeared_cb(GDBusConnection *connection, const gchar *name, const gchar *name_owner, gpointer user_data) { LOGD("name : %s, name_owner : %s", name, name_owner); @@ -150,16 +152,46 @@ static void _handle_gesture_engine_cb(GDBusConnection *connection, } else if (g_strcmp0(signal_name, GESTURE_ENGINE_SIGNAL_IS_SUPPORT_GESTURE_TYPE) == 0) { LOGD("[GESTURE_ENGINE_SIGNAL_IS_SUPPORT_GESTURE_TYPE] called"); - int gesture_type = 1; - bool isSupported = false; - g_variant_get(parameters, "(i)", &gesture_type); - g_basic_engine_callback.is_support_gesture_type(gesture_type, &isSupported); - } - else if (g_strcmp0(signal_name, GESTURE_ENGINE_SIGNAL_ENGINE_GET_INFO) == 0) { - LOGD("[GESTURE_ENGINE_SIGNAL_ENGINE_GET_INFO] called"); - char *engine_app_id; - char *engine_name; + int id = 0; + int gesture_type = 0; + g_variant_get(parameters, "(ii)", &id, &gesture_type); + LOGD("Invocation ID(%d), Gesture Type(%d)", id, gesture_type); + + bool is_supported = false; + g_basic_engine_callback.is_support_gesture_type(gesture_type, &is_supported); + GVariant* body = g_variant_new("(ib)", id, is_supported); + if (NULL == body) { + LOGE("Fail to create body"); + return; + } + + LOGD("send message variant. ID(%d), Is supported(%d)", id, is_supported); + gdbus_send_message_with_async(connection, body, GESTURE_ENGINE_MSG_IS_SUPPORT_GESTURE_TYPE); + g_variant_unref(body); + } + else if (g_strcmp0(signal_name, GESTURE_ENGINE_SIGNAL_GET_ENGINE_INFO) == 0) { + LOGD("[GESTURE_ENGINE_SIGNAL_GET_ENGINE_INFO] called"); + int id = 0; + g_variant_get(parameters, "(i)", &id); + LOGD("Invocation ID(%d)", id); + + char *engine_app_id = NULL; + char *engine_name = NULL; g_basic_engine_callback.get_info(&engine_app_id, &engine_name); + if (NULL == engine_app_id || NULL == engine_name) { + LOGE("Fail to get engine information"); + return; + } + + GVariant* body = g_variant_new("(iss)", id, engine_app_id, engine_name); + if (NULL == body) { + LOGE("Fail to create body"); + return; + } + + LOGD("send message variant. APP ID(%s), Name(%s)", engine_app_id, engine_name); + gdbus_send_message_with_async(connection, body, GESTURE_ENGINE_MSG_GET_ENGINE_INFO); + g_variant_unref(body); } } @@ -595,7 +627,7 @@ int gesture_engine_dbus_send_engine_get_info(GDBusConnection *gdbus_connection, GVariant *body = NULL; body = g_variant_new("(ss)", engine_app_id, engine_name); - ret = gdbus_send_message_with_sync(mgdbus_connection, body, &reply, GESTURE_ENGINE_MSG_SEND_ENGINE_GET_INFO); + ret = gdbus_send_message_with_sync(mgdbus_connection, body, &reply, GESTURE_ENGINE_MSG_GET_ENGINE_INFO); if (ret != GESTURE_ENGINE_ERROR_NONE) { LOGE("Fail to send result data to daemon"); } diff --git a/include/gesture_defs.h b/include/gesture_defs.h index d08beca..613e697 100644 --- a/include/gesture_defs.h +++ b/include/gesture_defs.h @@ -27,6 +27,8 @@ extern "C" { #define HAPI __attribute__((visibility("hidden"))) +#define GESTURE_SHARED_RESOURCE_PATH tzplatform_mkpath(tzplatform_getid("TZ_SYS_RO_SHARE"), "gesture") + #define DBUS_NAME "org.freedesktop.DBus" #define DBUS_OBJECT_PATH "/org/freedesktop/DBus" #define DBUS_INTERFACE_NAME "org.freedesktop.DBus" @@ -56,7 +58,8 @@ extern "C" { #define GESTURE_ENGINE_MSG_SEND_RESULT "gesture_engine_send_result" #define GESTURE_ENGINE_MSG_SEND_ERROR "gesture_engine_send_error" #define GESTURE_ENGINE_MSG_SEND_MOTION_STATUS "gesture_engine_send_motion_status" -#define GESTURE_ENGINE_MSG_SEND_ENGINE_GET_INFO "gesture_engine_send_engine_get_info" +#define GESTURE_ENGINE_MSG_IS_SUPPORT_GESTURE_TYPE "gesture_engine_is_support_gesture_type" +#define GESTURE_ENGINE_MSG_GET_ENGINE_INFO "gesture_engine_get_engine_info" #define GESTURE_ENGINE_SIGNAL_ENGINE_INITIALIZE "engine_initialize" #define GESTURE_ENGINE_SIGNAL_ENGINE_DEINITIALIZE "engine_deinitialize" @@ -65,7 +68,7 @@ extern "C" { #define GESTURE_ENGINE_SIGNAL_FOREACH_RESULT_TIME "engine_foreach_result_time" #define GESTURE_ENGINE_SIGNAL_FOREACH_SUPPORTED_TYPE "engine_foreach_supported_type" #define GESTURE_ENGINE_SIGNAL_IS_SUPPORT_GESTURE_TYPE "engine_is_support_gesture_type" -#define GESTURE_ENGINE_SIGNAL_ENGINE_GET_INFO "engine_get_info" +#define GESTURE_ENGINE_SIGNAL_GET_ENGINE_INFO "engine_get_engine_info" #define GESTURE_PRIVILEGE_APPLAUNCH "http://tizen.org/privilege/appmanager.launch" #define GESTURE_FEATURE_GESTURE "tizen.org/feature/sensor.gesture_recognition" diff --git a/manager/gestured_invocation_manager.cpp b/manager/gestured_invocation_manager.cpp new file mode 100644 index 0000000..7f1cd14 --- /dev/null +++ b/manager/gestured_invocation_manager.cpp @@ -0,0 +1,71 @@ +#include +#include + +#include + +#include "gestured_invocation_manager.h" + +#ifdef LOG_TAG +#undef LOG_TAG +#endif +#define LOG_TAG "GESTURE_INVOCATION" + +static const int MAX_INVOCATION_ID = 1000000; + +static std::map g_invocation_map; +static int g_last_id = -1; + +int gestureInvocationManagerInit() +{ + LOGD("Initialize invocation manager"); + g_last_id = -1; + g_invocation_map.clear(); + + return 0; +} + +int gestureInvocationManagerAdd(GDBusMethodInvocation* invocation) +{ + if (NULL == invocation) { + LOGE("Invalid parameter"); + return -1; + } + + LOGD("Add new invocation handle"); + bool findId = false; + for (int i = g_last_id + 1; i != g_last_id; i = (i + 1) % MAX_INVOCATION_ID) { + if (g_invocation_map.find(i) == g_invocation_map.end()) { + g_last_id = i; + findId = true; + break; + } + } + + if (!findId) { + LOGE("Invocation map is full"); + return -1; + } + + g_invocation_map.insert({g_last_id, invocation}); + + return g_last_id; +} + +GDBusMethodInvocation* gestureInvocationManagerGet(int invocation_id) +{ + LOGD("Find invocation handle. ID(%d)", invocation_id); + auto iter = g_invocation_map.find(invocation_id); + if (iter == g_invocation_map.end()) { + LOGE("There is no handle"); + return nullptr; + } + + return iter->second; +} + +bool gestureInvocationManagerRemove(int invocation_id) +{ + LOGD("Remove invocation handle. ID(%d)", invocation_id); + g_invocation_map.erase(invocation_id); + return true; +} \ No newline at end of file diff --git a/manager/gestured_invocation_manager.h b/manager/gestured_invocation_manager.h new file mode 100644 index 0000000..32c3458 --- /dev/null +++ b/manager/gestured_invocation_manager.h @@ -0,0 +1,20 @@ +#ifndef __GESTURED_INVOCATION_MANAGER_H__ +#define __GESTURED_INVOCATION_MANAGER_H__ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +int gestureInvocationManagerInit(); +int gestureInvocationManagerAdd(GDBusMethodInvocation* invocation); +GDBusMethodInvocation* gestureInvocationManagerGet(int invocation_id); +bool gestureInvocationManagerRemove(int invocation_id); + +#ifdef __cplusplus +} +#endif + +#endif /* __GESTURED_INVOCATION_MANAGER_H__ */ + diff --git a/packaging/capi-ui-gesture.spec b/packaging/capi-ui-gesture.spec index 7fb84c2..2bae1f2 100644 --- a/packaging/capi-ui-gesture.spec +++ b/packaging/capi-ui-gesture.spec @@ -104,6 +104,7 @@ cp %{SOURCE3} %{buildroot}/etc/dbus-1/system.d/capi-ui-gesture.conf %license LICENSE %{_libdir}/lib*.so %attr(0755,ui_fw,ui_fw) %{_bindir}/gesture-server +%attr(0644,root,root) %{_datadir}/gesture/capi-ui-gesture-gdbus.xml %attr(0644,root,root) %{_unitdir}/capi-ui-gesture.service %attr(0644,root,root) %{_datadir}/dbus-1/system-services/org.tizen.gesture.server.service %config %{_sysconfdir}/dbus-1/system.d/capi-ui-gesture.conf diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt index c41307a..d79d081 100644 --- a/server/CMakeLists.txt +++ b/server/CMakeLists.txt @@ -4,6 +4,7 @@ SET(SRCS gestured_dbus.c ../manager/gestured_client_manager.cpp ../manager/gestured_engine_manager.cpp + ../manager/gestured_invocation_manager.cpp ) FOREACH(flag ${pkgs_CFLAGS}) diff --git a/server/gestured_dbus.c b/server/gestured_dbus.c index 20a956e..0673c4d 100644 --- a/server/gestured_dbus.c +++ b/server/gestured_dbus.c @@ -30,6 +30,7 @@ #include "gesture_defs.h" #include "gestured_client_manager.h" #include "gestured_engine_manager.h" +#include "gestured_invocation_manager.h" #ifdef LOG_TAG #undef LOG_TAG @@ -300,6 +301,8 @@ int gestured_server_register_dbus_interface(char *introspection_xml, GDBusInterf goto cleanup; } + gestureInvocationManagerInit(); + return GESTURED_ERROR_NONE; cleanup: @@ -448,6 +451,7 @@ static void _gestured_client_dbus_method_call_handler(GDBusConnection *conn, con GVariant *reply_body = NULL; int ret = GESTURED_ERROR_NONE; + bool delay_response = false; if (g_strcmp0(method_name, GESTURE_MSG_SERVICE_REGISTER) == 0) { LOGD("[GESTURE_MSG_SERVICE_REGISTER] called"); @@ -481,11 +485,13 @@ static void _gestured_client_dbus_method_call_handler(GDBusConnection *conn, con } else if (g_strcmp0(method_name, GESTURE_CLIENT_MSG_IS_SUPPORT_GESTURE_TYPE) == 0) { LOGD("[GESTURE_CLIENT_MSG_IS_SUPPORT_GESTURE_TYPE] called"); - ret = gestured_client_is_support_gesture_type(parameters, &reply_body, sender); + ret = gestured_client_is_support_gesture_type(parameters, &reply_body, sender, invocation); + delay_response = true; } else if (g_strcmp0(method_name, GESTURE_CLIENT_MSG_ENGINE_GET_INFO) == 0) { LOGD("[GESTURE_CLIENT_MSG_ENGINE_GET_INFO] called"); - ret = gestured_client_engine_get_info(parameters, &reply_body, sender); + ret = gestured_client_get_engine_info(parameters, &reply_body, sender, invocation); + delay_response = true; } /* from engine */ @@ -504,24 +510,32 @@ static void _gestured_client_dbus_method_call_handler(GDBusConnection *conn, con else if (g_strcmp0(method_name, GESTURE_ENGINE_MSG_MAIN_START) == 0) { LOGD("[GESTURE_ENGINE_MSG_MAIN_START] called"); } - else if (g_strcmp0(method_name, GESTURE_ENGINE_MSG_SEND_ENGINE_GET_INFO) == 0) { - LOGD("[GESTURE_ENGINE_MSG_SEND_ENGINE_GET_INFO] called"); - ret = gestured_engine_send_engine_get_info(parameters, &reply_body, sender); + else if (g_strcmp0(method_name, GESTURE_ENGINE_MSG_GET_ENGINE_INFO) == 0) { + LOGD("[GESTURE_ENGINE_MSG_GET_ENGINE_INFO] called"); + int id = -1; + char* app_id = NULL; + char* name = NULL; + + g_variant_get(parameters, "(iss)", &id, &app_id, &name); + ret = gestured_reply_get_engine_info(id, app_id, name); } + else if (g_strcmp0(method_name, GESTURE_ENGINE_MSG_IS_SUPPORT_GESTURE_TYPE) == 0) { + LOGD("[GESTURE_ENGINE_MSG_IS_SUPPORT_GESTURE_TYPE] called"); + int id = -1; + bool is_supported = false; - if (ret == GESTURED_ERROR_NONE) { - LOGD("method_call successful, method_name : %s", method_name); -#if 0 - if (reply_body != NULL) { - gchar *printmsg = g_variant_print(reply_body, true); - LOGD("<<>> : %s", printmsg); - g_free(printmsg); + g_variant_get(parameters, "(ib)", &id, &is_supported); + ret = gestured_reply_is_support_gesture_type(id, is_supported); + } + + if (false == delay_response) { + if (ret == GESTURED_ERROR_NONE) { + LOGD("method_call successful, method_name : %s", method_name); + g_dbus_method_invocation_return_value(invocation, reply_body); + } else { + LOGE("method_call failed, method_name : %s", method_name); + g_dbus_method_invocation_return_error(invocation, G_DBUS_ERROR, ret, "gesture error"); } -#endif - g_dbus_method_invocation_return_value(invocation, reply_body); - } else { - LOGE("method_call failed, method_name : %s", method_name); - g_dbus_method_invocation_return_error(invocation, G_DBUS_ERROR, ret, "gesture error"); } if (reply_body) @@ -537,77 +551,48 @@ static const GDBusInterfaceVTable _gesture_interface_vtable = { int gestured_register_dbus_interface(void) { LOGD("gestured_register_dbus_interface"); - static gchar introspection_xml[] = - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - - " " - " " - - " " - " " - - " " - " " - " " - " " - " " - " " - " " - - " " - " " - - " " - " " - - " " - " " - - " " - " " - - " " - " " - - " " - " " - " " - " " - " " - " " - " " - - " " - " " - " " - " " - - " " - " " - " " - - " " - " " - " " - - " " - " " - " " - " " - - " " - " "; - - return gestured_server_register_dbus_interface(introspection_xml, _gesture_interface_vtable); + + FILE* xml_file = NULL; + char xml_file_path[256] = {'\0', }; + char* introspection_xml = NULL; + int size = 0; + int ret = 0; + + snprintf(xml_file_path, strlen(GESTURE_SHARED_RESOURCE_PATH) + 27, "%s/capi-ui-gesture-gdbus.xml", GESTURE_SHARED_RESOURCE_PATH); + ret = access(xml_file_path, R_OK); + if (0 != ret) { + LOGE("Introspection file is not exist. path(%s)", xml_file_path); + return GESTURED_ERROR_OPERATION_FAILED; + } + + xml_file = fopen(xml_file_path, "r"); + if (NULL == xml_file) { + LOGE("Fail to open introspection file"); + return GESTURED_ERROR_OPERATION_FAILED; + } + + fseek(xml_file, 0, SEEK_END); + size = ftell(xml_file); + rewind(xml_file); + + introspection_xml = (char*)calloc(sizeof(char), size); + if (NULL == introspection_xml) { + LOGE("Fail to allocate memory"); + return GESTURED_ERROR_OUT_OF_MEMORY; + } + + ret = fread(introspection_xml, 1, size, xml_file); + if (ret != size) { + LOGE("Error is occured reading file"); + return GESTURED_ERROR_OPERATION_FAILED; + } + + ret = gestured_server_register_dbus_interface(introspection_xml, _gesture_interface_vtable); + + fclose(xml_file); + free(introspection_xml); + + return ret; } int gestured_dbus_init(void) @@ -750,7 +735,7 @@ int gestured_client_foreach_supported_type(GVariant *parameters, GVariant **repl return ret; } -int gestured_client_is_support_gesture_type(GVariant *parameters, GVariant **reply_body, const char *sender) +int gestured_client_is_support_gesture_type(GVariant *parameters, GVariant **reply_body, const char *sender, GDBusMethodInvocation* invocation) { int ret = GESTURED_ERROR_NONE; char *cmd = GESTURE_ENGINE_SIGNAL_IS_SUPPORT_GESTURE_TYPE; @@ -760,26 +745,55 @@ int gestured_client_is_support_gesture_type(GVariant *parameters, GVariant **rep return GESTURED_ERROR_INVALID_PARAMETER; } - ret = gestured_send_dbus_message(parameters, sender, cmd, GESTURE_CLIENT_LIB_ENGINE); + int id = gestureInvocationManagerAdd(invocation); + if (0 > id) { + LOGE("Fail to store invocation"); + return GESTURED_ERROR_OPERATION_FAILED; + } + + int gesture_type = 0; + g_variant_get(parameters, "(i)", &gesture_type); + + LOGD("invocation id (%d), gesture type(%d)", id, gesture_type); + GVariant* body = g_variant_new("(ii)", id, gesture_type); + if (NULL == body) { + LOGE("Fail to create body"); + return GESTURED_ERROR_OPERATION_FAILED; + } + + ret = gestured_send_dbus_message(body, sender, cmd, GESTURE_CLIENT_LIB_ENGINE); if (ret != GESTURED_ERROR_NONE) LOGE("Failed to start to engine"); return ret; } -int gestured_client_engine_get_info(GVariant *parameters, GVariant **reply_body, const char *sender) +int gestured_client_get_engine_info(GVariant *parameters, GVariant **reply_body, const char *sender, GDBusMethodInvocation* invocation) { - LOGD("[engineInfo] gestured_client_engine_get_info : sendor [%s]", sender); + LOGD("[engineInfo] gestured_client_get_engine_info : sendor [%s]", sender); int ret = GESTURED_ERROR_NONE; - char *cmd = GESTURE_ENGINE_SIGNAL_ENGINE_GET_INFO; + char *cmd = GESTURE_ENGINE_SIGNAL_GET_ENGINE_INFO; if (parameters == NULL) { LOGE("failed to get parameters"); return GESTURED_ERROR_INVALID_PARAMETER; } - ret = gestured_send_dbus_message(parameters, sender, cmd, GESTURE_CLIENT_LIB_ENGINE); + int id = gestureInvocationManagerAdd(invocation); + if (0 > id) { + LOGE("Fail to store invocation"); + return GESTURED_ERROR_OPERATION_FAILED; + } + + LOGD("invocation ID (%d)", id); + GVariant* body = g_variant_new("(i)", id); + if (NULL == body) { + LOGE("Fail to create body"); + return GESTURED_ERROR_OPERATION_FAILED; + } + + ret = gestured_send_dbus_message(body, sender, cmd, GESTURE_CLIENT_LIB_ENGINE); if (ret != GESTURED_ERROR_NONE) LOGE("Failed to start to engine"); @@ -835,6 +849,64 @@ int gestured_engine_send_engine_get_info(GVariant *parameters, GVariant **reply_ return ret; } +int gestured_reply_is_support_gesture_type(int invocation_id, bool is_supported) +{ + GDBusMethodInvocation *invocation = gestureInvocationManagerGet(invocation_id); + if (NULL == invocation) { + LOGE("Invalid invocation ID"); + return GESTURED_ERROR_INVALID_PARAMETER; + } + gestureInvocationManagerRemove(invocation_id); + + GVariant *reply_body = g_variant_new("(b)", is_supported); + if (NULL == reply_body) { + LOGE("Fail to create reply_body"); + g_dbus_method_invocation_return_error(invocation, G_DBUS_ERROR, GESTURED_ERROR_OPERATION_FAILED, "Fail to create return value"); + return GESTURED_ERROR_OPERATION_FAILED; + } + + LOGD("Invocation ID(%d), IsSupport(%d)", invocation_id, is_supported); + + g_dbus_method_invocation_return_value(invocation, reply_body); + g_variant_unref(reply_body); + reply_body = NULL; + + return GESTURED_ERROR_NONE; +} + + +int gestured_reply_get_engine_info(int invocation_id, char* engine_app_id, char* engine_name) +{ + GDBusMethodInvocation *invocation = gestureInvocationManagerGet(invocation_id); + if (NULL == invocation) { + LOGE("Invalid invocation ID"); + return GESTURED_ERROR_INVALID_PARAMETER; + } + gestureInvocationManagerRemove(invocation_id); + + if (NULL == engine_app_id || NULL == engine_name) { + LOGE("Invalid parameter"); + g_dbus_method_invocation_return_error(invocation, G_DBUS_ERROR, GESTURED_ERROR_INVALID_PARAMETER, "Invalid parameter"); + return GESTURED_ERROR_INVALID_PARAMETER; + } + + GVariant *reply_body = g_variant_new("(ss)", engine_app_id, engine_name); + if (NULL == reply_body) { + LOGE("Fail to create reply_body"); + g_dbus_method_invocation_return_error(invocation, G_DBUS_ERROR, GESTURED_ERROR_OPERATION_FAILED, "Fail to create return value"); + return GESTURED_ERROR_OPERATION_FAILED; + } + + LOGD("Invocation ID(%d), APP ID(%s), Name(%s)", invocation_id, engine_app_id, engine_name); + + g_dbus_method_invocation_return_value(invocation, reply_body); + g_variant_unref(reply_body); + reply_body = NULL; + + return GESTURED_ERROR_NONE; +} + + static void __response_cb(app_control_h request, app_control_h reply, app_control_result_e result, void *user_data) { LOGD("app_control launch result : %d", result); diff --git a/server/gestured_dbus.h b/server/gestured_dbus.h index 03d5452..5ccda23 100644 --- a/server/gestured_dbus.h +++ b/server/gestured_dbus.h @@ -50,8 +50,8 @@ int gestured_client_start_recognition(GVariant *parameters, GVariant **reply_bod int gestured_client_stop_recognition(GVariant *parameters, GVariant **reply_body, const char *sender); int gestured_client_foreach_result_time(GVariant *parameters, GVariant **reply_body, const char *sender); int gestured_client_foreach_supported_type(GVariant *parameters, GVariant **reply_body, const char *sender); -int gestured_client_is_support_gesture_type(GVariant *parameters, GVariant **reply_body, const char *sender); -int gestured_client_engine_get_info(GVariant *parameters, GVariant **reply_body, const char *sender); +int gestured_client_is_support_gesture_type(GVariant *parameters, GVariant **reply_body, const char *sender, GDBusMethodInvocation* invocation); +int gestured_client_get_engine_info(GVariant *parameters, GVariant **reply_body, const char *sender, GDBusMethodInvocation* invocation); /* engine side function : engine -> daemon */ int gestured_engine_send_result(GVariant *parameters, GVariant **reply_body, const char *sender); @@ -59,6 +59,10 @@ int gestured_engine_send_error(GVariant *parameters, GVariant **reply_body, cons int gestured_engine_send_motion_status(GVariant *parameters, GVariant **reply_body, const char *sender); int gestured_engine_send_engine_get_info(GVariant *parameters, GVariant **reply_body, const char *sender); +/* daemon side function : daemon -> client */ +int gestured_reply_is_support_gesture_type(int invocation_id, bool is_supported); +int gestured_reply_get_engine_info(int invocation_id, char* engine_app_id, char* engine_name); + int __launch_engine_service_app(char *appid); -- 2.7.4 From 2999c59c26206da977f72713bcd9d406142893cd Mon Sep 17 00:00:00 2001 From: Sungwook Park Date: Wed, 2 Sep 2020 10:31:00 +0900 Subject: [PATCH 04/16] Update pacakge version to 1.0.0 Change-Id: I63454e0930e954c9dccd064fca31df463274dbf2 Signed-off-by: Sungwook Park --- CMakeLists.txt | 2 +- packaging/capi-ui-gesture.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5ccea7d..ab48ba4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ PROJECT(capi-ui-gesture) SET(PREFIX ${CMAKE_INSTALL_PREFIX}) SET(EXEC_PREFIX "${PREFIX}") -SET(VERSION 0.2.56) +SET(VERSION 1.0.0) ADD_DEFINITIONS("-Werror") diff --git a/packaging/capi-ui-gesture.spec b/packaging/capi-ui-gesture.spec index 7aa6b55..3602853 100644 --- a/packaging/capi-ui-gesture.spec +++ b/packaging/capi-ui-gesture.spec @@ -1,6 +1,6 @@ Name: capi-ui-gesture Summary: Gesture client library and daemon -Version: 0.0.1 +Version: 1.0.0 Release: 1 Group: Graphics & UI Framework/Input License: Apache-2.0 -- 2.7.4 From 2f4877623f987376f1ad60066f3b5a56c0dd028b Mon Sep 17 00:00:00 2001 From: Sungwook Park Date: Thu, 3 Sep 2020 13:57:24 +0900 Subject: [PATCH 05/16] Update package version to 1.0.1 Change-Id: Ie3074383982d5d8bbbc45055b368527fcd22ee81 Signed-off-by: Sungwook Park --- CMakeLists.txt | 2 +- packaging/capi-ui-gesture.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3c2503c..b901ff7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ PROJECT(capi-ui-gesture) SET(PREFIX ${CMAKE_INSTALL_PREFIX}) SET(EXEC_PREFIX "${PREFIX}") -SET(VERSION 1.0.0) +SET(VERSION 1.60.1) ADD_DEFINITIONS("-Werror") diff --git a/packaging/capi-ui-gesture.spec b/packaging/capi-ui-gesture.spec index e02b581..0ce80e3 100644 --- a/packaging/capi-ui-gesture.spec +++ b/packaging/capi-ui-gesture.spec @@ -1,6 +1,6 @@ Name: capi-ui-gesture Summary: Gesture client library and daemon -Version: 1.0.0 +Version: 1.60.1 Release: 1 Group: Graphics & UI Framework/Input License: Apache-2.0 -- 2.7.4 From 6cb0b897cdc7d62c6a7157497250268cd15e4fe4 Mon Sep 17 00:00:00 2001 From: "wn.jang" Date: Tue, 15 Sep 2020 10:25:47 +0900 Subject: [PATCH 06/16] Fix defects detected by static analysis tool Change-Id: Ieac1cab7fc72b545d78792425166dc03e5cba4d4 --- server/gestured_dbus.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/server/gestured_dbus.c b/server/gestured_dbus.c index 0673c4d..86026d0 100644 --- a/server/gestured_dbus.c +++ b/server/gestured_dbus.c @@ -578,12 +578,15 @@ int gestured_register_dbus_interface(void) introspection_xml = (char*)calloc(sizeof(char), size); if (NULL == introspection_xml) { LOGE("Fail to allocate memory"); + fclose(xml_file); return GESTURED_ERROR_OUT_OF_MEMORY; } ret = fread(introspection_xml, 1, size, xml_file); if (ret != size) { LOGE("Error is occured reading file"); + fclose(xml_file); + free(introspection_xml); return GESTURED_ERROR_OPERATION_FAILED; } -- 2.7.4 From 02da4169f431b734461fa8ecff4d4dc061b7d16e Mon Sep 17 00:00:00 2001 From: "wn.jang" Date: Tue, 15 Sep 2020 10:47:00 +0900 Subject: [PATCH 07/16] Change length of copy when snprintf is called Change-Id: I3e91edaa02d236bcd0234e65f0bb63477298a95f --- server/gestured_dbus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/gestured_dbus.c b/server/gestured_dbus.c index 86026d0..f33ef15 100644 --- a/server/gestured_dbus.c +++ b/server/gestured_dbus.c @@ -558,7 +558,7 @@ int gestured_register_dbus_interface(void) int size = 0; int ret = 0; - snprintf(xml_file_path, strlen(GESTURE_SHARED_RESOURCE_PATH) + 27, "%s/capi-ui-gesture-gdbus.xml", GESTURE_SHARED_RESOURCE_PATH); + snprintf(xml_file_path, 256, "%s/capi-ui-gesture-gdbus.xml", GESTURE_SHARED_RESOURCE_PATH); ret = access(xml_file_path, R_OK); if (0 != ret) { LOGE("Introspection file is not exist. path(%s)", xml_file_path); -- 2.7.4 From 69c6c3ae08e22c711998c73f005b4c0b9539367c Mon Sep 17 00:00:00 2001 From: "sooyeon.kim" Date: Fri, 21 May 2021 14:36:48 +0900 Subject: [PATCH 08/16] Fix coverity issue * Remove unnecessary null checkers * Add a checker of the integer range Change-Id: Ide9a5b13762a4da296f6b87e33bdbc76ccc8d857 Signed-off-by: sooyeon.kim --- client/gesture.c | 4 ---- server/gestured_dbus.c | 5 +++++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/client/gesture.c b/client/gesture.c index abed09d..236dfcc 100644 --- a/client/gesture.c +++ b/client/gesture.c @@ -129,8 +129,6 @@ EXPORT_API int hand_gesture_create(hand_gesture_h *handle) ASSERT_NOT_NULL(handle); int ret; - if (!handle) - return HAND_GESTURE_ERROR_INVALID_PARAMETER; if (_gesture_check_privilege() != HAND_GESTURE_ERROR_NONE) return HAND_GESTURE_ERROR_PERMISSION_DENIED; @@ -177,8 +175,6 @@ EXPORT_API int hand_gesture_destroy(hand_gesture_h handle) ASSERT_NOT_NULL(handle); int ret; - if (!handle) - return HAND_GESTURE_ERROR_INVALID_PARAMETER; LOGD("handle : %p", handle); ret = gesture_client_dbus_shutdown(handle->gdbus_connection, &handle->server_monitor_id, &handle->monitor_id); diff --git a/server/gestured_dbus.c b/server/gestured_dbus.c index f33ef15..10f5922 100644 --- a/server/gestured_dbus.c +++ b/server/gestured_dbus.c @@ -573,6 +573,11 @@ int gestured_register_dbus_interface(void) fseek(xml_file, 0, SEEK_END); size = ftell(xml_file); + if (0 >= size) { + LOGE("Fail to get xml file"); + fclose(xml_file); + return GESTURED_ERROR_OPERATION_FAILED; + } rewind(xml_file); introspection_xml = (char*)calloc(sizeof(char), size); -- 2.7.4 From 988a55d4a32fe3d716ced12632472a2c1fda725f Mon Sep 17 00:00:00 2001 From: Suyeon Hwang Date: Fri, 21 May 2021 15:58:25 +0900 Subject: [PATCH 09/16] Remove memory allocation code for unused memory Change-Id: I60260283272a1472bbc41da36e172d6f71b57b49 Signed-off-by: Suyeon Hwang --- client/gesture.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/client/gesture.c b/client/gesture.c index abed09d..fa58fc0 100644 --- a/client/gesture.c +++ b/client/gesture.c @@ -306,12 +306,13 @@ EXPORT_API int hand_gesture_start_recognition(hand_gesture_h handle, hand_gestur handle->recog_cb = callback; handle->recog_user_data = user_data; - hand_gesture_data_h gesture_data = (hand_gesture_data_h)calloc(1, sizeof(struct hand_gesture_data_s)); - if (!gesture_data) { - return HAND_GESTURE_ERROR_OUT_OF_MEMORY; - } + // TODO: analysis the purpose of this data. + // hand_gesture_data_h gesture_data = (hand_gesture_data_h)calloc(1, sizeof(struct hand_gesture_data_s)); + // if (!gesture_data) { + // return HAND_GESTURE_ERROR_OUT_OF_MEMORY; + // } - ret = gesture_client_dbus_start_recognition(handle->gdbus_connection, gesture_type, gesture_data, callback); + ret = gesture_client_dbus_start_recognition(handle->gdbus_connection, gesture_type, NULL, callback); if (ret != HAND_GESTURE_ERROR_NONE) { LOGE("Failed to start recoginition : %d", ret); return HAND_GESTURE_ERROR_OPERATION_FAILED; -- 2.7.4 From afb1d80a1d439e8a43651fd4b985fed6ef2074f2 Mon Sep 17 00:00:00 2001 From: sooyeon Date: Thu, 8 Jul 2021 17:50:32 +0900 Subject: [PATCH 10/16] Move header into proper file Change-Id: I1bc2ba700c2c515d16762fcaa14dc69315fe50b0 Signed-off-by: sooyeon --- client/gesture.c | 1 + include/gesture_common.h | 1 - include/gesture_common_internal.h | 1 - 3 files changed, 1 insertion(+), 2 deletions(-) diff --git a/client/gesture.c b/client/gesture.c index 0e4a1b0..c7f177f 100644 --- a/client/gesture.c +++ b/client/gesture.c @@ -27,6 +27,7 @@ #include "gesture_common_internal.h" #include "gesture_main.h" #include "gesture_client_dbus.h" +#include "gesture_data_info.h" #ifdef LOG_TAG diff --git a/include/gesture_common.h b/include/gesture_common.h index a8954c6..a909343 100644 --- a/include/gesture_common.h +++ b/include/gesture_common.h @@ -18,7 +18,6 @@ #define __TIZEN_UIX_GESTURE_COMMON_H__ #include -#include #ifdef __cplusplus extern "C" { diff --git a/include/gesture_common_internal.h b/include/gesture_common_internal.h index 6b42c07..992010f 100644 --- a/include/gesture_common_internal.h +++ b/include/gesture_common_internal.h @@ -18,7 +18,6 @@ #define __TIZEN_UIX_GESTURE_COMMON_INTERNAL_H__ #include -#include #ifdef __cplusplus extern "C" { -- 2.7.4 From 59f62cb39bf53e5e91ed76638730fd83c80b8f71 Mon Sep 17 00:00:00 2001 From: sooyeon Date: Wed, 15 Dec 2021 21:17:26 +0900 Subject: [PATCH 11/16] Move glib header outside extern C Change-Id: Idc43c5455c6925a0816975ecb56e56854a43b5df Signed-off-by: sooyeon --- manager/gestured_client_manager.h | 6 +++--- manager/gestured_engine_manager.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/manager/gestured_client_manager.h b/manager/gestured_client_manager.h index 66b6b14..35b7ce9 100644 --- a/manager/gestured_client_manager.h +++ b/manager/gestured_client_manager.h @@ -2,14 +2,14 @@ #define __GESTURED_CLIENT_MANAGER_H__ +#include +#include +#include #ifdef __cplusplus extern "C" { #endif -#include -#include -#include #include "gesture.h" #include "gesture_defs.h" #include "gestured_error.h" diff --git a/manager/gestured_engine_manager.h b/manager/gestured_engine_manager.h index e6cc51b..fb4373d 100644 --- a/manager/gestured_engine_manager.h +++ b/manager/gestured_engine_manager.h @@ -2,13 +2,13 @@ #define __GESTURED_ENGINE_MANAGER_H__ +#include +#include #ifdef __cplusplus extern "C" { #endif -#include -#include #include "gesture_engine.h" #include "gesture_defs.h" #include "gestured_error.h" -- 2.7.4 From ce4359d17bae73b2e71e35971b863ab6947bef3b Mon Sep 17 00:00:00 2001 From: sooyeon Date: Tue, 18 Jan 2022 04:01:48 +0900 Subject: [PATCH 12/16] Fix coverity issue to check whether the file is exist or not Change-Id: I50244a3c23a3272298cde3bcb7497f793df7a81e Signed-off-by: sooyeon --- engine/gesture_engine_dbus.c | 6 +++--- server/gestured_dbus.c | 8 +------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/engine/gesture_engine_dbus.c b/engine/gesture_engine_dbus.c index a0ec977..b22bcad 100644 --- a/engine/gesture_engine_dbus.c +++ b/engine/gesture_engine_dbus.c @@ -574,9 +574,9 @@ int gesture_engine_dbus_send_error(GDBusConnection *gdbus_connection, gesture_e ret = gdbus_send_message_with_sync(gdbus_connection, body, &reply, GESTURE_ENGINE_MSG_SEND_ERROR); if (ret == GESTURE_ENGINE_ERROR_NONE) { - gchar *msg = g_dbus_message_print (reply, 1); - LOGD("Reply msg print : %s", msg); - g_free(msg); + gchar *tmsg = g_dbus_message_print (reply, 1); + LOGD("Reply msg print : %s", tmsg); + g_free(tmsg); } if (body) diff --git a/server/gestured_dbus.c b/server/gestured_dbus.c index 10f5922..391653e 100644 --- a/server/gestured_dbus.c +++ b/server/gestured_dbus.c @@ -559,15 +559,9 @@ int gestured_register_dbus_interface(void) int ret = 0; snprintf(xml_file_path, 256, "%s/capi-ui-gesture-gdbus.xml", GESTURE_SHARED_RESOURCE_PATH); - ret = access(xml_file_path, R_OK); - if (0 != ret) { - LOGE("Introspection file is not exist. path(%s)", xml_file_path); - return GESTURED_ERROR_OPERATION_FAILED; - } - xml_file = fopen(xml_file_path, "r"); if (NULL == xml_file) { - LOGE("Fail to open introspection file"); + LOGE("Fail to open introspection file. path(%s)", xml_file_path); return GESTURED_ERROR_OPERATION_FAILED; } -- 2.7.4 From cc555933870b02a8e0089cf3b424364184656adc Mon Sep 17 00:00:00 2001 From: "sungwook79.park" Date: Thu, 10 Aug 2023 15:27:33 +0900 Subject: [PATCH 13/16] Add TIZEN_DEPRECATED_API macro Change-Id: Ibc63085b38c07f2275494d97ff9009b7ad305e0d Signed-off-by: sungwook79.park --- doc/uix_gesture_doc.h | 2 +- include/gesture.h | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/doc/uix_gesture_doc.h b/doc/uix_gesture_doc.h index 54a528e..55c60b8 100644 --- a/doc/uix_gesture_doc.h +++ b/doc/uix_gesture_doc.h @@ -21,7 +21,7 @@ /** * @ingroup CAPI_UIX_FRAMEWORK - * @defgroup CAPI_UIX_GESTURE_MODULE Gesture + * @defgroup CAPI_UIX_GESTURE_MODULE Gesture (Deprecated) * @brief The @ref CAPI_UIX_GESTURE_MODULE API provides functions for recognizing hand gestures from input sensor data. * @section CAPI_UIX_GESTURE_MODULE_HEADER Required Header * \#include diff --git a/include/gesture.h b/include/gesture.h index 1171bd0..6065720 100644 --- a/include/gesture.h +++ b/include/gesture.h @@ -62,7 +62,7 @@ typedef struct hand_gesture_s *hand_gesture_h; * * @see hand_gesture_start_recognition() */ -typedef void(* hand_gesture_recognition_cb)(hand_gesture_h handle, hand_gesture_type_e gesture, double timestamp, hand_gesture_error_e error, void *user_data); +typedef void(* hand_gesture_recognition_cb)(hand_gesture_h handle, hand_gesture_type_e gesture, double timestamp, hand_gesture_error_e error, void *user_data) TIZEN_DEPRECATED_API; /** * @brief Called when an error is occurred. @@ -89,7 +89,7 @@ typedef void(* hand_gesture_recognition_cb)(hand_gesture_h handle, hand_gesture_ * @see hand_gesture_set_error_cb() * @see hand_gesture_unset_error_cb() */ -typedef void(* hand_gesture_error_cb)(hand_gesture_h handle, hand_gesture_error_e error, const char* msg, void *user_data); +typedef void(* hand_gesture_error_cb)(hand_gesture_h handle, hand_gesture_error_e error, const char* msg, void *user_data) TIZEN_DEPRECATED_API; /** * @brief Checks whether a gesture is supported or not. @@ -108,7 +108,7 @@ typedef void(* hand_gesture_error_cb)(hand_gesture_h handle, hand_gesture_error_ * @retval #HAND_GESTURE_ERROR_INVALID_PARAMETER Invalid parameter used * @retval #HAND_GESTURE_ERROR_OPERATION_FAILED Operation failed because of a system error */ -int hand_gesture_is_supported_type(hand_gesture_h handle, hand_gesture_type_e gesture, bool* supported); +int hand_gesture_is_supported_type(hand_gesture_h handle, hand_gesture_type_e gesture, bool* supported) TIZEN_DEPRECATED_API; /** * @brief Creates a gesture handle. @@ -130,7 +130,7 @@ int hand_gesture_is_supported_type(hand_gesture_h handle, hand_gesture_type_e ge * * @see hand_gesture_destroy() */ -int hand_gesture_create(hand_gesture_h *handle); +int hand_gesture_create(hand_gesture_h *handle) TIZEN_DEPRECATED_API; /** * @brief Destroys a gesture handle. @@ -147,7 +147,7 @@ int hand_gesture_create(hand_gesture_h *handle); * * @see hand_gesture_create() */ -int hand_gesture_destroy(hand_gesture_h handle); +int hand_gesture_destroy(hand_gesture_h handle) TIZEN_DEPRECATED_API; /** * @brief Sets an option for gesture recognition. @@ -167,7 +167,7 @@ int hand_gesture_destroy(hand_gesture_h handle); * * @see hand_gesture_start_recognition() */ -int hand_gesture_set_option(hand_gesture_h handle, hand_gesture_option_e option); +int hand_gesture_set_option(hand_gesture_h handle, hand_gesture_option_e option) TIZEN_DEPRECATED_API; /** * @brief Starts to recognize a gesture. @@ -196,7 +196,7 @@ int hand_gesture_set_option(hand_gesture_h handle, hand_gesture_option_e option) * @post hand_gesture_recognition_cb() * @see hand_gesture_stop_recognition() */ -int hand_gesture_start_recognition(hand_gesture_h handle, hand_gesture_type_e gesture, hand_gesture_recognition_cb callback, void *user_data); +int hand_gesture_start_recognition(hand_gesture_h handle, hand_gesture_type_e gesture, hand_gesture_recognition_cb callback, void *user_data) TIZEN_DEPRECATED_API; /** * @brief Stops recognizing the gesture registered to the gesture handle. @@ -212,7 +212,7 @@ int hand_gesture_start_recognition(hand_gesture_h handle, hand_gesture_type_e ge * @retval #HAND_GESTURE_ERROR_NOT_STARTED Nothing is started using the @c handle * @retval #HAND_GESTURE_ERROR_OPERATION_FAILED Operation failed because of a system error */ -int hand_gesture_stop_recognition(hand_gesture_h handle); +int hand_gesture_stop_recognition(hand_gesture_h handle) TIZEN_DEPRECATED_API; /** * @brief Gets a gesture engine information. @@ -230,7 +230,7 @@ int hand_gesture_stop_recognition(hand_gesture_h handle); * @retval #HAND_GESTURE_ERROR_INVALID_PARAMETER Invalid parameter used * @retval #HAND_GESTURE_ERROR_OPERATION_FAILED Operation failed because of a system error */ -int hand_gesture_get_engine_info(hand_gesture_h handle, char** engine_app_id, char** engine_name); +int hand_gesture_get_engine_info(hand_gesture_h handle, char** engine_app_id, char** engine_name) TIZEN_DEPRECATED_API; /** * @brief Sets a callback function to be invoked when an error is occurred. @@ -250,7 +250,7 @@ int hand_gesture_get_engine_info(hand_gesture_h handle, char** engine_app_id, ch * @see hand_gesture_error_cb() * @see hand_gesture_unset_error_cb() */ -int hand_gesture_set_error_cb(hand_gesture_h handle, hand_gesture_error_cb callback, void *user_data); +int hand_gesture_set_error_cb(hand_gesture_h handle, hand_gesture_error_cb callback, void *user_data) TIZEN_DEPRECATED_API; /** * @brief Unsets a callback function to be invoked when an error is occurred. @@ -267,7 +267,7 @@ int hand_gesture_set_error_cb(hand_gesture_h handle, hand_gesture_error_cb callb * * @see hand_gesture_set_error_cb() */ -int hand_gesture_unset_error_cb(hand_gesture_h handle); +int hand_gesture_unset_error_cb(hand_gesture_h handle) TIZEN_DEPRECATED_API; /** -- 2.7.4 From 9b66961931172f8eb636cae33a545cbecef6d956 Mon Sep 17 00:00:00 2001 From: "sungwook79.park" Date: Thu, 10 Aug 2023 16:39:24 +0900 Subject: [PATCH 14/16] Add warning log to deprecated API Change-Id: Ib5c835ac89ccceff0674b9debf904a903633f44e Signed-off-by: sungwook79.park --- client/gesture.c | 13 +++++++++++++ include/gesture.h | 12 ++++++++++++ include/gesture_common.h | 4 ++++ 3 files changed, 29 insertions(+) diff --git a/client/gesture.c b/client/gesture.c index c7f177f..951e5b8 100644 --- a/client/gesture.c +++ b/client/gesture.c @@ -124,6 +124,7 @@ static int _gesture_check_privilege() EXPORT_API int hand_gesture_create(hand_gesture_h *handle) { + LOGW("DEPRECATION WARNING: hand_gesture_create() is deprecated and will be removed from next release."); LOGD("hand_gesture_create"); CHECK_GESTURE_FEATURE(); @@ -170,6 +171,7 @@ EXPORT_API int hand_gesture_create(hand_gesture_h *handle) EXPORT_API int hand_gesture_destroy(hand_gesture_h handle) { + LOGW("DEPRECATION WARNING: hand_gesture_destroy() is deprecated and will be removed from next release."); LOGD("hand_gesture_destroy"); CHECK_GESTURE_FEATURE(); @@ -195,6 +197,7 @@ EXPORT_API int hand_gesture_destroy(hand_gesture_h handle) EXPORT_API int hand_gesture_is_supported_type(hand_gesture_h handle, hand_gesture_type_e gesture, bool* supported) { + LOGW("DEPRECATION WARNING: hand_gesture_is_supported_type() is deprecated and will be removed from next release."); LOGD("hand_gesture_is_supported_type"); CHECK_GESTURE_FEATURE(); @@ -214,6 +217,7 @@ EXPORT_API int hand_gesture_is_supported_type(hand_gesture_h handle, hand_gestur //LCOV_EXCL_START EXPORT_API int hand_gesture_set_handtype(hand_gesture_h handle, hand_gesture_handtype_e hand_type) { + LOGW("DEPRECATION WARNING: hand_gesture_set_handtype() is deprecated and will be removed from next release."); LOGD("hand_gesture_set_handtype"); CHECK_GESTURE_FEATURE(); @@ -232,6 +236,7 @@ EXPORT_API int hand_gesture_set_handtype(hand_gesture_h handle, hand_gesture_han EXPORT_API int hand_gesture_set_workmode(hand_gesture_h handle, hand_gesture_workmode_e work_mode) { + LOGW("DEPRECATION WARNING: hand_gesture_set_workmode() is deprecated and will be removed from next release."); LOGD("hand_gesture_set_workmode"); CHECK_GESTURE_FEATURE(); @@ -250,6 +255,7 @@ EXPORT_API int hand_gesture_set_workmode(hand_gesture_h handle, hand_gesture_wor //LCOV_EXCL_STOP EXPORT_API int hand_gesture_set_option(hand_gesture_h handle, hand_gesture_option_e option) { + LOGW("DEPRECATION WARNING: hand_gesture_set_option() is deprecated and will be removed from next release."); LOGD("hand_gesture_set_option"); CHECK_GESTURE_FEATURE(); @@ -268,6 +274,7 @@ EXPORT_API int hand_gesture_set_option(hand_gesture_h handle, hand_gesture_optio //LCOV_EXCL_START EXPORT_API int hand_gesture_set_sensitivity(hand_gesture_h handle, int sensitivity) { + LOGW("DEPRECATION WARNING: hand_gesture_set_sensitivity() is deprecated and will be removed from next release."); LOGD("hand_gesture_set_sensitivity"); CHECK_GESTURE_FEATURE(); @@ -286,6 +293,7 @@ EXPORT_API int hand_gesture_set_sensitivity(hand_gesture_h handle, int sensitivi //LCOV_EXCL_STOP EXPORT_API int hand_gesture_start_recognition(hand_gesture_h handle, hand_gesture_type_e gesture_type, hand_gesture_recognition_cb callback, void *user_data) { + LOGW("DEPRECATION WARNING: hand_gesture_start_recognition() is deprecated and will be removed from next release."); LOGD("hand_gesture_start_recognition"); CHECK_GESTURE_FEATURE(); @@ -320,6 +328,7 @@ EXPORT_API int hand_gesture_start_recognition(hand_gesture_h handle, hand_gestur EXPORT_API int hand_gesture_stop_recognition(hand_gesture_h handle) { + LOGW("DEPRECATION WARNING: hand_gesture_stop_recognition() is deprecated and will be removed from next release."); CHECK_GESTURE_FEATURE(); ASSERT_NOT_NULL(handle); @@ -340,6 +349,7 @@ EXPORT_API int hand_gesture_stop_recognition(hand_gesture_h handle) //LCOV_EXCL_START EXPORT_API int hand_gesture_get_event(const hand_gesture_data_h data, hand_gesture_event_e *event) { + LOGW("DEPRECATION WARNING: hand_gesture_get_event() is deprecated and will be removed from next release."); CHECK_GESTURE_FEATURE(); ASSERT_NOT_NULL(data); ASSERT_NOT_NULL(event); @@ -351,6 +361,7 @@ EXPORT_API int hand_gesture_get_event(const hand_gesture_data_h data, hand_gestu //LCOV_EXCL_STOP EXPORT_API int hand_gesture_get_engine_info(hand_gesture_h handle, char** engine_app_id, char** engine_name) { + LOGW("DEPRECATION WARNING: hand_gesture_get_engine_info() is deprecated and will be removed from next release."); LOGD("[engineInfo] hand_gesture_get_engine_info"); CHECK_GESTURE_FEATURE(); @@ -369,6 +380,7 @@ EXPORT_API int hand_gesture_get_engine_info(hand_gesture_h handle, char** engine EXPORT_API int hand_gesture_set_error_cb(hand_gesture_h handle, hand_gesture_error_cb callback, void *user_data) { + LOGW("DEPRECATION WARNING: hand_gesture_set_error_cb() is deprecated and will be removed from next release."); CHECK_GESTURE_FEATURE(); ASSERT_NOT_NULL(handle); @@ -387,6 +399,7 @@ EXPORT_API int hand_gesture_set_error_cb(hand_gesture_h handle, hand_gesture_err EXPORT_API int hand_gesture_unset_error_cb(hand_gesture_h handle) { + LOGW("DEPRECATION WARNING: hand_gesture_unset_error_cb() is deprecated and will be removed from next release."); CHECK_GESTURE_FEATURE(); ASSERT_NOT_NULL(handle); diff --git a/include/gesture.h b/include/gesture.h index 6065720..cfa0720 100644 --- a/include/gesture.h +++ b/include/gesture.h @@ -34,12 +34,14 @@ extern "C" { */ /** + * @deprecated Deprecated since 8.0. * @brief The hand gesture handle. * @since_tizen @if WEARABLE 6.0 @endif */ typedef struct hand_gesture_s *hand_gesture_h; /** + * @deprecated Deprecated since 8.0. * @brief Called when a gesture is detected. * @details Following error codes can be delivered: \n * #HAND_GESTURE_ERROR_NONE, \n @@ -65,6 +67,7 @@ typedef struct hand_gesture_s *hand_gesture_h; typedef void(* hand_gesture_recognition_cb)(hand_gesture_h handle, hand_gesture_type_e gesture, double timestamp, hand_gesture_error_e error, void *user_data) TIZEN_DEPRECATED_API; /** + * @deprecated Deprecated since 8.0. * @brief Called when an error is occurred. * @details Following error codes can be delivered: \n * #HAND_GESTURE_ERROR_INVALID_PARAMETER, \n @@ -92,6 +95,7 @@ typedef void(* hand_gesture_recognition_cb)(hand_gesture_h handle, hand_gesture_ typedef void(* hand_gesture_error_cb)(hand_gesture_h handle, hand_gesture_error_e error, const char* msg, void *user_data) TIZEN_DEPRECATED_API; /** + * @deprecated Deprecated since 8.0. * @brief Checks whether a gesture is supported or not. * @details Check if the given gesture type is supported on the device. * @@ -111,6 +115,7 @@ typedef void(* hand_gesture_error_cb)(hand_gesture_h handle, hand_gesture_error_ int hand_gesture_is_supported_type(hand_gesture_h handle, hand_gesture_type_e gesture, bool* supported) TIZEN_DEPRECATED_API; /** + * @deprecated Deprecated since 8.0. * @brief Creates a gesture handle. * * @since_tizen @if WEARABLE 6.0 @endif @@ -133,6 +138,7 @@ int hand_gesture_is_supported_type(hand_gesture_h handle, hand_gesture_type_e ge int hand_gesture_create(hand_gesture_h *handle) TIZEN_DEPRECATED_API; /** + * @deprecated Deprecated since 8.0. * @brief Destroys a gesture handle. * * @since_tizen @if WEARABLE 6.0 @endif @@ -150,6 +156,7 @@ int hand_gesture_create(hand_gesture_h *handle) TIZEN_DEPRECATED_API; int hand_gesture_destroy(hand_gesture_h handle) TIZEN_DEPRECATED_API; /** + * @deprecated Deprecated since 8.0. * @brief Sets an option for gesture recognition. * * @since_tizen @if WEARABLE 6.0 @endif @@ -170,6 +177,7 @@ int hand_gesture_destroy(hand_gesture_h handle) TIZEN_DEPRECATED_API; int hand_gesture_set_option(hand_gesture_h handle, hand_gesture_option_e option) TIZEN_DEPRECATED_API; /** + * @deprecated Deprecated since 8.0. * @brief Starts to recognize a gesture. * @details Sets a callback function to be invoked when the gesture is detected, and starts to monitor occurrences of the gesture. * @@ -199,6 +207,7 @@ int hand_gesture_set_option(hand_gesture_h handle, hand_gesture_option_e option) int hand_gesture_start_recognition(hand_gesture_h handle, hand_gesture_type_e gesture, hand_gesture_recognition_cb callback, void *user_data) TIZEN_DEPRECATED_API; /** + * @deprecated Deprecated since 8.0. * @brief Stops recognizing the gesture registered to the gesture handle. * * @since_tizen @if WEARABLE 6.0 @endif @@ -215,6 +224,7 @@ int hand_gesture_start_recognition(hand_gesture_h handle, hand_gesture_type_e ge int hand_gesture_stop_recognition(hand_gesture_h handle) TIZEN_DEPRECATED_API; /** + * @deprecated Deprecated since 8.0. * @brief Gets a gesture engine information. * * @since_tizen @if WEARABLE 6.0 @endif @@ -233,6 +243,7 @@ int hand_gesture_stop_recognition(hand_gesture_h handle) TIZEN_DEPRECATED_API; int hand_gesture_get_engine_info(hand_gesture_h handle, char** engine_app_id, char** engine_name) TIZEN_DEPRECATED_API; /** + * @deprecated Deprecated since 8.0. * @brief Sets a callback function to be invoked when an error is occurred. * * @since_tizen @if WEARABLE 6.0 @endif @@ -253,6 +264,7 @@ int hand_gesture_get_engine_info(hand_gesture_h handle, char** engine_app_id, ch int hand_gesture_set_error_cb(hand_gesture_h handle, hand_gesture_error_cb callback, void *user_data) TIZEN_DEPRECATED_API; /** + * @deprecated Deprecated since 8.0. * @brief Unsets a callback function to be invoked when an error is occurred. * * @since_tizen @if WEARABLE 6.0 @endif diff --git a/include/gesture_common.h b/include/gesture_common.h index a909343..3ef2b06 100644 --- a/include/gesture_common.h +++ b/include/gesture_common.h @@ -38,12 +38,14 @@ extern "C" { */ /** + * @deprecated Deprecated since 8.0. * @brief Delivery through hand_gesture_recognition_cb() of gesture data handle. * @since_tizen @if WEARABLE 6.0 @endif */ typedef struct hand_gesture_data_s* hand_gesture_data_h; /** + * @deprecated Deprecated since 8.0. * @brief Enumerations for hand gesture function error. * * @since_tizen @if WEARABLE 6.0 @endif @@ -61,6 +63,7 @@ typedef enum { } hand_gesture_error_e; /** + * @deprecated Deprecated since 8.0. * @brief Enumerations for hand gesture types. * @since_tizen @if WEARABLE 6.0 @endif */ @@ -70,6 +73,7 @@ typedef enum { } hand_gesture_type_e; /** + * @deprecated Deprecated since 8.0. * @brief Enumerations for gesture recognition option. * @details If the default option is used, the system tries to reduce power consumption. * For example, the recognition engine may stop detecting gestures if the display is turned off. -- 2.7.4 From b801b5bea9171450ed727f864801a1c6033ffeed Mon Sep 17 00:00:00 2001 From: "sungwook79.park" Date: Thu, 10 Aug 2023 18:28:35 +0900 Subject: [PATCH 15/16] Remove deprecated macro in callback function Change-Id: Ibdf1a1b4bb1c8018e25d871ebb911b5b6701c465 Signed-off-by: sungwook79.park --- include/gesture.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/gesture.h b/include/gesture.h index cfa0720..910f45f 100644 --- a/include/gesture.h +++ b/include/gesture.h @@ -64,7 +64,7 @@ typedef struct hand_gesture_s *hand_gesture_h; * * @see hand_gesture_start_recognition() */ -typedef void(* hand_gesture_recognition_cb)(hand_gesture_h handle, hand_gesture_type_e gesture, double timestamp, hand_gesture_error_e error, void *user_data) TIZEN_DEPRECATED_API; +typedef void(* hand_gesture_recognition_cb)(hand_gesture_h handle, hand_gesture_type_e gesture, double timestamp, hand_gesture_error_e error, void *user_data); /** * @deprecated Deprecated since 8.0. @@ -92,7 +92,7 @@ typedef void(* hand_gesture_recognition_cb)(hand_gesture_h handle, hand_gesture_ * @see hand_gesture_set_error_cb() * @see hand_gesture_unset_error_cb() */ -typedef void(* hand_gesture_error_cb)(hand_gesture_h handle, hand_gesture_error_e error, const char* msg, void *user_data) TIZEN_DEPRECATED_API; +typedef void(* hand_gesture_error_cb)(hand_gesture_h handle, hand_gesture_error_e error, const char* msg, void *user_data); /** * @deprecated Deprecated since 8.0. -- 2.7.4 From 2b6340e8214aef9d29ea375c8c799543b0468057 Mon Sep 17 00:00:00 2001 From: sooyeon Date: Tue, 12 Mar 2024 18:05:48 +0900 Subject: [PATCH 16/16] Fix gcov QB build error and Update version (1.60.2) Change-Id: Ia2e6979a35fedcc955a4a8cc456d81b40ccbb7da Signed-off-by: sooyeon --- packaging/capi-ui-gesture.spec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packaging/capi-ui-gesture.spec b/packaging/capi-ui-gesture.spec index 0ce80e3..0f5821d 100644 --- a/packaging/capi-ui-gesture.spec +++ b/packaging/capi-ui-gesture.spec @@ -1,6 +1,6 @@ Name: capi-ui-gesture Summary: Gesture client library and daemon -Version: 1.60.1 +Version: 1.60.2 Release: 1 Group: Graphics & UI Framework/Input License: Apache-2.0 @@ -97,7 +97,7 @@ install -m 0644 gcov-obj/* %{buildroot}%{_datadir}/gcov/obj %endif #%if 0%{?gcov:1} -#lcov -c --ignore-errors graph --no-external -q -d . -o gcov.info +#lcov -c --ignore-errors mismatch,graph,unused --no-external -q -d . -o gcov.info #genhtml gcov.info #%endif -- 2.7.4