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

Commit 3c6f60f0 authored by Rahul Arya's avatar Rahul Arya
Browse files

Fix HOGP with RPA

We should not use the identity address if the device is HOGP, but should
if it is HID-over-classic.

Bug: 261206213
Test: manual
Change-Id: Ic1f32b719d0d61680b3a7412d05ac39a90628501
parent c50c7655
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) {