From 510473db3dd0d55cdbd8aaf926359828920a7f7e Mon Sep 17 00:00:00 2001 From: DoHyun Pyun Date: Tue, 7 Feb 2017 14:30:33 +0900 Subject: [PATCH] Merge latest tizen_3.0 bug fix codes -------------------------------------------------- commit 178bae0d9b723525553ed8455af6a2abcb385145 Author: Lee Hyuk Date: Mon Jan 9 18:06:27 2017 +0900 Fix the MMC down load state(TSAM-12498) -------------------------------------------------- Change-Id: I3e68e25aee2754d309a57a2f2f2ee96195cd8d98 Signed-off-by: DoHyun Pyun --- bt-share/include/bt-share-notification.h | 2 +- bt-share/src/bt-share-ipc.c | 6 +-- bt-share/src/bt-share-noti-handler.c | 29 +++++++++++ bt-share/src/bt-share-notification.c | 58 +++++++++++++--------- bt-share/src/obex-event-handler.c | 32 +++++------- ...e_upgrade.sh => 500.bluetooth-share_upgrade.sh} | 0 packaging/bluetooth-share.spec | 4 +- 7 files changed, 83 insertions(+), 48 deletions(-) rename packaging/{bluetooth-share_upgrade.sh => 500.bluetooth-share_upgrade.sh} (100%) diff --git a/bt-share/include/bt-share-notification.h b/bt-share/include/bt-share-notification.h index a4f00d5..3879c2a 100644 --- a/bt-share/include/bt-share-notification.h +++ b/bt-share/include/bt-share-notification.h @@ -57,7 +57,7 @@ notification_h _bt_insert_notification(bt_appdata_t *ad, char *address, char *db_sid); int _bt_update_notification(bt_appdata_t *ad, notification_h noti, - char *title, char *content, char *icon_path, char *opc_count); + char *title, char *content, char *dev_name, char *icon_path, char *opc_count); int _bt_update_notification_progress(notification_h noti, int id, diff --git a/bt-share/src/bt-share-ipc.c b/bt-share/src/bt-share-ipc.c index a871850..bf3ac2f 100644 --- a/bt-share/src/bt-share-ipc.c +++ b/bt-share/src/bt-share-ipc.c @@ -187,7 +187,7 @@ static opc_transfer_info_t *__add_transfer_info(GVariant *msg) bd_addr, NULL); } else { _bt_update_notification(ad, ad->send_noti, - NULL, NULL, NULL, NULL); + NULL, NULL, NULL, NULL, NULL); } g_free(file_path); @@ -868,7 +868,7 @@ static void __bt_share_update_tr_info(int tr_uid, int tr_type) if ((ad->send_data.tr_success + ad->send_data.tr_fail) != 0) { _bt_update_notification(ad, ad->send_noti, - NULL, NULL, NULL, NULL); + NULL, NULL, NULL, NULL, NULL); } else { _bt_delete_notification(ad->send_noti); } @@ -905,7 +905,7 @@ static void __bt_share_update_tr_info(int tr_uid, int tr_type) if ((ad->recv_data.tr_success + ad->recv_data.tr_fail) != 0) { _bt_update_notification(ad, ad->receive_noti, - NULL, NULL, NULL, NULL); + NULL, NULL, NULL, NULL, NULL); } else { _bt_delete_notification(ad->receive_noti); } diff --git a/bt-share/src/bt-share-noti-handler.c b/bt-share/src/bt-share-noti-handler.c index fed23ef..4fa5f6f 100644 --- a/bt-share/src/bt-share-noti-handler.c +++ b/bt-share/src/bt-share-noti-handler.c @@ -88,6 +88,8 @@ static void __bt_mmc_status_changed_cb(keynode_t *node, void *data) int mmc_status = 0; int default_memory = 0; int ret = NOTIFICATION_ERROR_NONE; + char *root_path = NULL; + char *download_path = NULL; DBG_SECURE("key=%s", vconf_keynode_get_name(node)); bt_appdata_t *ad = (bt_appdata_t *)data; @@ -120,6 +122,33 @@ static void __bt_mmc_status_changed_cb(keynode_t *node, void *data) DBG_SECURE("Default Memory set to Phone"); } } + } else if (mmc_status == VCONFKEY_SYSMAN_MMC_MOUNTED) { + vconf_get_int(VCONFKEY_SETAPPL_DEFAULT_MEM_BLUETOOTH_INT, &default_memory); + if (default_memory == BT_DEFAULT_MEM_MMC) /* MMC */ { + download_path = _bt_share_get_storage_path(default_memory); + root_path = _bt_share_get_storage_path(default_memory); + + if (download_path == NULL) + download_path = g_strdup(BT_DOWNLOAD_DEFAULT_MEDIA_FOLDER); + + if (root_path == NULL) + root_path = g_strdup(BT_DOWNLOAD_DEFAULT_MEDIA_FOLDER); + + } else { + download_path = g_strdup(BT_DOWNLOAD_DEFAULT_MEDIA_FOLDER); + root_path = g_strdup(BT_DOWNLOAD_DEFAULT_MEDIA_FOLDER); + } + + if (access(download_path, W_OK) != 0) { + warn_if(mkdir(download_path, 0755) < 0, + "mkdir fail![%s]", download_path); + } + + bluetooth_obex_server_set_root(root_path); + bluetooth_obex_server_set_destination_path(download_path); + + g_free(download_path); + g_free(root_path); } } diff --git a/bt-share/src/bt-share-notification.c b/bt-share/src/bt-share-notification.c index b82193c..0a6fc29 100644 --- a/bt-share/src/bt-share-notification.c +++ b/bt-share/src/bt-share-notification.c @@ -128,7 +128,6 @@ notification_h _bt_insert_notification(bt_appdata_t *ad, notification_h noti = NULL; notification_error_e ret = NOTIFICATION_ERROR_NONE; notification_type_e noti_type = NOTIFICATION_TYPE_NONE; - char *stms_str = NULL; char *title = NULL; char *content = NULL; char *icon_path = NULL; @@ -138,6 +137,7 @@ notification_h _bt_insert_notification(bt_appdata_t *ad, int flag = -1; int success = 0; int fail = 0; + bool include_name_param = false; DBG("Create notification type : %d", type); @@ -146,18 +146,18 @@ notification_h _bt_insert_notification(bt_appdata_t *ad, fail = ad->send_data.tr_fail; if (success == 0) { - title = g_strdup("IDS_BT_MBODY_SENDING_FAILED"); + title = "IDS_BT_MBODY_SENDING_FAILED"; } else { - stms_str = BT_STR_FILES_SENT_TO; - title = g_strdup_printf(stms_str, dev_name); + title = "IDS_WIFI_BODY_FILES_SENT_TO_PS_M_STATUS"; + include_name_param = true; } if (success == 0 && fail > 0) - content = g_strdup("IDS_BT_SBODY_PD_FAILED_ABB"); + content = "IDS_BT_SBODY_PD_FAILED_ABB"; else if (fail == 0 && success > 0) - content = g_strdup("IDS_BT_SBODY_PD_SUCCEEDED_ABB"); + content = "IDS_BT_SBODY_PD_SUCCEEDED_ABB"; else - content = g_strdup("IDS_BT_SBODY_P1SD_SUCCEEDED_P2SD_FAILED_ABB2"); + content = "IDS_BT_SBODY_P1SD_SUCCEEDED_P2SD_FAILED_ABB2"; icon_path = BT_ICON_NOTIFICATION_SENT; indicator_icon_path = BT_ICON_NOTIFICATION_SENT_INDICATOR; @@ -170,15 +170,15 @@ notification_h _bt_insert_notification(bt_appdata_t *ad, if (success == 0 && fail > 0) { content = "IDS_BT_SBODY_PD_FAILED_ABB"; - title = g_strdup("IDS_BT_MBODY_RECEIVING_FAILED"); + title = "IDS_BT_MBODY_RECEIVING_FAILED"; } else if (fail == 0 && success > 0) { - stms_str = BT_STR_FILES_RECEIVED_FROM; - title = g_strdup_printf(stms_str, dev_name); + title = "IDS_WIFI_MBODY_FILES_RECEIVED_FROM_PS"; content = "IDS_BT_SBODY_PD_SUCCEEDED_ABB"; + include_name_param = true; } else { - stms_str = BT_STR_FILES_RECEIVED_FROM; - title = g_strdup_printf(stms_str, dev_name); + title = "IDS_WIFI_MBODY_FILES_RECEIVED_FROM_PS"; content = "IDS_BT_SBODY_P1SD_SUCCEEDED_P2SD_FAILED_ABB2"; + include_name_param = true; } icon_path = BT_ICON_NOTIFICATION_RECEIVED; indicator_icon_path = BT_ICON_NOTIFICATION_RECEIVED_INDICATOR; @@ -186,13 +186,13 @@ notification_h _bt_insert_notification(bt_appdata_t *ad, app_id = NOTI_OPS_APP_ID; noti_type = NOTIFICATION_TYPE_NOTI; } else if (type == BT_SENDING_NOTI) { - title = g_strdup("IDS_BT_SBODY_PREPARING_TO_SEND_FILES_ING_ABB"); + title = "IDS_BT_SBODY_PREPARING_TO_SEND_FILES_ING_ABB"; icon_path = BT_ICON_NOTIFICATION_SENDING; indicator_icon_path = BT_ICON_NOTIFICATION_SENDING_INDICATOR; flag = NOTIFICATION_PROP_DISABLE_TICKERNOTI; noti_type = NOTIFICATION_TYPE_ONGOING; } else if (type == BT_RECEIVING_NOTI) { - title = g_strdup("IDS_BT_SBODY_PREPARING_TO_RECEIVE_FILES_ING_ABB"); + title = "IDS_BT_SBODY_PREPARING_TO_RECEIVE_FILES_ING_ABB"; icon_path = BT_ICON_NOTIFICATION_RECEIVING; indicator_icon_path = BT_ICON_NOTIFICATION_RECEIVING_INDICATOR; flag = NOTIFICATION_PROP_DISABLE_TICKERNOTI; @@ -202,17 +202,22 @@ notification_h _bt_insert_notification(bt_appdata_t *ad, noti = notification_create(noti_type); if (!noti) { ERR("Fail to notification_create"); - g_free(title); return NULL; } notification_set_text_domain(noti, BT_COMMON_PKG, BT_COMMON_RES); if (title) { - ret = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, - NULL, title, - NOTIFICATION_VARIABLE_TYPE_NONE); - free(title); + if (include_name_param == true) { + ret = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, + NULL, title, + NOTIFICATION_VARIABLE_TYPE_STRING, dev_name, + NOTIFICATION_VARIABLE_TYPE_NONE); + } else { + ret = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, + NULL, title, + NOTIFICATION_VARIABLE_TYPE_NONE); + } warn_if(ret != NOTIFICATION_ERROR_NONE, "Fail to notification_set_text [%d]", ret); } @@ -302,8 +307,8 @@ notification_h _bt_insert_notification(bt_appdata_t *ad, } int _bt_update_notification(bt_appdata_t *ad, - notification_h noti, char *title, char *content, char *icon_path, - char *opc_count) + notification_h noti, char *title, char *content, char *dev_name, + char *icon_path, char *opc_count) { retvm_if(!noti, BT_SHARE_FAIL, "noti is NULL"); @@ -353,8 +358,15 @@ int _bt_update_notification(bt_appdata_t *ad, NOTIFICATION_VARIABLE_TYPE_NONE); } } else { - ret = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT, - NULL, content, NOTIFICATION_VARIABLE_TYPE_NONE); + if (dev_name) { + ret = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT, + NULL, content, + NOTIFICATION_VARIABLE_TYPE_STRING, dev_name, + NOTIFICATION_VARIABLE_TYPE_NONE); + } else { + ret = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT, + NULL, content, NOTIFICATION_VARIABLE_TYPE_NONE); + } } warn_if(ret != NOTIFICATION_ERROR_NONE, diff --git a/bt-share/src/obex-event-handler.c b/bt-share/src/obex-event-handler.c index f72d8e2..dd6220d 100644 --- a/bt-share/src/obex-event-handler.c +++ b/bt-share/src/obex-event-handler.c @@ -663,7 +663,7 @@ void _bt_share_event_handler(int event, bluetooth_event_param_t *param, ad->send_data.tr_success = snd_noti_info->send_data.tr_success; ad->send_data.tr_fail = snd_noti_info->send_data.tr_fail; _bt_update_notification(ad, ad->send_noti, NULL, NULL, - NULL, NULL); + NULL, NULL, NULL); } /* Update Database with Notification ID*/ __bt_update_db_with_noti_id(BT_DB_OUTBOUND, snd_noti_info->send_noti, @@ -736,11 +736,9 @@ void _bt_share_event_handler(int event, bluetooth_event_param_t *param, _bt_update_transfer_list_view("outbound"); if (ad->opc_noti && is_tr_wait == false) { - char *tmp = BT_STR_SENDING_FILES_TO; - char *sending_files = g_strdup_printf(tmp, node->name); - _bt_update_notification(ad, ad->opc_noti, name, sending_files, NULL, opc_cnt); + char *sending_files = "IDS_WIFI_BODY_SENDING_FILES_TO_PS_ING"; + _bt_update_notification(ad, ad->opc_noti, name, sending_files, node->name, NULL, opc_cnt); _bt_update_notification_progress(NULL, ad->opc_noti_id, 0); - g_free(sending_files); } g_free(opc_cnt); @@ -765,17 +763,15 @@ void _bt_share_event_handler(int event, bluetooth_event_param_t *param, if (ad->opc_noti) { if (is_tr_wait == true) { - char *tmp = BT_STR_SENDING_FILES_TO; - char *sending_files = g_strdup_printf(tmp, node->name); + char *sending_files = "IDS_WIFI_BODY_SENDING_FILES_TO_PS_ING"; if (node->file_cnt > 1) opc_cnt = g_strdup_printf("[%d/%d]", send_index, node->file_cnt); _bt_update_notification(ad, ad->opc_noti, name, sending_files, - NULL, opc_cnt); + node->name, NULL, opc_cnt); g_free(opc_cnt); - g_free(sending_files); is_tr_wait = false; } _bt_update_notification_progress(NULL, ad->opc_noti_id, percentage); @@ -811,15 +807,13 @@ void _bt_share_event_handler(int event, bluetooth_event_param_t *param, name = client_info->filename; if (ad->opc_noti && is_tr_wait == true) { - char *tmp = BT_STR_SENDING_FILES_TO; - char *sending_files = g_strdup_printf(tmp, node->name); + char *sending_files = "IDS_WIFI_BODY_SENDING_FILES_TO_PS_ING"; if (node->file_cnt > 1) opc_cnt = g_strdup_printf("[%d/%d]", send_index, node->file_cnt); - _bt_update_notification(ad, ad->opc_noti, name, sending_files, NULL, opc_cnt); + _bt_update_notification(ad, ad->opc_noti, name, sending_files, node->name, NULL, opc_cnt); g_free(opc_cnt); - g_free(sending_files); is_tr_wait = false; } @@ -1099,10 +1093,9 @@ done: transfer_info->transfer_id); } - char *tmp = BT_STR_RECEIVING_FILES_FROM; - #ifdef ENABLE_CONTACTS_SERVICE2 { +#if 0 int contact_id = -1; if (transfer_info->contact_auth_info) { @@ -1113,17 +1106,18 @@ done: DBG_SECURE("contact_id: %d | contact_name: [%s]", contact_id, contact_name); } } - char *receiving_files = g_strdup_printf(tmp, - contact_name ? contact_name : transfer_info->device_name); +#endif + char *receiving_files = "IDS_WIFI_BODY_RECEIVING_FILES_FROM_PS_ING"; } #else - char *receiving_files = g_strdup_printf(tmp, transfer_info->device_name); + char *receiving_files = "IDS_WIFI_BODY_RECEIVING_FILES_FROM_PS_ING"; #endif INFO("Notification data: %p", data); if (data) { _bt_update_notification(ad, data->noti_handle, - transfer_info->filename, receiving_files, NULL, opc_cnt); + transfer_info->filename, receiving_files, + transfer_info->device_name, NULL, opc_cnt); _bt_update_notification_progress(data->noti_handle, data->noti_id, 0); } diff --git a/packaging/bluetooth-share_upgrade.sh b/packaging/500.bluetooth-share_upgrade.sh similarity index 100% rename from packaging/bluetooth-share_upgrade.sh rename to packaging/500.bluetooth-share_upgrade.sh diff --git a/packaging/bluetooth-share.spec b/packaging/bluetooth-share.spec index 4080f34..2c2d43a 100644 --- a/packaging/bluetooth-share.spec +++ b/packaging/bluetooth-share.spec @@ -83,7 +83,7 @@ install -D -m 0644 packaging/bluetooth-share.service %{buildroot}%{_libdir}/syst mkdir -p %{buildroot}%{upgrade_script_path} mkdir -p %{buildroot}%{upgrade_data_path} -cp -f packaging/bluetooth-share_upgrade.sh %{buildroot}%{upgrade_script_path} +cp -f packaging/500.bluetooth-share_upgrade.sh %{buildroot}%{upgrade_script_path} cp -f packaging/init_db.sh %{buildroot}%{upgrade_data_path} %post @@ -106,7 +106,7 @@ ln -sf %{_libdir}/systemd/system/bluetooth-share.service %{_sysconfdir}/systemd/ #%{_datadir}/dbus-1/system-services/org.bluetooth.share.service %{TZ_COMM_DATA}/%{name}/init_db.sh %{_libdir}/systemd/system/bluetooth-share.service -%{upgrade_script_path}/bluetooth-share_upgrade.sh +%{upgrade_script_path}/500.bluetooth-share_upgrade.sh %{upgrade_data_path}/init_db.sh %files -n libbluetooth-share -- 2.7.4