aboutsummaryrefslogtreecommitdiff
path: root/framework/java/android/bluetooth/BluetoothAdapter.java
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2022-03-03 02:31:40 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2022-03-03 02:31:40 +0000
commit835b73ada953ad6ce647ee782eaf7f4d91757b02 (patch)
tree652e081d120bd334652c8618f7af1c14b784e4a5 /framework/java/android/bluetooth/BluetoothAdapter.java
parentb7fd1c18ed8b0b86730c0735ca7905aee3e34a09 (diff)
parent4a680b9117becf05b2953b8e25f3c771d3d6e109 (diff)
Merge "Throw exception when LE state is on, but bluetooth service is null." am: 4a680b9117
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/2003692 Change-Id: I3bbae20133f7ee37569c9e7e923ec3047c667ca2
Diffstat (limited to 'framework/java/android/bluetooth/BluetoothAdapter.java')
-rw-r--r--framework/java/android/bluetooth/BluetoothAdapter.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/framework/java/android/bluetooth/BluetoothAdapter.java b/framework/java/android/bluetooth/BluetoothAdapter.java
index fdd02f7818..f93480502c 100644
--- a/framework/java/android/bluetooth/BluetoothAdapter.java
+++ b/framework/java/android/bluetooth/BluetoothAdapter.java
@@ -2458,6 +2458,7 @@ public final class BluetoothAdapter {
* supported, or an error code.
*
* @return whether the LE audio is supported
+ * @throws IllegalStateException if the bluetooth service is null
*/
@RequiresNoPermission
public @LeFeatureReturnValues int isLeAudioSupported() {
@@ -2471,6 +2472,9 @@ public final class BluetoothAdapter {
mService.isLeAudioSupported(recv);
return recv.awaitResultNoInterrupt(getSyncTimeout())
.getValue(BluetoothStatusCodes.ERROR_UNKNOWN);
+ } else {
+ throw new IllegalStateException(
+ "LE state is on, but there is no bluetooth service.");
}
} catch (TimeoutException e) {
Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
@@ -2488,6 +2492,7 @@ public final class BluetoothAdapter {
* feature is not supported, or an error code.
*
* @return whether the LE audio broadcast source is supported
+ * @throws IllegalStateException if the bluetooth service is null
*/
@RequiresNoPermission
public @LeFeatureReturnValues int isLeAudioBroadcastSourceSupported() {
@@ -2501,6 +2506,9 @@ public final class BluetoothAdapter {
mService.isLeAudioBroadcastSourceSupported(recv);
return recv.awaitResultNoInterrupt(getSyncTimeout())
.getValue(BluetoothStatusCodes.ERROR_UNKNOWN);
+ } else {
+ throw new IllegalStateException(
+ "LE state is on, but there is no bluetooth service.");
}
} catch (TimeoutException e) {
Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
@@ -2519,6 +2527,7 @@ public final class BluetoothAdapter {
* feature is not supported, or an error code.
*
* @return whether the LE audio broadcast assistent is supported
+ * @throws IllegalStateException if the bluetooth service is null
*/
@RequiresNoPermission
public @LeFeatureReturnValues int isLeAudioBroadcastAssistantSupported() {
@@ -2532,6 +2541,9 @@ public final class BluetoothAdapter {
mService.isLeAudioBroadcastAssistantSupported(recv);
return recv.awaitResultNoInterrupt(getSyncTimeout())
.getValue(BluetoothStatusCodes.ERROR_UNKNOWN);
+ } else {
+ throw new IllegalStateException(
+ "LE state is on, but there is no bluetooth service.");
}
} catch (TimeoutException e) {
Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));