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

Commit 7944f03b authored by Yi Xie's avatar Yi Xie Committed by Automerger Merge Worker
Browse files

Merge "Fix compiling with C++20" into main am: 2dce74e7 am: caa6f126 am:...

Merge "Fix compiling with C++20" into main am: 2dce74e7 am: caa6f126 am: 13d4dc9c am: ceee24c0

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/2751907



Change-Id: I0b650246dbd1e19795cee6f6f68e1fa67ebff8e1
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 7b6cd28c ceee24c0
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -113,7 +113,7 @@ config("target_defaults") {
                ]),
  ]

  cflags_cc = [ "-std=c++17" ]
  cflags_cc = [ "-std=c++20" ]

  defines = [
    "TARGET_FLOSS",
+2 −0
Original line number Diff line number Diff line
@@ -67,6 +67,7 @@ struct EventCallbacks {
                                        int packets_not_receive_count,
                                        int negative_acknowledgement_count);

  EventCallbacks() = default;
  EventCallbacks(const EventCallbacks&) = delete;
  EventCallbacks& operator=(const EventCallbacks&) = delete;
};
@@ -126,6 +127,7 @@ struct HACK_ProfileInterface {
  // AVRCP hacks
  uint16_t (*AVRC_GetProfileVersion)();

  HACK_ProfileInterface() = default;
  HACK_ProfileInterface(const HACK_ProfileInterface&) = delete;
  HACK_ProfileInterface& operator=(const HACK_ProfileInterface&) = delete;
};
+48 −31
Original line number Diff line number Diff line
@@ -328,44 +328,61 @@ struct CoreInterfaceImpl : bluetooth::core::CoreInterface {
};

