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

Commit 7a8f4f3d authored by chelseahao's avatar chelseahao Committed by Chelsea Hao
Browse files

Add util function for modify source.

Test: atest
Bug: 384976631
Flag: com.android.settingslib.flags.audio_stream_play_pause_by_modify_source
Change-Id: Ie84350a93a16fe31205b83c7a5695cc3ed306e2e
parent dd8f4e6b
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
     *