Fix wrong av disconnected event sending issue 06/228406/1
authorWootak Jung <wootak.jung@samsung.com>
Mon, 16 Mar 2020 03:39:31 +0000 (12:39 +0900)
committerWootak Jung <wootak.jung@samsung.com>
Mon, 23 Mar 2020 01:44:31 +0000 (10:44 +0900)
Change-Id: I6606d9814262c2f98ee5accf08b3cd84e17aeb2c

bt-service-adaptation/services/audio/a2dp_src/bt-service-a2dp-src.c

index caf7515..51d15b1 100644 (file)
@@ -185,10 +185,6 @@ static void __bt_handle_av_disconnected_state(bluetooth_device_address_t *addres
        /* Set VCONF status for A2DP Disconnection */
        _bt_set_device_values(FALSE, VCONFKEY_BT_DEVICE_A2DP_HEADSET_CONNECTED);
 
-       /* Send A2DP(SRC Role) disconnected event to Application */
-       param = g_variant_new("(is)", result, addr);
-       _bt_send_event(BT_HEADSET_EVENT, BLUETOOTH_EVENT_AV_DISCONNECTED, param);
-
        /* Remove data from the connected list */
        _bt_remove_headset_from_list(BT_AUDIO_A2DP, addr);
 
@@ -211,6 +207,10 @@ static void __bt_handle_av_disconnected_state(bluetooth_device_address_t *addres
                        if (req_info == NULL) {
                                BT_INFO("Audio Connect All request is also Not found..");
 
+                               /* Send A2DP(SRC Role) disconnected event to Application */
+                               param = g_variant_new("(is)", result, addr);
+                               _bt_send_event(BT_HEADSET_EVENT, BLUETOOTH_EVENT_AV_DISCONNECTED, param);
+
                                req_info = _bt_get_request_info_data(BT_AUDIO_DISCONNECT, addr);
                                if (req_info == NULL) {
                                        BT_INFO("Audio DisConnect All request is also Not found..");
@@ -253,6 +253,9 @@ static void __bt_handle_av_disconnected_state(bluetooth_device_address_t *addres
                }
        } else {
                BT_ERR("AV Disconnect request found for [%s], means disconnect request is successful", addr); /* DBUS return needed */
+               /* Send A2DP(SRC Role) disconnected event to Application */
+               param = g_variant_new("(is)", result, addr);
+               _bt_send_event(BT_HEADSET_EVENT, BLUETOOTH_EVENT_AV_DISCONNECTED, param);
                goto check_wait_device;
        }
 check_wait_device: