summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGilbok Lee <gilbok.lee@samsung.com>2018-04-03 14:10:52 +0900
committerGilbok Lee <gilbok.lee@samsung.com>2018-04-03 14:23:06 +0900
commitab9d9e32ded6ea49b718453ac5d2049d7d21ed42 (patch)
tree170e8b28c8f3b3ada35cae420a21df45ced4f46d
parent8731374d6ce658639898e208d02bd3d63e030975 (diff)
downloadlibmm-radio-ab9d9e32ded6ea49b718453ac5d2049d7d21ed42.tar.gz
libmm-radio-ab9d9e32ded6ea49b718453ac5d2049d7d21ed42.tar.bz2
libmm-radio-ab9d9e32ded6ea49b718453ac5d2049d7d21ed42.zip
[Version] 0.2.36 [Profile] Mobile, Wearable [Issue Type] Disable sound docus feature Change-Id: Ifda1158b6bed8738502c170cfa8da477125c1e6e
-rwxr-xr-xconfigure.ac20
-rwxr-xr-xpackaging/libmm-radio.spec3
-rwxr-xr-xsrc/Makefile.am11
-rw-r--r--src/include/mm_radio_priv.h8
-rw-r--r--[-rwxr-xr-x]src/include/mm_radio_priv_hal.h7
-rw-r--r--src/include/mm_radio_sound_focus.h50
-rw-r--r--src/mm_radio_priv_emulator.c216
-rwxr-xr-xsrc/mm_radio_priv_hal.c207
-rw-r--r--src/mm_radio_sound_focus.c391
9 files changed, 4 insertions, 909 deletions
diff --git a/configure.ac b/configure.ac
index 5160329..ccf3d34 100755
--- a/configure.ac
+++ b/configure.ac
@@ -66,26 +66,6 @@ if test "x$ENABLE_EMULATOR" == "xyes"; then
AC_SUBST(GSTAPP_LIBS)
fi
-AC_ARG_ENABLE(sound-focus, AC_HELP_STRING([--enable-sound-focus], [using sound focus]),
-[
- case "${enableval}" in
- yes) ENABLE_SOUND_FOCUS=yes ;;
- no) ENABLE_SOUND_FOCUS=no ;;
- *) AC_MSG_ERROR(bad value ${enableval} for --enable-sound-focus) ;;
- esac
- ],[ENABLE_SOUND_FOCUS=no])
-AM_CONDITIONAL(ENABLE_SOUND_FOCUS, test "x$ENABLE_SOUND_FOCUS" = "xyes")
-
-if test "x$ENABLE_SOUND_FOCUS" == "xyes"; then
- PKG_CHECK_MODULES(MMSESSION, mm-session)
- AC_SUBST(MMSESSION_CFLAGS)
- AC_SUBST(MMSESSION_LIBS)
-
- PKG_CHECK_MODULES(MMSOUND, mm-sound)
- AC_SUBST(MMSOUND_CFLAGS)
- AC_SUBST(MMSOUND_LIBS)
-fi
-
AC_ARG_ENABLE(sound-vstream, AC_HELP_STRING([--enable-sound-vstream], [using sound virtual stream]),
[
case "${enableval}" in
diff --git a/packaging/libmm-radio.spec b/packaging/libmm-radio.spec
index 59cc0ce..84a7ade 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.35
+Version: 0.2.36
Release: 0
Group: System/Libraries
License: Apache-2.0
@@ -46,7 +46,6 @@ export CFLAGS+=" -DPATH_LIBDIR=\\\"%{_libdir}\\\""
%ifnarch %{arm}
--enable-emulator \
%endif
---enable-sound-focus \
--enable-sound-vstream \
--disable-static --prefix=%{_prefix}
diff --git a/src/Makefile.am b/src/Makefile.am
index a839909..9bad76c 100755
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -30,17 +30,6 @@ libmmfradio_la_SOURCES += mm_radio_priv_hal.c \
radio_hal_interface.c
endif
-if ENABLE_SOUND_FOCUS
-libmmfradio_la_SOURCES += mm_radio_sound_focus.c
-
-libmmfradio_la_CFLAGS += $(MMSESSION_CFLAGS) \
- $(MMSOUND_CFLAGS) \
- -DTIZEN_FEATURE_SOUND_FOCUS
-
-libmmfradio_la_LIBADD += $(MMSESSION_LIBS) \
- $(MMSOUND_LIBS)
-endif
-
if ENABLE_SOUND_VSTREAM
libmmfradio_la_CFLAGS += $(SOUNDMGR_CFLAGS) \
-DTIZEN_FEATURE_SOUND_VSTREAM
diff --git a/src/include/mm_radio_priv.h b/src/include/mm_radio_priv.h
index db0acfd..7870aab 100644
--- a/src/include/mm_radio_priv.h
+++ b/src/include/mm_radio_priv.h
@@ -34,10 +34,6 @@
#include <mm_message.h>
#include <media/mm_resource_manager.h>
-#ifdef TIZEN_FEATURE_SOUND_FOCUS
-#include "mm_radio_sound_focus.h"
-#endif
-
#include "mm_radio.h"
#include "mm_radio_utils.h"
#include <linux/videodev2.h>
@@ -192,10 +188,6 @@ typedef struct {
int prev_seek_freq;
MMRadioSeekDirectionType seek_direction;
-#ifdef TIZEN_FEATURE_SOUND_FOCUS
- mm_radio_sound_focus sound_focus;
-#endif
-
int freq;
#ifdef USE_GST_PIPELINE
mm_radio_gstreamer_s* pGstreamer_s;
diff --git a/src/include/mm_radio_priv_hal.h b/src/include/mm_radio_priv_hal.h
index d3acdaa..2a68170 100755..100644
--- a/src/include/mm_radio_priv_hal.h
+++ b/src/include/mm_radio_priv_hal.h
@@ -34,10 +34,6 @@
#include <mm_message.h>
#include <media/mm_resource_manager.h>
-#ifdef TIZEN_FEATURE_SOUND_FOCUS
-#include "mm_radio_sound_focus.h"
-#endif
-
#ifdef TIZEN_FEATURE_SOUND_VSTREAM
#include <media/sound_manager.h>
#include <media/sound_manager_internal.h>
@@ -177,9 +173,6 @@ typedef struct {
MMRadioSeekDirectionType seek_direction;
-#ifdef TIZEN_FEATURE_SOUND_FOCUS
- mm_radio_sound_focus sound_focus;
-#endif
#ifdef TIZEN_FEATURE_SOUND_VSTREAM
sound_stream_info_h stream_info;
virtual_sound_stream_h vstream;
diff --git a/src/include/mm_radio_sound_focus.h b/src/include/mm_radio_sound_focus.h
deleted file mode 100644
index 31f008d..0000000
--- a/src/include/mm_radio_sound_focus.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * mm_radio_sound_focus.h
- *
- * Copyright (c) 2000 - 2016 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * 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 MM_RADIO_AUDIO_FOCUS_H_
-#define MM_RADIO_AUDIO_FOCUS_H_
-
-#include <mm_types.h>
-#include <mm_error.h>
-
-#include <mm_session.h>
-#include <mm_session_private.h>
-#include <mm_sound_focus.h>
-#include <mm_message.h>
-
-typedef struct {
- int focus_id;
- int watch_id;
- unsigned int subscribe_id;
- unsigned int device_subs_id;
- int handle;
- int pid;
- bool by_focus_cb;
- int event_src;
- int snd_session_flags;
- int session_type;
- mm_sound_focus_type_e cur_focus_type;
-} mm_radio_sound_focus;
-int mmradio_sound_focus_register(mm_radio_sound_focus *sound_focus, mm_sound_focus_changed_cb focus_cb, mm_sound_focus_changed_watch_cb watch_cb, void *param);
-int mmradio_sound_focus_deregister(mm_radio_sound_focus *sound_focus);
-int mmradio_acquire_sound_focus(mm_radio_sound_focus *sound_focus);
-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);
-
-#endif /* MM_RADIO_AUDIO_FOCUS_H_ */
diff --git a/src/mm_radio_priv_emulator.c b/src/mm_radio_priv_emulator.c
index 5bb4de0..21d211a 100644
--- a/src/mm_radio_priv_emulator.c
+++ b/src/mm_radio_priv_emulator.c
@@ -36,12 +36,6 @@
#include <mm_message.h>
#include <time.h>
-#ifdef TIZEN_FEATURE_SOUND_FOCUS
-#include <mm_sound.h>
-#include <mm_sound_focus.h>
-#include <mm_sound_device.h>
-#endif
-
#include "mm_radio_priv.h"
/*===========================================================================================
@@ -139,14 +133,6 @@ static int __mmradio_set_band_range(mm_radio_t * radio);
static int __mmradio_get_wave_num(mm_radio_t * radio);
static int __resource_release_cb(mm_resource_manager_h rm,
mm_resource_manager_res_h res, void *user_data);
-#ifdef TIZEN_FEATURE_SOUND_FOCUS
-static void __mmradio_sound_focus_cb(int id, mm_sound_focus_type_e focus_type,
- mm_sound_focus_state_e focus_state, const char *reason_for_change, int option,
- const char *additional_info, void *user_data);
-static void __mmradio_sound_focus_watch_cb(int id, mm_sound_focus_type_e focus_type,
- mm_sound_focus_state_e focus_state, const char *reason_for_change,
- const char *additional_info, void *user_data);
-#endif
/*===========================================================================
FUNCTION DEFINITIONS
========================================================================== */
@@ -249,20 +235,6 @@ int _mmradio_create_radio(mm_radio_t * radio)
return MM_ERROR_RADIO_INTERNAL;
}
-#ifdef TIZEN_FEATURE_SOUND_FOCUS
- /* register to audio focus */
- ret = mmradio_sound_focus_register(&radio->sound_focus,
- (mm_sound_focus_changed_cb)__mmradio_sound_focus_cb,
- (mm_sound_focus_changed_watch_cb)__mmradio_sound_focus_watch_cb,
- (void *)radio);
-
- if (ret) {
- /* NOTE : we are dealing it as an error since we cannot expect it's behavior */
- MMRADIO_LOG_ERROR("failed to register sound focus");
- return MM_ERROR_RADIO_INTERNAL;
- }
-#endif
-
MMRADIO_LOG_FLEAVE();
return MM_ERROR_NONE;
@@ -337,14 +309,6 @@ int _mmradio_unrealize(mm_radio_t * radio)
MMRADIO_SET_STATE(radio, MM_RADIO_STATE_NULL);
-#ifdef TIZEN_FEATURE_SOUND_FOCUS
- ret = mmradio_release_sound_focus(&radio->sound_focus);
- if (ret) {
- MMRADIO_LOG_ERROR("failed to release sound focus");
- return ret;
- }
-#endif
-
#ifdef USE_GST_PIPELINE
ret = _mmradio_destroy_pipeline(radio);
if (ret) {
@@ -371,14 +335,6 @@ int _mmradio_destroy(mm_radio_t * radio)
/* destroy mutex and thread */
__mmradio_destroy_thread(radio);
-#ifdef TIZEN_FEATURE_SOUND_FOCUS
- ret = mmradio_sound_focus_deregister(&radio->sound_focus);
- if (ret) {
- MMRADIO_LOG_ERROR("failed to deregister sound focus");
- return MM_ERROR_RADIO_INTERNAL;
- }
-#endif
-
ret = mm_resource_manager_destroy(radio->resource_manager);
if (ret) {
MMRADIO_LOG_ERROR("failed to destroy resource manager");
@@ -614,39 +570,6 @@ int _mmradio_start(mm_radio_t * radio)
return ret;
}
-#ifdef TIZEN_FEATURE_SOUND_FOCUS
- if (radio->sound_focus.handle > 0) {
- ret = mmradio_acquire_sound_focus(&radio->sound_focus);
- if (ret != MM_ERROR_NONE) {
- MMRADIO_LOG_ERROR("failed to acquire sound focus");
- return ret;
- }
- }
-
- /* check previous acquired focus */
- if (radio->sound_focus.watch_id > 0) {
- char *stream_type = NULL;
- char *ext_info = NULL;
- int option = 0;
-
- ret = mm_sound_get_stream_type_of_acquired_focus(FOCUS_FOR_BOTH, &stream_type, &option, &ext_info);
- if (ret == MM_ERROR_NONE) {
- MMRADIO_LOG_DEBUG("Focus is acquired by stream_type[%s], option[%d], ext_info[%s]",
- stream_type, option, ext_info);
- if (!strcmp(stream_type, "alarm") || !strcmp(stream_type, "ringtone-voip") ||
- !strcmp(stream_type, "ringtone-call") || !strcmp(stream_type, "voip") ||
- !strcmp(stream_type, "call-voice") || !strcmp(stream_type, "call-video")) {
- MMRADIO_LOG_DEBUG("Blcoked by session policy, focus_acquired_by[%s]", stream_type);
- free(ext_info);
- free(stream_type);
- return MM_ERROR_POLICY_BLOCKED;
- }
- free(ext_info);
- free(stream_type);
- }
- }
-#endif
-
/* set stored frequency */
_mmradio_set_frequency(radio, radio->freq);
@@ -698,16 +621,6 @@ int _mmradio_stop(mm_radio_t * radio)
MMRADIO_LOG_ERROR("resource manager commit fail");
}
-#ifdef TIZEN_FEATURE_SOUND_FOCUS
- if (radio->sound_focus.handle > 0) {
- ret = mmradio_release_sound_focus(&radio->sound_focus);
- if (ret) {
- MMRADIO_LOG_ERROR("failed to release sound focus");
- return ret;
- }
- }
-#endif
-
MMRADIO_SET_STATE(radio, MM_RADIO_STATE_READY);
#ifdef USE_GST_PIPELINE
@@ -1341,14 +1254,7 @@ static bool __mmradio_set_state(mm_radio_t * radio, int new_state)
msg.state.previous = radio->old_state;
msg.state.current = radio->current_state;
-#ifdef TIZEN_FEATURE_SOUND_FOCUS
- /* post message to application */
- if (radio->sound_focus.by_focus_cb) {
- msg_type = MM_MESSAGE_STATE_INTERRUPTED;
- msg.state.code = radio->sound_focus.event_src;
- MMRADIO_POST_MSG(radio, msg_type, &msg);
- radio->sound_focus.by_focus_cb = false;
- } else if (radio->interrupted_by_resource_conflict) {
+ if (radio->interrupted_by_resource_conflict) {
msg_type = MM_MESSAGE_STATE_INTERRUPTED;
msg.state.code = MM_MSG_CODE_INTERRUPTED_BY_RESOURCE_CONFLICT;
MMRADIO_POST_MSG(radio, msg_type, &msg);
@@ -1356,17 +1262,7 @@ static bool __mmradio_set_state(mm_radio_t * radio, int new_state)
msg_type = MM_MESSAGE_STATE_CHANGED;
MMRADIO_POST_MSG(radio, msg_type, &msg);
}
-#else
- if (radio->interrupted_by_resource_conflict) {
- msg_type = MM_MESSAGE_STATE_INTERRUPTED;
- msg.state.code = MM_MSG_CODE_INTERRUPTED_BY_RESOURCE_CONFLICT;
- MMRADIO_POST_MSG(radio, msg_type, &msg);
- } else {
- msg_type = MM_MESSAGE_STATE_CHANGED;
- MMRADIO_POST_MSG(radio, msg_type, &msg);
- }
-#endif
MMRADIO_LOG_FLEAVE();
return true;
@@ -1382,116 +1278,6 @@ static int __mmradio_get_state(mm_radio_t * radio)
return radio->current_state;
}
-#ifdef TIZEN_FEATURE_SOUND_FOCUS
-static void __mmradio_sound_focus_cb(int id, mm_sound_focus_type_e focus_type,
- mm_sound_focus_state_e focus_state, const char *reason_for_change, int option,
- const char *additional_info, void *user_data)
-{
- mm_radio_t *radio = (mm_radio_t *)user_data;
- enum MMMessageInterruptedCode event_source;
- int result = MM_ERROR_NONE;
- int postMsg = false;
-
- MMRADIO_LOG_FENTER();
- MMRADIO_CHECK_INSTANCE_RETURN_VOID(radio);
-
- mmradio_get_sound_focus_reason(focus_state, reason_for_change, FALSE, &event_source, &postMsg);
- radio->sound_focus.event_src = event_source;
-
- switch (focus_state) {
- case FOCUS_IS_RELEASED:{
- radio->sound_focus.cur_focus_type &= ~focus_type;
- radio->sound_focus.by_focus_cb = true;
-
- MMRADIO_CMD_LOCK(radio);
- result = _mmradio_stop(radio);
- if (result)
- MMRADIO_LOG_ERROR("failed to stop radio");
- MMRADIO_CMD_UNLOCK(radio);
-
- radio->sound_focus.by_focus_cb = false;
-
- MMRADIO_LOG_DEBUG("FOCUS_IS_RELEASED cur_focus_type : %d", radio->sound_focus.cur_focus_type);
- }
- break;
-
- case FOCUS_IS_ACQUIRED:{
- MMMessageParamType msg = { 0, };
- msg.union_type = MM_MSG_UNION_CODE;
- msg.code = event_source;
-
- radio->sound_focus.cur_focus_type |= focus_type;
-
- if ((postMsg) && (FOCUS_FOR_BOTH == radio->sound_focus.cur_focus_type))
- MMRADIO_POST_MSG(radio, MM_MESSAGE_READY_TO_RESUME, &msg);
-
- MMRADIO_LOG_DEBUG("FOCUS_IS_ACQUIRED cur_focus_type : %d", radio->sound_focus.cur_focus_type);
- }
- break;
-
- default:
- MMRADIO_LOG_DEBUG("Unknown focus_state");
- break;
- }
-
- MMRADIO_LOG_FLEAVE();
-}
-
-static void __mmradio_sound_focus_watch_cb(int id, mm_sound_focus_type_e focus_type,
- mm_sound_focus_state_e focus_state, const char *reason_for_change,
- const char *additional_info, void *user_data)
-{
- mm_radio_t *radio = (mm_radio_t *)user_data;
- enum MMMessageInterruptedCode event_source;
- int result = MM_ERROR_NONE;
- int postMsg = false;
-
- MMRADIO_LOG_FENTER();
- MMRADIO_CHECK_INSTANCE_RETURN_VOID(radio);
-
- mmradio_get_sound_focus_reason(focus_state, reason_for_change, TRUE, &event_source, &postMsg);
- radio->sound_focus.event_src = event_source;
-
- switch (focus_state) {
- case FOCUS_IS_ACQUIRED: {
- radio->sound_focus.cur_focus_type &= ~focus_type;
- radio->sound_focus.by_focus_cb = true;
-
- MMRADIO_CMD_LOCK(radio);
- result = _mmradio_stop(radio);
- if (result)
- MMRADIO_LOG_ERROR("failed to stop radio\n");
- MMRADIO_CMD_UNLOCK(radio);
-
- radio->sound_focus.by_focus_cb = false;
-
- MMRADIO_LOG_DEBUG("FOCUS_IS_RELEASED cur_focus_type : %d", radio->sound_focus.cur_focus_type);
- }
- break;
-
- case FOCUS_IS_RELEASED: {
- MMMessageParamType msg = { 0, };
- msg.union_type = MM_MSG_UNION_CODE;
- msg.code = event_source;
-
- radio->sound_focus.cur_focus_type |= focus_type;
-
- if ((postMsg) && (FOCUS_FOR_BOTH == radio->sound_focus.cur_focus_type))
- MMRADIO_POST_MSG(radio, MM_MESSAGE_READY_TO_RESUME, &msg);
-
- MMRADIO_LOG_DEBUG("FOCUS_IS_ACQUIRED cur_focus_type : %d", radio->sound_focus.cur_focus_type);
- }
- break;
-
- default:
- MMRADIO_LOG_DEBUG("Unknown focus_state");
- break;
- }
-
- MMRADIO_LOG_FLEAVE();
-}
-#endif
-
int _mmradio_get_region_type(mm_radio_t * radio, MMRadioRegionType * type)
{
MMRADIO_LOG_FENTER();
diff --git a/src/mm_radio_priv_hal.c b/src/mm_radio_priv_hal.c
index e1f55f1..44d5bf5 100755
--- a/src/mm_radio_priv_hal.c
+++ b/src/mm_radio_priv_hal.c
@@ -126,15 +126,6 @@ static bool __is_tunable_frequency(mm_radio_t *radio, int freq);
static int __mmradio_create_thread(mm_radio_t *radio);
static void __mmradio_destroy_thread(mm_radio_t *radio);
-#ifdef TIZEN_FEATURE_SOUND_FOCUS
-static void __mmradio_sound_focus_cb(int id, mm_sound_focus_type_e focus_type,
- mm_sound_focus_state_e focus_state, const char *reason_for_change, int option,
- const char *additional_info, void *user_data);
-static void __mmradio_sound_focus_watch_cb(int id, mm_sound_focus_type_e focus_type,
- mm_sound_focus_state_e focus_state, const char *reason_for_change,
- const char *additional_info, void *user_data);
-#endif
-
static void __mmradio_volume_changed_cb(volume_type_t type, unsigned int volume, void *user_data);
static int __mmradio_set_media_volume(mm_radio_t *radio, unsigned int level);
static int __resource_release_cb(mm_resource_manager_h rm,
@@ -192,9 +183,6 @@ int _mmradio_create_radio(mm_radio_t *radio)
/* set default value */
radio->freq = DEFAULT_FREQ;
-#ifdef TIZEN_FEATURE_SOUND_FOCUS
- memset(&radio->sound_focus, 0, sizeof(mm_radio_sound_focus));
-#endif
memset(&radio->region_setting, 0, sizeof(MMRadioRegion_t));
radio->local_volume = 1.0;
@@ -215,19 +203,6 @@ int _mmradio_create_radio(mm_radio_t *radio)
return MM_ERROR_RADIO_INTERNAL;
}
-#ifdef TIZEN_FEATURE_SOUND_FOCUS
- ret = mmradio_sound_focus_register(&radio->sound_focus,
- (mm_sound_focus_changed_cb)__mmradio_sound_focus_cb,
- (mm_sound_focus_changed_watch_cb)__mmradio_sound_focus_watch_cb,
- (void *)radio);
-
- if (ret) {
- /* NOTE : we are dealing it as an error since we cannot expect it's behavior */
- MMRADIO_LOG_ERROR("failed to register sound focus");
- return MM_ERROR_RADIO_INTERNAL;
- }
-#endif
-
ret = radio_hal_interface_init(&(radio->hal_inf));
if (ret) {
MMRADIO_LOG_ERROR("failed to init mmradio hal interface");
@@ -356,14 +331,6 @@ int _mmradio_destroy(mm_radio_t *radio)
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");
- return MM_ERROR_RADIO_INTERNAL;
- }
-#endif
-
ret = mm_resource_manager_destroy(radio->resource_manager);
if (ret) {
MMRADIO_LOG_ERROR("failed to destroy resource manager");
@@ -525,39 +492,6 @@ int _mmradio_start(mm_radio_t *radio)
MMRADIO_LOG_INFO("now tune to frequency : %d", radio->freq);
-#ifdef TIZEN_FEATURE_SOUND_FOCUS
- if (radio->sound_focus.handle > 0) {
- ret = mmradio_acquire_sound_focus(&radio->sound_focus);
- if (ret != MM_ERROR_NONE) {
- MMRADIO_LOG_ERROR("failed to acquire sound focus");
- return ret;
- }
- }
-
- /* check previous acquired focus */
- if (radio->sound_focus.watch_id > 0) {
- char *stream_type = NULL;
- char *ext_info = NULL;
- int option = 0;
-
- ret = mm_sound_get_stream_type_of_acquired_focus(FOCUS_FOR_BOTH, &stream_type, &option, &ext_info);
- if (ret == MM_ERROR_NONE) {
- MMRADIO_LOG_DEBUG("Focus is acquired by stream_type[%s], option[%d], ext_info[%s]",
- stream_type, option, ext_info);
- if (!strcmp(stream_type, "alarm") || !strcmp(stream_type, "ringtone-voip") ||
- !strcmp(stream_type, "ringtone-call") || !strcmp(stream_type, "voip") ||
- !strcmp(stream_type, "call-voice") || !strcmp(stream_type, "call-video")) {
- MMRADIO_LOG_DEBUG("Blcoked by session policy, focus_acquired_by[%s]", stream_type);
- free(ext_info);
- free(stream_type);
- return MM_ERROR_POLICY_BLOCKED;
- }
- free(ext_info);
- free(stream_type);
- }
- }
-#endif
-
if (!radio->is_ready) {
ret = mm_resource_manager_mark_for_acquire(radio->resource_manager,
MM_RESOURCE_MANAGER_RES_TYPE_RADIO,
@@ -706,15 +640,7 @@ int _mmradio_stop(mm_radio_t *radio)
radio->is_ready = false;
}
-#ifdef TIZEN_FEATURE_SOUND_FOCUS
- if (radio->sound_focus.handle > 0) {
- ret = mmradio_release_sound_focus(&radio->sound_focus);
- if (ret) {
- MMRADIO_LOG_ERROR("failed to release sound focus");
- return ret;
- }
- }
-#endif
+
MMRADIO_SET_STATE(radio, MM_RADIO_STATE_READY);
MMRADIO_LOG_FLEAVE();
@@ -1358,13 +1284,7 @@ static bool __mmradio_set_state(mm_radio_t *radio, int new_state)
msg.state.previous = radio->old_state;
msg.state.current = radio->current_state;
-#ifdef TIZEN_FEATURE_SOUND_FOCUS
- /* post message to application */
- if (radio->sound_focus.by_focus_cb) {
- msg_type = MM_MESSAGE_STATE_INTERRUPTED;
- msg.state.code = radio->sound_focus.event_src;
- MMRADIO_POST_MSG(radio, msg_type, &msg);
- } else if (radio->interrupted_by_resource_conflict) {
+ if (radio->interrupted_by_resource_conflict) {
msg_type = MM_MESSAGE_STATE_INTERRUPTED;
msg.state.code = MM_MSG_CODE_INTERRUPTED_BY_RESOURCE_CONFLICT;
MMRADIO_POST_MSG(radio, msg_type, &msg);
@@ -1372,17 +1292,6 @@ static bool __mmradio_set_state(mm_radio_t *radio, int new_state)
msg_type = MM_MESSAGE_STATE_CHANGED;
MMRADIO_POST_MSG(radio, msg_type, &msg);
}
-#else
- if (radio->interrupted_by_resource_conflict) {
- msg_type = MM_MESSAGE_STATE_INTERRUPTED;
- msg.state.code = MM_MSG_CODE_INTERRUPTED_BY_RESOURCE_CONFLICT;
- MMRADIO_POST_MSG(radio, msg_type, &msg);
- } else {
- msg_type = MM_MESSAGE_STATE_CHANGED;
- MMRADIO_POST_MSG(radio, msg_type, &msg);
- }
-
-#endif
MMRADIO_LOG_FLEAVE();
@@ -1399,118 +1308,6 @@ static int __mmradio_get_state(mm_radio_t *radio)
return radio->current_state;
}
-#ifdef TIZEN_FEATURE_SOUND_FOCUS
-static void __mmradio_sound_focus_cb(int id, mm_sound_focus_type_e focus_type,
- mm_sound_focus_state_e focus_state, const char *reason_for_change, int option,
- const char *additional_info, void *user_data)
-{
- mm_radio_t *radio = (mm_radio_t *)user_data;
- enum MMMessageInterruptedCode event_source;
- int result = MM_ERROR_NONE;
- int postMsg = false;
-
- MMRADIO_LOG_FENTER();
- MMRADIO_CHECK_INSTANCE_RETURN_VOID(radio);
- MMRADIO_LOG_INFO("focus_state [%d]", focus_state);
-
- mmradio_get_sound_focus_reason(focus_state, reason_for_change, FALSE, &event_source, &postMsg);
- radio->sound_focus.event_src = event_source;
-
- switch (focus_state) {
- case FOCUS_IS_RELEASED:{
- radio->sound_focus.cur_focus_type &= ~focus_type;
- radio->sound_focus.by_focus_cb = true;
-
- MMRADIO_CMD_LOCK(radio);
- result = _mmradio_stop(radio);
- if (result)
- MMRADIO_LOG_ERROR("failed to stop radio");
- MMRADIO_CMD_UNLOCK(radio);
-
- radio->sound_focus.by_focus_cb = false;
-
- MMRADIO_LOG_DEBUG("FOCUS_IS_RELEASED cur_focus_type : %d", radio->sound_focus.cur_focus_type);
- }
- break;
-
- case FOCUS_IS_ACQUIRED:{
- MMMessageParamType msg = { 0, };
- msg.union_type = MM_MSG_UNION_CODE;
- msg.code = event_source;
-
- radio->sound_focus.cur_focus_type |= focus_type;
-
- if ((postMsg) && (FOCUS_FOR_BOTH == radio->sound_focus.cur_focus_type))
- MMRADIO_POST_MSG(radio, MM_MESSAGE_READY_TO_RESUME, &msg);
-
- MMRADIO_LOG_DEBUG("FOCUS_IS_ACQUIRED cur_focus_type : %d", radio->sound_focus.cur_focus_type);
- }
- break;
-
- default:
- MMRADIO_LOG_DEBUG("Unknown focus_state");
- break;
- }
-
- MMRADIO_LOG_FLEAVE();
-}
-
-static void __mmradio_sound_focus_watch_cb(int id, mm_sound_focus_type_e focus_type,
- mm_sound_focus_state_e focus_state, const char *reason_for_change,
- const char *additional_info, void *user_data)
-{
- mm_radio_t *radio = (mm_radio_t *)user_data;
- enum MMMessageInterruptedCode event_source;
- int result = MM_ERROR_NONE;
- int postMsg = false;
-
- MMRADIO_LOG_FENTER();
- MMRADIO_CHECK_INSTANCE_RETURN_VOID(radio);
- MMRADIO_LOG_INFO("focus_state [%d]", focus_state);
-
- mmradio_get_sound_focus_reason(focus_state, reason_for_change, true, &event_source, &postMsg);
- radio->sound_focus.event_src = event_source;
-
- switch (focus_state) {
- case FOCUS_IS_ACQUIRED: {
- radio->sound_focus.cur_focus_type &= ~focus_type;
- radio->sound_focus.by_focus_cb = true;
-
- MMRADIO_CMD_LOCK(radio);
- result = _mmradio_stop(radio);
- if (result)
- MMRADIO_LOG_ERROR("failed to stop radio");
- MMRADIO_CMD_UNLOCK(radio);
-
- radio->sound_focus.by_focus_cb = false;
-
- MMRADIO_LOG_DEBUG("FOCUS_IS_RELEASED cur_focus_type : %d\n", radio->sound_focus.cur_focus_type);
- }
- break;
-
- case FOCUS_IS_RELEASED: {
- MMMessageParamType msg = { 0, };
- msg.union_type = MM_MSG_UNION_CODE;
- msg.code = event_source;
-
- radio->sound_focus.cur_focus_type |= focus_type;
-
- if ((postMsg) && (FOCUS_FOR_BOTH == radio->sound_focus.cur_focus_type))
- MMRADIO_POST_MSG(radio, MM_MESSAGE_READY_TO_RESUME, &msg);
-
- MMRADIO_LOG_DEBUG("FOCUS_IS_ACQUIRED cur_focus_type : %d", radio->sound_focus.cur_focus_type);
- }
- break;
-
- default:
- MMRADIO_LOG_DEBUG("Unknown focus_state");
- break;
- }
-
- MMRADIO_LOG_FLEAVE();
-}
-#endif
-
static void __mmradio_volume_changed_cb(volume_type_t type, unsigned int volume, void *user_data)
{
mm_radio_t *radio = (mm_radio_t *)user_data;
diff --git a/src/mm_radio_sound_focus.c b/src/mm_radio_sound_focus.c
deleted file mode 100644
index 83e7fce..0000000
--- a/src/mm_radio_sound_focus.c
+++ /dev/null
@@ -1,391 +0,0 @@
-/*
- * mm_radio_sound_focus.c
- *
- * Copyright (c) 2000 - 2016 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * 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.
- *
- */
-
-#include <assert.h>
-#include <unistd.h>
-#include <mm_sound.h>
-#include <mm_sound_focus.h>
-#include <mm_sound_device.h>
-#include "mm_radio_utils.h"
-#include "mm_radio_priv_hal.h"
-#include "mm_radio_sound_focus.h"
-
-static void _mmradio_device_connected_cb(MMSoundDevice_t device, bool is_connected, void *user_data)
-{
- mm_radio_t *radio = (mm_radio_t *)user_data;
- int result = MM_ERROR_NONE;
- mm_sound_device_type_e type;
-
- MMRADIO_LOG_FENTER();
- MMRADIO_CHECK_INSTANCE_RETURN_VOID(radio);
- MMRADIO_LOG_INFO("device [%d] is_connected [%d]", device, is_connected);
-
- if (mm_sound_get_device_type(device, &type) != MM_ERROR_NONE) {
- MMRADIO_LOG_ERROR("getting device type failed");
- } else {
- switch (type) {
- case MM_SOUND_DEVICE_TYPE_AUDIOJACK:
- case MM_SOUND_DEVICE_TYPE_BLUETOOTH:
- case MM_SOUND_DEVICE_TYPE_HDMI:
- case MM_SOUND_DEVICE_TYPE_MIRRORING:
- case MM_SOUND_DEVICE_TYPE_USB_AUDIO:
- if (!is_connected) {
- MMRADIO_LOG_ERROR("sound device unplugged");
- radio->sound_focus.by_focus_cb = true;
- radio->sound_focus.event_src = MM_MSG_CODE_INTERRUPTED_BY_EARJACK_UNPLUG;
-
- MMRADIO_CMD_LOCK(radio);
- result = _mmradio_stop(radio);
- if (result != MM_ERROR_NONE)
- MMRADIO_LOG_ERROR("failed to stop radio");
- MMRADIO_CMD_UNLOCK(radio);
-
- radio->sound_focus.by_focus_cb = false;
- }
- break;
- default:
- break;
- }
- }
- MMRADIO_LOG_FLEAVE();
-}
-
-void _mmradio_sound_signal_callback(mm_sound_signal_name_t signal, int value, void *user_data)
-{
- mm_radio_sound_focus *sound_focus = (mm_radio_sound_focus *)user_data;
- int ret = MM_ERROR_NONE;
-
- MMRADIO_LOG_INFO("sound signal callback %d / %d", signal, value);
-
- if (signal == MM_SOUND_SIGNAL_RELEASE_INTERNAL_FOCUS) {
- if (value == 1) {
- /* 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)
- MMRADIO_LOG_ERROR("failed to mm_sound_unset_focus_watch_callback()");
- }
- /* 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)
- MMRADIO_LOG_ERROR("failed to mm_sound_unregister_focus() %d", sound_focus->focus_id);
- }
- /* unregister device connected callback */
- if (sound_focus->device_subs_id > 0) {
- MMRADIO_LOG_DEBUG("unset the device connected cb %d", sound_focus->device_subs_id);
- ret = mm_sound_remove_device_connected_callback(sound_focus->device_subs_id);
- sound_focus->device_subs_id = 0;
- if (ret != MM_ERROR_NONE)
- MMRADIO_LOG_ERROR("failed to mm_sound_remove_device_connected_callback()");
- }
- }
- }
-}
-
-int mmradio_sound_focus_register(mm_radio_sound_focus *sound_focus,
- mm_sound_focus_changed_cb focus_cb, mm_sound_focus_changed_watch_cb watch_cb, void *param)
-{
- /* read mm-session information */
- int session_type = MM_SESSION_TYPE_MEDIA;
- int session_flags = 0;
- int ret = MM_ERROR_NONE;
- int pid = getpid();
- int handle = 0;
-
- MMRADIO_LOG_FENTER();
-
- if (!sound_focus) {
- MMRADIO_LOG_ERROR("invalid session handle");
- return MM_ERROR_RADIO_NOT_INITIALIZED;
- }
- sound_focus->cur_focus_type = FOCUS_NONE;
-
- /* read session information */
- ret = _mm_session_util_read_information(pid, &session_type, &session_flags);
- MMRADIO_LOG_INFO("Read Session type ret:0x%X", ret);
- if (ret == MM_ERROR_INVALID_HANDLE) {
- 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");
- return MM_ERROR_POLICY_BLOCKED;
- }
- 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");
- return MM_ERROR_POLICY_BLOCKED;
- }
- MMRADIO_LOG_INFO("(%p) set focus watch callback = %d", param, sound_focus->watch_id);
-
- /* register device connected callback */
- 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");
- return MM_ERROR_POLICY_BLOCKED;
- }
- MMRADIO_LOG_INFO("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", 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) {
- if (sound_focus->snd_session_flags & MM_SESSION_OPTION_PAUSE_OTHERS) {
- /* register focus session */
- sound_focus->pid = pid;
- MMRADIO_LOG_DEBUG("sound register focus pid[%d]", pid);
- ret = mm_sound_focus_get_id(&handle);
- if (ret != MM_ERROR_NONE) {
- MMRADIO_LOG_ERROR("Failed to get sound focus id");
- return MM_ERROR_POLICY_BLOCKED;
- }
- sound_focus->handle = handle;
-
- ret = mm_sound_register_focus_for_session(handle, pid, "radio", focus_cb, param);
- if (ret != MM_ERROR_NONE) {
- MMRADIO_LOG_ERROR("mm_sound_register_focus_for_session is failed");
- return MM_ERROR_POLICY_BLOCKED;
- }
- MMRADIO_LOG_DEBUG("(%p) register focus for session %d", param, pid);
- /* register device_connected_cb */
- 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");
- return MM_ERROR_POLICY_BLOCKED;
- }
- MMRADIO_LOG_DEBUG("(%p) add device connected callback = %d", param, sound_focus->device_subs_id);
-
- } else if (sound_focus->snd_session_flags & MM_SESSION_OPTION_UNINTERRUPTIBLE) {
- /* register device_connected_cb */
- 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");
- return MM_ERROR_POLICY_BLOCKED;
- }
- MMRADIO_LOG_DEBUG("add device connected callback = %d", sound_focus->device_subs_id);
- MMRADIO_LOG_WARNING("settion flags isn't OPTION_PAUSE_OTHERS and UNINTERRUPTIBLE. skip it..");
- } else {
- /* 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");
- return MM_ERROR_POLICY_BLOCKED;
- }
- MMRADIO_LOG_DEBUG("set focus watch callback = %d", sound_focus->watch_id);
-
- /* register device connected callback */
- 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");
- return MM_ERROR_POLICY_BLOCKED;
- }
- MMRADIO_LOG_INFO("(%p) add device connected callback = %d", param, sound_focus->device_subs_id);
- }
- } else if (sound_focus->session_type == MM_SESSION_TYPE_REPLACED_BY_STREAM) {
- /* didn't register device connected cb */
- MMRADIO_LOG_WARNING("this process is using stream info. skip it..");
- } else {
- MMRADIO_LOG_WARNING("seesion type is not MEDIA (%d)", sound_focus->session_type);
- return MM_ERROR_RADIO_INTERNAL;
- }
- ret = MM_ERROR_NONE;
- } else {
- MMRADIO_LOG_WARNING("Read Session Information failed. skip sound focus register function. errorcode %x", ret);
- }
-
- MMRADIO_LOG_FLEAVE();
-
- return MM_ERROR_NONE;
-}
-
-int mmradio_sound_focus_deregister(mm_radio_sound_focus *sound_focus)
-{
-
- int ret = MM_ERROR_NONE;
-
- MMRADIO_LOG_FENTER();
-
- if (!sound_focus) {
- MMRADIO_LOG_ERROR("invalid session handle");
- return MM_ERROR_RADIO_NOT_INITIALIZED;
- }
-
- if (sound_focus->watch_id > 0) {
- MMRADIO_LOG_INFO("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)
- MMRADIO_LOG_ERROR("failed to mm_sound_unset_focus_watch_callback() ret = %d", ret);
- }
- /* unregister focus callback */
- if (sound_focus->focus_id > 0) {
- ret = mm_sound_unregister_focus(sound_focus->focus_id);
- sound_focus->focus_id = 0;
- if (ret != MM_ERROR_NONE)
- MMRADIO_LOG_ERROR("failed to mm_sound_unregister_focus() ret = %d", ret);
- }
- /* unregister device connected callback */
- if (sound_focus->device_subs_id > 0) {
- MMRADIO_LOG_INFO("unset the device connected cb %d", sound_focus->device_subs_id);
- ret = mm_sound_remove_device_connected_callback(sound_focus->device_subs_id);
- sound_focus->device_subs_id = 0;
- if (ret != MM_ERROR_NONE)
- MMRADIO_LOG_ERROR("failed to mm_sound_remove_device_connected_callback() ret = %d", ret);
- }
-
- if (sound_focus->subscribe_id > 0) {
- MMRADIO_LOG_INFO("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;
-}
-
-int mmradio_acquire_sound_focus(mm_radio_sound_focus *sound_focus)
-{
- int ret = MM_ERROR_NONE;
- 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", 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");
- return MM_ERROR_POLICY_BLOCKED;
- }
- sound_focus->cur_focus_type = FOCUS_FOR_BOTH;
- }
-
- MMRADIO_LOG_FLEAVE();
- return ret;
-}
-
-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", 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");
- return MM_ERROR_POLICY_BLOCKED;
- }
- sound_focus->cur_focus_type = FOCUS_NONE;
- }
-
- MMRADIO_LOG_FLEAVE();
- return ret;
-}
-
-#define AUDIO_FOCUS_REASON_MAX 128
-
-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", 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))
- || (0 == strncmp(reason_for_change, "ringtone-voip", AUDIO_FOCUS_REASON_MAX))
- || (0 == strncmp(reason_for_change, "ringtone-call", AUDIO_FOCUS_REASON_MAX))
- ) {
- if (focus_state == FOCUS_IS_RELEASED) {
- if (is_watch)
- *event_source = MM_MSG_CODE_INTERRUPTED_BY_CALL_END;
- else
- *event_source = MM_MSG_CODE_INTERRUPTED_BY_CALL_START;
- } else if (focus_state == FOCUS_IS_ACQUIRED) {
- if (is_watch)
- *event_source = MM_MSG_CODE_INTERRUPTED_BY_CALL_START;
- else
- *event_source = MM_MSG_CODE_INTERRUPTED_BY_CALL_END;
- }
- *postMsg = true;
- } else if (0 == strncmp(reason_for_change, "alarm", AUDIO_FOCUS_REASON_MAX)) {
- if (focus_state == FOCUS_IS_RELEASED) {
- if (is_watch)
- *event_source = MM_MSG_CODE_INTERRUPTED_BY_ALARM_END;
- else
- *event_source = MM_MSG_CODE_INTERRUPTED_BY_ALARM_START;
- } else if (focus_state == FOCUS_IS_ACQUIRED) {
- if (is_watch)
- *event_source = MM_MSG_CODE_INTERRUPTED_BY_ALARM_START;
- else
- *event_source = MM_MSG_CODE_INTERRUPTED_BY_ALARM_END;
- }
- *postMsg = true;
- } else if (0 == strncmp(reason_for_change, "notification", AUDIO_FOCUS_REASON_MAX)) {
- if (focus_state == FOCUS_IS_RELEASED) {
- if (is_watch)
- *event_source = MM_MSG_CODE_INTERRUPTED_BY_NOTIFICATION_END;
- else
- *event_source = MM_MSG_CODE_INTERRUPTED_BY_NOTIFICATION_START;
- } else if (focus_state == FOCUS_IS_ACQUIRED) {
- if (is_watch)
- *event_source = MM_MSG_CODE_INTERRUPTED_BY_NOTIFICATION_START;
- else
- *event_source = MM_MSG_CODE_INTERRUPTED_BY_NOTIFICATION_END;
- }
- *postMsg = true;
- } else if (0 == strncmp(reason_for_change, "emergency", AUDIO_FOCUS_REASON_MAX)) {
- if (focus_state == FOCUS_IS_RELEASED) {
- if (is_watch)
- *event_source = MM_MSG_CODE_INTERRUPTED_BY_EMERGENCY_END;
- else
- *event_source = MM_MSG_CODE_INTERRUPTED_BY_EMERGENCY_START;
- } else if (focus_state == FOCUS_IS_ACQUIRED) {
- if (is_watch)
- *event_source = MM_MSG_CODE_INTERRUPTED_BY_EMERGENCY_START;
- else
- *event_source = MM_MSG_CODE_INTERRUPTED_BY_EMERGENCY_END;
- }
- *postMsg = false;
- } else if (0 == strncmp(reason_for_change, "media", AUDIO_FOCUS_REASON_MAX)) {
- *event_source = MM_MSG_CODE_INTERRUPTED_BY_MEDIA;
- *postMsg = false;
- } else {
- *event_source = MM_MSG_CODE_INTERRUPTED_BY_MEDIA;
- *postMsg = false;
- }
- MMRADIO_LOG_FLEAVE();
-}