diff options
| author | Rahul Sabnis <rahulsabnis@google.com> | 2019-11-19 18:09:39 -0800 |
|---|---|---|
| committer | android-build-merger <android-build-merger@google.com> | 2019-11-19 18:09:39 -0800 |
| commit | d3d41774f9a228a8164ee8787d3d249014b040ae (patch) | |
| tree | 4c0118074070637832c2a87d6ad1d03ad5f77930 /core/java | |
| parent | 68eb3611d49fa5c7a653609b4122df589f0f2539 (diff) | |
| parent | 0f6700acb5fa3d3712b145e6d3f7edf6412626dd (diff) | |
Merge "Create systemapis to connect/disconnect all bt profiles" am: 7700b81cb3 am: 3e4a53735e
am: 0f6700acb5
Change-Id: I9b4a4b7ca4967bab1a6b3170941e2bb2fa79564d
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/bluetooth/BluetoothAdapter.java | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/core/java/android/bluetooth/BluetoothAdapter.java b/core/java/android/bluetooth/BluetoothAdapter.java index 566b38738dc1..9d152a7faf44 100644 --- a/core/java/android/bluetooth/BluetoothAdapter.java +++ b/core/java/android/bluetooth/BluetoothAdapter.java @@ -1734,6 +1734,56 @@ public final class BluetoothAdapter { } /** + * 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 * * @return true if Multiple Advertisement feature is supported |
