From b42c696281a9005f823411d26205aaeadeac9b1e Mon Sep 17 00:00:00 2001 From: Pomai Ahlo <poahlo@google.com> Date: Wed, 31 Jan 2024 15:27:05 -0800 Subject: [PATCH] LOG_VERBOSE in bta_jv_api.cc Replace VLOG with LOG_VERBOSE and add relevant parameters to make the logs more helpful Bug: 295023364 Test: m Bluetooth Flag: EXEMPT changes only affect logs Change-Id: I676eb0542d753ca2abd882f1e58fcc1e5e09d3ca --- system/bta/jv/bta_jv_api.cc | 56 +++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 27 deletions(-) diff --git a/system/bta/jv/bta_jv_api.cc b/system/bta/jv/bta_jv_api.cc index df391c189a8..0bb295e8045 100644 --- a/system/bta/jv/bta_jv_api.cc +++ b/system/bta/jv/bta_jv_api.cc @@ -63,13 +63,12 @@ bool bta_jv_enabled = false; * ******************************************************************************/ tBTA_JV_STATUS BTA_JvEnable(tBTA_JV_DM_CBACK* p_cback) { + LOG_VERBOSE(""); if (!p_cback || bta_jv_enabled) { LOG(ERROR) << __func__ << ": failure"; return BTA_JV_FAILURE; } - VLOG(2) << __func__; - memset(&bta_jv_cb, 0, sizeof(tBTA_JV_CB)); /* set handle to invalid value by default */ for (int i = 0; i < BTA_JV_PM_MAX_NUM; i++) { @@ -116,7 +115,7 @@ void BTA_JvDisable(void) { * ******************************************************************************/ void BTA_JvGetChannelId(int conn_type, uint32_t id, int32_t channel) { - VLOG(2) << __func__ << ": conn_type=" << conn_type; + LOG_VERBOSE("conn_type:%d, id:%u, channel:%u", conn_type, id, channel); if (conn_type != BTA_JV_CONN_TYPE_RFCOMM && conn_type != BTA_JV_CONN_TYPE_L2CAP && @@ -143,7 +142,7 @@ void BTA_JvGetChannelId(int conn_type, uint32_t id, int32_t channel) { * ******************************************************************************/ tBTA_JV_STATUS BTA_JvFreeChannel(uint16_t channel, int conn_type) { - VLOG(2) << __func__; + LOG_VERBOSE("channel:%u, conn_type:%d", channel, conn_type); do_in_main_thread(FROM_HERE, Bind(&bta_jv_free_scn, conn_type, channel)); return BTA_JV_SUCCESS; @@ -165,7 +164,8 @@ tBTA_JV_STATUS BTA_JvFreeChannel(uint16_t channel, int conn_type) { tBTA_JV_STATUS BTA_JvStartDiscovery(const RawAddress& bd_addr, uint16_t num_uuid, const Uuid* p_uuid_list, uint32_t rfcomm_slot_id) { - VLOG(2) << __func__; + LOG_VERBOSE("bd_addr:%s, rfcomm_slot_id:%u, num_uuid:%u", + ADDRESS_TO_LOGGABLE_CSTR(bd_addr), rfcomm_slot_id, num_uuid); Uuid* uuid_list_copy = new Uuid[num_uuid]; memcpy(uuid_list_copy, p_uuid_list, num_uuid * sizeof(Uuid)); @@ -189,7 +189,7 @@ tBTA_JV_STATUS BTA_JvStartDiscovery(const RawAddress& bd_addr, * ******************************************************************************/ tBTA_JV_STATUS BTA_JvCreateRecordByUser(uint32_t rfcomm_slot_id) { - VLOG(2) << __func__; + LOG_VERBOSE("rfcomm_slot_id: %u", rfcomm_slot_id); do_in_main_thread(FROM_HERE, Bind(&bta_jv_create_record, rfcomm_slot_id)); return BTA_JV_SUCCESS; @@ -206,7 +206,7 @@ tBTA_JV_STATUS BTA_JvCreateRecordByUser(uint32_t rfcomm_slot_id) { * ******************************************************************************/ tBTA_JV_STATUS BTA_JvDeleteRecord(uint32_t handle) { - VLOG(2) << __func__; + LOG_VERBOSE("handle:%u", handle); do_in_main_thread(FROM_HERE, Bind(&bta_jv_delete_record, handle)); return BTA_JV_SUCCESS; @@ -231,7 +231,11 @@ void BTA_JvL2capConnect(int conn_type, tBTA_SEC sec_mask, tBTA_JV_ROLE role, const RawAddress& peer_bd_addr, tBTA_JV_L2CAP_CBACK* p_cback, uint32_t l2cap_socket_id) { - VLOG(2) << __func__; + LOG_VERBOSE( + "conn_type:%d, role:%u, remote_psm:%u, peer_bd_addr:%s, " + "l2cap_socket_id:%u", + conn_type, role, remote_psm, ADDRESS_TO_LOGGABLE_CSTR(peer_bd_addr), + l2cap_socket_id); CHECK(p_cback); do_in_main_thread(FROM_HERE, @@ -251,7 +255,7 @@ void BTA_JvL2capConnect(int conn_type, tBTA_SEC sec_mask, tBTA_JV_ROLE role, * ******************************************************************************/ tBTA_JV_STATUS BTA_JvL2capClose(uint32_t handle) { - VLOG(2) << __func__; + LOG_VERBOSE("handle:%u", handle); if (handle >= BTA_JV_MAX_L2C_CONN || !bta_jv_cb.l2c_cb[handle].p_cback) return BTA_JV_FAILURE; @@ -281,7 +285,8 @@ void BTA_JvL2capStartServer(int conn_type, tBTA_SEC sec_mask, tBTA_JV_ROLE role, std::unique_ptr<tL2CAP_CFG_INFO> cfg, tBTA_JV_L2CAP_CBACK* p_cback, uint32_t l2cap_socket_id) { - VLOG(2) << __func__; + LOG_VERBOSE("conn_type:%d, role:%u, local_psm:%u, l2cap_socket_id:%u", + conn_type, role, local_psm, l2cap_socket_id); CHECK(p_cback); do_in_main_thread(FROM_HERE, @@ -303,7 +308,7 @@ void BTA_JvL2capStartServer(int conn_type, tBTA_SEC sec_mask, tBTA_JV_ROLE role, ******************************************************************************/ tBTA_JV_STATUS BTA_JvL2capStopServer(uint16_t local_psm, uint32_t l2cap_socket_id) { - VLOG(2) << __func__; + LOG_VERBOSE("local_psm:%u, l2cap_socket_id:%u", local_psm, l2cap_socket_id); do_in_main_thread( FROM_HERE, Bind(&bta_jv_l2cap_stop_server, local_psm, l2cap_socket_id)); @@ -324,7 +329,7 @@ tBTA_JV_STATUS BTA_JvL2capStopServer(uint16_t local_psm, ******************************************************************************/ tBTA_JV_STATUS BTA_JvL2capRead(uint32_t handle, uint32_t req_id, uint8_t* p_data, uint16_t len) { - VLOG(2) << __func__; + LOG_VERBOSE("handle:%u, req_id:%u, len:%u", handle, req_id, len); if (handle >= BTA_JV_MAX_L2C_CONN || !bta_jv_cb.l2c_cb[handle].p_cback) return BTA_JV_FAILURE; @@ -359,7 +364,7 @@ tBTA_JV_STATUS BTA_JvL2capRead(uint32_t handle, uint32_t req_id, tBTA_JV_STATUS BTA_JvL2capReady(uint32_t handle, uint32_t* p_data_size) { tBTA_JV_STATUS status = BTA_JV_FAILURE; - VLOG(2) << __func__ << ": handle=" << handle; + LOG_VERBOSE("handle:%u", handle); if (p_data_size && handle < BTA_JV_MAX_L2C_CONN && bta_jv_cb.l2c_cb[handle].p_cback) { *p_data_size = 0; @@ -388,7 +393,7 @@ tBTA_JV_STATUS BTA_JvL2capReady(uint32_t handle, uint32_t* p_data_size) { ******************************************************************************/ tBTA_JV_STATUS BTA_JvL2capWrite(uint32_t handle, uint32_t req_id, BT_HDR* msg, uint32_t user_id) { - VLOG(2) << __func__; + LOG_VERBOSE("handle:%u, user_id:%u", handle, user_id); if (handle >= BTA_JV_MAX_L2C_CONN || !bta_jv_cb.l2c_cb[handle].p_cback) { osi_free(msg); @@ -421,7 +426,8 @@ tBTA_JV_STATUS BTA_JvRfcommConnect(tBTA_SEC sec_mask, tBTA_JV_ROLE role, const RawAddress& peer_bd_addr, tBTA_JV_RFCOMM_CBACK* p_cback, uint32_t rfcomm_slot_id) { - VLOG(2) << __func__; + LOG_VERBOSE("remote_scn:%u, peer_bd_addr:%s, rfcomm_slot_id:%u", remote_scn, + ADDRESS_TO_LOGGABLE_CSTR(peer_bd_addr), rfcomm_slot_id); if (!p_cback) return BTA_JV_FAILURE; /* Nothing to do */ @@ -445,7 +451,7 @@ tBTA_JV_STATUS BTA_JvRfcommClose(uint32_t handle, uint32_t rfcomm_slot_id) { uint32_t hi = ((handle & BTA_JV_RFC_HDL_MASK) & ~BTA_JV_RFCOMM_MASK) - 1; uint32_t si = BTA_JV_RFC_HDL_TO_SIDX(handle); - VLOG(2) << __func__; + LOG_VERBOSE("handle:%u, rfcomm_slot_id:%u", handle, rfcomm_slot_id); if (hi >= BTA_JV_MAX_RFC_CONN || !bta_jv_cb.rfc_cb[hi].p_cback || si >= BTA_JV_MAX_RFC_SR_SESSION || !bta_jv_cb.rfc_cb[hi].rfc_hdl[si]) @@ -475,7 +481,7 @@ tBTA_JV_STATUS BTA_JvRfcommStartServer(tBTA_SEC sec_mask, tBTA_JV_ROLE role, uint8_t local_scn, uint8_t max_session, tBTA_JV_RFCOMM_CBACK* p_cback, uint32_t rfcomm_slot_id) { - VLOG(2) << __func__; + LOG_VERBOSE("local_scn:%u, rfcomm_slot_id:%u", local_scn, rfcomm_slot_id); if (p_cback == NULL) return BTA_JV_FAILURE; /* Nothing to do */ @@ -505,7 +511,7 @@ tBTA_JV_STATUS BTA_JvRfcommStartServer(tBTA_SEC sec_mask, tBTA_JV_ROLE role, ******************************************************************************/ tBTA_JV_STATUS BTA_JvRfcommStopServer(uint32_t handle, uint32_t rfcomm_slot_id) { - VLOG(2) << __func__; + LOG_VERBOSE("handle:%u, rfcomm_slot_id:%u", handle, rfcomm_slot_id); do_in_main_thread(FROM_HERE, Bind(&bta_jv_rfcomm_stop_server, handle, rfcomm_slot_id)); @@ -516,10 +522,9 @@ tBTA_JV_STATUS BTA_JvRfcommStopServer(uint32_t handle, * * Function BTA_JvRfcommGetPortHdl * - * Description This function fetches the rfcomm port handle + * Description This function fetches the rfcomm port handle * - * Returns BTA_JV_SUCCESS, if the request is being processed. - * BTA_JV_FAILURE, otherwise. + * Returns * ******************************************************************************/ uint16_t BTA_JvRfcommGetPortHdl(uint32_t handle) { @@ -547,16 +552,13 @@ tBTA_JV_STATUS BTA_JvRfcommWrite(uint32_t handle, uint32_t req_id) { uint32_t hi = ((handle & BTA_JV_RFC_HDL_MASK) & ~BTA_JV_RFCOMM_MASK) - 1; uint32_t si = BTA_JV_RFC_HDL_TO_SIDX(handle); - VLOG(2) << __func__; - - VLOG(2) << __func__ << "handle=" << loghex(handle) << ", hi=" << hi - << ", si=" << si; + LOG_VERBOSE("handle:%u, req_id:%u, hi:%u, si:%u", handle, req_id, hi, si); if (hi >= BTA_JV_MAX_RFC_CONN || !bta_jv_cb.rfc_cb[hi].p_cback || si >= BTA_JV_MAX_RFC_SR_SESSION || !bta_jv_cb.rfc_cb[hi].rfc_hdl[si]) { return BTA_JV_FAILURE; } - VLOG(2) << "write ok"; + LOG_VERBOSE("write ok"); tBTA_JV_RFC_CB* p_cb = &bta_jv_cb.rfc_cb[hi]; do_in_main_thread(FROM_HERE, Bind(&bta_jv_rfcomm_write, handle, req_id, p_cb, @@ -589,7 +591,7 @@ tBTA_JV_STATUS BTA_JvRfcommWrite(uint32_t handle, uint32_t req_id) { ******************************************************************************/ tBTA_JV_STATUS BTA_JvSetPmProfile(uint32_t handle, tBTA_JV_PM_ID app_id, tBTA_JV_CONN_STATE init_st) { - VLOG(2) << __func__ << " handle=" << loghex(handle) << ", app_id:" << app_id; + LOG_VERBOSE("handle:%u, app_id:%u, init_st:%u", handle, app_id, handle); do_in_main_thread(FROM_HERE, Bind(&bta_jv_set_pm_profile, handle, app_id, init_st)); -- GitLab