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

Commit 0fdfd3e3 authored by Jack He's avatar Jack He Committed by Automerger Merge Worker
Browse files

Merge "[le audio] Broadcast service api enforce callback check" am: 5d2398cb...

Merge "[le audio] Broadcast service api enforce callback check" am: 5d2398cb am: 6963c212 am: cc715557

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/2579277



Change-Id: I9de8c74fb7d63034dfb693e82a175277ab0492fe
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents a0970906 cc715557
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -554,6 +554,9 @@ public final class BluetoothLeBroadcast implements AutoCloseable, BluetoothProfi
    public void startBroadcast(@NonNull BluetoothLeAudioContentMetadata contentMetadata,
            @Nullable byte[] broadcastCode) {
        Objects.requireNonNull(contentMetadata, "contentMetadata cannot be null");
        if (mCallbackExecutorMap.isEmpty()) {
            throw new IllegalStateException("No callback was ever registered");
        }

        if (DBG) log("startBroadcasting");
        final IBluetoothLeAudio service = getService();
@@ -593,6 +596,9 @@ public final class BluetoothLeBroadcast implements AutoCloseable, BluetoothProfi
            })
    public void startBroadcast(@NonNull BluetoothLeBroadcastSettings broadcastSettings) {
        Objects.requireNonNull(broadcastSettings, "broadcastSettings cannot be null");
        if (mCallbackExecutorMap.isEmpty()) {
            throw new IllegalStateException("No callback was ever registered");
        }

        if (DBG) log("startBroadcasting");
        final IBluetoothLeAudio service = getService();
@@ -637,6 +643,9 @@ public final class BluetoothLeBroadcast implements AutoCloseable, BluetoothProfi
    public void updateBroadcast(int broadcastId,
            @NonNull BluetoothLeAudioContentMetadata contentMetadata) {
        Objects.requireNonNull(contentMetadata, "contentMetadata cannot be null");
        if (mCallbackExecutorMap.isEmpty()) {
            throw new IllegalStateException("No callback was ever registered");
        }

        if (DBG) log("updateBroadcast");
        final IBluetoothLeAudio service = getService();
@@ -682,6 +691,9 @@ public final class BluetoothLeBroadcast implements AutoCloseable, BluetoothProfi
    public void updateBroadcast(
            int broadcastId, @NonNull BluetoothLeBroadcastSettings broadcastSettings) {
        Objects.requireNonNull(broadcastSettings, "broadcastSettings cannot be null");
        if (mCallbackExecutorMap.isEmpty()) {
            throw new IllegalStateException("No callback was ever registered");
        }

        if (DBG) log("updateBroadcast");
        final IBluetoothLeAudio service = getService();
@@ -721,6 +733,10 @@ public final class BluetoothLeBroadcast implements AutoCloseable, BluetoothProfi
            android.Manifest.permission.BLUETOOTH_PRIVILEGED,
    })
    public void stopBroadcast(int broadcastId) {
        if (mCallbackExecutorMap.isEmpty()) {
            throw new IllegalStateException("No callback was ever registered");
        }

        if (DBG) log("disableBroadcastMode");
        final IBluetoothLeAudio service = getService();
        if (service == null) {