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

Commit 57b2597f authored by Rahul Sabnis's avatar Rahul Sabnis
Browse files

Add new extra EXTRA_TRANSPORT for acl connection state broadcasts to

identify whether the connection is over LE or BR/EDR

Tag: #feature
Bug: 213956674
Test: Manual
Change-Id: I0b00351c6f9597abd46cb6d6717eee8507333b1c
parent 966c88d1
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -756,6 +756,7 @@ final class RemoteDevices {
        if (newState == AbstractionLayer.BT_ACL_STATE_CONNECTED) {
            if (state == BluetoothAdapter.STATE_ON || state == BluetoothAdapter.STATE_TURNING_ON) {
                intent = new Intent(BluetoothDevice.ACTION_ACL_CONNECTED);
                intent.putExtra(BluetoothDevice.EXTRA_TRANSPORT, transportLinkType);
            } else if (state == BluetoothAdapter.STATE_BLE_ON
                    || state == BluetoothAdapter.STATE_BLE_TURNING_ON) {
                intent = new Intent(BluetoothAdapter.ACTION_BLE_ACL_CONNECTED);
@@ -774,6 +775,7 @@ final class RemoteDevices {
            }
            if (state == BluetoothAdapter.STATE_ON || state == BluetoothAdapter.STATE_TURNING_OFF) {
                intent = new Intent(BluetoothDevice.ACTION_ACL_DISCONNECTED);
                intent.putExtra(BluetoothDevice.EXTRA_TRANSPORT, transportLinkType);
            } else if (state == BluetoothAdapter.STATE_BLE_ON
                    || state == BluetoothAdapter.STATE_BLE_TURNING_OFF) {
                intent = new Intent(BluetoothAdapter.ACTION_BLE_ACL_DISCONNECTED);
+12 −4
Original line number Diff line number Diff line
@@ -135,7 +135,7 @@ public final class BluetoothDevice implements Parcelable, Attributable {
    /**
     * Broadcast Action: Indicates a low level (ACL) connection has been
     * established with a remote device.
     * <p>Always contains the extra field {@link #EXTRA_DEVICE}.
     * <p>Always contains the extra fields {@link #EXTRA_DEVICE} and {@link #EXTRA_TRANSPORT}.
     * <p>ACL connections are managed automatically by the Android Bluetooth
     * stack.
     */
@@ -164,7 +164,7 @@ public final class BluetoothDevice implements Parcelable, Attributable {
    /**
     * Broadcast Action: Indicates a low level (ACL) disconnection from a
     * remote device.
     * <p>Always contains the extra field {@link #EXTRA_DEVICE}.
     * <p>Always contains the extra fields {@link #EXTRA_DEVICE} and {@link #EXTRA_TRANSPORT}.
     * <p>ACL connections are managed automatically by the Android Bluetooth
     * stack.
     */
@@ -1020,12 +1020,12 @@ public final class BluetoothDevice implements Parcelable, Attributable {
    public static final int TRANSPORT_AUTO = 0;

    /**
     * Prefer BR/EDR transport for GATT connections to remote dual-mode devices
     * Constant representing the BR/EDR transport.
     */
    public static final int TRANSPORT_BREDR = 1;

    /**
     * Prefer LE transport for GATT connections to remote dual-mode devices
     * Constant representing the Bluetooth Low Energy (BLE) Transport.
     */
    public static final int TRANSPORT_LE = 2;

@@ -1085,6 +1085,14 @@ public final class BluetoothDevice implements Parcelable, Attributable {
    public static final String EXTRA_MAS_INSTANCE =
            "android.bluetooth.device.extra.MAS_INSTANCE";

    /**
     * Used as an int extra field in {@link #ACTION_ACL_CONNECTED} and
     * {@link #ACTION_ACL_DISCONNECTED} intents to indicate which transport is connected.
     * Possible values are: {@link #TRANSPORT_BREDR} and {@link #TRANSPORT_LE}.
     */
    @SuppressLint("ActionValue")
    public static final String EXTRA_TRANSPORT = "android.bluetooth.device.extra.TRANSPORT";

    /** @hide */
    @Retention(RetentionPolicy.SOURCE)
    @IntDef(