diff options
| author | Alice Kuo <aliceypkuo@google.com> | 2022-01-19 22:28:36 +0800 |
|---|---|---|
| committer | Alice Kuo <aliceypkuo@google.com> | 2022-01-20 13:30:02 +0800 |
| commit | a7168437addf28bc19dcd8439c9f10decde9256f (patch) | |
| tree | 6d6d3368351ec3645f35ff7bcc84c8371baf9741 /framework/java/android/bluetooth/BluetoothAdapter.java | |
| parent | c35fd28f4a290ffbd98c863de9d7cdff7af53a9e (diff) | |
Add broadcast feature supported API
Expose isLeAudioBroadcastSourceSupported and isLeAudioBroadcastAssistantSupported
API. It would check the controller capabilities for now, and plan to
check the profile enable status later.
Bug: 150670922
Bug: 208368819
Test: make build
Change-Id: Ic68a19575e09dc8cf525c28afaca92ea44158981
Merged-In: Ic68a19575e09dc8cf525c28afaca92ea44158981
Diffstat (limited to 'framework/java/android/bluetooth/BluetoothAdapter.java')
| -rw-r--r-- | framework/java/android/bluetooth/BluetoothAdapter.java | 64 |
1 files changed, 45 insertions, 19 deletions
diff --git a/framework/java/android/bluetooth/BluetoothAdapter.java b/framework/java/android/bluetooth/BluetoothAdapter.java index f94ee8579e..b70d268dee 100644 --- a/framework/java/android/bluetooth/BluetoothAdapter.java +++ b/framework/java/android/bluetooth/BluetoothAdapter.java @@ -2325,28 +2325,54 @@ public final class BluetoothAdapter { } /** - * Returns {@link BluetoothStatusCodes#SUCCESS} if LE Periodic Advertising Sync Transfer Sender - * feature is supported, returns {@link BluetoothStatusCodes#ERROR_FEATURE_NOT_SUPPORTED} if the - * feature is not supported or an error code + * Returns {@link BluetoothStatusCodes#SUCCESS} if the LE audio broadcast source + * feature is supported, {@link BluetoothStatusCodes#ERROR_FEATURE_NOT_SUPPORTED} if the + * feature is not supported, or an error code. * - * @return whether the chipset supports the LE Periodic Advertising Sync Transfer Sender feature + * @return whether the LE audio broadcast source is supported */ @RequiresNoPermission - public @LeFeatureReturnValues int isLePeriodicAdvertisingSyncTransferSenderSupported() { - if (!getLeAccess()) { - return BluetoothStatusCodes.ERROR_BLUETOOTH_NOT_ENABLED; - } - try { - mServiceLock.readLock().lock(); - if (mService != null) { - return mService.isLePeriodicAdvertisingSyncTransferSenderSupported(); - } - } catch (RemoteException e) { - e.rethrowFromSystemServer(); - } finally { - mServiceLock.readLock().unlock(); - } - return BluetoothStatusCodes.ERROR_UNKNOWN; + public @LeFeatureReturnValues int isLeAudioBroadcastSourceSupported() { + if (!getLeAccess()) { + return BluetoothStatusCodes.ERROR_BLUETOOTH_NOT_ENABLED; + } + try { + mServiceLock.readLock().lock(); + if (mService != null) { + return mService.isLeAudioBroadcastSourceSupported(); + } + } catch (RemoteException e) { + e.rethrowFromSystemServer(); + } finally { + mServiceLock.readLock().unlock(); + } + + return BluetoothStatusCodes.ERROR_UNKNOWN; + } + + /** + * Returns {@link BluetoothStatusCodes#SUCCESS} if the LE audio broadcast assistant + * feature is supported, {@link BluetoothStatusCodes#ERROR_FEATURE_NOT_SUPPORTED} if the + * feature is not supported, or an error code. + * + * @return whether the LE audio broadcast assistent is supported + */ + @RequiresNoPermission + public @LeFeatureReturnValues int isLeAudioBroadcastAssistantSupported() { + if (!getLeAccess()) { + return BluetoothStatusCodes.ERROR_BLUETOOTH_NOT_ENABLED; + } + try { + mServiceLock.readLock().lock(); + if (mService != null) { + return mService.isLeAudioBroadcastAssistantSupported(); + } + } catch (RemoteException e) { + e.rethrowFromSystemServer(); + } finally { + mServiceLock.readLock().unlock(); + } + return BluetoothStatusCodes.ERROR_UNKNOWN; } /** |
