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

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

Use device privacy mode as default

am: 79962a0e

Change-Id: Iaaef84b029891d6f3f214ab4b4751b7f9f39ebc3
parents 5b72e43e 79962a0e
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -710,6 +710,12 @@ bool btm_ble_resolving_list_load_dev(tBTM_SEC_DEV_REC* p_dev_rec) {
          btsnd_hcic_ble_add_device_resolving_list(
              p_dev_rec->ble.static_addr_type, p_dev_rec->ble.static_addr,
              peer_irk, local_irk);

          if (controller_get_interface()->supports_ble_privacy()) {
            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);
          }
        } else {
          uint8_t param[40] = {0};
          uint8_t* p = param;
+17 −0
Original line number Diff line number Diff line
@@ -595,6 +595,23 @@ void btsnd_hcic_ble_rm_device_resolving_list(uint8_t addr_type_peer,
  btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p);
}

void btsnd_hcic_ble_set_privacy_mode(uint8_t addr_type_peer, BD_ADDR bda_peer,
                                     uint8_t privacy_type) {
  BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE);
  uint8_t* pp = (uint8_t*)(p + 1);

  p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_BLE_SET_PRIVACY_MODE;
  p->offset = 0;

  UINT16_TO_STREAM(pp, HCI_BLE_SET_PRIVACY_MODE);
  UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_BLE_SET_PRIVACY_MODE);
  UINT8_TO_STREAM(pp, addr_type_peer);
  BDADDR_TO_STREAM(pp, bda_peer);
  UINT8_TO_STREAM(pp, privacy_type);

  btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p);
}

void btsnd_hcic_ble_clear_resolving_list(void) {
  BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE);
  uint8_t* pp = (uint8_t*)(p + 1);
+1 −0
Original line number Diff line number Diff line
@@ -374,6 +374,7 @@
#define HCI_LE_SET_EXTENDED_SCAN_PARAMETERS (0x0041 | HCI_GRP_BLE_CMDS)
#define HCI_LE_SET_EXTENDED_SCAN_ENABLE (0x0042 | HCI_GRP_BLE_CMDS)
#define HCI_LE_EXTENDED_CREATE_CONNECTION (0x0043 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_SET_PRIVACY_MODE (0x004E | HCI_GRP_BLE_CMDS)

/* LE Get Vendor Capabilities Command OCF */
#define HCI_BLE_VENDOR_CAP_OCF (0x0153 | HCI_GRP_VENDOR_SPECIFIC)
+5 −0
Original line number Diff line number Diff line
@@ -676,6 +676,7 @@ extern void btsnd_hcic_vendor_spec_cmd(void* buffer, uint16_t opcode,

#define HCIC_PARAM_SIZE_BLE_ADD_DEV_RESOLVING_LIST (7 + HCIC_BLE_IRK_SIZE * 2)
#define HCIC_PARAM_SIZE_BLE_RM_DEV_RESOLVING_LIST 7
#define HCIC_PARAM_SIZE_BLE_SET_PRIVACY_MODE 8
#define HCIC_PARAM_SIZE_BLE_CLEAR_RESOLVING_LIST 0
#define HCIC_PARAM_SIZE_BLE_READ_RESOLVING_LIST_SIZE 0
#define HCIC_PARAM_SIZE_BLE_READ_RESOLVABLE_ADDR_PEER 7
@@ -835,6 +836,10 @@ extern void btsnd_hcic_ble_add_device_resolving_list(
extern void btsnd_hcic_ble_rm_device_resolving_list(uint8_t addr_type_peer,
                                                    BD_ADDR bda_peer);

extern void btsnd_hcic_ble_set_privacy_mode(uint8_t addr_type_peer,
                                            BD_ADDR bda_peer,
                                            uint8_t privacy_type);

extern void btsnd_hcic_ble_clear_resolving_list(void);

extern void btsnd_hcic_ble_read_resolvable_addr_peer(uint8_t addr_type_peer,