Loading system/gd/rust/linux/client/src/command_handler.rs +4 −0 Original line number Diff line number Diff line Loading @@ -889,6 +889,7 @@ impl CommandHandler { uuids, wake_allowed, dual_mode_audio, le_audio_stable, ) = { let ctx = self.lock_context(); let adapter = ctx.adapter_dbus.as_ref().unwrap(); Loading @@ -908,6 +909,7 @@ impl CommandHandler { let uuids = adapter.get_remote_uuids(device.clone()); let wake_allowed = adapter.get_remote_wake_allowed(device.clone()); let dual_mode_audio = adapter.is_dual_mode_audio_sink_device(device.clone()); let le_audio_stable = adapter.is_le_audio_stable(device.clone()); ( name, Loading @@ -921,6 +923,7 @@ impl CommandHandler { uuids, wake_allowed, dual_mode_audio, le_audio_stable, ) }; Loading @@ -935,6 +938,7 @@ impl CommandHandler { print_info!("Bond State: {:?}", bonded); print_info!("Connection State: {}", connection_state); print_info!("Dual Mode Audio Device: {}", dual_mode_audio); print_info!("Is LE Audio Stable: {}", le_audio_stable); print_info!( "Uuids: {}", DisplayList( Loading system/gd/rust/linux/client/src/dbus_iface.rs +5 −0 Original line number Diff line number Diff line Loading @@ -1036,6 +1036,11 @@ impl IBluetooth for BluetoothDBus { dbus_generated!() } #[dbus_method("IsLEAudioStable")] fn is_le_audio_stable(&self, device: BluetoothDevice) -> bool { dbus_generated!() } #[dbus_method("GetDumpsys")] fn get_dumpsys(&self) -> String { dbus_generated!() Loading system/gd/rust/linux/service/src/iface_bluetooth.rs +5 −0 Original line number Diff line number Diff line Loading @@ -771,6 +771,11 @@ impl IBluetooth for IBluetoothDBus { dbus_generated!() } #[dbus_method("IsLEAudioStable", DBusLog::Disable)] fn is_le_audio_stable(&self, device: BluetoothDevice) -> bool { dbus_generated!() } #[dbus_method("GetDumpsys", DBusLog::Disable)] fn get_dumpsys(&self) -> String { dbus_generated!() Loading system/gd/rust/linux/stack/src/bluetooth.rs +18 −1 Original line number Diff line number Diff line Loading @@ -17,7 +17,7 @@ use bt_topshim::{ }, profiles::sdp::{BtSdpRecord, Sdp, SdpCallbacks, SdpCallbacksDispatcher}, profiles::ProfileConnectionState, topstack, sysprop, topstack, }; use bt_utils::array_utils; Loading Loading @@ -265,6 +265,9 @@ pub trait IBluetooth { /// LE Audio sink roles). fn is_dual_mode_audio_sink_device(&self, device: BluetoothDevice) -> bool; /// Returns whether the remote device is LE audio stable. fn is_le_audio_stable(&self, device: BluetoothDevice) -> bool; /// Gets diagnostic output. fn get_dumpsys(&self) -> String; } Loading Loading @@ -3004,6 +3007,20 @@ impl IBluetooth for Bluetooth { }) } fn is_le_audio_stable(&self, device: BluetoothDevice) -> bool { let model_name = match self.get_remote_device_property(&device, &BtPropertyType::RemoteModelName) { Some(BluetoothProperty::RemoteModelName(name)) => name, _ => { return false; } }; sysprop::get_string(sysprop::PropertyString::LeAudioAllowList) .split(",") .any(|model| model == model_name) } fn get_dumpsys(&self) -> String { NamedTempFile::new() .and_then(|file| { Loading system/gd/rust/topshim/src/btif.rs +10 −1 Original line number Diff line number Diff line Loading @@ -167,7 +167,7 @@ pub enum BtPropertyType { // Unimplemented: // BT_PROPERTY_REMOTE_ASHA_CAPABILITY, // BT_PROPERTY_REMOTE_ASHA_TRUNCATED_HISYNCID, // BT_PROPERTY_REMOTE_MODEL_NUM, RemoteModelName = 0x17, RemoteAddrType = 0x18, Unknown = 0xFE, Loading Loading @@ -586,6 +586,7 @@ pub enum BluetoothProperty { RemoteIsCoordinatedSetMember(bool), Appearance(u16), VendorProductInfo(BtVendorProductInfo), RemoteModelName(String), RemoteAddrType(BtAddrType), RemoteDeviceTimestamp(), Loading Loading @@ -630,6 +631,7 @@ impl BluetoothProperty { BluetoothProperty::Appearance(_) => BtPropertyType::Appearance, BluetoothProperty::VendorProductInfo(_) => BtPropertyType::VendorProductInfo, BluetoothProperty::RemoteDeviceTimestamp() => BtPropertyType::RemoteDeviceTimestamp, BluetoothProperty::RemoteModelName(_) => BtPropertyType::RemoteModelName, BluetoothProperty::RemoteAddrType(_) => BtPropertyType::RemoteAddrType, BluetoothProperty::Unknown() => BtPropertyType::Unknown, } Loading Loading @@ -661,6 +663,7 @@ impl BluetoothProperty { BluetoothProperty::RemoteIsCoordinatedSetMember(_) => mem::size_of::<bool>(), BluetoothProperty::Appearance(_) => mem::size_of::<u16>(), BluetoothProperty::VendorProductInfo(_) => mem::size_of::<BtVendorProductInfo>(), BluetoothProperty::RemoteModelName(name) => name.len(), BluetoothProperty::RemoteAddrType(_) => mem::size_of::<BtAddrType>(), // TODO(abps) - Figure out sizes for these Loading Loading @@ -770,6 +773,9 @@ impl BluetoothProperty { }; data.copy_from_slice(&slice); } BluetoothProperty::RemoteModelName(name) => { data.copy_from_slice(name.as_bytes()); } BluetoothProperty::RemoteAddrType(addr_type) => { data.copy_from_slice( &BtAddrType::to_u32(addr_type).unwrap_or_default().to_ne_bytes(), Loading Loading @@ -851,6 +857,9 @@ impl From<bindings::bt_property_t> for BluetoothProperty { let v = unsafe { (prop.val as *const BtVendorProductInfo).read_unaligned() }; BluetoothProperty::VendorProductInfo(BtVendorProductInfo::from(v)) } BtPropertyType::RemoteModelName => { BluetoothProperty::RemoteModelName(ascii_to_string(slice, len)) } BtPropertyType::RemoteAddrType => BluetoothProperty::RemoteAddrType( BtAddrType::from_u32(u32_from_bytes(slice)).unwrap_or(BtAddrType::Unknown), ), Loading Loading
system/gd/rust/linux/client/src/command_handler.rs +4 −0 Original line number Diff line number Diff line Loading @@ -889,6 +889,7 @@ impl CommandHandler { uuids, wake_allowed, dual_mode_audio, le_audio_stable, ) = { let ctx = self.lock_context(); let adapter = ctx.adapter_dbus.as_ref().unwrap(); Loading @@ -908,6 +909,7 @@ impl CommandHandler { let uuids = adapter.get_remote_uuids(device.clone()); let wake_allowed = adapter.get_remote_wake_allowed(device.clone()); let dual_mode_audio = adapter.is_dual_mode_audio_sink_device(device.clone()); let le_audio_stable = adapter.is_le_audio_stable(device.clone()); ( name, Loading @@ -921,6 +923,7 @@ impl CommandHandler { uuids, wake_allowed, dual_mode_audio, le_audio_stable, ) }; Loading @@ -935,6 +938,7 @@ impl CommandHandler { print_info!("Bond State: {:?}", bonded); print_info!("Connection State: {}", connection_state); print_info!("Dual Mode Audio Device: {}", dual_mode_audio); print_info!("Is LE Audio Stable: {}", le_audio_stable); print_info!( "Uuids: {}", DisplayList( Loading
system/gd/rust/linux/client/src/dbus_iface.rs +5 −0 Original line number Diff line number Diff line Loading @@ -1036,6 +1036,11 @@ impl IBluetooth for BluetoothDBus { dbus_generated!() } #[dbus_method("IsLEAudioStable")] fn is_le_audio_stable(&self, device: BluetoothDevice) -> bool { dbus_generated!() } #[dbus_method("GetDumpsys")] fn get_dumpsys(&self) -> String { dbus_generated!() Loading
system/gd/rust/linux/service/src/iface_bluetooth.rs +5 −0 Original line number Diff line number Diff line Loading @@ -771,6 +771,11 @@ impl IBluetooth for IBluetoothDBus { dbus_generated!() } #[dbus_method("IsLEAudioStable", DBusLog::Disable)] fn is_le_audio_stable(&self, device: BluetoothDevice) -> bool { dbus_generated!() } #[dbus_method("GetDumpsys", DBusLog::Disable)] fn get_dumpsys(&self) -> String { dbus_generated!() Loading
system/gd/rust/linux/stack/src/bluetooth.rs +18 −1 Original line number Diff line number Diff line Loading @@ -17,7 +17,7 @@ use bt_topshim::{ }, profiles::sdp::{BtSdpRecord, Sdp, SdpCallbacks, SdpCallbacksDispatcher}, profiles::ProfileConnectionState, topstack, sysprop, topstack, }; use bt_utils::array_utils; Loading Loading @@ -265,6 +265,9 @@ pub trait IBluetooth { /// LE Audio sink roles). fn is_dual_mode_audio_sink_device(&self, device: BluetoothDevice) -> bool; /// Returns whether the remote device is LE audio stable. fn is_le_audio_stable(&self, device: BluetoothDevice) -> bool; /// Gets diagnostic output. fn get_dumpsys(&self) -> String; } Loading Loading @@ -3004,6 +3007,20 @@ impl IBluetooth for Bluetooth { }) } fn is_le_audio_stable(&self, device: BluetoothDevice) -> bool { let model_name = match self.get_remote_device_property(&device, &BtPropertyType::RemoteModelName) { Some(BluetoothProperty::RemoteModelName(name)) => name, _ => { return false; } }; sysprop::get_string(sysprop::PropertyString::LeAudioAllowList) .split(",") .any(|model| model == model_name) } fn get_dumpsys(&self) -> String { NamedTempFile::new() .and_then(|file| { Loading
system/gd/rust/topshim/src/btif.rs +10 −1 Original line number Diff line number Diff line Loading @@ -167,7 +167,7 @@ pub enum BtPropertyType { // Unimplemented: // BT_PROPERTY_REMOTE_ASHA_CAPABILITY, // BT_PROPERTY_REMOTE_ASHA_TRUNCATED_HISYNCID, // BT_PROPERTY_REMOTE_MODEL_NUM, RemoteModelName = 0x17, RemoteAddrType = 0x18, Unknown = 0xFE, Loading Loading @@ -586,6 +586,7 @@ pub enum BluetoothProperty { RemoteIsCoordinatedSetMember(bool), Appearance(u16), VendorProductInfo(BtVendorProductInfo), RemoteModelName(String), RemoteAddrType(BtAddrType), RemoteDeviceTimestamp(), Loading Loading @@ -630,6 +631,7 @@ impl BluetoothProperty { BluetoothProperty::Appearance(_) => BtPropertyType::Appearance, BluetoothProperty::VendorProductInfo(_) => BtPropertyType::VendorProductInfo, BluetoothProperty::RemoteDeviceTimestamp() => BtPropertyType::RemoteDeviceTimestamp, BluetoothProperty::RemoteModelName(_) => BtPropertyType::RemoteModelName, BluetoothProperty::RemoteAddrType(_) => BtPropertyType::RemoteAddrType, BluetoothProperty::Unknown() => BtPropertyType::Unknown, } Loading Loading @@ -661,6 +663,7 @@ impl BluetoothProperty { BluetoothProperty::RemoteIsCoordinatedSetMember(_) => mem::size_of::<bool>(), BluetoothProperty::Appearance(_) => mem::size_of::<u16>(), BluetoothProperty::VendorProductInfo(_) => mem::size_of::<BtVendorProductInfo>(), BluetoothProperty::RemoteModelName(name) => name.len(), BluetoothProperty::RemoteAddrType(_) => mem::size_of::<BtAddrType>(), // TODO(abps) - Figure out sizes for these Loading Loading @@ -770,6 +773,9 @@ impl BluetoothProperty { }; data.copy_from_slice(&slice); } BluetoothProperty::RemoteModelName(name) => { data.copy_from_slice(name.as_bytes()); } BluetoothProperty::RemoteAddrType(addr_type) => { data.copy_from_slice( &BtAddrType::to_u32(addr_type).unwrap_or_default().to_ne_bytes(), Loading Loading @@ -851,6 +857,9 @@ impl From<bindings::bt_property_t> for BluetoothProperty { let v = unsafe { (prop.val as *const BtVendorProductInfo).read_unaligned() }; BluetoothProperty::VendorProductInfo(BtVendorProductInfo::from(v)) } BtPropertyType::RemoteModelName => { BluetoothProperty::RemoteModelName(ascii_to_string(slice, len)) } BtPropertyType::RemoteAddrType => BluetoothProperty::RemoteAddrType( BtAddrType::from_u32(u32_from_bytes(slice)).unwrap_or(BtAddrType::Unknown), ), Loading