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

Commit 8871bca9 authored by Chelsea Hao's avatar Chelsea Hao Committed by Android (Google) Code Review
Browse files

Merge "Add util function for modify source." into main

parents 061ebdb5 7a8f4f3d
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -409,6 +409,27 @@ public class LocalBluetoothLeBroadcastAssistant implements LocalBluetoothProfile
        return null;
    }

    /**
     * Modifies the source associated with a specific sink and source ID.
     *
     * @param sink Broadcast Sink device
     * @param sourceId Broadcast source id
     * @param source {@link BluetoothLeBroadcastMetadata} the updated source.
     */
    public void modifySource(
            @NonNull BluetoothDevice sink, @IntRange(from = 0x00, to = 0xFF) int sourceId,
            @NonNull BluetoothLeBroadcastMetadata source) {
        if (mService == null) {
            Log.d(TAG, "The BluetoothLeBroadcastAssistant is null");
            return;
        }
        try {
            mService.modifySource(sink, sourceId, source);
        } catch (IllegalArgumentException | NoSuchMethodError e) {
            Log.w(TAG, "Error calling modifySource()", e);
        }
    }

    /**
     * Register Broadcast Assistant Callbacks to track its state and receivers
     *