Use identity addr in BLE scan filter

For BT controllers with the ability to filter scans and resolve RPAs on
controller, when trying to filter for a Public ID type address the
filter must use the static identity address of the peer device instead
of the random pseudo address.

Bug: 78888800
Test: manually tested filtered scanning for BLE peer with RPA with a
device with both offloaded RPA resolution & controller filtering
supported. Tested on a device with no controller filtering, which has
no changes, as expected.

Change-Id: I1d92e219bdbc9ba2399eae637a1f4623d695a3f8
(cherry picked from commit 10704399e1cfbad3421c3272795952cad3ee2920)
diff --git a/stack/btm/btm_ble_adv_filter.cc b/stack/btm/btm_ble_adv_filter.cc
index c8dfff5..1f68fb6 100644
--- a/stack/btm/btm_ble_adv_filter.cc
+++ b/stack/btm/btm_ble_adv_filter.cc
@@ -499,6 +499,19 @@
   UINT8_TO_STREAM(p, filt_index);
 
   if (action != BTM_BLE_SCAN_COND_CLEAR) {
+#if (BLE_PRIVACY_SPT == TRUE)
+    if (addr.type == BLE_ADDR_PUBLIC_ID) {
+      LOG(INFO) << __func__ << " Filter address " << addr.bda
+                << " has type PUBLIC_ID, try to get identity address";
+      /* If no matching identity address is found for the input address,
+       * this call will have no effect. */
+      btm_random_pseudo_to_identity_addr(&addr.bda, &addr.type);
+    }
+#endif
+
+    LOG(INFO) << __func__
+              << " Adding scan filter with peer address: " << addr.bda;
+
     BDADDR_TO_STREAM(p, addr.bda);
     UINT8_TO_STREAM(p, addr.type);
   }