diff options
author | jinwang.an <jinwang.an@samsung.com> | 2018-10-02 18:21:12 +0900 |
---|---|---|
committer | jinwang.an <jinwang.an@samsung.com> | 2018-10-02 19:50:54 +0900 |
commit | a2e2c12f1e59dfecb3f80255401a2b2c643eb142 (patch) | |
tree | 94c238ecbb717bc25efe4c8b3ae476dfee2d1031 | |
parent | 1b80c388cbbc20f764872d295f74be3053bbe598 (diff) | |
download | watch-setting-a2e2c12f1e59dfecb3f80255401a2b2c643eb142.tar.gz watch-setting-a2e2c12f1e59dfecb3f80255401a2b2c643eb142.tar.bz2 watch-setting-a2e2c12f1e59dfecb3f80255401a2b2c643eb142.zip |
Fix sound volume setting routine.submit/tizen/20181004.000856accepted/tizen/unified/20181005.012513
Change-Id: I4b8464ebc29cd88dbea7edf2bec96b1d1292cb37
Signed-off-by: jinwang.an <jinwang.an@samsung.com>
-rw-r--r-- | src/setting-sound.c | 16 | ||||
-rw-r--r-- | src/setting-volume-page.c | 94 |
2 files changed, 51 insertions, 59 deletions
diff --git a/src/setting-sound.c b/src/setting-sound.c index a6f0855..17f76be 100644 --- a/src/setting-sound.c +++ b/src/setting-sound.c @@ -353,7 +353,6 @@ void _sound_mode_cb(void *data, Evas_Object *obj, void *event_info) void _touch_sound_cb(void *data, Evas_Object *obj, void *event_info) { - int ret = 0; Elm_Object_Item *it = (Elm_Object_Item *)event_info; appdata *ad = data; DBG("_touch_sound_cb is called!!!!!!!"); @@ -729,6 +728,21 @@ static void _sound_mode_gl_cb(void *data, Evas_Object *obj, void *event_info) system_settings_set_value_bool(SYSTEM_SETTINGS_KEY_SOUND_TOUCH, curr_touch_sound); curr_touch_sound = false; + + sound_stream_info_h stream_info = NULL; + sound_type_e type; + + int ret = sound_manager_create_stream_information_internal(SOUND_STREAM_TYPE_RINGTONE_CALL, NULL, NULL, &stream_info); + if (ret != SOUND_MANAGER_ERROR_NONE) { + ERR("sound_manager_create_stream_information_internal() get failed with err[%d, 0x%x]", ret, ret); + return; + } + sound_manager_get_sound_type(stream_info, &type); + sound_manager_destroy_stream_information(stream_info); + ret = sound_manager_set_volume(type, ringtone_level); + if (ret != SOUND_MANAGER_ERROR_NONE) { + ERR("Setting - sound_manager_set_volume() is failed! : %d", ret); + } } break; case SOUND_MODE_VIBRATE: diff --git a/src/setting-volume-page.c b/src/setting-volume-page.c index 7948f74..0c6f02d 100644 --- a/src/setting-volume-page.c +++ b/src/setting-volume-page.c @@ -1,5 +1,4 @@ -/* - * Copyright (c) 2010 Samsung Electronics, Inc. +/* * Copyright (c) 2010 Samsung Electronics, Inc. * All rights reserved. * * This software is a confidential and proprietary information @@ -74,7 +73,6 @@ static char *vconf_name[VOLUME_LIST_COUNT] = { EAPI Evas_Object *elm_widget_top_get(const Evas_Object *obj); -static void _set_volumn(sound_stream_type_e type, int volume_index, char *vconf_key); /*static void _change_to_vibrate_mode(); */ static void _play_sound_all_type(int sound_type, float volume); @@ -791,6 +789,16 @@ Evas_Object *_create_volume_page(void *data) vconf_get_int(vconf_name[is_telephony_enable() ? i : i+1], &pd->slider_value[i]); ERR("vconf_name : %s = %d", vconf_name[is_telephony_enable() ? i : i+1], pd->slider_value[i]); + if (is_telephony_enable() && i == 0) { + int mode = get_sound_mode(); + if (mode == SOUND_MODE_VIBRATE || mode == SOUND_MODE_MUTE) { + vconf_set_int(vconf_name_backup[i], pd->slider_value[i]); + pd->slider_value[i] = 0; + } else if (mode == SOUND_MODE_SOUND && pd->slider_value[i] == 0) { + vconf_get_int(vconf_name_backup[i], &pd->slider_value[i]); + } + } + eext_circle_object_value_set(slider, (float)pd->slider_value[i]); /* Activate Circle slider's rotary object event. @@ -1166,52 +1174,27 @@ Evas_Object *_media_create_volume_page(void *data) return layout; } -static void _set_volumn(sound_stream_type_e type, int volume_index, char *vconf_key) +static void _play_sound_all_type(int sound_type, float volume) { - DBG("Setting - set_volume() is called!"); + char buf[__SETTING_BUF_SIZE__] = {0,}; + const char *sound_path = NULL; int err = -1; - err = sound_manager_set_volume(get_sound_type(type), volume_index); - - /* save system vulume value */ - if (err == SOUND_MANAGER_ERROR_NONE) { - int vret = vconf_set_int(vconf_key, volume_index); - DBG(" ret = %d , %s :: %d ", vret, vconf_key, volume_index); - - if (curr_sound_type == SOUND_STREAM_TYPE_RINGTONE_CALL) { - DBG("Ringtone volume is changed....!"); + int ret_vconf = 0; + switch (sound_type) { + case SOUND_STREAM_TYPE_RINGTONE_CALL: { + ret_vconf = vconf_set_int(VCONFKEY_SETAPPL_CALL_RINGTONE_SOUND_VOLUME_INT, volume_index); + vconf_set_int("db/setting/sound/call/rmd_ringtone_volume", volume_index); /* backup ringtone volume */ + DBG("SOUND_STREAM_TYPE_RINGTONE_CALL"); + DBG("vconf_name SET INT : %s = %d, ret %d", VCONFKEY_SETAPPL_CALL_RINGTONE_SOUND_VOLUME_INT, volume_index, ret_vconf); if (volume_index == 0 && get_sound_mode() == SOUND_MODE_SOUND) { system_settings_set_value_bool(SYSTEM_SETTINGS_KEY_SOUND_SILENT_MODE, TRUE); - system_settings_set_value_bool(SYSTEM_SETTINGS_KEY_VIBRATION, FALSE); + system_settings_set_value_bool(SYSTEM_SETTINGS_KEY_VIBRATION, TRUE); } else if (volume_index > 0 && get_sound_mode() != SOUND_MODE_SOUND) { system_settings_set_value_bool(SYSTEM_SETTINGS_KEY_SOUND_SILENT_MODE, FALSE); system_settings_set_value_bool(SYSTEM_SETTINGS_KEY_VIBRATION, FALSE); } - } else { - DBG("current sound mode is %d, not type_ringtone", curr_sound_type); - } - } else { - DBG("Setting - ringtone value is not saved... %d", volume_index); - } -} - -static void _play_sound_all_type(int sound_type, float volume) -{ - - char buf[__SETTING_BUF_SIZE__] = {0,}; - const char *sound_path = NULL; - int temp_volume_index = 0; - switch (sound_type) { - case SOUND_STREAM_TYPE_RINGTONE_CALL: { - temp_volume_index = volume_index; - - int ret_vconf = vconf_set_int(VCONFKEY_SETAPPL_CALL_RINGTONE_SOUND_VOLUME_INT, temp_volume_index); - vconf_set_int("db/setting/sound/call/rmd_ringtone_volume", temp_volume_index); /* backup ringtone volume */ - - /*_set_volumn(sound_type, volume_index, VCONFKEY_SETAPPL_CALL_RINGTONE_SOUND_VOLUME_INT); */ - - ERR("vconf_name SET INT : %s = %d, ret %d", VCONFKEY_SETAPPL_CALL_RINGTONE_SOUND_VOLUME_INT, temp_volume_index, ret_vconf); sound_path = vconf_get_str(VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR); if (sound_path) { @@ -1220,16 +1203,22 @@ static void _play_sound_all_type(int sound_type, float volume) snprintf(buf, sizeof(buf)-1, "%s", VCONFKEY_SETAPPL_CALL_RINGTONE_DEFAULT_PATH_STR); } + err = sound_manager_set_volume(get_sound_internal_type(sound_type), volume_index); + if (err != SOUND_MANAGER_ERROR_NONE) { + ERR("Setting - sound_manager_set_volume() is failed! : %d", err); + } break; } case SOUND_STREAM_TYPE_MEDIA: - _set_volumn(sound_type, volume_index, VCONFKEY_SETAPPL_MEDIA_SOUND_VOLUME_INT); - + ret_vconf = vconf_set_int(VCONFKEY_SETAPPL_MEDIA_SOUND_VOLUME_INT, volume_index); + DBG("SOUND_STREAM_TYPE_MEDIA"); + DBG("vconf_name SET INT : %s = %d, ret %d", VCONFKEY_SETAPPL_MEDIA_SOUND_VOLUME_INT, volume_index, ret_vconf); snprintf(buf, sizeof(buf)-1, "%s", SETTING_DEFAULT_MEDIA_TONE); break; case SOUND_STREAM_TYPE_NOTIFICATION: - vconf_set_int(VCONFKEY_SETAPPL_NOTI_SOUND_VOLUME_INT, volume_index); - temp_volume_index = volume_index; + DBG("SOUND_STREAM_TYPE_NOTIFICATION"); + ret_vconf = vconf_set_int(VCONFKEY_SETAPPL_NOTI_SOUND_VOLUME_INT, volume_index); + DBG("vconf_name SET INT : %s = %d, ret %d", VCONFKEY_SETAPPL_NOTI_SOUND_VOLUME_INT, volume_index, ret_vconf); sound_path = vconf_get_str(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR); if (sound_path) { @@ -1239,33 +1228,22 @@ static void _play_sound_all_type(int sound_type, float volume) } break; case SOUND_STREAM_TYPE_SYSTEM: - vconf_set_int(VCONFKEY_SETAPPL_TOUCH_FEEDBACK_SOUND_VOLUME_INT, volume_index); - + DBG("SOUND_STREAM_TYPE_SYSTEM"); + ret_vconf = vconf_set_int(VCONFKEY_SETAPPL_TOUCH_FEEDBACK_SOUND_VOLUME_INT, volume_index); + DBG("vconf_name SET INT : %s = %d, ret %d", VCONFKEY_SETAPPL_TOUCH_FEEDBACK_SOUND_VOLUME_INT, volume_index, ret_vconf); snprintf(buf, sizeof(buf)-1, "%s", SETTING_DEFAULT_SYS_TONE); break; } ERR(">>>>> Play Sound path : %s", buf); - int err = -1; - - if (sound_type == SOUND_STREAM_TYPE_RINGTONE_CALL) { - DBG("Setting - ringtone safety volume!!"); - DBG("Setting - real volume : %d", temp_volume_index); - - sound_manager_set_volume(get_sound_internal_type(sound_type), temp_volume_index); - } else if (sound_type == SOUND_STREAM_TYPE_NOTIFICATION) { - ERR("Setting - notification safety volume!!"); - sound_manager_set_volume(get_sound_type(sound_type), temp_volume_index); - } else { - ERR("Setting - normal volume!! ----- volume_index : %d ", volume_index); + if (sound_type != SOUND_STREAM_TYPE_RINGTONE_CALL) { err = sound_manager_set_volume(get_sound_type(sound_type), volume_index); if (err != SOUND_MANAGER_ERROR_NONE) { ERR("Setting - sound_manager_set_volume() is failed! : %d", err); } } - if (!is_created_player() || is_player_paused()) { play_sound(buf, volume, sound_type); set_looping(TRUE); |