aboutsummaryrefslogtreecommitdiff
path: root/framework/java/android/bluetooth/BluetoothDevice.java
diff options
context:
space:
mode:
authorRahul Sabnis <rahulsabnis@google.com>2020-03-18 17:46:33 -0700
committerRahul Sabnis <rahulsabnis@google.com>2020-03-21 04:14:29 +0000
commitc228ce27e2d7fe26193236eb5d4299214deb17ec (patch)
tree6a2dd060fb67eeee6c65a270ad95607c308c155b /framework/java/android/bluetooth/BluetoothDevice.java
parent20968800f83a194b724782dee211c2fb92fb179c (diff)
Add BLUETOOTH_PRIVILEGED permission as a requirement for all new Bluetooth SystemApis and for hidden connect/disconnect APIs.
Hide some APIs that were previously marked as @UnsupportedAppUsage and re-add annotation as changing the permissions for these SystemApis would break the unsupported app contract that was previously there. Therefore, we're choosing to hide them until we have a good story on how to deal with them next release. Bug: 148689314 Test: Manual Merged-In: I33ee2c7ccd3827db3d23d6447cf82d9ffc36836a Change-Id: I33ee2c7ccd3827db3d23d6447cf82d9ffc36836a
Diffstat (limited to 'framework/java/android/bluetooth/BluetoothDevice.java')
-rw-r--r--framework/java/android/bluetooth/BluetoothDevice.java32
1 files changed, 15 insertions, 17 deletions
diff --git a/framework/java/android/bluetooth/BluetoothDevice.java b/framework/java/android/bluetooth/BluetoothDevice.java
index 2a3f2be642..a2cf7d9cc2 100644
--- a/framework/java/android/bluetooth/BluetoothDevice.java
+++ b/framework/java/android/bluetooth/BluetoothDevice.java
@@ -35,8 +35,6 @@ import android.os.Process;
import android.os.RemoteException;
import android.util.Log;
-import com.android.internal.annotations.VisibleForTesting;
-
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.lang.annotation.Retention;
@@ -1103,8 +1101,8 @@ public final class BluetoothDevice implements Parcelable {
* @return true on success, false on error
* @hide
*/
- @SystemApi
- @RequiresPermission(Manifest.permission.BLUETOOTH_PRIVILEGED)
+ @UnsupportedAppUsage
+ @RequiresPermission(Manifest.permission.BLUETOOTH)
public boolean setAlias(@NonNull String alias) {
final IBluetooth service = sService;
if (service == null) {
@@ -1145,8 +1143,8 @@ public final class BluetoothDevice implements Parcelable {
* not have any battery reporting service, or return value is invalid
* @hide
*/
- @SystemApi
- @RequiresPermission(Manifest.permission.BLUETOOTH_PRIVILEGED)
+ @UnsupportedAppUsage
+ @RequiresPermission(Manifest.permission.BLUETOOTH)
public int getBatteryLevel() {
final IBluetooth service = sService;
if (service == null) {
@@ -1236,8 +1234,8 @@ public final class BluetoothDevice implements Parcelable {
*
* @hide
*/
- @SystemApi
- @RequiresPermission(Manifest.permission.BLUETOOTH_PRIVILEGED)
+ @UnsupportedAppUsage
+ @RequiresPermission(Manifest.permission.BLUETOOTH)
public boolean isBondingInitiatedLocally() {
final IBluetooth service = sService;
if (service == null) {
@@ -1531,7 +1529,7 @@ public final class BluetoothDevice implements Parcelable {
* @return true pin has been set false for error
* @hide
*/
- @SystemApi
+ @UnsupportedAppUsage
@RequiresPermission(Manifest.permission.BLUETOOTH_ADMIN)
public boolean setPin(@NonNull String pin) {
byte[] pinBytes = convertPinToBytes(pin);
@@ -1568,8 +1566,8 @@ public final class BluetoothDevice implements Parcelable {
*
* @hide
*/
- @SystemApi
- @RequiresPermission(Manifest.permission.BLUETOOTH_PRIVILEGED)
+ @UnsupportedAppUsage
+ @RequiresPermission(Manifest.permission.BLUETOOTH_ADMIN)
public boolean cancelPairing() {
final IBluetooth service = sService;
if (service == null) {
@@ -1600,8 +1598,8 @@ public final class BluetoothDevice implements Parcelable {
* #ACCESS_UNKNOWN}, {@link #ACCESS_ALLOWED} or {@link #ACCESS_REJECTED}.
* @hide
*/
- @SystemApi
- @RequiresPermission(Manifest.permission.BLUETOOTH_PRIVILEGED)
+ @UnsupportedAppUsage
+ @RequiresPermission(Manifest.permission.BLUETOOTH)
public @AccessPermission int getPhonebookAccessPermission() {
final IBluetooth service = sService;
if (service == null) {
@@ -1708,8 +1706,8 @@ public final class BluetoothDevice implements Parcelable {
* @return Whether the message access is allowed to this device.
* @hide
*/
- @SystemApi
- @RequiresPermission(Manifest.permission.BLUETOOTH_PRIVILEGED)
+ @UnsupportedAppUsage
+ @RequiresPermission(Manifest.permission.BLUETOOTH)
public @AccessPermission int getMessageAccessPermission() {
final IBluetooth service = sService;
if (service == null) {
@@ -1758,7 +1756,7 @@ public final class BluetoothDevice implements Parcelable {
* @hide
*/
@SystemApi
- @RequiresPermission(Manifest.permission.BLUETOOTH_PRIVILEGED)
+ @RequiresPermission(Manifest.permission.BLUETOOTH)
public @AccessPermission int getSimAccessPermission() {
final IBluetooth service = sService;
if (service == null) {
@@ -2013,7 +2011,7 @@ public final class BluetoothDevice implements Parcelable {
* @return the pin code as a UTF-8 byte array, or null if it is an invalid Bluetooth pin.
* @hide
*/
- @VisibleForTesting
+ @UnsupportedAppUsage
public static byte[] convertPinToBytes(String pin) {
if (pin == null) {
return null;