fix oncontentdiradded event type issue after oncontentdirdeleted 62/167662/5
authorchen89.chen <chen89.chen@samsung.com>
Fri, 19 Jan 2018 06:34:09 +0000 (14:34 +0800)
committerchen89.chen <chen89.chen@samsung.com>
Fri, 19 Jan 2018 06:51:52 +0000 (14:51 +0800)
Change-Id: I333a5abc041dc626655167ba7fb667e43085c28b

src/scanner-v2/media-scanner-extract-v2.c
src/scanner-v2/media-scanner-scan-v2.c

index 3b9987a..8b4a5b9 100755 (executable)
@@ -276,10 +276,13 @@ NEXT:
                malloc_trim(0);
 
                if (extract_data->result) {
-                       /*send notification*/
-                       char *folder_uuid = NULL;
-                       ms_get_folder_id(handle, storage_id, extract_data->msg, &folder_uuid);
-                       ms_send_dir_update_noti(handle, storage_id, update_path, folder_uuid, noti_type, extract_data->pid);
+                       if (noti_type == MS_ITEM_INSERT || noti_type == MS_ITEM_UPDATE) {
+                               /*send notification*/
+                               char *folder_uuid = NULL;
+                               ms_get_folder_id(handle, storage_id, extract_data->msg, &folder_uuid);
+                               MS_DBG_WARN("storage_id = [%s], dir Path = [%s], folder_uuid = [%s], noti_type = [%d]", storage_id, update_path, folder_uuid, noti_type);
+                               ms_send_dir_update_noti(handle, storage_id, update_path, folder_uuid, noti_type, extract_data->pid);
+                       }
                        extract_data->msg_type = MS_MSG_EXTRACTOR_COMPLETE;
                        msc_send_result(ret, extract_data);
                }
index 56ce882..4be87db 100755 (executable)
@@ -304,6 +304,9 @@ static int __msc_dir_scan_for_folder(void **handle, const char *storage_id, cons
                        MS_DBG_ERR("insert folder failed");
 
                MS_DBG_WARN("ms_insert_folder insert path[%s]", new_start_path);
+       } else {
+               if (ms_set_folder_validity(handle, storage_id, new_start_path, MS_INVALID, is_recursive, uid) != MS_MEDIA_ERR_NONE)
+               MS_DBG_ERR("set_folder_validity failed [%d] ", scan_type);
        }
 
        /*start db update. the number of element in the array , db update is complete.*/
@@ -1294,8 +1297,11 @@ gboolean msc_directory_scan_thread(void *data)
                }*/
 
 SCAN_DONE:
-               MS_DBG_WARN("storage_id = [%s], dir Path = [%s], pid = [%d]", storage_id, scan_data->msg, scan_data->pid);
                if (ret != MS_MEDIA_ERR_SCANNER_FORCE_STOP) {
+                       if (noti_type == MS_ITEM_DELETE) {
+                               MS_DBG_WARN("storage_id = [%s], dir Path = [%s], folder_uuid = [%s], noti_type = [%d]", storage_id, scan_data->msg, folder_uuid, noti_type);
+                               ms_send_dir_update_noti(handle, storage_id, scan_data->msg, folder_uuid, noti_type, scan_data->pid);
+                       }
                        msc_insert_exactor_request(scan_data->msg_type, TRUE, scan_data->storage_id, scan_data->msg, scan_data->pid, uid, noti_type);
                }
                if (power_off2) {