Check mic feature when setting session type to voip 10/88110/1
authorSeungbae Shin <seungbae.shin@samsung.com>
Tue, 13 Sep 2016 10:29:57 +0000 (19:29 +0900)
committerSeungbae Shin <seungbae.shin@samsung.com>
Tue, 13 Sep 2016 10:29:57 +0000 (19:29 +0900)
This code is from tizen 2.4 which is added recently

[Version] 0.3.64
[Profile] Common
[Issue Type] TC

Change-Id: Id81f096240c05abac1d49f9e5b75e94f6b8992e4

CMakeLists.txt
packaging/capi-media-sound-manager.spec
src/sound_manager.c

index ffce898..4d67822 100644 (file)
@@ -23,7 +23,7 @@ SET(service "media")
 SET(submodule "sound-manager")
 
 # for package file
-SET(dependents "mm-sound dlog capi-base-common mm-session libpulse gio-2.0 vconf")
+SET(dependents "mm-sound dlog capi-base-common mm-session libpulse gio-2.0 vconf capi-system-info")
 SET(pc_dependents "capi-base-common")
 
 # for deb
index 6fa8374..fc646e0 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       capi-media-sound-manager
 Summary:    Sound Manager library
-Version:    0.3.63
+Version:    0.3.64
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
@@ -14,6 +14,7 @@ BuildRequires:  pkgconfig(capi-base-common)
 BuildRequires:  pkgconfig(vconf)
 BuildRequires:  pkgconfig(libpulse)
 BuildRequires:  pkgconfig(gio-2.0)
+BuildRequires:  pkgconfig(capi-system-info)
 Requires(post): /sbin/ldconfig
 Requires(postun): /sbin/ldconfig
 
index 82b934a..aae3c41 100644 (file)
@@ -16,7 +16,9 @@
 
 #include "sound_manager.h"
 #include "sound_manager_private.h"
+#include <system_info.h>
 
+#define FEATURE_MICROPHONE          "http://tizen.org/feature/microphone"
 
 _session_interrupt_info_s g_session_interrupt_cb_table = {0, 0, NULL, NULL};
 _volume_changed_info_s g_volume_changed_cb_table = {0, NULL, NULL};
@@ -470,12 +472,21 @@ int sound_manager_set_session_type(sound_session_type_e type)
        int ret = MM_ERROR_NONE;
        int cur_session = -1;
        int new_session = MM_SESSION_TYPE_MEDIA;
+       bool mic_enable = false;
 
        LOGI(">> enter : type=%d", type);
 
        if (type < SOUND_SESSION_TYPE_MEDIA || type >  SOUND_SESSION_TYPE_VOIP)
                return _convert_sound_manager_error_code(__func__, MM_ERROR_INVALID_ARGUMENT);
 
+       /* If session type is VOIP but MIC is not enabled, return false */
+       if (type == SOUND_SESSION_TYPE_VOIP) {
+               ret = system_info_get_platform_bool(FEATURE_MICROPHONE, &mic_enable);
+               LOGI("system_info_platform [%s]=[%d], ret[%d]", FEATURE_MICROPHONE, mic_enable, ret);
+               if (ret != SYSTEM_INFO_ERROR_NONE || !mic_enable)
+                       return _convert_sound_manager_error_code(__func__, MM_ERROR_NOT_SUPPORT_API);
+       }
+
        /* it is not supported both session and stream feature at the same time */
        if (g_stream_info_count) {
                LOGE("Could not set this type(%d) because of being used stream feature", type);