Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b059caa9 authored by Mehmet Murat Sevim's avatar Mehmet Murat Sevim Committed by William Escande
Browse files

Omit SDP records for GATT services if GATT over BR/EDR is disabled.

Adding these records would be misleading since the services are not
available over BR/EDR. In particular, Generic Attribute Profile
record is an indicator that GATT over BR/EDR is supported.

Renaming the property for homogeneity

Cherry-picked from wear-os

Bug: 263323082
Bug: 234331631
Bug: 248147531
Test: manual - verified iOS no longer tries to use GATT over BR/EDR
Change-Id: I3f608352b3ae78769ac8d087f19ed7494109d214
(cherry picked from commit afb96e955b55b9f33fd08cc05235ff15573e428c)
parent 088afbc3
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -304,7 +304,7 @@ tGATT_STATUS GATTS_AddService(tGATT_IF gatt_if, btgatt_db_element_t* service,
  elem.type = list.asgn_range.is_primary ? GATT_UUID_PRI_SERVICE
  elem.type = list.asgn_range.is_primary ? GATT_UUID_PRI_SERVICE
                                         : GATT_UUID_SEC_SERVICE;
                                         : GATT_UUID_SEC_SERVICE;


  if (elem.type == GATT_UUID_PRI_SERVICE) {
  if (elem.type == GATT_UUID_PRI_SERVICE && gatt_cb.over_br_enabled) {
    Uuid* p_uuid = gatts_get_service_uuid(elem.p_db);
    Uuid* p_uuid = gatts_get_service_uuid(elem.p_db);
    if (*p_uuid != Uuid::From16Bit(UUID_SERVCLASS_GMCS_SERVER) &&
    if (*p_uuid != Uuid::From16Bit(UUID_SERVCLASS_GMCS_SERVER) &&
        *p_uuid != Uuid::From16Bit(UUID_SERVCLASS_GTBS_SERVER)) {
        *p_uuid != Uuid::From16Bit(UUID_SERVCLASS_GTBS_SERVER)) {
+1 −0
Original line number Original line Diff line number Diff line
@@ -450,6 +450,7 @@ typedef struct {
  tGATT_APPL_INFO cb_info;
  tGATT_APPL_INFO cb_info;


  tGATT_HDL_CFG hdl_cfg;
  tGATT_HDL_CFG hdl_cfg;
  bool over_br_enabled;
} tGATT_CB;
} tGATT_CB;


#define GATT_SIZE_OF_SRV_CHG_HNDL_RANGE 4
#define GATT_SIZE_OF_SRV_CHG_HNDL_RANGE 4
+3 −3
Original line number Original line Diff line number Diff line
@@ -125,10 +125,10 @@ void gatt_init(void) {


  L2CA_RegisterFixedChannel(L2CAP_ATT_CID, &fixed_reg);
  L2CA_RegisterFixedChannel(L2CAP_ATT_CID, &fixed_reg);


  bool gatt_over_br_is_disabled =
  gatt_cb.over_br_enabled =
      osi_property_get_bool("bluetooth.gatt_over_bredr.disabled", false);
      osi_property_get_bool("bluetooth.gatt.over_bredr.enabled", true);
  /* Now, register with L2CAP for ATT PSM over BR/EDR */
  /* Now, register with L2CAP for ATT PSM over BR/EDR */
  if (!gatt_over_br_is_disabled &&
  if (gatt_cb.over_br_enabled &&
      !L2CA_Register2(BT_PSM_ATT, dyn_info, false /* enable_snoop */, nullptr,
      !L2CA_Register2(BT_PSM_ATT, dyn_info, false /* enable_snoop */, nullptr,
                      GATT_MAX_MTU_SIZE, 0, BTM_SEC_NONE)) {
                      GATT_MAX_MTU_SIZE, 0, BTM_SEC_NONE)) {
    LOG(ERROR) << "ATT Dynamic Registration failed";
    LOG(ERROR) << "ATT Dynamic Registration failed";