summaryrefslogtreecommitdiff
path: root/framework/java/android/bluetooth/BluetoothDevice.java
diff options
context:
space:
mode:
Diffstat (limited to 'framework/java/android/bluetooth/BluetoothDevice.java')
-rw-r--r--framework/java/android/bluetooth/BluetoothDevice.java38
1 files changed, 33 insertions, 5 deletions
diff --git a/framework/java/android/bluetooth/BluetoothDevice.java b/framework/java/android/bluetooth/BluetoothDevice.java
index 978c8ed4ac..698e409723 100644
--- a/framework/java/android/bluetooth/BluetoothDevice.java
+++ b/framework/java/android/bluetooth/BluetoothDevice.java
@@ -19,6 +19,7 @@ package android.bluetooth;
import static android.bluetooth.BluetoothUtils.getSyncTimeout;
import android.annotation.IntDef;
+import android.annotation.IntRange;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.RequiresPermission;
@@ -794,6 +795,15 @@ public final class BluetoothDevice implements Parcelable, Attributable {
/**
* Broadcast Action: This intent is used to broadcast CONNECTION ACCESS REQUEST
*
+ * This action will trigger a prompt for the user to accept or deny giving the
+ * permission for this device. Permissions can be specified with
+ * {@link #EXTRA_ACCESS_REQUEST_TYPE}.
+ *
+ * The reply will be an {@link #ACTION_CONNECTION_ACCESS_REPLY} sent to the specified
+ * {@link #EXTRA_PACKAGE_NAME} and {@link #EXTRA_CLASS_NAME}.
+ *
+ * This action can be cancelled with {@link #ACTION_CONNECTION_ACCESS_CANCEL}.
+ *
* @hide
*/
@SystemApi
@@ -807,6 +817,13 @@ public final class BluetoothDevice implements Parcelable, Attributable {
/**
* Broadcast Action: This intent is used to broadcast CONNECTION ACCESS REPLY
*
+ * This action is the reply from {@link #ACTION_CONNECTION_ACCESS_REQUEST}
+ * that is sent to the specified {@link #EXTRA_PACKAGE_NAME}
+ * and {@link #EXTRA_CLASS_NAME}.
+ *
+ * See the extra fields {@link #EXTRA_CONNECTION_ACCESS_RESULT} and
+ * {@link #EXTRA_ALWAYS_ALLOWED} for possible results.
+ *
* @hide
*/
@SystemApi
@@ -844,7 +861,11 @@ public final class BluetoothDevice implements Parcelable, Attributable {
"android.bluetooth.device.action.SILENCE_MODE_CHANGED";
/**
- * Used as an extra field in {@link #ACTION_CONNECTION_ACCESS_REQUEST} intent.
+ * Used as an extra field in {@link #ACTION_CONNECTION_ACCESS_REQUEST}.
+ *
+ * Possible values are {@link #REQUEST_TYPE_PROFILE_CONNECTION},
+ * {@link #REQUEST_TYPE_PHONEBOOK_ACCESS}, {@link #REQUEST_TYPE_MESSAGE_ACCESS}
+ * and {@link #REQUEST_TYPE_SIM_ACCESS}
*
* @hide
*/
@@ -888,6 +909,8 @@ public final class BluetoothDevice implements Parcelable, Attributable {
/**
* Used as an extra field in {@link #ACTION_CONNECTION_ACCESS_REPLY} intent.
*
+ * Possible values are {@link #CONNECTION_ACCESS_YES} and {@link #CONNECTION_ACCESS_NO}.
+ *
* @hide
*/
@SystemApi
@@ -1044,7 +1067,8 @@ public final class BluetoothDevice implements Parcelable, Attributable {
public static final int PAIRING_VARIANT_DISPLAY_PIN = 5;
/**
- * The user will be prompted to accept or deny the OOB pairing request
+ * The user will be prompted to accept or deny the OOB pairing request.
+ * This is used for Bluetooth 2.1 secure simple pairing.
*
* @hide
*/
@@ -1624,7 +1648,7 @@ public final class BluetoothDevice implements Parcelable, Attributable {
@RequiresLegacyBluetoothPermission
@RequiresBluetoothConnectPermission
@RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
- public int getBatteryLevel() {
+ public @IntRange(from = -100, to = 100) int getBatteryLevel() {
if (DBG) log("getBatteryLevel()");
final IBluetooth service = sService;
final int defaultValue = BATTERY_LEVEL_BLUETOOTH_OFF;
@@ -2009,10 +2033,14 @@ public final class BluetoothDevice implements Parcelable, Attributable {
/**
* Disconnects all connected bluetooth profiles between the local and remote device.
- * Disconnection is asynchronous and you should listen to each profile's broadcast intent
+ * Disconnection is asynchronous, so 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}
+ * {@link BluetoothA2dp#ACTION_CONNECTION_STATE_CHANGED}. Once all profiles have disconnected,
+ * the ACL link should come down and {@link #ACTION_ACL_DISCONNECTED} should be broadcast.
+ * <p>
+ * In the rare event that one or more profiles fail to disconnect, call this method again to
+ * send another request to disconnect each connected profile.
*
* @return whether the messages were successfully sent to try to disconnect all profiles
* @throws IllegalArgumentException if the device address is invalid