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

Commit 1ab4875a authored by Archie Pusaka's avatar Archie Pusaka Committed by Gerrit Code Review
Browse files

Merge "floss: Enable profiles in a certain good order" into main

parents 3435c688 454a9b49
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -649,7 +649,7 @@ impl Bluetooth {
    }

    pub fn toggle_enabled_profiles(&mut self, allowed_services: &Vec<Uuid128Bit>) {
        for profile in UuidHelper::get_supported_profiles().clone() {
        for profile in UuidHelper::get_ordered_supported_profiles().clone() {
            // Only toggle initializable profiles.
            if let Some(enabled) = self.is_profile_enabled(&profile) {
                let allowed = allowed_services.len() == 0
+16 −5
Original line number Diff line number Diff line
@@ -109,7 +109,10 @@ impl<'a> Display for KnownUuidWrapper<'a> {
pub struct UuidHelper {}

lazy_static! {
    static ref SUPPORTED_PROFILES: HashSet<Profile> = [
    // AVRCP fights with A2DP when initializing, so let's initiate profiles in a known good order.
    // Specifically, A2DP must be initialized before AVRCP.
    // TODO (b/286991526): remove after issue is resolved
    static ref ORDERED_SUPPORTED_PROFILES: Vec<Profile> = vec![
        Profile::A2dpSink,
        Profile::A2dpSource,
        Profile::AvrcpController,
@@ -125,10 +128,12 @@ lazy_static! {
        Profile::HearingAid,
        Profile::VolumeControl,
        Profile::CoordinatedSet,
    ]
    .iter()
    .cloned()
    .collect();
    ];
}

lazy_static! {
    static ref SUPPORTED_PROFILES: HashSet<Profile> =
        ORDERED_SUPPORTED_PROFILES.iter().cloned().collect();
}

lazy_static! {
@@ -185,6 +190,12 @@ impl UuidHelper {
        PROFILES.get(uuid).cloned()
    }

    // AVRCP fights with A2DP when initializing, so let's initiate profiles in a known good order.
    // TODO (b/286991526): remove after issue is resolved
    pub fn get_ordered_supported_profiles() -> Vec<Profile> {
        ORDERED_SUPPORTED_PROFILES.clone()
    }

    pub fn get_supported_profiles() -> HashSet<Profile> {
        SUPPORTED_PROFILES.clone()
    }