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

Commit e8b46a41 authored by Jeremy Wu's avatar Jeremy Wu Committed by Automerger Merge Worker
Browse files

Merge "Floss: return codec format instead of codec ids on device connection"...

Merge "Floss: return codec format instead of codec ids on device connection" into main am: 31d3970d

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



Change-Id: Id4e18a1f8aba361b0e909638199c5bebb658102b
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 930a9148 31d3970d
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -87,6 +87,7 @@
#include "common/metrics.h"
#include "common/os_utils.h"
#include "device/include/device_iot_config.h"
#include "device/include/esco_parameters.h"
#include "device/include/interop.h"
#include "device/include/interop_config.h"
#include "include/check.h"
@@ -489,6 +490,10 @@ static bool get_swb_supported() {
  return hfp_hal_interface::get_swb_supported();
}

static bool is_coding_format_supported(esco_coding_format_t coding_format) {
  return hfp_hal_interface::is_coding_format_supported(coding_format);
}

bool is_common_criteria_mode() {
  return is_bluetooth_uid() && common_criteria_mode;
}
@@ -1205,6 +1210,7 @@ EXPORT_SYMBOL bt_interface_t bluetoothInterface = {
        set_event_filter_connection_setup_all_devices,
    .get_wbs_supported = get_wbs_supported,
    .get_swb_supported = get_swb_supported,
    .is_coding_format_supported = is_coding_format_supported,
    .metadata_changed = metadata_changed,
    .interop_match_addr = interop_match_addr,
    .interop_match_name = interop_match_name,
+12 −4
Original line number Diff line number Diff line
@@ -10,7 +10,7 @@ use bt_topshim::profiles::a2dp::{
};
use bt_topshim::profiles::avrcp::PlayerMetadata;
use bt_topshim::profiles::gatt::{AdvertisingStatus, GattStatus, LePhy};
use bt_topshim::profiles::hfp::HfpCodecCapability;
use bt_topshim::profiles::hfp::{EscoCodingFormat, HfpCodecBitId, HfpCodecFormat};
use bt_topshim::profiles::hid_host::BthhReportType;
use bt_topshim::profiles::sdp::{
    BtSdpDipRecord, BtSdpHeaderOverlay, BtSdpMasRecord, BtSdpMnsRecord, BtSdpMpsRecord,
@@ -435,13 +435,16 @@ impl_dbus_arg_from_into!(A2dpCodecSampleRate, i32);
impl_dbus_arg_from_into!(A2dpCodecBitsPerSample, i32);
impl_dbus_arg_from_into!(A2dpCodecChannelMode, i32);

impl_dbus_arg_from_into!(HfpCodecCapability, i32);
impl_dbus_arg_from_into!(EscoCodingFormat, u8);
impl_dbus_arg_from_into!(HfpCodecBitId, i32);
impl_dbus_arg_from_into!(HfpCodecFormat, i32);

#[dbus_propmap(BluetoothAudioDevice)]
pub struct BluetoothAudioDeviceDBus {
    address: String,
    name: String,
    a2dp_caps: Vec<A2dpCodecConfig>,
    hfp_cap: HfpCodecCapability,
    hfp_cap: HfpCodecFormat,
    absolute_volume: bool,
}

@@ -1001,6 +1004,11 @@ impl IBluetooth for BluetoothDBus {
    fn get_supported_roles(&self) -> Vec<BtAdapterRole> {
        dbus_generated!()
    }

    #[dbus_method("IsCodingFormatSupported")]
    fn is_coding_format_supported(&self, coding_format: EscoCodingFormat) -> bool {
        dbus_generated!()
    }
}

pub(crate) struct BluetoothQALegacyDBus {
@@ -2656,7 +2664,7 @@ impl IBluetoothMedia for BluetoothMediaDBus {
        &mut self,
        address: String,
        sco_offload: bool,
        disabled_codecs: HfpCodecCapability,
        disabled_codecs: HfpCodecBitId,
    ) -> bool {
        dbus_generated!()
    }
+8 −0
Original line number Diff line number Diff line
@@ -5,6 +5,8 @@ use bt_topshim::btif::{
use bt_topshim::profiles::socket::SocketType;
use bt_topshim::profiles::ProfileConnectionState;

use bt_topshim::profiles::hfp::EscoCodingFormat;

use bt_topshim::profiles::hid_host::BthhReportType;

use bt_topshim::profiles::sdp::{
@@ -424,6 +426,7 @@ impl DBusArg for BtSdpRecord {
}

impl_dbus_arg_enum!(BtDiscMode);
impl_dbus_arg_from_into!(EscoCodingFormat, u8);

#[allow(dead_code)]
struct IBluetoothDBus {}
@@ -712,6 +715,11 @@ impl IBluetooth for IBluetoothDBus {
    fn get_supported_roles(&self) -> Vec<BtAdapterRole> {
        dbus_generated!()
    }

    #[dbus_method("IsCodingFormatSupported", DBusLog::Disable)]
    fn is_coding_format_supported(&self, coding_format: EscoCodingFormat) -> bool {
        dbus_generated!()
    }
}

impl_dbus_arg_enum!(SocketType);
+5 −4
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@ use bt_topshim::profiles::a2dp::{
    A2dpCodecSampleRate, PresentationPosition,
};
use bt_topshim::profiles::avrcp::PlayerMetadata;
use bt_topshim::profiles::hfp::HfpCodecCapability;
use bt_topshim::profiles::hfp::{HfpCodecBitId, HfpCodecFormat};
use btstack::bluetooth_media::{BluetoothAudioDevice, IBluetoothMedia, IBluetoothMediaCallback};
use btstack::RPCProxy;

@@ -43,11 +43,12 @@ pub struct BluetoothAudioDeviceDBus {
    address: String,
    name: String,
    a2dp_caps: Vec<A2dpCodecConfig>,
    hfp_cap: HfpCodecCapability,
    hfp_cap: HfpCodecFormat,
    absolute_volume: bool,
}

impl_dbus_arg_from_into!(HfpCodecCapability, i32);
impl_dbus_arg_from_into!(HfpCodecBitId, i32);
impl_dbus_arg_from_into!(HfpCodecFormat, i32);
impl_dbus_arg_enum!(A2dpCodecIndex);
impl_dbus_arg_from_into!(A2dpCodecSampleRate, i32);
impl_dbus_arg_from_into!(A2dpCodecBitsPerSample, i32);
@@ -254,7 +255,7 @@ impl IBluetoothMedia for IBluetoothMediaDBus {
        &mut self,
        address: String,
        sco_offload: bool,
        disabled_codecs: HfpCodecCapability,
        disabled_codecs: HfpCodecBitId,
    ) -> bool {
        dbus_generated!()
    }
+8 −0
Original line number Diff line number Diff line
@@ -10,6 +10,7 @@ use bt_topshim::btif::{
use bt_topshim::{
    controller, metrics,
    profiles::gatt::GattStatus,
    profiles::hfp::EscoCodingFormat,
    profiles::hid_host::{
        BthhConnectionState, BthhHidInfo, BthhProtocolMode, BthhReportType, BthhStatus,
        HHCallbacks, HHCallbacksDispatcher, HidHost,
@@ -251,6 +252,9 @@ pub trait IBluetooth {

    /// Returns a list of all the roles that are supported.
    fn get_supported_roles(&self) -> Vec<BtAdapterRole>;

    /// Returns whether the coding format is supported.
    fn is_coding_format_supported(&self, coding_format: EscoCodingFormat) -> bool;
}

/// Adapter API for Bluetooth qualification and verification.
@@ -2797,6 +2801,10 @@ impl IBluetooth for Bluetooth {

        roles
    }

    fn is_coding_format_supported(&self, coding_format: EscoCodingFormat) -> bool {
        self.intf.lock().unwrap().is_coding_format_supported(coding_format as u8)
    }
}

impl BtifSdpCallbacks for Bluetooth {
Loading