Loading android/app/src/com/android/bluetooth/bass_client/BassClientService.java +50 −17 Original line number Diff line number Diff line Loading @@ -878,9 +878,45 @@ public class BassClientService extends ProfileService { && (leAudioService.getActiveDevices().contains(device)); } private boolean isAnyDeviceFromActiveUnicastGroupReceivingBroadcast() { return getActiveBroadcastSinks().stream() .anyMatch(d -> isDevicePartOfActiveUnicastGroup(d)); private boolean isEmptyBluetoothDevice(BluetoothDevice device) { if (device == null) { Log.e(TAG, "Device is null!"); return true; } return device.getAddress().equals("00:00:00:00:00:00"); } private boolean hasAnyConnectedDeviceExternalBroadcastSource() { for (BluetoothDevice device : getConnectedDevices()) { // Check if any connected device has add some source if (getAllSources(device).stream() .anyMatch( receiveState -> (!isEmptyBluetoothDevice(receiveState.getSourceDevice()) && !isLocalBroadcast(receiveState)))) { return true; } } return false; } private void checkAndResetGroupAllowedContextMask() { LeAudioService leAudioService = mServiceFactory.getLeAudioService(); if (leAudioService == null) { return; } if (leaudioAllowedContextMask()) { /* Restore allowed context mask for Unicast */ if (mIsAllowedContextOfActiveGroupModified && !hasAnyConnectedDeviceExternalBroadcastSource()) { leAudioService.setActiveGroupAllowedContextMask( BluetoothLeAudio.CONTEXTS_ALL, BluetoothLeAudio.CONTEXTS_ALL); mIsAllowedContextOfActiveGroupModified = false; } } } private void localNotifyReceiveStateChanged(BluetoothDevice sink) { Loading Loading @@ -918,16 +954,10 @@ public class BassClientService extends ProfileService { leAudioService.activeBroadcastAssistantNotification(false); } if (leaudioAllowedContextMask()) { /* Restore allowed context mask for active device */ if (mIsAllowedContextOfActiveGroupModified) { if (!isAnyDeviceFromActiveUnicastGroupReceivingBroadcast()) { leAudioService.setActiveGroupAllowedContextMask( BluetoothLeAudio.CONTEXTS_ALL, BluetoothLeAudio.CONTEXTS_ALL); } mIsAllowedContextOfActiveGroupModified = false; } } /* Restore allowed context mask for unicast in case if last connected broadcast * delegator device which has external source removes this source */ checkAndResetGroupAllowedContextMask(); } } Loading Loading @@ -1074,9 +1104,8 @@ public class BassClientService extends ProfileService { return false; } boolean isRoomAvailable = false; String emptyBluetoothDevice = "00:00:00:00:00:00"; for (BluetoothLeBroadcastReceiveState recvState : stateMachine.getAllSources()) { if (recvState.getSourceDevice().getAddress().equals(emptyBluetoothDevice)) { if (isEmptyBluetoothDevice(recvState.getSourceDevice())) { isRoomAvailable = true; break; } Loading Loading @@ -1348,6 +1377,11 @@ public class BassClientService extends ProfileService { log("Unbonded " + device + ". Removing state machine"); removeStateMachine(device); } /* Restore allowed context mask for unicast in case if last connected broadcast * delegator device which has external source disconnectes. */ checkAndResetGroupAllowedContextMask(); } else if (toState == BluetoothProfile.STATE_CONNECTED) { handleReconnectingAudioSharingModeDevice(device); } Loading Loading @@ -2730,8 +2764,7 @@ public class BassClientService extends ProfileService { List<BluetoothLeBroadcastReceiveState> recvStates = new ArrayList<BluetoothLeBroadcastReceiveState>(); for (BluetoothLeBroadcastReceiveState rs : stateMachine.getAllSources()) { String emptyBluetoothDevice = "00:00:00:00:00:00"; if (!rs.getSourceDevice().getAddress().equals(emptyBluetoothDevice)) { if (!isEmptyBluetoothDevice(rs.getSourceDevice())) { recvStates.add(rs); } } Loading flags/pairing.aconfig +10 −0 Original line number Diff line number Diff line Loading @@ -64,3 +64,13 @@ flag { purpose: PURPOSE_BUGFIX } } flag { name: "guest_mode_bond" namespace: "bluetooth" description: "Do not remove guest mode bonded devices on BT restart in guest mode" bug: "349882273" metadata { purpose: PURPOSE_BUGFIX } } flags/rfcomm.aconfig +10 −0 Original line number Diff line number Diff line Loading @@ -17,3 +17,13 @@ flag { purpose: PURPOSE_BUGFIX } } flag { name: "rfcomm_prevent_unnecessary_collisions" namespace: "bluetooth" description: "Restrict collision handling to exclude unrelated connections" bug: "349892756" metadata { purpose: PURPOSE_BUGFIX } } system/audio_hal_interface/aidl/hfp_client_interface_aidl.cc +3 −1 Original line number Diff line number Diff line Loading @@ -150,7 +150,9 @@ BluetoothAudioCtrlAck HfpTransport::SuspendRequest() { } auto status = instance->DisconnectAudio(&addr); log::info("DisconnectAudio status = {} - {}", status, bt_status_text(status)); return BluetoothAudioCtrlAck::SUCCESS_FINISHED; return status == BT_STATUS_SUCCESS ? BluetoothAudioCtrlAck::SUCCESS_FINISHED : BluetoothAudioCtrlAck::FAILURE; } void HfpTransport::SetLatencyMode(LatencyMode latency_mode) {} Loading system/bta/ag/bta_ag_sco.cc +2 −2 Original line number Diff line number Diff line Loading @@ -585,9 +585,9 @@ void bta_ag_create_sco(tBTA_AG_SCB* p_scb, bool is_orig) { bluetooth::hci::OpCode::ENHANCED_SETUP_SYNCHRONOUS_CONNECTION))) { if (esco_codec == tBTA_AG_UUID_CODEC::UUID_CODEC_MSBC || esco_codec == tBTA_AG_UUID_CODEC::UUID_CODEC_LC3) { BTM_WriteVoiceSettings(BTM_VOICE_SETTING_TRANS); get_btm_client_interface().sco.BTM_WriteVoiceSettings(BTM_VOICE_SETTING_TRANS); } else { BTM_WriteVoiceSettings(BTM_VOICE_SETTING_CVSD); get_btm_client_interface().sco.BTM_WriteVoiceSettings(BTM_VOICE_SETTING_CVSD); } } Loading Loading
android/app/src/com/android/bluetooth/bass_client/BassClientService.java +50 −17 Original line number Diff line number Diff line Loading @@ -878,9 +878,45 @@ public class BassClientService extends ProfileService { && (leAudioService.getActiveDevices().contains(device)); } private boolean isAnyDeviceFromActiveUnicastGroupReceivingBroadcast() { return getActiveBroadcastSinks().stream() .anyMatch(d -> isDevicePartOfActiveUnicastGroup(d)); private boolean isEmptyBluetoothDevice(BluetoothDevice device) { if (device == null) { Log.e(TAG, "Device is null!"); return true; } return device.getAddress().equals("00:00:00:00:00:00"); } private boolean hasAnyConnectedDeviceExternalBroadcastSource() { for (BluetoothDevice device : getConnectedDevices()) { // Check if any connected device has add some source if (getAllSources(device).stream() .anyMatch( receiveState -> (!isEmptyBluetoothDevice(receiveState.getSourceDevice()) && !isLocalBroadcast(receiveState)))) { return true; } } return false; } private void checkAndResetGroupAllowedContextMask() { LeAudioService leAudioService = mServiceFactory.getLeAudioService(); if (leAudioService == null) { return; } if (leaudioAllowedContextMask()) { /* Restore allowed context mask for Unicast */ if (mIsAllowedContextOfActiveGroupModified && !hasAnyConnectedDeviceExternalBroadcastSource()) { leAudioService.setActiveGroupAllowedContextMask( BluetoothLeAudio.CONTEXTS_ALL, BluetoothLeAudio.CONTEXTS_ALL); mIsAllowedContextOfActiveGroupModified = false; } } } private void localNotifyReceiveStateChanged(BluetoothDevice sink) { Loading Loading @@ -918,16 +954,10 @@ public class BassClientService extends ProfileService { leAudioService.activeBroadcastAssistantNotification(false); } if (leaudioAllowedContextMask()) { /* Restore allowed context mask for active device */ if (mIsAllowedContextOfActiveGroupModified) { if (!isAnyDeviceFromActiveUnicastGroupReceivingBroadcast()) { leAudioService.setActiveGroupAllowedContextMask( BluetoothLeAudio.CONTEXTS_ALL, BluetoothLeAudio.CONTEXTS_ALL); } mIsAllowedContextOfActiveGroupModified = false; } } /* Restore allowed context mask for unicast in case if last connected broadcast * delegator device which has external source removes this source */ checkAndResetGroupAllowedContextMask(); } } Loading Loading @@ -1074,9 +1104,8 @@ public class BassClientService extends ProfileService { return false; } boolean isRoomAvailable = false; String emptyBluetoothDevice = "00:00:00:00:00:00"; for (BluetoothLeBroadcastReceiveState recvState : stateMachine.getAllSources()) { if (recvState.getSourceDevice().getAddress().equals(emptyBluetoothDevice)) { if (isEmptyBluetoothDevice(recvState.getSourceDevice())) { isRoomAvailable = true; break; } Loading Loading @@ -1348,6 +1377,11 @@ public class BassClientService extends ProfileService { log("Unbonded " + device + ". Removing state machine"); removeStateMachine(device); } /* Restore allowed context mask for unicast in case if last connected broadcast * delegator device which has external source disconnectes. */ checkAndResetGroupAllowedContextMask(); } else if (toState == BluetoothProfile.STATE_CONNECTED) { handleReconnectingAudioSharingModeDevice(device); } Loading Loading @@ -2730,8 +2764,7 @@ public class BassClientService extends ProfileService { List<BluetoothLeBroadcastReceiveState> recvStates = new ArrayList<BluetoothLeBroadcastReceiveState>(); for (BluetoothLeBroadcastReceiveState rs : stateMachine.getAllSources()) { String emptyBluetoothDevice = "00:00:00:00:00:00"; if (!rs.getSourceDevice().getAddress().equals(emptyBluetoothDevice)) { if (!isEmptyBluetoothDevice(rs.getSourceDevice())) { recvStates.add(rs); } } Loading
flags/pairing.aconfig +10 −0 Original line number Diff line number Diff line Loading @@ -64,3 +64,13 @@ flag { purpose: PURPOSE_BUGFIX } } flag { name: "guest_mode_bond" namespace: "bluetooth" description: "Do not remove guest mode bonded devices on BT restart in guest mode" bug: "349882273" metadata { purpose: PURPOSE_BUGFIX } }
flags/rfcomm.aconfig +10 −0 Original line number Diff line number Diff line Loading @@ -17,3 +17,13 @@ flag { purpose: PURPOSE_BUGFIX } } flag { name: "rfcomm_prevent_unnecessary_collisions" namespace: "bluetooth" description: "Restrict collision handling to exclude unrelated connections" bug: "349892756" metadata { purpose: PURPOSE_BUGFIX } }
system/audio_hal_interface/aidl/hfp_client_interface_aidl.cc +3 −1 Original line number Diff line number Diff line Loading @@ -150,7 +150,9 @@ BluetoothAudioCtrlAck HfpTransport::SuspendRequest() { } auto status = instance->DisconnectAudio(&addr); log::info("DisconnectAudio status = {} - {}", status, bt_status_text(status)); return BluetoothAudioCtrlAck::SUCCESS_FINISHED; return status == BT_STATUS_SUCCESS ? BluetoothAudioCtrlAck::SUCCESS_FINISHED : BluetoothAudioCtrlAck::FAILURE; } void HfpTransport::SetLatencyMode(LatencyMode latency_mode) {} Loading
system/bta/ag/bta_ag_sco.cc +2 −2 Original line number Diff line number Diff line Loading @@ -585,9 +585,9 @@ void bta_ag_create_sco(tBTA_AG_SCB* p_scb, bool is_orig) { bluetooth::hci::OpCode::ENHANCED_SETUP_SYNCHRONOUS_CONNECTION))) { if (esco_codec == tBTA_AG_UUID_CODEC::UUID_CODEC_MSBC || esco_codec == tBTA_AG_UUID_CODEC::UUID_CODEC_LC3) { BTM_WriteVoiceSettings(BTM_VOICE_SETTING_TRANS); get_btm_client_interface().sco.BTM_WriteVoiceSettings(BTM_VOICE_SETTING_TRANS); } else { BTM_WriteVoiceSettings(BTM_VOICE_SETTING_CVSD); get_btm_client_interface().sco.BTM_WriteVoiceSettings(BTM_VOICE_SETTING_CVSD); } } Loading