From 3e9082d24a1377292cb19093bff6c36e307bc2bd Mon Sep 17 00:00:00 2001 From: InHong Han Date: Mon, 15 Jun 2020 18:42:19 +0900 Subject: [PATCH 01/16] Update package version to 0.1.56 Change-Id: I22a450053bb46a8727472648d9c1e173551fe8d7 --- packaging/capi-ui-sticker.spec | 2 +- receiver/tizen-manifest.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packaging/capi-ui-sticker.spec b/packaging/capi-ui-sticker.spec index 264efe8..48fdec4 100644 --- a/packaging/capi-ui-sticker.spec +++ b/packaging/capi-ui-sticker.spec @@ -1,6 +1,6 @@ Name: capi-ui-sticker Summary: Sticker client library and daemon -Version: 0.1.55 +Version: 0.1.56 Release: 1 Group: Graphics & UI Framework/Input License: Apache-2.0 diff --git a/receiver/tizen-manifest.xml b/receiver/tizen-manifest.xml index 9814958..2a9aff2 100644 --- a/receiver/tizen-manifest.xml +++ b/receiver/tizen-manifest.xml @@ -1,5 +1,5 @@ - + -- 2.7.4 From 61f808e82820973e5bf8e9b31c46a513ce0343ca Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Fri, 26 Jun 2020 11:43:16 +0900 Subject: [PATCH 02/16] Keep the directory structure in gcov package Change-Id: If9310998850d1e548256441b7021328459810074 Signed-off-by: Jihoon Kim --- packaging/capi-ui-sticker.spec | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/packaging/capi-ui-sticker.spec b/packaging/capi-ui-sticker.spec index 48fdec4..efdabd0 100644 --- a/packaging/capi-ui-sticker.spec +++ b/packaging/capi-ui-sticker.spec @@ -106,8 +106,7 @@ export FFLAGS+=" -DTIZEN_DEBUG_ENABLE -fvisibility=hidden" make %{?jobs:-j%jobs} %if 0%{?gcov:1} -mkdir -p gcov-obj -find . -name '*.gcno' -exec cp '{}' gcov-obj ';' +find . -name '*.gcno' | tar cf %{name}-gcov.tar -T - %endif %install @@ -127,8 +126,8 @@ mkdir -p %{buildroot}%{_sysconfdir}/dbus-1/system.d install -m 0644 %SOURCE3 %{buildroot}%{_sysconfdir}/dbus-1/system.d/capi-ui-sticker.conf %if 0%{?gcov:1} -mkdir -p %{buildroot}%{_datadir}/gcov/obj -install -m 0644 gcov-obj/* %{buildroot}%{_datadir}/gcov/obj +install -d -m 755 %{buildroot}%{_datadir}/gcov/obj +tar xf %{name}-gcov.tar -C %{buildroot}%{_datadir}/gcov/obj %endif %if 0%{?sec_product_feature_profile_wearable} @@ -186,5 +185,5 @@ chsmack -a "User::App::Shared" /opt/usr/share/sticker-data %if 0%{?gcov:1} %files gcov -%{_datadir}/gcov/obj/* +%{_datadir}/gcov/* %endif -- 2.7.4 From 969d5b0994a4cfda9d65dfd6ad17316eac7fdc80 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Fri, 26 Jun 2020 19:18:12 +0900 Subject: [PATCH 03/16] Update package version to 0.1.57 Change-Id: I7bf42355224305e609004bfeb04ae48fef71b8a6 Signed-off-by: Jihoon Kim --- packaging/capi-ui-sticker.spec | 2 +- receiver/tizen-manifest.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packaging/capi-ui-sticker.spec b/packaging/capi-ui-sticker.spec index efdabd0..52c61fa 100644 --- a/packaging/capi-ui-sticker.spec +++ b/packaging/capi-ui-sticker.spec @@ -1,6 +1,6 @@ Name: capi-ui-sticker Summary: Sticker client library and daemon -Version: 0.1.56 +Version: 0.1.57 Release: 1 Group: Graphics & UI Framework/Input License: Apache-2.0 diff --git a/receiver/tizen-manifest.xml b/receiver/tizen-manifest.xml index 2a9aff2..f724b35 100644 --- a/receiver/tizen-manifest.xml +++ b/receiver/tizen-manifest.xml @@ -1,5 +1,5 @@ - + -- 2.7.4 From e89babb374b32b2644dd2b7d33c1635fab42eeca Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Sun, 19 Jul 2020 15:30:54 +0900 Subject: [PATCH 04/16] Add exclude section for impossible lines to be executed in TCT Change-Id: I12fd296bbc832d2083d24800f162514f70018cc4 Signed-off-by: Jihoon Kim --- client/sticker_data.c | 12 +++++++----- client/sticker_dbus.c | 22 +++++++++++++++++++++- consumer/sticker_consumer.c | 12 +++++++++--- provider/sticker_provider.c | 18 ++++++++++++------ 4 files changed, 49 insertions(+), 15 deletions(-) diff --git a/client/sticker_data.c b/client/sticker_data.c index cb5c427..c0a5869 100644 --- a/client/sticker_data.c +++ b/client/sticker_data.c @@ -39,21 +39,21 @@ static char* _make_absolute_path(const char *relative_path) ret = app_get_id(&app_id); if (ret != APP_ERROR_NONE) { - LOGE("Failed to get app_id : %d", ret); + LOGE("Failed to get app_id : %d", ret); //LCOV_EXCL_LINE ret = STICKER_ERROR_OPERATION_FAILED; goto cleanup; } ret = package_info_create(app_id, &package_info); if (ret != PACKAGE_MANAGER_ERROR_NONE || package_info == NULL) { - LOGE("failed to create package_info. ret: %d", ret); + LOGE("failed to create package_info. ret: %d", ret); //LCOV_EXCL_LINE ret = STICKER_ERROR_OPERATION_FAILED; goto cleanup; } ret = package_info_get_root_path(package_info, &app_path); if (ret != PACKAGE_MANAGER_ERROR_NONE || app_path == NULL) { - LOGE("failed to create package_info. ret: %d", ret); + LOGE("failed to create package_info. ret: %d", ret); //LCOV_EXCL_LINE ret = STICKER_ERROR_OPERATION_FAILED; goto cleanup; } @@ -61,7 +61,7 @@ static char* _make_absolute_path(const char *relative_path) int path_len = strlen(app_path) + strlen(relative_path) + 2; file_path = (char *)calloc(path_len, sizeof(char)); if (!file_path) { - LOGE("failed to alloc memory"); + LOGE("failed to alloc memory"); //LCOV_EXCL_LINE ret = STICKER_ERROR_OPERATION_FAILED; goto cleanup; } @@ -69,7 +69,7 @@ static char* _make_absolute_path(const char *relative_path) if(relative_path[0] == '/') snprintf(file_path, path_len, "%s%s",app_path, relative_path); else - snprintf(file_path, path_len, "%s%s%s",app_path, "/", relative_path); + snprintf(file_path, path_len, "%s%s%s",app_path, "/", relative_path); //LCOV_EXCL_LINE if (access(file_path, F_OK) != 0) { LOGE("%s does not exist", file_path); @@ -152,10 +152,12 @@ EXPORT_API int sticker_data_create(sticker_data_h *data_handle) char *app_id = NULL; int ret = app_get_id(&app_id); if (ret != APP_ERROR_NONE) { + //LCOV_EXCL_START LOGE("Failed to get app_id : %d", ret); free(data_struct); ret = STICKER_ERROR_OPERATION_FAILED; goto cleanup; + //LCOV_EXCL_STOP } data_struct->app_id = strdup(app_id); diff --git a/client/sticker_dbus.c b/client/sticker_dbus.c index a3c9cfa..2b653da 100644 --- a/client/sticker_dbus.c +++ b/client/sticker_dbus.c @@ -49,10 +49,12 @@ static int _dbus_init(GDBusConnection **gdbus_connection) GDBusConnection *conn = NULL; conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error); if (conn == NULL) { + //LCOV_EXCL_START if (error != NULL) { LOGE("g_bus_get_sync error message = %s", error->message); g_error_free(error); } + //LCOV_EXCL_STOP return STICKER_CLIENT_ERROR_IO_ERROR; } *gdbus_connection = conn; @@ -68,7 +70,7 @@ static int _dbus_init(GDBusConnection **gdbus_connection) LOGD("watch_id : %d", watch_id); if (watch_id == 0) { - LOGE("Failed to get identifier"); + LOGE("Failed to get identifier"); //LCOV_EXCL_LINE return STICKER_CLIENT_ERROR_IO_ERROR; } @@ -352,8 +354,10 @@ static int _dbus_signal_init(GDBusConnection *gdbus_connection, int *monitor_id, NULL); LOGD("id : %d", id); if (id == 0) { + //LCOV_EXCL_START ret = STICKER_CLIENT_ERROR_IO_ERROR; LOGE("g_dbus_connection_signal_subscribe() failed"); + //LCOV_EXCL_STOP } else { *monitor_id = id; } @@ -372,9 +376,11 @@ static GDBusMessage *_get_gbus_message(GVariant *body, const char *cmd) cmd); if (!message) { + //LCOV_EXCL_START LOGE("Failed to create a new gdbus message"); if (body) g_variant_unref(body); + //LCOV_EXCL_STOP return NULL; } @@ -399,6 +405,7 @@ static int _send_gdbus_sync_message(GDBusConnection *gdbus_connection, GDBusMess &err); if (!*reply) { + //LCOV_EXCL_START ret = STICKER_CLIENT_ERROR_SERVICE_NOT_READY; if (err != NULL) { LOGE("Error occurred when sending message(%s) : %s", cmd, err->message); @@ -406,16 +413,19 @@ static int _send_gdbus_sync_message(GDBusConnection *gdbus_connection, GDBusMess ret = STICKER_CLIENT_ERROR_PERMISSION_DENIED; g_error_free(err); } + //LCOV_EXCL_STOP return ret; } if (g_dbus_message_to_gerror(*reply, &err)) { + //LCOV_EXCL_START LOGE("error message = %s, code = %d", err->message, err->code); if (err->code == G_DBUS_ERROR_ACCESS_DENIED) ret = STICKER_CLIENT_ERROR_PERMISSION_DENIED; else ret = err->code; g_error_free(err); + //LCOV_EXCL_STOP return ret; } @@ -456,6 +466,7 @@ static int _send_async_message(GDBusConnection *gdbus_connection, GVariant *body g_object_unref(msg); if (err != NULL) { + //LCOV_EXCL_START ret = STICKER_CLIENT_ERROR_SERVICE_NOT_READY; LOGE("Error occurred when sending message(%s) : %s", cmd, err->message); @@ -464,6 +475,7 @@ static int _send_async_message(GDBusConnection *gdbus_connection, GVariant *body g_error_free(err); return ret; + //LCOV_EXCL_STOP } return ret; @@ -519,20 +531,26 @@ int sticker_dbus_init(GDBusConnection **gdbus_connection, int *server_watcher_id ret = _dbus_init(gdbus_connection); if (ret != STICKER_CLIENT_ERROR_NONE) { + //LCOV_EXCL_START LOGE("_dbus_init() failed : %d", ret); return ret; + //LCOV_EXCL_STOP } ret = _dbus_signal_init(*gdbus_connection, monitor_id, lib, data); if (ret != STICKER_CLIENT_ERROR_NONE) { + //LCOV_EXCL_START LOGE("_dbus_signal_init() failed : %d", ret); return ret; + //LCOV_EXCL_STOP } ret = _monitor_register(*gdbus_connection, server_watcher_id, lib); if (ret != STICKER_CLIENT_ERROR_NONE) { + //LCOV_EXCL_START LOGE("_monitor_register() failed : %d", ret); return ret; + //LCOV_EXCL_STOP } if (*server_monitor_id == 0) { @@ -545,10 +563,12 @@ int sticker_dbus_init(GDBusConnection **gdbus_connection, int *server_watcher_id server_watcher_id, NULL); if (*server_monitor_id == 0) { + //LCOV_EXCL_START g_dbus_connection_signal_unsubscribe(*gdbus_connection, *monitor_id); *monitor_id = 0; LOGE("Failed to get identifier"); return STICKER_CLIENT_ERROR_IO_ERROR; + //LCOV_EXCL_STOP } } diff --git a/consumer/sticker_consumer.c b/consumer/sticker_consumer.c index 1c11f19..4f51fb5 100644 --- a/consumer/sticker_consumer.c +++ b/consumer/sticker_consumer.c @@ -78,7 +78,7 @@ static int _cynara_initialize() { int ret = cynara_initialize(&p_cynara, NULL); if (ret != CYNARA_API_SUCCESS) - LOGE("Failed to cynara initialize"); + LOGE("Failed to cynara initialize"); //LCOV_EXCL_LINE return ret; } @@ -110,7 +110,7 @@ static int _check_privilege(const char *uid, const char *privilege) free(session); if (ret != CYNARA_API_ACCESS_ALLOWED) { - LOGE("Access denied. The result of cynara_check() : %d.", ret); + LOGE("Access denied. The result of cynara_check() : %d.", ret); //LCOV_EXCL_LINE return -1; } @@ -134,7 +134,7 @@ static int _sticker_check_privilege() { snprintf(uid, 16, "%d", getuid()); if (_check_privilege(uid, STICKER_PRIVILEGE_MEDIASTORAGE) < 0) { - LOGE("Permission is denied"); + LOGE("Permission is denied"); //LCOV_EXCL_LINE ret = STICKER_ERROR_PERMISSION_DENIED; } @@ -161,17 +161,21 @@ EXPORT_API int sticker_consumer_create(sticker_consumer_h *consumer_handle) ret = app_get_id(&consumer_struct->app_id); if (ret != APP_ERROR_NONE) { + //LCOV_EXCL_START LOGE("Failed to get app_id : %d", ret); free(consumer_struct); return STICKER_ERROR_OPERATION_FAILED; + //LCOV_EXCL_STOP } ret = sticker_dbus_init(&consumer_struct->gdbus_connection, &consumer_struct->server_watcher_id, &consumer_struct->monitor_id, &consumer_struct->server_monitor_id, STICKER_CLIENT_LIB_CONSUMER, (void *)consumer_struct); if (ret != STICKER_ERROR_NONE) { + //LCOV_EXCL_START LOGE("Failed to initialize dbus : %d", ret); free(consumer_struct); return STICKER_ERROR_OPERATION_FAILED; + //LCOV_EXCL_STOP } *consumer_handle = consumer_struct; @@ -191,9 +195,11 @@ EXPORT_API int sticker_consumer_destroy(sticker_consumer_h consumer_handle) ret = sticker_dbus_shutdown(consumer_handle->gdbus_connection, &consumer_handle->server_watcher_id, &consumer_handle->server_monitor_id, &consumer_handle->monitor_id, STICKER_CLIENT_LIB_CONSUMER); if (ret != STICKER_ERROR_NONE) { + //LCOV_EXCL_START LOGE("Failed to finalize dbus : %d", ret); free(consumer_handle); return STICKER_ERROR_OPERATION_FAILED; + //LCOV_EXCL_STOP } if (consumer_handle->gdbus_connection) diff --git a/provider/sticker_provider.c b/provider/sticker_provider.c index b16db5e..82e32c8 100644 --- a/provider/sticker_provider.c +++ b/provider/sticker_provider.c @@ -87,9 +87,11 @@ EXPORT_API int sticker_provider_create(sticker_provider_h *provider_handle) ret = sticker_dbus_init(&provider_struct->gdbus_connection, &provider_struct->server_watcher_id, &provider_struct->monitor_id, &provider_struct->server_monitor_id, STICKER_CLIENT_LIB_PROVIDER, (void *)provider_struct); if (ret != STICKER_ERROR_NONE) { + //LCOV_EXCL_START LOGE("Failed to initialize dbus : %d", ret); free(provider_struct); return STICKER_ERROR_OPERATION_FAILED; + //LCOV_EXCL_STOP } *provider_handle = provider_struct; @@ -109,9 +111,11 @@ EXPORT_API int sticker_provider_destroy(sticker_provider_h provider_handle) ret = sticker_dbus_shutdown(provider_handle->gdbus_connection, &provider_handle->server_watcher_id, &provider_handle->server_monitor_id, &provider_handle->monitor_id, STICKER_CLIENT_LIB_PROVIDER); if (ret != STICKER_ERROR_NONE) { + //LCOV_EXCL_START LOGE("Failed to finalize dbus : %d", ret); free(provider_handle); return STICKER_ERROR_OPERATION_FAILED; + //LCOV_EXCL_STOP } if (provider_handle->gdbus_connection) @@ -169,7 +173,7 @@ EXPORT_API int sticker_provider_insert_data_by_json_file(sticker_provider_h prov ret = app_get_id(&app_id); if (ret != APP_ERROR_NONE) { - LOGE("Failed to get app_id : %d", ret); + LOGE("Failed to get app_id : %d", ret); //LCOV_EXCL_LINE ret = STICKER_ERROR_OPERATION_FAILED; goto cleanup; } @@ -177,14 +181,14 @@ EXPORT_API int sticker_provider_insert_data_by_json_file(sticker_provider_h prov if (access(json_path, F_OK) != 0) { ret = package_info_create(app_id, &package_info); if (ret != PACKAGE_MANAGER_ERROR_NONE || package_info == NULL) { - LOGE("failed to create package_info. ret: %d", ret); + LOGE("failed to create package_info. ret: %d", ret); //LCOV_EXCL_LINE ret = STICKER_ERROR_OPERATION_FAILED; goto cleanup; } ret = package_info_get_root_path(package_info, &app_path); if (ret != PACKAGE_MANAGER_ERROR_NONE || app_path == NULL) { - LOGE("failed to create package_info. ret: %d", ret); + LOGE("failed to create package_info. ret: %d", ret); //LCOV_EXCL_LINE ret = STICKER_ERROR_OPERATION_FAILED; goto cleanup; } @@ -192,7 +196,7 @@ EXPORT_API int sticker_provider_insert_data_by_json_file(sticker_provider_h prov int path_len = strlen(app_path) + strlen(json_path) + 2; file_path = (char *)calloc(path_len, sizeof(char)); if (!file_path) { - LOGE("failed to alloc memory"); + LOGE("failed to alloc memory"); //LCOV_EXCL_LINE ret = STICKER_ERROR_OPERATION_FAILED; goto cleanup; } @@ -247,6 +251,7 @@ EXPORT_API int sticker_provider_update_data(sticker_provider_h provider_handle, ret = sticker_dbus_update_sticker_info(provider_handle->gdbus_connection, data_handle); if (ret != STICKER_ERROR_NONE) { + //LCOV_EXCL_START LOGE("Failed to update sticker information : %d", ret); if (ret == STICKER_CLIENT_ERROR_FILE_EXISTS) return STICKER_ERROR_FILE_EXISTS; @@ -254,6 +259,7 @@ EXPORT_API int sticker_provider_update_data(sticker_provider_h provider_handle, return STICKER_ERROR_NO_SUCH_FILE; else return STICKER_ERROR_OPERATION_FAILED; + //LCOV_EXCL_STOP } return STICKER_ERROR_NONE; @@ -288,7 +294,7 @@ EXPORT_API int sticker_provider_get_sticker_count(sticker_provider_h provider_ha ret = app_get_id(&app_id); if (ret != APP_ERROR_NONE) { - LOGE("Failed to get app_id : %d", ret); + LOGE("Failed to get app_id : %d", ret); //LCOV_EXCL_LINE ret = STICKER_ERROR_OPERATION_FAILED; goto cleanup; } @@ -321,7 +327,7 @@ EXPORT_API int sticker_provider_data_foreach_all(sticker_provider_h provider_han ret = app_get_id(&app_id); if (ret != APP_ERROR_NONE) { - LOGE("Failed to get app_id : %d", ret); + LOGE("Failed to get app_id : %d", ret); //LCOV_EXCL_LINE ret = STICKER_ERROR_OPERATION_FAILED; goto cleanup; } -- 2.7.4 From 337fb870830a849e25a75a528b7d05170d2b95f3 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Wed, 22 Jul 2020 14:57:43 +0900 Subject: [PATCH 05/16] Update package version to 0.1.58 Change-Id: I8615ed2806a92155b417a8d008d2407798f64531 Signed-off-by: Jihoon Kim --- packaging/capi-ui-sticker.spec | 2 +- receiver/tizen-manifest.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packaging/capi-ui-sticker.spec b/packaging/capi-ui-sticker.spec index 52c61fa..0fdadce 100644 --- a/packaging/capi-ui-sticker.spec +++ b/packaging/capi-ui-sticker.spec @@ -1,6 +1,6 @@ Name: capi-ui-sticker Summary: Sticker client library and daemon -Version: 0.1.57 +Version: 0.1.58 Release: 1 Group: Graphics & UI Framework/Input License: Apache-2.0 diff --git a/receiver/tizen-manifest.xml b/receiver/tizen-manifest.xml index f724b35..d9d4dfc 100644 --- a/receiver/tizen-manifest.xml +++ b/receiver/tizen-manifest.xml @@ -1,5 +1,5 @@ - + -- 2.7.4 From 80b9a9dd53eeecd8cba47583fed4594ae76465ff Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Mon, 3 Aug 2020 11:50:47 +0900 Subject: [PATCH 06/16] Remove code to send message through message_port This feature was replaced by event subscription Change-Id: I6d8a8551352908582d985668013ecc50506e3d93 Signed-off-by: Jihoon Kim --- packaging/capi-ui-sticker.spec | 1 - receiver/CMakeLists.txt | 1 - receiver/inc/config.h | 3 --- receiver/inc/message.h | 3 --- receiver/src/message.cpp | 21 --------------------- 5 files changed, 29 deletions(-) diff --git a/packaging/capi-ui-sticker.spec b/packaging/capi-ui-sticker.spec index 0fdadce..60670ca 100644 --- a/packaging/capi-ui-sticker.spec +++ b/packaging/capi-ui-sticker.spec @@ -28,7 +28,6 @@ BuildRequires: pkgconfig(sqlite3) %if 0%{?sec_product_feature_profile_wearable} BuildRequires: pkgconfig(capi-base-common) BuildRequires: pkgconfig(capi-appfw-service-application) -BuildRequires: pkgconfig(capi-message-port) BuildRequires: pkgconfig(capi-appfw-preference) BuildRequires: pkgconfig(capi-system-device) BuildRequires: pkgconfig(sap-client-stub-api) diff --git a/receiver/CMakeLists.txt b/receiver/CMakeLists.txt index 4797abb..99f02ee 100644 --- a/receiver/CMakeLists.txt +++ b/receiver/CMakeLists.txt @@ -15,7 +15,6 @@ pkg_check_modules(pkgs_test REQUIRED capi-base-common dlog capi-appfw-service-application - capi-message-port capi-appfw-app-common capi-appfw-event capi-appfw-preference diff --git a/receiver/inc/config.h b/receiver/inc/config.h index e02f07c..8d202ee 100644 --- a/receiver/inc/config.h +++ b/receiver/inc/config.h @@ -23,9 +23,6 @@ #define SYNC_INTERVAL 24*60*60 #define MAX_WAIT_TIME 120*60*60 -#define REMOTE_APP_ID "com.samsung.w-input-selector" -#define MESSAGE_PORT_REMOTE_NAME REMOTE_APP_ID"_msg_port_rcv" - #define MINIMUM_BATTERY 15 #define THUMBNAIL_WIDTH 96 diff --git a/receiver/inc/message.h b/receiver/inc/message.h index 597ee7a..793c98c 100644 --- a/receiver/inc/message.h +++ b/receiver/inc/message.h @@ -14,9 +14,6 @@ * limitations under the License. */ -#include -#include - #ifndef __MESSAGE_H__ #define __MESSAGE_H__ diff --git a/receiver/src/message.cpp b/receiver/src/message.cpp index 6e06820..80b69da 100644 --- a/receiver/src/message.cpp +++ b/receiver/src/message.cpp @@ -27,33 +27,12 @@ bool send_message(const char *cmd, const char *data) { bool result = false; int ret; - bool found = false; bundle *b = bundle_create(); bundle_add_str(b, "command", cmd); if (data) bundle_add_str(b, "data", data); - message_port_check_remote_port(REMOTE_APP_ID, MESSAGE_PORT_REMOTE_NAME, &found); - if (found) { - ret = message_port_send_message(REMOTE_APP_ID, MESSAGE_PORT_REMOTE_NAME, b); - if (ret != MESSAGE_PORT_ERROR_NONE) - { - LOGW("message port send message error. err : %d", ret); - result = false; - } - else - { - LOGI("Succeed to send message."); - result = true; - } - } - else - { - LOGW("Can't find remote port"); - result = false; - } - ret = event_publish_app_event(EVENT_NAME, b); if (ret != EVENT_ERROR_NONE) { result = false; -- 2.7.4 From 0aca54c26d3365e62bcaa4c40ccc803be279285f Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Tue, 4 Aug 2020 14:24:26 +0900 Subject: [PATCH 07/16] Reduce the computation between current time and last sync time Change-Id: Ib8b4f4132de13797b945ab4ba4eeaf3317c78cd2 Signed-off-by: Jihoon Kim --- receiver/src/main.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/receiver/src/main.cpp b/receiver/src/main.cpp index 8e04807..8f40413 100644 --- a/receiver/src/main.cpp +++ b/receiver/src/main.cpp @@ -101,15 +101,16 @@ static bool check_sync_time_condition() } // compare time - LOGD("current time : %f, last_sync_time : %f", ecore_time_unix_get(), last_sync_time); + double timediff = ecore_time_unix_get() - last_sync_time; + LOGD("current time : %.3f, last_sync_time : %.3f, diff : %.3f", ecore_time_unix_get(), last_sync_time, timediff); - if (ecore_time_unix_get() - last_sync_time > MAX_WAIT_TIME) { + if (timediff > MAX_WAIT_TIME) { LOGD("Starting manual synchronization"); initialize_sap(); request_show_sync_notification(); result = false; } else { - if (ecore_time_unix_get() - last_sync_time > SYNC_INTERVAL) + if (timediff > SYNC_INTERVAL) result = true; else result = false; -- 2.7.4 From 18f3c7dc96db233a031a18400efbfdcdd0b182c3 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Tue, 4 Aug 2020 15:02:55 +0900 Subject: [PATCH 08/16] Prevent crash in the encryption mode Change-Id: I65dd85d659da0d530b3fdffd637fbcb37bd172ac Signed-off-by: Jihoon Kim --- receiver/src/main.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/receiver/src/main.cpp b/receiver/src/main.cpp index 8f40413..f5d8120 100644 --- a/receiver/src/main.cpp +++ b/receiver/src/main.cpp @@ -125,6 +125,25 @@ static bool check_sync_time_condition() return result; } +bool check_rw_mount() +{ + char *data_path = NULL; + bool rw_mount = false; + data_path = app_get_shared_data_path(); + if (!data_path) return false; + + if (access(data_path, R_OK) == 0) + rw_mount = true; + + free(data_path); + + if (!rw_mount) { + SECURE_LOGE("Can't access rw storage\n"); + } + + return rw_mount; +} + static void app_control(app_control_h app_control, void *data) { /* Handle the launch request. */ @@ -137,6 +156,9 @@ static void app_control(app_control_h app_control, void *data) const char *event_uri = "event://tizen.system.event.battery_charger_status"; int res; + if (!check_rw_mount()) + service_app_exit(); + // operation int ret = app_control_get_operation(app_control, &operation); if (ret == APP_CONTROL_ERROR_NONE) { -- 2.7.4 From 98cc6afb8e303a432d8bf80e532a3537f7c02e9e Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Tue, 4 Aug 2020 18:05:47 +0900 Subject: [PATCH 09/16] Send request to sync after receiving sticker feature Change-Id: I9a719deff45a0dc5c42642fbdc35f1d820cf4a0c Signed-off-by: Jihoon Kim --- receiver/inc/ft.h | 1 + receiver/inc/sticker_request.h | 3 ++- receiver/src/ft.cpp | 48 +++++++++++++++++++++++++++++------------- receiver/src/main.cpp | 3 ++- 4 files changed, 38 insertions(+), 17 deletions(-) diff --git a/receiver/inc/ft.h b/receiver/inc/ft.h index 6c91c66..afab92e 100644 --- a/receiver/inc/ft.h +++ b/receiver/inc/ft.h @@ -33,6 +33,7 @@ gboolean is_init_sap(); void request_all_sticker_data(const char *mode, const char *type); bool request_sticker_data(const char *mode, const char *category, const char *type); +void request_auto_sync(); void request_sticker_feature(); void send_disconnect_message(); void request_show_sync_notification(); diff --git a/receiver/inc/sticker_request.h b/receiver/inc/sticker_request.h index 9fa6f2e..1aca41d 100644 --- a/receiver/inc/sticker_request.h +++ b/receiver/inc/sticker_request.h @@ -24,7 +24,8 @@ using namespace std; typedef enum { REQUEST_TYPE_SYNC, REQUEST_TYPE_FEATURE_REQ, - REQUEST_TYPE_SHOW_NOTIFICATION + REQUEST_TYPE_SHOW_NOTIFICATION, + REQUEST_TYPE_AUTOSYNC } request_type; struct StickerRequest { diff --git a/receiver/src/ft.cpp b/receiver/src/ft.cpp index 670d30c..dd20ce5 100644 --- a/receiver/src/ft.cpp +++ b/receiver/src/ft.cpp @@ -422,28 +422,46 @@ static bool process_request_queue() StickerRequest request = ReqQueue.front(); - if (request.req_type == REQUEST_TYPE_FEATURE_REQ) { - LOGD("[Request feature exchange]"); - request_sticker_feature(); - ReqQueue.pop(); - } - else if (request.req_type == REQUEST_TYPE_SYNC) { - LOGD("[Request to sync sticker] mode: %s, category: %s, type : %s", request.mode.c_str(), - request.category.c_str(), - request.type.c_str()); + switch (request.req_type) { + case REQUEST_TYPE_FEATURE_REQ: + LOGD("[Request feature exchange]"); + request_sticker_feature(); + ReqQueue.pop(); + break; + case REQUEST_TYPE_SYNC: + LOGD("[Request to sync sticker] mode: %s, category: %s, type : %s", request.mode.c_str(), + request.category.c_str(), + request.type.c_str()); + + if (request_sticker_data(request.mode.c_str(), request.category.c_str(), request.type.c_str())) + ReqQueue.pop(); - if (request_sticker_data(request.mode.c_str(), request.category.c_str(), request.type.c_str())) + break; + case REQUEST_TYPE_SHOW_NOTIFICATION: + LOGD("[Request to show notification]"); + request_show_sync_notification(); ReqQueue.pop(); - } - else if (request.req_type == REQUEST_TYPE_SHOW_NOTIFICATION) { - LOGD("[Request to show notification]"); - request_show_sync_notification(); - ReqQueue.pop(); + break; + case REQUEST_TYPE_AUTOSYNC: + LOGD("[Request to sync automatically]"); + ReqQueue.pop(); + request_all_sticker_data("auto", "input"); + break; + default: + break; } return true; } +void request_auto_sync() +{ + LOGD("Add request to sync automatically"); + StickerRequest pending_request; + pending_request.req_type = REQUEST_TYPE_AUTOSYNC; + ReqQueue.push(pending_request); +} + void request_all_sticker_data(const char *mode, const char *type) { StickerRequest pending_request; diff --git a/receiver/src/main.cpp b/receiver/src/main.cpp index f5d8120..b874611 100644 --- a/receiver/src/main.cpp +++ b/receiver/src/main.cpp @@ -185,7 +185,8 @@ static void app_control(app_control_h app_control, void *data) if (check_battery_condition()) { LOGD("Starting auto synchronization"); initialize_sap(); - request_all_sticker_data("auto", "input"); + request_sticker_feature(); + request_auto_sync(); } } else { -- 2.7.4 From 9bcfc53a60e80e580d1c5d183782278a5e28443b Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Wed, 5 Aug 2020 11:29:13 +0900 Subject: [PATCH 10/16] Update package version to 0.1.59 Change-Id: I74575a881def3a5e8ad91a3508cc342c684a5412 Signed-off-by: Jihoon Kim --- packaging/capi-ui-sticker.spec | 2 +- receiver/tizen-manifest.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packaging/capi-ui-sticker.spec b/packaging/capi-ui-sticker.spec index 60670ca..f62ffd2 100644 --- a/packaging/capi-ui-sticker.spec +++ b/packaging/capi-ui-sticker.spec @@ -1,6 +1,6 @@ Name: capi-ui-sticker Summary: Sticker client library and daemon -Version: 0.1.58 +Version: 0.1.59 Release: 1 Group: Graphics & UI Framework/Input License: Apache-2.0 diff --git a/receiver/tizen-manifest.xml b/receiver/tizen-manifest.xml index d9d4dfc..488af6d 100644 --- a/receiver/tizen-manifest.xml +++ b/receiver/tizen-manifest.xml @@ -1,5 +1,5 @@ - + -- 2.7.4 From 797f822d64b721ceed4b285009dabaa82cbb25cf Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Wed, 5 Aug 2020 14:04:24 +0900 Subject: [PATCH 11/16] Fix typo in function name Change-Id: Ib2c7f85040bf814bc6ef651a0f05b8517137736d Signed-off-by: Jihoon Kim --- client/sticker_dbus.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/client/sticker_dbus.c b/client/sticker_dbus.c index 2b653da..9189de2 100644 --- a/client/sticker_dbus.c +++ b/client/sticker_dbus.c @@ -366,7 +366,7 @@ static int _dbus_signal_init(GDBusConnection *gdbus_connection, int *monitor_id, return ret; } -static GDBusMessage *_get_gbus_message(GVariant *body, const char *cmd) +static GDBusMessage *_get_gdbus_message(GVariant *body, const char *cmd) { GDBusMessage *message = NULL; message = g_dbus_message_new_method_call( @@ -438,7 +438,7 @@ static int _send_sync_message(GDBusConnection *gdbus_connection, GVariant *body, int ret = STICKER_CLIENT_ERROR_NONE; GDBusMessage *msg = NULL; - msg = _get_gbus_message(body, cmd); + msg = _get_gdbus_message(body, cmd); if (msg == NULL) return STICKER_CLIENT_ERROR_IO_ERROR; @@ -456,7 +456,7 @@ static int _send_async_message(GDBusConnection *gdbus_connection, GVariant *body GDBusMessage *msg = NULL; GError *err = NULL; - msg = _get_gbus_message(body, cmd); + msg = _get_gdbus_message(body, cmd); if (msg == NULL) return STICKER_CLIENT_ERROR_IO_ERROR; -- 2.7.4 From 92a86e3b45b494fe6cbb8bf0d1adbc0d9e5280d1 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Wed, 5 Aug 2020 14:52:26 +0900 Subject: [PATCH 12/16] Check RW mount Change-Id: Ie8fc9c7a7a4023d48c57b871d2a0366526388772 Signed-off-by: Jihoon Kim --- receiver/src/main.cpp | 7 +++++++ receiver/src/sticker_log.cpp | 9 ++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/receiver/src/main.cpp b/receiver/src/main.cpp index b874611..d8797dd 100644 --- a/receiver/src/main.cpp +++ b/receiver/src/main.cpp @@ -33,6 +33,8 @@ using namespace std; +static bool check_rw_mount(); + static bool app_create(void *data) { /* Hook to take necessary actions before main event loop starts @@ -40,6 +42,11 @@ static bool app_create(void *data) If this function returns true, the main loop of application starts If this function returns false, the application is terminated */ + if (!check_rw_mount()) { + service_app_exit(); + return true; + } + LOGD(""); char log_path[PATH_MAX]; diff --git a/receiver/src/sticker_log.cpp b/receiver/src/sticker_log.cpp index 1faffd5..8b9a3a7 100644 --- a/receiver/src/sticker_log.cpp +++ b/receiver/src/sticker_log.cpp @@ -42,10 +42,17 @@ void sticker_save_log(const char *fmt, ...) char *data_path = NULL; data_path = app_get_shared_data_path(); + if (!data_path) + return; + snprintf(log_path, sizeof(log_path), "%s/log", data_path); - if (data_path) + if (access(data_path, R_OK) != 0) { free(data_path); + return; + } + + free(data_path); int idx = 0; if (preference_get_int(LAST_LOG_FILE_INDEX, &idx) != PREFERENCE_ERROR_NONE) { -- 2.7.4 From 3acecce526921c4591644c29a8dcc7c97fb44d73 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Wed, 5 Aug 2020 14:52:57 +0900 Subject: [PATCH 13/16] Update package version to 0.1.59 Change-Id: Ic311e2adb540d1e62177eceb883dbecb009baf22 Signed-off-by: Jihoon Kim --- packaging/capi-ui-sticker.spec | 2 +- receiver/tizen-manifest.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packaging/capi-ui-sticker.spec b/packaging/capi-ui-sticker.spec index f62ffd2..7453cc6 100644 --- a/packaging/capi-ui-sticker.spec +++ b/packaging/capi-ui-sticker.spec @@ -1,6 +1,6 @@ Name: capi-ui-sticker Summary: Sticker client library and daemon -Version: 0.1.59 +Version: 0.1.60 Release: 1 Group: Graphics & UI Framework/Input License: Apache-2.0 diff --git a/receiver/tizen-manifest.xml b/receiver/tizen-manifest.xml index 488af6d..f4db12c 100644 --- a/receiver/tizen-manifest.xml +++ b/receiver/tizen-manifest.xml @@ -1,5 +1,5 @@ - + -- 2.7.4 From 34728e67a54bfc2128f1adf372ee325fab8c8464 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Wed, 5 Aug 2020 20:22:13 +0900 Subject: [PATCH 14/16] Remove cyclic call of dlog LOGD or LOGW in sticker_log.cpp makes infinite recursion calls. Change-Id: I8e72a30c2c994fa0901150443f34a2145aa44d0c Signed-off-by: Jihoon Kim --- receiver/inc/log.h | 17 +-- receiver/src/ft.cpp | 248 +++++++++++++++++++++--------------------- receiver/src/main.cpp | 32 +++--- receiver/src/message.cpp | 2 +- receiver/src/sticker_info.cpp | 30 ++--- 5 files changed, 162 insertions(+), 167 deletions(-) diff --git a/receiver/inc/log.h b/receiver/inc/log.h index 43a3aa6..0e9c66d 100644 --- a/receiver/inc/log.h +++ b/receiver/inc/log.h @@ -31,19 +31,14 @@ void sticker_save_log (const char *fmt, ...); sticker_save_log("pid(%d) %s : %s(%d) > " fmt, getpid(), rindex(__FILE__, '/')+1, __FUNCTION__, __LINE__, ##__VA_ARGS__); \ } while (0) -#undef LOGD -#define LOGD(format, arg...) _STICKER_RECEIVER_LOG(DLOG_DEBUG, format, ##arg) +#define STLOGD(format, arg...) _STICKER_RECEIVER_LOG(DLOG_DEBUG, format, ##arg) -#undef LOGI -#define LOGI(format, arg...) _STICKER_RECEIVER_LOG(DLOG_INFO, format, ##arg) +#define STLOGI(format, arg...) _STICKER_RECEIVER_LOG(DLOG_INFO, format, ##arg) -#undef LOGW -#define LOGW(format, arg...) _STICKER_RECEIVER_LOG(DLOG_WARN, format, ##arg) +#define STLOGW(format, arg...) _STICKER_RECEIVER_LOG(DLOG_WARN, format, ##arg) -#undef LOGE -#define LOGE(format, arg...) _STICKER_RECEIVER_LOG(DLOG_ERROR, format, ##arg) +#define STLOGE(format, arg...) _STICKER_RECEIVER_LOG(DLOG_ERROR, format, ##arg) -#undef LOGF -#define LOGF(format, arg...) _STICKER_RECEIVER_LOG(DLOG_FATAL, format, ##arg) +#define STLOGF(format, arg...) _STICKER_RECEIVER_LOG(DLOG_FATAL, format, ##arg) -#endif /* __debug_H__ */ \ No newline at end of file +#endif /* __debug_H__ */ diff --git a/receiver/src/ft.cpp b/receiver/src/ft.cpp index dd20ce5..eda0692 100644 --- a/receiver/src/ft.cpp +++ b/receiver/src/ft.cpp @@ -101,7 +101,7 @@ static void save_last_sync_time() LOGI("Succeed to set last sync time : %f", current_time); } else { - LOGW("Failed to set last sync time"); + STLOGW("Failed to set last sync time"); } } @@ -111,9 +111,9 @@ static void set_sync_first_complete() if (vconf_get_int(VCONFKEY_STICKER_SYNC_COMPLETE, &complete_flags) == 0 && complete_flags == 0) { // first sync if (vconf_set_int(VCONFKEY_STICKER_SYNC_COMPLETE, VCONFKEY_STICKER_SYNC_COMPLETE_DONE) == 0) - LOGD("Succeed to set sync complete"); + STLOGD("Succeed to set sync complete"); else - LOGW("Fail to set sync complete"); + STLOGW("Fail to set sync complete"); } } @@ -127,13 +127,13 @@ static void set_sync_progressing(gboolean flag) { job_progress = flag; #ifdef VCONFKEY_STICKER_SYNC_STATE - LOGD("sync progressing : %d", flag); + STLOGD("sync progressing : %d", flag); if (vconf_set_int(VCONFKEY_STICKER_SYNC_STATE, flag ? VCONFKEY_STICKER_SYNC_STATE_IN_PROGRESS : VCONFKEY_STICKER_SYNC_STATE_WAITING) == 0) - LOGD("Succeed to set sync state"); + STLOGD("Succeed to set sync state"); else - LOGW("Fail to set sync state"); + STLOGW("Fail to set sync state"); #else - LOGW("No vconf sync state definition"); + STLOGW("No vconf sync state definition"); #endif } @@ -147,13 +147,13 @@ static gboolean _send_json_data(JsonObject *obj) j_generator = json_generator_new(); if (j_generator == NULL) { - LOGE("Unable to json_generator_new"); + STLOGE("Unable to json_generator_new"); goto cleanup; } j_node = json_node_new(JSON_NODE_OBJECT); if (j_node == NULL) { - LOGE("Unable to json_node_new"); + STLOGE("Unable to json_node_new"); goto cleanup; } @@ -162,12 +162,12 @@ static gboolean _send_json_data(JsonObject *obj) data = json_generator_to_data(j_generator, &size); if (data == NULL) { - LOGE("Unable to json_generator_to_data"); + STLOGE("Unable to json_generator_to_data"); goto cleanup; } if (priv_data.socket) { - LOGD("Send JSON data : %s", data); + STLOGD("Send JSON data : %s", data); result = sap_socket_send_data(priv_data.socket, ACCESSORY_SERVICE_CHANNEL_ID, strlen(data), (void *)data); } @@ -207,7 +207,7 @@ static void _on_transfer_completed(sap_file_transaction_h file_transaction, LOGI("Transfer Completed"); if (chmod(sticker_data.file_path.c_str(), S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH) == -1) { - LOGE("Failed to change permission : %s. error : %s", sticker_data.file_path.c_str(), strerror(errno)); + STLOGE("Failed to change permission : %s. error : %s", sticker_data.file_path.c_str(), strerror(errno)); } else { LOGI("Succeed to change permission : %s", sticker_data.file_path.c_str()); @@ -222,7 +222,7 @@ static void _on_transfer_completed(sap_file_transaction_h file_transaction, int ret = thumbnail_util_extract_to_file(sticker_data.file_path.c_str(), THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT, sticker_data.thumbnail_path.c_str()); if (ret != THUMBNAIL_UTIL_ERROR_NONE) { - LOGE("Failed to create thumbnail. msg : %s", get_error_message(ret)); + STLOGE("Failed to create thumbnail. msg : %s", get_error_message(ret)); sticker_data.thumbnail_path.clear(); } @@ -230,11 +230,11 @@ static void _on_transfer_completed(sap_file_transaction_h file_transaction, sticker_data.thumbnail_path.c_str(), sticker_data.disp_type.c_str()); if (unlink(sticker_data.file_path.c_str()) == -1) - LOGE("Failed to remove sticker file"); + STLOGE("Failed to remove sticker file"); if (!sticker_data.thumbnail_path.empty()) { if (unlink(sticker_data.thumbnail_path.c_str()) == -1) - LOGE("Failed to remove sticker thumbnail"); + STLOGE("Failed to remove sticker thumbnail"); } } @@ -242,47 +242,47 @@ static void _on_transfer_completed(sap_file_transaction_h file_transaction, } else { switch (result) { case (SAP_FT_TRANSFER_FAIL_CHANNEL_IO): { - LOGW("Channel IO Error."); + STLOGW("Channel IO Error."); break; } case (SAP_FT_TRANSFER_FAIL_FILE_IO): { - LOGW("File IO Error."); + STLOGW("File IO Error."); break; } case (SAP_FT_TRANSFER_FAIL_CMD_DROPPED): { - LOGW("Transfer dropped."); + STLOGW("Transfer dropped."); break; } case (SAP_FT_TRANSFER_FAIL_PEER_UNRESPONSIVE): { - LOGW("Peer Un Responsive."); + STLOGW("Peer Un Responsive."); break; } case (SAP_FT_TRANSFER_FAIL_PEER_CONN_LOST): { - LOGW("Connection Lost."); + STLOGW("Connection Lost."); break; } case (SAP_FT_TRANSFER_FAIL_PEER_CANCELLED): { - LOGW("Peer Cancelled."); + STLOGW("Peer Cancelled."); break; } case (SAP_FT_TRANSFER_FAIL_SPACE_NOT_AVAILABLE): { - LOGW("No Space."); + STLOGW("No Space."); break; } default: - LOGW("Unknown Error"); + STLOGW("Unknown Error"); break; } } @@ -329,10 +329,10 @@ void accept_file() ret = sap_file_transfer_receive(priv_data.file_socket, file_path); switch(ret) { case SAP_RESULT_PERMISSION_DENIED: - LOGW("permission denied"); + STLOGW("permission denied"); break; case SAP_RESULT_FAILURE: - LOGW("Fail"); + STLOGW("Fail"); break; case SAP_RESULT_SUCCESS: LOGI("Success"); @@ -356,7 +356,7 @@ static int _create_thumbnail_directory() return 0; if (mkdir(thumb_path, 0755) == -1) { - LOGE("directory create error"); + STLOGE("directory create error"); return -1; } @@ -384,12 +384,12 @@ bool request_sticker_data(const char *mode, const char *category, const char *ty j_object = json_object_new(); if (j_object == NULL) { - LOGE("json object create error"); + STLOGE("json object create error"); return false; } if (_create_thumbnail_directory() != 0) - LOGE("Failed to create thumbnail directory"); + STLOGE("Failed to create thumbnail directory"); json_object_set_string_member(j_object, "msgId", STICKER_SYNC_START_REQ); json_object_set_int_member(j_object, "tID", ++t_id); @@ -398,7 +398,7 @@ bool request_sticker_data(const char *mode, const char *category, const char *ty json_object_set_string_member(j_object, "type", type); if (_send_json_data(j_object) == FALSE) { - LOGE("Failed to send STICKER_SYNC_START_REQ"); + STLOGE("Failed to send STICKER_SYNC_START_REQ"); result = false; } else { @@ -424,12 +424,12 @@ static bool process_request_queue() switch (request.req_type) { case REQUEST_TYPE_FEATURE_REQ: - LOGD("[Request feature exchange]"); + STLOGD("[Request feature exchange]"); request_sticker_feature(); ReqQueue.pop(); break; case REQUEST_TYPE_SYNC: - LOGD("[Request to sync sticker] mode: %s, category: %s, type : %s", request.mode.c_str(), + STLOGD("[Request to sync sticker] mode: %s, category: %s, type : %s", request.mode.c_str(), request.category.c_str(), request.type.c_str()); @@ -438,12 +438,12 @@ static bool process_request_queue() break; case REQUEST_TYPE_SHOW_NOTIFICATION: - LOGD("[Request to show notification]"); + STLOGD("[Request to show notification]"); request_show_sync_notification(); ReqQueue.pop(); break; case REQUEST_TYPE_AUTOSYNC: - LOGD("[Request to sync automatically]"); + STLOGD("[Request to sync automatically]"); ReqQueue.pop(); request_all_sticker_data("auto", "input"); break; @@ -456,7 +456,7 @@ static bool process_request_queue() void request_auto_sync() { - LOGD("Add request to sync automatically"); + STLOGD("Add request to sync automatically"); StickerRequest pending_request; pending_request.req_type = REQUEST_TYPE_AUTOSYNC; ReqQueue.push(pending_request); @@ -484,7 +484,7 @@ void request_all_sticker_data(const char *mode, const char *type) } } else - LOGW("Failed to get value of VCONFKEY_STICKER_SUPPORTED_FEATURE"); + STLOGW("Failed to get value of VCONFKEY_STICKER_SUPPORTED_FEATURE"); #else pending_request.category = string("arsticker"); ReqQueue.push(pending_request); @@ -511,7 +511,7 @@ void request_sticker_feature() j_object = json_object_new(); if (j_object == NULL) { - LOGE("json object create error"); + STLOGE("json object create error"); return; } @@ -519,7 +519,7 @@ void request_sticker_feature() json_object_set_int_member(j_object, "tID", ++t_id); if (_send_json_data(j_object) == FALSE) { - LOGE("Failed to send STICKER_SYNC_FEATURE_REQ"); + STLOGE("Failed to send STICKER_SYNC_FEATURE_REQ"); } else { job_progress = TRUE; @@ -528,7 +528,7 @@ void request_sticker_feature() json_object_unref(j_object); if (_create_thumbnail_directory() != 0) - LOGE("Failed to create thumbnail directory"); + STLOGE("Failed to create thumbnail directory"); } void send_disconnect_message() @@ -536,7 +536,7 @@ void send_disconnect_message() JsonObject *j_object = NULL; j_object = json_object_new(); if (j_object == NULL) { - LOGE("json object create error"); + STLOGE("json object create error"); return; } @@ -544,7 +544,7 @@ void send_disconnect_message() json_object_set_int_member(j_object, "tID", t_id); if (_send_json_data(j_object) == FALSE) { - LOGE("Failed to send STICKER_SEND_DISCONNECT_REQ"); + STLOGE("Failed to send STICKER_SEND_DISCONNECT_REQ"); } json_object_unref(j_object); @@ -565,7 +565,7 @@ void request_show_sync_notification() j_object = json_object_new(); if (j_object == NULL) { - LOGE("json object create error"); + STLOGE("json object create error"); return; } @@ -573,7 +573,7 @@ void request_show_sync_notification() json_object_set_int_member(j_object, "tID", ++t_id); if (_send_json_data(j_object) == FALSE) { - LOGE("Failed to send STICKER_REQUEST_NOTI_REQ"); + STLOGE("Failed to send STICKER_REQUEST_NOTI_REQ"); } else { job_progress = TRUE; } @@ -619,16 +619,16 @@ void conn_terminated(sap_peer_agent_h peer_agent, switch (result) { case SAP_CONNECTION_TERMINATED_REASON_PEER_DISCONNECTED: - LOGW("Peer Disconnected"); + STLOGW("Peer Disconnected"); break; case SAP_CONNECTION_TERMINATED_REASON_DEVICE_DETACHED: - LOGW("Disconnected Device Detached"); + STLOGW("Disconnected Device Detached"); break; case SAP_CONNECTION_TERMINATED_REASON_UNKNOWN: - LOGW("Disconnected Unknown Reason"); + STLOGW("Disconnected Unknown Reason"); break; default: - LOGW("connection terminated. reason : %d", result); + STLOGW("connection terminated. reason : %d", result); break; } @@ -668,7 +668,7 @@ static void send_sync_start_response(int result_code) { int is_synced = 0; if (vconf_get_int(VCONFKEY_STICKER_SYNC_COMPLETE, &is_synced) != 0) - LOGW("Failed to read sync completion"); + STLOGW("Failed to read sync completion"); if (is_synced == VCONFKEY_STICKER_SYNC_COMPLETE_NONE) response_to_app = "no_sticker"; @@ -687,20 +687,20 @@ static void send_sync_start_response(int result_code) break; } - LOGD("result code : %d, sync complete flag : %d", result_code, sync_complete_flags); + STLOGD("result code : %d, sync complete flag : %d", result_code, sync_complete_flags); #ifdef VCONFKEY_STICKER_SUPPORTED_FEATURE if (vconf_get_int(VCONFKEY_STICKER_SUPPORTED_FEATURE, &feature_flag) != 0) { - LOGW("Failed to read support feature"); + STLOGW("Failed to read support feature"); return; } - LOGD("feature : %d, current request category : %s", feature_flag, current_request.category.c_str()); + STLOGD("feature : %d, current request category : %s", feature_flag, current_request.category.c_str()); if (feature_flag == VCONFKEY_STICKER_FEATURE_AREMOJI || feature_flag == VCONFKEY_STICKER_FEATURE_BITMOJI) { - LOGD("only standalone sync mode"); + STLOGD("only standalone sync mode"); send_message("sync_start_response", response_to_app.c_str()); } else { @@ -735,19 +735,19 @@ on_data_received(sap_socket_h socket, unsigned short int channel_id, unsigned in json_parser_load_from_data(parser, (char *)buffer, payload_length, &err_msg); if (err_msg) { - LOGE("failed to load json file. error message: %s", err_msg->message); + STLOGE("failed to load json file. error message: %s", err_msg->message); goto cleanup; } root = json_parser_get_root(parser); if (root == NULL) { - LOGE("failed to get root"); + STLOGE("failed to get root"); goto cleanup; } root_obj = json_node_get_object(root); if (root_obj == NULL) { - LOGE("failed to get object"); + STLOGE("failed to get object"); goto cleanup; } @@ -756,7 +756,7 @@ on_data_received(sap_socket_h socket, unsigned short int channel_id, unsigned in if (msg_id == STICKER_REQUEST_SYNC_REQ) { request_all_sticker_data("manual", "input"); } else if (msg_id == STICKER_SYNC_FEATURE_RSP) { - LOGD("msg : %s", msg_id.c_str()); + STLOGD("msg : %s", msg_id.c_str()); #ifdef VCONFKEY_STICKER_SUPPORTED_FEATURE const char *json_aremoji = json_object_get_string_member(root_obj, "arEmoji"); const char *json_bitmoji = json_object_get_string_member(root_obj, "bitmoji"); @@ -771,39 +771,39 @@ on_data_received(sap_socket_h socket, unsigned short int channel_id, unsigned in supported_feature |= VCONFKEY_STICKER_FEATURE_BITMOJI; if (vconf_set_int(VCONFKEY_STICKER_SUPPORTED_FEATURE, supported_feature) == 0) - LOGD("Succeed to set supported feature"); + STLOGD("Succeed to set supported feature"); else - LOGW("Fail to set supported feature"); + STLOGW("Fail to set supported feature"); #else - LOGW("No vconf supported feature"); + STLOGW("No vconf supported feature"); #endif if (!process_request_queue()) { quit(); } } else if (msg_id == STICKER_SYNC_START_RSP) { - LOGD("msg : %s", msg_id.c_str()); + STLOGD("msg : %s", msg_id.c_str()); const char *json_result = json_object_get_string_member(root_obj, "result"); string result = string(json_result ? json_result : ""); int result_code = json_object_get_int_member(root_obj, "resultCode"); - LOGD("result : %s, resultCode : %d", result.c_str(), result_code); + STLOGD("result : %s, resultCode : %d", result.c_str(), result_code); if(result_code == SYNC_START_RSP_SUCCESS) { send_sync_start_response(result_code); if (current_request.category == string("bitmoji")) { - LOGD("Delete all bitmoji stickers"); + STLOGD("Delete all bitmoji stickers"); delete_all_stickers("bitmoji"); } } else if (result_code == SYNC_START_RSP_SYNC_AFTER_DELETING_AREMOJI) { send_sync_start_response(result_code); - LOGD("Delete all AR Emoji stickers"); + STLOGD("Delete all AR Emoji stickers"); delete_all_stickers("arsticker"); } else { if (result_code == SYNC_START_RSP_BITMOJI_ALL_DELETE) { - LOGD("Delete all bitmoji stickers"); + STLOGD("Delete all bitmoji stickers"); delete_all_stickers("bitmoji"); } else if (result_code == SYNC_START_RSP_AREMOJI_ALL_DELETE) { - LOGD("Delete all AR Emoji stickers"); + STLOGD("Delete all AR Emoji stickers"); delete_all_stickers("arsticker"); } @@ -813,7 +813,7 @@ on_data_received(sap_socket_h socket, unsigned short int channel_id, unsigned in if (vconf_get_int(VCONFKEY_STICKER_SUPPORTED_FEATURE, &feature_flag) == 0) { - LOGD("feature : %d, current request category : %s", feature_flag, current_request.category.c_str()); + STLOGD("feature : %d, current request category : %s", feature_flag, current_request.category.c_str()); if (feature_flag & VCONFKEY_STICKER_FEATURE_BITMOJI) { if (current_request.category == string("bitmoji")) @@ -826,10 +826,10 @@ on_data_received(sap_socket_h socket, unsigned short int channel_id, unsigned in } } else { - LOGW("Failed to read support feature"); + STLOGW("Failed to read support feature"); } #else - LOGW("No vconf supported feature"); + STLOGW("No vconf supported feature"); #endif /* VCONFKEY_STICKER_SUPPORTED_FEATURE */ send_sync_start_response(result_code); @@ -840,7 +840,7 @@ on_data_received(sap_socket_h socket, unsigned short int channel_id, unsigned in } } } else if (msg_id == STICKER_SEND_START_REQ) { - LOGD("msg : %s", msg_id.c_str()); + STLOGD("msg : %s", msg_id.c_str()); total_file_count_in_group = 0; rec_file_cnt_in_group = 0; t_id = json_object_get_int_member(root_obj, "tID"); @@ -854,7 +854,7 @@ on_data_received(sap_socket_h socket, unsigned short int channel_id, unsigned in string file_name = string(json_filename ? json_filename : ""); if (file_len > 0) { - LOGD("Add file : %s, len : %d", file_name.c_str(), file_len); + STLOGD("Add file : %s, len : %d", file_name.c_str(), file_len); total_file_count_in_group++; } else { char *app_id = NULL; @@ -867,7 +867,7 @@ on_data_received(sap_socket_h socket, unsigned short int channel_id, unsigned in snprintf(file_path, sizeof(file_path), "%s/%s", data_path, del_file_name.c_str()); snprintf(del_path, sizeof(del_path), "%s/%s%s",STICKER_DIRECTORY, app_id, file_path); - LOGD("Delete file : %s, len : %d", del_path, file_len); + STLOGD("Delete file : %s, len : %d", del_path, file_len); delete_sticker_data(del_path); if (app_id) @@ -878,7 +878,7 @@ on_data_received(sap_socket_h socket, unsigned short int channel_id, unsigned in JsonObject *j_object = json_object_new(); if (j_object == NULL) { - LOGE("Unable to json_object_new"); + STLOGE("Unable to json_object_new"); goto cleanup; } @@ -887,11 +887,11 @@ on_data_received(sap_socket_h socket, unsigned short int channel_id, unsigned in json_object_set_string_member(j_object, "result", "success"); if (_send_json_data(j_object) == FALSE) - LOGE("Failed to send message"); + STLOGE("Failed to send message"); json_object_unref(j_object); } else if (msg_id == STICKER_SEND_FACE_DATA) { - LOGD("msg : %s", msg_id.c_str()); + STLOGD("msg : %s", msg_id.c_str()); const char *type_data = json_object_get_string_member(root_obj, "type"); if (type_data) sticker_data.disp_type = string(type_data); @@ -902,14 +902,14 @@ on_data_received(sap_socket_h socket, unsigned short int channel_id, unsigned in sticker_data.keyword = string(category); } } else if (msg_id == STICKER_SEND_STOP_REQ) { - LOGD("msg : %s", msg_id.c_str()); + STLOGD("msg : %s", msg_id.c_str()); const char *json_reason = json_object_get_string_member(root_obj, "reason"); string reason = string(json_reason ? json_reason : ""); int file_len = json_object_get_int_member(root_obj, "count"); JsonObject *j_object = json_object_new(); if (j_object == NULL) { - LOGE("Unable to json_object_new"); + STLOGE("Unable to json_object_new"); goto cleanup; } @@ -923,7 +923,7 @@ on_data_received(sap_socket_h socket, unsigned short int channel_id, unsigned in if (vconf_get_int(VCONFKEY_STICKER_SUPPORTED_FEATURE, &feature_flag) == 0) { - LOGD("feature : %d, current request category : %s", feature_flag, current_request.category.c_str()); + STLOGD("feature : %d, current request category : %s", feature_flag, current_request.category.c_str()); if (feature_flag == VCONFKEY_STICKER_FEATURE_AREMOJI) { if (current_request.category == string("arsticker")) @@ -942,10 +942,10 @@ on_data_received(sap_socket_h socket, unsigned short int channel_id, unsigned in } } else { - LOGW("Failed to read support feature"); + STLOGW("Failed to read support feature"); } #else - LOGW("No vconf supported feature"); + STLOGW("No vconf supported feature"); #endif /* VCONFKEY_STICKER_SUPPORTED_FEATURE */ json_object_set_string_member(j_object, "result", "success"); @@ -960,7 +960,7 @@ on_data_received(sap_socket_h socket, unsigned short int channel_id, unsigned in } if (_send_json_data(j_object) == FALSE) - LOGE("Failed to send message"); + STLOGE("Failed to send message"); json_object_unref(j_object); @@ -976,7 +976,7 @@ on_data_received(sap_socket_h socket, unsigned short int channel_id, unsigned in quit(); } } else - LOGW("unknown msg id : %s", msg_id.c_str()); + STLOGW("unknown msg id : %s", msg_id.c_str()); cleanup: if (err_msg) @@ -1005,25 +1005,25 @@ static void on_conn_req(sap_peer_agent_h peer_agent, LOGI("Connection Already Exist"); break; case SAP_CONNECTION_FAILURE_DEVICE_UNREACHABLE: - LOGW("Connection failure device unreachable"); + STLOGW("Connection failure device unreachable"); break; case SAP_CONNECTION_FAILURE_INVALID_PEERAGENT: - LOGW("Connection failure invalid peer agent"); + STLOGW("Connection failure invalid peer agent"); break; case SAP_CONNECTION_FAILURE_NETWORK: - LOGW("Connection failure network"); + STLOGW("Connection failure network"); break; case SAP_CONNECTION_FAILURE_PEERAGENT_NO_RESPONSE: - LOGW("Connection failure peer agent no response"); + STLOGW("Connection failure peer agent no response"); break; case SAP_CONNECTION_FAILURE_PEERAGENT_REJECTED: - LOGW("Connection failure peer agent rejected"); + STLOGW("Connection failure peer agent rejected"); break; case SAP_CONNECTION_FAILURE_UNKNOWN: - LOGW("Connection failure unknown"); + STLOGW("Connection failure unknown"); break; default: - LOGW("Connection failure. error code : %d", result); + STLOGW("Connection failure. error code : %d", result); break; } } @@ -1057,35 +1057,35 @@ _on_service_connection_created(sap_peer_agent_h peer_agent, break; case SAP_CONNECTION_FAILURE_DEVICE_UNREACHABLE: - LOGW("Connection Failure device unreachable"); + STLOGW("Connection Failure device unreachable"); break; case SAP_CONNECTION_FAILURE_INVALID_PEERAGENT: - LOGW("Connection Failure invalid peer agent"); + STLOGW("Connection Failure invalid peer agent"); break; case SAP_CONNECTION_FAILURE_NETWORK: - LOGW("Connection Failure network"); + STLOGW("Connection Failure network"); break; case SAP_CONNECTION_FAILURE_PEERAGENT_NO_RESPONSE: - LOGW("Connection Failure peer agent no response"); + STLOGW("Connection Failure peer agent no response"); break; case SAP_CONNECTION_FAILURE_PEERAGENT_REJECTED: - LOGW("Connection Failure peer agent rejected"); + STLOGW("Connection Failure peer agent rejected"); break; case SAP_CONNECTION_FAILURE_UNKNOWN: - LOGW("Connection Failure peer agent unknown"); + STLOGW("Connection Failure peer agent unknown"); break; case SAP_CONNECTION_IN_PROGRESS: - LOGW("Connection in progress"); + STLOGW("Connection in progress"); break; case SAP_CONNECTION_PEER_AGENT_NOT_SUPPORTED: - LOGW("Connection peer agent not supported"); + STLOGW("Connection peer agent not supported"); break; } } @@ -1099,7 +1099,7 @@ _create_service_connection(gpointer user_data) _on_service_connection_created, priv); - LOGD("request connection result : %d", result); + STLOGD("request connection result : %d", result); return FALSE; } @@ -1115,13 +1115,13 @@ _on_peer_agent_updated(sap_peer_agent_h peer_agent, switch (result) { case SAP_PEER_AGENT_FOUND_RESULT_DEVICE_NOT_CONNECTED: - LOGW("SAP_PEER_AGENT_FOUND_RESULT_DEVICE_NOT_CONNECTED"); + STLOGW("SAP_PEER_AGENT_FOUND_RESULT_DEVICE_NOT_CONNECTED"); break; case SAP_PEER_AGENT_FOUND_RESULT_FOUND: if (peer_status == SAP_PEER_AGENT_STATUS_AVAILABLE) { - LOGD("SAP_PEER_AGENT_FOUND_RESULT_FOUND"); + STLOGD("SAP_PEER_AGENT_FOUND_RESULT_FOUND"); priv->peer_agent = peer_agent; g_idle_add(_create_service_connection, priv); } @@ -1132,15 +1132,15 @@ _on_peer_agent_updated(sap_peer_agent_h peer_agent, break; case SAP_PEER_AGENT_FOUND_RESULT_SERVICE_NOT_FOUND: - LOGW("SAP_PEER_AGENT_FOUND_RESULT_SERVICE_NOT_FOUND"); + STLOGW("SAP_PEER_AGENT_FOUND_RESULT_SERVICE_NOT_FOUND"); break; case SAP_PEER_AGENT_FOUND_RESULT_TIMEDOUT: - LOGW("SAP_PEER_AGENT_FOUND_RESULT_TIMEDOUT"); + STLOGW("SAP_PEER_AGENT_FOUND_RESULT_TIMEDOUT"); break; case SAP_PEER_AGENT_FOUND_RESULT_INTERNAL_ERROR: - LOGW("SAP_PEER_AGENT_FOUND_RESULT_INTERNAL_ERROR"); + STLOGW("SAP_PEER_AGENT_FOUND_RESULT_INTERNAL_ERROR"); break; default: @@ -1163,7 +1163,7 @@ static void on_agent_initialized(sap_agent_h agent, { switch (result) { case SAP_AGENT_INITIALIZED_RESULT_SUCCESS: - LOGD("agent is initialized"); + STLOGD("agent is initialized"); priv_data.agent = agent; @@ -1172,16 +1172,16 @@ static void on_agent_initialized(sap_agent_h agent, break; case SAP_AGENT_INITIALIZED_RESULT_DUPLICATED: - LOGE("duplicate registration"); + STLOGE("duplicate registration"); break; case SAP_AGENT_INITIALIZED_RESULT_INVALID_ARGUMENTS: - LOGE("invalid arguments"); + STLOGE("invalid arguments"); break; case SAP_AGENT_INITIALIZED_RESULT_INTERNAL_ERROR: - LOGE("internal sap error"); + STLOGE("internal sap error"); break; default: - LOGE("unknown status (%d)", result); + STLOGE("unknown status (%d)", result); break; } } @@ -1190,47 +1190,47 @@ static void on_agent_deinitialized(sap_agent_h agent, sap_agent_deinitialized_result_e result, void *user_data) { - LOGD("result of deinitialize : %d", result); + STLOGD("result of deinitialize : %d", result); } static void _on_device_status_changed(sap_device_status_e status, sap_transport_type_e transport_type, void *user_data) { - LOGD("%s, status :%d", __func__, status); + STLOGD("%s, status :%d", __func__, status); switch (transport_type) { case SAP_TRANSPORT_TYPE_BT: - LOGD("transport_type (%d): bt", transport_type); + STLOGD("transport_type (%d): bt", transport_type); break; case SAP_TRANSPORT_TYPE_BLE: - LOGD("transport_type (%d): ble", transport_type); + STLOGD("transport_type (%d): ble", transport_type); break; case SAP_TRANSPORT_TYPE_TCP: - LOGD("transport_type (%d): tcp/ip", transport_type); + STLOGD("transport_type (%d): tcp/ip", transport_type); break; case SAP_TRANSPORT_TYPE_USB: - LOGD("transport_type (%d): usb", transport_type); + STLOGD("transport_type (%d): usb", transport_type); break; case SAP_TRANSPORT_TYPE_MOBILE: - LOGD("transport_type (%d): mobile", transport_type); + STLOGD("transport_type (%d): mobile", transport_type); break; default: - LOGE("unknown transport_type (%d)", transport_type); + STLOGE("unknown transport_type (%d)", transport_type); break; } switch (status) { case SAP_DEVICE_STATUS_DETACHED: - LOGD("device is not connected."); + STLOGD("device is not connected."); send_message("sync_stop_result", "cancel"); break; case SAP_DEVICE_STATUS_ATTACHED: - LOGD("Attached calling find peer now"); + STLOGD("Attached calling find peer now"); g_idle_add(_find_peer_agent, &priv_data); break; default: - LOGE("unknown status (%d)", status); + STLOGE("unknown status (%d)", status); break; } } @@ -1243,7 +1243,7 @@ gboolean agent_initialize() result = sap_agent_initialize(priv_data.agent, ACCESSORY_SERVICE_PROFILE_ID, SAP_AGENT_ROLE_CONSUMER, on_agent_initialized, NULL); - LOGD("SAP >>> getRegisteredServiceAgent() >>> %d", result); + STLOGD("SAP >>> getRegisteredServiceAgent() >>> %d", result); } while (result != SAP_RESULT_SUCCESS); return TRUE; @@ -1254,7 +1254,7 @@ gboolean initialize_sap(void) sap_agent_h agent = NULL; if (priv_data.agent) { - LOGW("duplicate initialize"); + STLOGW("duplicate initialize"); return FALSE; } @@ -1271,21 +1271,21 @@ gboolean initialize_sap(void) void deinitialize_sap(void) { - LOGD("deinitialize"); + STLOGD("deinitialize"); if (priv_data.agent) { int ret = sap_agent_deinitialize(priv_data.agent, on_agent_deinitialized, NULL); switch (ret) { case SAP_RESULT_FAILURE: - LOGW("Failed to deinitialize"); + STLOGW("Failed to deinitialize"); break; case SAP_RESULT_SUCCESS: - LOGD("Succeed to deinitialize"); + STLOGD("Succeed to deinitialize"); break; case SAP_RESULT_PERMISSION_DENIED: - LOGW("permission denied: deinitialize "); + STLOGW("permission denied: deinitialize "); break; default: - LOGD("deinitialize : %d", ret); + STLOGD("deinitialize : %d", ret); break; } diff --git a/receiver/src/main.cpp b/receiver/src/main.cpp index d8797dd..783ac2d 100644 --- a/receiver/src/main.cpp +++ b/receiver/src/main.cpp @@ -47,7 +47,7 @@ static bool app_create(void *data) return true; } - LOGD(""); + STLOGD(""); char log_path[PATH_MAX]; char *data_path = NULL; @@ -59,7 +59,7 @@ static bool app_create(void *data) if (access(log_path, F_OK) != 0) { if (mkdir(log_path, 0755) == -1) { - LOGE("directory create error"); + STLOGE("directory create error"); } } @@ -77,7 +77,7 @@ static bool check_battery_condition() ret = device_battery_get_percent(&battery_percentage); if (ret != DEVICE_ERROR_NONE) { - LOGW("No sync. Failed to get battery percent. error : %d", ret); + STLOGW("No sync. Failed to get battery percent. error : %d", ret); return false; } @@ -103,16 +103,16 @@ static bool check_sync_time_condition() { if (preference_get_double(LAST_SYNC_TIME, &last_sync_time) != PREFERENCE_ERROR_NONE) { - LOGD("Can't get last sync time."); + STLOGD("Can't get last sync time."); return true; } // compare time double timediff = ecore_time_unix_get() - last_sync_time; - LOGD("current time : %.3f, last_sync_time : %.3f, diff : %.3f", ecore_time_unix_get(), last_sync_time, timediff); + STLOGD("current time : %.3f, last_sync_time : %.3f, diff : %.3f", ecore_time_unix_get(), last_sync_time, timediff); if (timediff > MAX_WAIT_TIME) { - LOGD("Starting manual synchronization"); + STLOGD("Starting manual synchronization"); initialize_sap(); request_show_sync_notification(); result = false; @@ -169,7 +169,7 @@ static void app_control(app_control_h app_control, void *data) // operation int ret = app_control_get_operation(app_control, &operation); if (ret == APP_CONTROL_ERROR_NONE) { - LOGD("operation: %s", operation); + STLOGD("operation: %s", operation); if (!operation) { goto cleanup; @@ -190,7 +190,7 @@ static void app_control(app_control_h app_control, void *data) if (!is_init_sap()) { if (check_sync_time_condition()) { if (check_battery_condition()) { - LOGD("Starting auto synchronization"); + STLOGD("Starting auto synchronization"); initialize_sap(); request_sticker_feature(); request_auto_sync(); @@ -199,13 +199,13 @@ static void app_control(app_control_h app_control, void *data) else { if (!get_job_progress()) { - LOGD("exit"); + STLOGD("exit"); service_app_exit(); } } } else { - LOGD("continue doing current job"); + STLOGD("continue doing current job"); } } free(event_value); @@ -216,7 +216,7 @@ static void app_control(app_control_h app_control, void *data) } } else { - LOGW("Failed to get operation. error : %d", ret); + STLOGW("Failed to get operation. error : %d", ret); } // sync request @@ -225,12 +225,12 @@ static void app_control(app_control_h app_control, void *data) if (strcmp(request, "sync") == 0) { bool param_error = false; if (app_control_get_extra_data(app_control, "mode", &mode) != APP_CONTROL_ERROR_NONE) { - LOGE("No given mode"); + STLOGE("No given mode"); param_error = true; } if (app_control_get_extra_data(app_control, "type", &type) != APP_CONTROL_ERROR_NONE) { - LOGE("No given type"); + STLOGE("No given type"); param_error = true; } @@ -251,7 +251,7 @@ static void app_control(app_control_h app_control, void *data) } else { - LOGW("Unknown command : %s", request); + STLOGW("Unknown command : %s", request); if (!is_init_sap()) { service_app_exit(); @@ -276,7 +276,7 @@ cleanup: static void app_terminate(void *data) { /* Release all resources. */ - LOGD(""); + STLOGD(""); destroy_sticker_provider_handle(); deinitialize_sap(); } @@ -294,7 +294,7 @@ int main(int argc, char *argv[]) ret = service_app_main(argc, argv, &event_callback, NULL); if (ret != APP_ERROR_NONE) { - LOGE("app_main() is failed. err = %d", ret); + STLOGE("app_main() is failed. err = %d", ret); } return ret; } diff --git a/receiver/src/message.cpp b/receiver/src/message.cpp index 80b69da..0abac07 100644 --- a/receiver/src/message.cpp +++ b/receiver/src/message.cpp @@ -36,7 +36,7 @@ bool send_message(const char *cmd, const char *data) ret = event_publish_app_event(EVENT_NAME, b); if (ret != EVENT_ERROR_NONE) { result = false; - LOGE("Failed to send message by event publish. error : %d", ret); + STLOGE("Failed to send message by event publish. error : %d", ret); } else { diff --git a/receiver/src/sticker_info.cpp b/receiver/src/sticker_info.cpp index 650d880..435d507 100644 --- a/receiver/src/sticker_info.cpp +++ b/receiver/src/sticker_info.cpp @@ -35,14 +35,14 @@ int len, const char* group, const char* thumbnail, const char* description, stic ret = sticker_data_create(&sticker_data); if (ret != STICKER_ERROR_NONE) { /* Error handling */ - LOGE("Failed to create sticker data"); + STLOGE("Failed to create sticker data"); } /* Sets the URI and URI type of the sticker */ ret = sticker_data_set_uri(sticker_data, type, uri); if (ret != STICKER_ERROR_NONE) { /* Error handling */ - LOGE("Failed to set uri"); + STLOGE("Failed to set uri"); } //for (int i = 0; i < len; i++) @@ -51,7 +51,7 @@ int len, const char* group, const char* thumbnail, const char* description, stic ret = sticker_data_add_keyword(sticker_data, keyword); if (ret != STICKER_ERROR_NONE) { /* Error handling */ - LOGE("Failed to add keyword"); + STLOGE("Failed to add keyword"); } } @@ -59,7 +59,7 @@ int len, const char* group, const char* thumbnail, const char* description, stic ret = sticker_data_set_group_name(sticker_data, group); if (ret != STICKER_ERROR_NONE) { /* Error handling */ - LOGE("Failed to set group name"); + STLOGE("Failed to set group name"); } /* Sets the thumbnail local path of the sticker */ @@ -67,7 +67,7 @@ int len, const char* group, const char* thumbnail, const char* description, stic ret = sticker_data_set_thumbnail(sticker_data, thumbnail); if (ret != STICKER_ERROR_NONE) { /* Error handling */ - LOGE("Failed to set thumbnail"); + STLOGE("Failed to set thumbnail"); } } @@ -75,14 +75,14 @@ int len, const char* group, const char* thumbnail, const char* description, stic ret = sticker_data_set_description(sticker_data, description); if (ret != STICKER_ERROR_NONE) { /* Error handling */ - LOGE("Failed to set description"); + STLOGE("Failed to set description"); } /* Sets the display type of the sticker.*/ ret = sticker_data_set_display_type(sticker_data, disp_type); if (ret != STICKER_ERROR_NONE) { /* Error handling */ - LOGE("Failed to set display type"); + STLOGE("Failed to set display type"); } return sticker_data; @@ -104,7 +104,7 @@ insert_sticker_data(const char *filepath, const char *keyword, const char *group ret = sticker_provider_insert_data(sticker_provider, data_handle); if (ret != STICKER_ERROR_NONE) { - LOGE("Failed to insert data. error code : %x. message : %s", ret, get_error_message(ret)); + STLOGE("Failed to insert data. error code : %x. message : %s", ret, get_error_message(ret)); } else { LOGI("Succeeded to insert data"); @@ -114,7 +114,7 @@ insert_sticker_data(const char *filepath, const char *keyword, const char *group ret = sticker_data_destroy(data_handle); if (ret != STICKER_ERROR_NONE) { /* Error handling */ - LOGE("Failed to destroy sticker data"); + STLOGE("Failed to destroy sticker data"); } } @@ -124,7 +124,7 @@ void create_sticker_provider_handle(void) ret = sticker_provider_create(&sticker_provider); if (ret != STICKER_ERROR_NONE) { /* Error handling */ - LOGE("Failed to create sticker provider. ret : %d", ret); + STLOGE("Failed to create sticker provider. ret : %d", ret); } } @@ -139,7 +139,7 @@ void delete_sticker_data(const char *fileName) int ret; ret = sticker_provider_delete_data_by_uri(sticker_provider, fileName); if (ret != STICKER_ERROR_NONE) - LOGE("Failed to delete sticker. ret : %d", ret); + STLOGE("Failed to delete sticker. ret : %d", ret); } static void _delete_all_stickers_cb(sticker_data_h data_handle, void *user_data) @@ -150,12 +150,12 @@ static void _delete_all_stickers_cb(sticker_data_h data_handle, void *user_data) ret = sticker_data_get_group_name(data_handle, &sticker_group); if (ret != STICKER_ERROR_NONE) - LOGE("Failed to get group name. ret : %d", ret); + STLOGE("Failed to get group name. ret : %d", ret); if (strcmp(sticker_group, del_group) == 0) { ret = sticker_provider_delete_data(sticker_provider, data_handle); if (ret != STICKER_ERROR_NONE) - LOGE("Failed to delete sticker. ret : %d", ret); + STLOGE("Failed to delete sticker. ret : %d", ret); } } @@ -167,9 +167,9 @@ void delete_all_stickers(const char *groupName) ret = sticker_provider_get_sticker_count(sticker_provider, &total_cnt); if (ret != STICKER_ERROR_NONE) - LOGE("Failed to get sticker count. ret : %d", ret); + STLOGE("Failed to get sticker count. ret : %d", ret); ret = sticker_provider_data_foreach_all(sticker_provider, 0, total_cnt, &result, _delete_all_stickers_cb, (void *)groupName); if (ret != STICKER_ERROR_NONE) - LOGE("Failed to retrieve all sticker data. ret : %d", ret); + STLOGE("Failed to retrieve all sticker data. ret : %d", ret); } \ No newline at end of file -- 2.7.4 From e4988dd06737e4637cdc02ad93f2eb0e95c7f0b8 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Fri, 7 Aug 2020 13:49:14 +0900 Subject: [PATCH 15/16] Remove unused alarm privilege Change-Id: Ie576a87b3558d5d096b9ebc87bd86245026aaf5d Signed-off-by: Jihoon Kim --- receiver/tizen-manifest.xml | 2 -- 1 file changed, 2 deletions(-) diff --git a/receiver/tizen-manifest.xml b/receiver/tizen-manifest.xml index f4db12c..b4889cd 100644 --- a/receiver/tizen-manifest.xml +++ b/receiver/tizen-manifest.xml @@ -17,8 +17,6 @@ http://developer.samsung.com/tizen/privilege/accessoryprotocol http://tizen.org/privilege/content.write http://tizen.org/privilege/appdir.shareddata - http://tizen.org/privilege/alarm.set - http://tizen.org/privilege/alarm.get http://tizen.org/privilege/appmanager.launch -- 2.7.4 From e809fdec8c457128406987c7c22336b865ab2881 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Fri, 7 Aug 2020 13:53:40 +0900 Subject: [PATCH 16/16] Launch sticker-receiver for receiving sticker feature Change-Id: I4a0851c30ffdf10917bfec9dd1adf643e6ba80d3 Signed-off-by: Jihoon Kim --- receiver/src/main.cpp | 15 +++++++++++++++ receiver/tizen-manifest.xml | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/receiver/src/main.cpp b/receiver/src/main.cpp index 783ac2d..a829059 100644 --- a/receiver/src/main.cpp +++ b/receiver/src/main.cpp @@ -214,6 +214,21 @@ static void app_control(app_control_h app_control, void *data) free(uri); } } + else if (strcmp(operation, APP_CONTROL_OPERATION_DEFAULT) == 0) { +#ifdef VCONFKEY_STICKER_SUPPORTED_FEATURE + // Check whether oobe has been done + int feature_flag = 0; + if (vconf_get_int(VCONFKEY_STICKER_SUPPORTED_FEATURE, &feature_flag) == 0 && feature_flag == 0) { + STLOGD("Request to get sticker feature"); + initialize_sap(); + request_sticker_feature(); + } + else { + if (!is_init_sap()) + service_app_exit(); + } +#endif + } } else { STLOGW("Failed to get operation. error : %d", ret); diff --git a/receiver/tizen-manifest.xml b/receiver/tizen-manifest.xml index b4889cd..247a220 100644 --- a/receiver/tizen-manifest.xml +++ b/receiver/tizen-manifest.xml @@ -1,7 +1,7 @@ - + -- 2.7.4