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

Commit 3a7b2c89 authored by Rahul Arya's avatar Rahul Arya Committed by Gerrit Code Review
Browse files

Merge "Fix HOGP with RPA"

parents d03b40da 3c6f60f0
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import android.annotation.RequiresPermission;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothHidHost;
import android.bluetooth.BluetoothProfile;
import android.bluetooth.BluetoothUuid;
import android.bluetooth.IBluetoothHidHost;
import android.content.AttributionSource;
import android.content.Intent;
@@ -140,13 +141,16 @@ public class HidHostService extends ProfileService {
        setHidHostService(null);
    }

    private BluetoothDevice getDevice(byte[] address) {
        return mAdapterService.getDeviceFromByte(address);
    }

    private byte[] getByteAddress(BluetoothDevice device) {
        if (Utils.arrayContains(device.getUuids(), BluetoothUuid.HOGP)) {
            // if HOGP is available, use the address on initial bonding
            // (so if we bonded over LE, use the RPA)
            return Utils.getByteAddress(device);
        } else {
            // if only classic HID is available, force usage of BREDR address
            return mAdapterService.getByteIdentityAddress(device);
        }
    }

    public static synchronized HidHostService getHidHostService() {
        if (sHidHostService == null) {