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

Commit 871d130a authored by Grzegorz Kołodziejczyk's avatar Grzegorz Kołodziejczyk Committed by Jack He
Browse files

le_audio: Use broadcast device for broadcasting usecase

With this patch, Audio Frameworks is notified about Broadcast device to
be connected for broadcasting usecase.

Tag: #feature
Test: atest LeAudioServiceTest
Sponsor: jpawlowski@
Bug: 210986334
Merged-In: I69324802bddb5eeb05bdc8ccf7067d445a48026a
Change-Id: I69324802bddb5eeb05bdc8ccf7067d445a48026a
parent 82b06cbe
Loading
Loading
Loading
Loading
+14 −4
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ import android.media.BluetoothProfileConnectionInfo;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.Looper;
import android.os.Parcel;
import android.os.ParcelUuid;
import android.os.RemoteCallbackList;
import android.os.RemoteException;
@@ -1044,6 +1045,17 @@ public class LeAudioService extends ProfileService {
        }
    }

    BluetoothProfileConnectionInfo getBroadcastProfile(boolean suppressNoisyIntent) {
        Parcel parcel = Parcel.obtain();
        parcel.writeInt(BluetoothProfile.LE_AUDIO_BROADCAST);
        parcel.writeBoolean(suppressNoisyIntent);
        parcel.writeInt(-1 /* mVolume */);
        parcel.writeBoolean(true /* mIsLeOutput */);
        parcel.setDataPosition(0);

        return BluetoothProfileConnectionInfo.CREATOR.createFromParcel(parcel);
    }

    private void clearLostDevicesWhileStreaming(LeAudioGroupDescriptor descriptor) {
        if (DBG) {
            Log.d(TAG, " lost dev: " + descriptor.mLostLeadDeviceWhileStreaming);
@@ -1300,8 +1312,7 @@ public class LeAudioService extends ProfileService {
                        mActiveAudioOutDevice = null;
                        mAudioManager.handleBluetoothActiveDeviceChanged(mActiveAudioOutDevice,
                                previousDevice,
                                // TODO: implement createLeAudioBroadcastInfo()
                                BluetoothProfileConnectionInfo.createLeAudioInfo(false, true));
                                getBroadcastProfile(true));
                    }
                }

@@ -1334,8 +1345,7 @@ public class LeAudioService extends ProfileService {
                        mActiveAudioOutDevice = device;
                        mAudioManager.handleBluetoothActiveDeviceChanged(mActiveAudioOutDevice,
                                previousDevice,
                                // TODO: implement createLeAudioBroadcastInfo()
                                BluetoothProfileConnectionInfo.createLeAudioInfo(true, true));
                                getBroadcastProfile(false));
                    }
                }
            }