shared/gatt-client: Do not read device name gatt char in DA 28/316828/1 accepted/tizen_unified_x_asan accepted/tizen/unified/20241224.130056 accepted/tizen/unified/x/20241224.221629 accepted/tizen/unified/x/asan/20250113.002240
authorSohyeon Choi <shss.choi@samsung.com>
Fri, 13 Dec 2024 06:19:53 +0000 (15:19 +0900)
committerWootak Jung <wootak.jung@samsung.com>
Wed, 18 Dec 2024 08:43:56 +0000 (17:43 +0900)
if remote adv is non-discoverable and not bonded,
request for reading GATT characterisitic device name (2A00) makes confirm popup for security.
to prevent unnecessary popup, Do not read device name in DA products.

Change-Id: Id3067e8e1ec83ec0c5c985022b9164822fd6780c
Signed-off-by: Wootak Jung <wootak.jung@samsung.com>
Makefile.tools
profiles/gap/gas.c
src/shared/gatt-client.c

index 0d694d173d97ddb45156bfbb8db7fb2d4424ce70..41fcadb64e1bcc6ab52cbeff1a6d5c83c3d355cc 100755 (executable)
@@ -113,7 +113,7 @@ peripheral_btsensor_SOURCES = peripheral/main.c \
                                peripheral/log.h peripheral/log.c \
                                peripheral/gap.h peripheral/gap.c \
                                peripheral/gatt.h peripheral/gatt.c
-peripheral_btsensor_LDADD = src/libshared-mainloop.la \
+peripheral_btsensor_LDADD = src/libshared-mainloop.la @LIBXML_LIBS@ \
                                lib/libbluetooth-internal.la
 
 tools_3dsp_SOURCES = tools/3dsp.c monitor/bt.h
@@ -389,7 +389,7 @@ noinst_PROGRAMS += tools/bdaddr tools/avinfo \
                        tools/test-runner tools/check-selftest
 
 tools_bdaddr_SOURCES = tools/bdaddr.c src/oui.h src/oui.c
-tools_bdaddr_LDADD = lib/libbluetooth-internal.la @UDEV_LIBS@
+tools_bdaddr_LDADD = lib/libbluetooth-internal.la @UDEV_LIBS@ @LIBXML_LIBS@
 
 tools_avinfo_LDADD = lib/libbluetooth-internal.la
 
@@ -451,7 +451,7 @@ tools_ibeacon_SOURCES = tools/ibeacon.c monitor/bt.h
 tools_ibeacon_LDADD = src/libshared-mainloop.la
 
 tools_btgatt_client_SOURCES = tools/btgatt-client.c src/uuid-helper.c
-tools_btgatt_client_LDADD = src/libshared-mainloop.la \
+tools_btgatt_client_LDADD = src/libshared-mainloop.la @LIBXML_LIBS@ \
                                                lib/libbluetooth-internal.la
 
 tools_btgatt_server_SOURCES = tools/btgatt-server.c src/uuid-helper.c
index 9c4e4a41b5f4ddb1a9d764a9ef5b25855e06697a..0e44b9743ebb0610f1c71c7e9a2fc23f22bc49a5 100755 (executable)
 #include "src/service.h"
 #include "src/log.h"
 
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+#include "../../profile.h"
+#endif
+
 #define GAP_UUID16 0x1800
 
 /* Generic Attribute/Access Service */
@@ -109,6 +113,13 @@ static void read_device_name_cb(bool success, uint8_t att_ecode,
 
 static void handle_device_name(struct gas *gas, uint16_t value_handle)
 {
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+       if (TIZEN_FEATURE_BLUEZ_DA) {
+               DBG("Do not try to read device name in DA");
+               return;
+       }
+#endif
+
        if (!bt_gatt_client_read_long_value(gas->client, value_handle, 0,
                                                read_device_name_cb, gas, NULL))
                DBG("Failed to send request to read device name");
index 49e94335bbb284f2460657399129436cc2785fb5..10cb573eff508f705e1d7e219d4e3750f7f514f9 100644 (file)
@@ -1162,10 +1162,15 @@ static void discover_chrcs_cb(bool success, uint8_t att_ecode,
 
 #ifdef TIZEN_FEATURE_BLUEZ_MODIFY
                if (!strcmp(uuid_str, "00002a00-0000-1000-8000-00805f9b34fb")) {
-                       if (!bt_gatt_client_read_value(client, chrc_data->value_handle,
-                                               read_name_cb, client, NULL)) {
+                       if (TIZEN_FEATURE_BLUEZ_DA) {
                                util_debug(client->debug_callback, client->debug_data,
-                                               "Failed to read value");
+                                               "device name char found but do not read in DA");
+                       } else {
+                               if (!bt_gatt_client_read_value(client, chrc_data->value_handle,
+                                               read_name_cb, client, NULL)) {
+                                       util_debug(client->debug_callback, client->debug_data,
+                                                       "Failed to read value");
+                               }
                        }
                }
 #endif