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

Commit 9d894ec1 authored by Chris Manton's avatar Chris Manton Committed by Automerger Merge Worker
Browse files

Provide more suitable API to query acl role am: 2722b73a am: 3d8fa61a am: 8d09bb29

Original change: https://android-review.googlesource.com/c/platform/system/bt/+/1393944

Change-Id: I3f6993c10ca26acf98ff2eca231ab5bc0c3b9893
parents 351150e3 8d09bb29
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -2452,3 +2452,11 @@ bool lmp_version_below(const RawAddress& bda, uint8_t version) {
                    version);
  return acl->lmp_version < version;
}

bool acl_is_role_master(const RawAddress& bda, tBT_TRANSPORT transport) {
  tACL_CONN* p = btm_bda_to_acl(bda, transport);
  if (p == nullptr) {
    return false;
  }
  return (p->link_role == HCI_ROLE_MASTER);
}
+3 −3
Original line number Diff line number Diff line
@@ -305,10 +305,10 @@ tGATT_STATUS gatts_db_read_attr_value_by_type(
        (type.As16Bit() == GATT_UUID_GAP_DEVICE_NAME)) {
      if ((flag & (BTM_SEC_LINK_KEY_KNOWN | BTM_SEC_FLAG_ENCRYPTED)) ==
          BTM_SEC_LINK_KEY_KNOWN) {
        tACL_CONN* p = btm_bda_to_acl(tcb.peer_bda, BT_TRANSPORT_LE);
        if ((p != NULL) && (p->link_role == HCI_ROLE_MASTER))
        if (acl_is_role_master(tcb.peer_bda, BT_TRANSPORT_LE)) {
          btm_ble_set_encryption(tcb.peer_bda, BTM_BLE_SEC_ENCRYPT,
                                 p->link_role);
                                 HCI_ROLE_MASTER);
        }
      }
    }
  }
+2 −0
Original line number Diff line number Diff line
@@ -247,3 +247,5 @@ void btm_set_packet_types_from_address(const RawAddress& bda,
                                       uint16_t pkt_types);

bool lmp_version_below(const RawAddress& bda, uint8_t version);

bool acl_is_role_master(const RawAddress& remote_bda, tBT_TRANSPORT transport);