Delete unused BLE scanner code

This code is unreachable and duplicated by GD, so it can be removed.

Test: compilation
Bug: 284982932
Change-Id: Ibc260b4226f5b51ff749718f4f62e6c0564f371f
diff --git a/system/main/shim/btm_api.cc b/system/main/shim/btm_api.cc
index 8be911b..5ec6318 100644
--- a/system/main/shim/btm_api.cc
+++ b/system/main/shim/btm_api.cc
@@ -478,64 +478,6 @@
   return 0;
 }
 
-/**
- * This function update(add,delete or clear) the adv local name filtering
- * condition.
- */
-void bluetooth::shim::BTM_LE_PF_local_name(tBTM_BLE_SCAN_COND_OP action,
-                                           tBTM_BLE_PF_FILT_INDEX filt_index,
-                                           std::vector<uint8_t> name,
-                                           tBTM_BLE_PF_CFG_CBACK cb) {
-  LOG_INFO("UNIMPLEMENTED %s", __func__);
-}
-
-void bluetooth::shim::BTM_LE_PF_srvc_data(tBTM_BLE_SCAN_COND_OP action,
-                                          tBTM_BLE_PF_FILT_INDEX filt_index) {
-  LOG_INFO("UNIMPLEMENTED %s", __func__);
-}
-
-void bluetooth::shim::BTM_LE_PF_manu_data(
-    tBTM_BLE_SCAN_COND_OP action, tBTM_BLE_PF_FILT_INDEX filt_index,
-    uint16_t company_id, uint16_t company_id_mask, std::vector<uint8_t> data,
-    std::vector<uint8_t> data_mask, tBTM_BLE_PF_CFG_CBACK cb) {
-  LOG_INFO("UNIMPLEMENTED %s", __func__);
-}
-
-void bluetooth::shim::BTM_LE_PF_srvc_data_pattern(
-    tBTM_BLE_SCAN_COND_OP action, tBTM_BLE_PF_FILT_INDEX filt_index,
-    std::vector<uint8_t> data, std::vector<uint8_t> data_mask,
-    tBTM_BLE_PF_CFG_CBACK cb) {
-  LOG_INFO("UNIMPLEMENTED %s", __func__);
-}
-
-void bluetooth::shim::BTM_LE_PF_addr_filter(tBTM_BLE_SCAN_COND_OP action,
-                                            tBTM_BLE_PF_FILT_INDEX filt_index,
-                                            tBLE_BD_ADDR addr,
-                                            tBTM_BLE_PF_CFG_CBACK cb) {
-  LOG_INFO("UNIMPLEMENTED %s", __func__);
-}
-
-void bluetooth::shim::BTM_LE_PF_uuid_filter(tBTM_BLE_SCAN_COND_OP action,
-                                            tBTM_BLE_PF_FILT_INDEX filt_index,
-                                            tBTM_BLE_PF_COND_TYPE filter_type,
-                                            const bluetooth::Uuid& uuid,
-                                            tBTM_BLE_PF_LOGIC_TYPE cond_logic,
-                                            const bluetooth::Uuid& uuid_mask,
-                                            tBTM_BLE_PF_CFG_CBACK cb) {
-  LOG_INFO("UNIMPLEMENTED %s", __func__);
-}
-
-void bluetooth::shim::BTM_LE_PF_set(tBTM_BLE_PF_FILT_INDEX filt_index,
-                                    std::vector<ApcfCommand> commands,
-                                    tBTM_BLE_PF_CFG_CBACK cb) {
-  LOG_INFO("UNIMPLEMENTED %s", __func__);
-}
-
-void bluetooth::shim::BTM_LE_PF_clear(tBTM_BLE_PF_FILT_INDEX filt_index,
-                                      tBTM_BLE_PF_CFG_CBACK cb) {
-  LOG_INFO("UNIMPLEMENTED %s", __func__);
-}
-
 void bluetooth::shim::BTM_BleAdvFilterParamSetup(
     tBTM_BLE_SCAN_COND_OP action, tBTM_BLE_PF_FILT_INDEX filt_index,
     std::unique_ptr<btgatt_filt_param_setup_t> p_filt_params,
@@ -543,15 +485,6 @@
   LOG_INFO("UNIMPLEMENTED %s", __func__);
 }
 
