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

Commit 831f837b authored by Henri Chataing's avatar Henri Chataing
Browse files

system/btif/src: Fix -Wmissing-prototypes errors

Bug: 369381361
Test: m com.android.btservices
Flag: EXEMPT, minor fixes
Change-Id: I0c744366ac688d7ebd0ed20e359ebfeadab1a2b3
parent 76cdc953
Loading
Loading
Loading
Loading
+1 −7
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@
#include "bta/include/bta_ar_api.h"
#include "bta/include/utl.h"
#include "btif/avrcp/avrcp_service.h"
#include "btif/include/btif_av.h"
#include "device/include/device_iot_config.h"
#include "device/include/interop.h"
#include "internal_include/bt_target.h"
@@ -72,13 +73,6 @@ static void bta_av_accept_signalling_timer_cback(void* data);
#define AVRC_MIN_META_CMD_LEN 20
#endif

extern bool btif_av_is_source_enabled(void);
extern bool btif_av_both_enable(void);
extern bool btif_av_src_sink_coexist_enabled(void);
extern bool btif_av_is_sink_enabled(void);
extern bool btif_av_peer_is_connected_sink(const RawAddress& peer_address);
extern const RawAddress& btif_av_find_by_handle(tBTA_AV_HNDL bta_handle);

/*******************************************************************************
 *
 * Function         bta_av_get_rcb_by_shdl
+2 −2
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@
#include <cstdint>
#include <vector>

#include "bta/include/bta_av_api.h"
#include "include/hardware/bt_av.h"
#include "types/raw_address.h"

@@ -288,13 +289,12 @@ void btif_av_connect_sink_delayed(uint8_t handle, const RawAddress& peer_address
/**
 * Check whether A2DP Source is enabled.
 */
bool btif_av_is_source_enabled(void);
bool btif_av_both_enable(void);
bool btif_av_src_sink_coexist_enabled(void);
bool btif_av_is_sink_enabled(void);
bool btif_av_peer_is_connected_sink(const RawAddress& peer_address);
bool btif_av_peer_is_connected_source(const RawAddress& peer_address);
bool btif_av_peer_is_sink(const RawAddress& peer_address);
bool btif_av_peer_is_source(const RawAddress& peer_address);
const RawAddress& btif_av_find_by_handle(tBTA_AV_HNDL bta_handle);

#endif /* BTIF_AV_H */
+3 −5
Original line number Diff line number Diff line
@@ -54,9 +54,6 @@
#include "stack/include/btm_status.h"
#include "types/raw_address.h"

// TODO(b/369381361) Enfore -Wmissing-prototypes
#pragma GCC diagnostic ignored "-Wmissing-prototypes"

using bluetooth::audio::a2dp::BluetoothAudioStatus;
using bluetooth::common::A2dpSessionMetrics;
using bluetooth::common::BluetoothMetricsLogger;
@@ -269,7 +266,8 @@ static void btm_read_rssi_cb(void* data);
static void btm_read_failed_contact_counter_cb(void* data);
static void btm_read_tx_power_cb(void* data);

