Merge "[LE broadcast sink] Add the broadcast sink apis" into tm-dev am: 5f937a7093
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18130743 Change-Id: Id17dd2c85cdde329cfa8c59fdbba262313874338 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -26,6 +26,7 @@ import android.bluetooth.BluetoothClass;
|
|||||||
import android.bluetooth.BluetoothDevice;
|
import android.bluetooth.BluetoothDevice;
|
||||||
import android.bluetooth.BluetoothLeBroadcastAssistant;
|
import android.bluetooth.BluetoothLeBroadcastAssistant;
|
||||||
import android.bluetooth.BluetoothLeBroadcastMetadata;
|
import android.bluetooth.BluetoothLeBroadcastMetadata;
|
||||||
|
import android.bluetooth.BluetoothLeBroadcastReceiveState;
|
||||||
import android.bluetooth.BluetoothProfile;
|
import android.bluetooth.BluetoothProfile;
|
||||||
import android.bluetooth.BluetoothProfile.ServiceListener;
|
import android.bluetooth.BluetoothProfile.ServiceListener;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@@ -202,6 +203,43 @@ public class LocalBluetoothLeBroadcastAssistant implements LocalBluetoothProfile
|
|||||||
mService.startSearchingForSources(filters);
|
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,
|
public void registerServiceCallBack(@NonNull @CallbackExecutor Executor executor,
|
||||||
@NonNull BluetoothLeBroadcastAssistant.Callback callback) {
|
@NonNull BluetoothLeBroadcastAssistant.Callback callback) {
|
||||||
if (mService == null) {
|
if (mService == null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user