diff options
| author | TreeHugger Robot <treehugger-gerrit@google.com> | 2020-03-03 19:14:16 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2020-03-03 19:14:16 +0000 |
| commit | 1f9f5ddd1cb77c3079bb4d63efcfe3a14038ec28 (patch) | |
| tree | 02672814114b220d4eb1881e48ba0660da9fb28a /core/java/android/bluetooth | |
| parent | c9611acb621254df51c3771033fd706a58d7e282 (diff) | |
| parent | 82425166a89a2ba15d1af8de4eddb62cbe56009e (diff) | |
Merge "Update BluetoothDevice SystemApi permissions and disallow passing a null pin to BluetoothDevice#setPin" into rvc-dev
Diffstat (limited to 'core/java/android/bluetooth')
| -rw-r--r-- | core/java/android/bluetooth/BluetoothDevice.java | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/core/java/android/bluetooth/BluetoothDevice.java b/core/java/android/bluetooth/BluetoothDevice.java index 3e1a480b4f66..6e5f914c3596 100644 --- a/core/java/android/bluetooth/BluetoothDevice.java +++ b/core/java/android/bluetooth/BluetoothDevice.java @@ -1118,7 +1118,7 @@ public final class BluetoothDevice implements Parcelable { * @hide */ @SystemApi - @RequiresPermission(Manifest.permission.BLUETOOTH) + @RequiresPermission(Manifest.permission.BLUETOOTH_PRIVILEGED) public int getBatteryLevel() { final IBluetooth service = sService; if (service == null) { @@ -1209,7 +1209,7 @@ public final class BluetoothDevice implements Parcelable { * @hide */ @SystemApi - @RequiresPermission(Manifest.permission.BLUETOOTH) + @RequiresPermission(Manifest.permission.BLUETOOTH_PRIVILEGED) public boolean isBondingInitiatedLocally() { final IBluetooth service = sService; if (service == null) { @@ -1247,13 +1247,12 @@ public final class BluetoothDevice implements Parcelable { /** * Cancel an in-progress bonding request started with {@link #createBond}. - * <p>Requires {@link android.Manifest.permission#BLUETOOTH_ADMIN}. * * @return true on success, false on error * @hide */ @SystemApi - @RequiresPermission(android.Manifest.permission.BLUETOOTH_ADMIN) + @RequiresPermission(Manifest.permission.BLUETOOTH_PRIVILEGED) public boolean cancelBondProcess() { final IBluetooth service = sService; if (service == null) { @@ -1276,13 +1275,12 @@ public final class BluetoothDevice implements Parcelable { * <p>Delete the link key associated with the remote device, and * immediately terminate connections to that device that require * authentication and encryption. - * <p>Requires {@link android.Manifest.permission#BLUETOOTH_ADMIN}. * * @return true on success, false on error * @hide */ @SystemApi - @RequiresPermission(android.Manifest.permission.BLUETOOTH_ADMIN) + @RequiresPermission(Manifest.permission.BLUETOOTH_PRIVILEGED) public boolean removeBond() { final IBluetooth service = sService; if (service == null) { @@ -1355,13 +1353,12 @@ public final class BluetoothDevice implements Parcelable { /** * Returns whether there is an open connection to this device. - * <p>Requires {@link android.Manifest.permission#BLUETOOTH}. * * @return True if there is at least one open connection to this device. * @hide */ @SystemApi - @RequiresPermission(android.Manifest.permission.BLUETOOTH) + @RequiresPermission(Manifest.permission.BLUETOOTH) public boolean isConnected() { final IBluetooth service = sService; if (service == null) { @@ -1379,13 +1376,12 @@ public final class BluetoothDevice implements Parcelable { /** * Returns whether there is an open connection to this device * that has been encrypted. - * <p>Requires {@link android.Manifest.permission#BLUETOOTH}. * * @return True if there is at least one encrypted connection to this device. * @hide */ @SystemApi - @RequiresPermission(android.Manifest.permission.BLUETOOTH) + @RequiresPermission(Manifest.permission.BLUETOOTH) public boolean isEncrypted() { final IBluetooth service = sService; if (service == null) { @@ -1538,7 +1534,7 @@ public final class BluetoothDevice implements Parcelable { */ @SystemApi @RequiresPermission(Manifest.permission.BLUETOOTH_ADMIN) - public boolean setPin(@Nullable String pin) { + public boolean setPin(@NonNull String pin) { byte[] pinBytes = convertPinToBytes(pin); if (pinBytes == null) { return false; @@ -1574,6 +1570,7 @@ public final class BluetoothDevice implements Parcelable { * @hide */ @SystemApi + @RequiresPermission(Manifest.permission.BLUETOOTH_PRIVILEGED) public boolean cancelPairing() { final IBluetooth service = sService; if (service == null) { @@ -1605,8 +1602,8 @@ public final class BluetoothDevice implements Parcelable { * @hide */ @SystemApi - @RequiresPermission(Manifest.permission.BLUETOOTH) - public int getPhonebookAccessPermission() { + @RequiresPermission(Manifest.permission.BLUETOOTH_PRIVILEGED) + public @AccessPermission int getPhonebookAccessPermission() { final IBluetooth service = sService; if (service == null) { return ACCESS_UNKNOWN; @@ -1685,7 +1682,6 @@ public final class BluetoothDevice implements Parcelable { /** * Sets whether the phonebook access is allowed to this device. - * <p>Requires {@link android.Manifest.permission#BLUETOOTH_PRIVILEGED}. * * @param value Can be {@link #ACCESS_UNKNOWN}, {@link #ACCESS_ALLOWED} or {@link * #ACCESS_REJECTED}. @@ -1694,7 +1690,7 @@ public final class BluetoothDevice implements Parcelable { */ @SystemApi @RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED) - public boolean setPhonebookAccessPermission(int value) { + public boolean setPhonebookAccessPermission(@AccessPermission int value) { final IBluetooth service = sService; if (service == null) { return false; @@ -1714,7 +1710,7 @@ public final class BluetoothDevice implements Parcelable { * @hide */ @SystemApi - @RequiresPermission(Manifest.permission.BLUETOOTH) + @RequiresPermission(Manifest.permission.BLUETOOTH_PRIVILEGED) public @AccessPermission int getMessageAccessPermission() { final IBluetooth service = sService; if (service == null) { @@ -1761,7 +1757,7 @@ public final class BluetoothDevice implements Parcelable { * @hide */ @SystemApi - @RequiresPermission(Manifest.permission.BLUETOOTH) + @RequiresPermission(Manifest.permission.BLUETOOTH_PRIVILEGED) public @AccessPermission int getSimAccessPermission() { final IBluetooth service = sService; if (service == null) { |
