sound: Fixed issue of volume resetting on ringtone change 74/106174/3
authorBartlomiej Uliasz <b.uliasz@samsung.com>
Tue, 20 Dec 2016 16:44:09 +0000 (17:44 +0100)
committerBartlomiej Uliasz <b.uliasz@samsung.com>
Tue, 20 Dec 2016 16:48:26 +0000 (08:48 -0800)
Fixes issue TSAM-11788.
Code formatting according to "Native Platform Coding Idiom and Style Guide"

Change-Id: Ie4abe833aa83ca48578fbba518f5ec98808480c0
Signed-off-by: Bartlomiej Uliasz <b.uliasz@samsung.com>
setting-profile/include/setting-profile-sound-main.h [deleted file]
setting-profile/include/setting-profile.h
setting-profile/src/setting-profile-common.c
setting-profile/src/setting-profile-sound-main.c
setting-profile/src/setting-profile.c

diff --git a/setting-profile/include/setting-profile-sound-main.h b/setting-profile/include/setting-profile-sound-main.h
deleted file mode 100644 (file)
index 240d0c0..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * setting
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd.
- *
- * Contact: MyoungJune Park <mj2004.park@samsung.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-#ifndef __SETTING_PROFILE_SOUND_MAIN_H__
-#define __SETTING_PROFILE_SOUND_MAIN_H__
-
-#include "setting-profile.h"
-
-#define NOTIFICATION_STR_ON_LOCK_SCREEN "IDS_QP_TMBODY_NOTIFICATIONS_ON_LOCK_SCREEN"
-#define NOTIFICATION_STR_ON_LOCK_SCREEN_HIDE "IDS_ST_OPT_HIDE_CONTENT"
-#define NOTIFICATION_STR_ON_LOCK_SCREEN_HIDE_SENSITIVE "IDS_QP_OPT_HIDE_SENSITIVE_CONTENT_ABB"
-#define NOTIFICATION_STR_ON_LOCK_SCREEN_SHOW_ALL "IDS_QP_OPT_SHOW_ALL_CONTENT_ABB"
-
-static void setting_sound_main_mouse_up_Gendial_list_cb(void *data,
-               Evas_Object *obj, void *event_info);
-#endif
index f94b19decdce1b376a5d3f2ef5a7dc82d05e6563..626bfdedd5d2925e5d91443a7586c3c69966b4c3 100644 (file)
 #define SETTING_PROFILE_ICON_PATH_CFG _TZ_SYS_RO_APP"/org.tizen.setting/res/icons/"
 
 #define VOLUME_APP_NAME "org.tizen.setting.volume"
-#define MAX_SAFETY_VOLUME_LEVEL 10
-#define SETTING_PROFILE_SOUND_ALERTS_PATH \
-       _TZ_SYS_SHARE"/settings/Alerts"
-#define SETTING_PROFILE_SOUND_RINGTONES_PATH \
-       _TZ_SYS_SHARE"/settings/Ringtones"
 #define SETTING_PROFILE_MMC_PATH \
        _TZ_SYS_MEDIA"/sdcard"
 #define SETTING_DEFAULT_MSG_TONE \
