From 9bcfc53a60e80e580d1c5d183782278a5e28443b Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Wed, 5 Aug 2020 11:29:13 +0900 Subject: [PATCH 01/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 02/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 03/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 04/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 05/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 06/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 07/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 From f18f93b78567452c24465b956f1bba41d5375840 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Fri, 7 Aug 2020 15:04:23 +0900 Subject: [PATCH 08/16] Update package version to 0.1.61 Change-Id: Iac8c9f83602addcce8e695923762238e6ebb8fdc 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 7453cc6..0e1f5c9 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.60 +Version: 0.1.61 Release: 1 Group: Graphics & UI Framework/Input License: Apache-2.0 diff --git a/receiver/tizen-manifest.xml b/receiver/tizen-manifest.xml index 247a220..d4cdf2e 100644 --- a/receiver/tizen-manifest.xml +++ b/receiver/tizen-manifest.xml @@ -1,5 +1,5 @@ - + -- 2.7.4 From 5536db9e95adae1016e7b537552ce318ac225a02 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Mon, 10 Aug 2020 15:03:16 +0900 Subject: [PATCH 09/16] Replace LOGI with STLOGI in sticker-receiver Change-Id: I55fafa0fad8a753a49a6eb31e6dc9785baad8861 Signed-off-by: Jihoon Kim --- receiver/src/ft.cpp | 38 +++++++++++++++++++------------------- receiver/src/main.cpp | 6 +++--- receiver/src/sticker_info.cpp | 4 ++-- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/receiver/src/ft.cpp b/receiver/src/ft.cpp index eda0692..629d54f 100644 --- a/receiver/src/ft.cpp +++ b/receiver/src/ft.cpp @@ -98,7 +98,7 @@ static void save_last_sync_time() // save last sync time in preference double current_time = ecore_time_unix_get(); if (preference_set_double(LAST_SYNC_TIME, current_time) == PREFERENCE_ERROR_NONE) { - LOGI("Succeed to set last sync time : %f", current_time); + STLOGI("Succeed to set last sync time : %f", current_time); } else { STLOGW("Failed to set last sync time"); @@ -189,7 +189,7 @@ static void notify_sync_progress(unsigned int file_progress) if (total_file_count_in_group == 0) return; - LOGI("(%2d / %2d), file progress : %3u%%", rec_file_cnt_in_group+1, total_file_count_in_group, file_progress); + STLOGI("(%2d / %2d), file progress : %3u%%", rec_file_cnt_in_group+1, total_file_count_in_group, file_progress); send_message("sync_progress", NULL); } @@ -204,13 +204,13 @@ static void _on_transfer_completed(sap_file_transaction_h file_transaction, } if (result == SAP_FT_TRANSFER_SUCCESS) { - LOGI("Transfer Completed"); + STLOGI("Transfer Completed"); if (chmod(sticker_data.file_path.c_str(), S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH) == -1) { 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()); + STLOGI("Succeed to change permission : %s", sticker_data.file_path.c_str()); char thumb_path[PATH_MAX]; char *data_path = NULL; data_path = app_get_shared_data_path(); @@ -300,7 +300,7 @@ static void _on_transfer_file_in_progress(sap_file_transaction_h file_transactio static void __set_file_transfer_cb(sap_file_transaction_h file_socket) { - LOGI("# set callbacks"); + STLOGI("# set callbacks"); sap_file_transfer_set_progress_cb(file_socket, _on_transfer_file_in_progress, NULL); sap_file_transfer_set_done_cb(file_socket, _on_transfer_completed, NULL); @@ -318,9 +318,9 @@ void accept_file() char *data_path = NULL; data_path = app_get_shared_data_path(); - LOGI("Path : %s", data_path); + STLOGI("Path : %s", data_path); snprintf(file_path, sizeof(file_path), "%s/%s", data_path, incoming_file_name.c_str()); - LOGI("Receive filepath : %s", file_path); + STLOGI("Receive filepath : %s", file_path); sticker_data.file_path = string(file_path); if (data_path) @@ -335,7 +335,7 @@ void accept_file() STLOGW("Fail"); break; case SAP_RESULT_SUCCESS: - LOGI("Success"); + STLOGI("Success"); break; } @@ -377,7 +377,7 @@ bool request_sticker_data(const char *mode, const char *category, const char *ty pending_request.type = string(type ? type : "input"); ReqQueue.push(pending_request); - LOGI("Push sync request"); + STLOGI("Push sync request"); return false; } @@ -505,7 +505,7 @@ void request_sticker_feature() StickerRequest pending_request; pending_request.req_type = REQUEST_TYPE_FEATURE_REQ; ReqQueue.push(pending_request); - LOGI("Push sync feature request"); + STLOGI("Push sync feature request"); return; } @@ -559,7 +559,7 @@ void request_show_sync_notification() StickerRequest pending_request; pending_request.req_type = REQUEST_TYPE_SHOW_NOTIFICATION; ReqQueue.push(pending_request); - LOGI("Push show notification request"); + STLOGI("Push show notification request"); return; } @@ -584,7 +584,7 @@ void request_show_sync_notification() void reject_file() { int ret = sap_file_transfer_reject(priv_data.file_socket); - LOGI("ret : %d", ret); + STLOGI("ret : %d", ret); file_on_progress = FALSE; } @@ -596,14 +596,14 @@ static void _on_transfer_file_cb(sap_peer_agent_h peer_agent_h, { file_on_progress = TRUE; priv_data.file_socket = socket; - LOGI("# incoming file request."); + STLOGI("# incoming file request."); __set_file_transfer_cb(priv_data.file_socket); incoming_file_name = file_path; std::size_t found = incoming_file_name.find_last_of("/"); incoming_file_name = incoming_file_name.substr(found+1); - LOGI("# file path : %s, incoming file name : %s", file_path, incoming_file_name.c_str()); + STLOGI("# file path : %s, incoming file name : %s", file_path, incoming_file_name.c_str()); accept_file(); } @@ -724,7 +724,7 @@ on_data_received(sap_socket_h socket, unsigned short int channel_id, unsigned in void *user_data) /* message exchange on_receive callback (sap_agent_data_received_cb) */ { unsigned int buf_len = strlen((char *)buffer); - LOGI("received data: %s, len: %d, buffer len : %d", (char *)buffer, payload_length, buf_len); + STLOGI("received data: %s, len: %d, buffer len : %d", (char *)buffer, payload_length, buf_len); JsonParser *parser = json_parser_new(); GError *err_msg = NULL; @@ -994,7 +994,7 @@ static void on_conn_req(sap_peer_agent_h peer_agent, switch (result) { case SAP_CONNECTION_SUCCESS: - LOGI("Connection success"); + STLOGI("Connection success"); priv_data.socket = socket; sap_peer_agent_accept_service_connection(peer_agent); sap_peer_agent_set_service_connection_terminated_cb(peer_agent, conn_terminated, &priv_data); @@ -1002,7 +1002,7 @@ static void on_conn_req(sap_peer_agent_h peer_agent, break; case SAP_CONNECTION_ALREADY_EXIST: priv_data.socket = socket; - LOGI("Connection Already Exist"); + STLOGI("Connection Already Exist"); break; case SAP_CONNECTION_FAILURE_DEVICE_UNREACHABLE: STLOGW("Connection failure device unreachable"); @@ -1045,7 +1045,7 @@ _on_service_connection_created(sap_peer_agent_h peer_agent, sap_socket_set_data_received_cb(socket, on_data_received, peer_agent); priv->socket = socket; - LOGI("Connection Established"); + STLOGI("Connection Established"); process_request_queue(); @@ -1053,7 +1053,7 @@ _on_service_connection_created(sap_peer_agent_h peer_agent, case SAP_CONNECTION_ALREADY_EXIST: priv->socket = socket; - LOGI("Connection Already Exist"); + STLOGI("Connection Already Exist"); break; case SAP_CONNECTION_FAILURE_DEVICE_UNREACHABLE: diff --git a/receiver/src/main.cpp b/receiver/src/main.cpp index a829059..07e6a24 100644 --- a/receiver/src/main.cpp +++ b/receiver/src/main.cpp @@ -81,12 +81,12 @@ static bool check_battery_condition() return false; } - LOGI("battery percent : %d", battery_percentage); + STLOGI("battery percent : %d", battery_percentage); if (battery_percentage >= MINIMUM_BATTERY) return true; else { - LOGI("No sync due to insufficient battery"); + STLOGI("No sync due to insufficient battery"); return false; } } @@ -249,7 +249,7 @@ static void app_control(app_control_h app_control, void *data) param_error = true; } - LOGI("[sync request] mode : %s, type : %s", mode, type); + STLOGI("[sync request] mode : %s, type : %s", mode, type); if (param_error) goto cleanup; diff --git a/receiver/src/sticker_info.cpp b/receiver/src/sticker_info.cpp index 435d507..fa7c2ff 100644 --- a/receiver/src/sticker_info.cpp +++ b/receiver/src/sticker_info.cpp @@ -107,7 +107,7 @@ insert_sticker_data(const char *filepath, const char *keyword, const char *group STLOGE("Failed to insert data. error code : %x. message : %s", ret, get_error_message(ret)); } else { - LOGI("Succeeded to insert data"); + STLOGI("Succeeded to insert data"); } /* Destroys a sticker data handle */ @@ -172,4 +172,4 @@ void delete_all_stickers(const char *groupName) ret = sticker_provider_data_foreach_all(sticker_provider, 0, total_cnt, &result, _delete_all_stickers_cb, (void *)groupName); if (ret != STICKER_ERROR_NONE) STLOGE("Failed to retrieve all sticker data. ret : %d", ret); -} \ No newline at end of file +} -- 2.7.4 From 94a46fbd63e3ea1abfdc5f518be311d4b979194d Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Tue, 11 Aug 2020 21:03:44 +0900 Subject: [PATCH 10/16] Fix bug not to send sticker count in manual request mode Change-Id: I08d4ac51189d9637f525be0a6fd24830faa11e35 Signed-off-by: Jihoon Kim --- receiver/src/main.cpp | 109 ++++++++++++++++++++++++++------------------------ 1 file changed, 57 insertions(+), 52 deletions(-) diff --git a/receiver/src/main.cpp b/receiver/src/main.cpp index 07e6a24..7fa1a9f 100644 --- a/receiver/src/main.cpp +++ b/receiver/src/main.cpp @@ -195,10 +195,15 @@ static void app_control(app_control_h app_control, void *data) request_sticker_feature(); request_auto_sync(); } + else { + if (!get_job_progress()) { + STLOGD("exit"); + service_app_exit(); + } + } } else { - if (!get_job_progress()) - { + if (!get_job_progress()) { STLOGD("exit"); service_app_exit(); } @@ -215,63 +220,63 @@ static void app_control(app_control_h app_control, void *data) } } 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); - } - - // sync request - res = app_control_get_extra_data(app_control, "request", &request); - if (APP_CONTROL_ERROR_NONE == res && NULL != request) { - if (strcmp(request, "sync") == 0) { - bool param_error = false; - if (app_control_get_extra_data(app_control, "mode", &mode) != APP_CONTROL_ERROR_NONE) { - STLOGE("No given mode"); - param_error = true; - } + // sync request + res = app_control_get_extra_data(app_control, "request", &request); + if (APP_CONTROL_ERROR_NONE == res && NULL != request) { + if (strcmp(request, "sync") == 0) { + bool param_error = false; + if (app_control_get_extra_data(app_control, "mode", &mode) != APP_CONTROL_ERROR_NONE) { + STLOGE("No given mode"); + param_error = true; + } - if (app_control_get_extra_data(app_control, "type", &type) != APP_CONTROL_ERROR_NONE) { - STLOGE("No given type"); - param_error = true; - } + if (app_control_get_extra_data(app_control, "type", &type) != APP_CONTROL_ERROR_NONE) { + STLOGE("No given type"); + param_error = true; + } - STLOGI("[sync request] mode : %s, type : %s", mode, type); - if (param_error) - goto cleanup; + STLOGI("[sync request] mode : %s, type : %s", mode, type); + if (param_error) + goto cleanup; - if (mode && type) { - if (!is_init_sap()) { + if (mode && type) { + if (!is_init_sap()) { + initialize_sap(); + request_all_sticker_data(mode, type); + } + } + } + else if (strcmp(request, "oobe") == 0) { initialize_sap(); - request_all_sticker_data(mode, type); + request_sticker_feature(); + } + else { + STLOGW("Unknown command : %s", request); + if (!is_init_sap()) { + service_app_exit(); + } + } + } // end of request + else { + STLOGD("booting"); +#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 if (strcmp(request, "oobe") == 0) { - initialize_sap(); - request_sticker_feature(); - } - else - { - STLOGW("Unknown command : %s", request); - if (!is_init_sap()) - { - service_app_exit(); - } - } + } + else { + STLOGW("Failed to get operation. error : %d", ret); } cleanup: -- 2.7.4 From b8e8a37808e2e10f34c353e01a36d4d9e71e14ac Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Wed, 12 Aug 2020 14:14:09 +0900 Subject: [PATCH 11/16] Refactor code to process request Change-Id: Ied2db039175209241d47af7322db70fcb2b4088c Signed-off-by: Jihoon Kim --- receiver/src/main.cpp | 95 ++++++++++++++++++++++++++++----------------------- 1 file changed, 52 insertions(+), 43 deletions(-) diff --git a/receiver/src/main.cpp b/receiver/src/main.cpp index 7fa1a9f..06c2c4f 100644 --- a/receiver/src/main.cpp +++ b/receiver/src/main.cpp @@ -151,12 +151,57 @@ bool check_rw_mount() return rw_mount; } +static void process_request(app_control_h app_control, char *request) +{ + char* mode = NULL; + char* type = NULL; + + if (strcmp(request, "sync") == 0) { + bool param_error = false; + if (app_control_get_extra_data(app_control, "mode", &mode) != APP_CONTROL_ERROR_NONE) { + STLOGE("No given mode"); + param_error = true; + } + + if (app_control_get_extra_data(app_control, "type", &type) != APP_CONTROL_ERROR_NONE) { + STLOGE("No given type"); + param_error = true; + } + + STLOGI("[sync request] mode : %s, type : %s", mode, type); + if (param_error) + goto cleanup; + + if (mode && type) { + if (!is_init_sap()) { + initialize_sap(); + request_all_sticker_data(mode, type); + } + } + } + else if (strcmp(request, "oobe") == 0) { + initialize_sap(); + request_sticker_feature(); + } + else { + STLOGW("Unknown command : %s", request); + if (!is_init_sap()) { + service_app_exit(); + } + } + +cleanup: + if (NULL != mode) + free(mode); + + if (NULL != type) + free(type); +} + static void app_control(app_control_h app_control, void *data) { /* Handle the launch request. */ char* request = NULL; - char* mode = NULL; - char* type = NULL; char* operation = NULL; char* event_value = NULL; char* uri = NULL; @@ -187,6 +232,7 @@ static void app_control(app_control_h app_control, void *data) { if (string(event_value) == "connected") { + STLOGI("The charger state is connected"); if (!is_init_sap()) { if (check_sync_time_condition()) { if (check_battery_condition()) { @@ -196,6 +242,7 @@ static void app_control(app_control_h app_control, void *data) request_auto_sync(); } else { + STLOGI("The status of battery is low"); if (!get_job_progress()) { STLOGD("exit"); service_app_exit(); @@ -220,43 +267,11 @@ static void app_control(app_control_h app_control, void *data) } } else if (strcmp(operation, APP_CONTROL_OPERATION_DEFAULT) == 0) { - // sync request res = app_control_get_extra_data(app_control, "request", &request); + STLOGD("get extra data result : %d, request : %s", res, request); if (APP_CONTROL_ERROR_NONE == res && NULL != request) { - if (strcmp(request, "sync") == 0) { - bool param_error = false; - if (app_control_get_extra_data(app_control, "mode", &mode) != APP_CONTROL_ERROR_NONE) { - STLOGE("No given mode"); - param_error = true; - } - - if (app_control_get_extra_data(app_control, "type", &type) != APP_CONTROL_ERROR_NONE) { - STLOGE("No given type"); - param_error = true; - } - - STLOGI("[sync request] mode : %s, type : %s", mode, type); - if (param_error) - goto cleanup; - - if (mode && type) { - if (!is_init_sap()) { - initialize_sap(); - request_all_sticker_data(mode, type); - } - } - } - else if (strcmp(request, "oobe") == 0) { - initialize_sap(); - request_sticker_feature(); - } - else { - STLOGW("Unknown command : %s", request); - if (!is_init_sap()) { - service_app_exit(); - } - } - } // end of request + process_request(app_control, request); + } else { STLOGD("booting"); #ifdef VCONFKEY_STICKER_SUPPORTED_FEATURE @@ -285,12 +300,6 @@ cleanup: if (NULL != request) free(request); - - if (NULL != mode) - free(mode); - - if (NULL != type) - free(type); } static void app_terminate(void *data) -- 2.7.4 From 1c0c2a4b1dbbf4837c1d45ed27e99863f5fcb5d4 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Wed, 12 Aug 2020 14:28:30 +0900 Subject: [PATCH 12/16] Refactor sticker-receiver code Change-Id: I792ee0ddafc74b9de4773f6ced7aa37ec8840d5c Signed-off-by: Jihoon Kim --- receiver/src/main.cpp | 146 +++++++++++++++++++++++++++----------------------- 1 file changed, 78 insertions(+), 68 deletions(-) diff --git a/receiver/src/main.cpp b/receiver/src/main.cpp index 06c2c4f..aa196e1 100644 --- a/receiver/src/main.cpp +++ b/receiver/src/main.cpp @@ -198,6 +198,53 @@ cleanup: free(type); } +static void process_auto_sync() +{ + if (is_init_sap()) { + STLOGD("continue doing current job"); + return; + } + + if (check_sync_time_condition()) { + if (check_battery_condition()) { + STLOGD("Starting auto synchronization"); + initialize_sap(); + request_sticker_feature(); + request_auto_sync(); + } + else { + STLOGI("The status of battery is low"); + if (!get_job_progress()) { + STLOGD("exit"); + service_app_exit(); + } + } + } + else { + if (!get_job_progress()) { + STLOGD("exit"); + service_app_exit(); + } + } +} + +static void get_sticker_feature() +{ +#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 +} + static void app_control(app_control_h app_control, void *data) { /* Handle the launch request. */ @@ -213,85 +260,48 @@ 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) { - STLOGD("operation: %s", operation); + if (ret != APP_CONTROL_ERROR_NONE) { + STLOGW("Failed to get operation. error : %d", ret); + return; + } - if (!operation) { - goto cleanup; - } + STLOGD("operation: %s", operation); - if (strcmp(operation, APP_CONTROL_OPERATION_LAUNCH_ON_EVENT) == 0) + if (!operation) { + goto cleanup; + } + + if (strcmp(operation, APP_CONTROL_OPERATION_LAUNCH_ON_EVENT) == 0) + { + ret = app_control_get_uri(app_control, &uri); + if (ret == APP_CONTROL_ERROR_NONE && uri) { - ret = app_control_get_uri(app_control, &uri); - if (ret == APP_CONTROL_ERROR_NONE && uri) + if (strncmp(uri, event_uri, strlen(event_uri) + 1) == 0) { - if (strncmp(uri, event_uri, strlen(event_uri) + 1) == 0) + ret = app_control_get_extra_data(app_control, "battery_charger_status", &event_value); + if (ret == APP_CONTROL_ERROR_NONE && event_value) { - ret = app_control_get_extra_data(app_control, "battery_charger_status", &event_value); - if (ret == APP_CONTROL_ERROR_NONE && event_value) + if (string(event_value) == "connected") { - if (string(event_value) == "connected") - { - STLOGI("The charger state is connected"); - if (!is_init_sap()) { - if (check_sync_time_condition()) { - if (check_battery_condition()) { - STLOGD("Starting auto synchronization"); - initialize_sap(); - request_sticker_feature(); - request_auto_sync(); - } - else { - STLOGI("The status of battery is low"); - if (!get_job_progress()) { - STLOGD("exit"); - service_app_exit(); - } - } - } - else { - if (!get_job_progress()) { - STLOGD("exit"); - service_app_exit(); - } - } - } - else { - STLOGD("continue doing current job"); - } - } - free(event_value); + STLOGI("The charger state is connected"); + process_auto_sync(); } + free(event_value); } - free(uri); } - } - else if (strcmp(operation, APP_CONTROL_OPERATION_DEFAULT) == 0) { - res = app_control_get_extra_data(app_control, "request", &request); - STLOGD("get extra data result : %d, request : %s", res, request); - if (APP_CONTROL_ERROR_NONE == res && NULL != request) { - process_request(app_control, request); - } - else { - STLOGD("booting"); -#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 + free(uri); } } - else { - STLOGW("Failed to get operation. error : %d", ret); + else if (strcmp(operation, APP_CONTROL_OPERATION_DEFAULT) == 0) { + res = app_control_get_extra_data(app_control, "request", &request); + STLOGD("get extra data result : %d, request : %s", res, request); + if (APP_CONTROL_ERROR_NONE == res && NULL != request) { + process_request(app_control, request); + } + else { + STLOGD("booting"); + get_sticker_feature(); + } } cleanup: -- 2.7.4 From ae8e45c2dcd894eb240e40588c5361651177d674 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Thu, 27 Aug 2020 15:52:43 +0900 Subject: [PATCH 13/16] Update package version to 0.1.62 Change-Id: Id34d1c618e3101205adc1fa6f937a087845193d5 Signed-off-by: Jihoon Kim --- packaging/capi-ui-sticker.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/capi-ui-sticker.spec b/packaging/capi-ui-sticker.spec index 0e1f5c9..db80dc6 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.61 +Version: 0.1.62 Release: 1 Group: Graphics & UI Framework/Input License: Apache-2.0 -- 2.7.4 From 6d4992a666245ca13b9baa3508744d92d2a06d84 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Fri, 28 Aug 2020 17:47:34 +0900 Subject: [PATCH 14/16] Fix memory leak in unittest Change-Id: I94f9c8f034e03a61f78ffd6e1f056c063f3d6e8c Signed-off-by: Jihoon Kim --- tests/src/sticker_data_unittests.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/src/sticker_data_unittests.cc b/tests/src/sticker_data_unittests.cc index 7b0294c..57002ce 100644 --- a/tests/src/sticker_data_unittests.cc +++ b/tests/src/sticker_data_unittests.cc @@ -71,6 +71,7 @@ TEST_F(StickerDataTest, utc_sticker_data_create_p) sticker_data_h sd_h = NULL; int ret = sticker_data_create(&sd_h); + sticker_data_destroy(sd_h); EXPECT_EQ(ret, STICKER_ERROR_NONE); } -- 2.7.4 From 7e02649b83094d076abd4243c425397bdeb5d5fa Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Fri, 4 Sep 2020 16:46:23 +0900 Subject: [PATCH 15/16] Fix ASAN build error Change-Id: I1a05babc1efec70b52b21fb1ce77d8ab272e47e2 Signed-off-by: Jihoon Kim --- packaging/capi-ui-sticker.spec | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/packaging/capi-ui-sticker.spec b/packaging/capi-ui-sticker.spec index b2f3e04..db9f3b1 100644 --- a/packaging/capi-ui-sticker.spec +++ b/packaging/capi-ui-sticker.spec @@ -126,13 +126,6 @@ find . -name '*.gcno' | tar cf %{name}-gcov.tar -T - rm -rf %{buildroot} %make_install -%check -ctest --output-on-failure %{?_smp_mflags} -%if 0%{?gcov:1} -lcov -c --ignore-errors graph --no-external -q -d . -o gcov.info -genhtml gcov.info -%endif - mkdir -p %{buildroot}/%{TZ_SYS_ETC}/dump.d/module.d cp -af dump/sticker_log_dump.sh %{buildroot}/%{TZ_SYS_ETC}/dump.d/module.d @@ -158,6 +151,13 @@ tar xf %{name}-gcov.tar -C %{buildroot}%{_datadir}/gcov/obj %define tizen_dist_sign 1 %endif +%check +ctest --output-on-failure %{?_smp_mflags} +%if 0%{?gcov:1} +lcov -c --ignore-errors graph --no-external -q -d . -o gcov.info +genhtml gcov.info +%endif + %post /sbin/ldconfig -- 2.7.4 From 476c2b7f3ca54ea7bfb3db61b16b4cc0849ed9c5 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Fri, 4 Sep 2020 16:47:16 +0900 Subject: [PATCH 16/16] Update package version to 0.1.63 Change-Id: I7e6ff9cb77739d039728a5dc4e5caf58a0423db5 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 db9f3b1..9a49a50 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.62 +Version: 0.1.63 Release: 1 Group: Graphics & UI Framework/Input License: Apache-2.0 diff --git a/receiver/tizen-manifest.xml b/receiver/tizen-manifest.xml index d4cdf2e..b8c75ad 100644 --- a/receiver/tizen-manifest.xml +++ b/receiver/tizen-manifest.xml @@ -1,5 +1,5 @@ - + -- 2.7.4