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

Commit 7b9f8e82 authored by Hansong Zhang's avatar Hansong Zhang
Browse files

Simplify BTM_SecAddDevice

Ah 0 is BTM_IO_CAP_OUT.  When we load a device from storage, we always
it's display only.

Bug: 159815595
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I0f51d2e03e58734e2244d959446e3728707edb27
parent 7621b695
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -640,7 +640,7 @@ void bta_dm_add_device(std::unique_ptr<tBTA_DM_API_ADD_DEVICE> msg) {
  if (msg->link_key_known) p_lc = &msg->link_key;

  if (!BTM_SecAddDevice(msg->bd_addr, p_dc, msg->bd_name, msg->features,
                        trusted_services_mask, p_lc, msg->key_type, 0,
                        trusted_services_mask, p_lc, msg->key_type,
                        msg->pin_length)) {
    LOG(ERROR) << "BTA_DM: Error adding device " << msg->bd_addr;
  }
+2 −3
Original line number Diff line number Diff line
@@ -65,8 +65,7 @@
bool BTM_SecAddDevice(const RawAddress& bd_addr, DEV_CLASS dev_class,
                      BD_NAME bd_name, uint8_t* features,
                      uint32_t trusted_mask[], LinkKey* p_link_key,
                      uint8_t key_type, tBTM_IO_CAP io_cap,
                      uint8_t pin_length) {
                      uint8_t key_type, uint8_t pin_length) {
  BTM_TRACE_API("%s: link key type:%x", __func__, key_type);

  tBTM_SEC_DEV_REC* p_dev_rec = btm_find_dev(bd_addr);
@@ -147,7 +146,7 @@ bool BTM_SecAddDevice(const RawAddress& bd_addr, DEV_CLASS dev_class,
    p_dev_rec->sm4 = BTM_SM4_TRUE;
#endif

  p_dev_rec->rmt_io_caps = io_cap;
  p_dev_rec->rmt_io_caps = BTM_IO_CAP_OUT;
  p_dev_rec->device_type |= BT_DEVICE_TYPE_BREDR;

  return true;
+1 −1
Original line number Diff line number Diff line
@@ -56,7 +56,7 @@
bool BTM_SecAddDevice(const RawAddress& bd_addr, DEV_CLASS dev_class,
                      BD_NAME bd_name, uint8_t* features,
                      uint32_t trusted_mask[], LinkKey* p_link_key,
                      uint8_t key_type, tBTM_IO_CAP io_cap, uint8_t pin_length);
                      uint8_t key_type, uint8_t pin_length);
void wipe_secrets_and_remove(tBTM_SEC_DEV_REC* p_dev_rec);

/** Free resources associated with the device associated with |bd_addr| address.
+1 −1
Original line number Diff line number Diff line
@@ -693,7 +693,7 @@ uint32_t* BTM_ReadTrustedMask(const RawAddress& bd_addr);
bool BTM_SecAddDevice(const RawAddress& bd_addr, DEV_CLASS dev_class,
                      BD_NAME bd_name, uint8_t* features,
                      uint32_t trusted_mask[], LinkKey* link_key,
                      uint8_t key_type, tBTM_IO_CAP io_cap, uint8_t pin_length);
                      uint8_t key_type, uint8_t pin_length);

/** Free resources associated with the device associated with |bd_addr| address.
 *