Fix default sound issue
authorJoohyun Kim <joohyune.kim@samsung.com>
Tue, 2 Jul 2013 12:28:52 +0000 (21:28 +0900)
committerJoohyun Kim <joohyune.kim@samsung.com>
Tue, 2 Jul 2013 12:28:52 +0000 (21:28 +0900)
Change-Id: I5a286be6384849d252522431407b0545802e1ba3
Signed-off-by: Joohyun Kim <joohyune.kim@samsung.com>
src/system-server/setting/providers/FSys_SettingSoundProvider.cpp

index 1d5df81..3553fd5 100644 (file)
@@ -343,13 +343,32 @@ _SettingSoundProvider::GetValue(const String& key, String& value)
                free(pRingtone);
                if(File::IsFileExist(value) == false)
                {
-                       if(File::IsFileExist(L"/opt/share/settings/Ringtones/ringtone_sdk.mp3") == true)
+                       char* pPreloaded = vconf_get_str(VCONFKEY_SETAPPL_CALL_RINGTONE_DEFAULT_PATH_STR);
+                       SysTryReturnResult(NID_SYS, pPreloaded != null, E_SYSTEM, "It is failed to get default ringtone.");
+
+                       String preloaded;
+                       preloaded.Append(pPreloaded);
+
+                       if(File::IsFileExist(preloaded) == true)
                        {
-                               value = L"/opt/share/settings/Ringtones/ringtone_sdk.mp3";
-                               system_settings_set_value_string(SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE, "/opt/share/settings/Ringtones/ringtone_sdk.mp3");
+                               value =  preloaded;
+                               errorCode = system_settings_set_value_string(SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE, pPreloaded);
+                               if(errorCode != SYSTEM_SETTINGS_ERROR_NONE)
+                               {
+                                       SysLogException(NID_SYS, E_SYSTEM, "It is failed to set default ringtone.");
+                               }
+
+                               if(pPreloaded != null)
+                               {
+                                       free(pPreloaded);
+                               }
                        }
                        else
                        {
+                               if(pPreloaded != null)
+                               {
+                                       free(pPreloaded);
+                               }
                                return E_SYSTEM;
                        }
                }
@@ -367,13 +386,31 @@ _SettingSoundProvider::GetValue(const String& key, String& value)
 
                if(File::IsFileExist(value) == false)
                {
-                       if(File::IsFileExist( L"/opt/share/settings/Alerts/General notification_sdk.wav") == true)
+                       char* pPreloaded = vconf_get_str(VCONFKEY_SETAPPL_NOTI_RINGTONE_DEFAULT_PATH_STR);
+                       SysTryReturnResult(NID_SYS, pPreloaded != null, E_SYSTEM, "It is failed to get default noti ringtone.");
+
+                       String preloaded;
+                       preloaded.Append(pPreloaded);
+                       if(File::IsFileExist(preloaded) == true)
                        {
-                               value =  L"/opt/share/settings/Alerts/General notification_sdk.wav";
-                               errorCode = vconf_set_str(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, "/opt/share/settings/Alerts/General notification_sdk.wav");
+                               value =  preloaded;
+                               errorCode = vconf_set_str(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, pPreloaded);
+                               if(errorCode != 0)
+                               {
+                                       SysLogException(NID_SYS, E_SYSTEM, "It is failed to set default noti ringtone.");
+                               }
+
+                               if(pPreloaded != null)
+                               {
+                                       free(pPreloaded);
+                               }
                        }
                        else
                        {
+                               if(pPreloaded != null)
+                               {
+                                       free(pPreloaded);
+                               }
                                return E_SYSTEM;
                        }
                }