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

Commit 73b8244c authored by Alice Kuo's avatar Alice Kuo Committed by Automerger Merge Worker
Browse files

Merge "Revert "BassClient: Force PA sync reset before removing source"" into tm-dev am: 575dfa39

parents 1cf1e271 575dfa39
Loading
Loading
Loading
Loading
+0 −15
Original line number Original line Diff line number Diff line
@@ -816,7 +816,6 @@ public class BassClientService extends ProfileService {
        }
        }
        Message message = stateMachine.obtainMessage(BassClientStateMachine.UPDATE_BCAST_SOURCE);
        Message message = stateMachine.obtainMessage(BassClientStateMachine.UPDATE_BCAST_SOURCE);
        message.arg1 = sourceId;
        message.arg1 = sourceId;
        message.arg2 = BluetoothLeBroadcastReceiveState.PA_SYNC_STATE_INVALID;
        message.obj = updatedMetadata;
        message.obj = updatedMetadata;
        stateMachine.sendMessage(message);
        stateMachine.sendMessage(message);
    }
    }
@@ -845,20 +844,6 @@ public class BassClientService extends ProfileService {
                    BluetoothStatusCodes.ERROR_REMOTE_LINK_ERROR);
                    BluetoothStatusCodes.ERROR_REMOTE_LINK_ERROR);
            return;
            return;
        }
        }
        BluetoothLeBroadcastReceiveState recvState =
                stateMachine.getBroadcastReceiveStateForSourceId(sourceId);
        BluetoothLeBroadcastMetadata metaData =
                stateMachine.getCurrentBroadcastMetadata(sourceId);
        if (metaData != null && recvState != null && recvState.getPaSyncState() ==
                BluetoothLeBroadcastReceiveState.PA_SYNC_STATE_SYNCHRONIZED) {
            log("Force source to lost PA sync");
            Message message = stateMachine.obtainMessage(
                    BassClientStateMachine.UPDATE_BCAST_SOURCE);
            message.arg1 = sourceId;
            message.arg2 = BluetoothLeBroadcastReceiveState.PA_SYNC_STATE_IDLE;
            message.obj = metaData;
            stateMachine.sendMessage(message);
        }
        Message message = stateMachine.obtainMessage(BassClientStateMachine.REMOVE_BCAST_SOURCE);
        Message message = stateMachine.obtainMessage(BassClientStateMachine.REMOVE_BCAST_SOURCE);
        message.arg1 = sourceId;
        message.arg1 = sourceId;
        stateMachine.sendMessage(message);
        stateMachine.sendMessage(message);
+4 −12
Original line number Original line Diff line number Diff line
@@ -1271,7 +1271,7 @@ public class BassClientStateMachine extends StateMachine {
    }
    }


    private byte[] convertBroadcastMetadataToUpdateSourceByteArray(int sourceId,
    private byte[] convertBroadcastMetadataToUpdateSourceByteArray(int sourceId,
            BluetoothLeBroadcastMetadata metaData, int paSync) {
            BluetoothLeBroadcastMetadata metaData) {
        BluetoothLeBroadcastReceiveState existingState =
        BluetoothLeBroadcastReceiveState existingState =
                getBroadcastReceiveStateForSourceId(sourceId);
                getBroadcastReceiveStateForSourceId(sourceId);
        if (existingState == null) {
        if (existingState == null) {
@@ -1303,9 +1303,7 @@ public class BassClientStateMachine extends StateMachine {
        // Source_ID
        // Source_ID
        res[offset++] = (byte) sourceId;
        res[offset++] = (byte) sourceId;
        // PA_Sync
        // PA_Sync
        if (paSync != BluetoothLeBroadcastReceiveState.PA_SYNC_STATE_INVALID) {
        if (existingState.getPaSyncState()
            res[offset++] = (byte) paSync;
        } else if (existingState.getPaSyncState()
                == BluetoothLeBroadcastReceiveState.PA_SYNC_STATE_SYNCHRONIZED) {
                == BluetoothLeBroadcastReceiveState.PA_SYNC_STATE_SYNCHRONIZED) {
            res[offset++] = (byte) (0x01);
            res[offset++] = (byte) (0x01);
        } else {
        } else {
@@ -1317,12 +1315,7 @@ public class BassClientStateMachine extends StateMachine {
        // Num_Subgroups
        // Num_Subgroups
        res[offset++] = numSubGroups;
        res[offset++] = numSubGroups;
        for (int i = 0; i < numSubGroups; i++) {
        for (int i = 0; i < numSubGroups; i++) {
            int bisIndexValue;
            int bisIndexValue = existingState.getBisSyncState().get(i).intValue();
            if (paSync != BluetoothLeBroadcastReceiveState.PA_SYNC_STATE_INVALID) {
                bisIndexValue = 0;
            } else {
                bisIndexValue = existingState.getBisSyncState().get(i).intValue();
            }
            log("UPDATE_BCAST_SOURCE: bisIndexValue : " + bisIndexValue);
            log("UPDATE_BCAST_SOURCE: bisIndexValue : " + bisIndexValue);
            // BIS_Sync
            // BIS_Sync
            res[offset++] = (byte) (bisIndexValue & 0x00000000000000FF);
            res[offset++] = (byte) (bisIndexValue & 0x00000000000000FF);
@@ -1520,10 +1513,9 @@ public class BassClientStateMachine extends StateMachine {
                case UPDATE_BCAST_SOURCE:
                case UPDATE_BCAST_SOURCE:
                    metaData = (BluetoothLeBroadcastMetadata) message.obj;
                    metaData = (BluetoothLeBroadcastMetadata) message.obj;
                    int sourceId = message.arg1;
                    int sourceId = message.arg1;
                    int paSync = message.arg2;
                    log("Updating Broadcast source" + metaData);
                    log("Updating Broadcast source" + metaData);
                    byte[] updateSourceInfo = convertBroadcastMetadataToUpdateSourceByteArray(
                    byte[] updateSourceInfo = convertBroadcastMetadataToUpdateSourceByteArray(
                            sourceId, metaData, paSync);
                            sourceId, metaData);
                    if (updateSourceInfo == null) {
                    if (updateSourceInfo == null) {
                        Log.e(TAG, "update source: source Info is NULL");
                        Log.e(TAG, "update source: source Info is NULL");
                        break;
                        break;