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

Commit fc8006e6 authored by Marie Janssen's avatar Marie Janssen
Browse files

build: Update osi log functions, use consistently

Update the LOG_* functions to take a tag argument which makes them more
consistent with the Android Log.*(TAG, s) common syntax and removes
some #define-dependency with osi/include/log.h.

Also update to never use Android log functions directly.

Also contains minor cleanup of some header includes.

Bug: 21569831
Change-Id: If07385cafbea062232ecdbc7c673f908d5ef8921
parent e3fd0088
Loading
Loading
Loading
Loading
+6 −6
Original line number Original line Diff line number Diff line
@@ -42,8 +42,6 @@
#include <hardware/hardware.h>
#include <hardware/hardware.h>
#include <system/audio.h>
#include <system/audio.h>


#define LOG_TAG "bt_a2dp_hw"

#include "audio_a2dp_hw.h"
#include "audio_a2dp_hw.h"
#include "bt_utils.h"
#include "bt_utils.h"
#include "osi/include/log.h"
#include "osi/include/log.h"
@@ -58,10 +56,12 @@


#define CASE_RETURN_STR(const) case const: return #const;
#define CASE_RETURN_STR(const) case const: return #const;


#define FNLOG()             LOG_VERBOSE("%s", __FUNCTION__);
#define LOG_TAG "bt_a2dp_hw"
#define DEBUG(fmt, ...)     LOG_VERBOSE("%s: " fmt,__FUNCTION__, ## __VA_ARGS__)

#define INFO(fmt, ...)      LOG_INFO("%s: " fmt,__FUNCTION__, ## __VA_ARGS__)
#define FNLOG()             LOG_VERBOSE(LOG_TAG, "%s", __FUNCTION__);
#define ERROR(fmt, ...)     LOG_ERROR("%s: " fmt,__FUNCTION__, ## __VA_ARGS__)
#define DEBUG(fmt, ...)     LOG_VERBOSE(LOG_TAG, "%s: " fmt,__FUNCTION__, ## __VA_ARGS__)
#define INFO(fmt, ...)      LOG_INFO(LOG_TAG, "%s: " fmt,__FUNCTION__, ## __VA_ARGS__)
#define ERROR(fmt, ...)     LOG_ERROR(LOG_TAG, "%s: " fmt,__FUNCTION__, ## __VA_ARGS__)


#define ASSERTC(cond, msg, val) if (!(cond)) {ERROR("### ASSERT : %s line %d %s (%d) ###", __FILE__, __LINE__, msg, val);}
#define ASSERTC(cond, msg, val) if (!(cond)) {ERROR("### ASSERT : %s line %d %s (%d) ###", __FILE__, __LINE__, msg, val);}


+6 −3
Original line number Original line Diff line number Diff line
@@ -24,16 +24,19 @@
 ******************************************************************************/
 ******************************************************************************/


#include "bt_target.h"
#include "bt_target.h"

#if defined(BTA_AV_INCLUDED) && (BTA_AV_INCLUDED == TRUE)
#if defined(BTA_AV_INCLUDED) && (BTA_AV_INCLUDED == TRUE)


#include <string.h>
#include <string.h>

#include "avdt_api.h"
#include "bta_av_api.h"
#include "bta_av_api.h"
#include "bta_av_int.h"
#include "bta_av_int.h"
#include "avdt_api.h"
#include "utl.h"
#include "l2c_api.h"
#include "l2c_api.h"
#include "osi/include/list.h"
#include "osi/include/list.h"
#include "osi/include/osi.h"
#include "osi/include/osi.h"
#include "utl.h"

#if( defined BTA_AR_INCLUDED ) && (BTA_AR_INCLUDED == TRUE)
#if( defined BTA_AR_INCLUDED ) && (BTA_AR_INCLUDED == TRUE)
#include "bta_ar_api.h"
#include "bta_ar_api.h"
#endif
#endif
@@ -505,7 +508,7 @@ void bta_av_rc_opened(tBTA_AV_CB *p_cb, tBTA_AV_DATA *p_data)
            p_scb->rc_handle = p_data->rc_conn_chg.handle;
            p_scb->rc_handle = p_data->rc_conn_chg.handle;
            APPL_TRACE_DEBUG("bta_av_rc_opened shdl:%d, srch %d", i + 1, p_scb->rc_handle);
            APPL_TRACE_DEBUG("bta_av_rc_opened shdl:%d, srch %d", i + 1, p_scb->rc_handle);
            shdl = i+1;
            shdl = i+1;
            LOG_INFO("%s allow incoming AVRCP connections:%d", __func__, p_scb->use_rc);
            LOG_INFO(LOG_TAG, "%s allow incoming AVRCP connections:%d", __func__, p_scb->use_rc);
            bta_sys_stop_timer(&p_scb->timer);
            bta_sys_stop_timer(&p_scb->timer);
            disc = p_scb->hndl;
            disc = p_scb->hndl;
            break;
            break;
+7 −3
Original line number Original line Diff line number Diff line
@@ -29,11 +29,12 @@
#include "osi/include/log.h"
#include "osi/include/log.h"


