aboutsummaryrefslogtreecommitdiff
path: root/framework/java/android/bluetooth/BluetoothAdapter.java
diff options
context:
space:
mode:
authorWilliam Escande <wescande@google.com>2022-02-14 18:41:26 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2022-02-14 18:41:26 +0000
commite2c4db2a654cbe8ab738c20b4ca8fe20af66ec5a (patch)
tree6ae1e617f217a63458e54e37bb12c3b33c3a52e6 /framework/java/android/bluetooth/BluetoothAdapter.java
parent033ebc0eef28e7efed8762a8e10cbd28012e1b1e (diff)
parentc19637e18805ebde6379e8bdaeec2acc38c03aa0 (diff)
Fix some API recently added am: 371420336d am: c19637e188
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/1982209 Change-Id: Ia4e2b3da9e0bebd8a8ca0ce41da69b306b7b1ac1
Diffstat (limited to 'framework/java/android/bluetooth/BluetoothAdapter.java')
-rw-r--r--framework/java/android/bluetooth/BluetoothAdapter.java11
1 files changed, 7 insertions, 4 deletions
diff --git a/framework/java/android/bluetooth/BluetoothAdapter.java b/framework/java/android/bluetooth/BluetoothAdapter.java
index a13fabc62d..8f1d0c642d 100644
--- a/framework/java/android/bluetooth/BluetoothAdapter.java
+++ b/framework/java/android/bluetooth/BluetoothAdapter.java
@@ -273,7 +273,7 @@ public final class BluetoothAdapter {
* @hide
*/
@SystemApi
- @RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED)
+ @RequiresNoPermission
@NonNull
public static String nameForState(@AdapterState int state) {
switch (state) {
@@ -1440,7 +1440,6 @@ public final class BluetoothAdapter {
@RequiresLegacyBluetoothPermission
@RequiresBluetoothConnectPermission
@RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
- @NonNull
@SuppressLint(value = {"ArrayReturn", "NullableCollection"})
public @Nullable ParcelUuid[] getUuids() {
if (getState() != STATE_ON) {
@@ -4136,6 +4135,7 @@ public final class BluetoothAdapter {
*
* @hide
*/
+ @RequiresNoPermission
@SystemApi
public boolean registerServiceLifecycleCallback(@NonNull ServiceLifecycleCallback callback) {
return getBluetoothService(callback.mRemote) != null;
@@ -4146,7 +4146,9 @@ public final class BluetoothAdapter {
*
* @hide
*/
- public void unregisterServiceLifecycleCallback(ServiceLifecycleCallback callback) {
+ @RequiresNoPermission
+ @SystemApi
+ public void unregisterServiceLifecycleCallback(@NonNull ServiceLifecycleCallback callback) {
removeServiceStateCallback(callback.mRemote);
}
@@ -4640,7 +4642,7 @@ public final class BluetoothAdapter {
public boolean registerBluetoothConnectionCallback(@NonNull @CallbackExecutor Executor executor,
@NonNull BluetoothConnectionCallback callback) {
if (DBG) Log.d(TAG, "registerBluetoothConnectionCallback()");
- if (callback == null) {
+ if (callback == null || executor == null) {
return false;
}
@@ -4683,6 +4685,7 @@ public final class BluetoothAdapter {
* @return true if the callback was unregistered successfully, false otherwise
* @hide
*/
+ @SystemApi
@RequiresBluetoothConnectPermission
@RequiresPermission(allOf = {
android.Manifest.permission.BLUETOOTH_CONNECT,