Merge "Add a system api to fetch uuids by the specific transport" into sc-dev-plus-aosp am: a928d17bd8 am: e412df1b71

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15544581

Change-Id: I105a62a14fbfc742f5240e79fc143dc5d640e451
This commit is contained in:
TreeHugger Robot
2021-08-19 00:52:01 +00:00
committed by Automerger Merge Worker
2 changed files with 30 additions and 1 deletions

View File

@@ -1967,6 +1967,7 @@ package android.bluetooth {
method @RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT, android.Manifest.permission.BLUETOOTH_PRIVILEGED}) public boolean canBondWithoutDialog(); method @RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT, android.Manifest.permission.BLUETOOTH_PRIVILEGED}) public boolean canBondWithoutDialog();
method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public boolean cancelBondProcess(); method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public boolean cancelBondProcess();
method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public boolean createBondOutOfBand(int, @Nullable android.bluetooth.OobData, @Nullable android.bluetooth.OobData); method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public boolean createBondOutOfBand(int, @Nullable android.bluetooth.OobData, @Nullable android.bluetooth.OobData);
method @RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT, android.Manifest.permission.BLUETOOTH_PRIVILEGED}) public boolean fetchUuidsWithSdp(int);
method @Nullable @RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT, android.Manifest.permission.BLUETOOTH_PRIVILEGED}) public byte[] getMetadata(int); method @Nullable @RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT, android.Manifest.permission.BLUETOOTH_PRIVILEGED}) public byte[] getMetadata(int);
method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public int getSimAccessPermission(); method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public int getSimAccessPermission();
method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public boolean isConnected(); method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public boolean isConnected();

View File

@@ -1791,13 +1791,41 @@ public final class BluetoothDevice implements Parcelable, Attributable {
@RequiresBluetoothConnectPermission @RequiresBluetoothConnectPermission
@RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
public boolean fetchUuidsWithSdp() { 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(allOf = {
android.Manifest.permission.BLUETOOTH_CONNECT,
android.Manifest.permission.BLUETOOTH_PRIVILEGED,
})
public boolean fetchUuidsWithSdp(@Transport int transport) {
final IBluetooth service = sService; final IBluetooth service = sService;
if (service == null || !isBluetoothEnabled()) { if (service == null || !isBluetoothEnabled()) {
Log.e(TAG, "BT not enabled. Cannot fetchUuidsWithSdp"); Log.e(TAG, "BT not enabled. Cannot fetchUuidsWithSdp");
return false; return false;
} }
try { try {
return service.fetchRemoteUuidsWithAttribution(this, mAttributionSource); return service.fetchRemoteUuidsWithAttribution(this, transport, mAttributionSource);
} catch (RemoteException e) { } catch (RemoteException e) {
Log.e(TAG, "", e); Log.e(TAG, "", e);
} }