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

Commit 4e208faf authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Bass: Fix incorrect broadcast source address in add source command" into tm-qpr-dev

parents 1f71f21f c0573b87
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -750,6 +750,7 @@ public class BassClientStateMachine extends StateMachine {
                    BassConstants.BCAST_RCVR_STATE_SRC_ADDR_SIZE);
            byte sourceAddressType = receiverState[BassConstants
                    .BCAST_RCVR_STATE_SRC_ADDR_TYPE_IDX];
            BassUtils.reverse(sourceAddress);
            String address = Utils.getAddressStringFromByte(sourceAddress);
            BluetoothDevice device = btAdapter.getRemoteLeDevice(
                    address, sourceAddressType);
@@ -1267,7 +1268,9 @@ public class BassClientStateMachine extends StateMachine {
        stream.write(metaData.getSourceAddressType());

        // Advertiser_Address
        stream.write(Utils.getBytesFromAddress(advSource.getAddress()), 0, 6);
        byte[] bcastSourceAddr = Utils.getBytesFromAddress(advSource.getAddress());
        BassUtils.reverse(bcastSourceAddr);
        stream.write(bcastSourceAddr, 0, 6);
        log("Address bytes: " + advSource.getAddress());

        // Advertising_SID
+9 −0
Original line number Diff line number Diff line
@@ -141,4 +141,13 @@ class BassUtils {
            log("array[" + i + "] :" + Byte.toUnsignedInt(array[i]));
        }
    }

    static void reverse(byte[] address) {
        int len = address.length;
        for (int i = 0; i < len / 2; ++i) {
            byte b = address[i];
            address[i] = address[len - 1 - i];
            address[len - 1 - i] = b;
        }
    }
}