summaryrefslogtreecommitdiff
path: root/core/java/android
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2021-08-23 19:23:26 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2021-08-23 19:23:26 +0000
commit95d77312a95df882159bc9377e8f99273fedf806 (patch)
tree15692633fff4eee6ab68f71ff12c4c739e84fabc /core/java/android
parentf4d7116b4920032e4305c1fa3c869de96f875728 (diff)
parentee291365417b741a2a30844cd0d42514c77ae02e (diff)
Merge "Add a system api to fetch uuids by the specific transport"
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/bluetooth/BluetoothDevice.java27
1 files changed, 26 insertions, 1 deletions
diff --git a/core/java/android/bluetooth/BluetoothDevice.java b/core/java/android/bluetooth/BluetoothDevice.java
index 0969ec2269b1..38fb90d9c4a7 100644
--- a/core/java/android/bluetooth/BluetoothDevice.java
+++ b/core/java/android/bluetooth/BluetoothDevice.java
@@ -1622,13 +1622,38 @@ public final class BluetoothDevice implements Parcelable {
*/
@RequiresPermission(Manifest.permission.BLUETOOTH)
public boolean fetchUuidsWithSdp() {
+ return fetchUuidsWithSdp(TRANSPORT_AUTO);
+ }
+
+ /**
+ * Perform a service discovery on the remote device to get the UUIDs supported with the
+ * specific transport.
+ *
+ * <p>This API is asynchronous and {@link #ACTION_UUID} intent is sent,
+ * with the UUIDs supported by the remote end. If there is an error
+ * in getting the SDP or GATT records or if the process takes a long time, or the device
+ * is bonding and we have its UUIDs cached, {@link #ACTION_UUID} intent is sent with the
+ * UUIDs that is currently present in the cache. Clients should use the {@link #getUuids}
+ * to get UUIDs if service discovery is not to be performed. If there is an ongoing bonding
+ * process, service discovery or device inquiry, the request will be queued.
+ *
+ * @param transport - provide type of transport (e.g. LE or Classic).
+ * @return False if the check fails, True if the process of initiating an ACL connection
+ * to the remote device was started or cached UUIDs will be broadcast with the specific
+ * transport.
+ *
+ * @hide
+ */
+ @SystemApi
+ @RequiresPermission(Manifest.permission.BLUETOOTH_PRIVILEGED)
+ public boolean fetchUuidsWithSdp(@Transport int transport) {
final IBluetooth service = sService;
if (service == null || !isBluetoothEnabled()) {
Log.e(TAG, "BT not enabled. Cannot fetchUuidsWithSdp");
return false;
}
try {
- return service.fetchRemoteUuids(this);
+ return service.fetchRemoteUuids(this, transport);
} catch (RemoteException e) {
Log.e(TAG, "", e);
}