summaryrefslogtreecommitdiff
path: root/framework/java/android/bluetooth/BluetoothAdapter.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:10:15 +0000
commitce594994e8aa1b4bf9a6917e18c4f2f3b68c1ddc (patch)
tree22ff052ac71fcee0d0c6f6c05f96641fdcb38dac /framework/java/android/bluetooth/BluetoothAdapter.java
parent8e78d743cfc4b914b5e9862566acec998f8c3544 (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 Change-Id: I33ee2c7ccd3827db3d23d6447cf82d9ffc36836a
Diffstat (limited to 'framework/java/android/bluetooth/BluetoothAdapter.java')
-rw-r--r--framework/java/android/bluetooth/BluetoothAdapter.java15
1 files changed, 7 insertions, 8 deletions
diff --git a/framework/java/android/bluetooth/BluetoothAdapter.java b/framework/java/android/bluetooth/BluetoothAdapter.java
index 608b563bfc..4aad3cbb21 100644
--- a/framework/java/android/bluetooth/BluetoothAdapter.java
+++ b/framework/java/android/bluetooth/BluetoothAdapter.java
@@ -1224,7 +1224,7 @@ public final class BluetoothAdapter {
* @return true to indicate that the config file was successfully cleared
* @hide
*/
- @SystemApi
+ @UnsupportedAppUsage
@RequiresPermission(Manifest.permission.BLUETOOTH_PRIVILEGED)
public boolean factoryReset() {
try {
@@ -1517,8 +1517,9 @@ public final class BluetoothAdapter {
* @return true if the scan mode was set, false otherwise
* @hide
*/
- @SystemApi
- @RequiresPermission(Manifest.permission.BLUETOOTH_PRIVILEGED)
+ @UnsupportedAppUsage(publicAlternatives = "Use {@link #ACTION_REQUEST_DISCOVERABLE}, which "
+ + "shows UI that confirms the user wants to go into discoverable mode.")
+ @RequiresPermission(Manifest.permission.BLUETOOTH)
public boolean setScanMode(@ScanMode int mode, long durationMillis) {
if (getState() != STATE_ON) {
return false;
@@ -1566,8 +1567,8 @@ public final class BluetoothAdapter {
* @return true if the scan mode was set, false otherwise
* @hide
*/
- @SystemApi
- @RequiresPermission(Manifest.permission.BLUETOOTH_PRIVILEGED)
+ @UnsupportedAppUsage
+ @RequiresPermission(Manifest.permission.BLUETOOTH)
public boolean setScanMode(@ScanMode int mode) {
if (getState() != STATE_ON) {
return false;
@@ -1631,7 +1632,7 @@ public final class BluetoothAdapter {
* @hide
*/
@SystemApi
- @RequiresPermission(Manifest.permission.BLUETOOTH)
+ @RequiresPermission(Manifest.permission.BLUETOOTH_PRIVILEGED)
public long getDiscoveryEndMillis() {
try {
mServiceLock.readLock().lock();
@@ -1883,7 +1884,6 @@ public final class BluetoothAdapter {
*
* @hide
*/
- @SystemApi
@RequiresPermission(Manifest.permission.BLUETOOTH_PRIVILEGED)
public boolean connectAllEnabledProfiles(@NonNull BluetoothDevice device) {
try {
@@ -1912,7 +1912,6 @@ public final class BluetoothAdapter {
*
* @hide
*/
- @SystemApi
@RequiresPermission(Manifest.permission.BLUETOOTH_PRIVILEGED)
public boolean disconnectAllEnabledProfiles(@NonNull BluetoothDevice device) {
try {