summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGilbok Lee <gilbok.lee@samsung.com>2017-05-02 18:33:41 +0900
committerGilbok Lee <gilbok.lee@samsung.com>2017-05-16 12:29:32 +0900
commit04c6b15e4ab97af1ac388f2347e1005cceeff344 (patch)
treeb9dcd39c1f8db4c659543c17ee8f5f24b3253f76
parent82239203347f19d3a772faff4f6f2e1fd56550c7 (diff)
downloadlibmm-radio-04c6b15e4ab97af1ac388f2347e1005cceeff344.tar.gz
libmm-radio-04c6b15e4ab97af1ac388f2347e1005cceeff344.tar.bz2
libmm-radio-04c6b15e4ab97af1ac388f2347e1005cceeff344.zip
Check acquire focus type for backward compatibility
[Version] 0.2.27 [Profile] Mobile, Wearable [Issue Type] Backward compatibility Change-Id: I4b35f974a51a6c5f863495640166af8e0e55eb0b
-rwxr-xr-xpackaging/libmm-radio.spec2
-rw-r--r--src/mm_radio_priv_emulator.c23
-rw-r--r--src/mm_radio_priv_hal.c23
3 files changed, 47 insertions, 1 deletions
diff --git a/packaging/libmm-radio.spec b/packaging/libmm-radio.spec
index dc9a83b..1bbe61c 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.26
+Version: 0.2.27
Release: 0
Group: System/Libraries
License: Apache-2.0
diff --git a/src/mm_radio_priv_emulator.c b/src/mm_radio_priv_emulator.c
index 7fa2ae2..609f6a6 100644
--- a/src/mm_radio_priv_emulator.c
+++ b/src/mm_radio_priv_emulator.c
@@ -585,6 +585,29 @@ int _mmradio_start(mm_radio_t * radio)
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 */
diff --git a/src/mm_radio_priv_hal.c b/src/mm_radio_priv_hal.c
index 5fc7d30..dbbbc5d 100644
--- a/src/mm_radio_priv_hal.c
+++ b/src/mm_radio_priv_hal.c
@@ -553,6 +553,29 @@ int _mmradio_start(mm_radio_t *radio)
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) {