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

Commit a6a4472b authored by Jakub Tyszkowski's avatar Jakub Tyszkowski
Browse files

broadcaster: Add missing null checks at client side

These can be already checked at the frameworks side.

Bug: 150670922
Tag: #feature
Test: atest CtsBluetoothTestCases:android.bluetooth.cts.BluetoothHapClientTest
Sponsor: jpawlowski@
Change-Id: I1b3d68594f5c96343080d4cf693bd41cce8be581
parent c7ceab19
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -542,8 +542,8 @@ public final class BluetoothLeBroadcast implements AutoCloseable, BluetoothProfi
     *
     * @param contentMetadata metadata for the default Broadcast subgroup
     * @param broadcastCode Encryption will be enabled when <var>broadcastCode</var> is not null
     * @throws IllegalArgumentException if <var>contentMetadata</var> is null
     * @throws IllegalStateException if callback was not registered
     * @throws NullPointerException if <var>contentMetadata</var> is null
     * @hide
     */
    @SystemApi
@@ -554,6 +554,8 @@ public final class BluetoothLeBroadcast implements AutoCloseable, BluetoothProfi
    })
    public void startBroadcast(@NonNull BluetoothLeAudioContentMetadata contentMetadata,
            @Nullable byte[] broadcastCode) {
        Objects.requireNonNull(contentMetadata, "contentMetadata cannot be null");

        if (DBG) log("startBroadcasting");
        final IBluetoothLeAudio service = getService();
        if (service == null) {
@@ -579,6 +581,7 @@ public final class BluetoothLeBroadcast implements AutoCloseable, BluetoothProfi
     * @param broadcastId broadcastId as defined by the Basic Audio Profile
     * @param contentMetadata updated metadata for the default Broadcast subgroup
     * @throws IllegalStateException if callback was not registered
     * @throws NullPointerException if <var>contentMetadata</var> is null
     * @hide
     */
    @SystemApi
@@ -589,6 +592,8 @@ public final class BluetoothLeBroadcast implements AutoCloseable, BluetoothProfi
    })
    public void updateBroadcast(int broadcastId,
            @NonNull BluetoothLeAudioContentMetadata contentMetadata) {
        Objects.requireNonNull(contentMetadata, "contentMetadata cannot be null");

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