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

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

Merge "Add new extra EXTRA_TRANSPORT for acl connection state broadcasts to...

Merge "Add new extra EXTRA_TRANSPORT for acl connection state broadcasts to identify whether the connection is over LE or BR/EDR" am: 94339d1b am: 7162d3d7

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

Change-Id: I072923a56eb4cad847b9595f5b1602d9b1bdd3ab
parents 1a5c04f1 7162d3d7
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.
     */
@@ -1050,12 +1050,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;

@@ -1115,6 +1115,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(