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

Commit d2cba995 authored by Chris Manton's avatar Chris Manton
Browse files

Re-log parts of btif/src/btif_storage

Towards loggable code

Bug: 163134718
Tag: #refactor
Test: act.py -tc BleCocTest
Test: ble paired 2 phones
Change-Id: I2d2a3a44037a132f2361acb36d039e9d8c757c8d
parent cc515919
Loading
Loading
Loading
Loading
+9 −14
Original line number Diff line number Diff line
@@ -188,12 +188,12 @@ static int prop2cfg(const RawAddress* remote_bd_addr, bt_property_t* prop) {
    bdstr = remote_bd_addr->ToString();
  }

  BTIF_TRACE_DEBUG("in, bd addr:%s, prop type:%d, len:%d", bdstr.c_str(),
                   prop->type, prop->len);
  char value[1024];
  if (prop->len <= 0 || prop->len > (int)sizeof(value) - 1) {
    BTIF_TRACE_ERROR("property type:%d, len:%d is invalid", prop->type,
                     prop->len);
    LOG_WARN(
        "Unable to save property to configuration file type:%d, "
        " len:%d is invalid",
        prop->type, prop->len);
    return false;
  }
  switch (prop->type) {
@@ -285,11 +285,9 @@ static int cfg2prop(const RawAddress* remote_bd_addr, bt_property_t* prop) {
  if (remote_bd_addr) {
    bdstr = remote_bd_addr->ToString();
  }
  BTIF_TRACE_DEBUG("in, bd addr:%s, prop type:%d, len:%d", bdstr.c_str(),
                   prop->type, prop->len);
  if (prop->len <= 0) {
    BTIF_TRACE_ERROR("property type:%d, len:%d is invalid", prop->type,
                     prop->len);
    LOG_WARN("Invalid property read from configuration file type:%d, len:%d",
             prop->type, prop->len);
    return false;
  }
  int ret = false;
@@ -425,8 +423,6 @@ static bt_status_t btif_in_fetch_bonded_device(const std::string& bdstr) {
  if ((btif_in_fetch_bonded_ble_device(bdstr, false, NULL) !=
       BT_STATUS_SUCCESS) &&
      (!bt_linkkey_file_found)) {
    BTIF_TRACE_DEBUG("Remote device:%s, no link key or ble key found",
                     bdstr.c_str());
    return BT_STATUS_FAIL;
  }
  return BT_STATUS_SUCCESS;
@@ -480,8 +476,7 @@ static bt_status_t btif_in_fetch_bonded_devices(
      }
    }
    if (!btif_in_fetch_bonded_ble_device(name, add, p_bonded_devices) && !bt_linkkey_file_found) {
      BTIF_TRACE_DEBUG("Remote device:%s, no link key or ble key found",
                       name.c_str());
      LOG_VERBOSE("No link key or ble key found for device:%s", name.c_str());
    }
  }
  return BT_STATUS_SUCCESS;
@@ -840,7 +835,7 @@ bt_status_t btif_storage_add_bonded_device(RawAddress* remote_bd_addr,
bt_status_t btif_storage_remove_bonded_device(
    const RawAddress* remote_bd_addr) {
  std::string bdstr = remote_bd_addr->ToString();
  BTIF_TRACE_DEBUG("in bd addr:%s", bdstr.c_str());
  LOG_DEBUG("Removing bonded device addr:%s", bdstr.c_str());

  btif_storage_remove_ble_bonding_keys(remote_bd_addr);

@@ -1133,7 +1128,7 @@ bt_status_t btif_storage_get_ble_bonding_key(const RawAddress& remote_bd_addr,
bt_status_t btif_storage_remove_ble_bonding_keys(
    const RawAddress* remote_bd_addr) {
  std::string bdstr = remote_bd_addr->ToString();
  BTIF_TRACE_DEBUG(" %s in bd addr:%s", __func__, bdstr.c_str());
  LOG_DEBUG("Removing bonding keys for bd addr:%s", bdstr.c_str());
  int ret = 1;
  if (btif_config_exist(bdstr, "LE_KEY_PENC"))
    ret &= btif_config_remove(bdstr, "LE_KEY_PENC");