-void bluetooth::shim::BTM_BleUpdateAdvFilterPolicy(tBTM_BLE_AFP adv_policy) {
-  LOG_INFO("UNIMPLEMENTED %s", __func__);
-}
-
-void bluetooth::shim::BTM_BleEnableDisableFilterFeature(
-    uint8_t enable, tBTM_BLE_PF_STATUS_CBACK p_stat_cback) {
-  LOG_INFO("UNIMPLEMENTED %s", __func__);
-}
-
 tBTM_STATUS bluetooth::shim::BTM_SecBond(const RawAddress& bd_addr,
                                          tBLE_ADDR_TYPE addr_type,
                                          tBT_TRANSPORT transport,
diff --git a/system/main/shim/btm_api.h b/system/main/shim/btm_api.h
index aa2996c..88275ce 100644
--- a/system/main/shim/btm_api.h
+++ b/system/main/shim/btm_api.h
@@ -710,42 +710,6 @@
  ******************************************************************************/
 uint8_t BTM_BleGetSupportedKeySize(const RawAddress& bd_addr);
 
-void BTM_LE_PF_local_name(tBTM_BLE_SCAN_COND_OP action,
-                          tBTM_BLE_PF_FILT_INDEX filt_index,
-                          std::vector<uint8_t> name, tBTM_BLE_PF_CFG_CBACK cb);
-
-void BTM_LE_PF_srvc_data(tBTM_BLE_SCAN_COND_OP action,
-                         tBTM_BLE_PF_FILT_INDEX filt_index);
-
-void BTM_LE_PF_manu_data(tBTM_BLE_SCAN_COND_OP action,
-                         tBTM_BLE_PF_FILT_INDEX filt_index, uint16_t company_id,
-                         uint16_t company_id_mask, std::vector<uint8_t> data,
-                         std::vector<uint8_t> data_mask,
-                         tBTM_BLE_PF_CFG_CBACK cb);
-
-void BTM_LE_PF_srvc_data_pattern(tBTM_BLE_SCAN_COND_OP action,
-                                 tBTM_BLE_PF_FILT_INDEX filt_index,
-                                 std::vector<uint8_t> data,
-                                 std::vector<uint8_t> data_mask,
-                                 tBTM_BLE_PF_CFG_CBACK cb);
-
-void BTM_LE_PF_addr_filter(tBTM_BLE_SCAN_COND_OP action,
-                           tBTM_BLE_PF_FILT_INDEX filt_index, tBLE_BD_ADDR addr,
-                           tBTM_BLE_PF_CFG_CBACK cb);
-
-void BTM_LE_PF_uuid_filter(tBTM_BLE_SCAN_COND_OP action,
-                           tBTM_BLE_PF_FILT_INDEX filt_index,
-                           tBTM_BLE_PF_COND_TYPE filter_type,
-                           const bluetooth::Uuid& uuid,
-                           tBTM_BLE_PF_LOGIC_TYPE cond_logic,
-                           const bluetooth::Uuid& uuid_mask,
-                           tBTM_BLE_PF_CFG_CBACK cb);
-
-void BTM_LE_PF_set(tBTM_BLE_PF_FILT_INDEX filt_index,
-                   std::vector<ApcfCommand> commands, tBTM_BLE_PF_CFG_CBACK cb);
-void BTM_LE_PF_clear(tBTM_BLE_PF_FILT_INDEX filt_index,
-                     tBTM_BLE_PF_CFG_CBACK cb);
-
 /*******************************************************************************
  *
  * Function         BTM_BleAdvFilterParamSetup
@@ -761,30 +725,6 @@
 
 /*******************************************************************************
  *
- * Function         BTM_BleUpdateAdvFilterPolicy
- *
- * Description      This function update the filter policy of advertiser.
- *
- * Parameter        adv_policy: advertising filter policy
- *
- * Return           void
- ******************************************************************************/
-void BTM_BleUpdateAdvFilterPolicy(tBTM_BLE_AFP adv_policy);
-
-/*******************************************************************************
- *
- * Function         BTM_BleEnableDisableFilterFeature
- *
- * Description      Enable or disable the APCF feature
- *
- * Parameters       enable - true - enables APCF, false - disables APCF
- *
- ******************************************************************************/
-void BTM_BleEnableDisableFilterFeature(uint8_t enable,
-                                       tBTM_BLE_PF_STATUS_CBACK p_stat_cback);
-
-/*******************************************************************************
- *
  * Function          BTM_BleMaxMultiAdvInstanceCount
  *
  * Description      Returns the maximum number of multi adv instances supported
diff --git a/system/stack/btm/btm_ble_adv_filter.cc b/system/stack/btm/btm_ble_adv_filter.cc
index ecceef7..bc5750f 100644
--- a/system/stack/btm/btm_ble_adv_filter.cc
+++ b/system/stack/btm/btm_ble_adv_filter.cc
@@ -83,14 +83,6 @@
   return cmn_ble_vsc_cb.filter_support != 0 && cmn_ble_vsc_cb.max_filter != 0;
 }
 
-static bool is_empty_128bit(const std::array<uint8_t, 16> data) {
-  int i, len = 16;
-  for (i = 0; i < len; i++) {
-    if (data[i] != (uint8_t)0) return false;
-  }
-  return true;
-}
-
 /*******************************************************************************
  *
  * Function         btm_ble_ocf_to_condtype
@@ -263,141 +255,6 @@
   return found;
 }
 
-/**
- * This function update(add,delete or clear) the adv local name filtering
- * condition.
- */
-static void BTM_LE_PF_local_name(tBTM_BLE_SCAN_COND_OP action,
-                                 tBTM_BLE_PF_FILT_INDEX filt_index,
-                                 std::vector<uint8_t> name,
-                                 tBTM_BLE_PF_CFG_CBACK cb) {
-  uint8_t len = BTM_BLE_ADV_FILT_META_HDR_LENGTH;
-
-  uint8_t len_max = len + BTM_BLE_PF_STR_LEN_MAX;
-  uint8_t param[len_max];
-  memset(param, 0, len_max);
-
-  uint8_t* p = param;
-  UINT8_TO_STREAM(p, BTM_BLE_META_PF_LOCAL_NAME);
-  UINT8_TO_STREAM(p, action);
-  UINT8_TO_STREAM(p, filt_index);
-
-  if (action != BTM_BLE_SCAN_COND_CLEAR) {
-    int size = std::min(name.size(), (size_t)BTM_BLE_PF_STR_LEN_MAX);
-    ARRAY_TO_STREAM(p, name.data(), size);
-    len += size;
-  }
-
-  /* send local name filter */
-  btu_hcif_send_cmd_with_cb(
-      FROM_HERE, HCI_BLE_ADV_FILTER, param, len,
-      base::Bind(&btm_flt_update_cb, BTM_BLE_META_PF_LOCAL_NAME, cb));
-
-  memset(&btm_ble_adv_filt_cb.cur_filter_target, 0, sizeof(tBLE_BD_ADDR));
-}
-
-/**
- * this function update(add/remove) service data change filter.
- */
-static void BTM_LE_PF_srvc_data(tBTM_BLE_SCAN_COND_OP action,
-                                tBTM_BLE_PF_FILT_INDEX filt_index) {
-  uint8_t num_avail = (action == BTM_BLE_SCAN_COND_ADD) ? 0 : 1;
-
-  btm_ble_cs_update_pf_counter(action, BTM_BLE_PF_SRVC_DATA, nullptr,
-                               num_avail);
-}
-
-/**
- * This function update(add,delete or clear) the adv manufacturer data filtering
- * condition.
- */
-static void BTM_LE_PF_manu_data(tBTM_BLE_SCAN_COND_OP action,
-                                tBTM_BLE_PF_FILT_INDEX filt_index,
-                                uint16_t company_id, uint16_t company_id_mask,
-                                std::vector<uint8_t> data,
-                                std::vector<uint8_t> data_mask,
-                                tBTM_BLE_PF_CFG_CBACK cb) {
-  uint8_t len = BTM_BLE_ADV_FILT_META_HDR_LENGTH;
-  int len_max = len + BTM_BLE_PF_STR_LEN_MAX + BTM_BLE_PF_STR_LEN_MAX;
-
-  uint8_t param[len_max];
-  memset(param, 0, len_max);
-
-  uint8_t* p = param;
-  UINT8_TO_STREAM(p, BTM_BLE_META_PF_MANU_DATA);
-  UINT8_TO_STREAM(p, action);
-  UINT8_TO_STREAM(p, filt_index);
-
-  if (action != BTM_BLE_SCAN_COND_CLEAR) {
-    uint8_t size = std::min(data.size(), (size_t)(BTM_BLE_PF_STR_LEN_MAX - 2));
-
-    UINT16_TO_STREAM(p, company_id);
-    if (size > 0 && data_mask.size() != 0) {
-      ARRAY_TO_STREAM(p, data.data(), size);
-      len += size + 2;
-    } else
-      len += 2;
-
-    if (company_id_mask != 0) {
-      UINT16_TO_STREAM(p, company_id_mask);
-    } else {
-      UINT16_TO_STREAM(p, (uint16_t)0xFFFF);
-    }
-    len += 2;
-
-    if (size > 0 && data_mask.size() != 0) {
-      ARRAY_TO_STREAM(p, data_mask.data(), size);
-      len += (size);
-    }
-
-    BTM_TRACE_DEBUG("Manuf data length: %d", len);
-  }
-
-  btu_hcif_send_cmd_with_cb(
-      FROM_HERE, HCI_BLE_ADV_FILTER, param, len,
-      base::Bind(&btm_flt_update_cb, BTM_BLE_META_PF_MANU_DATA, cb));
-
-  memset(&btm_ble_adv_filt_cb.cur_filter_target, 0, sizeof(tBLE_BD_ADDR));
-}
-
-/**
- * This function update(add,delete or clear) the service data filtering
- * condition.
- **/
-static void BTM_LE_PF_srvc_data_pattern(tBTM_BLE_SCAN_COND_OP action,
-                                        tBTM_BLE_PF_FILT_INDEX filt_index,
-                                        std::vector<uint8_t> data,
-                                        std::vector<uint8_t> data_mask,
-                                        tBTM_BLE_PF_CFG_CBACK cb) {
-  uint8_t len = BTM_BLE_ADV_FILT_META_HDR_LENGTH;
-  int len_max = len + BTM_BLE_PF_STR_LEN_MAX + BTM_BLE_PF_STR_LEN_MAX;
-
-  uint8_t param[len_max];
-  memset(param, 0, len_max);
-
-  uint8_t* p = param;
-  UINT8_TO_STREAM(p, BTM_BLE_META_PF_SRVC_DATA);
-  UINT8_TO_STREAM(p, action);
-  UINT8_TO_STREAM(p, filt_index);
-
-  if (action != BTM_BLE_SCAN_COND_CLEAR) {
-    uint8_t size = std::min(data.size(), (size_t)(BTM_BLE_PF_STR_LEN_MAX - 2));
-
-    if (size > 0) {
-      ARRAY_TO_STREAM(p, data.data(), size);
-      len += size;
-      ARRAY_TO_STREAM(p, data_mask.data(), size);
-      len += size;
-    }
-  }
-
-  btu_hcif_send_cmd_with_cb(
-      FROM_HERE, HCI_BLE_ADV_FILTER, param, len,
-      base::Bind(&btm_flt_update_cb, BTM_BLE_META_PF_SRVC_DATA, cb));
-
-  memset(&btm_ble_adv_filt_cb.cur_filter_target, 0, sizeof(tBLE_BD_ADDR));
-}
-
 /*******************************************************************************
  *
  * Function         btm_ble_cs_update_pf_counter
@@ -460,342 +317,6 @@
   return BTM_BLE_INVALID_COUNTER;
 }
 
-/**
- * This function updates the address filter of adv.
- */
-static void BTM_LE_PF_addr_filter(tBTM_BLE_SCAN_COND_OP action,
-                                  tBTM_BLE_PF_FILT_INDEX filt_index,
-                                  tBLE_BD_ADDR addr, tBTM_BLE_PF_CFG_CBACK cb) {
-  const uint8_t len = BTM_BLE_ADV_FILT_META_HDR_LENGTH + BTM_BLE_META_ADDR_LEN;
-
-  uint8_t param[len];
-  memset(param, 0, len);
-
-  uint8_t* p = param;
-  UINT8_TO_STREAM(p, BTM_BLE_META_PF_ADDR);
-  UINT8_TO_STREAM(p, action);
-  UINT8_TO_STREAM(p, filt_index);
-
-  if (action != BTM_BLE_SCAN_COND_CLEAR) {
-    LOG(INFO) << __func__ << " Filter address " << addr.bda
-              << " has DEVICE_TYPE_ALL, try to get identity address";
-    /*
-     * Always do the pseudo to id address check!
-     *
-     * In the happy path case this should be checking only random types.
-     *
-     * However, the Java layer only knows PUBLIC and RANDOM which leaves us with
-     * 0 and 1 respectively.
-     *
-     * In the native host stack we have 4 values.
-     *     -  Public = 0
-     *     -  Random = 1
-     *     -  Public ID = 2
-     *     -  Random ID = 3
-     *
-     * So we should really only need to do it for Random = 1.
-     *
-     * The app layer won't know the ID address since it didn't see it when it
-     * was scanning.
-     *
-     * Two possible CUJ:
-     *  1. app scans, finds RPA, bonds.  App will only know RPA (pseudo address)
-     *  2. app knows the (preshared) ID address (e.g. DCK+OOB+IRK)
-     *
-     * We cannot lock it to RANDOM here otherwise we break CUJ #1.
-     *
-     * Thus, we must always try to do the conversion.
-     */
-    btm_random_pseudo_to_identity_addr(&addr.bda, &addr.type);
-
-    LOG(INFO) << __func__
-              << " 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! */
-    uint8_t addr_type =
-        0x02;  // Really, you will break scanning if you change this.
-    UINT8_TO_STREAM(p, addr_type);
-  }
-
-  /* send address filter */
-  btu_hcif_send_cmd_with_cb(
-      FROM_HERE, HCI_BLE_ADV_FILTER, param, len,
-      base::Bind(&btm_flt_update_cb, BTM_BLE_META_PF_ADDR, cb));
-
-  memset(&btm_ble_adv_filt_cb.cur_filter_target, 0, sizeof(tBLE_BD_ADDR));
-}
-
-/**
- * This function updates(adds, deletes or clears) the service UUID filter.
- */
-static void BTM_LE_PF_uuid_filter(tBTM_BLE_SCAN_COND_OP action,
-                                  tBTM_BLE_PF_FILT_INDEX filt_index,
-                                  tBTM_BLE_PF_COND_TYPE filter_type,
-                                  const bluetooth::Uuid& uuid,
-                                  tBTM_BLE_PF_LOGIC_TYPE cond_logic,
-                                  const bluetooth::Uuid& uuid_mask,
-                                  tBTM_BLE_PF_CFG_CBACK cb) {
-  uint8_t evt_type;
-
-  if (BTM_BLE_PF_SRVC_UUID == filter_type) {
-    evt_type = BTM_BLE_META_PF_UUID;
-  } else {
-    evt_type = BTM_BLE_META_PF_SOL_UUID;
-  }
-
-  uint8_t len = BTM_BLE_ADV_FILT_META_HDR_LENGTH;
-  uint8_t max_len = len + BTM_BLE_META_UUID_LEN;
-  uint8_t param[max_len];
-  memset(param, 0, max_len);
-  uint8_t* p = param;
-
-  UINT8_TO_STREAM(p, evt_type);
-  UINT8_TO_STREAM(p, action);
-  UINT8_TO_STREAM(p, filt_index);
-
-  uint8_t uuid_len = uuid.GetShortestRepresentationSize();
-  if (action != BTM_BLE_SCAN_COND_CLEAR) {
-    if (uuid_len == Uuid::kNumBytes16) {
-      UINT16_TO_STREAM(p, uuid.As16Bit());
-      len += Uuid::kNumBytes16;
-    } else if (uuid_len == Uuid::kNumBytes32) {
-      UINT32_TO_STREAM(p, uuid.As32Bit());
-      len += Uuid::kNumBytes32;
-    } else if (uuid_len == Uuid::kNumBytes128) {
-      const auto& tmp = uuid.To128BitLE();
-      ARRAY_TO_STREAM(p, tmp.data(), (int)Uuid::kNumBytes128);
-      len += Uuid::kNumBytes128;
-    } else {
-      BTM_TRACE_ERROR("illegal UUID length: %d", uuid_len);
-      cb.Run(0, BTM_BLE_PF_CONFIG, BTM_ILLEGAL_VALUE);
-      return;
-    }
-
-    if (!uuid_mask.IsEmpty()) {
-      if (uuid_len == Uuid::kNumBytes16) {
-        UINT16_TO_STREAM(p, uuid_mask.As16Bit());
-        len += Uuid::kNumBytes16;
-      } else if (uuid_len == Uuid::kNumBytes32) {
-        UINT32_TO_STREAM(p, uuid_mask.As32Bit());
-        len += Uuid::kNumBytes32;
-      } else if (uuid_len == Uuid::kNumBytes128) {
-        const auto& tmp = uuid_mask.To128BitLE();
-        ARRAY_TO_STREAM(p, tmp.data(), (int)Uuid::kNumBytes128);
-        len += Uuid::kNumBytes128;
-      }
-    } else {
-      memset(p, 0xff, uuid_len);
-      len += uuid_len;
-    }
-  }
-
-  /* send UUID filter update */
-  btu_hcif_send_cmd_with_cb(FROM_HERE, HCI_BLE_ADV_FILTER, param, len,
-                            base::Bind(&btm_flt_update_cb, evt_type, cb));
-  memset(&btm_ble_adv_filt_cb.cur_filter_target, 0, sizeof(tBLE_BD_ADDR));
-}
-
-/*
- * Used to remove device records for devices setting scan filters with address,
- * type and IRK. Flow:
- *   - ScanFilter comes in with IRK.
- *   - Check IRK for empty, if empty ignore setting to resolving list.
- *   - Otherwise we set it to the resolving list via BTM_SecAddBleKey.
- *   - Then on clear we need to check if the device is paired and if it isn't we
- * remove it referencing this map.
- *
- */
-static std::unordered_map<tBTM_BLE_PF_FILT_INDEX, RawAddress>
-    remove_me_later_map;
-
-void BTM_LE_PF_set(tBTM_BLE_PF_FILT_INDEX filt_index,
-                   std::vector<ApcfCommand> commands,
-                   tBTM_BLE_PF_CFG_CBACK cb) {
-  if (!is_filtering_supported()) {
-    cb.Run(0, BTM_BLE_PF_ENABLE, BTM_MODE_UNSUPPORTED);
-    return;
-  }
-
-  tBTM_BLE_SCAN_COND_OP action = BTM_BLE_SCAN_COND_ADD;
-  for (const ApcfCommand& cmd : commands) {
-    /* If data is passed, both mask and data have to be the same length */
-    if (cmd.data.size() != cmd.data_mask.size() && cmd.data.size() != 0 &&
-        cmd.data_mask.size() != 0) {
-      LOG(ERROR) << __func__ << " data(" << cmd.data.size() << ") and mask("
-                 << cmd.data_mask.size() << ") are of different size";
-      continue;
-    }
-
-    switch (cmd.type) {
-      case BTM_BLE_PF_ADDR_FILTER: {
-        tBLE_BD_ADDR target_addr;
-        target_addr.bda = cmd.address;
-        target_addr.type = (cmd.addr_type & (~BLE_ADDR_TYPE_ID_BIT));
-
-        BTM_LE_PF_addr_filter(action, filt_index, target_addr,
-                              base::DoNothing());
-        if (!is_empty_128bit(cmd.irk)) {
-          // Save index and addr
-          auto entry = remove_me_later_map.find(filt_index);
-          if (entry != remove_me_later_map.end()) {
-            LOG_WARN("Replacing existing filter index entry with new address");
-            // If device is not bonded, then try removing the device
-            // If the device doesn't get removed then it is currently connected
-            // (may be pairing?) If we do delete the device we want to erase the
-            // filter index so we can replace it If the device is bonded, we
-            // want to erase the filter index so we don't delete it in the later
-            // BTM_LE_PF_clear call.
-            if (!btm_sec_is_a_bonded_dev(entry->second)) {
-              if (!BTM_SecDeleteDevice(entry->second)) {
-                LOG_WARN("Unable to remove device, still connected.");
-                return;
-              }
-            }
-            remove_me_later_map.erase(filt_index);
-          }
-          if (btm_find_dev(cmd.address) != nullptr) {
-            // Unless the user tries to bond with a device in between the
-            // scanner app starting a scan, then crashing, then being restarted
-            // and we get to this same point with the same filt_index (whose
-            // value is managed by the Java layer) then we might have a device
-            // record here, in which case something else is managing the device
-            // and we do not want to interfere with that experience.
-            LOG_WARN("Address record already exists...this is unexpected...");
-            return;
-          }
-          // Allocate a new "temporary" device record
-
-          btm_sec_alloc_dev(cmd.address);
-          remove_me_later_map.emplace(filt_index, cmd.address);
-          // Set the IRK
-          tBTM_LE_PID_KEYS pid_keys;
-          pid_keys.irk = cmd.irk;
-          pid_keys.identity_addr_type =
-              (cmd.addr_type & (~BLE_ADDR_TYPE_ID_BIT));
-          pid_keys.identity_addr = cmd.address;
-          // Add it to the union to pass to SecAddBleKey
-          tBTM_LE_KEY_VALUE le_key;
-          le_key.pid_key = pid_keys;
-          BTM_SecAddBleKey(cmd.address, &le_key, BTM_LE_KEY_PID);
-        }
-        break;
-      }
-
-      case BTM_BLE_PF_SRVC_DATA:
-        BTM_LE_PF_srvc_data(action, filt_index);
-        break;
-
-      case BTM_BLE_PF_SRVC_UUID:
-      case BTM_BLE_PF_SRVC_SOL_UUID: {
-        BTM_LE_PF_uuid_filter(action, filt_index, cmd.type, cmd.uuid,
-                              BTM_BLE_PF_LOGIC_AND, cmd.uuid_mask,
-                              base::DoNothing());
-        break;
-      }
-
-      case BTM_BLE_PF_LOCAL_NAME: {
-        BTM_LE_PF_local_name(action, filt_index, cmd.name, base::DoNothing());
-        break;
-      }
-
-      case BTM_BLE_PF_MANU_DATA: {
-        BTM_LE_PF_manu_data(action, filt_index, cmd.company, cmd.company_mask,
-                            cmd.data, cmd.data_mask, base::DoNothing());
-        break;
-      }
-
-      case BTM_BLE_PF_SRVC_DATA_PATTERN: {
-        BTM_LE_PF_srvc_data_pattern(action, filt_index, cmd.data, cmd.data_mask,
-                                    base::DoNothing());
-        break;
-      }
-
-      default:
-        LOG(ERROR) << __func__ << ": Unknown filter type: " << +cmd.type;
-        break;
-    }
-  }
-  cb.Run(0, 0, BTM_SUCCESS);
-}
-
-/**
- * all adv payload filter by de-selecting all the adv pf feature bits
- */
-void BTM_LE_PF_clear(tBTM_BLE_PF_FILT_INDEX filt_index,
-                     tBTM_BLE_PF_CFG_CBACK cb) {
-  if (!is_filtering_supported()) {
-    cb.Run(0, BTM_BLE_PF_ENABLE, BTM_MODE_UNSUPPORTED);
-    return;
-  }
-
-  /* clear the general filter entry */
-  {
-    tBTM_BLE_PF_CFG_CBACK fDoNothing;
-
-    /* clear manufactuer data filter */
-    BTM_LE_PF_manu_data(BTM_BLE_SCAN_COND_CLEAR, filt_index, 0, 0, {}, {},
-                        fDoNothing);
-
-    /* clear local name filter */
-    BTM_LE_PF_local_name(BTM_BLE_SCAN_COND_CLEAR, filt_index, {}, fDoNothing);
-
-    /* update the counter for service data */
-    BTM_LE_PF_srvc_data(BTM_BLE_SCAN_COND_CLEAR, filt_index);
-
-    /* clear UUID filter */
-    BTM_LE_PF_uuid_filter(BTM_BLE_SCAN_COND_CLEAR, filt_index,
-                          BTM_BLE_PF_SRVC_UUID, {}, 0, Uuid::kEmpty,
-                          fDoNothing);
-
-    BTM_LE_PF_uuid_filter(BTM_BLE_SCAN_COND_CLEAR, filt_index,
-                          BTM_BLE_PF_SRVC_SOL_UUID, {}, 0, Uuid::kEmpty,
-                          fDoNothing);
-
-    /* clear service data filter */
-    BTM_LE_PF_srvc_data_pattern(BTM_BLE_SCAN_COND_CLEAR, filt_index, {}, {},
-                                fDoNothing);
-  }
-
-  uint8_t len = BTM_BLE_ADV_FILT_META_HDR_LENGTH + BTM_BLE_PF_FEAT_SEL_LEN;
-  uint8_t param[len];
-  memset(param, 0, len);
-
-  uint8_t* p = param;
-
-  /* select feature based on control block settings */
-  UINT8_TO_STREAM(p, BTM_BLE_META_PF_FEAT_SEL);
-  UINT8_TO_STREAM(p, BTM_BLE_SCAN_COND_CLEAR);
-  UINT8_TO_STREAM(p, filt_index);
-  /* set PCF selection */
-  UINT32_TO_STREAM(p, BTM_BLE_PF_SELECT_NONE);
-  /* set logic condition as OR as default */
-  UINT8_TO_STREAM(p, BTM_BLE_PF_LOGIC_OR);
-
-  btu_hcif_send_cmd_with_cb(
-      FROM_HERE, HCI_BLE_ADV_FILTER, param, len,
-      base::Bind(&btm_flt_update_cb, BTM_BLE_META_PF_FEAT_SEL, cb));
-
-  memset(&btm_ble_adv_filt_cb.cur_filter_target, 0, sizeof(tBLE_BD_ADDR));
-}
-
 /*******************************************************************************
  *
  * Function         BTM_BleAdvFilterParamSetup
@@ -904,59 +425,6 @@
   }
 }
 
-static void enable_cmpl_cback(tBTM_BLE_PF_STATUS_CBACK p_stat_cback, uint8_t* p,
-                              uint16_t evt_len) {
-  uint8_t status, op_subcode, action;
-
-  if (evt_len != 3) {
-    BTM_TRACE_ERROR("%s: APCF callback length = %d", __func__, evt_len);
-    return;
-  }
-
-  STREAM_TO_UINT8(status, p);
-  STREAM_TO_UINT8(op_subcode, p);
-  STREAM_TO_UINT8(action, p);
-
-  if (op_subcode != BTM_BLE_META_PF_ENABLE) {
-    BTM_TRACE_ERROR("%s :bad subcode: 0x%02x", __func__, op_subcode);
-    return;
-  }
-
-  tBTM_STATUS btm_status = (status == 0) ? BTM_SUCCESS : BTM_ERR_PROCESSING;
-  p_stat_cback.Run(action, btm_status);
-}
-
-/*******************************************************************************
- *
- * Function         BTM_BleEnableDisableFilterFeature
- *
- * Description      This function is called to enable / disable the APCF feature
- *
- * Parameters       enable: enable or disable the filter condition
- *                  p_stat_cback - Status callback pointer
- *
- ******************************************************************************/
-void BTM_BleEnableDisableFilterFeature(uint8_t enable,
-                                       tBTM_BLE_PF_STATUS_CBACK p_stat_cback) {
-  if (!is_filtering_supported()) {
-    if (p_stat_cback)
-      p_stat_cback.Run(BTM_BLE_PF_ENABLE,
-                       BTM_MODE_UNSUPPORTED /* BTA_FAILURE */);
-    return;
-  }
-
-  uint8_t param[20];
-  memset(param, 0, 20);
-
-  uint8_t* p = param;
-  UINT8_TO_STREAM(p, BTM_BLE_META_PF_ENABLE);
-  UINT8_TO_STREAM(p, enable);
-
-  btu_hcif_send_cmd_with_cb(FROM_HERE, HCI_BLE_ADV_FILTER, param,
-                            BTM_BLE_PCF_ENABLE_LEN,
-                            base::Bind(&enable_cmpl_cback, p_stat_cback));
-}
-
 /*******************************************************************************
  *
  * Function         btm_ble_adv_filter_init
diff --git a/system/stack/include/btm_ble_api.h b/system/stack/include/btm_ble_api.h
index c58182f..043b725 100644
--- a/system/stack/include/btm_ble_api.h
+++ b/system/stack/include/btm_ble_api.h
@@ -588,26 +588,6 @@
     std::unique_ptr<btgatt_filt_param_setup_t> p_filt_params,
     tBTM_BLE_PF_PARAM_CB cb);
 
-/**
- * This functions are called to configure the adv data payload filter condition
- */
-void BTM_LE_PF_set(tBTM_BLE_PF_FILT_INDEX filt_index,
-                   std::vector<ApcfCommand> commands, tBTM_BLE_PF_CFG_CBACK cb);
-void BTM_LE_PF_clear(tBTM_BLE_PF_FILT_INDEX filt_index,
-                     tBTM_BLE_PF_CFG_CBACK cb);
-
-/*******************************************************************************
- *
- * Function         BTM_BleEnableDisableFilterFeature
- *
- * Description      Enable or disable the APCF feature
- *
- * Parameters       enable - true - enables APCF, false - disables APCF
- *
- ******************************************************************************/
-void BTM_BleEnableDisableFilterFeature(uint8_t enable,
-                                       tBTM_BLE_PF_STATUS_CBACK p_stat_cback);
-
 /*******************************************************************************
  *
  * Function         BTM_BleGetEnergyInfo
diff --git a/system/test/mock/mock_main_shim_btm_api.cc b/system/test/mock/mock_main_shim_btm_api.cc
index 884278b..1466508 100644
--- a/system/test/mock/mock_main_shim_btm_api.cc
+++ b/system/test/mock/mock_main_shim_btm_api.cc
@@ -253,10 +253,6 @@
     tBTM_BLE_PF_PARAM_CB cb) {
   inc_func_call_count(__func__);
 }
-void bluetooth::shim::BTM_BleEnableDisableFilterFeature(
-    uint8_t enable, tBTM_BLE_PF_STATUS_CBACK p_stat_cback) {
-  inc_func_call_count(__func__);
-}
 void bluetooth::shim::BTM_BleLoadLocalKeys(uint8_t key_type,
                                            tBTM_BLE_LOCAL_KEYS* p_key) {
   inc_func_call_count(__func__);
@@ -303,9 +299,6 @@
                                              tBTM_CMPL_CB* p_cmd_cmpl_cback) {
   inc_func_call_count(__func__);
 }
-void bluetooth::shim::BTM_BleUpdateAdvFilterPolicy(tBTM_BLE_AFP adv_policy) {
-  inc_func_call_count(__func__);
-}
 void bluetooth::shim::BTM_CancelInquiry(void) { inc_func_call_count(__func__); }
 void bluetooth::shim::BTM_ConfirmReqReply(tBTM_STATUS res,
                                           const RawAddress& bd_addr) {
@@ -317,52 +310,6 @@
 void bluetooth::shim::BTM_EnableInterlacedPageScan() {
   inc_func_call_count(__func__);
 }
-void bluetooth::shim::BTM_LE_PF_addr_filter(tBTM_BLE_SCAN_COND_OP action,
-                                            tBTM_BLE_PF_FILT_INDEX filt_index,
-                                            tBLE_BD_ADDR addr,
-                                            tBTM_BLE_PF_CFG_CBACK cb) {
-  inc_func_call_count(__func__);
-}
-void bluetooth::shim::BTM_LE_PF_clear(tBTM_BLE_PF_FILT_INDEX filt_index,
-                                      tBTM_BLE_PF_CFG_CBACK cb) {
-  inc_func_call_count(__func__);
-}
-void bluetooth::shim::BTM_LE_PF_local_name(tBTM_BLE_SCAN_COND_OP action,
-                                           tBTM_BLE_PF_FILT_INDEX filt_index,
-                                           std::vector<uint8_t> name,
-                                           tBTM_BLE_PF_CFG_CBACK cb) {
-  inc_func_call_count(__func__);
-}
-void bluetooth::shim::BTM_LE_PF_manu_data(
-    tBTM_BLE_SCAN_COND_OP action, tBTM_BLE_PF_FILT_INDEX filt_index,
-    uint16_t company_id, uint16_t company_id_mask, std::vector<uint8_t> data,
-    std::vector<uint8_t> data_mask, tBTM_BLE_PF_CFG_CBACK cb) {
-  inc_func_call_count(__func__);
-}
-void bluetooth::shim::BTM_LE_PF_set(tBTM_BLE_PF_FILT_INDEX filt_index,
-                                    std::vector<ApcfCommand> commands,
-                                    tBTM_BLE_PF_CFG_CBACK cb) {
-  inc_func_call_count(__func__);
-}
-void bluetooth::shim::BTM_LE_PF_srvc_data(tBTM_BLE_SCAN_COND_OP action,
-                                          tBTM_BLE_PF_FILT_INDEX filt_index) {
-  inc_func_call_count(__func__);
-}
-void bluetooth::shim::BTM_LE_PF_srvc_data_pattern(
-    tBTM_BLE_SCAN_COND_OP action, tBTM_BLE_PF_FILT_INDEX filt_index,
-    std::vector<uint8_t> data, std::vector<uint8_t> data_mask,
-    tBTM_BLE_PF_CFG_CBACK cb) {
-  inc_func_call_count(__func__);
-}
-void bluetooth::shim::BTM_LE_PF_uuid_filter(tBTM_BLE_SCAN_COND_OP action,
-                                            tBTM_BLE_PF_FILT_INDEX filt_index,
-                                            tBTM_BLE_PF_COND_TYPE filter_type,
-                                            const bluetooth::Uuid& uuid,
-                                            tBTM_BLE_PF_LOGIC_TYPE cond_logic,
-                                            const bluetooth::Uuid& uuid_mask,
-                                            tBTM_BLE_PF_CFG_CBACK cb) {
-  inc_func_call_count(__func__);
-}
 void bluetooth::shim::BTM_PINCodeReply(const RawAddress& bd_addr,
                                        tBTM_STATUS res, uint8_t pin_len,
                                        uint8_t* p_pin) {
diff --git a/system/test/mock/mock_stack_btm_ble_adv_filter.cc b/system/test/mock/mock_stack_btm_ble_adv_filter.cc
index 3969925..6808d7a 100644
--- a/system/test/mock/mock_stack_btm_ble_adv_filter.cc
+++ b/system/test/mock/mock_stack_btm_ble_adv_filter.cc
@@ -46,17 +46,4 @@
     tBTM_BLE_PF_PARAM_CB cb) {
   inc_func_call_count(__func__);
 }
-void BTM_BleEnableDisableFilterFeature(uint8_t enable,
-                                       tBTM_BLE_PF_STATUS_CBACK p_stat_cback) {
-  inc_func_call_count(__func__);
-}
-void BTM_LE_PF_clear(tBTM_BLE_PF_FILT_INDEX filt_index,
-                     tBTM_BLE_PF_CFG_CBACK cb) {
-  inc_func_call_count(__func__);
-}
-void BTM_LE_PF_set(tBTM_BLE_PF_FILT_INDEX filt_index,
-                   std::vector<ApcfCommand> commands,
-                   tBTM_BLE_PF_CFG_CBACK cb) {
-  inc_func_call_count(__func__);
-}
 void btm_ble_adv_filter_init(void) { inc_func_call_count(__func__); }