Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b019a3d9 authored by Rahul Sabnis's avatar Rahul Sabnis Committed by Automerger Merge Worker
Browse files

Update BluetoothHeadset#connectAudio and am: 030a5b1a

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/2037665

Change-Id: Iad9767bb11892d7c88ee9cb45c32fbc0269a2b61
parents ac817d0c 030a5b1a
Loading
Loading
Loading
Loading
+13 −7
Original line number Diff line number Diff line
@@ -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;
    }

    /**