Skip to content
Snippets Groups Projects
Commit 5d2398cb authored by Jack He's avatar Jack He Committed by Gerrit Code Review
Browse files

Merge "[le audio] Broadcast service api enforce callback check"

parents d438c5b2 6fbd7887
No related branches found
No related tags found
No related merge requests found
......@@ -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) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment