mm_sound_proxy: add bt-a2dp device to query list properly only if mask satisfied 50/255050/1
authorSeungbae Shin <seungbae.shin@samsung.com>
Thu, 11 Mar 2021 10:57:39 +0000 (19:57 +0900)
committerSeungbae Shin <seungbae.shin@samsung.com>
Thu, 11 Mar 2021 11:11:32 +0000 (20:11 +0900)
[Version] 0.13.5
[Issue Type] Bug (Product)

Change-Id: I5035ba829f060bfc8638006b47787b3a0d9af4fb

mm_sound_proxy.c
packaging/libmm-sound.spec

index 86e4621..6cd5b3f 100644 (file)
@@ -370,11 +370,27 @@ cleanup:
 #define _VCONF_KEY_SOUND_SPEAKER_SELECTION "file/private/sound/feature/SpeakerSelection"
 #define _AUDIO_TV_OUTPUT_BT_HEADSET 5
 
-static mm_sound_device_t* _get_tv_bt_device(void)
+static mm_sound_device_t* _get_tv_bt_device(int device_flags)
 {
        int speaker_value = 0;
        mm_sound_device_t* device_item = NULL;
 
+       /* check precondition mask first here */
+       if (device_flags != DEVICE_ALL_FLAG) {
+               if (!(device_flags & DEVICE_IO_DIRECTION_OUT_FLAG)) {
+                       debug_warning("no out flag given, skip checking bt a2dp");
+                       return NULL;
+               }
+               if (device_flags & DEVICE_TYPE_INTERNAL_FLAG) {
+                       debug_warning("internal flag given, skip checking bt a2dp");
+                       return NULL;
+               }
+               if (device_flags & DEVICE_STATE_DEACTIVATED_FLAG) {
+                       debug_warning("deactivated flag given, skip checking bt a2dp");
+                       return NULL;
+               }
+       }
+
        if (vconf_get_int(_VCONF_KEY_SOUND_SPEAKER_SELECTION, &speaker_value) == VCONF_ERROR) {
                debug_error("vconf_get_int(%s) failed..", _VCONF_KEY_SOUND_SPEAKER_SELECTION);
                return NULL;
@@ -453,7 +469,7 @@ int mm_sound_proxy_get_current_connected_device_list(int device_flags, GList** d
                g_variant_unref(child);
 
 #ifdef TIZEN_TV
-       device_item = _get_tv_bt_device();
+       device_item = _get_tv_bt_device(device_flags);
        if (device_item) {
                *device_list = g_list_append(*device_list, device_item);
                debug_msg("Added TV bt device id(%d) type(%17s) direction(%d) state(%d) name(%s) vendor-id(%04x) product-id(%04x)",
index 8c8fb1b..531418d 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmm-sound
 Summary:    MMSound Package contains client lib and sound_server binary
-Version:    0.13.4
+Version:    0.13.5
 Release:    0
 Group:      System/Libraries
 License:    Apache-2.0