Loading system/gd/rust/linux/service/src/iface_bluetooth_media.rs +5 −0 Original line number Diff line number Diff line Loading @@ -175,6 +175,11 @@ impl IBluetoothMedia for IBluetoothMediaDBus { dbus_generated!() } #[dbus_method("ResetActiveDevice")] fn reset_active_device(&mut self) { dbus_generated!() } #[dbus_method("SetHfpActiveDevice")] fn set_hfp_active_device(&mut self, address: String) { dbus_generated!() Loading system/gd/rust/linux/stack/src/bluetooth_media.rs +30 −8 Original line number Diff line number Diff line Loading @@ -78,6 +78,9 @@ pub trait IBluetoothMedia { // Set the device as the active A2DP device fn set_active_device(&mut self, address: String); // Reset the active A2DP device fn reset_active_device(&mut self); // Set the device as the active HFP device fn set_hfp_active_device(&mut self, address: String); Loading Loading @@ -1782,11 +1785,26 @@ impl IBluetoothMedia for BluetoothMedia { Some(addr) => addr, }; match self.a2dp.as_mut() { Some(a2dp) => a2dp.set_active_device(addr), None => warn!("Uninitialized A2DP to set active device"), } match self.a2dp_states.get(&addr) { Some(BtavConnectionState::Connected) => { if let Some(a2dp) = self.a2dp.as_mut() { a2dp.set_active_device(addr); self.uinput.set_active_device(addr.to_string()); } else { warn!("Uninitialized A2DP to set active device"); } } _ => warn!("[{}] Not connected or disconnected A2DP address", address), }; } fn reset_active_device(&mut self) { if let Some(a2dp) = self.a2dp.as_mut() { a2dp.set_active_device(RawAddress::empty()); } else { warn!("Uninitialized A2DP to set active device"); } self.uinput.set_active_device(RawAddress::empty().to_string()); } fn set_hfp_active_device(&mut self, address: String) { Loading @@ -1798,11 +1816,15 @@ impl IBluetoothMedia for BluetoothMedia { Some(addr) => addr, }; match self.hfp.as_mut() { Some(hfp) => { match self.hfp_states.get(&addr) { Some(BthfConnectionState::SlcConnected) => { if let Some(hfp) = self.hfp.as_mut() { hfp.set_active_device(addr); } else { warn!("Uninitialized HFP to set active device"); } } None => warn!("Uninitialized HFP to set active device"), _ => warn!("[{}] Not connected or disconnected HFP address", address), } } Loading system/gd/rust/topshim/src/btif.rs +4 −0 Original line number Diff line number Diff line Loading @@ -818,6 +818,10 @@ impl RawAddress { pub fn to_byte_arr(&self) -> [u8; 6] { self.address.clone() } pub fn empty() -> RawAddress { unsafe { bindings::RawAddress_kEmpty } } } /// Address that is safe to display in logs. Loading Loading
system/gd/rust/linux/service/src/iface_bluetooth_media.rs +5 −0 Original line number Diff line number Diff line Loading @@ -175,6 +175,11 @@ impl IBluetoothMedia for IBluetoothMediaDBus { dbus_generated!() } #[dbus_method("ResetActiveDevice")] fn reset_active_device(&mut self) { dbus_generated!() } #[dbus_method("SetHfpActiveDevice")] fn set_hfp_active_device(&mut self, address: String) { dbus_generated!() Loading
system/gd/rust/linux/stack/src/bluetooth_media.rs +30 −8 Original line number Diff line number Diff line Loading @@ -78,6 +78,9 @@ pub trait IBluetoothMedia { // Set the device as the active A2DP device fn set_active_device(&mut self, address: String); // Reset the active A2DP device fn reset_active_device(&mut self); // Set the device as the active HFP device fn set_hfp_active_device(&mut self, address: String); Loading Loading @@ -1782,11 +1785,26 @@ impl IBluetoothMedia for BluetoothMedia { Some(addr) => addr, }; match self.a2dp.as_mut() { Some(a2dp) => a2dp.set_active_device(addr), None => warn!("Uninitialized A2DP to set active device"), } match self.a2dp_states.get(&addr) { Some(BtavConnectionState::Connected) => { if let Some(a2dp) = self.a2dp.as_mut() { a2dp.set_active_device(addr); self.uinput.set_active_device(addr.to_string()); } else { warn!("Uninitialized A2DP to set active device"); } } _ => warn!("[{}] Not connected or disconnected A2DP address", address), }; } fn reset_active_device(&mut self) { if let Some(a2dp) = self.a2dp.as_mut() { a2dp.set_active_device(RawAddress::empty()); } else { warn!("Uninitialized A2DP to set active device"); } self.uinput.set_active_device(RawAddress::empty().to_string()); } fn set_hfp_active_device(&mut self, address: String) { Loading @@ -1798,11 +1816,15 @@ impl IBluetoothMedia for BluetoothMedia { Some(addr) => addr, }; match self.hfp.as_mut() { Some(hfp) => { match self.hfp_states.get(&addr) { Some(BthfConnectionState::SlcConnected) => { if let Some(hfp) = self.hfp.as_mut() { hfp.set_active_device(addr); } else { warn!("Uninitialized HFP to set active device"); } } None => warn!("Uninitialized HFP to set active device"), _ => warn!("[{}] Not connected or disconnected HFP address", address), } } Loading
system/gd/rust/topshim/src/btif.rs +4 −0 Original line number Diff line number Diff line Loading @@ -818,6 +818,10 @@ impl RawAddress { pub fn to_byte_arr(&self) -> [u8; 6] { self.address.clone() } pub fn empty() -> RawAddress { unsafe { bindings::RawAddress_kEmpty } } } /// Address that is safe to display in logs. Loading