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

Commit e28c6ad4 authored by Michal Belusiak's avatar Michal Belusiak
Browse files

BluetoothLeBroadcastMetadata: log updates

Everywhere BluetoothLeBroadcastMetadata is printed it will be changed from:
android.bluetooth.BluetoothLeBroadcastMetadata@597b0b92
to:
BluetoothLeBroadcastMetadata{sourceAddressType=1, sourceDevice=XX:XX:XX:XX:BE:03, sourceAdvertisingSid=1, broadcastId=10572183, paSyncInterval=65535, isEncrypted=true, isPublicBroadcast=true, broadcastName=Pixel 7a_8499, broadcastCode=[50, 97, 98, 57, 50, 51, 97, 48, 55, 100, 98, 52], presentationDelayMicros=40000, audioConfigQuality=1, rssi=-43, publicBroadcastMetadata=BluetoothLeAudioContentMetadata{programInfo=null, language=null, rawMetadata=[]}, subgroups=[BluetoothLeBroadcastSubgroup{codecId=6, codecSpecificConfig=BluetoothLeAudioCodecConfigMetadata{audioLocation=0, sampleRate=16, frameDuration=2, octetsPerFrame=60, rawMetadata=[2, 1, 5, 2, 2, 1, 3, 4, 60, 0]}, contentMetadata=BluetoothLeAudioContentMetadata{programInfo=Pixel 7a_8499, language=null, rawMetadata=[14, 3, 80, 105, 120, 101, 108, 32, 55, 97, 95, 56, 52, 57, 57, 2, 5, 2]}, channels=[BluetoothLeBroadcastChannel{isSelected=false, channelIndex=1, codecMetadata=BluetoothLeAudioCodecConfigMetadata{audioLocation=1, sampleRate=0, frameDuration=0, octetsPerFrame=0, rawMetadata=[5, 3, 1, 0, 0, 0]}}, BluetoothLeBroadcastChannel{isSelected=false, channelIndex=2, codecMetadata=BluetoothLeAudioCodecConfigMetadata{audioLocation=2, sampleRate=0, frameDuration=0, octetsPerFrame=0, rawMetadata=[5, 3, 2, 0, 0, 0]}}]}]}

Bug: 335795482
Test: mmm packages/modules/Bluetooth
Flag: Exempt, log updates only
Change-Id: If02560ab2e40dca1fb1f85d6ff63d1af29e0baa2
parent 6460734d
Loading
Loading
Loading
Loading
+46 −45
Original line number Diff line number Diff line
@@ -1505,12 +1505,10 @@ public class BassClientService extends ProfileService {
            BluetoothLeBroadcastMetadata sourceMetadata,
            boolean isGroupOp) {
        log(
                "addSource: device: "
                        + sink
                        + " sourceMetadata"
                        + sourceMetadata
                        + " isGroupOp: "
                        + isGroupOp);
                "addSource: "
                        + ("device: " + sink)
                        + (", sourceMetadata: " + sourceMetadata)
                        + (", isGroupOp: " + isGroupOp));

        List<BluetoothDevice> devices = getTargetDeviceList(sink, isGroupOp);
        // Don't coordinate it as a group if there's no group or there is one device only
