summaryrefslogtreecommitdiffstats
path: root/core/java/android/bluetooth/BluetoothDevice.java
diff options
context:
space:
mode:
authorTor Norbye <tnorbye@google.com>2015-05-15 14:21:12 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-05-15 14:21:16 +0000
commitf02fd46d34624b4549565be777deff8328bbdc05 (patch)
tree6a69f6598d8275436cfe9bc8389e9ed54a0a05bd /core/java/android/bluetooth/BluetoothDevice.java
parentb1f1293355a1837d95095d28891f9218bdcf2bdd (diff)
parent2d49752ee050ab7f1cd848933f6c62a73707e2d9 (diff)
downloadframeworks_base-f02fd46d34624b4549565be777deff8328bbdc05.zip
frameworks_base-f02fd46d34624b4549565be777deff8328bbdc05.tar.gz
frameworks_base-f02fd46d34624b4549565be777deff8328bbdc05.tar.bz2
Merge "Add bluetooth permission annotations" into mnc-dev
Diffstat (limited to 'core/java/android/bluetooth/BluetoothDevice.java')
-rw-r--r--core/java/android/bluetooth/BluetoothDevice.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/core/java/android/bluetooth/BluetoothDevice.java b/core/java/android/bluetooth/BluetoothDevice.java
index bfc374f..26a91e4 100644
--- a/core/java/android/bluetooth/BluetoothDevice.java
+++ b/core/java/android/bluetooth/BluetoothDevice.java
@@ -16,6 +16,8 @@
package android.bluetooth;
+import android.Manifest;
+import android.annotation.RequiresPermission;
import android.annotation.SdkConstant;
import android.annotation.SdkConstant.SdkConstantType;
import android.annotation.SystemApi;
@@ -709,6 +711,7 @@ public final class BluetoothDevice implements Parcelable {
*
* @return the Bluetooth name, or null if there was a problem.
*/
+ @RequiresPermission(Manifest.permission.BLUETOOTH)
public String getName() {
if (sService == null) {
Log.e(TAG, "BT not enabled. Cannot get Remote Device name");
@@ -729,6 +732,7 @@ public final class BluetoothDevice implements Parcelable {
* {@link #DEVICE_TYPE_DUAL}.
* {@link #DEVICE_TYPE_UNKNOWN} if it's not available
*/
+ @RequiresPermission(Manifest.permission.BLUETOOTH)
public int getType() {
if (sService == null) {
Log.e(TAG, "BT not enabled. Cannot get Remote Device type");
@@ -807,6 +811,7 @@ public final class BluetoothDevice implements Parcelable {
*
* @return false on immediate error, true if bonding will begin
*/
+ @RequiresPermission(Manifest.permission.BLUETOOTH_ADMIN)
public boolean createBond() {
if (sService == null) {
Log.e(TAG, "BT not enabled. Cannot create bond to Remote Device");
@@ -948,6 +953,7 @@ public final class BluetoothDevice implements Parcelable {
*
* @return the bond state
*/
+ @RequiresPermission(Manifest.permission.BLUETOOTH)
public int getBondState() {
if (sService == null) {
Log.e(TAG, "BT not enabled. Cannot get bond state");
@@ -1014,6 +1020,7 @@ public final class BluetoothDevice implements Parcelable {
*
* @return Bluetooth class object, or null on error
*/
+ @RequiresPermission(Manifest.permission.BLUETOOTH)
public BluetoothClass getBluetoothClass() {
if (sService == null) {
Log.e(TAG, "BT not enabled. Cannot get Bluetooth Class");
@@ -1039,6 +1046,7 @@ public final class BluetoothDevice implements Parcelable {
* @return the supported features (UUIDs) of the remote device,
* or null on error
*/
+ @RequiresPermission(Manifest.permission.BLUETOOTH)
public ParcelUuid[] getUuids() {
if (sService == null || isBluetoothEnabled() == false) {
Log.e(TAG, "BT not enabled. Cannot get remote device Uuids");
@@ -1065,6 +1073,7 @@ public final class BluetoothDevice implements Parcelable {
* of initiating an ACL connection to the remote device
* was started.
*/
+ @RequiresPermission(Manifest.permission.BLUETOOTH)
public boolean fetchUuidsWithSdp() {
IBluetooth service = sService;
if (service == null || isBluetoothEnabled() == false) {
@@ -1144,6 +1153,7 @@ public final class BluetoothDevice implements Parcelable {
* @return true confirmation has been sent out
* false for error
*/
+ @RequiresPermission(Manifest.permission.BLUETOOTH_ADMIN)
public boolean setPairingConfirmation(boolean confirm) {
if (sService == null) {
Log.e(TAG, "BT not enabled. Cannot set pairing confirmation");
@@ -1405,6 +1415,7 @@ public final class BluetoothDevice implements Parcelable {
* @throws IOException on error, for example Bluetooth not available, or
* insufficient permissions
*/
+ @RequiresPermission(Manifest.permission.BLUETOOTH)
public BluetoothSocket createRfcommSocketToServiceRecord(UUID uuid) throws IOException {
if (isBluetoothEnabled() == false) {
Log.e(TAG, "Bluetooth is not enabled");
@@ -1443,6 +1454,7 @@ public final class BluetoothDevice implements Parcelable {
* @throws IOException on error, for example Bluetooth not available, or
* insufficient permissions
*/
+ @RequiresPermission(Manifest.permission.BLUETOOTH)
public BluetoothSocket createInsecureRfcommSocketToServiceRecord(UUID uuid) throws IOException {
if (isBluetoothEnabled() == false) {
Log.e(TAG, "Bluetooth is not enabled");