Update HAL interface for Bluetooth Socket Offload with RFCOMM
Bug: 342012881
Test: m android.hardware.bluetooth.socket-update-api
Change-Id: I517038fff1c9b5d736b974fe055db9185729d9eb
diff --git a/bluetooth/socket/aidl/aidl_api/android.hardware.bluetooth.socket/current/android/hardware/bluetooth/socket/ChannelInfo.aidl b/bluetooth/socket/aidl/aidl_api/android.hardware.bluetooth.socket/current/android/hardware/bluetooth/socket/ChannelInfo.aidl
index c9f81bb..b9b9593 100644
--- a/bluetooth/socket/aidl/aidl_api/android.hardware.bluetooth.socket/current/android/hardware/bluetooth/socket/ChannelInfo.aidl
+++ b/bluetooth/socket/aidl/aidl_api/android.hardware.bluetooth.socket/current/android/hardware/bluetooth/socket/ChannelInfo.aidl
@@ -35,4 +35,5 @@
@VintfStability
union ChannelInfo {
android.hardware.bluetooth.socket.LeCocChannelInfo leCocChannelInfo;
+ android.hardware.bluetooth.socket.RfcommChannelInfo rfcommChannelInfo;
}
diff --git a/bluetooth/socket/aidl/aidl_api/android.hardware.bluetooth.socket/current/android/hardware/bluetooth/socket/RfcommCapabilities.aidl b/bluetooth/socket/aidl/aidl_api/android.hardware.bluetooth.socket/current/android/hardware/bluetooth/socket/RfcommCapabilities.aidl
new file mode 100644
index 0000000..06a75b4
--- /dev/null
+++ b/bluetooth/socket/aidl/aidl_api/android.hardware.bluetooth.socket/current/android/hardware/bluetooth/socket/RfcommCapabilities.aidl
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.bluetooth.socket;
+@VintfStability
+parcelable RfcommCapabilities {
+ int numberOfSupportedSockets;
+ int maxFrameSize;
+}
diff --git a/bluetooth/socket/aidl/aidl_api/android.hardware.bluetooth.socket/current/android/hardware/bluetooth/socket/RfcommChannelInfo.aidl b/bluetooth/socket/aidl/aidl_api/android.hardware.bluetooth.socket/current/android/hardware/bluetooth/socket/RfcommChannelInfo.aidl
new file mode 100644
index 0000000..3f9a140
--- /dev/null
+++ b/bluetooth/socket/aidl/aidl_api/android.hardware.bluetooth.socket/current/android/hardware/bluetooth/socket/RfcommChannelInfo.aidl
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.bluetooth.socket;
+@VintfStability
+parcelable RfcommChannelInfo {
+ int localCid;
+ int remoteCid;
+ int localMtu;
+ int remoteMtu;
+ int initialRxCredits;
+ int initialTxCredits;
+ int dlci;
+ int maxFrameSize;
+ boolean muxInitiator;
+}
diff --git a/bluetooth/socket/aidl/aidl_api/android.hardware.bluetooth.socket/current/android/hardware/bluetooth/socket/SocketCapabilities.aidl b/bluetooth/socket/aidl/aidl_api/android.hardware.bluetooth.socket/current/android/hardware/bluetooth/socket/SocketCapabilities.aidl
index 9b18926..400f20c 100644
--- a/bluetooth/socket/aidl/aidl_api/android.hardware.bluetooth.socket/current/android/hardware/bluetooth/socket/SocketCapabilities.aidl
+++ b/bluetooth/socket/aidl/aidl_api/android.hardware.bluetooth.socket/current/android/hardware/bluetooth/socket/SocketCapabilities.aidl
@@ -35,4 +35,5 @@
@VintfStability
parcelable SocketCapabilities {
android.hardware.bluetooth.socket.LeCocCapabilities leCocCapabilities;
+ android.hardware.bluetooth.socket.RfcommCapabilities rfcommCapabilities;
}
diff --git a/bluetooth/socket/aidl/android/hardware/bluetooth/socket/ChannelInfo.aidl b/bluetooth/socket/aidl/android/hardware/bluetooth/socket/ChannelInfo.aidl
index 415c34f..afae1c0 100644
--- a/bluetooth/socket/aidl/android/hardware/bluetooth/socket/ChannelInfo.aidl
+++ b/bluetooth/socket/aidl/android/hardware/bluetooth/socket/ChannelInfo.aidl
@@ -17,6 +17,7 @@
package android.hardware.bluetooth.socket;
import android.hardware.bluetooth.socket.LeCocChannelInfo;
+import android.hardware.bluetooth.socket.RfcommChannelInfo;
/**
* Used to specify the channel information of different protocol.
@@ -27,4 +28,9 @@
* LE L2CAP COC channel information.
*/
LeCocChannelInfo leCocChannelInfo;
+
+ /**
+ * RFCOMM channel information.
+ */
+ RfcommChannelInfo rfcommChannelInfo;
}
diff --git a/bluetooth/socket/aidl/android/hardware/bluetooth/socket/RfcommCapabilities.aidl b/bluetooth/socket/aidl/android/hardware/bluetooth/socket/RfcommCapabilities.aidl
new file mode 100644
index 0000000..e5cffff
--- /dev/null
+++ b/bluetooth/socket/aidl/android/hardware/bluetooth/socket/RfcommCapabilities.aidl
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.bluetooth.socket;
+
+/**
+ * Capabilities for RFCOMM that the offload stack supports.
+ */
+@VintfStability
+parcelable RfcommCapabilities {
+ /**
+ * Maximum number of RFCOMM sockets supported. If not supported, the value must be zero.
+ */
+ int numberOfSupportedSockets;
+
+ /**
+ * Maximum frame size in octets negotiated during DLCI establishment. The frame size must be
+ * in range 23 to 32767.
+ */
+ int maxFrameSize;
+}
diff --git a/bluetooth/socket/aidl/android/hardware/bluetooth/socket/RfcommChannelInfo.aidl b/bluetooth/socket/aidl/android/hardware/bluetooth/socket/RfcommChannelInfo.aidl
new file mode 100644
index 0000000..7c10144
--- /dev/null
+++ b/bluetooth/socket/aidl/android/hardware/bluetooth/socket/RfcommChannelInfo.aidl
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.bluetooth.socket;
+
+/**
+ * RFCOMM channel information
+ */
+@VintfStability
+parcelable RfcommChannelInfo {
+ /**
+ * L2cap local channel ID for RFCOMM.
+ */
+ int localCid;
+
+ /**
+ * L2cap remote channel ID for RFCOMM.
+ */
+ int remoteCid;
+
+ /**
+ * Local Maximum Transmission Unit Size in bytes that the local L2CAP layer can receive.
+ */
+ int localMtu;
+
+ /**
+ * Remote Maximum Transmission Unit Size in bytes that the remote L2CAP layer can receive.
+ */
+ int remoteMtu;
+
+ /**
+ * Protocol initial credits at Rx path.
+ *
+ * The host stack will always set the initial credits to 0 when configuring the RFCOMM
+ * channel, and this value will always be zero. It means offload stack should send initial
+ * credits to peer device when IBluetoothSocket.opened() is successful.
+ */
+ int initialRxCredits;
+
+ /**
+ * Protocol initial credits at Tx path.
+ */
+ int initialTxCredits;
+
+ /**
+ * Data Link Connection Identifier (DLCI).
+ */
+ int dlci;
+
+ /**
+ * Maximum frame size negotiated during DLCI establishment.
+ */
+ int maxFrameSize;
+
+ /**
+ * Flag of whether the Android stack initiated the RFCOMM multiplexer control channel.
+ *
+ * This flag determines the value of the Command/Response (C/R) bit of RFCOMM frames.
+ */
+ boolean muxInitiator;
+}
diff --git a/bluetooth/socket/aidl/android/hardware/bluetooth/socket/SocketCapabilities.aidl b/bluetooth/socket/aidl/android/hardware/bluetooth/socket/SocketCapabilities.aidl
index 9c7bced..05a59ee 100644
--- a/bluetooth/socket/aidl/android/hardware/bluetooth/socket/SocketCapabilities.aidl
+++ b/bluetooth/socket/aidl/android/hardware/bluetooth/socket/SocketCapabilities.aidl
@@ -17,6 +17,7 @@
package android.hardware.bluetooth.socket;
import android.hardware.bluetooth.socket.LeCocCapabilities;
+import android.hardware.bluetooth.socket.RfcommCapabilities;
/**
* Supported socket protocol capabilities.
@@ -27,4 +28,9 @@
* Supported LE CoC protocol capabilities.
*/
LeCocCapabilities leCocCapabilities;
+
+ /**
+ * Supported RFCOMM protocol capabilities.
+ */
+ RfcommCapabilities rfcommCapabilities;
}