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

Commit 355f503c authored by Martin Brabham's avatar Martin Brabham
Browse files

BLE Scanning: Force the APCF address type value to always be 0x02.

The address type in...

Java:
 Public = 0
 Random = 1

In the host stack when dealing with BLE ID addresses 2 and 3 are used for resolve
address
C++:
 Public = 0
 Random = 1
 Public ID = 2
 Random ID = 3

The vendor command takes Public (0) or Random (1) or Any (2)

We need to use 0x02 for Any if we want to use the resolving list for scans.

e.g. specifying for a PUBLIC (0x00) will only return results for a public matching
address and will NOT try to resolve any RPA to the address.  For this the Any (0x02)
must be specified.

Ignore-AOSP-First: Need on sc-v2-dev; code doesn't match on master

Bug: 209885517
Test: Manual scanning app
Tag: #stability
Change-Id: Ic4236d5703611de83c45ebe7638c0f4f2b02931b
parent b94558ae
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -513,6 +513,25 @@ static void BTM_LE_PF_addr_filter(tBTM_BLE_SCAN_COND_OP action,
              << " Adding scan filter with peer address: " << addr.bda;

    BDADDR_TO_STREAM(p, addr.bda);
    /*
     * DANGER: Thar be dragons!
     *
     * The vendor command (APCF Filtering 0x0157) takes Public (0) or Random (1)
     * or Any (2).
     *
     * Advertising results have four types:
     *     -  Public = 0
     *     -  Random = 1
     *     -  Public ID = 2
     *     -  Random ID = 3
     *
     * e.g. specifying PUBLIC (0) will only return results with a public
     * address. It will ignore resolved addresses, since they return PUBLIC
     * IDENTITY (2). For this, Any (0x02) must be specified.  This should also
     * cover if the RPA is derived from RANDOM STATIC.
     */
    /* ALWAYS FORCE 2 for this vendor command! */
    addr.type = 0x02;  // Really, you will break scanning if you change this.
    UINT8_TO_STREAM(p, addr.type);
  }