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

Commit 235f5a45 authored by Chris Manton's avatar Chris Manton Committed by Automerger Merge Worker
Browse files

Update btif/src/::ble_addr_type am: 3ebdca5f am: 19fdcce5

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

Change-Id: I0c5050c0315abcc5353986db4ac77cdfd96c3eb9
parents 958b7e2f 19fdcce5
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -71,7 +71,8 @@ bool btif_config_clear(void);

// TODO(zachoverflow): Eww...we need to move these out. These are peer specific,
// not config general.
bool btif_get_address_type(const RawAddress& bd_addr, int* p_addr_type);
bool btif_get_address_type(const RawAddress& bd_addr,
                           tBLE_ADDR_TYPE* p_addr_type);
bool btif_get_device_type(const RawAddress& bd_addr, int* p_device_type);

void btif_debug_config_dump(int fd);
+2 −2
Original line number Diff line number Diff line
@@ -276,10 +276,10 @@ bt_status_t btif_storage_get_ble_local_key(uint8_t key_type,
                                           Octet16* key_value);

bt_status_t btif_storage_get_remote_addr_type(const RawAddress* remote_bd_addr,
                                              int* addr_type);
                                              tBLE_ADDR_TYPE* addr_type);

bt_status_t btif_storage_set_remote_addr_type(const RawAddress* remote_bd_addr,
                                              uint8_t addr_type);
                                              tBLE_ADDR_TYPE addr_type);

/*******************************************************************************
 * Function         btif_storage_load_hidd
+3 −2
Original line number Diff line number Diff line
@@ -102,7 +102,7 @@ void bta_batch_scan_reports_cb(int client_id, tBTA_STATUS status,
}

void bta_scan_results_cb_impl(RawAddress bd_addr, tBT_DEVICE_TYPE device_type,
                              int8_t rssi, uint8_t addr_type,
                              int8_t rssi, tBLE_ADDR_TYPE addr_type,
                              uint16_t ble_evt_type, uint8_t ble_primary_phy,
                              uint8_t ble_secondary_phy,
                              uint8_t ble_advertising_sid, int8_t ble_tx_power,
@@ -310,7 +310,8 @@ class BleScannerInterfaceImpl : public BleScannerInterface {
                       int addr_type, int discard_rule, Callback cb) override {
    do_in_main_thread(
        FROM_HERE, base::Bind(&BTM_BleEnableBatchScan, scan_mode, scan_interval,
                              scan_window, discard_rule, addr_type,
                              scan_window, discard_rule,
                              static_cast<tBLE_ADDR_TYPE>(addr_type),
                              jni_thread_wrapper(FROM_HERE, cb)));
  }

+4 −2
Original line number Diff line number Diff line
@@ -140,13 +140,15 @@ bool btif_get_device_type(const RawAddress& bda, int* p_device_type) {
  return true;
}

bool btif_get_address_type(const RawAddress& bda, int* p_addr_type) {
bool btif_get_address_type(const RawAddress& bda, tBLE_ADDR_TYPE* p_addr_type) {
  if (p_addr_type == NULL) return false;

  std::string addrstr = bda.ToString();
  const char* bd_addr_str = addrstr.c_str();

  if (!btif_config_get_int(bd_addr_str, "AddrType", p_addr_type)) return false;
  int val = 0;
  if (!btif_config_get_int(bd_addr_str, "AddrType", &val)) return false;
  *p_addr_type = static_cast<tBLE_ADDR_TYPE>(val);

  LOG_DEBUG("%s: Device [%s] address type %d", __func__, bd_addr_str,
            *p_addr_type);
+9 −8
Original line number Diff line number Diff line
@@ -647,7 +647,7 @@ static void btif_dm_cb_create_bond(const RawAddress bd_addr,
  bond_state_changed(BT_STATUS_SUCCESS, bd_addr, BT_BOND_STATE_BONDING);

  int device_type = 0;
  int addr_type;
  tBLE_ADDR_TYPE addr_type = BLE_ADDR_PUBLIC;
  std::string addrstr = bd_addr.ToString();
  const char* bdstr = addrstr.c_str();
  if (transport == BT_TRANSPORT_LE) {
@@ -659,7 +659,7 @@ static void btif_dm_cb_create_bond(const RawAddress bd_addr,
      // Try to read address type. OOB pairing might have set it earlier, but
      // didn't store it, it defaults to BLE_ADDR_PUBLIC
      uint8_t tmp_dev_type;
      uint8_t tmp_addr_type;
      tBLE_ADDR_TYPE tmp_addr_type = BLE_ADDR_PUBLIC;
      BTM_ReadDevInfo(bd_addr, &tmp_dev_type, &tmp_addr_type);
      addr_type = tmp_addr_type;

@@ -1179,7 +1179,7 @@ static void btif_dm_search_devices_evt(tBTA_DM_SEARCH_EVT event,
        bt_device_type_t dev_type;
        uint32_t num_properties = 0;
        bt_status_t status;
        int addr_type = 0;
        tBLE_ADDR_TYPE addr_type = BLE_ADDR_PUBLIC;

        memset(properties, 0, sizeof(properties));
        /* RawAddress */
