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

Commit 45e179e8 authored by Rahul Arya's avatar Rahul Arya Committed by Automerger Merge Worker
Browse files

Merge "Fix HOGP with RPA" am: 3a7b2c89

parents 9873ebf1 3a7b2c89
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) {