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

Commit 21db5150 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 12032182 from 4ab13f36 to 24Q4-release

Change-Id: I313b0f08de6dd3deb79ea8dc3dd8e51d76b89dff
parents 11d3f168 4ab13f36
Loading
Loading
Loading
Loading
+50 −17
Original line number Diff line number Diff line
@@ -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) {
@@ -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();
        }
    }

@@ -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;
            }
@@ -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);
        }
@@ -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);
                }
            }
+10 −0
Original line number Diff line number Diff line
@@ -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
    }
}
+10 −0
Original line number Diff line number Diff line
@@ -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
    }
}
+3 −1
Original line number Diff line number Diff line
@@ -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) {}
+2 −2
Original line number Diff line number Diff line
@@ -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