diff options
| author | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2020-03-03 19:26:16 +0000 |
|---|---|---|
| committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2020-03-03 19:26:16 +0000 |
| commit | 488355b2064aaf9ed0908659b6241c9b92fb763c (patch) | |
| tree | 54b04e907ae081cf0cfb10e1a7e70dab0454ca26 /core/java/android/bluetooth/BluetoothDevice.java | |
| parent | 867f2e232ffa0ff7f165766a5a19467c3769298b (diff) | |
| parent | 1f9f5ddd1cb77c3079bb4d63efcfe3a14038ec28 (diff) | |
Merge "Update BluetoothDevice SystemApi permissions and disallow passing a null pin to BluetoothDevice#setPin" into rvc-dev am: 1f9f5ddd1c
Change-Id: Ia6ca3eee69bf89161824cf6b428363e48b9a8e3e
Diffstat (limited to 'core/java/android/bluetooth/BluetoothDevice.java')
| -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 2a4cec013fe1..da5c43caf9e2 100644 --- a/core/java/android/bluetooth/BluetoothDevice.java +++ b/core/java/android/bluetooth/BluetoothDevice.java @@ -1122,7 +1122,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) { @@ -1213,7 +1213,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) { @@ -1251,13 +1251,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) { @@ -1280,13 +1279,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) { @@ -1359,13 +1357,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) { @@ -1383,13 +1380,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) { @@ -1542,7 +1538,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; @@ -1578,6 +1574,7 @@ public final class BluetoothDevice implements Parcelable { * @hide */ @SystemApi + @RequiresPermission(Manifest.permission.BLUETOOTH_PRIVILEGED) public boolean cancelPairing() { final IBluetooth service = sService; if (service == null) { @@ -1609,8 +1606,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; @@ -1689,7 +1686,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}. @@ -1698,7 +1694,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; @@ -1718,7 +1714,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) { @@ -1765,7 +1761,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) { |