@@ -122,7 +117,6 @@ struct _SettingSoundData {
        bool sound_on;
        char *song_playing;
        char *ringtone_type;
-       char *sdcard_ringtone_path;
 
        /* for performance of incoming call ringtone slider */
        Ecore_Idler *play_ringtone_idler;
@@ -132,38 +126,32 @@ struct _SettingSoundData {
        bool is_pressing;
        Ecore_Timer *updown_timer;
        Evas_Object *calling_popup; /* Unable to pre-listening during a call */
-       int backup_ringtong_volume;
+       int backup_ringtone_volume[SOUND_TYPE_VOICE + 1];
        bool is_ringtone_slidering;
 };
 
-extern setting_view setting_view_sound_main;
-
-extern void setting_sound_play_sound_origin(void *data,
-               void *cb, char *ringtone_file, float vol,
-               sound_type_e sound_type);
-extern int setting_sound_check_file_exist(void *data, const char *file_path);
-
-extern void system_settings_changed_silent_mode(system_settings_key_e key,
-               void *user_data);
-
-extern bool setting_sound_play_sound(void *data, void *cb,
-               char *ringtone_file, int vol, sound_type_e sound_type);
-
-extern int __close_player(void *data, SoundType type);
-
-extern void setting_sound_stop_sound(void *data);
-extern void __setting_sound_key_grab(SettingSoundData *ad);
-extern void __setting_sound_key_ungrab(SettingSoundData *ad);
-extern char *setting_media_basename(char *path);
-extern void setting_sound_create_warning_popup_during_call(void *data);
-extern char *setting_sound_get_slider_icon(int type, int volume);
-extern void setting_sound_update_slider_icon(
-               Setting_GenGroupItem_Data *item_data, int type);
-extern Evas_Object *setting_sound_init(void *data);
-extern void setting_sound_deinit(void *data);
-extern const char *setting_do_not_disturb_is_enable(void *data);
-extern const char *setting_notifiaction_on_lock_screen(void *data);
-extern void setting_sound_update_do_not_disturb_item(void *data);
-extern void setting_sound_update_notifiaction_on_lock_screen_item(void *data);
+setting_view setting_view_sound_main;
+
+void setting_sound_play_sound_origin(void *data, void *cb, char *ringtone_file,
+               float vol, sound_type_e sound_type);
+int setting_sound_check_file_exist(void *data, const char *file_path);
+
+bool setting_sound_play_sound(void *data, void *cb, char *ringtone_file,
+               int vol, sound_type_e sound_type);
+
+void setting_sound_stop_sound(SettingSoundData *ad);
+void setting_sound_key_grab(SettingSoundData *ad);
+void setting_sound_key_ungrab(SettingSoundData *ad);
+char *setting_media_basename(char *path);
+void setting_sound_create_warning_popup_during_call(void *data);
+char *setting_sound_get_slider_icon(int type, int volume);
+void setting_sound_update_slider_icon(Setting_GenGroupItem_Data *item_data,
+               int type);
+Evas_Object *setting_sound_init(SettingSoundData *ad);
+void setting_sound_deinit(void *data);
+const char *setting_do_not_disturb_is_enable(void *data);
+const char *setting_notifiaction_on_lock_screen(void *data);
+void setting_sound_update_do_not_disturb_item(void *data);
+void setting_sound_update_notifiaction_on_lock_screen_item(void *data);
 
 #endif
index d39f811af8d40bddc887a757481a4524454da7ab..9299d44a7b8cba39e694f595f4bdc0f77c5dfce2 100644 (file)
 #include <metadata_extractor.h>
 #include <player.h>
 
+/*resolve P130805-7070 */
+#define SETTING_DEFAULT_FOLDER_PATH    _TZ_SYS_SHARE"/settings/"
+#define SDCARD_PATH    _TZ_SYS_MEDIA"/sdcard/"
+#define EXP 0.001
+
 typedef struct _SliderIcons {
        int index;
        char mute[256];
@@ -40,6 +45,7 @@ SliderIcons slider_icons[SND_SLIDER_MAX] = {
        /*{SND_SLIDER_MAX,      "",                     ""} */
 };
 
+static void __mm_player_prepared_cb(void *user_data);
 static void __sound_stream_focus_state_changed_cb(
                sound_stream_info_h stream_info,
                sound_stream_focus_mask_e focus_mask,
@@ -48,6 +54,13 @@ static void __sound_stream_focus_state_changed_cb(
                int sound_behavior,
                const char *extra_info,
                void *user_data);
+static Eina_Bool __volume_key_down_cb(void *data, int type, void *event);
+static Eina_Bool __volume_key_up_cb(void *data, int type, void *event);
+static Evas_Object *__sound_slider_icon_get(void *data, Evas_Object *obj,
+               const char *part);
+static int __listen_vconf_change(void *data);
+static int __unlisten_vconf_change(void *data);
+static void __calling_popup_cb(void *data, Evas_Object *obj, void *event_info);
 
 void setting_sound_update_do_not_disturb_item(void *data)
 {
@@ -153,94 +166,18 @@ char *setting_media_basename(char *path)
        return setting_file_basename(path);
 }
 
-/* ------------------------------------------------------------------------- */
-/* |           | elm.swallow.icon.0 | elm.text | elm.swallow.icon.1 |     | */
-/* | elm.swallow.icon |----------------------------------| elm.swallow.end | */
-/* |             |     elm.text.sub      | elm.text.sub.end   |           | */
-/* ------------------------------------------------------------------------- */
-static Evas_Object *__sound_slider_icon_get(
-               void *data, Evas_Object *obj, const char *part)
-{
-       SETTING_TRACE_BEGIN;
-       /*appcore_measure_start(); */
-       retv_if(data == NULL, NULL);
-
-       SETTING_TRACE(" -----------------> EDC part [%s]", part);
-       if (safeStrCmp(part, "elm.swallow.content"))
-               return NULL;
-
-       Evas_Object *layout;
-       /* Set custom layout style */
-       layout = elm_layout_add(obj);
-
-       Setting_GenGroupItem_Data *item_data =
-                       (Setting_GenGroupItem_Data *)data;
-       Evas_Object *slider = setting_create_slider(obj, item_data);
-
-       if (slider == NULL)
-               return NULL;
-
-       char *gl_style = "gl_custom_item";
-       elm_layout_file_set(layout, EDJDIR"/setting-theme.edj", gl_style);
-       evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
-       evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND,
-                       EVAS_HINT_EXPAND);
-
-       if (0 == safeStrCmp(item_data->keyStr, "IDS_ST_BODY_MEDIA")) {
-               elm_object_style_set(slider, "warning");
-
-               Edje_Message_Float_Set *msg =
-                               alloca(sizeof(Edje_Message_Float_Set)
-                                               + (sizeof(double)));
-               msg->count = 1;
-               /* Warning area point has to be calculated considering rounding
-                * off. For example, value 10's area will be 9.5~10.4.
-                * So, if warning area has to be started at 10, we need to
-                * calculate the start point with 9.5.
-                * Warning start point = (Warning min value - 0.5) /
-                *                              (Max_Value - Min_Value) */
-               msg->val[0] = 0.633333;
-               edje_object_message_send(
-                               _EDJ(slider), EDJE_MESSAGE_FLOAT_SET, 0, msg);
-               elm_slider_indicator_format_set(slider, "%1.0f");
-               elm_slider_indicator_show_set(slider, 1);
-       }
-
-       item_data->eo_check = slider;
-
-       evas_object_pass_events_set(slider, EINA_TRUE);
-       evas_object_propagate_events_set(slider, EINA_FALSE);
-
-       if (item_data->userdata == NULL)
-               return NULL;
-
-       /* Set text into layout */
-       /*if (0 == safeStrCmp(item_data->keyStr, "IDS_ST_BODY_MEDIA") */
-       /*      || 0 == safeStrCmp(item_data->keyStr, "IDS_ST_BODY_SYSTEM"))
-        * { */
-       elm_object_part_text_set(layout, "elm.text", _(item_data->keyStr));
-       /*} */
-       elm_object_part_content_set(layout, "elm.swallow.content", slider);
-       return layout;
-}
-
 /* ***************************************************
  *
  *general func
  *
  ***************************************************/
-/*resolve P130805-7070 */
-#define SETTING_DEFAULT_FOLDER_PATH    _TZ_SYS_SHARE"/settings/"
-#define SDCARD_PATH    _TZ_SYS_MEDIA"/sdcard/"
-
 int setting_sound_check_file_exist(void *data, const char *file_path)
 {
        retv_if(data == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
        retv_if(file_path == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
 
        /*resolve P130805-7070 */
-       if (0 == safeStrNCmp(
-                       file_path,
+       if (0 == safeStrNCmp(file_path,
                        SETTING_DEFAULT_FOLDER_PATH,
                        safeStrLen(SETTING_DEFAULT_FOLDER_PATH))) {
                SETTING_TRACE("Default file[%s]!", file_path);
@@ -284,88 +221,566 @@ int setting_sound_check_file_exist(void *data, const char *file_path)
        return SETTING_RETURN_SUCCESS;
 }
 
-static void __enable_sound_menu(void *data)
+bool setting_sound_play_sound(
+               void *data,
+               void *cb,
+               char *ringtone_file,
+               int vol,
+               sound_type_e sound_type)
 {
-       SETTING_TRACE_BEGIN;
-       ret_if(!data);
-       SettingSoundData *ad = data;
-       ad->sound_on = TRUE;
-       Setting_GenGroupItem_Data *item_to_update = NULL;
+       int err = 0;
+       sound_stream_focus_state_e ssfs = SOUND_STREAM_FOCUS_STATE_ACQUIRED;
+       player_state_e state = PLAYER_STATE_NONE;
+       /* error check */
+       retv_if(data == NULL, NULL);
+       SettingSoundData *ad = (SettingSoundData *) data;
+       sound_stream_info_h sound_stream_info_to_set = NULL;
 
+       int is_existing = setting_sound_check_file_exist(ad, ringtone_file);
 
-       /*1.Enable "Vibrate when ringing" */
-       if (ad->data_sound_when_ring) {
-               item_to_update = ad->data_sound_when_ring;
-               setting_genlist_item_disabled_set(item_to_update, EINA_FALSE);
-       }
+       if (is_existing == SETTING_RETURN_FAIL || NULL == ringtone_file) {
+               switch (sound_type) {
+               case SOUND_TYPE_RINGTONE:
+                       if (isEmulBin())
+                               ad->song_playing = (char *)g_strdup(
+                                               SETTING_DEFAULT_CALL_TONE_SDK);
+                       else
+                               ad->song_playing = (char *)g_strdup(
+                                               SETTING_DEFAULT_CALL_TONE);
+                       sound_stream_info_to_set =
+                                       ad->ringtone_sound_stream_info;
+                       break;
+               case SOUND_TYPE_MEDIA:
+                       if (isEmulBin())
+                               ad->song_playing = (char *)g_strdup(
+                                               SETTING_DEFAULT_CALL_TONE_SDK);
+                       else
+                               ad->song_playing = (char *)g_strdup(
+                                               SETTING_DEFAULT_MEDIA_TONE);
+                       sound_stream_info_to_set = ad->media_sound_stream_info;
+                       break;
+               case SOUND_TYPE_NOTIFICATION:
+                       ad->song_playing = (char *)g_strdup(
+                                       SETTING_DEFAULT_MSG_TONE);
+                       sound_stream_info_to_set = ad->noti_sound_stream_info;
+                       break;
+               default:
+                       return false;
+                       break;
+               }
 
-       if (ad->data_call_volume) {
-               elm_object_item_disabled_set(ad->data_call_volume->item,
-                               EINA_FALSE);
-               elm_object_disabled_set(ad->data_call_volume->eo_check,
-                               EINA_FALSE);
+       } else {
+               if (safeStrCmp(ringtone_file, "Silent") == 0)
+                       return false;
+
+               switch (sound_type) {
+               case SOUND_TYPE_RINGTONE:
+                       sound_stream_info_to_set =
+                                       ad->ringtone_sound_stream_info;
+                       break;
+               case SOUND_TYPE_MEDIA:
+                       sound_stream_info_to_set = ad->media_sound_stream_info;
+                       break;
+               case SOUND_TYPE_NOTIFICATION:
+                       sound_stream_info_to_set = ad->noti_sound_stream_info;
+                       break;
+               default:
+                       return false;
+                       break;
+               }
+               ad->song_playing = (char *)g_strdup(ringtone_file);
        }
 
-       /*2.Enable "Notification", via Sound Manager */
-       item_to_update = ad->data_noti_volume;
+       player_get_state(ad->mp_player, &state);
+       if (state != PLAYER_STATE_IDLE) {
+               if (err != player_unprepare(ad->mp_player)) {
+                       SETTING_TRACE_ERROR("player_unprepare() failed: [%s]",
+                                       get_error_message(err));
+                       player_unprepare(ad->mp_player);
+                       return false;
 
-       /* @todo make sure data_msg_alert_tone is correct for 'Silent' set.
-       if (item_to_update && safeStrCmp(item_to_update->sub_desc, "Silent"))*/
-       if ((ad->data_msg_alert_tone &&
-               safeStrCmp(ad->data_msg_alert_tone->sub_desc, "Silent")) ||
-               (!safeStrCmp(ad->viewtype, VOLUME_APP_NAME))
-               ) {
-               //Enable
-               if (item_to_update
-                               && item_to_update->item
-                               && item_to_update->eo_check) {
-                       int mm_value = 0;
-                       int ret =  sound_manager_get_volume(
-                                       SOUND_TYPE_NOTIFICATION, &mm_value);
-                       SETTING_TRACE("ret:%d", ret);
-                       item_to_update->chk_status = mm_value;
-                       elm_slider_value_set(
-                                       item_to_update->eo_check,
-                                       item_to_update->chk_status);
-                       elm_object_item_disabled_set(item_to_update->item,
-                                       EINA_FALSE);
-                       elm_object_disabled_set(item_to_update->eo_check,
-                                       EINA_FALSE);
+               }
+       }
 
-                       setting_sound_update_slider_icon(
-                                       item_to_update, SND_SLIDER_NOTI);
+       if (sound_type != SOUND_TYPE_NOTIFICATION) {
+               sound_manager_get_focus_state(sound_stream_info_to_set, &ssfs,
+                               NULL);
+               if (ssfs == SOUND_STREAM_FOCUS_STATE_RELEASED) {
+                       err = sound_manager_acquire_focus(
+                                       sound_stream_info_to_set,
+                                       SOUND_STREAM_FOCUS_FOR_PLAYBACK,
+                                       SOUND_BEHAVIOR_NONE, NULL);
+                       if (err != SOUND_MANAGER_ERROR_NONE) {
+                               SETTING_TRACE_ERROR(
+                                               "Could not acquire focus: [%s]",
+                                               get_error_message(err));
+                               player_unprepare(ad->mp_player);
+                               return false;
+                       }
                }
        }
 
-       /*3.Enable "System", via Sound Manager */
-       item_to_update = ad->data_touch_volume;
-       if (item_to_update && item_to_update->item
-                       && item_to_update->eo_check) {
-               int mm_value = 0;
-               int ret =  sound_manager_get_volume(
-                               SOUND_TYPE_SYSTEM, &mm_value);
-               SETTING_TRACE("ret:%d", ret);
-               item_to_update->chk_status = mm_value;
-               elm_slider_value_set(
-                               item_to_update->eo_check,
-                               item_to_update->chk_status);
-               elm_object_item_disabled_set(
-                               item_to_update->item, EINA_FALSE);
-               elm_object_disabled_set(item_to_update->eo_check, EINA_FALSE);
+       player_get_state(ad->mp_player, &state);
+       if (state != PLAYER_STATE_IDLE)
+               player_unprepare(ad->mp_player);
 
-               setting_sound_update_slider_icon(
-                               item_to_update, SND_SLIDER_SYSTEM);
+       err = player_set_audio_policy_info(ad->mp_player, sound_stream_info_to_set);
+       if (err != PLAYER_ERROR_NONE) {
+               SETTING_TRACE_ERROR("error to set audio policy [%s]",
+                               get_error_message(err));
+               if (sound_type != SOUND_TYPE_NOTIFICATION)
+                       sound_manager_release_focus(sound_stream_info_to_set,
+                                       SOUND_STREAM_FOCUS_FOR_PLAYBACK,
+                                       SOUND_BEHAVIOR_NONE, NULL);
+               player_unprepare(ad->mp_player);
+               return false;
        }
 
+       err = player_set_uri(ad->mp_player, ad->song_playing);
+       if (err != PLAYER_ERROR_NONE) {
+               SETTING_TRACE_ERROR("error to set attribute---profile_uri[%s]",
+                               get_error_message(err));
+               if (sound_type != SOUND_TYPE_NOTIFICATION)
+                       sound_manager_release_focus(sound_stream_info_to_set,
+                                       SOUND_STREAM_FOCUS_FOR_PLAYBACK,
+                                       SOUND_BEHAVIOR_NONE, NULL);
+               player_unprepare(ad->mp_player);
+               return false;
+       }
 
-       /*4.Enable "Call ringtone", via "Backuped" value */
-       item_to_update = ad->data_call_volume;
-       if (item_to_update && item_to_update->eo_check) {
-               SETTING_TRACE("....ad->is_ringtone_slidering:%d, "
-                               "ad->data_call_volume->chk_status:%d",
-                               ad->is_ringtone_slidering,
-                               item_to_update->chk_status);
-               /* do need to restore from BACKUP VOLUME */
+#if SUPPORT_PLAYER_ASYNC
+       err = player_prepare_async(ad->mp_player, __mm_player_prepared_cb, ad);
+       if (err != PLAYER_ERROR_NONE) {
+               SETTING_TRACE_ERROR("realizing the player handle failed[%s]",
+                               get_error_message(err));
+               if (sound_type != SOUND_TYPE_NOTIFICATION)
+                       sound_manager_release_focus(sound_stream_info_to_set,
+                                       SOUND_STREAM_FOCUS_FOR_PLAYBACK,
+                                       SOUND_BEHAVIOR_NONE, NULL);
+               player_unprepare(ad->mp_player);
+               return false;
+       }
+       ad->mp_prepare_async = ad->mp_player;
+       SETTING_TRACE("waiting..player (%x)", ad->mp_prepare_async);
+#else
+       err = player_prepare(ad->mp_player);
+       if (err != PLAYER_ERROR_NONE) {
+               SETTING_TRACE_ERROR("player_prepare() error %d", err);
+               if (sound_type != SOUND_TYPE_NOTIFICATION)
+                       sound_manager_release_focus(sound_stream_info_to_set,
+                                       SOUND_STREAM_FOCUS_FOR_PLAYBACK,
+                                       SOUND_BEHAVIOR_NONE, NULL);
+               player_unprepare(ad->mp_player);
+               return false;
+       }
+
+       state = PLAYER_STATE_NONE;
+       err = player_get_state(ad->mp_player, &state);
+       SETTING_TRACE("state:%d", state);
+       if (state != PLAYER_STATE_READY) {
+               SETTING_TRACE_ERROR("state of player is invalid %d", err);
+               if (sound_type != SOUND_TYPE_NOTIFICATION)
+                       sound_manager_release_focus(sound_stream_info_to_set,
+                                       SOUND_STREAM_FOCUS_FOR_PLAYBACK,
+                                       SOUND_BEHAVIOR_NONE, NULL);
+               player_unprepare(ad->mp_player);
+               return false;
+       }
+
+       player_set_completed_cb(ad->mp_player, __mm_player_msg_cb, ad);
+
+       err = player_start(ad->mp_player);
+       if (err != PLAYER_ERROR_NONE) {
+               /* if directly return error.. */
+               SETTING_TRACE_ERROR("player_start [%s]",
+                               get_error_message(err));
+               player_unset_completed_cb(ad->mp_player);
+               if (sound_type != SOUND_TYPE_NOTIFICATION)
+                       sound_manager_release_focus(sound_stream_info_to_set,
+                                       SOUND_STREAM_FOCUS_FOR_PLAYBACK,
+                                       SOUND_BEHAVIOR_NONE, NULL);
+               player_unprepare(ad->mp_player);
+               return false;
+       }
+#endif
+
+       return true;
+}
+
+void setting_sound_play_sound_origin(void *data, void *cb, char *ringtone_file,
+               float vol, sound_type_e sound_type)
+{
+       SETTING_TRACE_BEGIN;
+       int vconf_value = 0;
+       SettingSoundData *ad = (SettingSoundData *) data;
+
+       ret_if(!ad);
+
+       if (vol < EXP) {
+               SETTING_TRACE_DEBUG("vol < EXP");
+               setting_sound_stop_sound(ad);
+               return;
+       }
+
+       vconf_get_bool(VCONFKEY_SETAPPL_ACCESSIBILITY_TURN_OFF_ALL_SOUNDS,
+                       &vconf_value);
+
+       if (vconf_value == TRUE)
+               return;
+
+       setting_sound_play_sound(ad, cb, ringtone_file, vol, sound_type);
+       SETTING_TRACE("play sound type %d", sound_type);
+}
+
+void setting_sound_stop_sound(SettingSoundData *ad)
+{
+       SETTING_TRACE_BEGIN;
+       sound_stream_focus_state_e ssfs = SOUND_STREAM_FOCUS_STATE_ACQUIRED;
+       player_state_e player_state = PLAYER_STATE_NONE;
+
+       if (ad->song_playing) {
+               g_free(ad->song_playing);
+               ad->song_playing = NULL;
+       }
+
+       player_unset_completed_cb(ad->mp_player);
+
+       sound_manager_get_focus_state(ad->ringtone_sound_stream_info, &ssfs, NULL);
+       if (ssfs == SOUND_STREAM_FOCUS_STATE_ACQUIRED)
+               sound_manager_release_focus(ad->ringtone_sound_stream_info,
+                               SOUND_STREAM_FOCUS_FOR_PLAYBACK,
+                               SOUND_BEHAVIOR_NONE, NULL);
+
+       sound_manager_get_focus_state(ad->media_sound_stream_info, &ssfs, NULL);
+       if (ssfs == SOUND_STREAM_FOCUS_STATE_ACQUIRED)
+               sound_manager_release_focus(ad->media_sound_stream_info,
+                               SOUND_STREAM_FOCUS_FOR_PLAYBACK,
+                               SOUND_BEHAVIOR_NONE, NULL);
+
+       player_get_state(ad->mp_player, &player_state);
+
+       if (player_state != PLAYER_STATE_IDLE)
+               if (player_unprepare(ad->mp_player) != PLAYER_ERROR_NONE)
+                       SETTING_TRACE_ERROR("player unrealize failed");
+}
+
+void setting_sound_key_grab(SettingSoundData *ad)
+{
+       SETTING_TRACE_BEGIN;
+
+       /* To prevent conflict with volume app */
+       vconf_set_int(VCONFKEY_STARTER_USE_VOLUME_KEY, 2);
+
+       if (0 != safeStrCmp(ad->viewtype, VOLUME_APP_NAME))
+               return;
+
+       if (!ad->keydown_handler)
+               ad->keydown_handler = ecore_event_handler_add(
+                               ECORE_EVENT_KEY_DOWN, __volume_key_down_cb, ad);
+       if (!ad->keydown_handler)
+               SETTING_TRACE_DEBUG("ecore_event_handler_add() failed");
+
+       if (!ad->keyup_handler)
+               ad->keyup_handler = ecore_event_handler_add(
+                               ECORE_EVENT_KEY_UP, __volume_key_up_cb, ad);
+       if (!ad->keyup_handler)
+               SETTING_TRACE_DEBUG("ecore_event_handler_add() failed");
+}
+
+void setting_sound_key_ungrab(SettingSoundData *ad)
+{
+       SETTING_TRACE_BEGIN;
+
+       /* To prevent conflict with volume app */
+       vconf_set_int(VCONFKEY_STARTER_USE_VOLUME_KEY, 0);
+
+       ecore_timer_del(ad->updown_timer);
+       ad->updown_timer = NULL;
+
+       ecore_event_handler_del(ad->keydown_handler);
+       ad->keydown_handler = NULL;
+
+       ecore_event_handler_del(ad->keyup_handler);
+       ad->keyup_handler = NULL;
+}
+
+Evas_Object *setting_sound_init(SettingSoundData *ad)
+{
+       SETTING_TRACE_BEGIN;
+       int err = 0;
+
+       bindtextdomain(SETTING_PACKAGE, SETTING_LOCALEDIR);
+
+       setting_create_Gendial_itc(SETTING_GENLIST_LEFT_ICON_CONTENT_ICON_STYLE,
+                       &(ad->itc_layout));
+
+       ad->itc_layout.func.content_get = __sound_slider_icon_get;
+
+       setting_create_Gendial_itc(SETTING_GENLIST_LEFT_ICON_CONTENT_ICON_STYLE,
+                       &(ad->itc_layout_1icon));
+
+       ad->itc_layout_1icon.func.content_get = __sound_slider_icon_get;
+
+       /* register view node table */
+       setting_view_node_table_intialize();
+       setting_view_node_table_register(&setting_view_sound_main, NULL);
+
+       err = player_create(&ad->mp_player);
+       if (PLAYER_ERROR_NONE != err) {
+               SETTING_TRACE_ERROR("Cannot create ringtone player %s",
+                               get_error_message(err));
+               return NULL;
+       }
+
+       if (
+               (sound_manager_create_stream_information(
+                               SOUND_STREAM_TYPE_RINGTONE_VOIP,
+                               __sound_stream_focus_state_changed_cb, ad,
+                               &ad->ringtone_sound_stream_info)
+                       != SOUND_MANAGER_ERROR_NONE) ||
+               (sound_manager_create_stream_information(
+                               SOUND_STREAM_TYPE_MEDIA,
+                               __sound_stream_focus_state_changed_cb, ad,
+                               &ad->media_sound_stream_info)
+                       != SOUND_MANAGER_ERROR_NONE) ||
+               (sound_manager_create_stream_information(
+                               SOUND_STREAM_TYPE_NOTIFICATION,
+                               __sound_stream_focus_state_changed_cb, ad,
+                               &ad->noti_sound_stream_info)
+                       != SOUND_MANAGER_ERROR_NONE)
+       ) {
+               SETTING_TRACE_ERROR("Cannot create stream information ");
+               return NULL;
+       }
+       /* creating a view. */
+       setting_view_node_set_cur_view(&setting_view_sound_main);
+       setting_view_create(&setting_view_sound_main, (void *)ad);
+
+       err = feedback_initialize();
+       SETTING_TRACE_DEBUG("Feedback init: %s", get_error_message(err));
+
+       __listen_vconf_change(ad);
+
+       return ad->md.naviframe;
+}
+
+void setting_sound_deinit(void *data)
+{
+       SETTING_TRACE_BEGIN;
+       ret_if(data == NULL);
+       SettingSoundData *ad = data;
+
+       __unlisten_vconf_change(ad);
+       feedback_deinitialize();
+       setting_sound_stop_sound(ad);
+
+       evas_object_del(ad->calling_popup);
+       ad->calling_popup = NULL;
+
+       setting_sound_key_ungrab(ad);
+
+       FREE(ad->viewtype);
+
+       sound_manager_destroy_stream_information(
+                       ad->ringtone_sound_stream_info);
+       sound_manager_destroy_stream_information(ad->media_sound_stream_info);
+       sound_manager_destroy_stream_information(ad->noti_sound_stream_info);
+
+       ad->ringtone_sound_stream_info = ad->media_sound_stream_info =
+       ad->noti_sound_stream_info = NULL;
+
+       player_destroy(ad->mp_player);
+       ad->mp_player = NULL;
+
+       /* it is the view manage strategy to invoke view's destory operation */
+       setting_view_destroy(&setting_view_sound_main, ad);
+
+       SETTING_TRACE_END;
+}
+
+/* Show guide popup, when drag or tap slider if during call.
+       Do not provide pre-listening. */
+void setting_sound_create_warning_popup_during_call(void *data)
+{
+       ret_if(data == NULL);
+       SettingSoundData *ad = (SettingSoundData *)data;
+
+       cm_call_status_e call_status = CM_CALL_STATUS_IDLE;
+       cm_client_h cm_handle = NULL;
+       cm_init(&cm_handle);
+       cm_get_call_status(cm_handle, &call_status);
+       cm_deinit(cm_handle);
+       if (CM_CALL_STATUS_IDLE != call_status) {
+               SETTING_TRACE("Call status is not OFF (%d)", call_status);
+               if (!ad->calling_popup) {
+                       ad->calling_popup = setting_create_popup(
+                                       ad,
+                                       ad->md.window,
+                                       "IDS_ST_HEADER_UNABLE_TO_PLAY_SAMPLE_ABB",
+                                       "IDS_ST_POP_SAMPLES_CANNOT_BE_PLAYED_DURING_CALLS",
+                                       __calling_popup_cb,
+                                       0,
+                                       false,
+                                       false,
+                                       1,
+                                       "IDS_ST_BUTTON_OK");
+               }
+       }
+}
+
+/* ------------------------------------------------------------------------- */
+/* |           | elm.swallow.icon.0 | elm.text | elm.swallow.icon.1 |     | */
+/* | elm.swallow.icon |----------------------------------| elm.swallow.end | */
+/* |             |     elm.text.sub      | elm.text.sub.end   |           | */
+/* ------------------------------------------------------------------------- */
+static Evas_Object *__sound_slider_icon_get(void *data, Evas_Object *obj,
+               const char *part)
+{
+       SETTING_TRACE_BEGIN;
+       /*appcore_measure_start(); */
+       retv_if(data == NULL, NULL);
+
+       SETTING_TRACE(" -----------------> EDC part [%s]", part);
+       if (safeStrCmp(part, "elm.swallow.content"))
+               return NULL;
+
+       Evas_Object *layout;
+       /* Set custom layout style */
+       layout = elm_layout_add(obj);
+
+       Setting_GenGroupItem_Data *item_data =
+                       (Setting_GenGroupItem_Data *)data;
+       Evas_Object *slider = setting_create_slider(obj, item_data);
+
+       if (slider == NULL)
+               return NULL;
+
+       char *gl_style = "gl_custom_item";
+       elm_layout_file_set(layout, EDJDIR"/setting-theme.edj", gl_style);
+       evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
+       evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND,
+                       EVAS_HINT_EXPAND);
+
+       if (0 == safeStrCmp(item_data->keyStr, "IDS_ST_BODY_MEDIA")) {
+               elm_object_style_set(slider, "warning");
+
+               Edje_Message_Float_Set *msg =
+                               alloca(sizeof(Edje_Message_Float_Set)
+                                               + (sizeof(double)));
+               msg->count = 1;
+               /* Warning area point has to be calculated considering rounding
+                * off. For example, value 10's area will be 9.5~10.4.
+                * So, if warning area has to be started at 10, we need to
+                * calculate the start point with 9.5.
+                * Warning start point = (Warning min value - 0.5) /
+                *                              (Max_Value - Min_Value) */
+               msg->val[0] = 0.633333;
+               edje_object_message_send(
+                               _EDJ(slider), EDJE_MESSAGE_FLOAT_SET, 0, msg);
+               elm_slider_indicator_format_set(slider, "%1.0f");
+               elm_slider_indicator_show_set(slider, 1);
+       }
+
+       item_data->eo_check = slider;
+
+       evas_object_pass_events_set(slider, EINA_TRUE);
+       evas_object_propagate_events_set(slider, EINA_FALSE);
+
+       if (item_data->userdata == NULL)
+               return NULL;
+
+       /* Set text into layout */
+       /*if (0 == safeStrCmp(item_data->keyStr, "IDS_ST_BODY_MEDIA") */
+       /*      || 0 == safeStrCmp(item_data->keyStr, "IDS_ST_BODY_SYSTEM"))
+        * { */
+       elm_object_part_text_set(layout, "elm.text", _(item_data->keyStr));
+       /*} */
+       elm_object_part_content_set(layout, "elm.swallow.content", slider);
+       return layout;
+}
+
+static void __enable_sound_menu(void *data)
+{
+       SETTING_TRACE_BEGIN;
+       ret_if(!data);
+       SettingSoundData *ad = data;
+       ad->sound_on = TRUE;
+       Setting_GenGroupItem_Data *item_to_update = NULL;
+
+
+       /*1.Enable "Vibrate when ringing" */
+       if (ad->data_sound_when_ring) {
+               item_to_update = ad->data_sound_when_ring;
+               setting_genlist_item_disabled_set(item_to_update, EINA_FALSE);
+       }
+
+       if (ad->data_call_volume) {
+               elm_object_item_disabled_set(ad->data_call_volume->item,
+                               EINA_FALSE);
+               elm_object_disabled_set(ad->data_call_volume->eo_check,
+                               EINA_FALSE);
+       }
+
+       /*2.Enable "Notification", via Sound Manager */
+       item_to_update = ad->data_noti_volume;
+
+       /* @todo make sure data_msg_alert_tone is correct for 'Silent' set.
+       if (item_to_update && safeStrCmp(item_to_update->sub_desc, "Silent"))*/
+       if ((ad->data_msg_alert_tone &&
+               safeStrCmp(ad->data_msg_alert_tone->sub_desc, "Silent")) ||
+               (!safeStrCmp(ad->viewtype, VOLUME_APP_NAME))
+               ) {
+               /* Enable */
+               if (item_to_update
+                               && item_to_update->item
+                               && item_to_update->eo_check) {
+                       int mm_value = 0;
+                       int ret =  sound_manager_get_volume(
+                                       SOUND_TYPE_NOTIFICATION, &mm_value);
+                       SETTING_TRACE("ret:%d", ret);
+                       item_to_update->chk_status = mm_value;
+                       elm_slider_value_set(
+                                       item_to_update->eo_check,
+                                       item_to_update->chk_status);
+                       elm_object_item_disabled_set(item_to_update->item,
+                                       EINA_FALSE);
+                       elm_object_disabled_set(item_to_update->eo_check,
+                                       EINA_FALSE);
+
+                       setting_sound_update_slider_icon(
+                                       item_to_update, SND_SLIDER_NOTI);
+               }
+       }
+
+       /*3.Enable "System", via Sound Manager */
+       item_to_update = ad->data_touch_volume;
+       if (item_to_update && item_to_update->item
+                       && item_to_update->eo_check) {
+               int mm_value = 0;
+               int ret =  sound_manager_get_volume(
+                               SOUND_TYPE_SYSTEM, &mm_value);
+               SETTING_TRACE("ret:%d", ret);
+               item_to_update->chk_status = mm_value;
+               elm_slider_value_set(
+                               item_to_update->eo_check,
+                               item_to_update->chk_status);
+               elm_object_item_disabled_set(
+                               item_to_update->item, EINA_FALSE);
+               elm_object_disabled_set(item_to_update->eo_check, EINA_FALSE);
+
+               setting_sound_update_slider_icon(
+                               item_to_update, SND_SLIDER_SYSTEM);
+       }
+
+
+       /*4.Enable "Call ringtone", via "Backuped" value */
+       item_to_update = ad->data_call_volume;
+       if (item_to_update && item_to_update->eo_check) {
+               SETTING_TRACE("....ad->is_ringtone_slidering:%d, "
+                               "ad->data_call_volume->chk_status:%d",
+                               ad->is_ringtone_slidering,
+                               item_to_update->chk_status);
+               /* do need to restore from BACKUP VOLUME */
                if (ad->is_ringtone_slidering) return;
 
                int mm_value = 0;
@@ -449,8 +864,9 @@ static void __disable_sound_menu(void *data)
 
 }
 
-static void ___sound_vconf_change_cb(keynode_t *key, void *data)
+static void __sound_vconf_change_cb(keynode_t *key, void *data)
 {
+       SETTING_TRACE_BEGIN;
        ret_if(data == NULL);
        SettingSoundData *ad = data;
        int status = 0;
@@ -565,59 +981,59 @@ static void ___sound_vconf_change_cb(keynode_t *key, void *data)
 #endif
 }
 
-int setting_sound_listen_vconf_change(void *data)
+static int __listen_vconf_change(void *data)
 {
        retv_if(data == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
 
        /*Ints */
        (void)vconf_notify_key_changed(VCONFKEY_SYSMAN_MMC_STATUS,
-                       ___sound_vconf_change_cb, data);
+                       __sound_vconf_change_cb, data);
 
        /*Bools */
        (void)vconf_notify_key_changed(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL,
-                       ___sound_vconf_change_cb, data);
+                       __sound_vconf_change_cb, data);
        (void)vconf_notify_key_changed(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL,
-                       ___sound_vconf_change_cb, data);
+                       __sound_vconf_change_cb, data);
 
        (void)vconf_notify_key_changed(
                        VCONFKEY_SETAPPL_VIBRATE_WHEN_RINGING_BOOL,
-                       ___sound_vconf_change_cb, data);
+                       __sound_vconf_change_cb, data);
        (void)vconf_notify_key_changed(VCONFKEY_SETAPPL_BUTTON_SOUNDS_BOOL,
-                       ___sound_vconf_change_cb, data);
+                       __sound_vconf_change_cb, data);
        (void)vconf_notify_key_changed(VCONFKEY_SETAPPL_TOUCH_SOUNDS_BOOL,
-                       ___sound_vconf_change_cb, data);
+                       __sound_vconf_change_cb, data);
        (void)vconf_notify_key_changed(VCONFKEY_SETAPPL_SOUND_LOCK_BOOL,
-                       ___sound_vconf_change_cb, data);
+                       __sound_vconf_change_cb, data);
        /*      (void)vconf_notify_key_changed(VCONFKEY_ISE_KEYSOUND,
-        *  ___sound_vconf_change_cb, data); */
+        *  __sound_vconf_change_cb, data); */
 
        return 0;
 }
 
-int setting_sound_unlisten_vconf_change(void *data)
+static int __unlisten_vconf_change(void *data)
 {
        /* unused listen */
        /*Ints */
        (void)vconf_ignore_key_changed(VCONFKEY_SYSMAN_MMC_STATUS,
-                       ___sound_vconf_change_cb);
+                       __sound_vconf_change_cb);
 
        /*Bools */
        (void)vconf_ignore_key_changed(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL,
-                       ___sound_vconf_change_cb);
+                       __sound_vconf_change_cb);
        (void)vconf_ignore_key_changed(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL,
-                       ___sound_vconf_change_cb);
+                       __sound_vconf_change_cb);
 
        (void)vconf_ignore_key_changed(
                        VCONFKEY_SETAPPL_VIBRATE_WHEN_RINGING_BOOL,
-                       ___sound_vconf_change_cb);
+                       __sound_vconf_change_cb);
        (void)vconf_ignore_key_changed(VCONFKEY_SETAPPL_BUTTON_SOUNDS_BOOL,
-                       ___sound_vconf_change_cb);
+                       __sound_vconf_change_cb);
        (void)vconf_ignore_key_changed(VCONFKEY_SETAPPL_TOUCH_SOUNDS_BOOL,
-                       ___sound_vconf_change_cb);
+                       __sound_vconf_change_cb);
        (void)vconf_ignore_key_changed(VCONFKEY_SETAPPL_SOUND_LOCK_BOOL,
-                       ___sound_vconf_change_cb);
+                       __sound_vconf_change_cb);
        /*(void)vconf_ignore_key_changed(VCONFKEY_ISE_KEYSOUND,
-        *  ___sound_vconf_change_cb); */
+        *  __sound_vconf_change_cb); */
 
        return 0;
 }