void btif_a2dp_source_accumulate_scheduling_stats(SchedulingStats* src, SchedulingStats* dst) {
static void btif_a2dp_source_accumulate_scheduling_stats(SchedulingStats* src,
                                                         SchedulingStats* dst) {
  dst->total_updates += src->total_updates;
  dst->last_update_us = src->last_update_us;
  dst->overdue_scheduling_count += src->overdue_scheduling_count;
@@ -284,7 +282,7 @@ void btif_a2dp_source_accumulate_scheduling_stats(SchedulingStats* src, Scheduli
  dst->total_scheduling_time_us += src->total_scheduling_time_us;
}

void btif_a2dp_source_accumulate_stats(BtifMediaStats* src, BtifMediaStats* dst) {
static void btif_a2dp_source_accumulate_stats(BtifMediaStats* src, BtifMediaStats* dst) {
  dst->tx_queue_total_frames += src->tx_queue_total_frames;
  dst->tx_queue_max_frames_per_packet =
          std::max(dst->tx_queue_max_frames_per_packet, src->tx_queue_max_frames_per_packet);
+4 −11
Original line number Diff line number Diff line
@@ -67,9 +67,6 @@
#include <android/sysprop/BluetoothProperties.sysprop.h>
#endif

// TODO(b/369381361) Enfore -Wmissing-prototypes
#pragma GCC diagnostic ignored "-Wmissing-prototypes"

using namespace bluetooth;

/*****************************************************************************
@@ -885,7 +882,7 @@ const RawAddress& btif_av_find_by_handle(tBTA_AV_HNDL bta_handle) {
 * Local helper functions
 *****************************************************************************/

const char* dump_av_sm_event_name(btif_av_sm_event_t event) {
static const char* dump_av_sm_event_name(btif_av_sm_event_t event) {
  switch (static_cast<int>(event)) {
    CASE_RETURN_STR(BTA_AV_ENABLE_EVT)
    CASE_RETURN_STR(BTA_AV_REGISTER_EVT)
@@ -929,10 +926,6 @@ const char* dump_av_sm_event_name(btif_av_sm_event_t event) {
  }
}

const char* dump_av_sm_event_name(int event) {
  return dump_av_sm_event_name(static_cast<btif_av_sm_event_t>(event));
}

BtifAvEvent::BtifAvEvent(uint32_t event, const void* p_data, size_t data_length)
    : event_(event), data_(nullptr), data_length_(0) {
  DeepCopy(event, p_data, data_length);
@@ -953,7 +946,7 @@ BtifAvEvent::~BtifAvEvent() { DeepFree(); }
std::string BtifAvEvent::ToString() const { return BtifAvEvent::EventName(event_); }

std::string BtifAvEvent::EventName(uint32_t event) {
  std::string name = dump_av_sm_event_name((btif_av_sm_event_t)event);
  std::string name = dump_av_sm_event_name(static_cast<btif_av_sm_event_t>(event));
  std::stringstream ss_value;
  ss_value << "(0x" << std::hex << event << ")";
  return name + ss_value.str();
@@ -3298,7 +3291,7 @@ static void btif_av_handle_bta_av_event(uint8_t peer_sep, const BtifAvEvent& bti

bool btif_av_both_enable(void) { return btif_av_sink.Enabled() && btif_av_source.Enabled(); }

bool is_a2dp_source_property_enabled(void) {
static bool is_a2dp_source_property_enabled(void) {
#ifdef __ANDROID__
  return android::sysprop::BluetoothProperties::isProfileA2dpSourceEnabled().value_or(false);
#else
@@ -3306,7 +3299,7 @@ bool is_a2dp_source_property_enabled(void) {
#endif
}

bool is_a2dp_sink_property_enabled(void) {
static bool is_a2dp_sink_property_enabled(void) {
#ifdef __ANDROID__
  return android::sysprop::BluetoothProperties::isProfileA2dpSinkEnabled().value_or(false);
#else
+0 −36
Original line number Diff line number Diff line
@@ -293,42 +293,6 @@ TEST_F(BtifCoreTest, test_post_on_bt_jni_simple3) {
  ASSERT_EQ(val, future.get());
}

extern const char* dump_av_sm_event_name(int event);
TEST_F(BtifUtilsTest, dump_av_sm_event_name) {
  std::vector<std::pair<int, std::string>> events = {
          std::make_pair(BTA_AV_ENABLE_EVT, "BTA_AV_ENABLE_EVT"),
          std::make_pair(BTA_AV_REGISTER_EVT, "BTA_AV_REGISTER_EVT"),
          std::make_pair(BTA_AV_OPEN_EVT, "BTA_AV_OPEN_EVT"),
          std::make_pair(BTA_AV_CLOSE_EVT, "BTA_AV_CLOSE_EVT"),
          std::make_pair(BTA_AV_START_EVT, "BTA_AV_START_EVT"),
          std::make_pair(BTA_AV_STOP_EVT, "BTA_AV_STOP_EVT"),
          std::make_pair(BTA_AV_PROTECT_REQ_EVT, "BTA_AV_PROTECT_REQ_EVT"),
          std::make_pair(BTA_AV_PROTECT_RSP_EVT, "BTA_AV_PROTECT_RSP_EVT"),
          std::make_pair(BTA_AV_RC_OPEN_EVT, "BTA_AV_RC_OPEN_EVT"),
          std::make_pair(BTA_AV_RC_CLOSE_EVT, "BTA_AV_RC_CLOSE_EVT"),
          std::make_pair(BTA_AV_RC_BROWSE_OPEN_EVT, "BTA_AV_RC_BROWSE_OPEN_EVT"),
          std::make_pair(BTA_AV_RC_BROWSE_CLOSE_EVT, "BTA_AV_RC_BROWSE_CLOSE_EVT"),
          std::make_pair(BTA_AV_REMOTE_CMD_EVT, "BTA_AV_REMOTE_CMD_EVT"),
          std::make_pair(BTA_AV_REMOTE_RSP_EVT, "BTA_AV_REMOTE_RSP_EVT"),
          std::make_pair(BTA_AV_VENDOR_CMD_EVT, "BTA_AV_VENDOR_CMD_EVT"),
          std::make_pair(BTA_AV_VENDOR_RSP_EVT, "BTA_AV_VENDOR_RSP_EVT"),
          std::make_pair(BTA_AV_RECONFIG_EVT, "BTA_AV_RECONFIG_EVT"),
          std::make_pair(BTA_AV_SUSPEND_EVT, "BTA_AV_SUSPEND_EVT"),
          std::make_pair(BTA_AV_PENDING_EVT, "BTA_AV_PENDING_EVT"),
          std::make_pair(BTA_AV_META_MSG_EVT, "BTA_AV_META_MSG_EVT"),
          std::make_pair(BTA_AV_REJECT_EVT, "BTA_AV_REJECT_EVT"),
          std::make_pair(BTA_AV_RC_FEAT_EVT, "BTA_AV_RC_FEAT_EVT"),
          std::make_pair(BTA_AV_RC_PSM_EVT, "BTA_AV_RC_PSM_EVT"),
          std::make_pair(BTA_AV_OFFLOAD_START_RSP_EVT, "BTA_AV_OFFLOAD_START_RSP_EVT"),
  };
  for (const auto& event : events) {
    ASSERT_EQ(event.second, dump_av_sm_event_name(event.first));
  }
  std::ostringstream oss;
  oss << "UNKNOWN_EVENT";
  ASSERT_EQ(oss.str(), dump_av_sm_event_name(std::numeric_limits<int>::max()));
}

TEST_F(BtifUtilsTest, dump_dm_search_event) {
  std::vector<std::pair<uint16_t, std::string>> events = {
          std::make_pair(BTA_DM_INQ_RES_EVT, "BTA_DM_INQ_RES_EVT"),
Loading