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

Commit cac33f85 authored by Jeremy Wu's avatar Jeremy Wu
Browse files

Floss: add more logs to bluetooth_media.rs

There are many steps involved to get a bluetooth audio device stream
A2DP/HFP, and we are missing the logs for some of them to be able to
identify which step went wrong.

In this CL, we add more logs to show the exposed profiles of the
peripheral, and the timings of audio config setup and start/stop
request.

Bug: 254694739
Tag: #floss
Test: Build and verify
Change-Id: Icd375f5a4bfb491c9aad510a4547a56df5775e8d
parent 33020344
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -362,6 +362,8 @@ impl BluetoothMedia {
                self.a2dp_audio_state.insert(addr, state);
            }
            A2dpCallbacks::AudioConfig(addr, _config, _local_caps, a2dp_caps) => {
                // TODO(b/254808917): revert to debug log once fixed
                info!("[{}]: a2dp updated audio config: {:?}", addr.to_string(), a2dp_caps);
                self.a2dp_caps.insert(addr, a2dp_caps);
            }
            A2dpCallbacks::MandatoryCodecPreferred(_addr) => {}
@@ -862,6 +864,8 @@ impl IBluetoothMedia for BluetoothMedia {

        let available_profiles = self.adapter_get_audio_profiles(addr);

        info!("[{}]: Connecting to device, available profiles: {:?}.", address, available_profiles);

        let connected_profiles = self.connected_profiles.entry(addr).or_insert_with(HashSet::new);

        let missing_profiles =
@@ -1198,6 +1202,9 @@ impl IBluetoothMedia for BluetoothMedia {
    }

    fn start_audio_request(&mut self) {
        // TODO(b/254808917): revert to debug log once fixed
        info!("Start audio request");

        match self.a2dp.as_mut() {
            Some(a2dp) => a2dp.start_audio_request(),
            None => warn!("Uninitialized A2DP to start audio request"),
@@ -1210,6 +1217,9 @@ impl IBluetoothMedia for BluetoothMedia {
            return;
        }

        // TODO(b/254808917): revert to debug log once fixed
        info!("Stop audio request");

        match self.a2dp.as_mut() {
            Some(a2dp) => a2dp.stop_audio_request(),
            None => warn!("Uninitialized A2DP to stop audio request"),