summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGilbok Lee <gilbok.lee@samsung.com>2017-02-02 20:13:50 +0900
committerGilbok Lee <gilbok.lee@samsung.com>2017-02-02 20:13:57 +0900
commitff9cfd540f5ae4add469091c87c8faf0081cf37f (patch)
treece9c7c8f9bc08ebeb5a75234fbef1a90c3c23919
parentae5d1e1bc033a0e0177e2748ba1a51d39b33435c (diff)
parent684952d47398be7a40eb4a0137a307ccefc32cf7 (diff)
downloadlibmm-radio-ff9cfd540f5ae4add469091c87c8faf0081cf37f.tar.gz
libmm-radio-ff9cfd540f5ae4add469091c87c8faf0081cf37f.tar.bz2
libmm-radio-ff9cfd540f5ae4add469091c87c8faf0081cf37f.zip
Change-Id: I2026e38bb7baab79da7186f302787864e912f90a
-rwxr-xr-xpackaging/libmm-radio.spec2
-rw-r--r--src/mm_radio_priv_hal.c110
-rw-r--r--src/mm_radio_sound_focus.c49
-rw-r--r--src/radio_hal_interface.c3
4 files changed, 85 insertions, 79 deletions
diff --git a/packaging/libmm-radio.spec b/packaging/libmm-radio.spec
index edc364d..6e5c404 100755
--- a/packaging/libmm-radio.spec
+++ b/packaging/libmm-radio.spec
@@ -1,6 +1,6 @@
Name: libmm-radio
Summary: Multimedia Framework Radio Library
-Version: 0.2.19
+Version: 0.2.20
Release: 0
Group: System/Libraries
License: Apache-2.0
diff --git a/src/mm_radio_priv_hal.c b/src/mm_radio_priv_hal.c
index 206e728..ae5bca3 100644
--- a/src/mm_radio_priv_hal.c
+++ b/src/mm_radio_priv_hal.c
@@ -169,7 +169,7 @@ int _mmradio_apply_region(mm_radio_t *radio, MMRadioRegionType region, bool upda
}
}
- MMRADIO_LOG_DEBUG("setting region - country: %d, de-emphasis: %d, band range: %d ~ %d KHz\n",
+ MMRADIO_LOG_DEBUG("setting region - country: %d, de-emphasis: %d, band range: %d ~ %d KHz",
radio->region_setting.country, radio->region_setting.deemphasis,
radio->region_setting.band_min, radio->region_setting.band_max);
@@ -198,13 +198,13 @@ int _mmradio_create_radio(mm_radio_t *radio)
/* create command lock */
ret = pthread_mutex_init(&radio->cmd_lock, NULL);
if (ret) {
- MMRADIO_LOG_ERROR("mutex creation failed\n");
+ MMRADIO_LOG_ERROR("mutex creation failed");
return MM_ERROR_RADIO_INTERNAL;
}
ret = pthread_mutex_init(&radio->volume_lock, NULL);
if (ret) {
- MMRADIO_LOG_ERROR("volume mutex creation failed\n");
+ MMRADIO_LOG_ERROR("volume mutex creation failed");
return MM_ERROR_RADIO_INTERNAL;
}
@@ -218,14 +218,14 @@ int _mmradio_create_radio(mm_radio_t *radio)
if (ret) {
/* NOTE : we are dealing it as an error since we cannot expect it's behavior */
- MMRADIO_LOG_ERROR("mmradio_audio_focus_register is failed\n");
+ MMRADIO_LOG_ERROR("mmradio_audio_focus_register is failed");
return MM_ERROR_RADIO_INTERNAL;
}
#endif
ret = radio_hal_interface_init(&(radio->hal_inf));
if (ret) {
- MMRADIO_LOG_ERROR("mmradio hal interface init failed\n");
+ MMRADIO_LOG_ERROR("mmradio hal interface init failed");
return ret;
}
@@ -354,13 +354,13 @@ int _mmradio_destroy(mm_radio_t *radio)
ret = radio_hal_interface_deinit(radio->hal_inf);
if (ret) {
- MMRADIO_LOG_ERROR("mmradio hal interface deinit failed\n");
+ MMRADIO_LOG_ERROR("mmradio hal interface deinit failed");
return ret;
}
#ifdef TIZEN_FEATURE_SOUND_FOCUS
ret = mmradio_sound_focus_deregister(&radio->sound_focus);
if (ret) {
- MMRADIO_LOG_ERROR("failed to deregister sound focus\n");
+ MMRADIO_LOG_ERROR("failed to deregister sound focus");
return MM_ERROR_RADIO_INTERNAL;
}
#endif
@@ -379,7 +379,7 @@ int _mmradio_set_frequency(mm_radio_t *radio, int freq)
MMRADIO_CHECK_INSTANCE(radio);
MMRADIO_CHECK_STATE_RETURN_IF_FAIL(radio, MMRADIO_COMMAND_SET_FREQ);
- MMRADIO_LOG_DEBUG("Setting %d frequency\n", freq);
+ MMRADIO_LOG_DEBUG("Setting %d frequency", freq);
radio->freq = freq;
@@ -480,7 +480,7 @@ int _mmradio_set_message_callback(mm_radio_t *radio, MMMessageCallback callback,
radio->msg_cb = callback;
radio->msg_cb_param = user_param;
- MMRADIO_LOG_DEBUG("msg_cb : 0x%x msg_cb_param : 0x%x\n", callback, user_param);
+ MMRADIO_LOG_DEBUG("msg_cb : 0x%x msg_cb_param : 0x%x", callback, user_param);
MMRADIO_LOG_FLEAVE();
@@ -515,7 +515,7 @@ int _mmradio_start(mm_radio_t *radio)
MMRADIO_CHECK_INSTANCE(radio);
MMRADIO_CHECK_STATE_RETURN_IF_FAIL(radio, MMRADIO_COMMAND_START);
- MMRADIO_LOG_DEBUG("now tune to frequency : %d\n", radio->freq);
+ MMRADIO_LOG_DEBUG("now tune to frequency : %d", radio->freq);
#ifdef TIZEN_FEATURE_SOUND_FOCUS
if (radio->sound_focus.handle > 0) {
@@ -562,21 +562,21 @@ int _mmradio_start(mm_radio_t *radio)
if (ret == MM_ERROR_NOT_SUPPORT_API) {
MMRADIO_LOG_WARNING("radio_hal_start is not supported");
} else if (ret) {
- MMRADIO_LOG_ERROR("failed to radio_hal_start\n");
+ MMRADIO_LOG_ERROR("failed to radio_hal_start");
goto error1;
}
/* set stored frequency */
ret = radio_hal_set_frequency(radio->hal_inf, radio->freq);
if (ret) {
- MMRADIO_LOG_ERROR("failed to radio_hal_set_frequency\n");
+ MMRADIO_LOG_ERROR("failed to radio_hal_set_frequency");
goto error1;
}
#ifdef TIZEN_FEATURE_SOUND_VSTREAM
ret = sound_manager_start_virtual_stream(radio->vstream);
if (ret) {
- MMRADIO_LOG_ERROR("failed to sound_manager_start_virtual_stream\n");
+ MMRADIO_LOG_ERROR("failed to sound_manager_start_virtual_stream");
goto error;
}
#endif
@@ -623,7 +623,7 @@ int _mmradio_stop(mm_radio_t *radio)
if (ret == MM_ERROR_NOT_SUPPORT_API) {
MMRADIO_LOG_WARNING("radio_hal_unmute is not supported");
} else if (ret) {
- MMRADIO_LOG_ERROR("failed to radio_hal_stop\n");
+ MMRADIO_LOG_ERROR("failed to radio_hal_stop");
return ret;
}
@@ -650,7 +650,7 @@ int _mmradio_stop(mm_radio_t *radio)
if (radio->sound_focus.handle > 0) {
ret = mmradio_release_sound_focus(&radio->sound_focus);
if (ret) {
- MMRADIO_LOG_ERROR("mmradio_release_audio_focus is failed\n");
+ MMRADIO_LOG_ERROR("mmradio_release_audio_focus is failed");
return ret;
}
}
@@ -685,19 +685,19 @@ int _mmradio_seek(mm_radio_t *radio, MMRadioSeekDirectionType direction)
if (ret == MM_ERROR_NOT_SUPPORT_API) {
MMRADIO_LOG_WARNING("radio_hal_mute is not supported");
} else if (ret) {
- MMRADIO_LOG_ERROR("failed to radio_hal_mute\n");
+ MMRADIO_LOG_ERROR("failed to radio_hal_mute");
return ret;
}
radio->seek_unmute = TRUE;
}
- MMRADIO_LOG_DEBUG("trying to seek. direction[0:UP/1:DOWN) %d\n", direction);
+ MMRADIO_LOG_DEBUG("trying to seek. direction[0:UP/1:DOWN) %d", direction);
radio->seek_direction = direction;
ret = pthread_create(&radio->seek_thread, NULL, (void *)__mmradio_seek_thread, (void *)radio);
if (ret) {
- MMRADIO_LOG_DEBUG("failed create thread\n");
+ MMRADIO_LOG_DEBUG("failed create thread");
radio->is_seeking = FALSE;
radio->seek_cancel = TRUE;
if (radio->seek_unmute) {
@@ -705,7 +705,7 @@ int _mmradio_seek(mm_radio_t *radio, MMRadioSeekDirectionType direction)
if (ret == MM_ERROR_NOT_SUPPORT_API) {
MMRADIO_LOG_WARNING("radio_hal_mute is not supported");
} else if (ret) {
- MMRADIO_LOG_ERROR("failed to radio_hal_mute\n");
+ MMRADIO_LOG_ERROR("failed to radio_hal_mute");
radio->seek_unmute = FALSE;
return ret;
}
@@ -787,7 +787,7 @@ int _mmradio_start_scan(mm_radio_t *radio)
scan_tr_id = pthread_create(&radio->scan_thread, NULL, (void *)__mmradio_scan_thread, (void *)radio);
if (scan_tr_id != 0) {
- MMRADIO_LOG_DEBUG("failed to create thread : scan\n");
+ MMRADIO_LOG_DEBUG("failed to create thread : scan");
return MM_ERROR_RADIO_NOT_INITIALIZED;
}
@@ -845,7 +845,7 @@ int _mm_radio_get_signal_strength(mm_radio_t *radio, int *value)
if (ret == MM_ERROR_NOT_SUPPORT_API) {
MMRADIO_LOG_WARNING("radio_hal_unmute is not supported");
} else if (ret != MM_ERROR_NONE) {
- debug_error("radio_hal_get_signal_strength error\n");
+ debug_error("radio_hal_get_signal_strength error");
*value = 0;
MMRADIO_LOG_FLEAVE();
return ret;
@@ -883,7 +883,7 @@ void __mmradio_scan_thread(mm_radio_t *radio)
uint32_t freq = 0;
MMMessageParamType param = { 0, };
- MMRADIO_LOG_DEBUG("scanning....\n");
+ MMRADIO_LOG_DEBUG("scanning....");
pthread_mutex_lock(&radio->seek_cancel_mutex);
@@ -908,10 +908,10 @@ void __mmradio_scan_thread(mm_radio_t *radio)
ret = radio_hal_get_frequency(radio->hal_inf, &freq);
if (ret != MM_ERROR_NONE) {
- MMRADIO_LOG_ERROR("failed to get current frequency\n");
+ MMRADIO_LOG_ERROR("failed to get current frequency");
} else {
if (freq < prev_freq) {
- MMRADIO_LOG_DEBUG("scanning wrapped around. stopping scan\n");
+ MMRADIO_LOG_DEBUG("scanning wrapped around. stopping scan");
break;
}
@@ -919,11 +919,11 @@ void __mmradio_scan_thread(mm_radio_t *radio)
continue;
prev_freq = param.radio_scan.frequency = (int)freq;
- MMRADIO_LOG_DEBUG("scanning : new frequency : [%d]\n", param.radio_scan.frequency);
+ MMRADIO_LOG_DEBUG("scanning : new frequency : [%d]", param.radio_scan.frequency);
/* drop if max freq is scanned */
if (param.radio_scan.frequency == radio->region_setting.band_max) {
- MMRADIO_LOG_DEBUG("%d freq is dropping...and stopping scan\n", param.radio_scan.frequency);
+ MMRADIO_LOG_DEBUG("%d freq is dropping...and stopping scan", param.radio_scan.frequency);
break;
}
@@ -1019,13 +1019,13 @@ void __mmradio_seek_thread(mm_radio_t *radio)
MMRADIO_POST_MSG(radio, MM_MESSAGE_RADIO_SEEK_START, NULL);
- MMRADIO_LOG_DEBUG("seeking....\n");
+ MMRADIO_LOG_DEBUG("seeking....");
if (!radio->seek_cancel) {
MMRADIO_LOG_DEBUG("try to seek ");
pthread_mutex_lock(&radio->seek_cancel_mutex);
- MMRADIO_LOG_DEBUG("seek start\n");
+ MMRADIO_LOG_DEBUG("seek start");
if (radio->seek_cancel) {
MMRADIO_LOG_DEBUG("seek was canceled so we return failure to application");
@@ -1036,22 +1036,22 @@ void __mmradio_seek_thread(mm_radio_t *radio)
ret = radio_hal_seek(radio->hal_inf, radio->seek_direction);
pthread_mutex_unlock(&radio->seek_cancel_mutex);
if (ret) {
- MMRADIO_LOG_ERROR("radio_hal_seek failed\n");
+ MMRADIO_LOG_ERROR("radio_hal_seek failed");
goto SEEK_FAILED;
}
/* now we can get new frequency from radio device */
ret = radio_hal_get_frequency(radio->hal_inf, &freq);
if (ret) {
- MMRADIO_LOG_ERROR("failed to get current frequency\n");
+ MMRADIO_LOG_ERROR("failed to get current frequency");
goto SEEK_FAILED;
}
- MMRADIO_LOG_DEBUG("found frequency\n");
+ MMRADIO_LOG_DEBUG("found frequency");
/* if same freq is found, ignore it and search next one. */
if (freq == radio->prev_seek_freq) {
- MMRADIO_LOG_DEBUG("It's same with previous found one. So, trying next one. \n");
+ MMRADIO_LOG_DEBUG("It's same with previous found one. So, trying next one.");
goto SEEK_FAILED;
}
@@ -1060,7 +1060,7 @@ void __mmradio_seek_thread(mm_radio_t *radio)
/* now tune to new frequency */
ret = radio_hal_set_frequency(radio->hal_inf, freq);
if (ret) {
- MMRADIO_LOG_ERROR("failed to tune to new frequency\n");
+ MMRADIO_LOG_ERROR("failed to tune to new frequency");
goto SEEK_FAILED;
}
}
@@ -1072,14 +1072,14 @@ void __mmradio_seek_thread(mm_radio_t *radio)
*/
ret = radio_hal_unmute(radio->hal_inf);
if (ret) {
- MMRADIO_LOG_ERROR("failed to tune to new frequency\n");
+ MMRADIO_LOG_ERROR("failed to tune to new frequency");
goto SEEK_FAILED;
}
radio->seek_unmute = FALSE;
}
param.radio_scan.frequency = radio->prev_seek_freq = (int)freq;
- MMRADIO_LOG_DEBUG("seeking : new frequency : [%d]\n", param.radio_scan.frequency);
+ MMRADIO_LOG_DEBUG("seeking : new frequency : [%d]", param.radio_scan.frequency);
MMRADIO_POST_MSG(radio, MM_MESSAGE_RADIO_SEEK_FINISH, &param);
}
@@ -1100,7 +1100,7 @@ SEEK_FAILED:
*/
ret = radio_hal_unmute(radio->hal_inf);
if (ret)
- MMRADIO_LOG_ERROR("failed to tune to new frequency\n");
+ MMRADIO_LOG_ERROR("failed to tune to new frequency");
radio->seek_unmute = FALSE;
}
/* freq -1 means it's failed to seek */
@@ -1118,11 +1118,11 @@ static bool __mmradio_post_message(mm_radio_t *radio, enum MMMessageType msgtype
MMRADIO_LOG_FENTER();
if (!radio->msg_cb) {
- debug_warning("failed to post a message\n");
+ debug_warning("failed to post a message");
return false;
}
- MMRADIO_LOG_DEBUG("address of msg_cb : %p\n", radio->msg_cb);
+ MMRADIO_LOG_DEBUG("address of msg_cb : %p", radio->msg_cb);
radio->msg_cb(msgtype, param, radio->msg_cb_param);
@@ -1141,7 +1141,7 @@ static int __mmradio_check_state(mm_radio_t *radio, MMRadioCommand command)
radio_state = __mmradio_get_state(radio);
- MMRADIO_LOG_DEBUG("incomming command : %d current state : %d\n", command, radio_state);
+ MMRADIO_LOG_DEBUG("incomming command : %d current state : %d", command, radio_state);
switch (command) {
case MMRADIO_COMMAND_CREATE:
@@ -1240,11 +1240,11 @@ static int __mmradio_check_state(mm_radio_t *radio, MMRadioCommand command)
break;
default:
- MMRADIO_LOG_DEBUG("not handled in FSM. don't care it\n");
+ MMRADIO_LOG_DEBUG("not handled in FSM. don't care it");
break;
}
- MMRADIO_LOG_DEBUG("status OK\n");
+ MMRADIO_LOG_DEBUG("status OK");
radio->cmd = command;
@@ -1253,12 +1253,12 @@ static int __mmradio_check_state(mm_radio_t *radio, MMRadioCommand command)
return MM_ERROR_NONE;
INVALID_STATE:
- debug_warning("invalid state. current : %d command : %d\n", radio_state, command);
+ debug_warning("invalid state. current : %d command : %d", radio_state, command);
MMRADIO_LOG_FLEAVE();
return MM_ERROR_RADIO_INVALID_STATE;
NO_OP:
- debug_warning("mm-radio is in the desired state(%d). doing noting\n", radio_state);
+ debug_warning("mm-radio is in the desired state(%d). doing noting", radio_state);
MMRADIO_LOG_FLEAVE();
return MM_ERROR_RADIO_NO_OP;
@@ -1272,12 +1272,12 @@ static bool __mmradio_set_state(mm_radio_t *radio, int new_state)
MMRADIO_LOG_FENTER();
if (!radio) {
- debug_warning("calling set_state with invalid radio handle\n");
+ debug_warning("calling set_state with invalid radio handle");
return false;
}
if (radio->current_state == new_state && radio->pending_state == 0) {
- debug_warning("we are in same state\n");
+ debug_warning("we are in same state");
return true;
}
@@ -1326,7 +1326,7 @@ static int __mmradio_get_state(mm_radio_t *radio)
{
MMRADIO_CHECK_INSTANCE(radio);
- MMRADIO_LOG_DEBUG("radio state : current : [%d] old : [%d] pending : [%d]\n",
+ MMRADIO_LOG_DEBUG("radio state : current : [%d] old : [%d] pending : [%d]",
radio->current_state, radio->old_state, radio->pending_state);
return radio->current_state;
@@ -1355,9 +1355,9 @@ static void __mmradio_sound_focus_cb(int id, mm_sound_focus_type_e focus_type,
result = _mmradio_stop(radio);
if (result)
- MMRADIO_LOG_ERROR("failed to stop radio\n");
+ MMRADIO_LOG_ERROR("failed to stop radio");
- MMRADIO_LOG_DEBUG("FOCUS_IS_RELEASED cur_focus_type : %d\n", radio->sound_focus.cur_focus_type);
+ MMRADIO_LOG_DEBUG("FOCUS_IS_RELEASED cur_focus_type : %d", radio->sound_focus.cur_focus_type);
}
break;
@@ -1373,12 +1373,12 @@ static void __mmradio_sound_focus_cb(int id, mm_sound_focus_type_e focus_type,
radio->sound_focus.by_focus_cb = MMRADIO_FOCUS_CB_NONE;
- MMRADIO_LOG_DEBUG("FOCUS_IS_ACQUIRED cur_focus_type : %d\n", radio->sound_focus.cur_focus_type);
+ MMRADIO_LOG_DEBUG("FOCUS_IS_ACQUIRED cur_focus_type : %d", radio->sound_focus.cur_focus_type);
}
break;
default:
- MMRADIO_LOG_DEBUG("Unknown focus_state\n");
+ MMRADIO_LOG_DEBUG("Unknown focus_state");
break;
}
@@ -1407,7 +1407,7 @@ static void __mmradio_sound_focus_watch_cb(int id, mm_sound_focus_type_e focus_t
result = _mmradio_stop(radio);
if (result)
- MMRADIO_LOG_ERROR("failed to stop radio\n");
+ MMRADIO_LOG_ERROR("failed to stop radio");
MMRADIO_LOG_DEBUG("FOCUS_IS_RELEASED cur_focus_type : %d\n", radio->sound_focus.cur_focus_type);
}
@@ -1425,12 +1425,12 @@ static void __mmradio_sound_focus_watch_cb(int id, mm_sound_focus_type_e focus_t
radio->sound_focus.by_focus_cb = MMRADIO_FOCUS_CB_NONE;
- MMRADIO_LOG_DEBUG("FOCUS_IS_ACQUIRED cur_focus_type : %d\n", radio->sound_focus.cur_focus_type);
+ MMRADIO_LOG_DEBUG("FOCUS_IS_ACQUIRED cur_focus_type : %d", radio->sound_focus.cur_focus_type);
}
break;
default:
- MMRADIO_LOG_DEBUG("Unknown focus_state\n");
+ MMRADIO_LOG_DEBUG("Unknown focus_state");
break;
}
@@ -1504,7 +1504,7 @@ int _mmradio_set_volume(mm_radio_t *radio, float volume)
MMRADIO_CHECK_INSTANCE(radio);
MMRADIO_CHECK_STATE_RETURN_IF_FAIL(radio, MMRADIO_COMMAND_SET_VOLUME);
- MMRADIO_LOG_DEBUG("Setting %f volume\n", volume);
+ MMRADIO_LOG_DEBUG("Setting %f volume", volume);
MMRADIO_VOLUME_LOCK(radio);
radio->local_volume = volume;
@@ -1556,7 +1556,7 @@ static int __mmradio_set_media_volume(mm_radio_t *radio, unsigned int level)
MMRADIO_CHECK_INSTANCE(radio);
MMRADIO_CHECK_STATE_RETURN_IF_FAIL(radio, MMRADIO_COMMAND_SET_VOLUME);
- MMRADIO_LOG_DEBUG("Setting %d volume\n", level);
+ MMRADIO_LOG_DEBUG("Setting %d volume", level);
MMRADIO_VOLUME_LOCK(radio);
radio->media_volume = level;
diff --git a/src/mm_radio_sound_focus.c b/src/mm_radio_sound_focus.c
index cbfe624..668c060 100644
--- a/src/mm_radio_sound_focus.c
+++ b/src/mm_radio_sound_focus.c
@@ -52,7 +52,7 @@ static void _mmradio_device_connected_cb(MMSoundDevice_t device, bool is_connect
result = _mmradio_stop(radio);
if (result != MM_ERROR_NONE)
- MMRADIO_LOG_ERROR("failed to stop radio\n");
+ MMRADIO_LOG_ERROR("failed to stop radio");
}
break;
default:
@@ -74,7 +74,6 @@ void _mmradio_sound_signal_callback(mm_sound_signal_name_t signal, int value, vo
/* unregister watch callback */
if (sound_focus->watch_id > 0) {
MMRADIO_LOG_DEBUG("unset the focus watch cb %d", sound_focus->watch_id);
-
ret = mm_sound_unset_focus_watch_callback(sound_focus->watch_id);
sound_focus->watch_id = 0;
if (ret != MM_ERROR_NONE)
@@ -82,6 +81,7 @@ void _mmradio_sound_signal_callback(mm_sound_signal_name_t signal, int value, vo
}
/* unregister focus callback */
if (sound_focus->focus_id > 0) {
+ MMRADIO_LOG_DEBUG("unset the focus %d", sound_focus->focus_id);
ret = mm_sound_unregister_focus(sound_focus->focus_id);
sound_focus->focus_id = 0;
if (ret != MM_ERROR_NONE)
@@ -112,7 +112,7 @@ int mmradio_sound_focus_register(mm_radio_sound_focus *sound_focus,
MMRADIO_LOG_FENTER();
if (!sound_focus) {
- MMRADIO_LOG_ERROR("invalid session handle\n");
+ MMRADIO_LOG_ERROR("invalid session handle");
return MM_ERROR_RADIO_NOT_INITIALIZED;
}
sound_focus->cur_focus_type = FOCUS_NONE;
@@ -121,20 +121,20 @@ int mmradio_sound_focus_register(mm_radio_sound_focus *sound_focus,
ret = _mm_session_util_read_information(pid, &session_type, &session_flags);
MMRADIO_LOG_DEBUG("Read Session type ret:0x%X", ret);
if (ret == MM_ERROR_INVALID_HANDLE) {
- MMRADIO_LOG_WARNING("subscribe_id=%d\n", sound_focus->subscribe_id);
+ MMRADIO_LOG_WARNING("subscribe_id=%d", sound_focus->subscribe_id);
if (sound_focus->subscribe_id == 0) {
ret = mm_sound_subscribe_signal_for_daemon(MM_SOUND_SIGNAL_RELEASE_INTERNAL_FOCUS, pid, &sound_focus->subscribe_id,
(mm_sound_signal_callback)_mmradio_sound_signal_callback, (void*)sound_focus);
if (ret != MM_ERROR_NONE) {
- MMRADIO_LOG_ERROR("mm_sound_subscribe_signal is failed\n");
+ MMRADIO_LOG_ERROR("mm_sound_subscribe_signal is failed");
return MM_ERROR_POLICY_BLOCKED;
}
- MMRADIO_LOG_DEBUG("register focus watch callback for the value is 0, sub_cb id %d\n", sound_focus->subscribe_id);
+ MMRADIO_LOG_DEBUG("register mm_sound_subscribe_signal_for_daemon subscribe_id %d", sound_focus->subscribe_id);
/* register watch callback */
ret = mm_sound_set_focus_watch_callback_for_session(pid,
FOCUS_FOR_BOTH, watch_cb, (void *)param, &sound_focus->watch_id);
if (ret != MM_ERROR_NONE) {
- MMRADIO_LOG_ERROR("mm_sound_set_focus_watch_callback is failed\n");
+ MMRADIO_LOG_ERROR("mm_sound_set_focus_watch_callback is failed");
return MM_ERROR_POLICY_BLOCKED;
}
MMRADIO_LOG_DEBUG("(%p) set focus watch callback = %d", param, sound_focus->watch_id);
@@ -143,14 +143,14 @@ int mmradio_sound_focus_register(mm_radio_sound_focus *sound_focus,
ret = mm_sound_add_device_connected_callback(MM_SOUND_DEVICE_TYPE_EXTERNAL_FLAG,
(mm_sound_device_connected_cb)_mmradio_device_connected_cb, (void *)param, &sound_focus->device_subs_id);
if (ret != MM_ERROR_NONE) {
- MMRADIO_LOG_ERROR("mm_sound_add_device_connected_callback is failed\n");
+ MMRADIO_LOG_ERROR("mm_sound_add_device_connected_callback is failed");
return MM_ERROR_POLICY_BLOCKED;
}
- MMRADIO_LOG_ERROR("register device connected callback for the value is 0, sub_cb id %d\n", sound_focus->device_subs_id);
+ MMRADIO_LOG_ERROR("register device connected callback for the value is 0, sub_cb id %d", sound_focus->device_subs_id);
}
ret = MM_ERROR_NONE;
} else if (ret == MM_ERROR_NONE) {
- MMRADIO_LOG_WARNING("Read Session Information success. session_type : %d flags: %d \n", session_type, session_flags);
+ MMRADIO_LOG_WARNING("Read Session Information success. session_type : %d flags: %d", session_type, session_flags);
sound_focus->session_type = session_type;
sound_focus->snd_session_flags = session_flags;
if (sound_focus->session_type == MM_SESSION_TYPE_MEDIA) {
@@ -167,7 +167,7 @@ int mmradio_sound_focus_register(mm_radio_sound_focus *sound_focus,
ret = mm_sound_register_focus_for_session(handle, pid, "radio", focus_cb, param);
if (ret != MM_ERROR_NONE) {
- MMRADIO_LOG_DEBUG("mm_sound_register_focus_for_session is failed\n");
+ MMRADIO_LOG_DEBUG("mm_sound_register_focus_for_session is failed");
return MM_ERROR_POLICY_BLOCKED;
}
MMRADIO_LOG_DEBUG("(%p) register focus for session %d", param, pid);
@@ -175,7 +175,7 @@ int mmradio_sound_focus_register(mm_radio_sound_focus *sound_focus,
ret = mm_sound_add_device_connected_callback(MM_SOUND_DEVICE_TYPE_EXTERNAL_FLAG,
(mm_sound_device_connected_cb)_mmradio_device_connected_cb, (void *)param, &sound_focus->device_subs_id);
if (ret != MM_ERROR_NONE) {
- MMRADIO_LOG_ERROR("mm_sound_add_device_connected_callback is failed\n");
+ MMRADIO_LOG_ERROR("mm_sound_add_device_connected_callback is failed");
return MM_ERROR_POLICY_BLOCKED;
}
MMRADIO_LOG_DEBUG("(%p) add device connected callback = %d", param, sound_focus->device_subs_id);
@@ -185,7 +185,7 @@ int mmradio_sound_focus_register(mm_radio_sound_focus *sound_focus,
ret = mm_sound_add_device_connected_callback(MM_SOUND_DEVICE_TYPE_EXTERNAL_FLAG,
(mm_sound_device_connected_cb)_mmradio_device_connected_cb, (void*)param, &sound_focus->device_subs_id);
if (ret != MM_ERROR_NONE) {
- MMRADIO_LOG_ERROR("mm_sound_add_device_connected_callback is failed\n");
+ MMRADIO_LOG_ERROR("mm_sound_add_device_connected_callback is failed");
return MM_ERROR_POLICY_BLOCKED;
}
MMRADIO_LOG_DEBUG("add device connected callback = %d", sound_focus->device_subs_id);
@@ -195,7 +195,7 @@ int mmradio_sound_focus_register(mm_radio_sound_focus *sound_focus,
ret = mm_sound_set_focus_watch_callback_for_session(pid,
FOCUS_FOR_BOTH, watch_cb, (void*)param, &sound_focus->watch_id);
if (ret != MM_ERROR_NONE) {
- MMRADIO_LOG_ERROR("mm_sound_set_focus_watch_callback is failed\n");
+ MMRADIO_LOG_ERROR("mm_sound_set_focus_watch_callback is failed");
return MM_ERROR_POLICY_BLOCKED;
}
MMRADIO_LOG_DEBUG("set focus watch callback = %d", sound_focus->watch_id);
@@ -204,7 +204,7 @@ int mmradio_sound_focus_register(mm_radio_sound_focus *sound_focus,
ret = mm_sound_add_device_connected_callback(MM_SOUND_DEVICE_TYPE_EXTERNAL_FLAG,
(mm_sound_device_connected_cb)_mmradio_device_connected_cb, (void*)param, &sound_focus->device_subs_id);
if (ret != MM_ERROR_NONE) {
- MMRADIO_LOG_ERROR("mm_sound_add_device_connected_callback is failed\n");
+ MMRADIO_LOG_ERROR("mm_sound_add_device_connected_callback is failed");
return MM_ERROR_POLICY_BLOCKED;
}
MMRADIO_LOG_DEBUG("(%p) add device connected callback = %d", param, sound_focus->device_subs_id);
@@ -218,7 +218,7 @@ int mmradio_sound_focus_register(mm_radio_sound_focus *sound_focus,
}
ret = MM_ERROR_NONE;
} else {
- MMRADIO_LOG_WARNING("Read Session Information failed. skip sound focus register function. errorcode %x \n", ret);
+ MMRADIO_LOG_WARNING("Read Session Information failed. skip sound focus register function. errorcode %x", ret);
}
MMRADIO_LOG_FLEAVE();
@@ -234,7 +234,7 @@ int mmradio_sound_focus_deregister(mm_radio_sound_focus *sound_focus)
MMRADIO_LOG_FENTER();
if (!sound_focus) {
- MMRADIO_LOG_ERROR("invalid session handle\n");
+ MMRADIO_LOG_ERROR("invalid session handle");
return MM_ERROR_RADIO_NOT_INITIALIZED;
}
@@ -262,6 +262,11 @@ int mmradio_sound_focus_deregister(mm_radio_sound_focus *sound_focus)
MMRADIO_LOG_ERROR("failed to mm_sound_remove_device_connected_callback() ret = %d", ret);
}
+ if (sound_focus->subscribe_id > 0) {
+ MMRADIO_LOG_DEBUG("unset mm_sound_subscribe_signal_for_daemon %d", sound_focus->subscribe_id);
+ mm_sound_unsubscribe_signal(sound_focus->subscribe_id);
+ }
+
MMRADIO_LOG_FLEAVE();
return MM_ERROR_NONE;
@@ -273,13 +278,13 @@ int mmradio_acquire_sound_focus(mm_radio_sound_focus *sound_focus)
mm_sound_focus_type_e focus_type = FOCUS_NONE;
MMRADIO_LOG_FENTER();
- MMRADIO_LOG_ERROR("mmradio_acquire_sound_focus sound_focus->cur_focus_type : %d\n", sound_focus->cur_focus_type);
+ MMRADIO_LOG_ERROR("mmradio_acquire_sound_focus sound_focus->cur_focus_type : %d", sound_focus->cur_focus_type);
focus_type = FOCUS_FOR_BOTH & ~(sound_focus->cur_focus_type);
if (focus_type != FOCUS_NONE) {
ret = mm_sound_acquire_focus(sound_focus->handle, focus_type, NULL);
if (ret != MM_ERROR_NONE) {
- MMRADIO_LOG_ERROR("mm_sound_acquire_focus is failed\n");
+ MMRADIO_LOG_ERROR("mm_sound_acquire_focus is failed");
return MM_ERROR_POLICY_BLOCKED;
}
sound_focus->cur_focus_type = FOCUS_FOR_BOTH;
@@ -294,11 +299,11 @@ int mmradio_release_sound_focus(mm_radio_sound_focus *sound_focus)
int ret = MM_ERROR_NONE;
MMRADIO_LOG_FENTER();
- MMRADIO_LOG_ERROR("mmradio_release_sound_focus sound_focus->cur_focus_type : %d\n", sound_focus->cur_focus_type);
+ MMRADIO_LOG_ERROR("mmradio_release_sound_focus sound_focus->cur_focus_type : %d", sound_focus->cur_focus_type);
if (sound_focus->cur_focus_type != FOCUS_NONE) {
ret = mm_sound_release_focus(sound_focus->handle, sound_focus->cur_focus_type, NULL);
if (ret != MM_ERROR_NONE) {
- MMRADIO_LOG_ERROR("mm_sound_release_focus is failed\n");
+ MMRADIO_LOG_ERROR("mm_sound_release_focus is failed");
return MM_ERROR_POLICY_BLOCKED;
}
sound_focus->cur_focus_type = FOCUS_NONE;
@@ -313,7 +318,7 @@ int mmradio_release_sound_focus(mm_radio_sound_focus *sound_focus)
void mmradio_get_sound_focus_reason(mm_sound_focus_state_e focus_state, const char *reason_for_change, bool is_watch, enum MMMessageInterruptedCode *event_source, int *postMsg)
{
MMRADIO_LOG_FENTER();
- MMRADIO_LOG_ERROR("mmradio_get_sound_focus_reason focus_state : %d reason_for_change :%s\n", focus_state, reason_for_change);
+ MMRADIO_LOG_ERROR("mmradio_get_sound_focus_reason focus_state : %d reason_for_change :%s", focus_state, reason_for_change);
if (0 == strncmp(reason_for_change, "call-voice", AUDIO_FOCUS_REASON_MAX)
|| (0 == strncmp(reason_for_change, "voip", AUDIO_FOCUS_REASON_MAX))
diff --git a/src/radio_hal_interface.c b/src/radio_hal_interface.c
index 86b449b..567c469 100644
--- a/src/radio_hal_interface.c
+++ b/src/radio_hal_interface.c
@@ -133,7 +133,7 @@ int radio_hal_interface_init(mm_radio_hal_interface **handle)
*handle = h;
- MMRADIO_LOG_ERROR("open radio_hal interface");
+ MMRADIO_LOG_DEBUG("open radio_hal interface");
return MM_ERROR_NONE;
FAIL:
@@ -158,6 +158,7 @@ int radio_hal_interface_deinit(mm_radio_hal_interface *handle)
handle->rh_handle = NULL;
+ MMRADIO_LOG_DEBUG("close radio_hal interface");
dlclose(handle->dl_handle);
handle->dl_handle = NULL;
}