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

Commit 44b64827 authored by Henri Chataing's avatar Henri Chataing
Browse files

system: Migrate ASSERT to log::assert_that

Test: m com.android.btservices
Bug: 305066880
Flag: EXEMPT, mechanical refactor
Change-Id: Ieabf39f472d4aa940473e5052adca495845cdcf3
parent 107af98d
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. */
+2 −2
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);

@@ -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);
+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{} "
+1 −1
Original line number Diff line number Diff line
@@ -1247,7 +1247,7 @@ bt_property_t* property_deep_copy_array(int num_properties,

    copy = (bt_property_t*)osi_calloc((sizeof(bt_property_t) * num_properties) +
                                      content_len);
    ASSERT(copy != nullptr);
    log::assert_that(copy != nullptr, "assert failed: copy != nullptr");
    uint8_t* content = (uint8_t*)(copy + num_properties);

    for (int i = 0; i < num_properties; i++) {
+20 −17
Original line number Diff line number Diff line
@@ -946,8 +946,7 @@ uint16_t btif_dm_get_connection_state_sync(const RawAddress& bd_addr) {
  std::promise<uint16_t> promise;
  std::future future = promise.get_future();

  ASSERT(BT_STATUS_SUCCESS ==
         do_in_main_thread(
  auto status = do_in_main_thread(
      FROM_HERE,
      base::BindOnce(
          [](const RawAddress bd_addr, std::promise<uint16_t> promise) {
@@ -959,7 +958,9 @@ uint16_t btif_dm_get_connection_state_sync(const RawAddress& bd_addr) {
            state |= btif_dm_get_connection_state(bd_addr);
            promise.set_value(state);
          },
                 bd_addr, std::move(promise))));
          bd_addr, std::move(promise)));
  log::assert_that(BT_STATUS_SUCCESS == status,
                   "assert failed: BT_STATUS_SUCCESS == status");
  return future.get();
}

@@ -3695,15 +3696,17 @@ void btif_dm_load_ble_local_keys(void) {
void btif_dm_get_ble_local_keys(tBTA_DM_BLE_LOCAL_KEY_MASK* p_key_mask,
                                Octet16* p_er,
                                tBTA_BLE_LOCAL_ID_KEYS* p_id_keys) {
  ASSERT(p_key_mask != nullptr);
  log::assert_that(p_key_mask != nullptr,
                   "assert failed: p_key_mask != nullptr");
  if (ble_local_key_cb.is_er_rcvd) {
    ASSERT(p_er != nullptr);
    log::assert_that(p_er != nullptr, "assert failed: p_er != nullptr");
    *p_er = ble_local_key_cb.er;
    *p_key_mask |= BTA_BLE_LOCAL_KEY_TYPE_ER;
  }

  if (ble_local_key_cb.is_id_keys_rcvd) {
    ASSERT(p_id_keys != nullptr);
    log::assert_that(p_id_keys != nullptr,
                     "assert failed: p_id_keys != nullptr");
    p_id_keys->ir = ble_local_key_cb.id_keys.ir;
    p_id_keys->irk = ble_local_key_cb.id_keys.irk;
    p_id_keys->dhk = ble_local_key_cb.id_keys.dhk;
Loading