@@ -1890,7 +1890,8 @@ void btif_dm_create_bond_out_of_band(const RawAddress bd_addr, int transport,
  // value.
  if (memcmp(oob_data.le_bt_dev_addr, empty, 7) != 0) {
    /* byte no 7 is address type in LE Bluetooth Address OOB data */
    uint8_t address_type = oob_data.le_bt_dev_addr[6];
    tBLE_ADDR_TYPE address_type =
        static_cast<tBLE_ADDR_TYPE>(oob_data.le_bt_dev_addr[6]);
    if (address_type == BLE_ADDR_PUBLIC || address_type == BLE_ADDR_RANDOM) {
      // bd_addr->address is already reversed, so use it instead of
      // oob_data->le_bt_dev_addr
@@ -2001,7 +2002,7 @@ void btif_dm_pin_reply(const RawAddress bd_addr, uint8_t accept,

  if (bluetooth::shim::is_gd_shim_enabled()) {
    uint8_t tmp_dev_type = 0;
    uint8_t tmp_addr_type = 0;
    tBLE_ADDR_TYPE tmp_addr_type = BLE_ADDR_PUBLIC;
    BTM_ReadDevInfo(bd_addr, &tmp_dev_type, &tmp_addr_type);

    bluetooth::shim::BTIF_DM_pin_reply(bd_addr, tmp_addr_type, accept, pin_len,
@@ -2036,8 +2037,8 @@ void btif_dm_pin_reply(const RawAddress bd_addr, uint8_t accept,
void btif_dm_ssp_reply(const RawAddress bd_addr, bt_ssp_variant_t variant,
                       uint8_t accept) {
  if (bluetooth::shim::is_gd_shim_enabled()) {
    uint8_t tmp_dev_type = 0;
    uint8_t tmp_addr_type = 0;
    tBT_DEVICE_TYPE tmp_dev_type;
    tBLE_ADDR_TYPE tmp_addr_type = BLE_ADDR_PUBLIC;
    BTM_ReadDevInfo(bd_addr, &tmp_dev_type, &tmp_addr_type);

    bluetooth::shim::BTIF_DM_ssp_reply(bd_addr, tmp_addr_type, variant, accept);
@@ -2436,7 +2437,7 @@ static void btif_dm_ble_auth_cmpl_evt(tBTA_DM_AUTH_CMPL* p_auth_cmpl) {
  if (p_auth_cmpl->success) {
    status = BT_STATUS_SUCCESS;
    state = BT_BOND_STATE_BONDED;
    int addr_type;
    tBLE_ADDR_TYPE addr_type;
    RawAddress bdaddr = p_auth_cmpl->bd_addr;
    if (btif_storage_get_remote_addr_type(&bdaddr, &addr_type) !=
        BT_STATUS_SUCCESS)
Loading