diff --git a/core/java/android/bluetooth/BluetoothAdapter.java b/core/java/android/bluetooth/BluetoothAdapter.java index 01af9fe31d27a..3d9651db6833d 100644 --- a/core/java/android/bluetooth/BluetoothAdapter.java +++ b/core/java/android/bluetooth/BluetoothAdapter.java @@ -1133,6 +1133,28 @@ public final class BluetoothAdapter { return false; } + /** + * Returns the {@link BluetoothClass} Bluetooth Class of Device (CoD) of the local Bluetooth + * adapter. + * + * @return {@link BluetoothClass} Bluetooth CoD of local Bluetooth device. + * + * @hide + */ + @RequiresPermission(Manifest.permission.BLUETOOTH_ADMIN) + public BluetoothClass getBluetoothClass() { + if (getState() != STATE_ON) return null; + try { + mServiceLock.readLock().lock(); + if (mService != null) return mService.getBluetoothClass(); + } catch (RemoteException e) { + Log.e(TAG, "", e); + } finally { + mServiceLock.readLock().unlock(); + } + return null; + } + /** * Sets the {@link BluetoothClass} Bluetooth Class of Device (CoD) of the local Bluetooth * adapter. diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml index afa44713926b4..90729607006f0 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -182,10 +182,18 @@ android:name="android.bluetooth.a2dp-sink.profile.action.PLAYING_STATE_CHANGED" /> + + + +