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


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


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


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


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


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


#define LOG_TAG "bluetooth"
#define LOG_TAG "bluetooth"


@@ -37,12 +38,13 @@
#include "bta/include/bta_gatt_queue.h"
#include "bta/include/bta_gatt_queue.h"
#include "bta/include/bta_hearing_aid_api.h"
#include "bta/include/bta_hearing_aid_api.h"
#include "btm_iso_api.h"
#include "btm_iso_api.h"
#include "device/include/controller.h"
#include "embdrv/g722/g722_enc_dec.h"
#include "embdrv/g722/g722_enc_dec.h"
#include "hal/link_clocker.h"
#include "hal/link_clocker.h"
#include "hardware/bt_gatt_types.h"
#include "hardware/bt_gatt_types.h"
#include "hci/controller_interface.h"
#include "include/check.h"
#include "include/check.h"
#include "internal_include/bt_trace.h"
#include "internal_include/bt_trace.h"
#include "main/shim/entry.h"
#include "os/log.h"
#include "os/log.h"
#include "osi/include/allocator.h"
#include "osi/include/allocator.h"
#include "osi/include/properties.h"
#include "osi/include/properties.h"
@@ -549,7 +551,7 @@ class HearingAidImpl : public HearingAid {
    hearingDevice->connection_update_status = STARTED;
    hearingDevice->connection_update_status = STARTED;
    hearingDevice->requested_connection_interval = UpdateBleConnParams(address);
    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));
      log::info("{} set preferred 2M PHY", ADDRESS_TO_LOGGABLE_CSTR(address));
      BTM_BleSetPhy(address, PHY_LE_2M, PHY_LE_2M, 0);
      BTM_BleSetPhy(address, PHY_LE_2M, PHY_LE_2M, 0);
    }
    }
@@ -1027,7 +1029,7 @@ class HearingAidImpl : public HearingAid {
    }
    }


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