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

Commit c5c72647 authored by Henri Chataing's avatar Henri Chataing Committed by Gerrit Code Review
Browse files

Merge changes from topic "bluetooth-log-vts" into main

* changes:
  system: Migrate ASSERT to log::assert_that
  system/gd/os: Deprecate ASSERT_LOG
  system: Migrate ASSERT_LOG to log::assert_that
  system/gd/packet: Migrate from ASSERT/ASSERT_LOG to std::assert
parents e5430145 44b64827
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -3291,7 +3291,8 @@ void bta_av_offload_req(tBTA_AV_SCB* p_scb, tBTA_AV_DATA* p_data) {
               bta_av_cb.audio_open_cnt);

  A2dpCodecConfig* codec_config = bta_av_get_a2dp_current_codec();
  ASSERT(codec_config != nullptr);
  log::assert_that(codec_config != nullptr,
                   "assert failed: codec_config != nullptr");

  /* Check if stream has already been started. */
  /* Support offload if only one audio source stream is open. */
+6 −6
Original line number Diff line number Diff line
@@ -369,7 +369,7 @@ static bool force_disconnect_all_acl_connections() {
}

static void bta_dm_wait_for_acl_to_drain_cback(void* data) {
  ASSERT(data != nullptr);
  log::assert_that(data != nullptr, "assert failed: data != nullptr");
  const WaitForAllAclConnectionsToDrain* pass =
      WaitForAllAclConnectionsToDrain::FromAlarmCallbackData(data);

@@ -937,10 +937,10 @@ static void bta_dm_rm_cback(tBTA_SYS_CONN_STATUS status, tBTA_SYS_ID id,
        if (((p_bta_dm_rm_cfg[j].app_id == app_id) ||
             (p_bta_dm_rm_cfg[j].app_id == BTA_ALL_APP_ID)) &&
            (p_bta_dm_rm_cfg[j].id == id)) {
          ASSERT_LOG(p_bta_dm_rm_cfg[j].cfg <= BTA_PERIPHERAL_ROLE_ONLY,
                     "Passing illegal preferred role:0x%02x [0x%02x<=>0x%02x]",
                     p_bta_dm_rm_cfg[j].cfg, BTA_ANY_ROLE,
                     BTA_PERIPHERAL_ROLE_ONLY);
          log::assert_that(
              p_bta_dm_rm_cfg[j].cfg <= BTA_PERIPHERAL_ROLE_ONLY,
              "Passing illegal preferred role:0x{:02x} [0x{:02x}<=>0x{:02x}]",
              p_bta_dm_rm_cfg[j].cfg, BTA_ANY_ROLE, BTA_PERIPHERAL_ROLE_ONLY);
          role = static_cast<tBTA_PREF_ROLES>(p_bta_dm_rm_cfg[j].cfg);
          if (role > p_dev->pref_role) p_dev->pref_role = role;
          break;
@@ -1094,7 +1094,7 @@ static void bta_dm_set_eir(char* local_name) {

  /* Allocate a buffer to hold HCI command */
  BT_HDR* p_buf = (BT_HDR*)osi_malloc(BTM_CMD_BUF_SIZE);
  ASSERT(p_buf != nullptr);
  log::assert_that(p_buf != nullptr, "assert failed: p_buf != nullptr");
  p = (uint8_t*)p_buf + BTM_HCI_EIR_OFFSET;

  memset(p, 0x00, HCI_EXT_INQ_RESPONSE_LEN);
+4 −4
Original line number Diff line number Diff line
@@ -330,10 +330,10 @@ static void bta_dm_pm_stop_timer_by_index(tBTA_PM_TIMER* p_timer,
    return;
  } /* The timer was not scheduled */

  ASSERT_LOG(p_timer->in_use,
             "Timer was not scheduled p_timer->srvc_id[timer_idx]:%hhu",
  log::assert_that(p_timer->in_use,
                   "Timer was not scheduled p_timer->srvc_id[timer_idx]:{}",
                   p_timer->srvc_id[timer_idx]);
  ASSERT_LOG(p_timer->active > 0, "No tasks on timer are active");
  log::assert_that(p_timer->active > 0, "No tasks on timer are active");

  p_timer->srvc_id[timer_idx] = BTA_ID_MAX;
  /* NOTE: pm_action[timer_idx] intentionally not reset */
+6 −3
Original line number Diff line number Diff line
@@ -121,9 +121,10 @@ typedef enum : uint8_t {
} tBTA_PREF_ROLES;

inline tBTA_PREF_ROLES toBTA_PREF_ROLES(uint8_t role) {
  ASSERT_LOG(role <= BTA_PERIPHERAL_ROLE_ONLY,
             "Passing illegal preferred role:0x%02x [0x%02x<=>0x%02x]", role,
             BTA_ANY_ROLE, BTA_PERIPHERAL_ROLE_ONLY);
  bluetooth::log::assert_that(
      role <= BTA_PERIPHERAL_ROLE_ONLY,
      "Passing illegal preferred role:0x{:02x} [0x{:02x}<=>0x{:02x}]", role,
      int(BTA_ANY_ROLE), int(BTA_PERIPHERAL_ROLE_ONLY));
  return static_cast<tBTA_PREF_ROLES>(role);
}

@@ -949,6 +950,8 @@ template <>
struct formatter<tBTA_DM_SEARCH_EVT> : enum_formatter<tBTA_DM_SEARCH_EVT> {};
template <>
struct formatter<tBTA_DM_ACL_EVT> : enum_formatter<tBTA_DM_ACL_EVT> {};
template <>
struct formatter<tBTA_PREF_ROLES> : enum_formatter<tBTA_PREF_ROLES> {};
}  // namespace fmt

#endif /* BTA_API_H */
+1 −1
Original line number Diff line number Diff line
@@ -869,7 +869,7 @@ static void bta_jv_start_discovery_cback(UNUSED_ATTR const RawAddress& bd_addr,
void bta_jv_start_discovery(const RawAddress& bd_addr, uint16_t num_uuid,
                            bluetooth::Uuid* uuid_list,
                            uint32_t rfcomm_slot_id) {
  ASSERT(uuid_list != nullptr);
  log::assert_that(uuid_list != nullptr, "assert failed: uuid_list != nullptr");
  if (bta_jv_cb.sdp_cb.sdp_active) {
    log::warn(
        "Unable to start discovery as already in progress active_bd_addr{} "
Loading