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

Commit 9369d1ca authored by Henri Chataing's avatar Henri Chataing
Browse files

system/btif: Fix -Wmissing-prototypes errors

Bug: 369381361
Test: m com.android.btservices
Flag: EXEMPT, minor fixes
Change-Id: I53bf7520860a7d348298f1b85d75f3da8f6844d7
parent eb065ba6
Loading
Loading
Loading
Loading
+25 −0
Original line number Diff line number Diff line
/******************************************************************************
 *
 *  Copyright 2024 Google, LLC.
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at:
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *
 ******************************************************************************/

#pragma once

#include <hardware/bluetooth.h>
#include <hardware/bt_hf_client.h>

const bthf_client_interface_t* btif_hf_client_get_interface();
bt_status_t btif_hf_client_execute_service(bool b_enable);
+1 −3
Original line number Diff line number Diff line
@@ -70,6 +70,7 @@
#include "btif/include/btif_dm.h"
#include "btif/include/btif_hd.h"
#include "btif/include/btif_hf.h"
#include "btif/include/btif_hf_client.h"
#include "btif/include/btif_hh.h"
#include "btif/include/btif_keystore.h"
#include "btif/include/btif_metrics_logging.h"
@@ -161,8 +162,6 @@ bool is_local_device_atv = false;

/* list all extended interfaces here */

/* handsfree profile - client */
extern const bthf_client_interface_t* btif_hf_client_get_interface();
/*rfc l2cap*/
extern const btsock_interface_t* btif_sock_get_interface();
/* hid host profile */
@@ -194,7 +193,6 @@ extern VolumeControlInterface* btif_volume_control_get_interface();

bt_status_t btif_av_sink_execute_service(bool b_enable);
bt_status_t btif_hh_execute_service(bool b_enable);
bt_status_t btif_hf_client_execute_service(bool b_enable);
bt_status_t btif_hd_execute_service(bool b_enable);

extern void gatt_tcb_dump(int fd);
+5 −8
Original line number Diff line number Diff line
@@ -27,6 +27,8 @@

#define LOG_TAG "bt_btif_hf"

#include "btif/include/btif_hf.h"

#include <android_bluetooth_sysprop.h>
#include <base/functional/callback.h>
#include <bluetooth/log.h>
@@ -55,15 +57,11 @@
#include "stack/include/btm_log_history.h"
#include "types/raw_address.h"

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

namespace {
constexpr char kBtmLogTag[] = "HFP";
}

namespace bluetooth {
namespace headset {
namespace bluetooth::headset {

/*******************************************************************************
 *  Constants & Macros
@@ -271,7 +269,7 @@ static bool is_nth_bit_enabled(uint32_t value, int n) {
  return (value & (static_cast<uint32_t>(1) << n)) != 0;
}

void clear_phone_state_multihf(btif_hf_cb_t* hf_cb) {
static void clear_phone_state_multihf(btif_hf_cb_t* hf_cb) {
  hf_cb->call_setup_state = BTHF_CALL_STATE_IDLE;
  hf_cb->num_active = 0;
  hf_cb->num_held = 0;
@@ -1622,5 +1620,4 @@ Interface* GetInterface() {
  return HeadsetInterface::GetInstance();
}

}  // namespace headset
}  // namespace bluetooth
}  // namespace bluetooth::headset
+7 −33
Original line number Diff line number Diff line
@@ -42,9 +42,9 @@
 *
 ******************************************************************************/

#ifndef LOG_TAG
#define LOG_TAG "bt_btif_hfc"
#endif

#include "btif_hf_client.h"

#include <bluetooth/log.h>
#include <hardware/bluetooth.h>
@@ -68,9 +68,6 @@
#define BTIF_HF_CLIENT_SERVICE_NAME ("Handsfree")
#endif

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

using namespace bluetooth;

/*******************************************************************************
@@ -94,9 +91,8 @@ typedef struct {
/******************************************************************************
 * Local function declarations
 ******************************************************************************/
btif_hf_client_cb_t* btif_hf_client_get_cb_by_handle(uint16_t handle);
btif_hf_client_cb_t* btif_hf_client_get_cb_by_bda(const RawAddress& addr);
bool is_connected(const btif_hf_client_cb_t* cb);
static btif_hf_client_cb_t* btif_hf_client_get_cb_by_bda(const RawAddress& addr);
static bool is_connected(const btif_hf_client_cb_t* cb);

/*******************************************************************************
 *  Static variables
@@ -183,7 +179,7 @@ static void btif_in_hf_client_generic_evt(uint16_t event, char* p_param) {
/*******************************************************************************
 *  Functions
 ******************************************************************************/
bool is_connected(const btif_hf_client_cb_t* cb) {
static bool is_connected(const btif_hf_client_cb_t* cb) {
  if ((cb->state == BTHF_CLIENT_CONNECTION_STATE_CONNECTED) ||
      (cb->state == BTHF_CLIENT_CONNECTION_STATE_SLC_CONNECTED)) {
    return true;
@@ -193,28 +189,6 @@ bool is_connected(const btif_hf_client_cb_t* cb) {
  return false;
}

/*******************************************************************************
 *
 * Function        btif_hf_client_get_cb_by_handle
 *
 * Description     Get control block by handle
 *
 * Returns         btif_hf_client_cb_t pointer if available NULL otherwise
 *
 ******************************************************************************/
btif_hf_client_cb_t* btif_hf_client_get_cb_by_handle(uint16_t handle) {
  log::verbose("cb by handle {}", handle);
  for (int i = 0; i < HF_CLIENT_MAX_DEVICES; i++) {
    // Block is valid only if it is allocated i.e. state is not DISCONNECTED
    if (btif_hf_client_cb_arr.cb[i].state != BTHF_CLIENT_CONNECTION_STATE_DISCONNECTED &&
        btif_hf_client_cb_arr.cb[i].handle == handle) {
      return &btif_hf_client_cb_arr.cb[i];
    }
  }
  log::error("could not find block for handle {}", handle);
  return NULL;
}

/*******************************************************************************
 *
 * Function        btif_hf_client_get_cb_by_bda
@@ -224,7 +198,7 @@ btif_hf_client_cb_t* btif_hf_client_get_cb_by_handle(uint16_t handle) {
 * Returns         btif_hf_client_cb_t pointer if available NULL otherwise
 *
 ******************************************************************************/
btif_hf_client_cb_t* btif_hf_client_get_cb_by_bda(const RawAddress& bd_addr) {
static btif_hf_client_cb_t* btif_hf_client_get_cb_by_bda(const RawAddress& bd_addr) {
  log::verbose("incoming addr {}", bd_addr);

  for (int i = 0; i < HF_CLIENT_MAX_DEVICES; i++) {
@@ -247,7 +221,7 @@ btif_hf_client_cb_t* btif_hf_client_get_cb_by_bda(const RawAddress& bd_addr) {
 * Returns         btif_hf_client_cb_t pointer if available NULL otherwise
 *
 ******************************************************************************/
btif_hf_client_cb_t* btif_hf_client_allocate_cb() {
static btif_hf_client_cb_t* btif_hf_client_allocate_cb() {
  for (int i = 0; i < HF_CLIENT_MAX_DEVICES; i++) {
    btif_hf_client_cb_t* cb = &btif_hf_client_cb_arr.cb[i];
    if (cb->state == BTHF_CLIENT_CONNECTION_STATE_DISCONNECTED) {