Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 02e360e1 authored by Pulkit Bhuwalka's avatar Pulkit Bhuwalka
Browse files

Get Bluetooth Class of Device

Adds API to fetch Bluetooth CoD value of the stack. The API is hidden to
only be used by System code.

Bug: 36015415
Test: Verified fetching of COD from test app on flashed device, after modification
and after after reboot.

Change-Id: Ie35ecf141704c2aac46678da7cabdc7203a088f2
parent 85e6b009
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -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.