summaryrefslogtreecommitdiff
path: root/framework/java/android/bluetooth/BluetoothHeadset.java
diff options
context:
space:
mode:
authorRahul Sabnis <rahulsabnis@google.com>2022-03-23 02:49:34 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2022-03-23 02:49:34 +0000
commit3ac65a2dd685254433ffe9092b8ee2dbbb3a692e (patch)
treeb1f752faef19a73624662d466a644ad8ee64ee4b /framework/java/android/bluetooth/BluetoothHeadset.java
parent6cc3890648018cac0699132cf7123fff932a155f (diff)
parentb019a3d9eefddfe3b154a3fa27b593529b85edd3 (diff)
Update BluetoothHeadset#connectAudio and am: 030a5b1a8d am: b019a3d9ee
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/2037665 Change-Id: I49cb369facb86bff98cbff0c8f1fca101476ca5c
Diffstat (limited to 'framework/java/android/bluetooth/BluetoothHeadset.java')
-rw-r--r--framework/java/android/bluetooth/BluetoothHeadset.java20
1 files changed, 13 insertions, 7 deletions
diff --git a/framework/java/android/bluetooth/BluetoothHeadset.java b/framework/java/android/bluetooth/BluetoothHeadset.java
index 015f0bd6fb..8fe759ee25 100644
--- a/framework/java/android/bluetooth/BluetoothHeadset.java
+++ b/framework/java/android/bluetooth/BluetoothHeadset.java
@@ -1104,6 +1104,7 @@ public final class BluetoothHeadset implements BluetoothProfile {
BluetoothStatusCodes.ERROR_UNKNOWN,
BluetoothStatusCodes.ERROR_PROFILE_SERVICE_NOT_BOUND,
BluetoothStatusCodes.ERROR_TIMEOUT,
+ BluetoothStatusCodes.ERROR_BLUETOOTH_NOT_ENABLED,
BluetoothStatusCodes.ERROR_AUDIO_DEVICE_ALREADY_CONNECTED,
BluetoothStatusCodes.ERROR_NO_ACTIVE_DEVICES,
BluetoothStatusCodes.ERROR_NOT_ACTIVE_DEVICE,
@@ -1118,11 +1119,11 @@ public final class BluetoothHeadset implements BluetoothProfile {
* can be identified with {@link BluetoothAdapter#getActiveDevices(int)}.
* <p>
* If this function returns {@link BluetoothStatusCodes#SUCCESS}, the intent
- * {@link #ACTION_AUDIO_STATE_CHANGED} will be broadcasted twice. First with {@link #EXTRA_STATE}
- * set to {@link #STATE_AUDIO_CONNECTING}. This will be followed by a broadcast with
- * {@link #EXTRA_STATE} set to either {@link #STATE_AUDIO_CONNECTED} if the audio connection is
- * established or {@link #STATE_AUDIO_DISCONNECTED} if there was a failure in establishing the
- * audio connection.
+ * {@link #ACTION_AUDIO_STATE_CHANGED} will be broadcasted twice. First with
+ * {@link #EXTRA_STATE} set to {@link #STATE_AUDIO_CONNECTING}. This will be followed by a
+ * broadcast with {@link #EXTRA_STATE} set to either {@link #STATE_AUDIO_CONNECTED} if the audio
+ * connection is established or {@link #STATE_AUDIO_DISCONNECTED} if there was a failure in
+ * establishing the audio connection.
*
* @return whether the connection was successfully initiated or an error code on failure
* @hide
@@ -1140,6 +1141,7 @@ public final class BluetoothHeadset implements BluetoothProfile {
if (service == null) {
Log.w(TAG, "Proxy not attached to service");
if (DBG) log(Log.getStackTraceString(new Throwable()));
+ return BluetoothStatusCodes.ERROR_PROFILE_SERVICE_NOT_BOUND;
} else if (isEnabled()) {
try {
final SynchronousResultReceiver<Integer> recv = new SynchronousResultReceiver();
@@ -1152,8 +1154,9 @@ public final class BluetoothHeadset implements BluetoothProfile {
Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
return BluetoothStatusCodes.ERROR_TIMEOUT;
}
+ } else {
+ return BluetoothStatusCodes.ERROR_BLUETOOTH_NOT_ENABLED;
}
- return defaultValue;
}
/** @hide */
@@ -1163,6 +1166,7 @@ public final class BluetoothHeadset implements BluetoothProfile {
BluetoothStatusCodes.ERROR_UNKNOWN,
BluetoothStatusCodes.ERROR_PROFILE_SERVICE_NOT_BOUND,
BluetoothStatusCodes.ERROR_TIMEOUT,
+ BluetoothStatusCodes.ERROR_BLUETOOTH_NOT_ENABLED,
BluetoothStatusCodes.ERROR_PROFILE_NOT_CONNECTED,
BluetoothStatusCodes.ERROR_AUDIO_DEVICE_ALREADY_DISCONNECTED
})
@@ -1192,6 +1196,7 @@ public final class BluetoothHeadset implements BluetoothProfile {
if (service == null) {
Log.w(TAG, "Proxy not attached to service");
if (DBG) log(Log.getStackTraceString(new Throwable()));
+ return BluetoothStatusCodes.ERROR_PROFILE_SERVICE_NOT_BOUND;
} else if (isEnabled()) {
try {
final SynchronousResultReceiver<Integer> recv = new SynchronousResultReceiver();
@@ -1204,8 +1209,9 @@ public final class BluetoothHeadset implements BluetoothProfile {
Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
return BluetoothStatusCodes.ERROR_TIMEOUT;
}
+ } else {
+ return BluetoothStatusCodes.ERROR_BLUETOOTH_NOT_ENABLED;
}
- return defaultValue;
}
/**