summaryrefslogtreecommitdiff
path: root/core/java/android/bluetooth/BluetoothAdapter.java
diff options
context:
space:
mode:
authorRahul Sabnis <rahulsabnis@google.com>2020-02-05 14:03:19 -0800
committerRahul Sabnis <rahulsabnis@google.com>2020-02-05 16:37:18 -0800
commit966cef37c27d80aca5f6aedfb80b39f0e08e2296 (patch)
tree187ab97eeefecae90852e0e73ddcaeb83dd642c5 /core/java/android/bluetooth/BluetoothAdapter.java
parent53ae130d31a485682d8babdf0dbf9ab261732d66 (diff)
BluetoothAdapter#connectAllEnabledProfiles and
BluetoothAdapter#disconnectAllEnabledProfiles updated to require BLUETOOTH_PRIVILEGED permission and update documentation to indicate connection and disconnection is asynchronous Bug: 147321746 Test: Manual Change-Id: I961f02a539a247b1397ce4f478b9dc804d9973ab
Diffstat (limited to 'core/java/android/bluetooth/BluetoothAdapter.java')
-rw-r--r--core/java/android/bluetooth/BluetoothAdapter.java20
1 files changed, 14 insertions, 6 deletions
diff --git a/core/java/android/bluetooth/BluetoothAdapter.java b/core/java/android/bluetooth/BluetoothAdapter.java
index 56424c9f5a7d..0a9dbb608b9c 100644
--- a/core/java/android/bluetooth/BluetoothAdapter.java
+++ b/core/java/android/bluetooth/BluetoothAdapter.java
@@ -1861,15 +1861,19 @@ public final class BluetoothAdapter {
}
/**
- * Connects all enabled and supported bluetooth profiles between the local and remote device
+ * Connects all enabled and supported bluetooth profiles between the local and remote device.
+ * Connection is asynchronous and you should listen to each profile's broadcast intent
+ * ACTION_CONNECTION_STATE_CHANGED to verify whether connection was successful. For example,
+ * to verify a2dp is connected, you would listen for
+ * {@link BluetoothA2dp#ACTION_CONNECTION_STATE_CHANGED}
*
* @param device is the remote device with which to connect these profiles
- * @return true if all profiles successfully connected, false if an error occurred
+ * @return true if message sent to try to connect all profiles, false if an error occurred
*
* @hide
*/
@SystemApi
- @RequiresPermission(Manifest.permission.BLUETOOTH_ADMIN)
+ @RequiresPermission(Manifest.permission.BLUETOOTH_PRIVILEGED)
public boolean connectAllEnabledProfiles(@NonNull BluetoothDevice device) {
try {
mServiceLock.readLock().lock();
@@ -1886,15 +1890,19 @@ public final class BluetoothAdapter {
}
/**
- * Disconnects all enabled and supported bluetooth profiles between the local and remote device
+ * Disconnects all enabled and supported bluetooth profiles between the local and remote device.
+ * Disconnection is asynchronous and you should listen to each profile's broadcast intent
+ * ACTION_CONNECTION_STATE_CHANGED to verify whether disconnection was successful. For example,
+ * to verify a2dp is disconnected, you would listen for
+ * {@link BluetoothA2dp#ACTION_CONNECTION_STATE_CHANGED}
*
* @param device is the remote device with which to disconnect these profiles
- * @return true if all profiles successfully disconnected, false if an error occurred
+ * @return true if message sent to try to disconnect all profiles, false if an error occurred
*
* @hide
*/
@SystemApi
- @RequiresPermission(Manifest.permission.BLUETOOTH_ADMIN)
+ @RequiresPermission(Manifest.permission.BLUETOOTH_PRIVILEGED)
public boolean disconnectAllEnabledProfiles(@NonNull BluetoothDevice device) {
try {
mServiceLock.readLock().lock();