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

Commit 42062718 authored by William Escande's avatar William Escande
Browse files

Utils: add Adapter to getByteBrEdrAddress params

Bug: 311772251
Test: m Bluetooth
Flag: Exempt, no-op change to add utility method
Change-Id: I91d9ccc5e3ebd395ceddb3ff8e3bf058a89d017e
parent da9e1f6c
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -250,14 +250,21 @@ public final class Utils {
        return identity != null ? identity : address;
    }

    /**
     * @see #getByteBrEdrAddress(AdapterService, BluetoothDevice)
     */
    public static byte[] getByteBrEdrAddress(BluetoothDevice device) {
        return getByteBrEdrAddress(AdapterService.getAdapterService(), device);
    }

    /**
     * Returns the correct device address to be used for connections over BR/EDR transport.
     *
     * @param service the provided AdapterService
     * @param device the device for which to obtain the connection address
     * @return either identity address or device address as a byte array
     */
    public static byte[] getByteBrEdrAddress(BluetoothDevice device) {
        final AdapterService service = AdapterService.getAdapterService();
    public static byte[] getByteBrEdrAddress(AdapterService service, BluetoothDevice device) {
        // If dual mode device bonded over BLE first, BR/EDR address will be identity address
        // Otherwise, BR/EDR address will be same address as in BluetoothDevice#getAddress
        byte[] address = service.getByteIdentityAddress(device);