summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2020-03-04 19:28:11 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2020-03-04 19:28:11 +0000
commita1b84782c50521a28a302c454ae3f93a8a64171e (patch)
tree280b61d760876951625c65188bdd8ea10adffad8
parentbfd9edf84130a6cd8568cf4490959cf0fd5b8588 (diff)
parent5f1daae19fd6efdc25dc7535235a7da68a7bb1f2 (diff)
downloadbase-a1b84782c50521a28a302c454ae3f93a8a64171e.tar.gz
Merge "Update BluetoothDevice SystemApi permissions and disallow passing a null pin to BluetoothDevice#setPin" am: 5f1daae19f
Change-Id: I4204ee9c10101d99fc8e4bad4ee44fc431f2cb9f
-rwxr-xr-xapi/system-current.txt18
-rw-r--r--core/java/android/bluetooth/BluetoothDevice.java30
2 files changed, 22 insertions, 26 deletions
diff --git a/api/system-current.txt b/api/system-current.txt
index 079bb7b3f6b2..dd476870819d 100755
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -1389,23 +1389,23 @@ package android.bluetooth {
}
public final class BluetoothDevice implements android.os.Parcelable {
- method @RequiresPermission(android.Manifest.permission.BLUETOOTH_ADMIN) public boolean cancelBondProcess();
- method public boolean cancelPairing();
- method @RequiresPermission(android.Manifest.permission.BLUETOOTH) public int getBatteryLevel();
- method @RequiresPermission(android.Manifest.permission.BLUETOOTH) public int getMessageAccessPermission();
+ method @RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED) public boolean cancelBondProcess();
+ method @RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED) public boolean cancelPairing();
+ method @RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED) public int getBatteryLevel();
+ method @RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED) public int getMessageAccessPermission();
method @Nullable @RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED) public byte[] getMetadata(int);
- method @RequiresPermission(android.Manifest.permission.BLUETOOTH) public int getPhonebookAccessPermission();
- method @RequiresPermission(android.Manifest.permission.BLUETOOTH) public int getSimAccessPermission();
- method @RequiresPermission(android.Manifest.permission.BLUETOOTH) public boolean isBondingInitiatedLocally();
+ method @RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED) public int getPhonebookAccessPermission();
+ method @RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED) public int getSimAccessPermission();
+ method @RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED) public boolean isBondingInitiatedLocally();
method @RequiresPermission(android.Manifest.permission.BLUETOOTH) public boolean isConnected();
method @RequiresPermission(android.Manifest.permission.BLUETOOTH) public boolean isEncrypted();
method @RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED) public boolean isInSilenceMode();
- method @RequiresPermission(android.Manifest.permission.BLUETOOTH_ADMIN) public boolean removeBond();
+ method @RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED) public boolean removeBond();
method @RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED) public boolean setAlias(@NonNull String);
method @RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED) public boolean setMessageAccessPermission(int);
method @RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED) public boolean setMetadata(int, @NonNull byte[]);
method @RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED) public boolean setPhonebookAccessPermission(int);
- method @RequiresPermission(android.Manifest.permission.BLUETOOTH_ADMIN) public boolean setPin(@Nullable String);
+ method @RequiresPermission(android.Manifest.permission.BLUETOOTH_ADMIN) public boolean setPin(@NonNull String);
method @RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED) public boolean setSilenceMode(boolean);
method @RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED) public boolean setSimAccessPermission(int);
field public static final int ACCESS_ALLOWED = 1; // 0x1
diff --git a/core/java/android/bluetooth/BluetoothDevice.java b/core/java/android/bluetooth/BluetoothDevice.java
index 0c3959abe13d..c4ea080962f7 100644
--- a/core/java/android/bluetooth/BluetoothDevice.java
+++ b/core/java/android/bluetooth/BluetoothDevice.java
@@ -1139,7 +1139,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) {
@@ -1230,7 +1230,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) {
@@ -1268,13 +1268,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) {
@@ -1297,13 +1296,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) {
@@ -1347,13 +1345,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) {
@@ -1371,13 +1368,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) {
@@ -1530,7 +1526,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;
@@ -1566,6 +1562,7 @@ public final class BluetoothDevice implements Parcelable {
* @hide
*/
@SystemApi
+ @RequiresPermission(Manifest.permission.BLUETOOTH_PRIVILEGED)
public boolean cancelPairing() {
final IBluetooth service = sService;
if (service == null) {
@@ -1597,8 +1594,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;
@@ -1677,7 +1674,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}.
@@ -1686,7 +1682,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;
@@ -1706,7 +1702,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) {
@@ -1753,7 +1749,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) {