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

Commit c7a43ce9 authored by Myles Watson's avatar Myles Watson Committed by Gerrit Code Review
Browse files

Merge "Use GD Controller for SupportsBle" into main

parents 50885c25 2b41e879
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -226,6 +226,7 @@ cc_library_static {
cc_test {
    name: "net_test_bta",
    defaults: [
        "bluetooth_flatbuffer_bundler_defaults",
        "fluoride_bta_defaults",
        "latest_android_hardware_audio_common_ndk_static",
        "latest_android_hardware_bluetooth_audio_ndk_static",
@@ -749,6 +750,7 @@ cc_test {
    name: "bluetooth_le_audio_codec_manager_test",
    test_suites: ["general-tests"],
    defaults: [
        "bluetooth_flatbuffer_bundler_defaults",
        "fluoride_defaults",
        "mts_defaults",
    ],
@@ -777,6 +779,8 @@ cc_test {
        ":TestCommonMockFunctions",
        ":TestMockBtaLeAudioHalVerifier",
        ":TestMockLegacyHciInterface",
        ":TestMockMainShim",
        ":TestMockMainShimEntry",
        ":TestStubOsi",
        "le_audio/broadcaster/broadcast_configuration_provider.cc",
        "le_audio/codec_manager.cc",
@@ -793,6 +797,7 @@ cc_test {
        ":audio_set_scenarios_json",
    ],
    generated_headers: [
        "BluetoothGeneratedDumpsysDataSchema_h",
        "LeAudioSetConfigSchemas_h",
    ],
    shared_libs: [
@@ -806,6 +811,7 @@ cc_test {
        "libbluetooth_gd",
        "libbluetooth_log",
        "libbt-common",
        "libbt-platform-protos-lite",
        "libbt_shim_bridge",
        "libbt_shim_ffi",
        "libchrome",
@@ -825,6 +831,7 @@ cc_test {
    name: "bluetooth_le_audio_test",
    test_suites: ["general-tests"],
    defaults: [
        "bluetooth_flatbuffer_bundler_defaults",
        "fluoride_defaults",
        "mts_defaults",
    ],
@@ -934,6 +941,7 @@ cc_test {
    name: "bluetooth_le_audio_client_test",
    test_suites: ["general-tests"],
    defaults: [
        "bluetooth_flatbuffer_bundler_defaults",
        "fluoride_bta_defaults",
        "mts_defaults",
    ],
@@ -1115,6 +1123,7 @@ cc_test {
    name: "bluetooth_test_broadcaster",
    test_suites: ["general-tests"],
    defaults: [
        "bluetooth_flatbuffer_bundler_defaults",
        "fluoride_bta_defaults",
        "mts_defaults",
    ],
@@ -1130,6 +1139,8 @@ cc_test {
    srcs: [
        ":TestCommonMockFunctions",
        ":TestCommonStackConfig",
        ":TestMockMainShim",
        ":TestMockMainShimEntry",
        ":TestMockStackBtmIso",
        ":TestStubOsi",
        "le_audio/broadcaster/broadcaster.cc",
@@ -1153,13 +1164,17 @@ cc_test {
    ],
    static_libs: [
        "libbluetooth-types",
        "libbluetooth_gd",
        "libbluetooth_hci_pdl",
        "libbluetooth_log",
        "libbt-audio-hal-interface",
        "libbt-common",
        "libbt-platform-protos-lite",
        "libbt_shim_bridge",
        "libbt_shim_ffi",
        "libchrome",
        "libevent",
        "libflatbuffers-cpp",
        "libgmock",
        "libgtest",
        "liblc3",
+11 −9
Original line number Diff line number Diff line
@@ -33,9 +33,10 @@
#include "bta/ag/bta_ag_int.h"
#include "bta_ag_swb_aptx.h"
#include "common/init_flags.h"
#include "device/include/controller.h"
#include "hci/controller_interface.h"
#include "internal_include/bt_target.h"
#include "internal_include/bt_trace.h"
#include "main/shim/entry.h"
#include "os/log.h"
#include "osi/include/osi.h"  // UNUSED_ATTR
#include "stack/btm/btm_int_types.h"
@@ -222,8 +223,8 @@ static void bta_ag_sco_disc_cback(uint16_t sco_idx) {
    if (bta_ag_cb.sco.p_curr_scb->inuse_codec == UUID_CODEC_MSBC ||
        bta_ag_cb.sco.p_curr_scb->inuse_codec == UUID_CODEC_LC3 || aptx_voice) {
      /* Bypass vendor specific and voice settings if enhanced eSCO supported */
      if (!(controller_get_interface()
                ->supports_enhanced_setup_synchronous_connection())) {
      if (!(bluetooth::shim::GetController()->IsSupported(
              bluetooth::hci::OpCode::ENHANCED_SETUP_SYNCHRONOUS_CONNECTION))) {
        BTM_WriteVoiceSettings(BTM_VOICE_SETTING_CVSD);
      }

@@ -631,8 +632,8 @@ void bta_ag_create_pending_sco(tBTA_AG_SCB* p_scb, bool is_local) {
    }

    /* Bypass voice settings if enhanced SCO setup command is supported */
    if (!(controller_get_interface()
              ->supports_enhanced_setup_synchronous_connection())) {
    if (!(bluetooth::shim::GetController()->IsSupported(
            bluetooth::hci::OpCode::ENHANCED_SETUP_SYNCHRONOUS_CONNECTION))) {
      if (esco_codec == UUID_CODEC_MSBC || esco_codec == UUID_CODEC_LC3) {
        BTM_WriteVoiceSettings(BTM_VOICE_SETTING_TRANS);
      } else {
@@ -1567,9 +1568,10 @@ void bta_ag_sco_conn_rsp(tBTA_AG_SCB* p_scb,
                         tBTM_ESCO_CONN_REQ_EVT_DATA* p_data) {
  bta_ag_cb.sco.is_local = false;

  log::verbose("eSCO {}, state {}",
               controller_get_interface()
                   ->supports_enhanced_setup_synchronous_connection(),
  log::verbose(
      "eSCO {}, state {}",
      bluetooth::shim::GetController()->IsSupported(
          bluetooth::hci::OpCode::ENHANCED_SETUP_SYNCHRONOUS_CONNECTION),
      bta_ag_cb.sco.state);

  if (bta_ag_cb.sco.state == BTA_AG_SCO_LISTEN_ST ||
+3 −1
Original line number Diff line number Diff line
@@ -36,8 +36,10 @@
#include "btif/include/btif_debug_conn.h"
#include "device/include/controller.h"
#include "hardware/bt_gatt_types.h"
#include "hci/controller_interface.h"
#include "include/check.h"
#include "internal_include/bt_trace.h"
#include "main/shim/entry.h"
#include "os/log.h"
#include "osi/include/allocator.h"
#include "osi/include/osi.h"  // UNUSED_ATTR
@@ -226,7 +228,7 @@ void bta_gattc_register(const Uuid& app_uuid, tBTA_GATTC_CBACK* p_cback,
/** De-Register a GATT client application with BTA */
void bta_gattc_deregister(tBTA_GATTC_RCB* p_clreg) {
  uint8_t accept_list_size = 0;
  if (controller_get_interface()->SupportsBle()) {
  if (bluetooth::shim::GetController()->SupportsBle()) {
    accept_list_size = controller_get_interface()->get_ble_acceptlist_size();
  }

+3 −1
Original line number Diff line number Diff line
@@ -32,8 +32,10 @@
#include "bta/gatt/bta_gattc_int.h"
#include "common/init_flags.h"
#include "device/include/controller.h"
#include "hci/controller_interface.h"
#include "internal_include/bt_target.h"
#include "internal_include/bt_trace.h"
#include "main/shim/entry.h"
#include "os/log.h"
#include "osi/include/allocator.h"
#include "types/bt_transport.h"
@@ -44,7 +46,7 @@ using namespace bluetooth;

static uint8_t ble_acceptlist_size() {
  const controller_t* controller = controller_get_interface();
  if (!controller->SupportsBle()) {
  if (!bluetooth::shim::GetController()->SupportsBle()) {
    return 0;
  }
  return controller->get_ble_acceptlist_size();
+5 −3
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
 ******************************************************************************/

#include "bta_hearing_aid_api.h"
#include "main/shim/entry.h"

#define LOG_TAG "bluetooth"

@@ -37,12 +38,13 @@
#include "bta/include/bta_gatt_queue.h"
#include "bta/include/bta_hearing_aid_api.h"
#include "btm_iso_api.h"
#include "device/include/controller.h"
#include "embdrv/g722/g722_enc_dec.h"
#include "hal/link_clocker.h"
#include "hardware/bt_gatt_types.h"
#include "hci/controller_interface.h"
#include "include/check.h"
#include "internal_include/bt_trace.h"
#include "main/shim/entry.h"
#include "os/log.h"
#include "osi/include/allocator.h"
#include "osi/include/properties.h"
@@ -549,7 +551,7 @@ class HearingAidImpl : public HearingAid {
    hearingDevice->connection_update_status = STARTED;
    hearingDevice->requested_connection_interval = UpdateBleConnParams(address);

    if (controller_get_interface()->SupportsBle2mPhy()) {
    if (bluetooth::shim::GetController()->SupportsBle2mPhy()) {
      log::info("{} set preferred 2M PHY", ADDRESS_TO_LOGGABLE_CSTR(address));
      BTM_BleSetPhy(address, PHY_LE_2M, PHY_LE_2M, 0);
    }
@@ -1027,7 +1029,7 @@ class HearingAidImpl : public HearingAid {
    }

    if ((codecs & (1 << CODEC_G722_24KHZ)) &&
        controller_get_interface()->SupportsBle2mPhy() &&
        bluetooth::shim::GetController()->SupportsBle2mPhy() &&
        default_data_interval_ms == HA_INTERVAL_10_MS) {
      codec_in_use = CODEC_G722_24KHZ;
    } else if (codecs & (1 << CODEC_G722_16KHZ)) {
Loading