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

Commit 50138ed4 authored by howardchung's avatar howardchung
Browse files

Floss: Empower avrcp to be toggled by admin

It is locally verified that b/251692015 no longer happens. Make AVRCP as
toggleable by BluetoothAdmin as other media profiles.

Bug: 251692015
Test: Disable AVRCP and connect with WF-1000XM3. Verify there is no
crash.

Change-Id: I08fb97d214f27e8d90d99ee6e7d1e4fae9ea1822
parent 702caaf6
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -496,7 +496,7 @@ impl Bluetooth {
                self.hh.as_mut().unwrap().disable();
            }

            Profile::A2dpSource | Profile::Hfp => {
            Profile::A2dpSource | Profile::Hfp | Profile::AvrcpTarget => {
                self.bluetooth_media.lock().unwrap().disable_profile(profile);
            }
            // Ignore profiles that we don't connect.
@@ -514,7 +514,7 @@ impl Bluetooth {
                self.hh.as_mut().unwrap().enable();
            }

            Profile::A2dpSource | Profile::Hfp => {
            Profile::A2dpSource | Profile::Hfp | Profile::AvrcpTarget => {
                self.bluetooth_media.lock().unwrap().enable_profile(profile);
            }
            // Ignore profiles that we don't connect.
@@ -530,7 +530,7 @@ impl Bluetooth {
        match profile {
            Profile::Hid => Some(!self.hh.is_none() && self.hh.as_ref().unwrap().is_enabled()),

            Profile::A2dpSource | Profile::Hfp => {
            Profile::A2dpSource | Profile::Hfp | Profile::AvrcpTarget => {
                self.bluetooth_media.lock().unwrap().is_profile_enabled(profile)
            }
            // Ignore profiles that we don't connect.
+0 −5
Original line number Diff line number Diff line
@@ -1464,11 +1464,6 @@ impl IBluetoothMedia for BluetoothMedia {
        for profile in self.delay_enable_profiles.clone() {
            self.enable_profile(&profile);
        }

        // Default to enable AVRCP since btadapterd will crash when connecting a headset while
        // avrcp is disabled.
        // TODO: fix b/251692015
        self.enable_profile(&Profile::AvrcpTarget);
        true
    }

+1 −0
Original line number Diff line number Diff line
@@ -111,6 +111,7 @@ lazy_static! {
        Profile::A2dpSink,
        Profile::A2dpSource,
        Profile::AvrcpController,
        Profile::AvrcpTarget,
        Profile::Bas,
        Profile::Hsp,
        Profile::Hfp,