#if defined(BTA_AV_INCLUDED) && (BTA_AV_INCLUDED == TRUE)
#if defined(BTA_AV_INCLUDED) && (BTA_AV_INCLUDED == TRUE)
#include "bta_av_co.h"
#include "bta_av_int.h"
#include "bta_av_int.h"
#include "utl.h"
#include "l2c_api.h"
#include "l2c_api.h"
#include "l2cdefs.h"
#include "l2cdefs.h"
#include "bta_av_co.h"
#include "utl.h"

#if( defined BTA_AR_INCLUDED ) && (BTA_AR_INCLUDED == TRUE)
#if( defined BTA_AR_INCLUDED ) && (BTA_AR_INCLUDED == TRUE)
#include "bta_ar_api.h"
#include "bta_ar_api.h"
#endif
#endif
@@ -42,9 +43,12 @@
** Constants and types
** Constants and types
*****************************************************************************/
*****************************************************************************/


#define LOG_TAG "bta_av"

/* AVDTP protocol timeout values */
/* AVDTP protocol timeout values */
#define BTIF_AVK_SERVICE_NAME "Advanced Audio Sink"
#define BTIF_AVK_SERVICE_NAME "Advanced Audio Sink"



#ifndef BTA_AV_RET_TOUT
#ifndef BTA_AV_RET_TOUT
#define BTA_AV_RET_TOUT     4
#define BTA_AV_RET_TOUT     4
#endif
#endif
@@ -1106,7 +1110,7 @@ BOOLEAN bta_av_link_role_ok(tBTA_AV_SCB *p_scb, UINT8 bits)


    if (BTM_GetRole(p_scb->peer_addr, &role) == BTM_SUCCESS)
    if (BTM_GetRole(p_scb->peer_addr, &role) == BTM_SUCCESS)
    {
    {
        LOG_INFO("%s hndl:x%x role:%d conn_audio:x%x bits:%d features:x%x",
        LOG_INFO(LOG_TAG, "%s hndl:x%x role:%d conn_audio:x%x bits:%d features:x%x",
                __func__, p_scb->hndl, role, bta_av_cb.conn_audio, bits,
                __func__, p_scb->hndl, role, bta_av_cb.conn_audio, bits,
                bta_av_cb.features);
                bta_av_cb.features);
        if (BTM_ROLE_MASTER != role && (A2D_BitsSet(bta_av_cb.conn_audio) > bits || (bta_av_cb.features & BTA_AV_FEAT_MASTER)))
        if (BTM_ROLE_MASTER != role && (A2D_BitsSet(bta_av_cb.conn_audio) > bits || (bta_av_cb.features & BTA_AV_FEAT_MASTER)))
+13 −12
Original line number Original line Diff line number Diff line
@@ -23,30 +23,31 @@
 *
 *
 ******************************************************************************/
 ******************************************************************************/


#include <string.h>

#include "bt_target.h"
#include "bt_target.h"
#include "bt_types.h"
#include "bt_types.h"
#include "gki.h"
#include "bta_sys.h"
#include "bta_api.h"
#include "bta_api.h"
#include "bta_dm_int.h"
#include "bta_dm_co.h"
#include "bta_dm_co.h"
#include "bta_dm_int.h"
#include "bta_sys.h"
#include "btm_api.h"
#include "btm_api.h"
#include "btm_int.h"
#include "btm_int.h"
#include "btu.h"
#include "btu.h"
#include "sdp_api.h"
#include "l2c_api.h"
#include "utl.h"
#include "gap_api.h"    /* For GAP_BleReadPeerPrefConnParams */
#include "gap_api.h"    /* For GAP_BleReadPeerPrefConnParams */
#include <string.h>
#include "gki.h"

#include "l2c_api.h"
#define LOG_TAG "bt_bta_dm"
#include "osi/include/log.h"
#include "osi/include/log.h"
#include "osi/include/osi.h"
#include "osi/include/osi.h"
#include "sdp_api.h"
#include "utl.h"


#if (GAP_INCLUDED == TRUE)
#if (GAP_INCLUDED == TRUE)
#include "gap_api.h"
#include "gap_api.h"
#endif
#endif


#define LOG_TAG "bt_bta_dm"

static void bta_dm_inq_results_cb (tBTM_INQ_RESULTS *p_inq, UINT8 *p_eir);
static void bta_dm_inq_results_cb (tBTM_INQ_RESULTS *p_inq, UINT8 *p_eir);
static void bta_dm_inq_cmpl_cb (void * p_result);
static void bta_dm_inq_cmpl_cb (void * p_result);
static void bta_dm_service_search_remname_cback (BD_ADDR bd_addr, DEV_CLASS dc, BD_NAME bd_name);
static void bta_dm_service_search_remname_cback (BD_ADDR bd_addr, DEV_CLASS dc, BD_NAME bd_name);
@@ -2093,7 +2094,7 @@ static void bta_dm_find_services ( BD_ADDR bd_addr)
                /* try to search all services by search based on L2CAP UUID */
                /* try to search all services by search based on L2CAP UUID */
                if(bta_dm_search_cb.services == BTA_ALL_SERVICE_MASK )
                if(bta_dm_search_cb.services == BTA_ALL_SERVICE_MASK )
                {
                {
                    LOG_INFO("%s services_to_search=%08x", __func__, bta_dm_search_cb.services_to_search);
                    LOG_INFO(LOG_TAG, "%s services_to_search=%08x", __func__, bta_dm_search_cb.services_to_search);
                    if (bta_dm_search_cb.services_to_search & BTA_RES_SERVICE_MASK)
                    if (bta_dm_search_cb.services_to_search & BTA_RES_SERVICE_MASK)
                    {
                    {
                        uuid.uu.uuid16 = bta_service_id_to_uuid_lkup_tbl[0];
                        uuid.uu.uuid16 = bta_service_id_to_uuid_lkup_tbl[0];
@@ -2147,7 +2148,7 @@ static void bta_dm_find_services ( BD_ADDR bd_addr)
                    memcpy(&uuid, &bta_dm_search_cb.uuid, sizeof(tSDP_UUID));
                    memcpy(&uuid, &bta_dm_search_cb.uuid, sizeof(tSDP_UUID));
                }
                }


                LOG_INFO("%s search UUID = %04x", __func__, uuid.uu.uuid16);
                LOG_INFO(LOG_TAG, "%s search UUID = %04x", __func__, uuid.uu.uuid16);
                SDP_InitDiscoveryDb (bta_dm_search_cb.p_sdp_db, BTA_DM_SDP_DB_SIZE, 1, &uuid, 0, NULL);
                SDP_InitDiscoveryDb (bta_dm_search_cb.p_sdp_db, BTA_DM_SDP_DB_SIZE, 1, &uuid, 0, NULL);


                memset(g_disc_raw_data_buf, 0, sizeof(g_disc_raw_data_buf));
                memset(g_disc_raw_data_buf, 0, sizeof(g_disc_raw_data_buf));
@@ -5443,7 +5444,7 @@ static void bta_dm_gatt_disc_result(tBTA_GATT_ID service_id)
        APPL_TRACE_ERROR("%s out of room to accomodate more service ids ble_raw_size = %d ble_raw_used = %d", __FUNCTION__,bta_dm_search_cb.ble_raw_size, bta_dm_search_cb.ble_raw_used );
        APPL_TRACE_ERROR("%s out of room to accomodate more service ids ble_raw_size = %d ble_raw_used = %d", __FUNCTION__,bta_dm_search_cb.ble_raw_size, bta_dm_search_cb.ble_raw_used );
    }
    }


    LOG_INFO("%s service_id_uuid_len=%d ", __func__, service_id.uuid.len);
    LOG_INFO(LOG_TAG, "%s service_id_uuid_len=%d ", __func__, service_id.uuid.len);
    if ( bta_dm_search_cb.state != BTA_DM_SEARCH_IDLE)
    if ( bta_dm_search_cb.state != BTA_DM_SEARCH_IDLE)
    {
    {


+9 −11
Original line number Original line Diff line number Diff line
@@ -22,26 +22,24 @@
 *  machine.
 *  machine.
 *
 *
 ******************************************************************************/
 ******************************************************************************/
#define LOG_TAG "bt_bta_gattc"


#include "bt_target.h"
#include <string.h>


#include "utl.h"
#include "bt_target.h"
#include "gki.h"
#include "bta_sys.h"


#include "bta_gattc_int.h"
#include "bta_gattc_int.h"
#include "bta_sys.h"
#include "btif/include/btif_debug_conn.h"
#include "gki.h"
#include "l2c_api.h"
#include "l2c_api.h"
#include "osi/include/log.h"
#include "utl.h"


#if (defined BTA_HH_LE_INCLUDED && BTA_HH_LE_INCLUDED == TRUE)
#if (defined BTA_HH_LE_INCLUDED && BTA_HH_LE_INCLUDED == TRUE)
#include "bta_hh_int.h"
#include "bta_hh_int.h"
#endif
#endif


#include "btif/include/btif_debug_conn.h"
#define LOG_TAG "bt_bta_gattc"

#include <string.h>

#include "osi/include/log.h"


#if BTA_GATT_INCLUDED && BLE_INCLUDED == TRUE
#if BTA_GATT_INCLUDED && BLE_INCLUDED == TRUE


@@ -2319,7 +2317,7 @@ void bta_gattc_listen(tBTA_GATTC_CB *p_cb, tBTA_GATTC_DATA * p_msg)
                /* if listen to all */
                /* if listen to all */
                else
                else
                {
                {
                    LOG_DEBUG("Listen For All now");
                    LOG_DEBUG(LOG_TAG, "Listen For All now");
                    /* go through all connected device and send
                    /* go through all connected device and send
                    callback for all connected slave connection */
                    callback for all connected slave connection */
                    bta_gattc_process_listen_all(p_msg->api_listen.client_if);
                    bta_gattc_process_listen_all(p_msg->api_listen.client_if);
Loading