@@ -840,147 +1256,6 @@ static Eina_Bool __volume_key_down_cb(void *data, int type, void *event)
        return EINA_TRUE;
 }
 
-void __setting_sound_key_grab(SettingSoundData *ad)
-{
-       SETTING_TRACE_BEGIN;
-
-       ret_if(!ad);
-
-       /* To prevent conflict with volume app */
-       vconf_set_int(VCONFKEY_STARTER_USE_VOLUME_KEY, 2);
-
-       if (0 != safeStrCmp(ad->viewtype, VOLUME_APP_NAME))
-               return;
-
-       if (!ad->keydown_handler)
-               ad->keydown_handler = ecore_event_handler_add(
-                               ECORE_EVENT_KEY_DOWN, __volume_key_down_cb, ad);
-       if (!ad->keydown_handler)
-               SETTING_TRACE_DEBUG("ecore_event_handler_add() failed");
-
-       if (!ad->keyup_handler)
-               ad->keyup_handler = ecore_event_handler_add(
-                               ECORE_EVENT_KEY_UP, __volume_key_up_cb, ad);
-       if (!ad->keyup_handler)
-               SETTING_TRACE_DEBUG("ecore_event_handler_add() failed");
-}
-
-void __setting_sound_key_ungrab(SettingSoundData *ad)
-{
-       SETTING_TRACE_BEGIN;
-
-       ret_if(!ad);
-
-       /* To prevent conflict with volume app */
-       vconf_set_int(VCONFKEY_STARTER_USE_VOLUME_KEY, 0);
-
-       ecore_timer_del(ad->updown_timer);
-       ad->updown_timer = NULL;
-
-       ecore_event_handler_del(ad->keydown_handler);
-       ad->keydown_handler = NULL;
-
-       ecore_event_handler_del(ad->keyup_handler);
-       ad->keyup_handler = NULL;
-}
-
-Evas_Object *setting_sound_init(void *data)
-{
-       int err = 0;
-       SETTING_TRACE_BEGIN;
-       /*appcore_measure_start(); */
-       retv_if(data == NULL, NULL);
-       SettingSoundData *ad = data;
-
-       bindtextdomain(SETTING_PACKAGE, SETTING_LOCALEDIR);
-
-       setting_create_Gendial_itc(SETTING_GENLIST_LEFT_ICON_CONTENT_ICON_STYLE,
-                       &(ad->itc_layout));
-
-       ad->itc_layout.func.content_get = __sound_slider_icon_get;
-
-       setting_create_Gendial_itc(SETTING_GENLIST_LEFT_ICON_CONTENT_ICON_STYLE,
-                       &(ad->itc_layout_1icon));
-
-       ad->itc_layout_1icon.func.content_get = __sound_slider_icon_get;
-
-       /* register view node table */
-       setting_view_node_table_intialize();
-       setting_view_node_table_register(&setting_view_sound_main, NULL);
-
-       err = player_create(&ad->mp_player);
-       if (PLAYER_ERROR_NONE != err) {
-               SETTING_TRACE_ERROR("Cannot create ringtone player %s",
-                               get_error_message(err));
-               return NULL;
-       }
-
-       if (
-               (sound_manager_create_stream_information(
-                               SOUND_STREAM_TYPE_RINGTONE_VOIP,
-                               __sound_stream_focus_state_changed_cb, ad,
-                               &ad->ringtone_sound_stream_info)
-                       != SOUND_MANAGER_ERROR_NONE) ||
-               (sound_manager_create_stream_information(
-                               SOUND_STREAM_TYPE_MEDIA,
-                               __sound_stream_focus_state_changed_cb, ad,
-                               &ad->media_sound_stream_info)
-                       != SOUND_MANAGER_ERROR_NONE) ||
-               (sound_manager_create_stream_information(
-                               SOUND_STREAM_TYPE_NOTIFICATION,
-                               __sound_stream_focus_state_changed_cb, ad,
-                               &ad->noti_sound_stream_info)
-                       != SOUND_MANAGER_ERROR_NONE)
-       ) {
-               SETTING_TRACE_ERROR("Cannot create stream information ");
-               return NULL;
-       }
-       /* creating a view. */
-       setting_view_node_set_cur_view(&setting_view_sound_main);
-       setting_view_create(&setting_view_sound_main, (void *)ad);
-
-       err = feedback_initialize();
-       SETTING_TRACE_DEBUG("Feedback init: %s", get_error_message(err));
-
-       setting_sound_listen_vconf_change(ad);
-
-       return ad->md.naviframe;
-}
-
-void setting_sound_deinit(void *data)
-{
-       SETTING_TRACE_BEGIN;
-       ret_if(data == NULL);
-       SettingSoundData *ad = data;
-
-       setting_sound_unlisten_vconf_change(ad);
-       feedback_deinitialize();
-       setting_sound_stop_sound(ad);
-
-       evas_object_del(ad->calling_popup);
-       ad->calling_popup = NULL;
-
-       __setting_sound_key_ungrab(ad);
-
-       FREE(ad->viewtype);
-
-       sound_manager_destroy_stream_information(
-                       ad->ringtone_sound_stream_info);
-       sound_manager_destroy_stream_information(ad->media_sound_stream_info);
-       sound_manager_destroy_stream_information(ad->noti_sound_stream_info);
-
-       ad->ringtone_sound_stream_info = ad->media_sound_stream_info =
-       ad->noti_sound_stream_info = NULL;
-
-       player_destroy(ad->mp_player);
-       ad->mp_player = NULL;
-
-       /* it is the view manage strategy to invoke view's destory operation */
-       setting_view_destroy(&setting_view_sound_main, ad);
-
-       SETTING_TRACE_END;
-}
-
 /* ***************************************************
  *
  *general func
@@ -990,47 +1265,16 @@ static void __calling_popup_cb(void *data, Evas_Object *obj, void *event_info)
 {
        ret_if(data == NULL);
        SettingSoundData *ad = (SettingSoundData *) data;
-
-       if (ad->calling_popup) {
-               evas_object_del(ad->calling_popup);
-               ad->calling_popup = NULL;
-       }
-}
-
-/* Show guide popup, when drag or tap slider if during call.
-       Do not provide pre-listening. */
-void setting_sound_create_warning_popup_during_call(void *data)
-{
-       ret_if(data == NULL);
-       SettingSoundData *ad = (SettingSoundData *)data;
-
-       cm_call_status_e call_status = CM_CALL_STATUS_IDLE;
-       cm_client_h cm_handle = NULL;
-       cm_init(&cm_handle);
-       cm_get_call_status(cm_handle, &call_status);
-       cm_deinit(cm_handle);
-       if (CM_CALL_STATUS_IDLE != call_status) {
-               SETTING_TRACE("Call status is not OFF (%d)", call_status);
-               if (!ad->calling_popup) {
-                       ad->calling_popup = setting_create_popup(
-                                       ad,
-                                       ad->md.window,
-                                       "IDS_ST_HEADER_UNABLE_TO_PLAY_SAMPLE_ABB",
-                                       "IDS_ST_POP_SAMPLES_CANNOT_BE_PLAYED_DURING_CALLS",
-                                       __calling_popup_cb,
-                                       0,
-                                       false,
-                                       false,
-                                       1,
-                                       "IDS_ST_BUTTON_OK");
-               }
+
+       if (ad->calling_popup) {
+               evas_object_del(ad->calling_popup);
+               ad->calling_popup = NULL;
        }
 }
 
-#define EXP 0.001
-
 static void __mm_player_msg_cb(void *user_param)
 {
+       SETTING_TRACE_BEGIN;
        ret_if(user_param == NULL);
        SettingSoundData *ad = (SettingSoundData *)user_param;
 
@@ -1040,10 +1284,10 @@ static void __mm_player_msg_cb(void *user_param)
 
 static Eina_Bool __play_timer_cb(void *data)
 {
+       SETTING_TRACE_BEGIN;
        int err;
        player_state_e state = PLAYER_STATE_NONE;
 
-       SETTING_TRACE_BEGIN;
        retv_if(!data, EINA_FALSE);
        SettingSoundData *ad = (SettingSoundData *)data;
 
@@ -1103,257 +1347,3 @@ static void __sound_stream_focus_state_changed_cb(
        }
 }
 
-bool setting_sound_play_sound(
-               void *data,
-               void *cb,
-               char *ringtone_file,
-               int vol,
-               sound_type_e sound_type)
-{
-       int err = 0;
-       sound_stream_focus_state_e ssfs = SOUND_STREAM_FOCUS_STATE_ACQUIRED;
-       player_state_e state = PLAYER_STATE_NONE;
-       /* error check */
-       retv_if(data == NULL, NULL);
-       SettingSoundData *ad = (SettingSoundData *) data;
-       sound_stream_info_h sound_stream_info_to_set = NULL;
-
-       int is_existing = setting_sound_check_file_exist(ad, ringtone_file);
-
-       if (is_existing == SETTING_RETURN_FAIL || NULL == ringtone_file) {
-               switch (sound_type) {
-               case SOUND_TYPE_RINGTONE:
-                       if (isEmulBin())
-                               ad->song_playing = (char *)g_strdup(
-                                               SETTING_DEFAULT_CALL_TONE_SDK);
-                       else
-                               ad->song_playing = (char *)g_strdup(
-                                               SETTING_DEFAULT_CALL_TONE);
-                       sound_stream_info_to_set =
-                                       ad->ringtone_sound_stream_info;
-                       break;
-               case SOUND_TYPE_MEDIA:
-                       if (isEmulBin())
-                               ad->song_playing = (char *)g_strdup(
-                                               SETTING_DEFAULT_CALL_TONE_SDK);
-                       else
-                               ad->song_playing = (char *)g_strdup(
-                                               SETTING_DEFAULT_MEDIA_TONE);
-                       sound_stream_info_to_set = ad->media_sound_stream_info;
-                       break;
-               case SOUND_TYPE_NOTIFICATION:
-                       ad->song_playing = (char *)g_strdup(
-                                       SETTING_DEFAULT_MSG_TONE);
-                       sound_stream_info_to_set = ad->noti_sound_stream_info;
-                       break;
-               default:
-                       return false;
-                       break;
-               }
-
-       } else {
-               if (safeStrCmp(ringtone_file, "Silent") == 0)
-                       return false;
-
-               switch (sound_type) {
-               case SOUND_TYPE_RINGTONE:
-                       sound_stream_info_to_set =
-                                       ad->ringtone_sound_stream_info;
-                       break;
-               case SOUND_TYPE_MEDIA:
-                       sound_stream_info_to_set = ad->media_sound_stream_info;
-                       break;
-               case SOUND_TYPE_NOTIFICATION:
-                       sound_stream_info_to_set = ad->noti_sound_stream_info;
-                       break;
-               default:
-                       return false;
-                       break;
-               }
-               ad->song_playing = (char *)g_strdup(ringtone_file);
-       }
-
-       player_get_state(ad->mp_player, &state);
-       if (state != PLAYER_STATE_IDLE) {
-               if (err != player_unprepare(ad->mp_player)) {
-                       SETTING_TRACE_ERROR("player_unprepare() failed: [%s]",
-                                       get_error_message(err));
-                       player_unprepare(ad->mp_player);
-                       return false;
-
-               }
-       }
-
-       if (sound_type != SOUND_TYPE_NOTIFICATION) {
-               sound_manager_get_focus_state(sound_stream_info_to_set, &ssfs,
-                               NULL);
-               if (ssfs == SOUND_STREAM_FOCUS_STATE_RELEASED) {
-                       err = sound_manager_acquire_focus(
-                                       sound_stream_info_to_set,
-                                       SOUND_STREAM_FOCUS_FOR_PLAYBACK,
-                                       SOUND_BEHAVIOR_NONE, NULL);
-                       if (err != SOUND_MANAGER_ERROR_NONE) {
-                               SETTING_TRACE_ERROR(
-                                               "Could not acquire focus: [%s]",
-                                               get_error_message(err));
-                               player_unprepare(ad->mp_player);
-                               return false;
-                       }
-               }
-       }
-
-       player_get_state(ad->mp_player, &state);
-       if (state != PLAYER_STATE_IDLE)
-               player_unprepare(ad->mp_player);
-
-       err = player_set_audio_policy_info(ad->mp_player, sound_stream_info_to_set);
-       if (err != PLAYER_ERROR_NONE) {
-               SETTING_TRACE_ERROR("error to set audio policy [%s]",
-                               get_error_message(err));
-               if (sound_type != SOUND_TYPE_NOTIFICATION)
-                       sound_manager_release_focus(sound_stream_info_to_set,
-                                       SOUND_STREAM_FOCUS_FOR_PLAYBACK,
-                                       SOUND_BEHAVIOR_NONE, NULL);
-               player_unprepare(ad->mp_player);
-               return false;
-       }
-
-       err = player_set_uri(ad->mp_player, ad->song_playing);
-       if (err != PLAYER_ERROR_NONE) {
-               SETTING_TRACE_ERROR("error to set attribute---profile_uri[%s]",
-                               get_error_message(err));
-               if (sound_type != SOUND_TYPE_NOTIFICATION)
-                       sound_manager_release_focus(sound_stream_info_to_set,
-                                       SOUND_STREAM_FOCUS_FOR_PLAYBACK,
-                                       SOUND_BEHAVIOR_NONE, NULL);
-               player_unprepare(ad->mp_player);
-               return false;
-       }
-
-#if SUPPORT_PLAYER_ASYNC
-       err = player_prepare_async(ad->mp_player, __mm_player_prepared_cb, ad);
-       if (err != PLAYER_ERROR_NONE) {
-               SETTING_TRACE_ERROR("realizing the player handle failed[%s]",
-                               get_error_message(err));
-               if (sound_type != SOUND_TYPE_NOTIFICATION)
-                       sound_manager_release_focus(sound_stream_info_to_set,
-                                       SOUND_STREAM_FOCUS_FOR_PLAYBACK,
-                                       SOUND_BEHAVIOR_NONE, NULL);
-               player_unprepare(ad->mp_player);
-               return false;
-       }
-       ad->mp_prepare_async = ad->mp_player;
-       SETTING_TRACE("waiting..player (%x)", ad->mp_prepare_async);
-#else
-       err = player_prepare(ad->mp_player);
-       if (err != PLAYER_ERROR_NONE) {
-               SETTING_TRACE_ERROR("player_prepare() error %d", err);
-               if (sound_type != SOUND_TYPE_NOTIFICATION)
-                       sound_manager_release_focus(sound_stream_info_to_set,
-                                       SOUND_STREAM_FOCUS_FOR_PLAYBACK,
-                                       SOUND_BEHAVIOR_NONE, NULL);
-               player_unprepare(ad->mp_player);
-               return false;
-       }
-
-       state = PLAYER_STATE_NONE;
-       err = player_get_state(ad->mp_player, &state);
-       SETTING_TRACE("state:%d", state);
-       if (state != PLAYER_STATE_READY) {
-               SETTING_TRACE_ERROR("state of player is invalid %d", err);
-               if (sound_type != SOUND_TYPE_NOTIFICATION)
-                       sound_manager_release_focus(sound_stream_info_to_set,
-                                       SOUND_STREAM_FOCUS_FOR_PLAYBACK,
-                                       SOUND_BEHAVIOR_NONE, NULL);
-               player_unprepare(ad->mp_player);
-               return false;
-       }
-
-       player_set_completed_cb(ad->mp_player, __mm_player_msg_cb, ad);
-
-       err = player_start(ad->mp_player);
-       if (err != PLAYER_ERROR_NONE) {
-               /* if directly return error.. */
-               SETTING_TRACE_ERROR("player_start [%s]",
-                               get_error_message(err));
-               player_unset_completed_cb(ad->mp_player);
-               if (sound_type != SOUND_TYPE_NOTIFICATION)
-                       sound_manager_release_focus(sound_stream_info_to_set,
-                                       SOUND_STREAM_FOCUS_FOR_PLAYBACK,
-                                       SOUND_BEHAVIOR_NONE, NULL);
-               player_unprepare(ad->mp_player);
-               return false;
-       }
-#endif
-
-       return true;
-}
-
-void setting_sound_play_sound_origin(
-               void *data,
-               void *cb,
-               char *ringtone_file,
-               float vol,
-               sound_type_e sound_type)
-{
-       int vconf_value = 0;
-       SettingSoundData *ad = (SettingSoundData *) data;
-       SETTING_TRACE_BEGIN;
-
-       ret_if(data == NULL);
-
-       if (vol < EXP) {
-               SETTING_TRACE_DEBUG("vol < EXP");
-               setting_sound_stop_sound(data);
-               return;
-       }
-
-       vconf_get_bool(VCONFKEY_SETAPPL_ACCESSIBILITY_TURN_OFF_ALL_SOUNDS,
-                       &vconf_value);
-
-       if (vconf_value == TRUE)
-               return;
-
-       setting_sound_play_sound(ad, cb, ringtone_file, vol, sound_type);
-       SETTING_TRACE("play sound type %d", sound_type);
-
-}
-
-void setting_sound_stop_sound(void *data)
-{
-       sound_stream_focus_state_e ssfs = SOUND_STREAM_FOCUS_STATE_ACQUIRED;
-       SettingSoundData *ad = (SettingSoundData *)data;
-       player_state_e player_state = PLAYER_STATE_NONE;
-
-       SETTING_TRACE_BEGIN;
-
-       if (!data)
-               return;
-
-       if (ad->song_playing) {
-               g_free(ad->song_playing);
-               ad->song_playing = NULL;
-       }
-
-       player_unset_completed_cb(ad->mp_player);
-
-       sound_manager_get_focus_state(ad->ringtone_sound_stream_info, &ssfs,
-                       NULL);
-       if (ssfs == SOUND_STREAM_FOCUS_STATE_ACQUIRED)
-               sound_manager_release_focus(ad->ringtone_sound_stream_info,
-                               SOUND_STREAM_FOCUS_FOR_PLAYBACK,
-                               SOUND_BEHAVIOR_NONE, NULL);
-
-       sound_manager_get_focus_state(ad->media_sound_stream_info, &ssfs, NULL);
-       if (ssfs == SOUND_STREAM_FOCUS_STATE_ACQUIRED)
-               sound_manager_release_focus(ad->media_sound_stream_info,
-                               SOUND_STREAM_FOCUS_FOR_PLAYBACK,
-                               SOUND_BEHAVIOR_NONE, NULL);
-
-       player_get_state(ad->mp_player, &player_state);
-
-       if (player_state != PLAYER_STATE_IDLE)
-               if (player_unprepare(ad->mp_player) != PLAYER_ERROR_NONE)
-                       SETTING_TRACE_ERROR("player unrealize failed");
-}
-
index d0779c258a7442c4912020637c1e7e42dd165c7a..a5d6deb4a61fc2b323dd1db6ac2964aaeb533620 100644 (file)
 
 #include <notification_setting.h>
 #include <notification_setting_internal.h>
-
-#include "setting-profile-sound-main.h"
 #include "setting-profile.h"
 #include "setting-common-general-func.h"
 
-#define DO_NOT_DISTURB_OP "http://tizen.org/appcontrol/operation/setting/"\
-       "do_not_disturb"
-#define APP_NOTIFICATIONS_OP "http://tizen.org/appcontrol/operation/setting/"\
-       "app_notifications"
-#define NOTIFICATIONS_ON_LOCK_SCREEN "http://tizen.org/appcontrol/operation/setting/"\
-       "notification_on_lock_screen"
+#define DO_NOT_DISTURB_OP \
+       "http://tizen.org/appcontrol/operation/setting/do_not_disturb"
+#define APP_NOTIFICATIONS_OP \
+       "http://tizen.org/appcontrol/operation/setting/app_notifications"
+#define NOTIFICATIONS_ON_LOCK_SCREEN \
+       "http://tizen.org/appcontrol/operation/setting/notification_on_lock_screen"
 
 #define SETTING_DEFAULT_RINGTONE_VOL_INT       11
 #define SETTING_DEFAULT_NOTI_VOL_INT           11
 #define SETTING_DEFAULT_MEDIA_VOL_INT          9
 #define SETTING_DEFAULT_SYSTEM_VOL_INT         9
-
+#define NOTIFICATION_STR_ON_LOCK_SCREEN \
+       "IDS_QP_TMBODY_NOTIFICATIONS_ON_LOCK_SCREEN"
+#define NOTIFICATION_STR_ON_LOCK_SCREEN_HIDE "IDS_ST_OPT_HIDE_CONTENT"
+#define NOTIFICATION_STR_ON_LOCK_SCREEN_HIDE_SENSITIVE \
+       "IDS_QP_OPT_HIDE_SENSITIVE_CONTENT_ABB"
+#define NOTIFICATION_STR_ON_LOCK_SCREEN_SHOW_ALL \
+       "IDS_QP_OPT_SHOW_ALL_CONTENT_ABB"
 #define SILENT_MODE "Silent"
-
-static int setting_sound_main_create(void *cb);
-static int setting_sound_main_destroy(void *cb);
-static Eina_Bool _view_pop_cb(void *data, Elm_Object_Item *it);
-
-setting_view setting_view_sound_main = {
-       .create = setting_sound_main_create,
-       .destroy = setting_sound_main_destroy,
-       .update = NULL,
-       .cleanup = NULL
-};
+#define INIT_PATH      _TZ_SYS_SHARE"/settings/Vibrations/"
 
 /* should be called in function to return void */
 #define ADD_GENLIST2(genlist, parent) \
@@ -72,7 +66,7 @@ setting_view setting_view_sound_main = {
                item = setting_create_Gendial_field_def( \
                                genlist, \
                                &(item_style), \
-                               setting_sound_main_mouse_up_Gendial_list_cb, \
+                               __mouse_up_Gendial_list_cb, \
                                data, \
                                SWALLOW_Type_1ICON_1RADIO, \
                                NULL, \
@@ -97,7 +91,7 @@ setting_view setting_view_sound_main = {
                _item = setting_create_Gendial_field_def( \
                                genlist, \
                                &(item_style), \
-                               setting_sound_main_mouse_up_Gendial_list_cb, \
+                               __mouse_up_Gendial_list_cb, \
                                data, \
                                SWALLOW_Type_1ICON_1RADIO, \
                                NULL, \
@@ -164,11 +158,85 @@ setting_view setting_view_sound_main = {
                } \
        }
 
+static int __view_create(void *cb);
+static int __view_destroy(void *cb);
+static Eina_Bool __view_pop_cb(void *data, Elm_Object_Item *it);
+static void __mouse_up_Gendial_list_cb(void *data, Evas_Object *obj,
+               void *event_info);
+
+setting_view setting_view_sound_main = {
+       .create = __view_create,
+       .destroy = __view_destroy,
+       .update = NULL,
+       .cleanup = NULL
+};
+
+/* ***************************************************
+ *
+ * Public functions
+ *
+ ***************************************************/
+
+const char *setting_do_not_disturb_is_enable(void *data)
+{
+       int err = NOTIFICATION_ERROR_NONE;
+       bool do_not_disturb;
+       notification_system_setting_h system_setting = NULL;
+
+       err = notification_system_setting_load_system_setting(&system_setting);
+       setting_retvm_if(NULL == system_setting || NOTIFICATION_ERROR_NONE != err,
+                       "NULL parameter",
+                       "notification_system_setting_load_system_Setting failed");
+       err = notification_system_setting_get_do_not_disturb(
+                       system_setting, &do_not_disturb);
+       SETTING_TRACE("do_not_disturb: %d", do_not_disturb);
+
+       if (1 == do_not_disturb) {
+               notification_system_setting_free_system_setting(system_setting);
+               return "IDS_ST_BODY_ON";
+       } else {
+               notification_system_setting_free_system_setting(system_setting);
+               return "IDS_ST_BODY_ALERTTYPE_OFF";
+       }
+}
+
+const char *setting_notifiaction_on_lock_screen(void *data)
+{
+       int err = NOTIFICATION_ERROR_NONE;
+       notification_system_setting_h system_setting = NULL;
+       lock_screen_content_level_e level = 0;
+
+       err = notification_system_setting_load_system_setting(&system_setting);
+       setting_retvm_if(NOTIFICATION_ERROR_NONE != err,
+                       "NULL parameter",
+                       "notification_system_setting_load_system_setting failed");
+
+       err = notification_system_setting_get_lock_screen_content(
+                       system_setting, &level);
+       if (NOTIFICATION_ERROR_NONE != err) {
+               notification_system_setting_free_system_setting(system_setting);
+               SETTING_TRACE_ERROR("notification_system_setting_get_"\
+                               "lock_screen_content failed");
+               return "";
+       }
+
+       if (system_setting)
+               notification_system_setting_free_system_setting(system_setting);
+
+       if (level == SHOW_ALL_CONTENT)
+               return NOTIFICATION_STR_ON_LOCK_SCREEN_SHOW_ALL;
+       else if (level == HIDE_SENSITIVE_CONTENT)
+               return NOTIFICATION_STR_ON_LOCK_SCREEN_HIDE_SENSITIVE;
+       else
+               return NOTIFICATION_STR_ON_LOCK_SCREEN_HIDE;
+}
+
 /* ***************************************************
  *
- *basic func
+ * basic func
  *
  ***************************************************/
+
 static Eina_Bool __play_ringtone_sound_idle_cb(void *data)
 {
        double current;
@@ -241,7 +309,6 @@ static Eina_Bool __play_ringtone_sound_idle_cb(void *data)
        return EINA_FALSE;
 }
 
-
 void __start_change_cb(void *data, Evas_Object *obj, void *event_info)
 {
        SETTING_TRACE_BEGIN;
@@ -263,12 +330,10 @@ void __start_change_cb(void *data, Evas_Object *obj, void *event_info)
 static void __call_slider_change_cb(
                void *data, Evas_Object *obj, void *event_info)
 {
+       SETTING_TRACE_BEGIN;
        SettingSoundData *ad = NULL;
        double val = 0.0;
-       Setting_GenGroupItem_Data *list_item =
-                       (Setting_GenGroupItem_Data *)data;
-       SETTING_TRACE_BEGIN;
-
+       Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *)data;
        ret_if(!data);
 
        val = elm_slider_value_get(obj);
@@ -278,8 +343,7 @@ static void __call_slider_change_cb(
 
        if (list_item->chk_status != (int)(val + 0.5)) {
                list_item->chk_status = (int)(val + 0.5);
-               sound_manager_set_volume(
-                               SOUND_TYPE_RINGTONE, list_item->chk_status);
+               sound_manager_set_volume(SOUND_TYPE_RINGTONE, list_item->chk_status);
                SETTING_TRACE_DEBUG(
                                "ringtone volume is %d, %f",
                                list_item->chk_status,
@@ -518,7 +582,6 @@ static void __sys_slider_change_cb(
        }
 }
 
-
 void __stop_change_cb(void *data, Evas_Object *obj, void *event_info)
 {
        SETTING_TRACE_BEGIN;
@@ -538,64 +601,8 @@ void __stop_change_cb(void *data, Evas_Object *obj, void *event_info)
        SETTING_TRACE_END;
 }
 
-const char *setting_do_not_disturb_is_enable(void *data)
-{
-       int err = NOTIFICATION_ERROR_NONE;
-       bool do_not_disturb;
-       notification_system_setting_h system_setting = NULL;
-
-       err = notification_system_setting_load_system_setting(&system_setting);
-       setting_retvm_if(NULL == system_setting
-                       || NOTIFICATION_ERROR_NONE != err,
-                       "NULL parameter",
-                       "notification_system_setting_load_system_Setting failed");
-       err = notification_system_setting_get_do_not_disturb(
-                       system_setting, &do_not_disturb);
-       SETTING_TRACE("do_not_disturb: %d", do_not_disturb);
-
-       if (1 == do_not_disturb) {
-               notification_system_setting_free_system_setting(system_setting);
-               return "IDS_ST_BODY_ON";
-       } else {
-               notification_system_setting_free_system_setting(system_setting);
-               return "IDS_ST_BODY_ALERTTYPE_OFF";
-       }
-}
-
-const char *setting_notifiaction_on_lock_screen(void *data)
-{
-       int err = NOTIFICATION_ERROR_NONE;
-       notification_system_setting_h system_setting = NULL;
-       lock_screen_content_level_e level = 0;
-
-       err = notification_system_setting_load_system_setting(&system_setting);
-       setting_retvm_if(NOTIFICATION_ERROR_NONE != err,
-                       "NULL parameter",
-                       "notification_system_setting_load_system_setting failed");
-
-       err = notification_system_setting_get_lock_screen_content(
-                       system_setting, &level);
-       if (NOTIFICATION_ERROR_NONE != err) {
-               notification_system_setting_free_system_setting(system_setting);
-               SETTING_TRACE_ERROR("notification_system_setting_get_"\
-                               "lock_screen_content failed");
-               return "";
-       }
-
-       if (system_setting)
-               notification_system_setting_free_system_setting(system_setting);
-
-       if (level == SHOW_ALL_CONTENT)
-               return NOTIFICATION_STR_ON_LOCK_SCREEN_SHOW_ALL;
-       else if (level == HIDE_SENSITIVE_CONTENT)
-               return NOTIFICATION_STR_ON_LOCK_SCREEN_HIDE_SENSITIVE;
-       else
-               return NOTIFICATION_STR_ON_LOCK_SCREEN_HIDE;
-}
-
-static void
-__sound_chk_cb(void *data, Evas_Object *obj,
-                          void *event_info)
+static void __sound_chk_cb(void *data, Evas_Object *obj,
+                                                  void *event_info)
 {
        SETTING_TRACE_BEGIN;
        /* error check */
@@ -609,10 +616,9 @@ __sound_chk_cb(void *data, Evas_Object *obj,
        list_item->chk_status = elm_check_state_get(obj);
        /* rollback */
        setting_update_gl_item_chk_status(list_item, !list_item->chk_status);
-       setting_sound_main_mouse_up_Gendial_list_cb(ad, NULL, list_item->item);
+       __mouse_up_Gendial_list_cb(ad, NULL, list_item->item);
 }
 
-#define INIT_PATH      _TZ_SYS_SHARE"/settings/Vibrations/"
 static void __get_lite_main_list(void *data)
 {
        SETTING_TRACE_BEGIN;
@@ -719,7 +725,7 @@ static void __get_lite_main_list(void *data)
                        setting_create_Gendial_field_def(
                                        genlist,
                                        &itc_2text_2,
-                                       setting_sound_main_mouse_up_Gendial_list_cb,
+                                       __mouse_up_Gendial_list_cb,
                                        ad,
                                        SWALLOW_Type_INVALID,
                                        NULL,
@@ -795,7 +801,7 @@ static void __get_lite_main_list(void *data)
                        setting_create_Gendial_field_def(
                                        genlist,
                                        &itc_2text_2,
-                                       setting_sound_main_mouse_up_Gendial_list_cb,
+                                       __mouse_up_Gendial_list_cb,
                                        ad,
                                        SWALLOW_Type_INVALID,
                                        NULL,
@@ -907,7 +913,7 @@ static void __get_lite_main_list(void *data)
 
                /* 8. Feedback */
                setting_create_Gendial_field_def(genlist, &itc_1text,
-                               setting_sound_main_mouse_up_Gendial_list_cb,
+                               __mouse_up_Gendial_list_cb,
                                data, SWALLOW_Type_INVALID, NULL,
                                NULL, 0,
                                "IDS_ST_HEADER_FEEDBACK", NULL, NULL);
@@ -923,7 +929,7 @@ static void __get_lite_main_list(void *data)
                ad->data_do_not_disturb = setting_create_Gendial_field_def(
                                genlist,
                                &itc_2text_2,
-                               setting_sound_main_mouse_up_Gendial_list_cb,
+                               __mouse_up_Gendial_list_cb,
                                data,
                                SWALLOW_Type_INVALID,
                                NULL,
@@ -936,7 +942,7 @@ static void __get_lite_main_list(void *data)
                setting_create_Gendial_field_def(
                                genlist,
                                &itc_2text_2,
-                               setting_sound_main_mouse_up_Gendial_list_cb,
+                               __mouse_up_Gendial_list_cb,
                                data,
                                SWALLOW_Type_INVALID,
                                NULL,
@@ -952,7 +958,7 @@ static void __get_lite_main_list(void *data)
                ad->data_notifiaction_on_lock_screen = setting_create_Gendial_field_def(
                                genlist,
                                &itc_2text_2,
-                               setting_sound_main_mouse_up_Gendial_list_cb,
+                               __mouse_up_Gendial_list_cb,
                                data,
                                SWALLOW_Type_INVALID,
                                NULL,
@@ -971,16 +977,16 @@ static void __get_lite_main_list(void *data)
        }
 }
 
-static void setting_soudn_main_click_softkey_back_cb(void *data,
+static void __click_softkey_back_cb(void *data,
                Evas_Object *obj, void *event_info)
 {
        SETTING_TRACE_BEGIN;
        SettingSoundData *ad = (SettingSoundData *)data;
-       if (ad)
-               elm_naviframe_item_pop(ad->md.naviframe);
+       ret_if(!ad);
+       elm_naviframe_item_pop(ad->md.naviframe);
 }
 
-static int setting_sound_main_create(void *cb)
+static int __view_create(void *cb)
 {
        Evas_Object *back_button = NULL;
 
@@ -994,17 +1000,16 @@ static int setting_sound_main_create(void *cb)
                return ret;
 
        /* 1.Grab Hard Key */
-       __setting_sound_key_grab(ad);
+       setting_sound_key_grab(ad);
        SETTING_TRACE("viewtype: %s", ad->viewtype);
        __get_lite_main_list(ad);
 
        back_button = setting_create_button(ad->md.naviframe,
                        _(NULL), NAVI_BACK_ARROW_BUTTON_STYLE,
-                       setting_soudn_main_click_softkey_back_cb, ad);
+                       __click_softkey_back_cb, ad);
        elm_layout_content_set(ad->md.naviframe, "prev_btn",
                        back_button);
-       elm_naviframe_item_pop_cb_set(ad->md.naviframe_it, _view_pop_cb,
-                       ad);
+       elm_naviframe_item_pop_cb_set(ad->md.naviframe_it, __view_pop_cb, ad);
        elm_object_item_domain_text_translatable_set(
                        ad->md.naviframe_it, SETTING_PACKAGE,
                        EINA_TRUE);
@@ -1015,7 +1020,7 @@ static int setting_sound_main_create(void *cb)
        return SETTING_RETURN_SUCCESS;
 }
 
-static int setting_sound_main_destroy(void *cb)
+static int __view_destroy(void *cb)
 {
        /* error check */
        retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
@@ -1026,7 +1031,7 @@ static int setting_sound_main_destroy(void *cb)
        SettingSoundData *ad = (SettingSoundData *) cb;
 
        /* 1.Ungrab Key */
-       __setting_sound_key_ungrab(ad);
+       setting_sound_key_ungrab(ad);
 
        if (ad->play_ringtone_idler) {
                ecore_idler_del(ad->play_ringtone_idler);
@@ -1040,9 +1045,12 @@ static int setting_sound_main_destroy(void *cb)
        return SETTING_RETURN_SUCCESS;
 }
 
-static Eina_Bool _view_pop_cb(void *data, Elm_Object_Item *it)
+static Eina_Bool __view_pop_cb(void *data, Elm_Object_Item *it)
 {
-       setting_sound_stop_sound(data);
+       SETTING_TRACE_BEGIN;
+       SettingSoundData *ad = data;
+       retv_if(!ad, EINA_FALSE);
+       setting_sound_stop_sound(ad);
        ui_app_exit();
        return EINA_TRUE;
 }
@@ -1053,17 +1061,24 @@ static Eina_Bool _view_pop_cb(void *data, Elm_Object_Item *it)
  *
  ***************************************************/
 
-static void _update_slider_item(Setting_GenGroupItem_Data *item_to_update, sound_type_e sound_type_to_update,
-                                                               const char *ringtone_file, int icon_type)
+static void __update_slider_item(Setting_GenGroupItem_Data *item_to_update,
+               sound_type_e sound_type_to_update, const char *ringtone_file,
+               int icon_type)
 {
        int mm_value = 0;
-       if (!item_to_update)
-               return;
+       SettingSoundData *ad = NULL;
+
+       ret_if(!item_to_update);
+       ad = item_to_update->userdata;
+       ret_if(!ad);
 
        if (!safeStrCmp(ringtone_file, SILENT_MODE)) {
                /* Disable */
                if (item_to_update && item_to_update->item
                                && item_to_update->eo_check) {
+                       if (item_to_update->chk_status)
+                                       ad->backup_ringtone_volume[sound_type_to_update] =
+                                                       item_to_update->chk_status;
                        item_to_update->chk_status = 0;
                        elm_slider_value_set(item_to_update->eo_check,
                                        item_to_update->chk_status);
@@ -1074,8 +1089,7 @@ static void _update_slider_item(Setting_GenGroupItem_Data *item_to_update, sound
                        elm_object_disabled_set(item_to_update->eo_check, EINA_TRUE);
 
                        /* Change notification slider's icon as mute style */
-                       setting_sound_update_slider_icon(item_to_update,
-                                       icon_type);
+                       setting_sound_update_slider_icon(item_to_update, icon_type);
                }
        } else {
                /* Enable */
@@ -1087,17 +1101,17 @@ static void _update_slider_item(Setting_GenGroupItem_Data *item_to_update, sound
                                item_to_update->chk_status);
                elm_object_item_disabled_set(item_to_update->item, EINA_FALSE);
                elm_object_disabled_set(item_to_update->eo_check, EINA_FALSE);
-               sound_manager_set_volume(sound_type_to_update,
-                               SETTING_DEFAULT_NOTI_VOL_INT);
-               setting_sound_update_slider_icon(
-                               item_to_update, icon_type);
+               if (mm_value == 0)
+                       sound_manager_set_volume(sound_type_to_update,
+                                       ad->backup_ringtone_volume[sound_type_to_update]);
+               setting_sound_update_slider_icon(item_to_update, icon_type);
        }
 }
 
-
-static void _set_ringtone_path(Evas_Object *genlist, char *path, char *vconf,
+static void __set_ringtone_path(Evas_Object *genlist, char *path, char *vconf,
                system_settings_key_e key,
-               Setting_GenGroupItem_Data *ringtone_item, Setting_GenGroupItem_Data *slider_item,
+               Setting_GenGroupItem_Data *ringtone_item,
+               Setting_GenGroupItem_Data *slider_item,
                sound_type_e sound_type, SoundType type)
 {
        char *ringtone_file = setting_media_basename(path);
@@ -1108,31 +1122,34 @@ static void _set_ringtone_path(Evas_Object *genlist, char *path, char *vconf,
        if (strnlen(path, PATH_MAX) == 0) {
                ret = vconf_set_str(vconf, "");
                if (ret != 0)
-                       dlog_print(DLOG_ERROR, LOG_TAG, "[%s:%d] vconf_set_str() error: %s", __FILE__, __LINE__, get_error_message(ret));
+                       dlog_print(DLOG_ERROR, LOG_TAG, "[%s:%d] vconf_set_str() error: %s",
+                                       __FILE__, __LINE__, get_error_message(ret));
 
                ringtone_item->sub_desc = strdup(SILENT_MODE);
        } else  {
                ret = vconf_set_str(vconf, path);
                if (ret != 0)
-                       dlog_print(DLOG_ERROR, LOG_TAG, "[%s:%d] cause error: %s", __FILE__, __LINE__, get_error_message(ret));
+                       dlog_print(DLOG_ERROR, LOG_TAG, "[%s:%d] cause error: %s",
+                                       __FILE__, __LINE__, get_error_message(ret));
 
                ret = system_settings_set_value_string(key, path);
                if (SYSTEM_SETTINGS_ERROR_NONE == ret)
                        ringtone_item->sub_desc = strdup(ringtone_file);
                else
-                       SETTING_TRACE_ERROR("system_settings_set_value_string() failed: %s", get_error_message(ret));
+                       SETTING_TRACE_ERROR("system_settings_set_value_string() failed: %s",
+                                       get_error_message(ret));
        }
 
        elm_object_item_data_set(ringtone_item->item, ringtone_item);
        elm_genlist_item_update(ringtone_item->item);
        elm_genlist_realized_items_update(genlist);
-       _update_slider_item(slider_item, sound_type, ringtone_file, type);
+       __update_slider_item(slider_item, sound_type, ringtone_file, type);
 
        free(ringtone_file);
        SETTING_TRACE_END;
 }
 
-static void _setting_sound_main_result_myfile_cb(app_control_h request,
+static void __result_myfile_cb(app_control_h request,
                                        app_control_h reply, app_control_result_e result,
                                        void *priv)
 {
@@ -1147,21 +1164,22 @@ static void _setting_sound_main_result_myfile_cb(app_control_h request,
        if (APP_CONTROL_RESULT_SUCCEEDED != result)
                return;
 
-       (void)app_control_get_extra_data_array(reply, APP_CONTROL_DATA_SELECTED, &paths, &arr_len);
+       (void)app_control_get_extra_data_array(reply, APP_CONTROL_DATA_SELECTED,
+                       &paths, &arr_len);
        if (!paths || arr_len == 0)
                return;
 
        if (paths[0] != NULL) {
                if (0 == safeStrCmp(ad->ringtone_type, "IDS_ST_MBODY_RINGTONE")) {
-
-
-                       _set_ringtone_path(ad->md.genlist, paths[0], VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR,
+                       __set_ringtone_path(ad->md.genlist, paths[0],
+                                       VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR,
                                        SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE,
                                        ad->data_call_alert_tone, ad->data_call_volume,
                                        SOUND_TYPE_RINGTONE, SND_SLIDER_CALL);
 
                } else if (0 == safeStrCmp(ad->ringtone_type, "IDS_ST_BODY_NOTIFICATION")) {
-                       _set_ringtone_path(ad->md.genlist, paths[0], VCONFKEY_SETAPPL_NOTI_RINGTONE_PATH_STR,
+                       __set_ringtone_path(ad->md.genlist, paths[0],
+                                       VCONFKEY_SETAPPL_NOTI_RINGTONE_PATH_STR,
                                        SYSTEM_SETTINGS_KEY_SOUND_NOTIFICATION,
                                        ad->data_msg_alert_tone, ad->data_noti_volume,
                                        SOUND_TYPE_NOTIFICATION, SND_SLIDER_NOTI);
@@ -1171,7 +1189,7 @@ static void _setting_sound_main_result_myfile_cb(app_control_h request,
        free(paths);
 }
 
-static char *_prepare_ringtone_path(char *vconf, system_settings_key_e key, char *default_emul, char *default_arm)
+static char *__prepare_ringtone_path(char *vconf, system_settings_key_e key, char *default_emul, char *default_arm)
 {
        int ret = 0;
        char *vconf_ringtone = vconf_get_str(vconf);
@@ -1200,7 +1218,7 @@ static char *_prepare_ringtone_path(char *vconf, system_settings_key_e key, char
        return pa_cur_ringtone;
 }
 
-static void setting_sound_main_create_myfile_ug(
+static void __create_myfile_ug(
                SettingSoundData *ad, char *titleID)
 {
        ret_if(ad == NULL);
@@ -1211,13 +1229,15 @@ static void setting_sound_main_create_myfile_ug(
                return;
 
        if (0 == safeStrCmp(ad->ringtone_type, "IDS_ST_MBODY_RINGTONE")) {
-               pa_cur_ringtone = _prepare_ringtone_path(VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR,
+               pa_cur_ringtone = __prepare_ringtone_path(
+                               VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR,
                                SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE,
                                SETTING_DEFAULT_CALL_TONE_SDK,
                                SETTING_DEFAULT_CALL_TONE);
 
        } else if (0 == safeStrCmp(ad->ringtone_type, "IDS_ST_BODY_NOTIFICATION")) {
-               pa_cur_ringtone = _prepare_ringtone_path(VCONFKEY_SETAPPL_NOTI_RINGTONE_PATH_STR,
+               pa_cur_ringtone = __prepare_ringtone_path(
+                               VCONFKEY_SETAPPL_NOTI_RINGTONE_PATH_STR,
                                SYSTEM_SETTINGS_KEY_SOUND_NOTIFICATION,
                                SETTING_DEFAULT_MSG_TONE,
                                SETTING_DEFAULT_MSG_TONE);
@@ -1243,29 +1263,26 @@ static void setting_sound_main_create_myfile_ug(
 
        app_control_set_app_id(svc, "org.tizen.setting-ringtone");
        if (APP_CONTROL_ERROR_NONE !=
-               app_control_send_launch_request(svc,
-                               _setting_sound_main_result_myfile_cb, ad)
-               ) {
+                       app_control_send_launch_request(svc, __result_myfile_cb, ad))
                SETTING_TRACE_ERROR("org.tizen.setting-ringtone launch request failed");
-       }
 
        app_control_destroy(svc);
        free(pa_cur_ringtone);
 }
 
-static void _back_button_click_cb(void *data, Evas_Object *obj, void *event_info)
+static void __back_button_click_cb(void *data, Evas_Object *obj,
+               void *event_info)
 {
        SettingSoundData *ad = data;
-
-       if (ad)
-               elm_naviframe_item_pop(ad->md.naviframe);
+       ret_if(!ad);
+       elm_naviframe_item_pop(ad->md.naviframe);
 }
 
-static void
-setting_sound_main_mouse_up_Gendial_list_cb(void *data,
+static void __mouse_up_Gendial_list_cb(void *data,
                Evas_Object *obj,
                void *event_info)
 {
+       SETTING_TRACE_BEGIN;
        app_control_h service = 0;
        Evas_Object *back_button = NULL;
        SettingSoundData *ad = NULL;
@@ -1292,8 +1309,8 @@ setting_sound_main_mouse_up_Gendial_list_cb(void *data,
        if (!safeStrCmp("IDS_ST_MBODY_RINGTONE", list_item->keyStr)
                || !safeStrCmp("IDS_ST_BODY_NOTIFICATION", list_item->keyStr)) {
                ad->ringtone_type = list_item->keyStr;
-               setting_sound_main_create_myfile_ug(ad, list_item->keyStr);
-               __setting_sound_key_ungrab(ad);
+               __create_myfile_ug(ad, list_item->keyStr);
+               setting_sound_key_ungrab(ad);
        } else if (!safeStrCmp("IDS_ST_MBODY_DO_NOT_DISTURB_ABB",
                        list_item->keyStr)) {
                app_control_create(&service);
@@ -1330,8 +1347,7 @@ setting_sound_main_mouse_up_Gendial_list_cb(void *data,
                if (vconf_set_bool(VCONFKEY_SETAPPL_VIBRATE_WHEN_RINGING_BOOL,
                                !old_status) == 0) {
                        /* new status */
-                       setting_update_gl_item_chk_status(list_item,
-                                       !old_status);
+                       setting_update_gl_item_chk_status(list_item, !old_status);
                }
        } else if (!safeStrCmp("IDS_ST_BODY_SCREEN_LOCK_SOUND",
                        list_item->keyStr)) {
@@ -1365,7 +1381,7 @@ setting_sound_main_mouse_up_Gendial_list_cb(void *data,
                                        !old_status);
                }
        } else if (!safeStrCmp("IDS_ST_HEADER_FEEDBACK", list_item->keyStr)) {
-               __setting_sound_key_ungrab(ad);
+               setting_sound_key_ungrab(ad);
 
                ADD_GENLIST2(genlist, ad->md.naviframe);
                /* 1. Touch sounds */
@@ -1407,7 +1423,7 @@ setting_sound_main_mouse_up_Gendial_list_cb(void *data,
                elm_object_item_domain_text_translatable_set(navi_it,
                                SETTING_PACKAGE, EINA_TRUE);
                back_button = setting_create_button(ad->md.naviframe, _("IDS_ST_BUTTON_BACK"),
-                               NAVI_BACK_ARROW_BUTTON_STYLE, _back_button_click_cb, ad);
+                               NAVI_BACK_ARROW_BUTTON_STYLE, __back_button_click_cb, ad);
                elm_layout_content_set(ad->md.naviframe, "prev_btn", back_button);
        }
 }
index 082dae994e3f622c1385092a8258905995f908c4..c976c8ce501bfadb9ef0ddab9abd776267ade11c 100644 (file)
 static bool _setting_sound_app_create(void *priv)
 {
        SETTING_TRACE_BEGIN;
+       SettingSoundData *ad = priv;
+       retv_if(!ad, NULL);
 
-       retv_if(priv == NULL, NULL);
-
-       SettingSoundData *sound_data = priv;
-
-       if (app_init(&sound_data->md, VOLUME_APP_NAME)
+       if (app_init(&ad->md, VOLUME_APP_NAME)
                        != SETTING_RETURN_SUCCESS) {
                SETTING_TRACE_ERROR("Cannot initialize application");
                return false;
@@ -41,16 +39,17 @@ static bool _setting_sound_app_create(void *priv)
        elm_theme_extension_add(NULL, EDJDIR"/setting-genlist.edj");
        elm_theme_extension_add(NULL, EDJDIR"/setting-theme.edj");
 
-       if (setting_sound_init(sound_data) == NULL)
+       if (setting_sound_init(ad) == NULL)
                return false;
 
-       evas_object_show(sound_data->md.window);
+       evas_object_show(ad->md.window);
 
        return true;
 }
 
 static void _setting_sound_app_pause(void *priv)
 {
+       SETTING_TRACE_BEGIN;
        ret_if(priv == NULL);
        SettingSoundData *sound_data = (SettingSoundData *)priv;