diff options
| author | 2022-05-03 08:22:29 +0800 | |
|---|---|---|
| committer | 2022-05-05 06:00:33 +0000 | |
| commit | 2b62de12ceb9ef77bcf116e4046cbfa3e16a678d (patch) | |
| tree | aa1a47eaa9d227897c8b80eaed2e07772c7c8950 | |
| parent | 100004b0ca9ba19de39987bb36eabd1caf236f0a (diff) | |
[LE broadcast sink] Add the broadcast sink apis
Bug: 228258236
Test: manual test
Change-Id: I7a5872a17f0e3d5e1b32579a2fb7b52c2236d060
| -rw-r--r-- | packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothLeBroadcastAssistant.java | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothLeBroadcastAssistant.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothLeBroadcastAssistant.java index c248fff09d6f..b0392be9d336 100644 --- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothLeBroadcastAssistant.java +++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothLeBroadcastAssistant.java @@ -26,6 +26,7 @@ import android.bluetooth.BluetoothClass; import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothLeBroadcastAssistant; import android.bluetooth.BluetoothLeBroadcastMetadata; +import android.bluetooth.BluetoothLeBroadcastReceiveState; import android.bluetooth.BluetoothProfile; import android.bluetooth.BluetoothProfile.ServiceListener; import android.content.Context; @@ -202,6 +203,43 @@ public class LocalBluetoothLeBroadcastAssistant implements LocalBluetoothProfile mService.startSearchingForSources(filters); } + /** + * Return true if a search has been started by this application. + * + * @return true if a search has been started by this application + * @hide + */ + public boolean isSearchInProgress() { + if (DEBUG) { + Log.d(TAG, "isSearchInProgress()"); + } + if (mService == null) { + Log.d(TAG, "The BluetoothLeBroadcastAssistant is null"); + return false; + } + return mService.isSearchInProgress(); + } + + /** + * Get information about all Broadcast Sources that a Broadcast Sink knows about. + * + * @param sink Broadcast Sink from which to get all Broadcast Sources + * @return the list of Broadcast Receive State {@link BluetoothLeBroadcastReceiveState} + * stored in the Broadcast Sink + * @throws NullPointerException when <var>sink</var> is null + */ + public @NonNull List<BluetoothLeBroadcastReceiveState> getAllSources( + @NonNull BluetoothDevice sink) { + if (DEBUG) { + Log.d(TAG, "getAllSources()"); + } + if (mService == null) { + Log.d(TAG, "The BluetoothLeBroadcastAssistant is null"); + return new ArrayList<BluetoothLeBroadcastReceiveState>(); + } + return mService.getAllSources(sink); + } + public void registerServiceCallBack(@NonNull @CallbackExecutor Executor executor, @NonNull BluetoothLeBroadcastAssistant.Callback callback) { if (mService == null) { |