summaryrefslogtreecommitdiff
path: root/framework/java/android/bluetooth/BluetoothAdapter.java
diff options
context:
space:
mode:
authorWilliam Escande <wescande@google.com>2022-02-06 20:35:58 +0100
committerWilliam Escande <wescande@google.com>2022-02-07 18:11:01 +0100
commit1bf39c174bba236f4daa83584679ecd733ee3aa7 (patch)
tree61d9aca051527da03e0863977c0f4b89171060ad /framework/java/android/bluetooth/BluetoothAdapter.java
parentf2a3d170ab36b1df58dcad74607559d408fd1589 (diff)
Fix some API recently added
Bug: 217352944 Test: atest BluetoothHostTest#testAdapterGetConnectionState Test: atest BluetoothHostTest#testAdapterGetMostRecentlyConnectedDevices Test: atest BluetoothHostTest#testAdapterGetUuids Test: atest BluetoothHostTest#testAdapterNameForState Test: atest BluetoothHostTest#testAdapterRegisterBluetoothConnectionCallback Test: atest BluetoothHostTest#testAdapterRegisterServiceLifecycleCallback Test: atest BluetoothHostTest#testAdapterRequestControllerActivityEnergyInfo Tag: #refactor Change-Id: If90840d37d41cead376edeff946e552eab5bae85 Ignore-AOSP-First: no such api on aosp yet
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 7a7f16f3f9..27d446784b 100644
--- a/framework/java/android/bluetooth/BluetoothAdapter.java
+++ b/framework/java/android/bluetooth/BluetoothAdapter.java
@@ -272,7 +272,7 @@ public final class BluetoothAdapter {
* @hide
*/
@SystemApi
- @RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED)
+ @RequiresNoPermission
@NonNull
public static String nameForState(@AdapterState int state) {
switch (state) {
@@ -1454,7 +1454,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) {
@@ -4132,6 +4131,7 @@ public final class BluetoothAdapter {
*
* @hide
*/
+ @RequiresNoPermission
@SystemApi
public boolean registerServiceLifecycleCallback(@NonNull ServiceLifecycleCallback callback) {
return getBluetoothService(callback.mRemote) != null;
@@ -4142,7 +4142,9 @@ public final class BluetoothAdapter {
*
* @hide
*/
- public void unregisterServiceLifecycleCallback(ServiceLifecycleCallback callback) {
+ @RequiresNoPermission
+ @SystemApi
+ public void unregisterServiceLifecycleCallback(@NonNull ServiceLifecycleCallback callback) {
removeServiceStateCallback(callback.mRemote);
}
@@ -4636,7 +4638,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;
}
@@ -4679,6 +4681,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,