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

Commit dd52c7a0 authored by Archie Pusaka's avatar Archie Pusaka
Browse files

Floss: enable A2DP profile before enabling AVRCP

Libbluetooth memsets AVRCP struct to zero upon initializing A2DP.
Therefore we can only initialize AVRCP after A2DP, otherwise AVRCP
struct might not work as intended.

Bug: 284811956
Test: Let Bose NC700 reconnects successfully.
Change-Id: Ib6d732bd111e91ec9c8a6ddb53b97a953411482c
parent e83cfa05
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -1749,9 +1749,14 @@ impl IBluetoothMedia for BluetoothMedia {
        self.hfp = Some(Hfp::new(&self.intf.lock().unwrap()));
        self.hfp.as_mut().unwrap().initialize(hfp_dispatcher);

        for profile in self.delay_enable_profiles.clone() {
        // TODO(b/284811956) A2DP needs to be enabled before AVRCP otherwise AVRCP gets memset'd.
        // Iterate the delay_enable_profiles hashmap directly when this is fixed.
        let profile_order = vec![Profile::A2dpSource, Profile::AvrcpTarget, Profile::Hfp];
        for profile in profile_order {
            if self.delay_enable_profiles.contains(&profile) {
                self.enable_profile(&profile);
            }
        }
        true
    }