Disable AG connect in IOT profile 04/253704/1 accepted/tizen/unified/20210218.042229 submit/tizen/20210217.223135
authorDoHyun Pyun <dh79.pyun@samsung.com>
Wed, 17 Feb 2021 01:01:02 +0000 (10:01 +0900)
committerDoHyun Pyun <dh79.pyun@samsung.com>
Wed, 17 Feb 2021 01:01:02 +0000 (10:01 +0900)
Change-Id: I88ece81fc5935e900b42410436d0e231567ef355
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
standard/bt-main-view.c
standard/bt-profile-view.c

index 023e6fc..a89d761 100644 (file)
@@ -3667,45 +3667,46 @@ void _bt_main_connect_device(bt_ug_data *ugd, bt_dev_t *dev)
                        BT_ERR("Fail to connect BT_AUDIO_PROFILE_TYPE_A2DP_SINK");
                }
 #else
-#ifndef TELEPHONY_DISABLED
-       if ((dev->service_list & BT_SC_HFP_SERVICE_MASK) ||
-           (dev->service_list & BT_SC_HSP_SERVICE_MASK)) {
-               /* Connect the  Headset */
-               if (dev->service_list & BT_SC_A2DP_SERVICE_MASK)
-                       headset_type = BT_AUDIO_PROFILE_TYPE_ALL;
-               else
-                       headset_type = BT_AUDIO_PROFILE_TYPE_HSP_HFP;
-
-               BT_INFO("Connection type = %d", headset_type);
-               if (headset_type == BT_AUDIO_PROFILE_TYPE_ALL) {
-                       /* restriction check */
-                       bt_device_get_profile_restricted(dev->addr_str, BT_RESTRICTED_PROFILE_HFP_HS, &hfp_restricted);
-                       bt_device_get_profile_restricted(dev->addr_str, BT_RESTRICTED_PROFILE_A2DP, &a2dp_restricted);
-                       BT_INFO("Restricted Connection, HFP:%d, A2DP:%d", hfp_restricted, a2dp_restricted);
-
-                       if ((hfp_restricted == 0x1) && (a2dp_restricted == 0x1)) {
-                               ret = bt_device_set_profile_restricted(dev->addr_str, BT_RESTRICTED_PROFILE_HFP_HS, 0x0);
-                               if (ret != BT_ERROR_NONE)
-                                       BT_ERR("Fail to set profile restriction");
-
-                               ret = bt_device_set_profile_restricted(dev->addr_str, BT_RESTRICTED_PROFILE_A2DP, 0x0);
-                               if (ret != BT_ERROR_NONE)
-                                       BT_ERR("Fail to set profile restriction");
+
+       if (!TIZEN_COMMON) {
+               if ((dev->service_list & BT_SC_HFP_SERVICE_MASK) ||
+                   (dev->service_list & BT_SC_HSP_SERVICE_MASK)) {
+                       /* Connect the  Headset */
+                       if (dev->service_list & BT_SC_A2DP_SERVICE_MASK)
+                               headset_type = BT_AUDIO_PROFILE_TYPE_ALL;
+                       else
+                               headset_type = BT_AUDIO_PROFILE_TYPE_HSP_HFP;
+
+                       BT_INFO("Connection type = %d", headset_type);
+                       if (headset_type == BT_AUDIO_PROFILE_TYPE_ALL) {
+                               /* restriction check */
+                               bt_device_get_profile_restricted(dev->addr_str, BT_RESTRICTED_PROFILE_HFP_HS, &hfp_restricted);
+                               bt_device_get_profile_restricted(dev->addr_str, BT_RESTRICTED_PROFILE_A2DP, &a2dp_restricted);
+                               BT_INFO("Restricted Connection, HFP:%d, A2DP:%d", hfp_restricted, a2dp_restricted);
+
+                               if ((hfp_restricted == 0x1) && (a2dp_restricted == 0x1)) {
+                                       ret = bt_device_set_profile_restricted(dev->addr_str, BT_RESTRICTED_PROFILE_HFP_HS, 0x0);
+                                       if (ret != BT_ERROR_NONE)
+                                               BT_ERR("Fail to set profile restriction");
+
+                                       ret = bt_device_set_profile_restricted(dev->addr_str, BT_RESTRICTED_PROFILE_A2DP, 0x0);
+                                       if (ret != BT_ERROR_NONE)
+                                               BT_ERR("Fail to set profile restriction");
+                               }
                        }
-               }
 
-               if (bt_audio_connect(dev->addr_str,
-                                    headset_type) == BT_ERROR_NONE) {
-                       ugd->connect_req = TRUE;
-                       dev->status = BT_CONNECTING;
-               } else {
-                       BT_ERR("Fail to connect Headset device");
+                       if (bt_audio_connect(dev->addr_str,
+                                            headset_type) == BT_ERROR_NONE) {
+                               ugd->connect_req = TRUE;
+                               dev->status = BT_CONNECTING;
+                       } else {
+                               BT_ERR("Fail to connect Headset device");
+                       }
                }
-       } else if (dev->service_list & BT_SC_A2DP_SERVICE_MASK) {
-#else
+       }
+
        if (dev->service_list & BT_SC_A2DP_SERVICE_MASK) {
 #endif
-#endif
                if (bt_audio_connect(dev->addr_str,
                                     BT_AUDIO_PROFILE_TYPE_A2DP) ==
                    BT_ERROR_NONE) {
@@ -3770,30 +3771,32 @@ void _bt_main_disconnect_device(bt_ug_data *ugd, bt_dev_t *dev)
 {
        FN_START;
 
+       int audio_conn_type = BT_STEREO_HEADSET_CONNECTED;
+       bool is_headset_connected = false;
+
        ret_if(ugd == NULL);
        ret_if(dev == NULL);
 
-#ifndef TELEPHONY_DISABLED
-       if (_bt_util_is_profile_connected(BT_HEADSET_CONNECTED,
-                                    dev->bd_addr) == TRUE) {
-               BT_INFO("Disconnecting AG service");
-               if (bt_audio_disconnect(dev->addr_str,
-                                       BT_AUDIO_PROFILE_TYPE_ALL) ==
-                   BT_ERROR_NONE) {
-                       ugd->disconn_req = true;
-                       dev->status = BT_DISCONNECTING;
-               } else {
-                       BT_ERR("Fail to connect Headset device");
+       if (!TIZEN_COMMON) {
+               if (_bt_util_is_profile_connected(BT_HEADSET_CONNECTED,
+                            dev->bd_addr) == TRUE) {
+                       audio_conn_type = BT_AUDIO_PROFILE_TYPE_ALL;
+                       is_headset_connected = true;
                }
-       } else if (_bt_util_is_profile_connected(BT_STEREO_HEADSET_CONNECTED,
-                dev->bd_addr) == TRUE) {
-#else
-       if (_bt_util_is_profile_connected(BT_STEREO_HEADSET_CONNECTED,
-                dev->bd_addr) == TRUE) {
-#endif
-               BT_INFO("Disconnecting AV service");
+       }
+
+       if (is_headset_connected == false) {
+               if (_bt_util_is_profile_connected(BT_STEREO_HEADSET_CONNECTED,
+                            dev->bd_addr) == TRUE) {
+                       audio_conn_type = BT_STEREO_HEADSET_CONNECTED;
+                       is_headset_connected = true;
+               }
+       }
+
+       if (is_headset_connected == true) {
+               BT_INFO("Disconnecting Headset");
                if (bt_audio_disconnect(dev->addr_str,
-                                       BT_AUDIO_PROFILE_TYPE_A2DP) ==
+                                       audio_conn_type) ==
                    BT_ERROR_NONE) {
                        ugd->disconn_req = true;
                        dev->status = BT_DISCONNECTING;
index edff765..d902e7d 100644 (file)
@@ -1740,16 +1740,17 @@ static Evas_Object *__bt_profile_draw_genlist(bt_ug_data *ugd, bt_dev_t *dev_inf
        vd->title_itc->func.state_get = NULL;
        vd->title_itc->func.del = NULL;
 
-#ifndef TELEPHONY_DISABLED
-       vd->call_itc = elm_genlist_item_class_new();
-       retv_if(vd->call_itc == NULL, NULL);
-
-       vd->call_itc->item_style = BT_GENLIST_1LINE_TEXT_ICON_STYLE;
-       vd->call_itc->func.text_get = __bt_proflie_call_option_label_get;
-       vd->call_itc->func.content_get = __bt_profile_call_option_icon_get;
-       vd->call_itc->func.state_get = NULL;
-       vd->call_itc->func.del = NULL;
-#endif
+       if (!TIZEN_COMMON) {
+               vd->call_itc = elm_genlist_item_class_new();
+               retv_if(vd->call_itc == NULL, NULL);
+
+               vd->call_itc->item_style = BT_GENLIST_1LINE_TEXT_ICON_STYLE;
+               vd->call_itc->func.text_get = __bt_proflie_call_option_label_get;
+               vd->call_itc->func.content_get = __bt_profile_call_option_icon_get;
+               vd->call_itc->func.state_get = NULL;
+               vd->call_itc->func.del = NULL;
+       }
+
        vd->media_itc = elm_genlist_item_class_new();
        retv_if(vd->media_itc == NULL, NULL);
 
@@ -1788,18 +1789,19 @@ static Evas_Object *__bt_profile_draw_genlist(bt_ug_data *ugd, bt_dev_t *dev_inf
 
        vd->title_item = git;
 
-#ifndef TELEPHONY_DISABLED
-       if (dev_info->service_list & BT_SC_HFP_SERVICE_MASK ||
-            dev_info->service_list & BT_SC_HSP_SERVICE_MASK) {
-               /* Call audio */
-               git = elm_genlist_item_append(genlist, vd->call_itc,
-                                       dev_info, NULL,
-                                       ELM_GENLIST_ITEM_NONE,
-                                       __bt_profile_call_option_item_sel,
-                                       dev_info);
-               vd->call_item = git;
+       if (!TIZEN_COMMON) {
+               if (dev_info->service_list & BT_SC_HFP_SERVICE_MASK ||
+                    dev_info->service_list & BT_SC_HSP_SERVICE_MASK) {
+                       /* Call audio */
+                       git = elm_genlist_item_append(genlist, vd->call_itc,
+                                               dev_info, NULL,
+                                               ELM_GENLIST_ITEM_NONE,
+                                               __bt_profile_call_option_item_sel,
+                                               dev_info);
+                       vd->call_item = git;
+               }
        }
-#endif
+
 #ifdef TIZEN_BT_A2DP_SINK_ENABLE
        if (dev_info->service_list & BT_SC_A2DP_SOURCE_SERVICE_MASK) {
 #else