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

Commit 6f3c6f79 authored by Jeremy Wu's avatar Jeremy Wu
Browse files

floss: interop JBL Flip 5/6 to disregard HFP

JBL Flip 5/6 does not support HFP by specs and so is it in practice, but
it advertises the profile and that could cause trouble for Floss media
policy.

This CL adds an interop to disregard the HFP profile when advertised by
these headsets.

Bug: 381009230
Tag: #floss
Test: mmm packages/modules/Bluetooth
Flag: EXEMPT, enum adding and Floss-only logic change

Change-Id: I9079b0a877a3070cd1cbe7db9df202495e72f594
parent ecb352f5
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -878,3 +878,8 @@ BSK10 = Name_Based
# 0x03f6-0xa001 - Brydge C-Type Wireless Desktop Keyboard
[INTEROP_HOGP_FORCE_MTU_EXCHANGE]
0x03f6-0xa001 = Vndr_Prdt_Based

# Some devices claim to support HFP in EIR but do not actually support it.
[INTEROP_DISABLE_HF_PROFILE]
JBL Flip 5 = Name_Based
JBL Flip 6 = Name_Based
+3 −0
Original line number Diff line number Diff line
@@ -362,6 +362,9 @@ typedef enum {
  // Some HOGP devices requires MTU exchange be part of the initial setup to function.
  INTEROP_HOGP_FORCE_MTU_EXCHANGE,

  // Some devices claim to support HFP in EIR but does not actually support it.
  INTEROP_DISABLE_HF_PROFILE,

  END_OF_INTEROP_LIST
} interop_feature_t;

+1 −0
Original line number Diff line number Diff line
@@ -393,6 +393,7 @@ static const char* interop_feature_string_(const interop_feature_t feature) {
    CASE_RETURN_STR(INTEROP_HID_PREF_CONN_ZERO_LATENCY);
    CASE_RETURN_STR(INTEROP_HOGP_LONG_REPORT);
    CASE_RETURN_STR(INTEROP_HOGP_FORCE_MTU_EXCHANGE);
    CASE_RETURN_STR(INTEROP_DISABLE_HF_PROFILE);
  }
  return UNKNOWN_INTEROP_FEATURE;
}
+11 −3
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@ use bt_topshim::profiles::avrcp::{
use bt_topshim::profiles::csis::{
    BtCsisConnectionState, CsisClient, CsisClientCallbacks, CsisClientCallbacksDispatcher,
};
use bt_topshim::profiles::hfp::interop_insert_call_when_sco_start;
use bt_topshim::profiles::hfp::{interop_disable_hf_profile, interop_insert_call_when_sco_start};
use bt_topshim::profiles::hfp::{
    BthfAudioState, BthfConnectionState, CallHoldCommand, CallInfo, CallState, EscoCodingFormat,
    Hfp, HfpCallbacks, HfpCallbacksDispatcher, HfpCodecBitId, HfpCodecFormat, HfpCodecId,
@@ -2553,15 +2553,23 @@ impl BluetoothMedia {
    }

    fn adapter_get_classic_audio_profiles(&self, addr: RawAddress) -> HashSet<Profile> {
        let name = self.adapter_get_remote_name(addr);
        let device = BluetoothDevice::new(addr, "".to_string());
        self.adapter
        let mut profiles: HashSet<_> = self
            .adapter
            .lock()
            .unwrap()
            .get_remote_uuids(device)
            .into_iter()
            .filter_map(|u| UuidHelper::is_known_profile(&u))
            .filter(|u| MEDIA_CLASSIC_AUDIO_PROFILES.contains(u))
            .collect()
            .collect();

        if interop_disable_hf_profile(name) {
            profiles.remove(&Profile::Hfp);
        }

        profiles
    }

    pub fn get_hfp_connection_state(&self) -> ProfileConnectionState {
+4 −0
Original line number Diff line number Diff line
@@ -383,6 +383,10 @@ bool interop_insert_call_when_sco_start(RawAddress addr) {
  return interop_match_addr(interop_feature_t::INTEROP_INSERT_CALL_WHEN_SCO_START, &addr);
}

bool interop_disable_hf_profile(const char* name) {
  return interop_match_name(interop_feature_t::INTEROP_DISABLE_HF_PROFILE, name);
}

}  // namespace rust
}  // namespace topshim
}  // namespace bluetooth
Loading