static bluetooth::core::CoreInterface* CreateInterfaceToProfiles() {
  static auto eventCallbacks = bluetooth::core::EventCallbacks{
      .invoke_adapter_state_changed_cb = invoke_adapter_state_changed_cb,
      .invoke_adapter_properties_cb = invoke_adapter_properties_cb,
      .invoke_remote_device_properties_cb = invoke_remote_device_properties_cb,
      .invoke_device_found_cb = invoke_device_found_cb,
      .invoke_discovery_state_changed_cb = invoke_discovery_state_changed_cb,
      .invoke_pin_request_cb = invoke_pin_request_cb,
      .invoke_ssp_request_cb = invoke_ssp_request_cb,
      .invoke_oob_data_request_cb = invoke_oob_data_request_cb,
      .invoke_bond_state_changed_cb = invoke_bond_state_changed_cb,
      .invoke_address_consolidate_cb = invoke_address_consolidate_cb,
      .invoke_le_address_associate_cb = invoke_le_address_associate_cb,
      .invoke_acl_state_changed_cb = invoke_acl_state_changed_cb,
      .invoke_thread_evt_cb = invoke_thread_evt_cb,
      .invoke_le_test_mode_cb = invoke_le_test_mode_cb,
      .invoke_energy_info_cb = invoke_energy_info_cb,
      .invoke_link_quality_report_cb = invoke_link_quality_report_cb};
  static auto eventCallbacks = bluetooth::core::EventCallbacks();
  static bool eventCallbacks_initialized;
  if (!eventCallbacks_initialized) {
    eventCallbacks.invoke_adapter_state_changed_cb =
        invoke_adapter_state_changed_cb;
    eventCallbacks.invoke_adapter_properties_cb = invoke_adapter_properties_cb;
    eventCallbacks.invoke_remote_device_properties_cb =
        invoke_remote_device_properties_cb;
    eventCallbacks.invoke_device_found_cb = invoke_device_found_cb;
    eventCallbacks.invoke_discovery_state_changed_cb =
        invoke_discovery_state_changed_cb;
    eventCallbacks.invoke_pin_request_cb = invoke_pin_request_cb;
    eventCallbacks.invoke_ssp_request_cb = invoke_ssp_request_cb;
    eventCallbacks.invoke_oob_data_request_cb = invoke_oob_data_request_cb;
    eventCallbacks.invoke_bond_state_changed_cb = invoke_bond_state_changed_cb;
    eventCallbacks.invoke_address_consolidate_cb =
        invoke_address_consolidate_cb;
    eventCallbacks.invoke_le_address_associate_cb =
        invoke_le_address_associate_cb;
    eventCallbacks.invoke_acl_state_changed_cb = invoke_acl_state_changed_cb;
    eventCallbacks.invoke_thread_evt_cb = invoke_thread_evt_cb;
    eventCallbacks.invoke_le_test_mode_cb = invoke_le_test_mode_cb;
    eventCallbacks.invoke_energy_info_cb = invoke_energy_info_cb;
    eventCallbacks.invoke_link_quality_report_cb =
        invoke_link_quality_report_cb;

    eventCallbacks_initialized = true;
  }
  static auto configInterface = ConfigInterfaceImpl();
  static auto msbcCodecInterface = MSBCCodec();
  static auto lc3CodecInterface = LC3Codec();
  static auto profileInterface = bluetooth::core::HACK_ProfileInterface{
  static auto profileInterface = bluetooth::core::HACK_ProfileInterface();
  static bool profileInterface_initialized;
  if (!profileInterface_initialized) {
    // HID
      .btif_hh_connect = btif_hh_connect,
      .btif_hh_virtual_unplug = btif_hh_virtual_unplug,
      .bta_hh_read_ssr_param = bta_hh_read_ssr_param,
    profileInterface.btif_hh_connect = btif_hh_connect;
    profileInterface.btif_hh_virtual_unplug = btif_hh_virtual_unplug;
    profileInterface.bta_hh_read_ssr_param = bta_hh_read_ssr_param;

    // AVDTP
      .btif_av_set_dynamic_audio_buffer_size =
          btif_av_set_dynamic_audio_buffer_size,
    profileInterface.btif_av_set_dynamic_audio_buffer_size =
        btif_av_set_dynamic_audio_buffer_size;

    // ASHA
      .GetHearingAidDeviceCount = HearingAid::GetDeviceCount,
    profileInterface.GetHearingAidDeviceCount = HearingAid::GetDeviceCount;

    // LE Audio
      .IsLeAudioClientRunning = LeAudioClient::IsLeAudioClientRunning,
    profileInterface.IsLeAudioClientRunning =
        LeAudioClient::IsLeAudioClientRunning;

    // AVRCP
      .AVRC_GetProfileVersion = AVRC_GetProfileVersion};
    profileInterface.AVRC_GetProfileVersion = AVRC_GetProfileVersion;

    profileInterface_initialized = true;
  }

  static auto interfaceForCore =
      CoreInterfaceImpl(&eventCallbacks, &configInterface, &msbcCodecInterface,
+1 −1
Original line number Diff line number Diff line
@@ -41,7 +41,7 @@ fn main() {
    }

    // "-x" and "c++" must be separate due to a bug
    let clang_args: Vec<&str> = vec!["-x", "c++", "-std=c++17"];
    let clang_args: Vec<&str> = vec!["-x", "c++", "-std=c++20"];

    // The bindgen::Builder is the main entry point
    // to bindgen, and lets you build up options for
+5 −2
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@
#include <cstdint>
#include <list>
#include <memory>
#include <type_traits>
#include <vector>

#include "bta/include/bta_api.h"
@@ -1610,8 +1611,10 @@ static uint8_t btm_set_conn_mode_adv_init_addr(

    evt_type = p_cb->directed_conn;

    if (p_cb->directed_conn == BTM_BLE_CONNECT_DIR_EVT ||
        p_cb->directed_conn == BTM_BLE_CONNECT_LO_DUTY_DIR_EVT) {
    if (static_cast<std::underlying_type_t<tBTM_BLE_EVT>>(
            p_cb->directed_conn) == BTM_BLE_CONNECT_DIR_EVT ||
        static_cast<std::underlying_type_t<tBTM_BLE_EVT>>(
            p_cb->directed_conn) == BTM_BLE_CONNECT_LO_DUTY_DIR_EVT) {
      /* for privacy 1.2, convert peer address as static, own address set as ID
       * addr */
      if (btm_cb.ble_ctr_cb.privacy_mode == BTM_PRIVACY_1_2 ||
Loading