void volume_key_event_handler_add(void)
{
- if(!key_event_info.handler_volume_up)
+ if (!key_event_info.handler_volume_up)
key_event_info.handler_volume_up = ecore_event_handler_add(ECORE_EVENT_KEY_UP, _key_release_cb, NULL);
- if(!key_event_info.handler_volume_down)
+ if (!key_event_info.handler_volume_down)
key_event_info.handler_volume_down = ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, _key_press_cb, NULL);
}
{
ret_if(key_event_info.handler_volume_up == NULL);
ecore_event_handler_del(key_event_info.handler_volume_up);
- key_event_info.handler_volume_up= NULL;
+ key_event_info.handler_volume_up = NULL;
ret_if(key_event_info.handler_volume_down == NULL);
ecore_event_handler_del(key_event_info.handler_volume_down);
_D("sound status : %d", sound);
error = bt_ag_is_sco_opened(&bt_opened);
- if(error != BT_ERROR_NONE) {
+ if (error != BT_ERROR_NONE)
_E("bt_ag_is_sco_opened return [%d]", error);
- }
earphone_connected = earphone_get_earphone_is_connected();
_D("mute -> vib.");
volume_sound_vconf_status_set(TYPE_VCONF_VIBRATION_STATUS, 1);
volume_sound_vib_play();
- }
- else {
+ } else {
_D("vib -> sound");
volume_sound_vconf_status_set(TYPE_VCONF_SOUND_STATUS, 1);
volume_sound_vconf_status_set(TYPE_VCONF_VIBRATION_STATUS, 0);
volume_view_slider_value_set(sound_level+1);
_D("new sound value: %d", sound_level+1);
}
- }
- else {
+ } else {
/*adjust the sound level normally */
if (sound_level != sound_step) {
volume_sound_level_set(sound_type, sound_level+1);
_D("new sound value: %d", sound_level+1);
}
}
- }
- else if (sound_type == SOUND_TYPE_NOTIFICATION) {
+ } else if (sound_type == SOUND_TYPE_NOTIFICATION) {
if (!sound) {
/* No sound in notification type. */
volume_view_slider_value_set(0);
elm_object_disabled_set(volume_view_slider_get(), EINA_TRUE);
- }
- else {
+ } else {
/*adjust the sound level normally */
if (sound_level != sound_step) {
volume_sound_level_set(sound_type, sound_level+1);
_D("new sound value: %d", sound_level+1);
}
}
- }
+ } else if (sound_type == SOUND_TYPE_CALL && bt_opened) {
/* Sound type is not ringtone. Need to adjust sound level */
- else if (sound_type == SOUND_TYPE_CALL && bt_opened) {
int bt_vol = 0;
if (bt_ag_get_speaker_gain(&bt_vol) != BT_ERROR_NONE)
_E("Getting bt volume is failed");
_D("BT VOLUME : %d", bt_vol);
if (bt_vol != sound_step) {
- if(bt_ag_notify_speaker_gain(bt_vol+1) != BT_ERROR_NONE)
+ if (bt_ag_notify_speaker_gain(bt_vol+1) != BT_ERROR_NONE)
_E("Setting bt volume is failed");
volume_view_slider_value_set(bt_vol+1);
_D("New BT VOLUME : %d", bt_vol+1);
}
- }
- else {
+ } else {
if (sound_type == SOUND_TYPE_MEDIA && (bt_opened || earphone_connected) && sound_level + 1 > SAFETY_LIMIT) {
if (volume_control_get_safety_limit()) {
display_state_e state;
volume_sound_level_set(sound_type, SAFETY_LIMIT);
volume_view_slider_value_set(SAFETY_LIMIT);
- if (VOLUME_ERROR_OK != volume_view_send_warning_signal(EINA_TRUE)) {
+ if (VOLUME_ERROR_OK != volume_view_send_warning_signal(EINA_TRUE))
_E("Failed to set warning status");
- }
+
if (VOLUME_ERROR_OK != volume_view_open_warning_popup()) {
_E("Failed to open waring popup!!");
return VOLUME_ERROR_FAIL;
}
- if (device_display_get_state(&state) != DEVICE_ERROR_NONE) {
+ if (device_display_get_state(&state) != DEVICE_ERROR_NONE)
_E("Failed to get display state");
- }
+
if (state == DISPLAY_STATE_SCREEN_OFF || state == DISPLAY_STATE_SCREEN_DIM) {
device_display_change_state(DISPLAY_STATE_NORMAL);
- if(FEEDBACK_ERROR_NONE != feedback_play_type(FEEDBACK_TYPE_VIBRATION, FEEDBACK_PATTERN_WAKEUP)) {
+ if (FEEDBACK_ERROR_NONE != feedback_play_type(FEEDBACK_TYPE_VIBRATION, FEEDBACK_PATTERN_WAKEUP))
_E("Failed to play vibration");
- }
}
if (status == LOCK_AND_MEDIA) {
/* Check LCD */
if (elm_object_disabled_get(volume_view_slider_get()))
elm_object_disabled_set(volume_view_slider_get(), EINA_FALSE);
- if(sound_type == SOUND_TYPE_RINGTONE){
+ if (sound_type == SOUND_TYPE_RINGTONE) {
if (!sound)
/* Check sound status change case. */
_D("Do nothing.");
}
}
}
- }
- else if (sound_type == SOUND_TYPE_NOTIFICATION) {
- if(!sound) {
+ } else if (sound_type == SOUND_TYPE_NOTIFICATION) {
+ if (!sound) {
/* No sound in notification type. */
volume_view_slider_value_set(0);
elm_object_disabled_set(volume_view_slider_get(), EINA_TRUE);
- }
- else {
+ } else {
/*adjust the sound level normally */
if (val != 0) {
volume_sound_level_set(sound_type, val-1);
_D("new sound value: %d", val-1);
}
}
- }
- else if(sound_type == SOUND_TYPE_CALL && bt_opened) {
+ } else if (sound_type == SOUND_TYPE_CALL && bt_opened) {
int bt_vol = 0;
- if(bt_ag_get_speaker_gain(&bt_vol) != BT_ERROR_NONE)
+ if (bt_ag_get_speaker_gain(&bt_vol) != BT_ERROR_NONE)
_E("Getting bt volume is failed");
_D("BT VOLUME : %d", bt_vol);
- if(bt_ag_notify_speaker_gain(bt_vol-1) != BT_ERROR_NONE)
+ if (bt_ag_notify_speaker_gain(bt_vol-1) != BT_ERROR_NONE)
_E("Setting bt volume is failed");
volume_view_slider_value_set(bt_vol-1);
_D("New BT VOLUME : %d", bt_vol-1);
- }
+ } else {
/* Sound type is not ringtone. Need to adjust sound level */
- else {
if (volume_control_get_safety_limit() && sound_type == SOUND_TYPE_MEDIA
&& (bt_opened || earphone_connected) && val > SAFETY_LIMIT) {
display_state_e state;
volume_sound_level_set(sound_type, SAFETY_LIMIT);
volume_view_slider_value_set(SAFETY_LIMIT);
- if (VOLUME_ERROR_OK != volume_view_send_warning_signal(EINA_TRUE)) {
+ if (VOLUME_ERROR_OK != volume_view_send_warning_signal(EINA_TRUE))
_E("Failed to set warning status");
- }
+
if (VOLUME_ERROR_OK != volume_view_open_warning_popup()) {
_E("Failed to open waring popup!!");
return VOLUME_ERROR_FAIL;
}
- if (device_display_get_state(&state) != DEVICE_ERROR_NONE) {
+ if (device_display_get_state(&state) != DEVICE_ERROR_NONE)
_E("Failed to get display state");
- }
+
if (state == DISPLAY_STATE_SCREEN_OFF || state == DISPLAY_STATE_SCREEN_DIM) {
device_display_change_state(DISPLAY_STATE_NORMAL);
- if(FEEDBACK_ERROR_NONE != feedback_play_type(FEEDBACK_TYPE_VIBRATION, FEEDBACK_PATTERN_WAKEUP)) {
+ if (FEEDBACK_ERROR_NONE != feedback_play_type(FEEDBACK_TYPE_VIBRATION, FEEDBACK_PATTERN_WAKEUP))
_E("Failed to play vibration");
- }
}
- if (status == LOCK_AND_MEDIA) {
+ if (status == LOCK_AND_MEDIA)
/* Check LCD */
volume_view_window_show(sound_type);
- }
+
volume_timer_del(TYPE_TIMER_SU);
volume_timer_del(TYPE_TIMER_SD);
volume_timer_add(10.0, TYPE_TIMER_WARNING_POPUP);
}
}
- if(sound_type != SOUND_TYPE_ALARM)
+ if (sound_type != SOUND_TYPE_ALARM)
volume_sound_play();
volume_timer_del(TYPE_TIMER_SD);
{
int is_enabled = 0;
- if(sound_type == SOUND_TYPE_ALARM) {
+ if (sound_type == SOUND_TYPE_ALARM) {
_D("Sound type is Alarm Type");
- if(vconf_get_bool(VCONFKEY_ALARM_VOLUME_POPUP_ENABLE, &is_enabled) < 0) {
+ if (vconf_get_bool(VCONFKEY_ALARM_VOLUME_POPUP_ENABLE, &is_enabled) < 0) {
_E("Failed to get vconfkey : VCONFKEY_ALARM_VOLUME_POPUP_ENABLE");
return VOLUME_ERROR_FAIL;
}
_D("volume popup enabled in alarm type : %d", is_enabled);
- if(!is_enabled) {
+ if (!is_enabled) {
_D("alarm type but vconf for the volume popup is disabled");
return VOLUME_ERROR_FAIL;
}
volume_control_set_safety_limit(EINA_TRUE);
}
- if(!strncmp(ev->keyname, KEY_CANCEL, strlen(KEY_CANCEL)) || !strncmp(ev->keyname, KEY_BACK, strlen(KEY_BACK))) {
+ if (!strncmp(ev->keyname, KEY_CANCEL, strlen(KEY_CANCEL)) || !strncmp(ev->keyname, KEY_BACK, strlen(KEY_BACK))) {
_D("%s is pressed", ev->keyname);
return ECORE_CALLBACK_CANCEL;
}
- if(volume_view_is_slider_touching_get()) {
+ if (volume_view_is_slider_touching_get()) {
_E("Failed to show volume : is_slider_touching is EINA_TRUE");
return ECORE_CALLBACK_CANCEL;
}
- if(vconf_get_int(VCONFKEY_STARTER_USE_VOLUME_KEY, &key_status) < 0) {
+ if (vconf_get_int(VCONFKEY_STARTER_USE_VOLUME_KEY, &key_status) < 0) {
_E("Failed to get vconf : VCONFKEY_STATER_USE_VOLUME_KEY");
return ECORE_CALLBACK_CANCEL;
}
#ifndef FEATURE_SDK
int is_call = -1;
- if(!strncmp(ev->keyname, KEY_MUTE, strlen(KEY_MUTE))) {
+ if (!strncmp(ev->keyname, KEY_MUTE, strlen(KEY_MUTE))) {
_D("MUTE key is pressed");
- if(VOLUME_ERROR_OK != _mute_key_press())
+ if (VOLUME_ERROR_OK != _mute_key_press())
_E("Failed to press MUTE key");
return ECORE_CALLBACK_CANCEL;
}
- if(vconf_get_int(VCONFKEY_TELEPHONY_CALL_STATE, &is_call) < 0 || is_call < 0) {
+ if (vconf_get_int(VCONFKEY_TELEPHONY_CALL_STATE, &is_call) < 0 || is_call < 0) {
_E("Failed to get call state vconf");
return ECORE_CALLBACK_CANCEL;
}
- if(is_call>0) {
+ if (is_call > 0) {
_D("Call is active");
return ECORE_CALLBACK_CANCEL;
}
_D("sound status : %d", sound);
error = bt_ag_is_sco_opened(&bt_opened);
- if(error != BT_ERROR_NONE) {
+ if (error != BT_ERROR_NONE)
_E("bt_ag_is_sco_opened return [%d]", error);
- }
+
earphone_connected = earphone_get_earphone_is_connected();
_D("module state - bt: %d, earphone: %d", bt_opened, earphone_connected);
- if(VOLUME_ERROR_OK != _volume_popup_check_in_alarm_type(sound_type)) {
+ if (VOLUME_ERROR_OK != _volume_popup_check_in_alarm_type(sound_type)) {
_E("Failed to set volume popup");
return ECORE_CALLBACK_CANCEL;
}
volume_timer_del(TYPE_TIMER_POPUP);
if (!strncmp(ev->keyname, KEY_VOLUMEUP, strlen(KEY_VOLUMEUP))) {
- if(VOLUME_ERROR_OK != _volume_up_key_press(status, sound_type, sound, bt_opened, earphone_connected))
+ if (VOLUME_ERROR_OK != _volume_up_key_press(status, sound_type, sound, bt_opened, earphone_connected))
_E("Failed to press volume up key");
- }
- else if (!strncmp(ev->keyname, KEY_VOLUMEDOWN, strlen(KEY_VOLUMEDOWN))) {
- if(VOLUME_ERROR_OK != _volume_down_key_press(status, sound_type, sound, bt_opened, earphone_connected))
+ } else if (!strncmp(ev->keyname, KEY_VOLUMEDOWN, strlen(KEY_VOLUMEDOWN))) {
+ if (VOLUME_ERROR_OK != _volume_down_key_press(status, sound_type, sound, bt_opened, earphone_connected))
_E("Failed to press volume down key");
}
key_event_info.is_pressing = EINA_FALSE;
- if(!strncmp(ev->keyname, KEY_CANCEL, strlen(KEY_CANCEL))) {
+ if (!strncmp(ev->keyname, KEY_CANCEL, strlen(KEY_CANCEL))) {
_D("%s is released", ev->keyname);
- if(VOLUME_ERROR_OK != volume_control_hide_view())
+ if (VOLUME_ERROR_OK != volume_control_hide_view())
_E("Failed to close volume");
- if(VOLUME_ERROR_OK != volume_control_cache_flush())
+ if (VOLUME_ERROR_OK != volume_control_cache_flush())
_E("Failed to flush cache");
return ECORE_CALLBACK_CANCEL;
}
- if(!strncmp(ev->keyname, KEY_BACK, strlen(KEY_BACK))) {
+ if (!strncmp(ev->keyname, KEY_BACK, strlen(KEY_BACK))) {
_D("BACK Key is released");
return ECORE_CALLBACK_CANCEL;
}
if (!strncmp(ev->keyname, KEY_VOLUMEUP, strlen(KEY_VOLUMEUP))) {
_D("up key released and del timer");
volume_timer_del(TYPE_TIMER_SU);
- }
- else if (!strncmp(ev->keyname, KEY_VOLUMEDOWN, strlen(KEY_VOLUMEDOWN))) {
+ } else if (!strncmp(ev->keyname, KEY_VOLUMEDOWN, strlen(KEY_VOLUMEDOWN))) {
_D("down key released and del timer");
volume_timer_del(TYPE_TIMER_SD);
}
volume_timer_del(TYPE_TIMER_POPUP);
- if(volume_view_is_slider_touching_get() == EINA_FALSE) {
- if (!volume_view_warning_popup_get()) {
+ if (volume_view_is_slider_touching_get() == EINA_FALSE) {
+ if (!volume_view_warning_popup_get())
volume_timer_add(3.0, TYPE_TIMER_POPUP);
- }
}
_D("key release fini");