Apply tizen 3.0 based product patchsets 55/147855/2 accepted/tizen/unified/20170908.061953 submit/tizen/20170906.230917
authorDoHyun Pyun <dh79.pyun@samsung.com>
Wed, 6 Sep 2017 02:20:40 +0000 (11:20 +0900)
committerDoHyun Pyun <dh79.pyun@samsung.com>
Wed, 6 Sep 2017 02:33:11 +0000 (11:33 +0900)
-------------------------------------------------------
commit c396c5b362f3c376c1afb390c23476ae9f482697
Author: Biman Paul <biman.paul@samsung.com>
Date:   Fri Aug 4 19:59:40 2017 +0530

    Use Trusted Profiles instead of Restricted Profiles
-------------------------------------------------------

Change-Id: I5b38f1a17762d17391cda458fa9ae2204dd25b03
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
gobex/gobex.c [changed mode: 0755->0644]
gobex/gobex.h [changed mode: 0755->0644]
obexd/plugins/bluetooth.c [changed mode: 0755->0644]
obexd/src/obex.c [changed mode: 0755->0644]
profiles/audio/a2dp.c [changed mode: 0755->0644]
src/device.c
src/device.h [changed mode: 0755->0644]
src/profile.c

old mode 100755 (executable)
new mode 100644 (file)
index 61ddc66..d0b1e01
@@ -1552,7 +1552,14 @@ void g_obex_unref(GObex *obex)
 }
 
 /* Higher level functions */
