Loading system/gd/rust/linux/stack/src/bluetooth_media.rs +34 −24 Original line number Diff line number Diff line Loading @@ -767,14 +767,7 @@ impl BluetoothMedia { if self.should_insert_call_when_sco_start(addr) { // This triggers a +CIEV command to set the call status for HFP devices. // It is required for some devices to provide sound. self.phone_state.num_active += 1; self.call_list.push(CallInfo { index: self.new_call_index(), dir_incoming: false, state: CallState::Active, number: "".into(), }); self.phone_state_change("".into()); self.place_active_call(); } } BthfAudioState::Disconnected => { Loading Loading @@ -1329,8 +1322,11 @@ impl BluetoothMedia { } else if call_state == UHID_OUTPUT_RING { self.incoming_call_impl("".into()); } else if call_state == UHID_OUTPUT_OFF_HOOK { self.dialing_call_impl("".into(), None); if self.phone_state.state == CallState::Incoming { self.answer_call_impl(); } else if self.phone_state.state == CallState::Idle { self.place_active_call(); } self.uhid_send_hook_switch_input_report(&addr, true); } } Loading Loading @@ -2240,6 +2236,30 @@ impl BluetoothMedia { } return interop_insert_call_when_sco_start(address); } // Places an active call into the call list and triggers a headset update (+CIEV). // Preconditions: // - No active calls in progress (phone_state.num_active == 0) // - Phone state is idle (phone_state.state == CallState::Idle) fn place_active_call(&mut self) { if self.phone_state.num_active != 0 { warn!("Unexpected usage. phone_state.num_active can only be 0 when calling place_active_call"); return; } if self.phone_state.state != CallState::Idle { warn!("Unexpected usage. phone_state.state can only be idle when calling place_active_call"); return; } self.call_list.push(CallInfo { index: 1, dir_incoming: false, state: CallState::Active, number: "".into(), }); self.phone_state.num_active = 1; self.phone_state_change("".into()); } } fn get_a2dp_dispatcher(tx: Sender<Message>) -> A2dpCallbacksDispatcher { Loading Loading @@ -3001,13 +3021,8 @@ impl IBluetoothTelephony for BluetoothMedia { 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, state: CallState::Active, number: "".into(), }); self.phone_state.num_active = 1; self.place_active_call(); return; } self.phone_state_change("".into()); Loading @@ -3031,13 +3046,8 @@ impl IBluetoothTelephony for BluetoothMedia { 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, state: CallState::Active, number: "".into(), }); self.phone_state.num_active = 1; self.place_active_call(); return; } self.phone_state_change("".into()); Loading Loading
system/gd/rust/linux/stack/src/bluetooth_media.rs +34 −24 Original line number Diff line number Diff line Loading @@ -767,14 +767,7 @@ impl BluetoothMedia { if self.should_insert_call_when_sco_start(addr) { // This triggers a +CIEV command to set the call status for HFP devices. // It is required for some devices to provide sound. self.phone_state.num_active += 1; self.call_list.push(CallInfo { index: self.new_call_index(), dir_incoming: false, state: CallState::Active, number: "".into(), }); self.phone_state_change("".into()); self.place_active_call(); } } BthfAudioState::Disconnected => { Loading Loading @@ -1329,8 +1322,11 @@ impl BluetoothMedia { } else if call_state == UHID_OUTPUT_RING { self.incoming_call_impl("".into()); } else if call_state == UHID_OUTPUT_OFF_HOOK { self.dialing_call_impl("".into(), None); if self.phone_state.state == CallState::Incoming { self.answer_call_impl(); } else if self.phone_state.state == CallState::Idle { self.place_active_call(); } self.uhid_send_hook_switch_input_report(&addr, true); } } Loading Loading @@ -2240,6 +2236,30 @@ impl BluetoothMedia { } return interop_insert_call_when_sco_start(address); } // Places an active call into the call list and triggers a headset update (+CIEV). // Preconditions: // - No active calls in progress (phone_state.num_active == 0) // - Phone state is idle (phone_state.state == CallState::Idle) fn place_active_call(&mut self) { if self.phone_state.num_active != 0 { warn!("Unexpected usage. phone_state.num_active can only be 0 when calling place_active_call"); return; } if self.phone_state.state != CallState::Idle { warn!("Unexpected usage. phone_state.state can only be idle when calling place_active_call"); return; } self.call_list.push(CallInfo { index: 1, dir_incoming: false, state: CallState::Active, number: "".into(), }); self.phone_state.num_active = 1; self.phone_state_change("".into()); } } fn get_a2dp_dispatcher(tx: Sender<Message>) -> A2dpCallbacksDispatcher { Loading Loading @@ -3001,13 +3021,8 @@ impl IBluetoothTelephony for BluetoothMedia { 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, state: CallState::Active, number: "".into(), }); self.phone_state.num_active = 1; self.place_active_call(); return; } self.phone_state_change("".into()); Loading @@ -3031,13 +3046,8 @@ impl IBluetoothTelephony for BluetoothMedia { 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, state: CallState::Active, number: "".into(), }); self.phone_state.num_active = 1; self.place_active_call(); return; } self.phone_state_change("".into()); Loading