Merge "Create systemapis to connect/disconnect all bt profiles" am: 7700b81cb3 am: 3e4a53735e
am: 0f6700acb5
Change-Id: I9b4a4b7ca4967bab1a6b3170941e2bb2fa79564d
This commit is contained in:
@@ -1733,6 +1733,56 @@ public final class BluetoothAdapter {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Connects all enabled and supported bluetooth profiles between the local and remote device
|
||||
*
|
||||
* @param device is the remote device with which to connect these profiles
|
||||
* @return true if all profiles successfully connected, false if an error occurred
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
@RequiresPermission(Manifest.permission.BLUETOOTH_ADMIN)
|
||||
public boolean connectAllEnabledProfiles(@NonNull BluetoothDevice device) {
|
||||
try {
|
||||
mServiceLock.readLock().lock();
|
||||
if (mService != null) {
|
||||
return mService.connectAllEnabledProfiles(device);
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
Log.e(TAG, "", e);
|
||||
} finally {
|
||||
mServiceLock.readLock().unlock();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disconnects all enabled and supported bluetooth profiles between the local and remote device
|
||||
*
|
||||
* @param device is the remote device with which to disconnect these profiles
|
||||
* @return true if all profiles successfully disconnected, false if an error occurred
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
@RequiresPermission(Manifest.permission.BLUETOOTH_ADMIN)
|
||||
public boolean disconnectAllEnabledProfiles(@NonNull BluetoothDevice device) {
|
||||
try {
|
||||
mServiceLock.readLock().lock();
|
||||
if (mService != null) {
|
||||
return mService.disconnectAllEnabledProfiles(device);
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
Log.e(TAG, "", e);
|
||||
} finally {
|
||||
mServiceLock.readLock().unlock();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the multi advertisement is supported by the chipset
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user