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

Commit 232a6931 authored by Jakub Pawlowski's avatar Jakub Pawlowski Committed by android-build-merger
Browse files

Don't send the LE Set Privacy Mode command if it's not supported

am: 11d9b298

Change-Id: I18bcdfd58af00a6557871bee702b1ce8ad3bbe0e
parents 521cdc85 11d9b298
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -56,6 +56,7 @@ typedef struct controller_t {
  bool (*supports_ble_packet_extension)(void);
  bool (*supports_ble_connection_parameters_request)(void);
  bool (*supports_ble_privacy)(void);
  bool (*supports_ble_set_privacy_mode)(void);
  bool (*supports_ble_2m_phy)(void);
  bool (*supports_ble_coded_phy)(void);
  bool (*supports_ble_extended_advertising)(void);
+8 −0
Original line number Diff line number Diff line
@@ -378,6 +378,13 @@ static bool supports_ble_privacy(void) {
  return HCI_LE_ENHANCED_PRIVACY_SUPPORTED(features_ble.as_array);
}

static bool supports_ble_set_privacy_mode() {
  CHECK(readable);
  CHECK(ble_supported);
  return HCI_LE_ENHANCED_PRIVACY_SUPPORTED(features_ble.as_array) &&
         HCI_LE_SET_PRIVACY_MODE_SUPPORTED(supported_commands);
}

static bool supports_ble_packet_extension(void) {
  CHECK(readable);
  CHECK(ble_supported);
@@ -521,6 +528,7 @@ static const controller_t interface = {
    supports_ble_packet_extension,
    supports_ble_connection_parameters_request,
    supports_ble_privacy,
    supports_ble_set_privacy_mode,
    supports_ble_2m_phy,
    supports_ble_coded_phy,
    supports_ble_extended_advertising,
+1 −1
Original line number Diff line number Diff line
@@ -708,7 +708,7 @@ bool btm_ble_resolving_list_load_dev(tBTM_SEC_DEV_REC* p_dev_rec) {
              p_dev_rec->ble.static_addr_type, p_dev_rec->ble.static_addr,
              peer_irk, local_irk);

          if (controller_get_interface()->supports_ble_privacy()) {
          if (controller_get_interface()->supports_ble_set_privacy_mode()) {
            BTM_TRACE_DEBUG("%s: adding device privacy mode", __func__);
            btsnd_hcic_ble_set_privacy_mode(p_dev_rec->ble.static_addr_type,
                                            p_dev_rec->ble.static_addr, 0x01);
+2 −0
Original line number Diff line number Diff line
@@ -3230,6 +3230,8 @@ typedef struct {
  ((x)[HCI_SUPP_COMMANDS_LE_ENH_TX_TEST_OFF] & \
   HCI_SUPP_COMMANDS_LE_ENH_TX_TEST_MASK)

#define HCI_LE_SET_PRIVACY_MODE_SUPPORTED(x) ((x)[39] & 0x04)

/* LE Advertising Extension related Procedurs */
#define HCI_LE_EXTENDED_ADVERTISING_SUPPORTED(x) \
  (((x)[1] & 0x10))  // BIT 12 SET