@@ -1570,12 +1568,12 @@ public class BassClientService extends ProfileService {
                if (sourceId != BassConstants.INVALID_SOURCE_ID) {
                    sEventLogger.logd(
                            TAG,
                            "Switch Broadcast Source: device: "
                                    + device
                                    + ", old SourceId: "
                                    + sourceId
                                    + ", new SourceMetadata: "
                                    + sourceMetadata);
                            "Switch Broadcast Source: "
                                    + ("device: " + device)
                                    + (", old SourceId: " + sourceId)
                                    + (", new broadcastId: " + sourceMetadata.getBroadcastId())
                                    + (", new broadcastName: "
                                            + sourceMetadata.getBroadcastName()));

                    // new source will be added once the existing source got removed
                    if (isGroupOp) {
@@ -1629,12 +1627,11 @@ public class BassClientService extends ProfileService {

            sEventLogger.logd(
                    TAG,
                    "Add Broadcast Source: device: "
                            + device
                            + ", sourceMetadata: "
                            + sourceMetadata
                            + ", isGroupOp: "
                            + isGroupOp);
                    "Add Broadcast Source: "
                            + ("device: " + device)
                            + (", broadcastId: " + sourceMetadata.getBroadcastId())
                            + (", broadcastName: " + sourceMetadata.getBroadcastName())
                            + (", isGroupOp: " + isGroupOp));

            Message message = stateMachine.obtainMessage(BassClientStateMachine.ADD_BCAST_SOURCE);
            message.obj = sourceMetadata;
@@ -1642,10 +1639,10 @@ public class BassClientService extends ProfileService {
            if (code != null && code.length != 0) {
                sEventLogger.logd(
                        TAG,
                        "Set Broadcast Code (Add Source context): device: "
                                + device
                                + ", broadcastId: "
                                + sourceMetadata.getBroadcastId());
                        "Set Broadcast Code (Add Source context): "
                                + ("device: " + device)
                                + (", broadcastId: " + sourceMetadata.getBroadcastId())
                                + (", broadcastName: " + sourceMetadata.getBroadcastName()));

                message = stateMachine.obtainMessage(BassClientStateMachine.SET_BCAST_CODE);
                message.obj = sourceMetadata;
@@ -1664,7 +1661,11 @@ public class BassClientService extends ProfileService {
     */
    public void modifySource(
            BluetoothDevice sink, int sourceId, BluetoothLeBroadcastMetadata updatedMetadata) {
        log("modifySource: device: " + sink + " sourceId " + sourceId);
        log(
                "modifySource: "
                        + ("device: " + sink)
                        + ("sourceId: " + sourceId)
                        + (", updatedMetadata: " + updatedMetadata));

        Map<BluetoothDevice, Integer> devices = getGroupManagedDeviceSources(sink, sourceId).second;
        if (updatedMetadata == null) {
@@ -1695,12 +1696,11 @@ public class BassClientService extends ProfileService {

            sEventLogger.logd(
                    TAG,
                    "Modify Broadcast Source: device: "
                            + device
                            + ", sourceId: "
                            + sourceId
                            + ", updatedMetadata: "
                            + updatedMetadata);
                    "Modify Broadcast Source: "
                            + ("device: " + device)
                            + ("sourceId: " + sourceId)
                            + (", updatedBroadcastId: " + updatedMetadata.getBroadcastId())
                            + (", updatedBroadcastName: " + updatedMetadata.getBroadcastName()));

            Message message =
                    stateMachine.obtainMessage(BassClientStateMachine.UPDATE_BCAST_SOURCE);
@@ -1711,10 +1711,12 @@ public class BassClientService extends ProfileService {
            if (code != null && code.length != 0) {
                sEventLogger.logd(
                        TAG,
                        "Set Broadcast Code (Modify Source context), device: "
                                + device
                                + ", sourceId: "
                                + sourceId);
                        "Set Broadcast Code (Modify Source context): "
                                + ("device: " + device)
                                + ("sourceId: " + sourceId)
                                + (", updatedBroadcastId: " + updatedMetadata.getBroadcastId())
                                + (", updatedBroadcastName: "
                                        + updatedMetadata.getBroadcastName()));
                message = stateMachine.obtainMessage(BassClientStateMachine.SET_BCAST_CODE);
                message.obj = updatedMetadata;
                message.arg1 = BassClientStateMachine.ARGTYPE_METADATA;
@@ -1731,7 +1733,7 @@ public class BassClientService extends ProfileService {
     * @param sourceId source ID as delivered in onSourceAdded
     */
    public void removeSource(BluetoothDevice sink, int sourceId) {
        log("removeSource: device = " + sink + ", sourceId " + sourceId);
        log("removeSource: device: " + sink + ", sourceId: " + sourceId);

        Map<BluetoothDevice, Integer> devices = getGroupManagedDeviceSources(sink, sourceId).second;
        for (Map.Entry<BluetoothDevice, Integer> deviceSourceIdPair : devices.entrySet()) {
@@ -1768,10 +1770,11 @@ public class BassClientService extends ProfileService {
            if (metaData != null && stateMachine.isSyncedToTheSource(sourceId)) {
                sEventLogger.logd(
                        TAG,
                        "Remove Broadcast Source(Force lost PA sync): device: "
                                + device
                                + ", sourceId: "
                                + sourceId);
                        "Remove Broadcast Source(Force lost PA sync): "
                                + ("device: " + device)
                                + (", sourceId: " + sourceId)
                                + (", broadcastId: " + metaData.getBroadcastId())
                                + (", broadcastName: " + metaData.getBroadcastName()));

                log("Force source to lost PA sync");
                Message message = stateMachine.obtainMessage(
@@ -2159,13 +2162,11 @@ public class BassClientService extends ProfileService {

                    sEventLogger.logd(
                            TAG,
                            "Modify Broadcast Source (resume): device: "
                                    + sink
                                    + ", sourceId: "
                                    + sourceId
                                    + ", updatedMetadata: "
                                    + metadata);

                            "Modify Broadcast Source (resume): "
                                    + ("device: " + sink)
                                    + ("sourceId: " + sourceId)
                                    + (", updatedBroadcastId: " + metadata.getBroadcastId())
                                    + (", updatedBroadcastName: " + metadata.getBroadcastName()));
                    Message message =
                            stateMachine.obtainMessage(BassClientStateMachine.UPDATE_BCAST_SOURCE);
                    message.arg1 = sourceId;
+11 −1
Original line number Diff line number Diff line
@@ -29,7 +29,6 @@ import static android.bluetooth.BluetoothLeAudioCodecConfig.SAMPLE_RATE_8000;
import static android.bluetooth.BluetoothLeAudioCodecConfig.SAMPLE_RATE_NONE;
import static android.bluetooth.BluetoothLeAudioCodecConfig.SampleRate;

import android.annotation.FlaggedApi;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SystemApi;
@@ -125,6 +124,17 @@ public final class BluetoothLeAudioCodecConfigMetadata implements Parcelable {
                Arrays.hashCode(mRawMetadata));
    }

    @Override
    public String toString() {
        return "BluetoothLeAudioCodecConfigMetadata{"
                + ("audioLocation=" + mAudioLocation)
                + (", sampleRate=" + mSampleRate)
                + (", frameDuration=" + mFrameDuration)
                + (", octetsPerFrame=" + mOctetsPerFrame)
                + (", rawMetadata=" + Arrays.toString(mRawMetadata))
                + '}';
    }

    /**
     * Get the audio location information as defined in the Generic Audio section of Bluetooth
     * Assigned numbers.
+9 −0
Original line number Diff line number Diff line
@@ -69,6 +69,15 @@ public final class BluetoothLeAudioContentMetadata implements Parcelable {
        return Objects.hash(mProgramInfo, mLanguage, Arrays.hashCode(mRawMetadata));
    }

    @Override
    public String toString() {
        return "BluetoothLeAudioContentMetadata{"
                + ("programInfo=" + mProgramInfo)
                + (", language=" + mLanguage)
                + (", rawMetadata=" + Arrays.toString(mRawMetadata))
                + '}';
    }

    /**
     * Get the title and/or summary of Audio Stream content in UTF-8 format.
     *
+9 −0
Original line number Diff line number Diff line
@@ -63,6 +63,15 @@ public final class BluetoothLeBroadcastChannel implements Parcelable {
        return Objects.hash(mIsSelected, mChannelIndex, mCodecMetadata);
    }

    @Override
    public String toString() {
        return "BluetoothLeBroadcastChannel{"
                + ("isSelected=" + mIsSelected)
                + (", channelIndex=" + mChannelIndex)
                + (", codecMetadata=" + mCodecMetadata)
                + '}';
    }

    /**
     * Return true if the channel is selected by Broadcast Assistant for the Broadcast Sink.
     *
+20 −0
Original line number Diff line number Diff line
@@ -189,6 +189,26 @@ public final class BluetoothLeBroadcastMetadata implements Parcelable {
                mSubgroups);
    }

    @Override
    public String toString() {
        return "BluetoothLeBroadcastMetadata{"
                + ("sourceAddressType=" + mSourceAddressType)
                + (", sourceDevice=" + mSourceDevice)
                + (", sourceAdvertisingSid=" + mSourceAdvertisingSid)
                + (", broadcastId=" + mBroadcastId)
                + (", paSyncInterval=" + mPaSyncInterval)
                + (", isEncrypted=" + mIsEncrypted)
                + (", isPublicBroadcast=" + mIsPublicBroadcast)
                + (", broadcastName=" + mBroadcastName)
                + (", broadcastCode=" + Arrays.toString(mBroadcastCode))
                + (", presentationDelayMicros=" + mPresentationDelayMicros)
                + (", audioConfigQuality=" + mAudioConfigQuality)
                + (", rssi=" + mRssi)
                + (", publicBroadcastMetadata=" + mPublicBroadcastMetadata)
                + (", subgroups=" + mSubgroups)
                + '}';
    }

    /**
     * Get the address type of the Broadcast Source.
     *
Loading