Add checker for metadata update when language is changed 69/60169/4 accepted/tizen/common/20160302.193843 accepted/tizen/ivi/20160302.224254 accepted/tizen/mobile/20160302.224202 accepted/tizen/tv/20160302.224227 accepted/tizen/wearable/20160302.224238 submit/tizen/20160302.073044
authorMinje Ahn <minje.ahn@samsung.com>
Wed, 24 Feb 2016 02:58:55 +0000 (11:58 +0900)
committerMinje Ahn <minje.ahn@samsung.com>
Wed, 2 Mar 2016 00:58:27 +0000 (09:58 +0900)
Change-Id: I8d1653919e1ce4249742ebe9b09a5b616cade0db
Signed-off-by: Minje Ahn <minje.ahn@samsung.com>
src/scanner-v2/media-scanner-scan-v2.c
src/scanner/media-scanner-scan.c

index 0bfaa86..e81efe5 100755 (executable)
@@ -93,7 +93,7 @@ static void __msc_insert_register_request(GArray *register_array, ms_comm_msg_s
 static void __msc_bacth_commit_enable(void* handle, bool ins_status, bool valid_status, bool noti_enable, int pid);
 static void __msc_bacth_commit_disable(void* handle, bool ins_status, bool valid_status, int result, uid_t uid);
 static int __msc_dir_scan_for_folder(void **handle, const char *storage_id, const char*start_path, ms_storage_type_t storage_type, int scan_type, int pid, uid_t uid);
-static int __msc_dir_scan_for_storage(void **handle, const char *storage_id, const char*start_path, ms_storage_type_t storage_type, int scan_type, int pid, uid_t uid);
+static int __msc_dir_scan_for_storage(void **handle, const char *storage_id, const char*start_path, ms_storage_type_t storage_type, int scan_type, uid_t uid);
 static bool __msc_storage_mount_status(const char* start_path);
 static char* __msc_get_path(uid_t uid);
 
@@ -630,7 +630,7 @@ STOP_SCAN:
        return ret;
 }
 
-static int __msc_dir_scan_for_storage(void **handle, const char *storage_id, const char*start_path, ms_storage_type_t storage_type, int scan_type, int pid, uid_t uid)
+static int __msc_dir_scan_for_storage(void **handle, const char *storage_id, const char*start_path, ms_storage_type_t storage_type, int scan_type, uid_t uid)
 {
        GArray *dir_array = NULL;
        int ret = MS_MEDIA_ERR_NONE;
@@ -993,7 +993,7 @@ static int __msc_db_update(void **handle, const char *storage_id, const ms_comm_
                if (scan_type == MS_MSG_DIRECTORY_SCANNING || scan_type == MS_MSG_DIRECTORY_SCANNING_NON_RECURSIVE) {
                        err = __msc_dir_scan_for_folder(handle, storage_id, start_path, storage_type, scan_type, scan_data->pid, scan_data->uid);
                } else if (scan_type == MS_MSG_STORAGE_ALL || scan_type == MS_MSG_STORAGE_PARTIAL) {
-                       err = __msc_dir_scan_for_storage(handle, storage_id, start_path, storage_type, scan_type, scan_data->pid, scan_data->uid);
+                       err = __msc_dir_scan_for_storage(handle, storage_id, start_path, storage_type, scan_type, scan_data->uid);
                }
 
                if (err != MS_MEDIA_ERR_NONE) {
index 97b7862..ad9fe6c 100755 (executable)
@@ -1009,7 +1009,7 @@ gboolean msc_storage_scan_thread(void *data)
                        goto NEXT;
                }
 
-               /*connect to media db, if conneting is failed, db updating is stopped*/
+               /*connect to media db, if connecting is failed, db updating is stopped*/
                err = ms_connect_db(&handle, scan_data->uid);
                if (err != MS_MEDIA_ERR_NONE)
                        continue;
@@ -1669,9 +1669,12 @@ gboolean msc_metadata_update(void *data)
 {
        ms_comm_msg_s *scan_data = data;
        int ret = MS_MEDIA_ERR_NONE;
+       int idx = 0;
        void **handle = NULL;
        char *start_path = NULL;
        ms_storage_type_t storage_type = MS_STORAGE_INTERNAL;
+       GArray *storage_list = NULL;
+       ms_stg_info_s *stg_info = NULL;
 
        MS_DBG_INFO("META UPDATE START");
 
@@ -1710,8 +1713,36 @@ gboolean msc_metadata_update(void *data)
                }
        }
 
-       /*FIX ME*/
        /*__msc_dir_scan_meta_update For Each USB Storage*/
+       ret = ms_get_storage_list(handle, &storage_list);
+       if (ret != MS_MEDIA_ERR_NONE) {
+               MS_DBG_ERR("ms_get_storage_list() fail");
+               if (handle) ms_disconnect_db(&handle);
+               return MS_MEDIA_ERR_INTERNAL;
+       }
+
+       for (idx = 0; idx < storage_list->len; idx++) {
+               stg_info = g_array_index(storage_list, ms_stg_info_s *, idx);
+
+               /* Check power off status.. storage list vacating for g_array_free.. */
+               if (power_off) {
+                       MS_SAFE_FREE(stg_info->stg_path);
+                       MS_SAFE_FREE(stg_info->storage_id);
+                       MS_SAFE_FREE(stg_info);
+                       MS_DBG_WARN("power off");
+                       continue;
+               }
+
+               ret = __msc_dir_scan_meta_update(handle, stg_info->stg_path, stg_info->storage_id, storage_type, scan_data->uid);
+               /* send notification */
+               ms_send_dir_update_noti(handle, stg_info->storage_id, stg_info->stg_path, NULL, MS_ITEM_UPDATE, scan_data->pid);
+
+               MS_SAFE_FREE(stg_info->stg_path);
+               MS_SAFE_FREE(stg_info->storage_id);
+               MS_SAFE_FREE(stg_info);
+       }
+
+       g_array_free(storage_list, FALSE);
 
        /*call for bundle commit*/
        ms_update_end(handle, scan_data->uid);