summaryrefslogtreecommitdiff
path: root/service/java/com/android/server/bluetooth/BluetoothModeChangeHelper.java
diff options
context:
space:
mode:
authorJeff Sharkey <jsharkey@android.com>2021-04-02 08:06:09 -0600
committerJeff Sharkey <jsharkey@android.com>2021-04-14 21:13:24 -0600
commit8f80e4a05b3f1b227f40de5ec0e9a6297154ffc0 (patch)
tree03263d64510c4477b5cc75eeda52a0c9b547fe21 /service/java/com/android/server/bluetooth/BluetoothModeChangeHelper.java
parenta95b9490ca30736c3b508e102f8d92bf9aea4ad3 (diff)
Update Bluetooth API annotations.
Recent work has introduced a new "Nearby devices" runtime permission which protects all existing Bluetooth APIs; we've done this by defining a <split-permission> to convert the old BLUETOOTH and BLUETOOTH_ADMIN permissions into one of three new permissions: * BLUETOOTH_ADVERTISE: Required to be able to advertise to nearby Bluetooth devices. * BLUETOOTH_CONNECT: Allows applications to connect to paired bluetooth devices. * BLUETOOTH_SCAN: Required to be able to discover and pair nearby Bluetooth devices. At its core, this change begins updating the Bluetooth APIs to have correct @RequiresPermission indicating which permission is actually enforced internally. To ensure alignment across Binder, the newly added "RequiresPermissionChecker" Error Prone checker was used to discover any inconsistencies, ensuring correctness from server-side enforcement up through to the public APIs. In addition, since developers will continue building apps for both modern and legacy platforms, this change introduces new auto-doc annotations which will emit helpful consistent documentation describing the behavior of older devices that are still using the old permission model. Bug: 183626724 Test: ./build/soong/soong_ui.bash --make-mode Bluetooth RUN_ERROR_PRONE=true Change-Id: I02aa127e8e07f239561f4f2a3bbdfc6fccb82f7f
Diffstat (limited to 'service/java/com/android/server/bluetooth/BluetoothModeChangeHelper.java')
-rw-r--r--service/java/com/android/server/bluetooth/BluetoothModeChangeHelper.java2
1 files changed, 2 insertions, 0 deletions
diff --git a/service/java/com/android/server/bluetooth/BluetoothModeChangeHelper.java b/service/java/com/android/server/bluetooth/BluetoothModeChangeHelper.java
index 242fa848c2..3642e4dccf 100644
--- a/service/java/com/android/server/bluetooth/BluetoothModeChangeHelper.java
+++ b/service/java/com/android/server/bluetooth/BluetoothModeChangeHelper.java
@@ -16,6 +16,7 @@
package com.android.server;
+import android.annotation.RequiresPermission;
import android.bluetooth.BluetoothA2dp;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothHearingAid;
@@ -101,6 +102,7 @@ public class BluetoothModeChangeHelper {
}
@VisibleForTesting
+ @RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED)
public void onAirplaneModeChanged(BluetoothManagerService managerService) {
managerService.onAirplaneModeChanged();
}