From e671840be397d266419e8a3fb47c08387f58998d Mon Sep 17 00:00:00 2001 From: tadvana Date: Wed, 26 Jan 2022 10:35:38 -0800 Subject: Introduces mechanism for background rfcomm servers This change adds a mechanism in the AdapterService which allows it to register RFCOMM listeners requested by a BluetoothAdapter. This is so that applications can request the framework to listen for incoming RFCOMM connections in the background. Apps can request that the bluetooth manager, via a BluetoothAdapter, listen on a specific service record, and then transact incoming socket connections after receiving a notification of availability via a PendingIntent. Tag: #feature Test: Run the CTS Bluetooth Rfcomm Handoff service Test. This requires two devices. Bug: 186494155 Ignore-AOSP-First: Need to commit to downstream first in order to resolve a merge conflict. Change-Id: Ia0c71969e691e6353f22fe3b7dae4a7500230e03 Merged-In: Ia0c71969e691e6353f22fe3b7dae4a7500230e03 --- .../android/bluetooth/BluetoothStatusCodes.java | 51 ++++++++++++++++++++++ 1 file changed, 51 insertions(+) (limited to 'framework/java/android/bluetooth/BluetoothStatusCodes.java') diff --git a/framework/java/android/bluetooth/BluetoothStatusCodes.java b/framework/java/android/bluetooth/BluetoothStatusCodes.java index c6f6cde44e..0425220c8d 100644 --- a/framework/java/android/bluetooth/BluetoothStatusCodes.java +++ b/framework/java/android/bluetooth/BluetoothStatusCodes.java @@ -309,6 +309,57 @@ public final class BluetoothStatusCodes { */ public static final int ERROR_LE_AUDIO_BROADCAST_SOURCE_DISABLE_ENCRYPTION_FAILED = 1115; + /** + * Indicates that the RFCOMM listener could not be started due to the requested UUID already + * being in use. + * + * @hide + */ + @SystemApi + public static final int RFCOMM_LISTENER_START_FAILED_UUID_IN_USE = 2000; + + /** + * Indicates that the operation could not be competed because the service record on which the + * operation was requested on does not exist. + * + * @hide + */ + @SystemApi + public static final int RFCOMM_LISTENER_OPERATION_FAILED_NO_MATCHING_SERVICE_RECORD = 2001; + + /** + * Indicates that the operation could not be completed because the application requesting the + * operation on the RFCOMM listener was not the one which registered it. + * + * @hide + */ + @SystemApi + public static final int RFCOMM_LISTENER_OPERATION_FAILED_DIFFERENT_APP = 2002; + + /** + * Indicates that the creation of the underlying BluetoothServerSocket failed. + * + * @hide + */ + @SystemApi + public static final int RFCOMM_LISTENER_FAILED_TO_CREATE_SERVER_SOCKET = 2003; + + /** + * Indicates that closing the underlying BluetoothServerSocket failed. + * + * @hide + */ + @SystemApi + public static final int RFCOMM_LISTENER_FAILED_TO_CLOSE_SERVER_SOCKET = 2004; + + /** + * Indicates that there is no socket available to retrieve from the given listener. + * + * @hide + */ + @SystemApi + public static final int RFCOMM_LISTENER_NO_SOCKET_AVAILABLE = 2005; + /** * Indicates that an unknown error has occurred has occurred. */ -- cgit v1.2.3