Loading system/device/include/interop.h +4 −0 Original line number Diff line number Diff line Loading @@ -339,6 +339,10 @@ typedef enum { // both encryption complete and SMP key exchange completed. INTEROP_SUSPEND_ATT_TRAFFIC_DURING_PAIRING, // This triggers a +CIEV command to set the call status for HFP devices. // It is required for some devices to provide sound. INTEROP_INSERT_CALL_WHEN_SCO_START, END_OF_INTEROP_LIST } interop_feature_t; Loading system/device/src/interop.cc +1 −0 Original line number Diff line number Diff line Loading @@ -393,6 +393,7 @@ static const char* interop_feature_string_(const interop_feature_t feature) { CASE_RETURN_STR(INTEROP_HFP_1_9_ALLOWLIST); CASE_RETURN_STR(INTEROP_IGNORE_DISC_BEFORE_SIGNALLING_TIMEOUT); CASE_RETURN_STR(INTEROP_SUSPEND_ATT_TRAFFIC_DURING_PAIRING); CASE_RETURN_STR(INTEROP_INSERT_CALL_WHEN_SCO_START); } return UNKNOWN_INTEROP_FEATURE; } Loading system/gd/rust/linux/stack/src/bluetooth_media.rs +28 −16 Original line number Diff line number Diff line Loading @@ -12,6 +12,7 @@ use bt_topshim::profiles::a2dp::{ use bt_topshim::profiles::avrcp::{ Avrcp, AvrcpCallbacks, AvrcpCallbacksDispatcher, PlayerMetadata, }; use bt_topshim::profiles::hfp::interop_insert_call_when_sco_start; use bt_topshim::profiles::hfp::{ BthfAudioState, BthfConnectionState, CallHoldCommand, CallInfo, CallSource, CallState, Hfp, HfpCallbacks, HfpCallbacksDispatcher, HfpCodecCapability, HfpCodecId, PhoneState, Loading Loading @@ -759,7 +760,7 @@ impl BluetoothMedia { self.hfp_audio_state.insert(addr, state); if !self.mps_qualification_enabled if self.should_insert_call_when_sco_start(addr) && self.call_list.iter().all(|c| c.source != CallSource::CRAS) { // This triggers a +CIEV command to set the call status for HFP devices. Loading Loading @@ -2167,6 +2168,16 @@ impl BluetoothMedia { pub fn add_player(&mut self, name: String, browsing_supported: bool) { self.avrcp.as_mut().unwrap().add_player(&name, browsing_supported); } fn should_insert_call_when_sco_start(&self, address: RawAddress) -> bool { if self.mps_qualification_enabled { return false; } if !self.phone_ops_enabled { return true; } return interop_insert_call_when_sco_start(address); } } fn get_a2dp_dispatcher(tx: Sender<Message>) -> A2dpCallbacksDispatcher { Loading Loading @@ -2704,7 +2715,6 @@ impl IBluetoothMedia for BluetoothMedia { } Some(addr) => addr, }; let vol = match i8::try_from(volume) { Ok(val) if val <= 15 => val, _ => { Loading Loading @@ -2908,7 +2918,10 @@ impl IBluetoothTelephony for BluetoothMedia { self.last_dialing_number = None; self.a2dp_has_interrupted_stream = false; if self.hfp_audio_state.values().any(|x| x == &BthfAudioState::Connected) { self.phone_ops_enabled = enable; if self.hfp_audio_state.keys().any(|addr| self.should_insert_call_when_sco_start(*addr)) && self.hfp_audio_state.values().any(|x| x == &BthfAudioState::Connected) { self.call_list.push(CallInfo { index: 1, dir_incoming: false, Loading @@ -2919,7 +2932,6 @@ impl IBluetoothTelephony for BluetoothMedia { self.phone_state.num_active = 1; } self.phone_ops_enabled = enable; self.phone_state_change("".into()); } Loading @@ -2936,9 +2948,11 @@ impl IBluetoothTelephony for BluetoothMedia { self.memory_dialing_number = None; self.last_dialing_number = None; self.a2dp_has_interrupted_stream = false; self.mps_qualification_enabled = enable; if !enable { if self.hfp_audio_state.values().any(|x| x == &BthfAudioState::Connected) { if self.hfp_audio_state.keys().any(|addr| self.should_insert_call_when_sco_start(*addr)) && self.hfp_audio_state.values().any(|x| x == &BthfAudioState::Connected) { self.call_list.push(CallInfo { index: 1, dir_incoming: false, Loading @@ -2948,9 +2962,7 @@ impl IBluetoothTelephony for BluetoothMedia { }); self.phone_state.num_active = 1; } } self.mps_qualification_enabled = enable; self.phone_state_change("".into()); } Loading system/gd/rust/topshim/hfp/hfp_shim.cc +5 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ #include "gd/rust/topshim/hfp/hfp_shim.h" #include "btif/include/btif_hf.h" #include "device/include/interop.h" #include "gd/common/strings.h" #include "gd/os/log.h" #include "include/hardware/bt_hf.h" Loading Loading @@ -438,6 +439,10 @@ std::unique_ptr<HfpIntf> GetHfpProfile(const unsigned char* btif) { return hfpif; } bool interop_insert_call_when_sco_start(RawAddress addr) { return interop_match_addr(interop_feature_t::INTEROP_INSERT_CALL_WHEN_SCO_START, &addr); } } // namespace rust } // namespace topshim } // namespace bluetooth system/gd/rust/topshim/hfp/hfp_shim.h +1 −0 Original line number Diff line number Diff line Loading @@ -58,6 +58,7 @@ class HfpIntf { }; std::unique_ptr<HfpIntf> GetHfpProfile(const unsigned char* btif); bool interop_insert_call_when_sco_start(RawAddress addr); } // namespace rust } // namespace topshim Loading Loading
system/device/include/interop.h +4 −0 Original line number Diff line number Diff line Loading @@ -339,6 +339,10 @@ typedef enum { // both encryption complete and SMP key exchange completed. INTEROP_SUSPEND_ATT_TRAFFIC_DURING_PAIRING, // This triggers a +CIEV command to set the call status for HFP devices. // It is required for some devices to provide sound. INTEROP_INSERT_CALL_WHEN_SCO_START, END_OF_INTEROP_LIST } interop_feature_t; Loading
system/device/src/interop.cc +1 −0 Original line number Diff line number Diff line Loading @@ -393,6 +393,7 @@ static const char* interop_feature_string_(const interop_feature_t feature) { CASE_RETURN_STR(INTEROP_HFP_1_9_ALLOWLIST); CASE_RETURN_STR(INTEROP_IGNORE_DISC_BEFORE_SIGNALLING_TIMEOUT); CASE_RETURN_STR(INTEROP_SUSPEND_ATT_TRAFFIC_DURING_PAIRING); CASE_RETURN_STR(INTEROP_INSERT_CALL_WHEN_SCO_START); } return UNKNOWN_INTEROP_FEATURE; } Loading
system/gd/rust/linux/stack/src/bluetooth_media.rs +28 −16 Original line number Diff line number Diff line Loading @@ -12,6 +12,7 @@ use bt_topshim::profiles::a2dp::{ use bt_topshim::profiles::avrcp::{ Avrcp, AvrcpCallbacks, AvrcpCallbacksDispatcher, PlayerMetadata, }; use bt_topshim::profiles::hfp::interop_insert_call_when_sco_start; use bt_topshim::profiles::hfp::{ BthfAudioState, BthfConnectionState, CallHoldCommand, CallInfo, CallSource, CallState, Hfp, HfpCallbacks, HfpCallbacksDispatcher, HfpCodecCapability, HfpCodecId, PhoneState, Loading Loading @@ -759,7 +760,7 @@ impl BluetoothMedia { self.hfp_audio_state.insert(addr, state); if !self.mps_qualification_enabled if self.should_insert_call_when_sco_start(addr) && self.call_list.iter().all(|c| c.source != CallSource::CRAS) { // This triggers a +CIEV command to set the call status for HFP devices. Loading Loading @@ -2167,6 +2168,16 @@ impl BluetoothMedia { pub fn add_player(&mut self, name: String, browsing_supported: bool) { self.avrcp.as_mut().unwrap().add_player(&name, browsing_supported); } fn should_insert_call_when_sco_start(&self, address: RawAddress) -> bool { if self.mps_qualification_enabled { return false; } if !self.phone_ops_enabled { return true; } return interop_insert_call_when_sco_start(address); } } fn get_a2dp_dispatcher(tx: Sender<Message>) -> A2dpCallbacksDispatcher { Loading Loading @@ -2704,7 +2715,6 @@ impl IBluetoothMedia for BluetoothMedia { } Some(addr) => addr, }; let vol = match i8::try_from(volume) { Ok(val) if val <= 15 => val, _ => { Loading Loading @@ -2908,7 +2918,10 @@ impl IBluetoothTelephony for BluetoothMedia { self.last_dialing_number = None; self.a2dp_has_interrupted_stream = false; if self.hfp_audio_state.values().any(|x| x == &BthfAudioState::Connected) { self.phone_ops_enabled = enable; if self.hfp_audio_state.keys().any(|addr| self.should_insert_call_when_sco_start(*addr)) && self.hfp_audio_state.values().any(|x| x == &BthfAudioState::Connected) { self.call_list.push(CallInfo { index: 1, dir_incoming: false, Loading @@ -2919,7 +2932,6 @@ impl IBluetoothTelephony for BluetoothMedia { self.phone_state.num_active = 1; } self.phone_ops_enabled = enable; self.phone_state_change("".into()); } Loading @@ -2936,9 +2948,11 @@ impl IBluetoothTelephony for BluetoothMedia { self.memory_dialing_number = None; self.last_dialing_number = None; self.a2dp_has_interrupted_stream = false; self.mps_qualification_enabled = enable; if !enable { if self.hfp_audio_state.values().any(|x| x == &BthfAudioState::Connected) { if self.hfp_audio_state.keys().any(|addr| self.should_insert_call_when_sco_start(*addr)) && self.hfp_audio_state.values().any(|x| x == &BthfAudioState::Connected) { self.call_list.push(CallInfo { index: 1, dir_incoming: false, Loading @@ -2948,9 +2962,7 @@ impl IBluetoothTelephony for BluetoothMedia { }); self.phone_state.num_active = 1; } } self.mps_qualification_enabled = enable; self.phone_state_change("".into()); } Loading
system/gd/rust/topshim/hfp/hfp_shim.cc +5 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ #include "gd/rust/topshim/hfp/hfp_shim.h" #include "btif/include/btif_hf.h" #include "device/include/interop.h" #include "gd/common/strings.h" #include "gd/os/log.h" #include "include/hardware/bt_hf.h" Loading Loading @@ -438,6 +439,10 @@ std::unique_ptr<HfpIntf> GetHfpProfile(const unsigned char* btif) { return hfpif; } bool interop_insert_call_when_sco_start(RawAddress addr) { return interop_match_addr(interop_feature_t::INTEROP_INSERT_CALL_WHEN_SCO_START, &addr); } } // namespace rust } // namespace topshim } // namespace bluetooth
system/gd/rust/topshim/hfp/hfp_shim.h +1 −0 Original line number Diff line number Diff line Loading @@ -58,6 +58,7 @@ class HfpIntf { }; std::unique_ptr<HfpIntf> GetHfpProfile(const unsigned char* btif); bool interop_insert_call_when_sco_start(RawAddress addr); } // namespace rust } // namespace topshim Loading