-
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+void g_obex_io_shutdown(GObex *obex)
+{
+       GError *err = NULL;
+       if (obex->io != NULL)
+               g_io_channel_shutdown(obex->io, FALSE, &err);
+}
+#endif
 guint g_obex_connect(GObex *obex, GObexResponseFunc func, gpointer user_data,
                                        GError **err, guint8 first_hdr_id, ...)
 {
old mode 100755 (executable)
new mode 100644 (file)
index 5bc9103..827dc3b
@@ -134,5 +134,8 @@ gboolean g_obex_cancel_transfer(guint id, GObexFunc complete_func,
 
 const char *g_obex_strerror(guint8 err_code);
 guint8 g_obex_errno_to_rsp(int err);
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+void g_obex_io_shutdown(GObex *obex);
+#endif
 
 #endif /* __GOBEX_H */
old mode 100755 (executable)
new mode 100644 (file)
index 3ee5432..dd33ee7
@@ -162,6 +162,18 @@ static DBusMessage *profile_new_connection(DBusConnection *conn,
 static DBusMessage *profile_request_disconnection(DBusConnection *conn,
                                                DBusMessage *msg, void *data)
 {
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+       const char *device;
+       const char *path;
+       path = dbus_message_get_path(msg);
+       DBG("Path %s", path);
+
+       dbus_message_get_args(msg, NULL, DBUS_TYPE_OBJECT_PATH, &device,
+                                                       DBUS_TYPE_INVALID);
+       DBG("Device %s", device);
+
+       obex_session_disconnect(path, device);
+#endif
        return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
 }
 
old mode 100755 (executable)
new mode 100644 (file)
index fee2461..b81dfd9
 
 #include <glib.h>
 
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+#include "lib/uuid.h"
+#endif
+
 #include "gobex/gobex.h"
 
 #include "btio/btio.h"
@@ -1026,6 +1030,87 @@ static void disconn_func(GObex *obex, GError *err, gpointer user_data)
        obex_session_destroy(os);
 }
 
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+#define BLUETOOTH_MAC_ADDRESS_LEN      18
+void obex_convert_device_path_to_address(const char *device_path,
+                                               char *device_address)
+{
+       char address[BLUETOOTH_MAC_ADDRESS_LEN] = { 0 };
+       char *dev_addr;
+
+       if (device_path == NULL || device_address == NULL)
+               return;
+
+       dev_addr = strstr(device_path, "dev_");
+       if (dev_addr != NULL) {
+               char *pos = NULL;
+               dev_addr += 4;
+               g_strlcpy(address, dev_addr, sizeof(address));
+
+               while ((pos = strchr(address, '_')) != NULL)
+                       *pos = ':';
+
+               g_strlcpy(device_address, address, BLUETOOTH_MAC_ADDRESS_LEN);
+       }
+}
+
+int obex_object_path_to_uuid(const char *path)
+{
+       char uuid[MAX_LEN_UUID_STR] = { 0 };
+       const char *uuidptr;
+
+       if (path == NULL)
+               return -1;
+       /* /org/bluez/obex/0000112f_0000_1000_8000_00805f9b34fb */
+       uuidptr = path;
+
+       char *pos = NULL;
+       uuidptr += 16;
+       g_strlcpy(uuid, uuidptr, sizeof(uuid));
+
+       while ((pos = strchr(uuid, '_')) != NULL)
+               *pos = '-';
+
+       if (g_strcmp0(uuid, OBEX_PSE_UUID) == 0)
+               return OBEX_PBAP;
+       else if (g_strcmp0(uuid, OBEX_FTP_UUID) == 0)
+               return OBEX_FTP;
+       else if (g_strcmp0(uuid, OBEX_OPP_UUID) == 0)
+               return OBEX_OPP;
+       else if (g_strcmp0(uuid, OBEX_MAS_UUID) == 0)
+               return OBEX_MAS;
+       else if (g_strcmp0(uuid, OBEX_MNS_UUID) == 0)
+               return OBEX_MNS;
+       else
+               return -1;
+}
+
+void obex_session_disconnect(const char *uuid_path, const char *device_path)
+{
+       GSList *l = sessions;
+       char device_address[BLUETOOTH_MAC_ADDRESS_LEN];
+       int service;
+
+       obex_convert_device_path_to_address(device_path, device_address);
+       service = obex_object_path_to_uuid(uuid_path);
+
+       if (service == -1)
+               return;
+
+       while (l) {
+               struct obex_session *os = l->data;
+               if (g_strcmp0(os->dst, device_address) == 0 &&
+                       os->service->service == service) {
+                       /* Need to check for address? */
+                       g_obex_io_shutdown(os->obex);
+                       obex_session_destroy(os);
+                       break;
+               }
+               l = l->next;
+       }
+}
+#endif
+
 int obex_session_start(GIOChannel *io, uint16_t tx_mtu, uint16_t rx_mtu,
                                gboolean stream, struct obex_server *server)
 {
old mode 100755 (executable)
new mode 100644 (file)
index c09ddf9..c308754
@@ -1628,7 +1628,7 @@ static void confirm_cb(GIOChannel *io, gpointer data)
 {
        gboolean restricted = FALSE;
 
-       restricted = device_is_profile_restricted(device, A2DP_SINK_UUID);
+       restricted = device_is_profile_blocked(device, A2DP_SINK_UUID);
        if (restricted) {
                DBG("A2DP is restricted");
                goto drop;
index 30ec1b2..bc5d749 100644 (file)
@@ -210,12 +210,9 @@ struct trusted_profile_t {
        uint32_t        pbap:2;
        uint32_t        map:2;
        uint32_t        sap:2;
+       uint32_t        hfp_hs:2;
+       uint32_t        a2dp:2;
 } __packed;
-
-struct restricted_profile_t {
-       uint32_t        hfp_hs;
-       uint32_t        a2dp;
-};
 #endif
 
 struct btd_device {
@@ -287,7 +284,6 @@ struct btd_device {
        gboolean        trusted;
 #ifdef TIZEN_FEATURE_BLUEZ_MODIFY
        struct trusted_profile_t trusted_profiles;
-       struct restricted_profile_t restricted_profiles;
 #endif
        gboolean        blocked;
        gboolean        auto_connect;
@@ -343,17 +339,11 @@ typedef enum {
 #define PBAP_SHIFT_OFFSET 0
 #define MAP_SHIFT_OFFSET 2
 #define SAP_SHIFT_OFFSET 4
+#define HFP_HS_SHIFT_OFFSET 6
+#define A2DP_SHIFT_OFFSET 8
 
 #define PROFILE_SUPPORTED 0x3 /* This corresponds to binary 0b11*/
 
-typedef enum {
-       CONNECTION_PERMITTED = 0x0, /* 0b00 */
-       CONNECTION_RESTRICTED = 0x1, /* 0b01 */
-} bt_profile_restricted_states;
-
-#define HFP_HS_SHIFT_OFFSET 0
-#define A2DP_SHIFT_OFFSET 2
-
 #endif
 
 #ifdef TIZEN_FEATURE_BLUEZ_MODIFY
@@ -583,18 +573,12 @@ static gboolean store_device_info_cb(gpointer user_data)
        struct trusted_profile_t trust_profile = device->trusted_profiles;
        int trusted_profiles = (trust_profile.pbap << PBAP_SHIFT_OFFSET) |
                        (trust_profile.map << MAP_SHIFT_OFFSET) |
-                       (trust_profile.sap << SAP_SHIFT_OFFSET);
+                       (trust_profile.sap << SAP_SHIFT_OFFSET) |
+                       (trust_profile.hfp_hs << HFP_HS_SHIFT_OFFSET) |
+                       (trust_profile.a2dp << A2DP_SHIFT_OFFSET);
        DBG("Storing TrustedProfiles %d", trusted_profiles);
        g_key_file_set_integer(key_file, "General", "TrustedProfiles",
                                                        trusted_profiles);
-
-       struct restricted_profile_t restrict_profile = device->restricted_profiles;
-       int restricted_profiles = (restrict_profile.hfp_hs << HFP_HS_SHIFT_OFFSET) |
-                       (restrict_profile.a2dp << A2DP_SHIFT_OFFSET);
-       DBG("Storing RestrictedProfiles %d", restricted_profiles);
-       g_key_file_set_integer(key_file, "General", "RestrictedProfiles",
-                                                       restricted_profiles);
-
 #endif
        g_key_file_set_boolean(key_file, "General", "Blocked",
                                                        device->blocked);
@@ -945,18 +929,11 @@ gboolean device_is_profile_trusted(struct btd_device *device,
        } else if (g_strcmp0(uuid, SAP_UUID) == 0) {
                if (device->trusted_profiles.sap == SUPPORTED_TRUSTED)
                        return TRUE;
-       }
-       return FALSE;
-}
-
-gboolean device_is_profile_restricted(struct btd_device *device,
-               const char *uuid)
-{
-       if (g_strcmp0(uuid, HFP_HS_UUID) == 0) {
-               if (device->restricted_profiles.hfp_hs == CONNECTION_RESTRICTED)
+       } else if (g_strcmp0(uuid, HFP_HS_UUID) == 0) {
+               if (device->trusted_profiles.hfp_hs == SUPPORTED_TRUSTED)
                        return TRUE;
        } else if (g_strcmp0(uuid, A2DP_SINK_UUID) == 0) {
-               if (device->restricted_profiles.a2dp == CONNECTION_RESTRICTED)
+               if (device->trusted_profiles.a2dp == SUPPORTED_TRUSTED)
                        return TRUE;
        }
        return FALSE;
@@ -974,6 +951,12 @@ gboolean device_is_profile_blocked(struct btd_device *device,
        } else if (g_strcmp0(uuid, SAP_UUID) == 0) {
                if (device->trusted_profiles.sap == SUPPORTED_BLOCKED)
                        return TRUE;
+       } else if (g_strcmp0(uuid, HFP_HS_UUID) == 0) {
+               if (device->trusted_profiles.hfp_hs == SUPPORTED_BLOCKED)
+                       return TRUE;
+       } else if (g_strcmp0(uuid, A2DP_SINK_UUID) == 0) {
+               if (device->trusted_profiles.a2dp == SUPPORTED_BLOCKED)
+                       return TRUE;
        }
        return FALSE;
 }
@@ -1346,26 +1329,15 @@ static gboolean dev_property_get_trusted_profiles(const GDBusPropertyTable *prop
        uint32_t pbap = device->trusted_profiles.pbap;
        uint32_t map = device->trusted_profiles.map;
        uint32_t sap = device->trusted_profiles.sap;
+       uint32_t hfp_hs = device->trusted_profiles.hfp_hs;
+       uint32_t a2dp = device->trusted_profiles.a2dp;
 
        unsigned int val = (pbap << PBAP_SHIFT_OFFSET) |
                        (map << MAP_SHIFT_OFFSET) |
-                       (sap << SAP_SHIFT_OFFSET);
-
-       dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT32, &val);
-
-       return TRUE;
-}
-
-static gboolean dev_property_get_restricted_profiles(const GDBusPropertyTable *property,
-                                       DBusMessageIter *iter, void *data)
-{
-       struct btd_device *device = data;
-       uint32_t hfp_hs = device->restricted_profiles.hfp_hs;
-       uint32_t a2dp = device->restricted_profiles.a2dp;
-
-       unsigned int val = (hfp_hs << HFP_HS_SHIFT_OFFSET) |
+                       (sap << SAP_SHIFT_OFFSET) |
+                       (hfp_hs << HFP_HS_SHIFT_OFFSET) |
                        (a2dp << A2DP_SHIFT_OFFSET);
-
+       DBG("TRUST :%x", val);
        dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT32, &val);
 
        return TRUE;
@@ -3861,6 +3833,8 @@ static DBusMessage *set_trusted_profile(DBusConnection *conn,
        uint32_t pbap = dev->trusted_profiles.pbap;
        uint32_t map = dev->trusted_profiles.map;
        uint32_t sap = dev->trusted_profiles.sap;
+       uint32_t hfp_hs = dev->trusted_profiles.hfp_hs;
+       uint32_t a2dp = dev->trusted_profiles.a2dp;
 
        if (!dbus_message_get_args(msg, NULL,
                                DBUS_TYPE_STRING, &pattern,
@@ -3873,6 +3847,8 @@ static DBusMessage *set_trusted_profile(DBusConnection *conn,
        DBG("UUID : %s", uuid);
        DBG("profile Trusted : %d %d %d", dev->trusted_profiles.pbap,
                        dev->trusted_profiles.map, dev->trusted_profiles.sap);
+       DBG("profile Restricted : %d %d", dev->trusted_profiles.hfp_hs,
+                       dev->trusted_profiles.a2dp);
        if (g_strcmp0(uuid, OBEX_PBAP_UUID) == 0) {
                if (profile_trusted)
                        pbap = SUPPORTED_TRUSTED;
@@ -3888,50 +3864,21 @@ static DBusMessage *set_trusted_profile(DBusConnection *conn,
                        sap = SUPPORTED_TRUSTED;
                else
                        sap = SUPPORTED_BLOCKED;
-       } else {
-               return btd_error_invalid_args(msg);
-       }
-
-       btd_device_set_trusted_profiles(dev, pbap, map, sap);
-       return dbus_message_new_method_return(msg);
-}
-
-static DBusMessage *set_restricted_profile(DBusConnection *conn,
-                                               DBusMessage *msg, void *data)
-{
-       struct btd_device *dev = data;
-       dbus_bool_t profile_restricted;
-       const char *pattern;
-       char *uuid;
-       uint32_t hfp_hs = dev->restricted_profiles.hfp_hs;
-       uint32_t a2dp = dev->restricted_profiles.a2dp;
-
-       if (!dbus_message_get_args(msg, NULL,
-                               DBUS_TYPE_STRING, &pattern,
-                               DBUS_TYPE_BOOLEAN, &profile_restricted,
-                               DBUS_TYPE_INVALID))
-               return btd_error_invalid_args(msg);
-
-       DBG("Pattern : %s", pattern);
-       uuid = bt_name2string(pattern);
-       DBG("UUID : %s", uuid);
-       DBG("profile Restricted : %d %d", dev->restricted_profiles.hfp_hs,
-                       dev->restricted_profiles.a2dp);
-       if (g_strcmp0(uuid, HFP_HS_UUID) == 0) {
-               if (profile_restricted)
-                       hfp_hs = CONNECTION_RESTRICTED;
+       } else  if (g_strcmp0(uuid, HFP_HS_UUID) == 0) {
+               if (profile_trusted)
+                       hfp_hs = SUPPORTED_TRUSTED;
                else
-                       hfp_hs = CONNECTION_PERMITTED;
+                       hfp_hs = SUPPORTED_BLOCKED;
        } else if (g_strcmp0(uuid, A2DP_SINK_UUID) == 0) {
-               if (profile_restricted)
-                       a2dp = CONNECTION_RESTRICTED;
+               if (profile_trusted)
+                       a2dp = SUPPORTED_TRUSTED;
                else
-                       a2dp = CONNECTION_PERMITTED;
+                       a2dp = SUPPORTED_BLOCKED;
        } else {
                return btd_error_invalid_args(msg);
        }
 
-       btd_device_set_restricted_profiles(dev, hfp_hs, a2dp);
+       btd_device_set_trusted_profiles(dev, pbap, map, sap, hfp_hs, a2dp);
        return dbus_message_new_method_return(msg);
 }
 
@@ -4215,9 +4162,6 @@ static const GDBusMethodTable device_methods[] = {
        { GDBUS_METHOD("SetTrustedProfile",
                        GDBUS_ARGS({ "uuid", "s"}, { "trusted", "b"}), NULL,
                        set_trusted_profile) },
-       { GDBUS_METHOD("SetRestrictedProfile",
-                       GDBUS_ARGS({ "uuid", "s"}, { "restricted", "b"}), NULL,
-                       set_restricted_profile) },
 #endif
        { }
 };
@@ -4259,7 +4203,6 @@ static const GDBusPropertyTable device_properties[] = {
        { "IpspBtInterfaceInfo", "s", dev_property_get_ipsp_conn_bt_iface_name },
        { "AttMtu", "q", dev_property_get_att_mtu },
        { "TrustedProfiles", "u", dev_property_get_trusted_profiles},
-       { "RestrictedProfiles", "u", dev_property_get_restricted_profiles},
 #endif
        { "ManufacturerData", "a{qv}", dev_property_get_manufacturer_data,
                                NULL, dev_property_manufacturer_data_exist },
@@ -4705,13 +4648,10 @@ next:
                        (PROFILE_SUPPORTED << MAP_SHIFT_OFFSET)) >> MAP_SHIFT_OFFSET);
        device->trusted_profiles.sap = ((trusted_profiles &
                        (PROFILE_SUPPORTED << SAP_SHIFT_OFFSET)) >> SAP_SHIFT_OFFSET);
-
-       /* Load Restricted Profiles*/
-       int restricted_profiles = g_key_file_get_integer(key_file, "General",
-                                                       "RestrictedProfiles", NULL);
-       DBG("Loading RestrictedProfiles %d", restricted_profiles);
-       device->restricted_profiles.hfp_hs = (restricted_profiles >> HFP_HS_SHIFT_OFFSET) & 0x01;
-       device->restricted_profiles.a2dp = (restricted_profiles >> A2DP_SHIFT_OFFSET) & 0x01;
+       device->trusted_profiles.hfp_hs = ((trusted_profiles &
+                       (PROFILE_SUPPORTED << HFP_HS_SHIFT_OFFSET)) >> HFP_HS_SHIFT_OFFSET);
+       device->trusted_profiles.a2dp = ((trusted_profiles &
+                       (PROFILE_SUPPORTED << A2DP_SHIFT_OFFSET)) >> A2DP_SHIFT_OFFSET);
 
 #endif
 
@@ -5943,6 +5883,8 @@ void device_unpair(struct btd_device *device, gboolean remove_stored)
        device->trusted_profiles.pbap = SHOW_AUTHORIZATION;
        device->trusted_profiles.map = SHOW_AUTHORIZATION;
        device->trusted_profiles.sap = SHOW_AUTHORIZATION;
+       device->trusted_profiles.hfp_hs = SUPPORTED_TRUSTED;
+       device->trusted_profiles.a2dp = SUPPORTED_TRUSTED;
        if (device->alias != NULL) {
                /* Remove alias name because
                 * In UG if we rename and then unpair device and
@@ -7607,46 +7549,68 @@ void btd_device_set_trusted(struct btd_device *device, gboolean trusted)
 }
 
 #ifdef TIZEN_FEATURE_BLUEZ_MODIFY
-void btd_device_set_trusted_profiles(struct btd_device *device,
-               uint32_t pbap, uint32_t map, uint32_t sap)
+void device_disconnect_blocked(struct btd_device *device,
+                                                       const char *uuid)
 {
-       if (!device)
-               return;
-       DBG("TrustedProfiles Parameters: [PBAP %d] [MAP %d] [SAP %d]", pbap, map, sap);
+       struct btd_service *service;
+       GSList *l;
 
-       if (device->trusted_profiles.pbap == pbap &&
-                       device->trusted_profiles.map == map &&
-                       device->trusted_profiles.sap == sap)
+       if (!device || !uuid)
                return;
 
-       device->trusted_profiles.pbap = pbap;
-       device->trusted_profiles.map = map;
-       device->trusted_profiles.sap = sap;
-
-       store_device_info(device);
+       l = find_service_with_uuid(device->services, uuid);
+       if (l == NULL)
+               return;
 
-       g_dbus_emit_property_changed(dbus_conn, device->path,
-                                       DEVICE_INTERFACE, "TrustedProfiles");
+       service = l->data;
+       if (btd_service_get_state(service) ==
+                       BTD_SERVICE_STATE_CONNECTED) {
+               int err;
+               err = btd_service_disconnect(service);
+               if (err)
+                       error("error: %s", strerror(-err));
+       }
 }
 
-void btd_device_set_restricted_profiles(struct btd_device *device,
+void btd_device_set_trusted_profiles(struct btd_device *device,
+               uint32_t pbap, uint32_t map, uint32_t sap,
                uint32_t hfp_hs, uint32_t a2dp)
 {
+       char *uuid = NULL;
        if (!device)
                return;
-       DBG("RestrictedProfiles Parameters: [HFP %d] [A2DP %d]", hfp_hs, a2dp);
+       DBG("TrustedProfiles Parameters: [PBAP %d] [MAP %d] [SAP %d] [HFP %d] [A2DP %d]",
+                       pbap, map, sap, hfp_hs, a2dp);
 
-       if (device->restricted_profiles.hfp_hs == hfp_hs &&
-                       device->restricted_profiles.a2dp == a2dp)
-               return;
-
-       device->restricted_profiles.hfp_hs = hfp_hs;
-       device->restricted_profiles.a2dp = a2dp;
+       if (device->trusted_profiles.pbap == pbap &&
+                       device->trusted_profiles.map == map &&
+                       device->trusted_profiles.sap == sap &&
+                       device->trusted_profiles.hfp_hs == hfp_hs &&
+                       device->trusted_profiles.a2dp == a2dp)
+               return;
+
+       /* Disconnect OBEX based profiles if connected */
+       if (device->trusted_profiles.pbap != pbap) {
+               device->trusted_profiles.pbap = pbap;
+               if (pbap == SUPPORTED_BLOCKED)
+                       device_disconnect_blocked(device, OBEX_PSE_UUID);
+       } else if (device->trusted_profiles.map != map) {
+               device->trusted_profiles.map = map;
+               if (map == SUPPORTED_BLOCKED)
+                       device_disconnect_blocked(device, OBEX_MAP_UUID);
+       } else if (device->trusted_profiles.sap != sap) {
+               device->trusted_profiles.sap = sap;
+               if (sap == SUPPORTED_BLOCKED)
+                       device_disconnect_blocked(device, SAP_UUID);
+       } else if (device->trusted_profiles.hfp_hs != hfp_hs) {
+               device->trusted_profiles.hfp_hs = hfp_hs;
+       } else if (device->trusted_profiles.a2dp != a2dp) {
+               device->trusted_profiles.a2dp = a2dp;
+       }
 
        store_device_info(device);
-
        g_dbus_emit_property_changed(dbus_conn, device->path,
-                                       DEVICE_INTERFACE, "RestrictedProfiles");
+                                       DEVICE_INTERFACE, "TrustedProfiles");
 }
 #endif
 
old mode 100755 (executable)
new mode 100644 (file)
index ff39856..55aea7c
@@ -111,7 +111,8 @@ void device_set_irk_value(struct btd_device *device, const uint8_t *val);
 void device_set_conn_update_state(struct btd_device *device, bool state);
 bool device_get_conn_update_state(struct btd_device *device);
 void btd_device_set_trusted_profiles(struct btd_device *device,
-               uint32_t pbap, uint32_t map, uint32_t sap);
+               uint32_t pbap, uint32_t map, uint32_t sap,
+               uint32_t hfp_hs, uint32_t a2dp);
 #endif
 gboolean device_is_temporary(struct btd_device *device);
 bool device_is_paired(struct btd_device *device, uint8_t bdaddr_type);
@@ -219,8 +220,6 @@ gboolean device_is_profile_trusted(struct btd_device *device,
                const char *uuid);
 gboolean device_is_profile_blocked(struct btd_device *device,
                const char *uuid);
-gboolean device_is_profile_restricted(struct btd_device *device,
-               const char *uuid);
 void btd_device_disconnect(struct btd_device *dev);
 void btd_device_set_legacy_pairing(struct btd_device *dev, bool legacy_pairing);
 void btd_device_set_svc_changed_indication(struct btd_device *dev, bool value);
index 0ee3ce7..3ecfa10 100644 (file)
                        <uint8 value=\"0x00\"/>                         \
                </attribute>                                            \
                <attribute id=\"0x0316\">                               \
-                       <uint8 value=\"0x0F\"/>                         \
+                       <uint8 value=\""SUPPORTED_MESSAGE_TYPES"\"/>    \
                </attribute>                                            \
                <attribute id=\"0x0317\">                               \
                        <uint32 value=\"0x0000007f\"/>                  \
                <sequence>      \
                        <sequence>      \
                                <uint8 value=\"0x22\" />                \
-                               <text encoding=\"hex\" value=\"05010902a10185010901a100050919012903150025017501950381027505950181010501093009311581257f750895028106a10285010938950175081581257f8106c0c0c005010906a1018502a100050719e029e71500250175019508810295087508150025650507190029658100c0c005010905A10185030901A1000930093109330934150026FF00350046FF0075089504810209397504950115002507463B016614008142750195048103050919012910750195108102C0C0\" />      \
+                               <text encoding=\"hex\" value=\"05010902A10185010901A100050919012903150025017501950381027505950181010501093009311581257F750895028106A10285010938950175081581257F8106C0C0C005010906A1018502A100050719E029E71500250175019508810295087508150025650507190029658100C0C005010905A10185030901A1000930093109330934150026FF00350046FF0075089504810209397504950115002507463B016614008142750195048103050919012910750195108102C0C005010906A1018504A100050C150025017501950D09300931093209B009B109B309B409B509B609B709E209E909EA8102750295018103750195050508190129059102750395019103C0C0\" />  \
                        </sequence>     \
                </sequence>     \
        </attribute>    \
@@ -1471,20 +1471,19 @@ static void ext_confirm(GIOChannel *io, gpointer user_data)
        DBG("incoming connect from %s", addr);
 
 #ifdef TIZEN_FEATURE_BLUEZ_MODIFY
-{
-       struct btd_device *device;
-       gboolean restricted = FALSE;
-
-       device = btd_adapter_find_device(adapter_find(&src), &dst,
-                                                               BDADDR_BREDR);
-       if (device) {
-               restricted = device_is_profile_restricted(device, HFP_HS_UUID);
-               if (restricted) {
-                       DBG("HFP_HS is restricted");
-                       return;
+       if (g_strcmp0(uuid, HFP_AG_UUID) == 0) {
+               struct btd_device *device;
+               gboolean restricted = FALSE;
+               device = btd_adapter_find_device(adapter_find(&src), &dst,
+                                                                       BDADDR_BREDR);
+               if (device) {
+                       restricted = device_is_profile_blocked(device, HFP_HS_UUID);
+                       if (restricted) {
+                               DBG("HFP_HS is restricted");
+                               return;
+                       }
                }
        }
-}
 #endif
 
        conn = create_conn(server, io, &src, &dst);