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

Commit 9a699a72 authored by Jack He's avatar Jack He Committed by Gerrit Code Review
Browse files

Merge changes from topic "le-audio-broadcast-old-api"

* changes:
  LeAudioService: Fix parcel cleaning for broadcast profile info
  le_audio: Use broadcast device for broadcasting usecase
parents 01e2e6a8 ade7bff3
Loading
Loading
Loading
Loading
+17 −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,20 @@ 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);

        BluetoothProfileConnectionInfo profileInfo =
                BluetoothProfileConnectionInfo.CREATOR.createFromParcel(parcel);
        parcel.recycle();
        return profileInfo;
    }

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

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