From 265b043cc4f9a5af4ec1b75e0dea6fca3d8330ce Mon Sep 17 00:00:00 2001
From: Chris Manton <cmanton@google.com>
Date: Wed, 7 Apr 2021 17:37:08 -0700
Subject: [PATCH] Initial btif/test/btif_stack_test

Bug: 182544206
Test: gd/cert/run
Tag: #refactor
BYPASS_LONG_LINES_REASON: Bluetooth likes 120 lines
No-Typo-Check: Legacy code mocks

Change-Id: I5cf4b24651b436a96bfbba43ad33db28707352e3
---
 system/btif/Android.bp                        |  72 +++
 system/btif/test/btif_stack_test.cc           | 203 ++++++++
 system/test/Android.bp                        |  70 +++
 system/test/mock/mock_a2dp_api.cc             |  67 +++
 system/test/mock/mock_a2dp_codec_config.cc    | 351 ++++++++++++++
 system/test/mock/mock_activity_attribution.cc |  35 ++
 .../test/mock/mock_android_hardware_audio.cc  |  61 +++
 system/test/mock/mock_bta_ag_api.cc           |  67 +++
 system/test/mock/mock_bta_ar.cc               |  55 +++
 system/test/mock/mock_bta_av_api.cc           | 105 ++++
 system/test/mock/mock_bta_av_ci.cc            |  42 ++
 system/test/mock/mock_bta_av_main.cc          | 102 ++++
 system/test/mock/mock_bta_dm_act.cc           | 159 ++++++
 system/test/mock/mock_bta_dm_api.cc           | 145 ++++++
 system/test/mock/mock_bta_gattc_api.cc        | 167 +++++++
 system/test/mock/mock_bta_gatts_api.cc        |  85 ++++
 system/test/mock/mock_bta_hd_api.cc           |  60 +++
 system/test/mock/mock_bta_hearing_aid.cc      |  75 +++
 system/test/mock/mock_bta_hf_client_api.cc    |  62 +++
 system/test/mock/mock_bta_hh_api.cc           |  82 ++++
 system/test/mock/mock_bta_jv_api.cc           | 146 ++++++
 system/test/mock/mock_bta_pan_api.cc          |  48 ++
 system/test/mock/mock_bta_pan_ci.cc           |  67 +++
 system/test/mock/mock_bta_sdp_api.cc          |  54 +++
 system/test/mock/mock_bta_sys_conn.cc         | 122 +++++
 system/test/mock/mock_bta_sys_main.cc         |  64 +++
 system/test/mock/mock_bta_sys_utl.cc          |  63 +++
 system/test/mock/mock_bta_vc.cc               |  61 +++
 system/test/mock/mock_bta_vc_device.cc        |  95 ++++
 system/test/mock/mock_btcore_module.cc        |  61 +++
 .../mock/mock_common_address_obfuscator.cc    |  58 +++
 .../mock/mock_common_message_loop_thread.cc   | 250 ++++++++++
 .../mock/mock_common_metric_id_allocator.cc   | 104 ++++
 system/test/mock/mock_common_metrics.cc       | 207 ++++++++
 .../test/mock/mock_common_repeating_timer.cc  |  60 +++
 .../mock/mock_common_stop_watch_legacy.cc     |  55 +++
 system/test/mock/mock_common_time_util.cc     |  52 ++
 system/test/mock/mock_frameworks_libaudio.cc  | 305 ++++++++++++
 system/test/mock/mock_hci_btsnoop_mem.cc      |  43 ++
 system/test/mock/mock_hci_packet_factory.cc   |  44 ++
 system/test/mock/mock_hci_packet_parser.cc    |  41 ++
 system/test/mock/mock_l2cap_l2c_api.cc        | 177 +++++++
 system/test/mock/mock_l2cap_main.cc           |  60 +++
 system/test/mock/mock_main_shim.cc            |  93 ++++
 .../mock_main_shim_BtifConfigInterface.cc     |  90 ++++
 .../mock_main_shim_activity_attribution.cc    |  42 ++
 system/test/mock/mock_main_shim_controller.cc |  37 ++
 system/test/mock/mock_main_shim_dumpsys.cc    |  44 ++
 .../mock_main_shim_le_advertising_manager.cc  |  45 ++
 .../mock_main_shim_le_scanning_manager.cc     |  40 ++
 .../test/mock/mock_main_shim_metric_id_api.cc |  70 +++
 .../test/mock/mock_main_shim_metrics_api.cc   | 100 ++++
 system/test/mock/mock_stack_a2dp_api.cc       |  67 +++
 .../test/mock/mock_stack_a2dp_codec_config.cc | 351 ++++++++++++++
 system/test/mock/mock_stack_acl.cc            | 452 ++++++++++++++++++
 system/test/mock/mock_stack_avct_api.cc       |  75 +++
 system/test/mock/mock_stack_avdt_api.cc       | 147 ++++++
 system/test/mock/mock_stack_avrc_api.cc       |  83 ++++
 system/test/mock/mock_stack_avrc_bld_ct.cc    |  40 ++
 system/test/mock/mock_stack_avrc_bld_tg.cc    |  48 ++
 system/test/mock/mock_stack_avrc_pars.ct.cc   |  55 +++
 system/test/mock/mock_stack_avrc_pars_tg.cc   |  46 ++
 system/test/mock/mock_stack_avrc_sdp.cc       |  58 +++
 system/test/mock/mock_stack_bnep_api.cc       |  86 ++++
 system/test/mock/mock_stack_btm.cc            |  65 +++
 system/test/mock/mock_stack_btm_ble.cc        | 256 ++++++++++
 .../mock/mock_stack_btm_ble_adv_filter.cc     |  67 +++
 .../test/mock/mock_stack_btm_ble_batchscan.cc |  72 +++
 system/test/mock/mock_stack_btm_ble_gap.cc    | 213 +++++++++
 .../test/mock/mock_stack_btm_ble_multi_adv.cc |  66 +++
 system/test/mock/mock_stack_btm_dev.cc        | 112 +++++
 system/test/mock/mock_stack_btm_devctl.cc     | 124 +++++
 system/test/mock/mock_stack_btm_main.cc       |  57 +++
 system/test/mock/mock_stack_btm_scn.cc        |  46 ++
 system/test/mock/mock_stack_btm_sco.cc        | 125 +++++
 system/test/mock/mock_stack_btm_sec.cc        | 297 ++++++++++++
 system/test/mock/mock_stack_btu_task.cc       |  70 +++
 system/test/mock/mock_stack_gap_conn.cc       |  82 ++++
 system/test/mock/mock_stack_gatt.cc           | 159 ++++++
 .../mock_stack_gatt_connection_manager.cc     |  86 ++++
 system/test/mock/mock_stack_gatt_main.cc      | 113 +++++
 system/test/mock/mock_stack_hidd_api.cc       | 111 +++++
 system/test/mock/mock_stack_hidh.cc           |  81 ++++
 system/test/mock/mock_stack_l2cap_api.cc      | 177 +++++++
 system/test/mock/mock_stack_l2cap_main.cc     |  60 +++
 system/test/mock/mock_stack_pan_api.cc        |  93 ++++
 .../test/mock/mock_stack_rfcomm_port_api.cc   | 130 +++++
 system/test/mock/mock_stack_sdp.cc            | 113 +++++
 system/test/mock/mock_stack_sdp_db.cc         | 102 ++++
 system/test/mock/mock_stack_sdp_main.cc       |  51 ++
 system/test/mock/mock_stack_smp_api.cc        |  80 ++++
 .../test/mock/mock_system_libfmq_eventflag.cc |  99 ++++
 system/test/mock/mock_udrv_ulinux_uipc.cc     | 100 ++++
 93 files changed, 9578 insertions(+)
 create mode 100644 system/btif/test/btif_stack_test.cc
 create mode 100644 system/test/mock/mock_a2dp_api.cc
 create mode 100644 system/test/mock/mock_a2dp_codec_config.cc
 create mode 100644 system/test/mock/mock_activity_attribution.cc
 create mode 100644 system/test/mock/mock_android_hardware_audio.cc
 create mode 100644 system/test/mock/mock_bta_ag_api.cc
 create mode 100644 system/test/mock/mock_bta_ar.cc
 create mode 100644 system/test/mock/mock_bta_av_api.cc
 create mode 100644 system/test/mock/mock_bta_av_ci.cc
 create mode 100644 system/test/mock/mock_bta_av_main.cc
 create mode 100644 system/test/mock/mock_bta_dm_act.cc
 create mode 100644 system/test/mock/mock_bta_dm_api.cc
 create mode 100644 system/test/mock/mock_bta_gattc_api.cc
 create mode 100644 system/test/mock/mock_bta_gatts_api.cc
 create mode 100644 system/test/mock/mock_bta_hd_api.cc
 create mode 100644 system/test/mock/mock_bta_hearing_aid.cc
 create mode 100644 system/test/mock/mock_bta_hf_client_api.cc
 create mode 100644 system/test/mock/mock_bta_hh_api.cc
 create mode 100644 system/test/mock/mock_bta_jv_api.cc
 create mode 100644 system/test/mock/mock_bta_pan_api.cc
 create mode 100644 system/test/mock/mock_bta_pan_ci.cc
 create mode 100644 system/test/mock/mock_bta_sdp_api.cc
 create mode 100644 system/test/mock/mock_bta_sys_conn.cc
 create mode 100644 system/test/mock/mock_bta_sys_main.cc
 create mode 100644 system/test/mock/mock_bta_sys_utl.cc
 create mode 100644 system/test/mock/mock_bta_vc.cc
 create mode 100644 system/test/mock/mock_bta_vc_device.cc
 create mode 100644 system/test/mock/mock_btcore_module.cc
 create mode 100644 system/test/mock/mock_common_address_obfuscator.cc
 create mode 100644 system/test/mock/mock_common_message_loop_thread.cc
 create mode 100644 system/test/mock/mock_common_metric_id_allocator.cc
 create mode 100644 system/test/mock/mock_common_metrics.cc
 create mode 100644 system/test/mock/mock_common_repeating_timer.cc
 create mode 100644 system/test/mock/mock_common_stop_watch_legacy.cc
 create mode 100644 system/test/mock/mock_common_time_util.cc
 create mode 100644 system/test/mock/mock_frameworks_libaudio.cc
 create mode 100644 system/test/mock/mock_hci_btsnoop_mem.cc
 create mode 100644 system/test/mock/mock_hci_packet_factory.cc
 create mode 100644 system/test/mock/mock_hci_packet_parser.cc
 create mode 100644 system/test/mock/mock_l2cap_l2c_api.cc
 create mode 100644 system/test/mock/mock_l2cap_main.cc
 create mode 100644 system/test/mock/mock_main_shim.cc
 create mode 100644 system/test/mock/mock_main_shim_BtifConfigInterface.cc
 create mode 100644 system/test/mock/mock_main_shim_activity_attribution.cc
 create mode 100644 system/test/mock/mock_main_shim_controller.cc
 create mode 100644 system/test/mock/mock_main_shim_dumpsys.cc
 create mode 100644 system/test/mock/mock_main_shim_le_advertising_manager.cc
 create mode 100644 system/test/mock/mock_main_shim_le_scanning_manager.cc
 create mode 100644 system/test/mock/mock_main_shim_metric_id_api.cc
 create mode 100644 system/test/mock/mock_main_shim_metrics_api.cc
 create mode 100644 system/test/mock/mock_stack_a2dp_api.cc
 create mode 100644 system/test/mock/mock_stack_a2dp_codec_config.cc
 create mode 100644 system/test/mock/mock_stack_acl.cc
 create mode 100644 system/test/mock/mock_stack_avct_api.cc
 create mode 100644 system/test/mock/mock_stack_avdt_api.cc
 create mode 100644 system/test/mock/mock_stack_avrc_api.cc
 create mode 100644 system/test/mock/mock_stack_avrc_bld_ct.cc
 create mode 100644 system/test/mock/mock_stack_avrc_bld_tg.cc
 create mode 100644 system/test/mock/mock_stack_avrc_pars.ct.cc
 create mode 100644 system/test/mock/mock_stack_avrc_pars_tg.cc
 create mode 100644 system/test/mock/mock_stack_avrc_sdp.cc
 create mode 100644 system/test/mock/mock_stack_bnep_api.cc
 create mode 100644 system/test/mock/mock_stack_btm.cc
 create mode 100644 system/test/mock/mock_stack_btm_ble.cc
 create mode 100644 system/test/mock/mock_stack_btm_ble_adv_filter.cc
 create mode 100644 system/test/mock/mock_stack_btm_ble_batchscan.cc
 create mode 100644 system/test/mock/mock_stack_btm_ble_gap.cc
 create mode 100644 system/test/mock/mock_stack_btm_ble_multi_adv.cc
 create mode 100644 system/test/mock/mock_stack_btm_dev.cc
 create mode 100644 system/test/mock/mock_stack_btm_devctl.cc
 create mode 100644 system/test/mock/mock_stack_btm_main.cc
 create mode 100644 system/test/mock/mock_stack_btm_scn.cc
 create mode 100644 system/test/mock/mock_stack_btm_sco.cc
 create mode 100644 system/test/mock/mock_stack_btm_sec.cc
 create mode 100644 system/test/mock/mock_stack_btu_task.cc
 create mode 100644 system/test/mock/mock_stack_gap_conn.cc
 create mode 100644 system/test/mock/mock_stack_gatt.cc
 create mode 100644 system/test/mock/mock_stack_gatt_connection_manager.cc
 create mode 100644 system/test/mock/mock_stack_gatt_main.cc
 create mode 100644 system/test/mock/mock_stack_hidd_api.cc
 create mode 100644 system/test/mock/mock_stack_hidh.cc
 create mode 100644 system/test/mock/mock_stack_l2cap_api.cc
 create mode 100644 system/test/mock/mock_stack_l2cap_main.cc
 create mode 100644 system/test/mock/mock_stack_pan_api.cc
 create mode 100644 system/test/mock/mock_stack_rfcomm_port_api.cc
 create mode 100644 system/test/mock/mock_stack_sdp.cc
 create mode 100644 system/test/mock/mock_stack_sdp_db.cc
 create mode 100644 system/test/mock/mock_stack_sdp_main.cc
 create mode 100644 system/test/mock/mock_stack_smp_api.cc
 create mode 100644 system/test/mock/mock_system_libfmq_eventflag.cc
 create mode 100644 system/test/mock/mock_udrv_ulinux_uipc.cc

diff --git a/system/btif/Android.bp b/system/btif/Android.bp
index ab557277f7e..3d8b77d74ce 100644
--- a/system/btif/Android.bp
+++ b/system/btif/Android.bp
@@ -303,3 +303,75 @@ cc_test {
     ],
     cflags: ["-DBUILDCFG"],
 }
+
+// Cycle stack test
+// ========================================================
+cc_test {
+    name: "net_test_btif_stack",
+    host_supported: true,
+    defaults: ["fluoride_defaults"],
+    test_suites: ["device-tests"],
+    include_dirs: [
+        "frameworks/av/media/libaaudio/include",
+        "packages/modules/Bluetooth/system",
+        "packages/modules/Bluetooth/system/bta/dm",
+        "packages/modules/Bluetooth/system/bta/include",
+        "packages/modules/Bluetooth/system/bta/sys",
+        "packages/modules/Bluetooth/system/btcore/include",
+        "packages/modules/Bluetooth/system/btif/avrcp",
+        "packages/modules/Bluetooth/system/btif/co",
+        "packages/modules/Bluetooth/system/btif/include",
+        "packages/modules/Bluetooth/system/device/include",
+        "packages/modules/Bluetooth/system/embdrv/sbc/decoder/include",
+        "packages/modules/Bluetooth/system/embdrv/sbc/encoder/include",
+        "packages/modules/Bluetooth/system/gd",
+        "packages/modules/Bluetooth/system/hci/include",
+        "packages/modules/Bluetooth/system/include",
+        "packages/modules/Bluetooth/system/internal_include",
+        "packages/modules/Bluetooth/system/stack/a2dp",
+        "packages/modules/Bluetooth/system/stack/avdt",
+        "packages/modules/Bluetooth/system/stack/btm",
+        "packages/modules/Bluetooth/system/stack/include",
+        "packages/modules/Bluetooth/system/stack/l2cap",
+        "packages/modules/Bluetooth/system/udrv/include",
+        "packages/modules/Bluetooth/system/utils/include",
+        "packages/modules/Bluetooth/system/vnd/include",
+        "system/libfmq/include",
+        "system/libhwbinder/include",
+        ],
+      srcs: [
+          ":LibBluetoothSources",
+          ":TestMockAndroidHardware",
+          ":TestMockBta",
+          ":TestMockBtcore",
+          ":TestMockCommon",
+          ":TestMockFrameworks",
+          ":TestMockHci",
+          ":TestMockMainShim",
+          ":TestMockStack",
+          ":TestMockSystemLibfmq",
+          ":TestMockUdrv",
+          "test/btif_stack_test.cc",
+      ],
+      header_libs: ["libbluetooth_headers"],
+      shared_libs: [
+          "android.hardware.bluetooth.a2dp@1.0",
+          "android.hardware.bluetooth.audio@2.0",
+          "android.hardware.bluetooth.audio@2.1",
+          "libcrypto",
+          "libcutils",
+          "libhidlbase",
+          "liblog",
+          "libtinyxml2",
+      ],
+      whole_static_libs: [
+          "libbtif",
+      ],
+      static_libs: [
+          "libbluetooth-types",
+          "libbtdevice",
+          "libgmock",
+          "libosi",
+      ],
+      cflags: ["-DBUILDCFG"],
+}
diff --git a/system/btif/test/btif_stack_test.cc b/system/btif/test/btif_stack_test.cc
new file mode 100644
index 00000000000..0d99b47c6f1
--- /dev/null
+++ b/system/btif/test/btif_stack_test.cc
@@ -0,0 +1,203 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "btif/include/btif_profile_queue.h"
+
+#include <gtest/gtest.h>
+
+#include <base/bind.h>
+#include <base/callback.h>
+#include <base/location.h>
+#include "stack_manager.h"
+#include "types/raw_address.h"
+
+#include "bta/include/bta_ag_api.h"  // tBTA_AG_RES_DATA::kEmpty
+#include "hci/include/hci_layer.h"   // hci_t
+
+std::map<std::string, int> mock_function_count_map;
+
+void set_hal_cbacks(bt_callbacks_t* callbacks);  // btif/src/bluetooth.cc
+
+// tLEGACY_TRACE_LEVEL
+uint8_t btu_trace_level = 6;
+uint8_t appl_trace_level = 6;
+uint8_t btif_trace_level = 6;
+
+namespace {
+
+void dump_mock_function_count_map() {
+  LOG_INFO("Mock function count map size:%zu", mock_function_count_map.size());
+
+  for (auto it : mock_function_count_map) {
+    LOG_INFO("function:%s: call_count:%d", it.first.c_str(), it.second);
+  }
+}
+
+namespace _adapter_state_changed {
+bt_state_t state{BT_STATE_OFF};
+}
+void adapter_state_changed(bt_state_t state) {
+  LOG_INFO("%u => %u", _adapter_state_changed::state, state);
+}
+
+void adapter_properties(bt_status_t status, int num_properties,
+                        bt_property_t* properties) {
+  LOG_INFO("Callback rx");
+}
+
+void remote_device_properties(bt_status_t status, RawAddress* bd_addr,
+                              int num_properties, bt_property_t* properties) {
+  LOG_INFO("Callback rx");
+}
+
+void device_found(int num_properties, bt_property_t* properties) {
+  LOG_INFO("Callback rx");
+}
+
+void discovery_state_changed(bt_discovery_state_t state) {
+  LOG_INFO("Callback rx");
+}
+
+/** Bluetooth Legacy PinKey Request callback */
+void pin_request(RawAddress* remote_bd_addr, bt_bdname_t* bd_name, uint32_t cod,
+                 bool min_16_digit) {
+  LOG_INFO("Callback rx");
+}
+
+void ssp_request(RawAddress* remote_bd_addr, bt_bdname_t* bd_name, uint32_t cod,
+                 bt_ssp_variant_t pairing_variant, uint32_t pass_key) {
+  LOG_INFO("Callback rx");
+}
+
+/** Bluetooth Bond state changed callback */
+/* Invoked in response to create_bond, cancel_bond or remove_bond */
+void bond_state_changed(bt_status_t status, RawAddress* remote_bd_addr,
+                        bt_bond_state_t state) {
+  LOG_INFO("Callback rx");
+}
+
+/** Bluetooth ACL connection state changed callback */
+void acl_state_changed(bt_status_t status, RawAddress* remote_bd_addr,
+                       bt_acl_state_t state, bt_hci_error_code_t hci_reason) {
+  LOG_INFO("status:%s device:%s state:%s", bt_status_text(status).c_str(),
+           remote_bd_addr->ToString().c_str(),
+           (state) ? "disconnected" : "connected");
+}
+
+/** Bluetooth Link Quality Report callback */
+void link_quality_report(uint64_t timestamp, int report_id, int rssi, int snr,
+                         int retransmission_count,
+                         int packets_not_receive_count,
+                         int negative_acknowledgement_count) {
+  LOG_INFO("Callback rx");
+}
+
+void thread_event(bt_cb_thread_evt evt) { LOG_INFO("Callback rx"); }
+
+void dut_mode_recv(uint16_t opcode, uint8_t* buf, uint8_t len) {
+  LOG_INFO("Callback rx");
+}
+
+void le_test_mode(bt_status_t status, uint16_t num_packets) {
+  LOG_INFO("Callback rx");
+}
+
+void energy_info(bt_activity_energy_info* energy_info,
+                 bt_uid_traffic_t* uid_data) {
+  LOG_INFO("Callback rx");
+}
+
+bt_callbacks_t bt_callbacks{
+    /** set to sizeof(bt_callbacks_t) */
+    .size = sizeof(bt_callbacks_t),
+    .adapter_state_changed_cb = adapter_state_changed,
+    .adapter_properties_cb = adapter_properties,
+    .remote_device_properties_cb = remote_device_properties,
+    .device_found_cb = device_found,
+    .discovery_state_changed_cb = discovery_state_changed,
+    .pin_request_cb = pin_request,
+    .ssp_request_cb = ssp_request,
+    .bond_state_changed_cb = bond_state_changed,
+    .acl_state_changed_cb = acl_state_changed,
+    .thread_evt_cb = thread_event,
+    .dut_mode_recv_cb = dut_mode_recv,
+    .le_test_mode_cb = le_test_mode,
+    .energy_info_cb = energy_info,
+    .link_quality_report_cb = link_quality_report,
+};
+
+void set_data_cb(
+    base::Callback<void(const base::Location&, BT_HDR*)> send_data_cb) {
+  mock_function_count_map[__func__]++;
+}
+
+void transmit_command(BT_HDR* command, command_complete_cb complete_callback,
+                      command_status_cb status_cb, void* context) {
+  mock_function_count_map[__func__]++;
+}
+
+future_t* transmit_command_futured(BT_HDR* command) {
+  mock_function_count_map[__func__]++;
+  return nullptr;
+}
+
+void transmit_downward(uint16_t type, void* data) {
+  mock_function_count_map[__func__]++;
+}
+
+}  // namespace
+
+hci_t mock_hci = {
+    .set_data_cb = set_data_cb,
+    .transmit_command = transmit_command,
+    .transmit_command_futured = transmit_command_futured,
+    .transmit_downward = transmit_downward,
+};
+const hci_t* hci_layer_get_interface() { return &mock_hci; }
+
+bool is_bluetooth_uid() { return false; }
+const tBTA_AG_RES_DATA tBTA_AG_RES_DATA::kEmpty = {};
+
+namespace bluetooth {
+namespace common {
+
+class BluetoothMetricsLogger {};
+
+}  // namespace common
+}  // namespace bluetooth
+
+class StackCycleTest : public ::testing::Test {
+ protected:
+  void SetUp() override { stack_manager_ = stack_manager_get_interface(); }
+
+  void TearDown() override { stack_manager_ = nullptr; }
+  const stack_manager_t* stack_manager_{nullptr};
+};
+
+TEST_F(StackCycleTest, stack_init) {
+  // TODO load init flags
+  // bluetooth::common::InitFlags::Load(init_flags);
+
+  set_hal_cbacks(&bt_callbacks);
+
+  stack_manager_get_interface()->init_stack();
+
+  LOG_INFO("Initialized stack");
+
+  ASSERT_EQ(1, mock_function_count_map["set_data_cb"]);
+
+  dump_mock_function_count_map();
+}
diff --git a/system/test/Android.bp b/system/test/Android.bp
index 83b7c3cdc22..f5125c92a01 100644
--- a/system/test/Android.bp
+++ b/system/test/Android.bp
@@ -11,3 +11,73 @@ subdirs = [
     "rootcanal",
     "suite",
 ]
+
+filegroup {
+    name: "TestMockBta",
+    srcs: [
+      "mock/mock_bta_*.cc",
+    ],
+}
+
+filegroup {
+    name: "TestMockMainShim",
+    srcs: [
+      "mock/mock_main_shim*.cc",
+    ],
+}
+
+filegroup {
+    name: "TestMockCommon",
+    srcs: [
+      "mock/mock_common_*.cc",
+    ],
+}
+
+filegroup {
+    name: "TestMockStack",
+    srcs: [
+      "mock/mock_stack_*.cc",
+    ],
+}
+
+filegroup {
+    name: "TestMockHci",
+    srcs: [
+      "mock/mock_hci_*.cc",
+    ],
+}
+
+filegroup {
+    name: "TestMockFrameworks",
+    srcs: [
+      "mock/mock_frameworks_*.cc",
+    ],
+}
+
+filegroup {
+    name: "TestMockBtcore",
+    srcs: [
+      "mock/mock_btcore_*.cc",
+    ],
+}
+
+filegroup {
+    name: "TestMockSystemLibfmq",
+    srcs: [
+      "mock/mock_system_libfmq_*.cc",
+    ],
+}
+
+filegroup {
+    name: "TestMockUdrv",
+    srcs: [
+      "mock/mock_udrv_*.cc",
+    ],
+}
+
+filegroup {
+    name: "TestMockAndroidHardware",
+    srcs: [
+      "mock/mock_android_hardware_*.cc",
+    ],
+}
diff --git a/system/test/mock/mock_a2dp_api.cc b/system/test/mock/mock_a2dp_api.cc
new file mode 100644
index 00000000000..5ca56717af2
--- /dev/null
+++ b/system/test/mock/mock_a2dp_api.cc
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:9
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include <string.h>
+#include "a2dp_api.h"
+#include "a2dp_int.h"
+#include "avdt_api.h"
+#include "bt_common.h"
+#include "bt_target.h"
+#include "osi/include/log.h"
+#include "sdpdefs.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+tA2DP_STATUS A2DP_AddRecord(uint16_t service_uuid, char* p_service_name,
+                            char* p_provider_name, uint16_t features,
+                            uint32_t sdp_handle) {
+  mock_function_count_map[__func__]++;
+  return A2DP_SUCCESS;
+}
+tA2DP_STATUS A2DP_FindService(uint16_t service_uuid, const RawAddress& bd_addr,
+                              tA2DP_SDP_DB_PARAMS* p_db,
+                              tA2DP_FIND_CBACK* p_cback) {
+  mock_function_count_map[__func__]++;
+  return A2DP_SUCCESS;
+}
+uint16_t A2DP_GetAvdtpVersion() {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint8_t A2DP_BitsSet(uint64_t num) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint8_t A2DP_SetTraceLevel(uint8_t new_level) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+void A2DP_Init(void) { mock_function_count_map[__func__]++; }
+void a2dp_set_avdt_sdp_ver(uint16_t avdt_sdp_ver) {
+  mock_function_count_map[__func__]++;
+}
diff --git a/system/test/mock/mock_a2dp_codec_config.cc b/system/test/mock/mock_a2dp_codec_config.cc
new file mode 100644
index 00000000000..8d013282647
--- /dev/null
+++ b/system/test/mock/mock_a2dp_codec_config.cc
@@ -0,0 +1,351 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:67
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include <base/logging.h>
+#include <inttypes.h>
+#include "a2dp_aac.h"
+#include "a2dp_codec_api.h"
+#include "a2dp_sbc.h"
+#include "a2dp_vendor.h"
+#include "bta/av/bta_av_int.h"
+#include "osi/include/log.h"
+#include "osi/include/properties.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+A2dpCodecConfig* A2dpCodecConfig::createCodec(
+    btav_a2dp_codec_index_t codec_index,
+    btav_a2dp_codec_priority_t codec_priority) {
+  mock_function_count_map[__func__]++;
+  return nullptr;
+}
+A2dpCodecConfig* A2dpCodecs::findSinkCodecConfig(const uint8_t* p_codec_info) {
+  mock_function_count_map[__func__]++;
+  return nullptr;
+}
+A2dpCodecConfig* A2dpCodecs::findSourceCodecConfig(
+    const uint8_t* p_codec_info) {
+  mock_function_count_map[__func__]++;
+  return nullptr;
+}
+A2dpCodecConfig::A2dpCodecConfig(btav_a2dp_codec_index_t codec_index,
+                                 const std::string& name,
+                                 btav_a2dp_codec_priority_t codec_priority)
+    : codec_index_(codec_index),
+      name_(name),
+      default_codec_priority_(codec_priority) {
+  mock_function_count_map[__func__]++;
+}
+A2dpCodecConfig::~A2dpCodecConfig() { mock_function_count_map[__func__]++; }
+A2dpCodecs::A2dpCodecs(
+    const std::vector<btav_a2dp_codec_config_t>& codec_priorities)
+    : current_codec_config_(nullptr) {
+  mock_function_count_map[__func__]++;
+}
+A2dpCodecs::~A2dpCodecs() { mock_function_count_map[__func__]++; }
+bool A2DP_AdjustCodec(uint8_t* p_codec_info) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool A2DP_BuildCodecHeader(const uint8_t* p_codec_info, BT_HDR* p_buf,
+                           uint16_t frames_per_packet) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool A2DP_CodecEquals(const uint8_t* p_codec_info_a,
+                      const uint8_t* p_codec_info_b) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool A2DP_CodecTypeEquals(const uint8_t* p_codec_info_a,
+                          const uint8_t* p_codec_info_b) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool A2DP_GetPacketTimestamp(const uint8_t* p_codec_info, const uint8_t* p_data,
+                             uint32_t* p_timestamp) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool A2DP_InitCodecConfig(btav_a2dp_codec_index_t codec_index,
+                          AvdtpSepConfig* p_cfg) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool A2DP_IsPeerSinkCodecValid(const uint8_t* p_codec_info) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool A2DP_IsPeerSourceCodecSupported(const uint8_t* p_codec_info) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool A2DP_IsPeerSourceCodecValid(const uint8_t* p_codec_info) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool A2DP_IsSinkCodecSupported(const uint8_t* p_codec_info) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool A2DP_IsSinkCodecValid(const uint8_t* p_codec_info) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool A2DP_IsSourceCodecValid(const uint8_t* p_codec_info) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool A2DP_UsesRtpHeader(bool content_protection_enabled,
+                        const uint8_t* p_codec_info) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool A2dpCodecConfig::codecConfigIsValid(
+    const btav_a2dp_codec_config_t& codec_config) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool A2dpCodecConfig::copyOutOtaCodecConfig(uint8_t* p_codec_info) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool A2dpCodecConfig::getCodecSpecificConfig(tBT_A2DP_OFFLOAD* p_a2dp_offload) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool A2dpCodecConfig::isCodecConfigEmpty(
+    const btav_a2dp_codec_config_t& codec_config) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool A2dpCodecConfig::isValid() const {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool A2dpCodecConfig::setCodecUserConfig(
+    const btav_a2dp_codec_config_t& codec_user_config,
+    const btav_a2dp_codec_config_t& codec_audio_config,
+    const tA2DP_ENCODER_INIT_PEER_PARAMS* p_peer_params,
+    const uint8_t* p_peer_codec_info, bool is_capability,
+    uint8_t* p_result_codec_config, bool* p_restart_input,
+    bool* p_restart_output, bool* p_config_updated) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool A2dpCodecs::getCodecConfigAndCapabilities(
+    btav_a2dp_codec_config_t* p_codec_config,
+    std::vector<btav_a2dp_codec_config_t>* p_codecs_local_capabilities,
+    std::vector<btav_a2dp_codec_config_t>* p_codecs_selectable_capabilities) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool A2dpCodecs::init() {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool A2dpCodecs::isSupportedCodec(btav_a2dp_codec_index_t codec_index) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool A2dpCodecs::setCodecAudioConfig(
+    const btav_a2dp_codec_config_t& codec_audio_config,
+    const tA2DP_ENCODER_INIT_PEER_PARAMS* p_peer_params,
+    const uint8_t* p_peer_sink_capabilities, uint8_t* p_result_codec_config,
+    bool* p_restart_output, bool* p_config_updated) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool A2dpCodecs::setCodecConfig(const uint8_t* p_peer_codec_info,
+                                bool is_capability,
+                                uint8_t* p_result_codec_config,
+                                bool select_current_codec) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool A2dpCodecs::setCodecOtaConfig(
+    const uint8_t* p_ota_codec_config,
+    const tA2DP_ENCODER_INIT_PEER_PARAMS* p_peer_params,
+    uint8_t* p_result_codec_config, bool* p_restart_input,
+    bool* p_restart_output, bool* p_config_updated) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool A2dpCodecs::setCodecUserConfig(
+    const btav_a2dp_codec_config_t& codec_user_config,
+    const tA2DP_ENCODER_INIT_PEER_PARAMS* p_peer_params,
+    const uint8_t* p_peer_sink_capabilities, uint8_t* p_result_codec_config,
+    bool* p_restart_input, bool* p_restart_output, bool* p_config_updated) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool A2dpCodecs::setPeerSinkCodecCapabilities(
+    const uint8_t* p_peer_codec_capabilities) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool A2dpCodecs::setPeerSourceCodecCapabilities(
+    const uint8_t* p_peer_codec_capabilities) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool A2dpCodecs::setSinkCodecConfig(const uint8_t* p_peer_codec_info,
+                                    bool is_capability,
+                                    uint8_t* p_result_codec_config,
+                                    bool select_current_codec) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+btav_a2dp_codec_config_t A2dpCodecConfig::getCodecAudioConfig() {
+  mock_function_count_map[__func__]++;
+  btav_a2dp_codec_config_t config;
+  return config;
+}
+btav_a2dp_codec_config_t A2dpCodecConfig::getCodecCapability() {
+  mock_function_count_map[__func__]++;
+  btav_a2dp_codec_config_t config;
+  return config;
+}
+btav_a2dp_codec_config_t A2dpCodecConfig::getCodecConfig() {
+  mock_function_count_map[__func__]++;
+  btav_a2dp_codec_config_t config;
+  return config;
+}
+btav_a2dp_codec_config_t A2dpCodecConfig::getCodecLocalCapability() {
+  mock_function_count_map[__func__]++;
+  btav_a2dp_codec_config_t config;
+  return config;
+}
+btav_a2dp_codec_config_t A2dpCodecConfig::getCodecSelectableCapability() {
+  mock_function_count_map[__func__]++;
+  btav_a2dp_codec_config_t config;
+  return config;
+}
+btav_a2dp_codec_config_t A2dpCodecConfig::getCodecUserConfig() {
+  mock_function_count_map[__func__]++;
+  btav_a2dp_codec_config_t config;
+  return config;
+}
+btav_a2dp_codec_index_t A2DP_SinkCodecIndex(const uint8_t* p_codec_info) {
+  mock_function_count_map[__func__]++;
+  return BTAV_A2DP_CODEC_INDEX_MAX;
+}
+btav_a2dp_codec_index_t A2DP_SourceCodecIndex(const uint8_t* p_codec_info) {
+  mock_function_count_map[__func__]++;
+  return BTAV_A2DP_CODEC_INDEX_MAX;
+}
+const char* A2DP_CodecIndexStr(btav_a2dp_codec_index_t codec_index) {
+  mock_function_count_map[__func__]++;
+  return nullptr;
+}
+const char* A2DP_CodecName(const uint8_t* p_codec_info) {
+  mock_function_count_map[__func__]++;
+  return nullptr;
+}
+const tA2DP_DECODER_INTERFACE* A2DP_GetDecoderInterface(
+    const uint8_t* p_codec_info) {
+  mock_function_count_map[__func__]++;
+  return nullptr;
+}
+const tA2DP_ENCODER_INTERFACE* A2DP_GetEncoderInterface(
+    const uint8_t* p_codec_info) {
+  mock_function_count_map[__func__]++;
+  return nullptr;
+}
+int A2DP_GetSinkTrackChannelType(const uint8_t* p_codec_info) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+int A2DP_GetTrackBitsPerSample(const uint8_t* p_codec_info) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+int A2DP_GetTrackChannelCount(const uint8_t* p_codec_info) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+int A2DP_GetTrackSampleRate(const uint8_t* p_codec_info) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+int A2dpCodecConfig::getTrackBitRate() const {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+std::string A2DP_CodecInfoString(const uint8_t* p_codec_info) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+std::string A2dpCodecConfig::codecBitsPerSample2Str(
+    btav_a2dp_codec_bits_per_sample_t codec_bits_per_sample) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+std::string A2dpCodecConfig::codecChannelMode2Str(
+    btav_a2dp_codec_channel_mode_t codec_channel_mode) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+std::string A2dpCodecConfig::codecConfig2Str(
+    const btav_a2dp_codec_config_t& codec_config) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+std::string A2dpCodecConfig::codecSampleRate2Str(
+    btav_a2dp_codec_sample_rate_t codec_sample_rate) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+tA2DP_CODEC_TYPE A2DP_GetCodecType(const uint8_t* p_codec_info) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint8_t A2DP_GetMediaType(const uint8_t* p_codec_info) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint8_t A2dpCodecConfig::getAudioBitsPerSample() {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+void A2DP_InitDefaultCodec(uint8_t* p_codec_info) {
+  mock_function_count_map[__func__]++;
+}
+void A2dpCodecConfig::debug_codec_dump(int fd) {
+  mock_function_count_map[__func__]++;
+}
+void A2dpCodecConfig::setCodecPriority(
+    btav_a2dp_codec_priority_t codec_priority) {
+  mock_function_count_map[__func__]++;
+}
+void A2dpCodecConfig::setDefaultCodecPriority() {
+  mock_function_count_map[__func__]++;
+}
+void A2dpCodecs::debug_codec_dump(int fd) {
+  mock_function_count_map[__func__]++;
+}
diff --git a/system/test/mock/mock_activity_attribution.cc b/system/test/mock/mock_activity_attribution.cc
new file mode 100644
index 00000000000..e5cb2d976b8
--- /dev/null
+++ b/system/test/mock/mock_activity_attribution.cc
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "module.h"
+
+#include "btif/include/btif_activity_attribution.h"
+#include "main/shim/activity_attribution.h"
+#include "main/shim/shim.h"
+
+ActivityAttributionInterface*
+bluetooth::activity_attribution::get_activity_attribution_instance() {
+  return nullptr;
+}
+
+ActivityAttributionInterface*
+bluetooth::shim::get_activity_attribution_instance() {
+  return nullptr;
+}
+
+const bluetooth::ModuleFactory
+    bluetooth::activity_attribution::ActivityAttribution::Factory =
+        bluetooth::ModuleFactory([]() { return nullptr; });
diff --git a/system/test/mock/mock_android_hardware_audio.cc b/system/test/mock/mock_android_hardware_audio.cc
new file mode 100644
index 00000000000..01910deee9b
--- /dev/null
+++ b/system/test/mock/mock_android_hardware_audio.cc
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <cstdint>
+
+#include <android/hardware/bluetooth/a2dp/1.0/IBluetoothAudioHost.h>
+
+namespace android {
+namespace hardware {
+namespace bluetooth {
+
+namespace a2dp {
+namespace V1_0 {
+class BluetoothAudioHost : public IBluetoothAudioHost {
+  ::android::hardware::Return<void> setHALInstrumentation() { return Void(); }
+  ::android::hardware::Return<bool> linkToDeath(
+      android::sp<android::hardware::hidl_death_recipient> const&, uint64_t) {
+    return false;
+  }
+  ::android::hardware::Return<void> ping() { return Void(); }
+  ::android::hardware::Return<void> getDebugInfo(
+      std::__1::function<void(android::hidl::base::V1_0::DebugInfo const&)>) {
+    return Void();
+  }
+  ::android::hardware::Return<void> notifySyspropsChanged() { return Void(); }
+  ::android::hardware::Return<bool> unlinkToDeath(
+      android::sp<android::hardware::hidl_death_recipient> const&) {
+    return false;
+  }
+};
+
+}  // namespace V1_0
+}  // namespace a2dp
+
+namespace audio {
+
+namespace V2_0 {
+
+class AudioConfiguration {
+  AudioConfiguration() {}
+};
+
+}  // namespace V2_0
+
+}  // namespace audio
+}  // namespace bluetooth
+}  // namespace hardware
+}  // namespace android
diff --git a/system/test/mock/mock_bta_ag_api.cc b/system/test/mock/mock_bta_ag_api.cc
new file mode 100644
index 00000000000..ab2b866699f
--- /dev/null
+++ b/system/test/mock/mock_bta_ag_api.cc
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:14
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include <base/bind.h>
+#include <base/location.h>
+#include <cstdint>
+#include <cstring>
+#include <vector>
+#include "bta/ag/bta_ag_int.h"
+#include "bta/include/bta_ag_api.h"
+#include "stack/include/btu.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+tBTA_STATUS BTA_AgEnable(tBTA_AG_CBACK* p_cback) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+void BTA_AgAudioClose(uint16_t handle) { mock_function_count_map[__func__]++; }
+void BTA_AgAudioOpen(uint16_t handle) { mock_function_count_map[__func__]++; }
+void BTA_AgClose(uint16_t handle) { mock_function_count_map[__func__]++; }
+void BTA_AgDeregister(uint16_t handle) { mock_function_count_map[__func__]++; }
+void BTA_AgDisable() { mock_function_count_map[__func__]++; }
+void BTA_AgOpen(uint16_t handle, const RawAddress& bd_addr) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_AgRegister(tBTA_SERVICE_MASK services, tBTA_AG_FEAT features,
+                    const std::vector<std::string>& service_names,
+                    uint8_t app_id) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_AgResult(uint16_t handle, tBTA_AG_RES result,
+                  const tBTA_AG_RES_DATA& data) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_AgSetActiveDevice(const RawAddress& active_device_addr) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_AgSetCodec(uint16_t handle, tBTA_AG_PEER_CODEC codec) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_AgSetScoAllowed(bool value) { mock_function_count_map[__func__]++; }
diff --git a/system/test/mock/mock_bta_ar.cc b/system/test/mock/mock_bta_ar.cc
new file mode 100644
index 00000000000..1b9932c363d
--- /dev/null
+++ b/system/test/mock/mock_bta_ar.cc
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:8
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include <cstdint>
+#include "bta/ar/bta_ar_int.h"
+#include "bta/sys/bta_sys.h"
+#include "stack/include/avct_api.h"
+#include "stack/include/avrc_api.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+void bta_ar_avdt_conn(tBTA_SYS_ID sys_id, const RawAddress& bd_addr,
+                      uint8_t scb_index) {
+  mock_function_count_map[__func__]++;
+}
+void bta_ar_dereg_avct() { mock_function_count_map[__func__]++; }
+void bta_ar_dereg_avdt() { mock_function_count_map[__func__]++; }
+void bta_ar_dereg_avrc(uint16_t service_uuid) {
+  mock_function_count_map[__func__]++;
+}
+void bta_ar_init(void) { mock_function_count_map[__func__]++; }
+void bta_ar_reg_avct() { mock_function_count_map[__func__]++; }
+void bta_ar_reg_avdt(AvdtpRcb* p_reg, tAVDT_CTRL_CBACK* p_cback) {
+  mock_function_count_map[__func__]++;
+}
+void bta_ar_reg_avrc(uint16_t service_uuid, const char* service_name,
+                     const char* provider_name, uint16_t categories,
+                     bool browse_supported, uint16_t profile_version) {
+  mock_function_count_map[__func__]++;
+}
diff --git a/system/test/mock/mock_bta_av_api.cc b/system/test/mock/mock_bta_av_api.cc
new file mode 100644
index 00000000000..33f03b22184
--- /dev/null
+++ b/system/test/mock/mock_bta_av_api.cc
@@ -0,0 +1,105 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:23
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include "bt_target.h"
+#include "bta/av/bta_av_int.h"
+#include "osi/include/allocator.h"
+#include "osi/include/compat.h"
+#include "osi/include/log.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+void BTA_AvEnable(tBTA_AV_FEAT features, tBTA_AV_CBACK* p_cback) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_AvClose(tBTA_AV_HNDL handle) { mock_function_count_map[__func__]++; }
+void BTA_AvCloseRc(uint8_t rc_handle) { mock_function_count_map[__func__]++; }
+void BTA_AvDeregister(tBTA_AV_HNDL hndl) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_AvDisable(void) { mock_function_count_map[__func__]++; }
+void BTA_AvDisconnect(const RawAddress& bd_addr) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_AvMetaCmd(uint8_t rc_handle, uint8_t label, tBTA_AV_CMD cmd_code,
+                   BT_HDR* p_pkt) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_AvMetaRsp(uint8_t rc_handle, uint8_t label, tBTA_AV_CODE rsp_code,
+                   BT_HDR* p_pkt) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_AvOffloadStart(tBTA_AV_HNDL hndl) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_AvOffloadStartRsp(tBTA_AV_HNDL hndl, tBTA_AV_STATUS status) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_AvOpen(const RawAddress& bd_addr, tBTA_AV_HNDL handle, bool use_rc,
+                uint16_t uuid) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_AvOpenRc(tBTA_AV_HNDL handle) { mock_function_count_map[__func__]++; }
+void BTA_AvProtectReq(tBTA_AV_HNDL hndl, uint8_t* p_data, uint16_t len) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_AvProtectRsp(tBTA_AV_HNDL hndl, uint8_t error_code, uint8_t* p_data,
+                      uint16_t len) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_AvReconfig(tBTA_AV_HNDL hndl, bool suspend, uint8_t sep_info_idx,
+                    uint8_t* p_codec_info, uint8_t num_protect,
+                    const uint8_t* p_protect_info) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_AvRegister(tBTA_AV_CHNL chnl, const char* p_service_name,
+                    uint8_t app_id, tBTA_AV_SINK_DATA_CBACK* p_sink_data_cback,
+                    uint16_t service_uuid) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_AvRemoteCmd(uint8_t rc_handle, uint8_t label, tBTA_AV_RC rc_id,
+                     tBTA_AV_STATE key_state) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_AvRemoteVendorUniqueCmd(uint8_t rc_handle, uint8_t label,
+                                 tBTA_AV_STATE key_state, uint8_t* p_msg,
+                                 uint8_t buf_len) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_AvStart(tBTA_AV_HNDL handle) { mock_function_count_map[__func__]++; }
+void BTA_AvStop(tBTA_AV_HNDL handle, bool suspend) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_AvVendorCmd(uint8_t rc_handle, uint8_t label, tBTA_AV_CODE cmd_code,
+                     uint8_t* p_data, uint16_t len) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_AvVendorRsp(uint8_t rc_handle, uint8_t label, tBTA_AV_CODE rsp_code,
+                     uint8_t* p_data, uint16_t len, uint32_t company_id) {
+  mock_function_count_map[__func__]++;
+}
diff --git a/system/test/mock/mock_bta_av_ci.cc b/system/test/mock/mock_bta_av_ci.cc
new file mode 100644
index 00000000000..2c802247967
--- /dev/null
+++ b/system/test/mock/mock_bta_av_ci.cc
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:2
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include "bta/av/bta_av_int.h"
+#include "osi/include/allocator.h"
+#include "osi/include/log.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+void bta_av_ci_setconfig(tBTA_AV_HNDL bta_av_handle, uint8_t err_code,
+                         uint8_t category, uint8_t num_seid, uint8_t* p_seid,
+                         bool recfg_needed, uint8_t avdt_handle) {
+  mock_function_count_map[__func__]++;
+}
+void bta_av_ci_src_data_ready(tBTA_AV_CHNL chnl) {
+  mock_function_count_map[__func__]++;
+}
diff --git a/system/test/mock/mock_bta_av_main.cc b/system/test/mock/mock_bta_av_main.cc
new file mode 100644
index 00000000000..d23be35e5d3
--- /dev/null
+++ b/system/test/mock/mock_bta_av_main.cc
@@ -0,0 +1,102 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:21
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include <cstdint>
+#include "bt_target.h"
+#include "bta/av/bta_av_int.h"
+#include "bta/include/bta_ar_api.h"
+#include "bta/include/utl.h"
+#include "btif/avrcp/avrcp_service.h"
+#include "btif/include/btif_av_co.h"
+#include "btif/include/btif_config.h"
+#include "main/shim/dumpsys.h"
+#include "osi/include/log.h"
+#include "osi/include/osi.h"
+#include "osi/include/properties.h"
+#include "stack/include/acl_api.h"
+#include "types/hci_role.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+bool bta_av_chk_start(tBTA_AV_SCB* p_scb) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool bta_av_hdl_event(BT_HDR* p_msg) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool bta_av_link_role_ok(tBTA_AV_SCB* p_scb, uint8_t bits) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool bta_av_switch_if_needed(tBTA_AV_SCB* p_scb) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+const char* bta_av_evt_code(uint16_t evt_code) {
+  mock_function_count_map[__func__]++;
+  return nullptr;
+}
+int BTA_AvObtainPeerChannelIndex(const RawAddress& peer_address) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+tBTA_AV_SCB* bta_av_addr_to_scb(const RawAddress& bd_addr) {
+  mock_function_count_map[__func__]++;
+  return nullptr;
+}
+tBTA_AV_SCB* bta_av_hndl_to_scb(uint16_t handle) {
+  mock_function_count_map[__func__]++;
+  return nullptr;
+}
+void bta_av_api_deregister(tBTA_AV_DATA* p_data) {
+  mock_function_count_map[__func__]++;
+}
+void bta_av_conn_cback(UNUSED_ATTR uint8_t handle, const RawAddress& bd_addr,
+                       uint8_t event, tAVDT_CTRL* p_data, uint8_t scb_index) {
+  mock_function_count_map[__func__]++;
+}
+void bta_av_dup_audio_buf(tBTA_AV_SCB* p_scb, BT_HDR* p_buf) {
+  mock_function_count_map[__func__]++;
+}
+void bta_av_free_scb(tBTA_AV_SCB* p_scb) {
+  mock_function_count_map[__func__]++;
+}
+void bta_av_restore_switch(void) { mock_function_count_map[__func__]++; }
+void bta_av_sm_execute(tBTA_AV_CB* p_cb, uint16_t event, tBTA_AV_DATA* p_data) {
+  mock_function_count_map[__func__]++;
+}
+void bta_debug_av_dump(int fd) { mock_function_count_map[__func__]++; }
+void tBTA_AV_SCB::OnConnected(const RawAddress& peer_address) {
+  mock_function_count_map[__func__]++;
+}
+void tBTA_AV_SCB::OnDisconnected() { mock_function_count_map[__func__]++; }
+void tBTA_AV_SCB::SetAvdtpVersion(uint16_t avdtp_version) {
+  mock_function_count_map[__func__]++;
+}
diff --git a/system/test/mock/mock_bta_dm_act.cc b/system/test/mock/mock_bta_dm_act.cc
new file mode 100644
index 00000000000..7b7d7d4c18b
--- /dev/null
+++ b/system/test/mock/mock_bta_dm_act.cc
@@ -0,0 +1,159 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:57
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include <cstdint>
+#include "bta/dm/bta_dm_int.h"
+#include "bta/gatt/bta_gattc_int.h"
+#include "bta/include/bta_dm_ci.h"
+#include "btif/include/btif_dm.h"
+#include "btif/include/btif_storage.h"
+#include "btif/include/stack_manager.h"
+#include "device/include/controller.h"
+#include "device/include/interop.h"
+#include "main/shim/acl_api.h"
+#include "main/shim/btm_api.h"
+#include "main/shim/dumpsys.h"
+#include "main/shim/shim.h"
+#include "osi/include/log.h"
+#include "osi/include/osi.h"
+#include "stack/btm/btm_sec.h"
+#include "stack/btm/neighbor_inquiry.h"
+#include "stack/gatt/connection_manager.h"
+#include "stack/include/acl_api.h"
+#include "stack/include/bt_types.h"
+#include "stack/include/btm_client_interface.h"
+#include "stack/include/btu.h"
+#include "types/raw_address.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+void bta_dm_enable(tBTA_DM_SEC_CBACK* p_sec_cback) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_dm_acl_down(const RawAddress bd_addr, tBT_TRANSPORT transport) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_dm_acl_up(const RawAddress bd_addr, tBT_TRANSPORT transport) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_dm_notify_remote_features_complete(const RawAddress bd_addr) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_dm_on_hw_off() { mock_function_count_map[__func__]++; }
+void BTA_dm_on_hw_on() { mock_function_count_map[__func__]++; }
+void BTA_dm_report_role_change(const RawAddress bd_addr, tHCI_ROLE new_role,
+                               tHCI_STATUS hci_status) {
+  mock_function_count_map[__func__]++;
+}
+void bta_dm_acl_up(const RawAddress& bd_addr, tBT_TRANSPORT transport) {
+  mock_function_count_map[__func__]++;
+}
+void bta_dm_add_device(std::unique_ptr<tBTA_DM_API_ADD_DEVICE> msg) {
+  mock_function_count_map[__func__]++;
+}
+void bta_dm_bond(const RawAddress& bd_addr, tBLE_ADDR_TYPE addr_type,
+                 tBT_TRANSPORT transport, int device_type) {
+  mock_function_count_map[__func__]++;
+}
+void bta_dm_bond_cancel(const RawAddress& bd_addr) {
+  mock_function_count_map[__func__]++;
+}
+void bta_dm_ci_rmt_oob_act(std::unique_ptr<tBTA_DM_CI_RMT_OOB> msg) {
+  mock_function_count_map[__func__]++;
+}
+void bta_dm_close_acl(const RawAddress& bd_addr, bool remove_dev,
+                      tBT_TRANSPORT transport) {
+  mock_function_count_map[__func__]++;
+}
+void bta_dm_confirm(const RawAddress& bd_addr, bool accept) {
+  mock_function_count_map[__func__]++;
+}
+void bta_dm_deinit_cb(void) { mock_function_count_map[__func__]++; }
+void bta_dm_disable() { mock_function_count_map[__func__]++; }
+void bta_dm_disc_result(tBTA_DM_MSG* p_data) {
+  mock_function_count_map[__func__]++;
+}
+void bta_dm_disc_rmt_name(tBTA_DM_MSG* p_data) {
+  mock_function_count_map[__func__]++;
+}
+void bta_dm_discover(tBTA_DM_MSG* p_data) {
+  mock_function_count_map[__func__]++;
+}
+void bta_dm_free_sdp_db() { mock_function_count_map[__func__]++; }
+void bta_dm_init_cb(void) { mock_function_count_map[__func__]++; }
+void bta_dm_inq_cmpl(uint8_t num) { mock_function_count_map[__func__]++; }
+void bta_dm_pin_reply(std::unique_ptr<tBTA_DM_API_PIN_REPLY> msg) {
+  mock_function_count_map[__func__]++;
+}
+void bta_dm_process_remove_device(const RawAddress& bd_addr) {
+  mock_function_count_map[__func__]++;
+}
+void bta_dm_queue_disc(tBTA_DM_MSG* p_data) {
+  mock_function_count_map[__func__]++;
+}
+void bta_dm_queue_search(tBTA_DM_MSG* p_data) {
+  mock_function_count_map[__func__]++;
+}
+void bta_dm_remove_device(const RawAddress& bd_addr) {
+  mock_function_count_map[__func__]++;
+}
+void bta_dm_rm_cback(tBTA_SYS_CONN_STATUS status, uint8_t id, uint8_t app_id,
+                     const RawAddress& peer_addr) {
+  mock_function_count_map[__func__]++;
+}
+void bta_dm_rmt_name(tBTA_DM_MSG* p_data) {
+  mock_function_count_map[__func__]++;
+}
+void bta_dm_sdp_result(tBTA_DM_MSG* p_data) {
+  mock_function_count_map[__func__]++;
+}
+void bta_dm_search_cancel() { mock_function_count_map[__func__]++; }
+void bta_dm_search_cancel_cmpl() { mock_function_count_map[__func__]++; }
+void bta_dm_search_cancel_notify() { mock_function_count_map[__func__]++; }
+void bta_dm_search_clear_queue() { mock_function_count_map[__func__]++; }
+void bta_dm_search_cmpl() { mock_function_count_map[__func__]++; }
+void bta_dm_search_result(tBTA_DM_MSG* p_data) {
+  mock_function_count_map[__func__]++;
+}
+void bta_dm_search_start(tBTA_DM_MSG* p_data) {
+  mock_function_count_map[__func__]++;
+}
+void bta_dm_set_dev_name(const std::vector<uint8_t>& name) {
+  mock_function_count_map[__func__]++;
+}
+bool BTA_DmSetVisibility(bt_scan_mode_t mode) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+void handle_remote_features_complete(const RawAddress& bd_addr) {
+  mock_function_count_map[__func__]++;
+}
+bool bta_dm_check_if_only_hd_connected(const RawAddress& peer_addr) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
diff --git a/system/test/mock/mock_bta_dm_api.cc b/system/test/mock/mock_bta_dm_api.cc
new file mode 100644
index 00000000000..2f2bf17c813
--- /dev/null
+++ b/system/test/mock/mock_bta_dm_api.cc
@@ -0,0 +1,145 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:33
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include <base/bind.h>
+#include <vector>
+#include "bt_target.h"
+#include "bta/dm/bta_dm_int.h"
+#include "osi/include/allocator.h"
+#include "stack/btm/btm_sec.h"
+#include "stack/include/btm_api.h"
+#include "stack/include/btu.h"
+#include "types/bluetooth/uuid.h"
+#include "types/raw_address.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+void BTA_dm_init() { mock_function_count_map[__func__]++; }
+bool BTA_DmGetConnectionState(const RawAddress& bd_addr) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+tBTA_STATUS BTA_DmRemoveDevice(const RawAddress& bd_addr) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+tBTA_STATUS BTA_DmSetLocalDiRecord(tBTA_DI_RECORD* p_device_info,
+                                   uint32_t* p_handle) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+void BTA_AddEirUuid(uint16_t uuid16) { mock_function_count_map[__func__]++; }
+void BTA_DmAddBleDevice(const RawAddress& bd_addr, tBLE_ADDR_TYPE addr_type,
+                        tBT_DEVICE_TYPE dev_type) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_DmAddBleKey(const RawAddress& bd_addr, tBTA_LE_KEY_VALUE* p_le_key,
+                     tBTM_LE_KEY_TYPE key_type) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_DmAddDevice(const RawAddress& bd_addr, DEV_CLASS dev_class,
+                     const LinkKey& link_key, uint8_t key_type,
+                     uint8_t pin_length) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_DmBleConfigLocalPrivacy(bool privacy_enable) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_DmBleConfirmReply(const RawAddress& bd_addr, bool accept) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_DmBleGetEnergyInfo(tBTA_BLE_ENERGY_INFO_CBACK* p_cmpl_cback) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_DmBlePasskeyReply(const RawAddress& bd_addr, bool accept,
+                           uint32_t passkey) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_DmBleRequestMaxTxDataLength(const RawAddress& remote_device) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_DmBleSecurityGrant(const RawAddress& bd_addr,
+                            tBTA_DM_BLE_SEC_GRANT res) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_DmBleUpdateConnectionParams(const RawAddress& bd_addr,
+                                     uint16_t min_int, uint16_t max_int,
+                                     uint16_t latency, uint16_t timeout,
+                                     uint16_t min_ce_len, uint16_t max_ce_len) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_DmBond(const RawAddress& bd_addr, tBLE_ADDR_TYPE addr_type,
+                tBT_TRANSPORT transport, int device_type) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_DmBondCancel(const RawAddress& bd_addr) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_DmCloseACL(const RawAddress& bd_addr, bool remove_dev,
+                    tBT_TRANSPORT transport) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_DmConfirm(const RawAddress& bd_addr, bool accept) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_DmDiscover(const RawAddress& bd_addr, tBTA_DM_SEARCH_CBACK* p_cback,
+                    tBT_TRANSPORT transport) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_DmLocalOob(void) { mock_function_count_map[__func__]++; }
+void BTA_DmPinReply(const RawAddress& bd_addr, bool accept, uint8_t pin_len,
+                    uint8_t* p_pin) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_DmSearch(tBTA_DM_SEARCH_CBACK* p_cback) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_DmSearchCancel(void) { mock_function_count_map[__func__]++; }
+void BTA_DmSetBlePrefConnParams(const RawAddress& bd_addr,
+                                uint16_t min_conn_int, uint16_t max_conn_int,
+                                uint16_t peripheral_latency,
+                                uint16_t supervision_tout) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_DmSetDeviceName(char* p_name) { mock_function_count_map[__func__]++; }
+void BTA_DmSetEncryption(const RawAddress& bd_addr, tBT_TRANSPORT transport,
+                         tBTA_DM_ENCRYPT_CBACK* p_callback,
+                         tBTM_BLE_SEC_ACT sec_act) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_EnableTestMode(void) { mock_function_count_map[__func__]++; }
+void BTA_GetEirService(uint8_t* p_eir, size_t eir_len,
+                       tBTA_SERVICE_MASK* p_services) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_RemoveEirUuid(uint16_t uuid16) { mock_function_count_map[__func__]++; }
+void BTA_DmBleObserve(bool start, uint8_t duration,
+                      tBTA_DM_SEARCH_CBACK* p_results_cb) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_VendorInit(void) { mock_function_count_map[__func__]++; }
diff --git a/system/test/mock/mock_bta_gattc_api.cc b/system/test/mock/mock_bta_gattc_api.cc
new file mode 100644
index 00000000000..767e60531e4
--- /dev/null
+++ b/system/test/mock/mock_bta_gattc_api.cc
@@ -0,0 +1,167 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:30
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include <base/bind.h>
+#include <ios>
+#include <list>
+#include <memory>
+#include <vector>
+#include "bt_target.h"
+#include "bta/gatt/bta_gattc_int.h"
+#include "device/include/controller.h"
+#include "stack/include/btu.h"
+#include "types/bluetooth/uuid.h"
+#include "types/bt_transport.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+void BTA_GATTC_Disable(void) { mock_function_count_map[__func__]++; }
+const gatt::Characteristic* BTA_GATTC_GetCharacteristic(uint16_t conn_id,
+                                                        uint16_t handle) {
+  mock_function_count_map[__func__]++;
+  return nullptr;
+}
+const gatt::Characteristic* BTA_GATTC_GetOwningCharacteristic(uint16_t conn_id,
+                                                              uint16_t handle) {
+  mock_function_count_map[__func__]++;
+  return nullptr;
+}
+const gatt::Descriptor* BTA_GATTC_GetDescriptor(uint16_t conn_id,
+                                                uint16_t handle) {
+  mock_function_count_map[__func__]++;
+  return nullptr;
+}
+const gatt::Service* BTA_GATTC_GetOwningService(uint16_t conn_id,
+                                                uint16_t handle) {
+  mock_function_count_map[__func__]++;
+  return nullptr;
+}
+const std::list<gatt::Service>* BTA_GATTC_GetServices(uint16_t conn_id) {
+  mock_function_count_map[__func__]++;
+  return nullptr;
+}
+tGATT_STATUS BTA_GATTC_DeregisterForNotifications(tGATT_IF client_if,
+                                                  const RawAddress& bda,
+                                                  uint16_t handle) {
+  mock_function_count_map[__func__]++;
+  return GATT_SUCCESS;
+}
+tGATT_STATUS BTA_GATTC_RegisterForNotifications(tGATT_IF client_if,
+                                                const RawAddress& bda,
+                                                uint16_t handle) {
+  mock_function_count_map[__func__]++;
+  return GATT_SUCCESS;
+}
+void BTA_GATTC_AppDeregister(tGATT_IF client_if) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_GATTC_AppRegister(tBTA_GATTC_CBACK* p_client_cb,
+                           BtaAppRegisterCallback cb, bool eatt_support) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_GATTC_CancelOpen(tGATT_IF client_if, const RawAddress& remote_bda,
+                          bool is_direct) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_GATTC_Close(uint16_t conn_id) { mock_function_count_map[__func__]++; }
+void BTA_GATTC_ConfigureMTU(uint16_t conn_id, uint16_t mtu) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_GATTC_ConfigureMTU(uint16_t conn_id, uint16_t mtu,
+                            GATT_CONFIGURE_MTU_OP_CB callback, void* cb_data) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_GATTC_DiscoverServiceByUuid(uint16_t conn_id,
+                                     const bluetooth::Uuid& srvc_uuid) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_GATTC_ExecuteWrite(uint16_t conn_id, bool is_execute) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_GATTC_GetGattDb(uint16_t conn_id, uint16_t start_handle,
+                         uint16_t end_handle, btgatt_db_element_t** db,
+                         int* count) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_GATTC_Open(tGATT_IF client_if, const RawAddress& remote_bda,
+                    bool is_direct, bool opportunistic) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_GATTC_Open(tGATT_IF client_if, const RawAddress& remote_bda,
+                    bool is_direct, tBT_TRANSPORT transport, bool opportunistic,
+                    uint8_t initiating_phys) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_GATTC_PrepareWrite(uint16_t conn_id, uint16_t handle, uint16_t offset,
+                            std::vector<uint8_t> value, tGATT_AUTH_REQ auth_req,
+                            GATT_WRITE_OP_CB callback, void* cb_data) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_GATTC_ReadCharDescr(uint16_t conn_id, uint16_t handle,
+                             tGATT_AUTH_REQ auth_req, GATT_READ_OP_CB callback,
+                             void* cb_data) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_GATTC_ReadCharacteristic(uint16_t conn_id, uint16_t handle,
+                                  tGATT_AUTH_REQ auth_req,
+                                  GATT_READ_OP_CB callback, void* cb_data) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_GATTC_ReadMultiple(uint16_t conn_id, tBTA_GATTC_MULTI* p_read_multi,
+                            tGATT_AUTH_REQ auth_req) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_GATTC_ReadUsingCharUuid(uint16_t conn_id, const bluetooth::Uuid& uuid,
+                                 uint16_t s_handle, uint16_t e_handle,
+                                 tGATT_AUTH_REQ auth_req,
+                                 GATT_READ_OP_CB callback, void* cb_data) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_GATTC_Refresh(const RawAddress& remote_bda) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_GATTC_SendIndConfirm(uint16_t conn_id, uint16_t cid) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_GATTC_ServiceSearchRequest(uint16_t conn_id,
+                                    const bluetooth::Uuid* p_srvc_uuid) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_GATTC_WriteCharDescr(uint16_t conn_id, uint16_t handle,
+                              std::vector<uint8_t> value,
+                              tGATT_AUTH_REQ auth_req,
+                              GATT_WRITE_OP_CB callback, void* cb_data) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_GATTC_WriteCharValue(uint16_t conn_id, uint16_t handle,
+                              tGATT_WRITE_TYPE write_type,
+                              std::vector<uint8_t> value,
+                              tGATT_AUTH_REQ auth_req,
+                              GATT_WRITE_OP_CB callback, void* cb_data) {
+  mock_function_count_map[__func__]++;
+}
diff --git a/system/test/mock/mock_bta_gatts_api.cc b/system/test/mock/mock_bta_gatts_api.cc
new file mode 100644
index 00000000000..10329133d8e
--- /dev/null
+++ b/system/test/mock/mock_bta_gatts_api.cc
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:13
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include <base/bind.h>
+#include <base/location.h>
+#include <cstdint>
+#include <memory>
+#include <vector>
+#include "bt_target.h"
+#include "bta/gatt/bta_gatts_int.h"
+#include "osi/include/allocator.h"
+#include "stack/include/btu.h"
+#include "types/bluetooth/uuid.h"
+#include "types/bt_transport.h"
+#include "types/raw_address.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+void BTA_GATTS_Disable(void) { mock_function_count_map[__func__]++; }
+void BTA_GATTS_AppDeregister(tGATT_IF server_if) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_GATTS_AppRegister(const bluetooth::Uuid& app_uuid,
+                           tBTA_GATTS_CBACK* p_cback, bool eatt_support) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_GATTS_CancelOpen(tGATT_IF server_if, const RawAddress& remote_bda,
+                          bool is_direct) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_GATTS_Close(uint16_t conn_id) { mock_function_count_map[__func__]++; }
+void BTA_GATTS_AddService(tGATT_IF server_if,
+                          std::vector<btgatt_db_element_t> service,
+                          BTA_GATTS_AddServiceCb cb) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_GATTS_DeleteService(uint16_t service_id) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_GATTS_HandleValueIndication(uint16_t conn_id, uint16_t attr_id,
+                                     std::vector<uint8_t> value,
+                                     bool need_confirm) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_GATTS_Open(tGATT_IF server_if, const RawAddress& remote_bda,
+                    bool is_direct, tBT_TRANSPORT transport) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_GATTS_SendRsp(uint16_t conn_id, uint32_t trans_id, tGATT_STATUS status,
+                       tGATTS_RSP* p_msg) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_GATTS_StopService(uint16_t service_id) {
+  mock_function_count_map[__func__]++;
+}
+void bta_gatts_add_service_impl(tGATT_IF server_if,
+                                std::vector<btgatt_db_element_t> service,
+                                BTA_GATTS_AddServiceCb cb) {
+  mock_function_count_map[__func__]++;
+}
diff --git a/system/test/mock/mock_bta_hd_api.cc b/system/test/mock/mock_bta_hd_api.cc
new file mode 100644
index 00000000000..a8022450c20
--- /dev/null
+++ b/system/test/mock/mock_bta_hd_api.cc
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:12
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include "bt_target.h"
+#include "bta/hd/bta_hd_int.h"
+#include "osi/include/allocator.h"
+#include "osi/include/compat.h"
+#include "osi/include/log.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+void BTA_HdEnable(tBTA_HD_CBACK* p_cback) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_HdAddDevice(const RawAddress& addr) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_HdConnect(const RawAddress& addr) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_HdDisable(void) { mock_function_count_map[__func__]++; }
+void BTA_HdDisconnect(void) { mock_function_count_map[__func__]++; }
+void BTA_HdRegisterApp(tBTA_HD_APP_INFO* p_app_info, tBTA_HD_QOS_INFO* p_in_qos,
+                       tBTA_HD_QOS_INFO* p_out_qos) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_HdRemoveDevice(const RawAddress& addr) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_HdReportError(uint8_t error) { mock_function_count_map[__func__]++; }
+void BTA_HdSendReport(tBTA_HD_REPORT* p_report) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_HdUnregisterApp(void) { mock_function_count_map[__func__]++; }
+void BTA_HdVirtualCableUnplug(void) { mock_function_count_map[__func__]++; }
diff --git a/system/test/mock/mock_bta_hearing_aid.cc b/system/test/mock/mock_bta_hearing_aid.cc
new file mode 100644
index 00000000000..dea63d9ddd2
--- /dev/null
+++ b/system/test/mock/mock_bta_hearing_aid.cc
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:8
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include <base/bind.h>
+#include <base/callback.h>
+#include <base/strings/string_number_conversions.h>
+#include <cstdint>
+#include <vector>
+#include "bta/include/bta_gatt_api.h"
+#include "bta/include/bta_gatt_queue.h"
+#include "bta/include/bta_hearing_aid_api.h"
+#include "bta_hearing_aid_api.h"
+#include "device/include/controller.h"
+#include "embdrv/g722/g722_enc_dec.h"
+#include "osi/include/log.h"
+#include "osi/include/properties.h"
+#include "stack/btm/btm_sec.h"
+#include "stack/include/acl_api.h"
+#include "stack/include/acl_api_types.h"
+#include "stack/include/gap_api.h"
+#include "stack/include/l2c_api.h"
+#include "types/bluetooth/uuid.h"
+#include "types/bt_transport.h"
+#include "types/raw_address.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+int HearingAid::GetDeviceCount() {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+void HearingAid::AddFromStorage(const HearingDevice& dev_info,
+                                uint16_t is_acceptlisted) {
+  mock_function_count_map[__func__]++;
+}
+void HearingAid::DebugDump(int fd) { mock_function_count_map[__func__]++; }
+HearingAid* HearingAid::Get() {
+  mock_function_count_map[__func__]++;
+  return nullptr;
+}
+bool HearingAid::IsHearingAidRunning() {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+void HearingAid::CleanUp() { mock_function_count_map[__func__]++; }
+void HearingAid::Initialize(
+    bluetooth::hearing_aid::HearingAidCallbacks* callbacks,
+    base::Closure initCb) {
+  mock_function_count_map[__func__]++;
+}
diff --git a/system/test/mock/mock_bta_hf_client_api.cc b/system/test/mock/mock_bta_hf_client_api.cc
new file mode 100644
index 00000000000..cd036c9da1a
--- /dev/null
+++ b/system/test/mock/mock_bta_hf_client_api.cc
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:8
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include <cstdint>
+#include "bt_trace.h"
+#include "bta/hf_client/bta_hf_client_int.h"
+#include "bta/include/bta_hf_client_api.h"
+#include "bta/sys/bta_sys.h"
+#include "osi/include/allocator.h"
+#include "osi/include/compat.h"
+#include "stack/include/bt_types.h"
+#include "types/raw_address.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+tBTA_STATUS BTA_HfClientEnable(tBTA_HF_CLIENT_CBACK* p_cback,
+                               tBTA_HF_CLIENT_FEAT features,
+                               const char* p_service_name) {
+  mock_function_count_map[__func__]++;
+  return BTA_SUCCESS;
+}
+void BTA_HfClientAudioClose(uint16_t handle) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_HfClientAudioOpen(uint16_t handle) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_HfClientClose(uint16_t handle) { mock_function_count_map[__func__]++; }
+void BTA_HfClientDisable(void) { mock_function_count_map[__func__]++; }
+void BTA_HfClientDumpStatistics(int fd) { mock_function_count_map[__func__]++; }
+void BTA_HfClientOpen(const RawAddress& bd_addr, uint16_t* p_handle) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_HfClientSendAT(uint16_t handle, tBTA_HF_CLIENT_AT_CMD_TYPE at,
+                        uint32_t val1, uint32_t val2, const char* str) {
+  mock_function_count_map[__func__]++;
+}
diff --git a/system/test/mock/mock_bta_hh_api.cc b/system/test/mock/mock_bta_hh_api.cc
new file mode 100644
index 00000000000..2547b07f5fd
--- /dev/null
+++ b/system/test/mock/mock_bta_hh_api.cc
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:16
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include <cstdint>
+#include "bt_target.h"
+#include "bta/hh/bta_hh_int.h"
+#include "bta/sys/bta_sys.h"
+#include "osi/include/allocator.h"
+#include "osi/include/osi.h"
+#include "types/raw_address.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+void BTA_HhEnable(tBTA_HH_CBACK* p_cback) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_HhAddDev(const RawAddress& bda, tBTA_HH_ATTR_MASK attr_mask,
+                  uint8_t sub_class, uint8_t app_id,
+                  tBTA_HH_DEV_DSCP_INFO dscp_info) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_HhClose(uint8_t dev_handle) { mock_function_count_map[__func__]++; }
+void BTA_HhDisable(void) { mock_function_count_map[__func__]++; }
+void BTA_HhGetDscpInfo(uint8_t dev_handle) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_HhGetIdle(uint8_t dev_handle) { mock_function_count_map[__func__]++; }
+void BTA_HhGetProtoMode(uint8_t dev_handle) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_HhGetReport(uint8_t dev_handle, tBTA_HH_RPT_TYPE r_type,
+                     uint8_t rpt_id, uint16_t buf_size) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_HhOpen(const RawAddress& dev_bda) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_HhRemoveDev(uint8_t dev_handle) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_HhSendCtrl(uint8_t dev_handle, tBTA_HH_TRANS_CTRL_TYPE c_type) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_HhSendData(uint8_t dev_handle, UNUSED_ATTR const RawAddress& dev_bda,
+                    BT_HDR* p_data) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_HhSetIdle(uint8_t dev_handle, uint16_t idle_rate) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_HhSetProtoMode(uint8_t dev_handle, tBTA_HH_PROTO_MODE p_type) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_HhSetReport(uint8_t dev_handle, tBTA_HH_RPT_TYPE r_type,
+                     BT_HDR* p_data) {
+  mock_function_count_map[__func__]++;
+}
diff --git a/system/test/mock/mock_bta_jv_api.cc b/system/test/mock/mock_bta_jv_api.cc
new file mode 100644
index 00000000000..b0f7f339cac
--- /dev/null
+++ b/system/test/mock/mock_bta_jv_api.cc
@@ -0,0 +1,146 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:22
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include <base/bind.h>
+#include <base/location.h>
+#include <base/logging.h>
+#include <cstdint>
+#include <memory>
+#include "bt_target.h"
+#include "bta/jv/bta_jv_int.h"
+#include "stack/include/btu.h"
+#include "stack/include/gap_api.h"
+#include "types/bluetooth/uuid.h"
+#include "types/raw_address.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+tBTA_JV_STATUS BTA_JvCreateRecordByUser(uint32_t rfcomm_slot_id) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+tBTA_JV_STATUS BTA_JvDeleteRecord(uint32_t handle) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+tBTA_JV_STATUS BTA_JvEnable(tBTA_JV_DM_CBACK* p_cback) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+tBTA_JV_STATUS BTA_JvFreeChannel(uint16_t channel, int conn_type) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+tBTA_JV_STATUS BTA_JvL2capClose(uint32_t handle) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+tBTA_JV_STATUS BTA_JvL2capRead(uint32_t handle, uint32_t req_id,
+                               uint8_t* p_data, uint16_t len) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+tBTA_JV_STATUS BTA_JvL2capReady(uint32_t handle, uint32_t* p_data_size) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+tBTA_JV_STATUS BTA_JvL2capStopServer(uint16_t local_psm,
+                                     uint32_t l2cap_socket_id) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+tBTA_JV_STATUS BTA_JvL2capWrite(uint32_t handle, uint32_t req_id, BT_HDR* msg,
+                                uint32_t user_id) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+tBTA_JV_STATUS BTA_JvRfcommClose(uint32_t handle, uint32_t rfcomm_slot_id) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+tBTA_JV_STATUS BTA_JvRfcommConnect(tBTA_SEC sec_mask, tBTA_JV_ROLE role,
+                                   uint8_t remote_scn,
+                                   const RawAddress& peer_bd_addr,
+                                   tBTA_JV_RFCOMM_CBACK* p_cback,
+                                   uint32_t rfcomm_slot_id) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+tBTA_JV_STATUS BTA_JvRfcommStartServer(tBTA_SEC sec_mask, tBTA_JV_ROLE role,
+                                       uint8_t local_scn, uint8_t max_session,
+                                       tBTA_JV_RFCOMM_CBACK* p_cback,
+                                       uint32_t rfcomm_slot_id) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+tBTA_JV_STATUS BTA_JvRfcommStopServer(uint32_t handle,
+                                      uint32_t rfcomm_slot_id) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+tBTA_JV_STATUS BTA_JvRfcommWrite(uint32_t handle, uint32_t req_id) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+tBTA_JV_STATUS BTA_JvSetPmProfile(uint32_t handle, tBTA_JV_PM_ID app_id,
+                                  tBTA_JV_CONN_STATE init_st) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+tBTA_JV_STATUS BTA_JvStartDiscovery(const RawAddress& bd_addr,
+                                    uint16_t num_uuid,
+                                    const bluetooth::Uuid* p_uuid_list,
+                                    uint32_t rfcomm_slot_id) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint16_t BTA_JvRfcommGetPortHdl(uint32_t handle) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+void BTA_JvDisable(void) { mock_function_count_map[__func__]++; }
+void BTA_JvGetChannelId(int conn_type, uint32_t id, int32_t channel) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_JvL2capConnect(int conn_type, tBTA_SEC sec_mask, tBTA_JV_ROLE role,
+                        std::unique_ptr<tL2CAP_ERTM_INFO> ertm_info,
+                        uint16_t remote_psm, uint16_t rx_mtu,
+                        std::unique_ptr<tL2CAP_CFG_INFO> cfg,
+                        const RawAddress& peer_bd_addr,
+                        tBTA_JV_L2CAP_CBACK* p_cback,
+                        uint32_t l2cap_socket_id) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_JvL2capStartServer(int conn_type, tBTA_SEC sec_mask, tBTA_JV_ROLE role,
+                            std::unique_ptr<tL2CAP_ERTM_INFO> ertm_info,
+                            uint16_t local_psm, uint16_t rx_mtu,
+                            std::unique_ptr<tL2CAP_CFG_INFO> cfg,
+                            tBTA_JV_L2CAP_CBACK* p_cback,
+                            uint32_t l2cap_socket_id) {
+  mock_function_count_map[__func__]++;
+}
diff --git a/system/test/mock/mock_bta_pan_api.cc b/system/test/mock/mock_bta_pan_api.cc
new file mode 100644
index 00000000000..adc1462c3da
--- /dev/null
+++ b/system/test/mock/mock_bta_pan_api.cc
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:10
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include <cstdint>
+#include "bt_target.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+#include "bta/pan/bta_pan_int.h"
+
+void BTA_PanClose(uint16_t handle) { mock_function_count_map[__func__]++; }
+void BTA_PanDisable(void) { mock_function_count_map[__func__]++; }
+void BTA_PanEnable(tBTA_PAN_CBACK p_cback) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_PanOpen(const RawAddress& bd_addr, tBTA_PAN_ROLE local_role,
+                 tBTA_PAN_ROLE peer_role) {
+  mock_function_count_map[__func__]++;
+}
+void BTA_PanSetRole(tBTA_PAN_ROLE role, tBTA_PAN_ROLE_INFO* p_user_info,
+                    tBTA_PAN_ROLE_INFO* p_nap_info) {
+  mock_function_count_map[__func__]++;
+}
diff --git a/system/test/mock/mock_bta_pan_ci.cc b/system/test/mock/mock_bta_pan_ci.cc
new file mode 100644
index 00000000000..ffd2dc56edb
--- /dev/null
+++ b/system/test/mock/mock_bta_pan_ci.cc
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:8
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include "bt_target.h"
+#include "bta/pan/bta_pan_int.h"
+#include "osi/include/allocator.h"
+#include "types/raw_address.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+BT_HDR* bta_pan_ci_readbuf(uint16_t handle, RawAddress& src, RawAddress& dst,
+                           uint16_t* p_protocol, bool* p_ext, bool* p_forward) {
+  mock_function_count_map[__func__]++;
+  return nullptr;
+}
+void bta_pan_ci_rx_ready(uint16_t handle) {
+  mock_function_count_map[__func__]++;
+}
+void bta_pan_ci_rx_write(uint16_t handle, const RawAddress& dst,
+                         const RawAddress& src, uint16_t protocol,
+                         uint8_t* p_data, uint16_t len, bool ext) {
+  mock_function_count_map[__func__]++;
+}
+void bta_pan_ci_rx_writebuf(uint16_t handle, const RawAddress& dst,
+                            const RawAddress& src, uint16_t protocol,
+                            BT_HDR* p_buf, bool ext) {
+  mock_function_count_map[__func__]++;
+}
+void bta_pan_ci_set_mfilters(uint16_t handle, uint16_t num_mcast_filters,
+                             uint8_t* p_start_array, uint8_t* p_end_array) {
+  mock_function_count_map[__func__]++;
+}
+void bta_pan_ci_set_pfilters(uint16_t handle, uint16_t num_filters,
+                             uint16_t* p_start_array, uint16_t* p_end_array) {
+  mock_function_count_map[__func__]++;
+}
+void bta_pan_ci_tx_flow(uint16_t handle, bool enable) {
+  mock_function_count_map[__func__]++;
+}
+void bta_pan_ci_tx_ready(uint16_t handle) {
+  mock_function_count_map[__func__]++;
+}
diff --git a/system/test/mock/mock_bta_sdp_api.cc b/system/test/mock/mock_bta_sdp_api.cc
new file mode 100644
index 00000000000..87244d31da5
--- /dev/null
+++ b/system/test/mock/mock_bta_sdp_api.cc
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:4
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include <base/bind.h>
+#include <base/location.h>
+#include "bt_target.h"
+#include "bta/include/bta_sdp_api.h"
+#include "bta/sdp/bta_sdp_int.h"
+#include "stack/include/btu.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+tBTA_SDP_STATUS BTA_SdpCreateRecordByUser(void* user_data) {
+  mock_function_count_map[__func__]++;
+  return BTA_SDP_SUCCESS;
+}
+tBTA_SDP_STATUS BTA_SdpEnable(tBTA_SDP_DM_CBACK* p_cback) {
+  mock_function_count_map[__func__]++;
+  return BTA_SDP_SUCCESS;
+}
+tBTA_SDP_STATUS BTA_SdpRemoveRecordByUser(void* user_data) {
+  mock_function_count_map[__func__]++;
+  return BTA_SDP_SUCCESS;
+}
+tBTA_SDP_STATUS BTA_SdpSearch(const RawAddress& bd_addr,
+                              const bluetooth::Uuid& uuid) {
+  mock_function_count_map[__func__]++;
+  return BTA_SDP_SUCCESS;
+}
diff --git a/system/test/mock/mock_bta_sys_conn.cc b/system/test/mock/mock_bta_sys_conn.cc
new file mode 100644
index 00000000000..fa334a8bcae
--- /dev/null
+++ b/system/test/mock/mock_bta_sys_conn.cc
@@ -0,0 +1,122 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:19
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include <cstdint>
+#include "bt_target.h"
+#include "bta/sys/bta_sys.h"
+#include "bta/sys/bta_sys_int.h"
+#include "main/shim/dumpsys.h"
+#include "osi/include/log.h"
+#include "osi/include/osi.h"
+#include "stack/include/btm_api.h"
+#include "types/hci_role.h"
+#include "types/raw_address.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+void bta_sys_app_close(uint8_t id, uint8_t app_id,
+                       const RawAddress& peer_addr) {
+  mock_function_count_map[__func__]++;
+}
+void bta_sys_app_open(uint8_t id, uint8_t app_id, const RawAddress& peer_addr) {
+  mock_function_count_map[__func__]++;
+}
+void bta_sys_busy(uint8_t id, uint8_t app_id, const RawAddress& peer_addr) {
+  mock_function_count_map[__func__]++;
+}
+void bta_sys_chg_ssr_config(uint8_t id, uint8_t app_id, uint16_t max_latency,
+                            uint16_t min_tout) {
+  mock_function_count_map[__func__]++;
+}
+void bta_sys_collision_register(uint8_t bta_id, tBTA_SYS_CONN_CBACK* p_cback) {
+  mock_function_count_map[__func__]++;
+}
+void bta_sys_conn_close(uint8_t id, uint8_t app_id,
+                        const RawAddress& peer_addr) {
+  mock_function_count_map[__func__]++;
+}
+void bta_sys_conn_open(uint8_t id, uint8_t app_id,
+                       const RawAddress& peer_addr) {
+  mock_function_count_map[__func__]++;
+}
+void bta_sys_idle(uint8_t id, uint8_t app_id, const RawAddress& peer_addr) {
+  mock_function_count_map[__func__]++;
+}
+void bta_sys_notify_collision(const RawAddress& peer_addr) {
+  mock_function_count_map[__func__]++;
+}
+void bta_sys_notify_role_chg(const RawAddress& peer_addr, tHCI_ROLE new_role,
+                             tHCI_STATUS hci_status) {
+  mock_function_count_map[__func__]++;
+}
+void bta_sys_pm_register(tBTA_SYS_CONN_CBACK* p_cback) {
+  mock_function_count_map[__func__]++;
+}
+void bta_sys_rm_register(tBTA_SYS_CONN_CBACK* p_cback) {
+  mock_function_count_map[__func__]++;
+}
+void bta_sys_role_chg_register(tBTA_SYS_CONN_CBACK* p_cback) {
+  mock_function_count_map[__func__]++;
+}
+void bta_sys_sco_close(uint8_t id, uint8_t app_id,
+                       const RawAddress& peer_addr) {
+  mock_function_count_map[__func__]++;
+}
+void bta_sys_sco_open(uint8_t id, uint8_t app_id, const RawAddress& peer_addr) {
+  mock_function_count_map[__func__]++;
+}
+void bta_sys_sco_register(tBTA_SYS_CONN_CBACK* p_cback) {
+  mock_function_count_map[__func__]++;
+}
+void bta_sys_sco_unuse(uint8_t id, uint8_t app_id,
+                       const RawAddress& peer_addr) {
+  mock_function_count_map[__func__]++;
+}
+void bta_sys_sco_use(UNUSED_ATTR uint8_t id, uint8_t app_id,
+                     const RawAddress& peer_addr) {
+  mock_function_count_map[__func__]++;
+}
+void bta_sys_ssr_cfg_register(tBTA_SYS_SSR_CFG_CBACK* p_cback) {
+  mock_function_count_map[__func__]++;
+}
+void bta_sys_eir_register(tBTA_SYS_EIR_CBACK* p_cback) {
+  mock_function_count_map[__func__]++;
+}
+void bta_sys_cust_eir_register(tBTA_SYS_CUST_EIR_CBACK* p_cback) {
+  mock_function_count_map[__func__]++;
+}
+void bta_sys_add_uuid(uint16_t uuid16) { mock_function_count_map[__func__]++; }
+void bta_sys_remove_uuid(uint16_t uuid16) {
+  mock_function_count_map[__func__]++;
+}
+void bta_sys_add_cust_uuid(const tBTA_CUSTOM_UUID& curr) {
+  mock_function_count_map[__func__]++;
+}
+void bta_sys_remove_cust_uuid(const tBTA_CUSTOM_UUID& curr) {
+  mock_function_count_map[__func__]++;
+}
diff --git a/system/test/mock/mock_bta_sys_main.cc b/system/test/mock/mock_bta_sys_main.cc
new file mode 100644
index 00000000000..98713490b96
--- /dev/null
+++ b/system/test/mock/mock_bta_sys_main.cc
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:10
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include <base/bind.h>
+#include <cstring>
+#include "bt_target.h"
+#include "bta/sys/bta_sys.h"
+#include "bta/sys/bta_sys_int.h"
+#include "include/hardware/bluetooth.h"
+#include "osi/include/alarm.h"
+#include "osi/include/allocator.h"
+#include "osi/include/log.h"
+#include "stack/include/bt_types.h"
+#include "stack/include/btu.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+bool bta_sys_is_register(uint8_t id) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+void BTA_sys_signal_hw_error() { mock_function_count_map[__func__]++; }
+void bta_set_forward_hw_failures(bool value) {
+  mock_function_count_map[__func__]++;
+}
+void bta_sys_deregister(uint8_t id) { mock_function_count_map[__func__]++; }
+void bta_sys_disable() { mock_function_count_map[__func__]++; }
+void bta_sys_init(void) { mock_function_count_map[__func__]++; }
+void bta_sys_register(uint8_t id, const tBTA_SYS_REG* p_reg) {
+  mock_function_count_map[__func__]++;
+}
+void bta_sys_sendmsg(void* p_msg) { mock_function_count_map[__func__]++; }
+void bta_sys_sendmsg_delayed(void* p_msg, const base::TimeDelta& delay) {
+  mock_function_count_map[__func__]++;
+}
+void bta_sys_start_timer(alarm_t* alarm, uint64_t interval_ms, uint16_t event,
+                         uint16_t layer_specific) {
+  mock_function_count_map[__func__]++;
+}
diff --git a/system/test/mock/mock_bta_sys_utl.cc b/system/test/mock/mock_bta_sys_utl.cc
new file mode 100644
index 00000000000..ee6dac205f7
--- /dev/null
+++ b/system/test/mock/mock_bta_sys_utl.cc
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:7
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include <cstdint>
+#include "bt_target.h"
+#include "bta/include/utl.h"
+#include "stack/include/btm_api.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+bool utl_isdialchar(const char d) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool utl_isdialstr(const char* p_s) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool utl_isintstr(const char* p_s) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool utl_set_device_class(tBTA_UTL_COD* p_cod, uint8_t cmd) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+int utl_strucmp(const char* p_s, const char* p_t) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+int16_t utl_str2int(const char* p_s) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint8_t utl_itoa(uint16_t i, char* p_s) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
diff --git a/system/test/mock/mock_bta_vc.cc b/system/test/mock/mock_bta_vc.cc
new file mode 100644
index 00000000000..6ac9f573e18
--- /dev/null
+++ b/system/test/mock/mock_bta_vc.cc
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:7
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include <base/bind.h>
+#include <base/bind_helpers.h>
+#include <base/logging.h>
+#include <base/strings/string_number_conversions.h>
+#include <hardware/bt_vc.h>
+#include <string>
+#include <vector>
+#include "bta/vc/devices.h"
+#include "bta_gatt_api.h"
+#include "bta_gatt_queue.h"
+#include "bta_vc_api.h"
+#include "btif_storage.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+void VolumeControl::AddFromStorage(const RawAddress& address,
+                                   bool auto_connect) {
+  mock_function_count_map[__func__]++;
+}
+void VolumeControl::CleanUp() { mock_function_count_map[__func__]++; }
+void VolumeControl::DebugDump(int fd) { mock_function_count_map[__func__]++; }
+VolumeControl* VolumeControl::Get(void) {
+  mock_function_count_map[__func__]++;
+  return nullptr;
+}
+bool VolumeControl::IsVolumeControlRunning() {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+void VolumeControl::Initialize(
+    bluetooth::vc::VolumeControlCallbacks* callbacks) {
+  mock_function_count_map[__func__]++;
+}
diff --git a/system/test/mock/mock_bta_vc_device.cc b/system/test/mock/mock_bta_vc_device.cc
new file mode 100644
index 00000000000..d4102463d3f
--- /dev/null
+++ b/system/test/mock/mock_bta_vc_device.cc
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:12
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include <map>
+#include <vector>
+#include "bta/vc/devices.h"
+#include "bta_gatt_api.h"
+#include "bta_gatt_queue.h"
+#include "gatt_api.h"
+#include "stack/btm/btm_sec.h"
+
+using namespace bluetooth::vc::internal;
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+bool VolumeControlDevice::EnableEncryption(tBTM_SEC_CALLBACK* callback) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool VolumeControlDevice::EnqueueInitialRequests(
+    tGATT_IF gatt_if, GATT_READ_OP_CB chrc_read_cb,
+    GATT_WRITE_OP_CB cccd_write_cb) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool VolumeControlDevice::IsEncryptionEnabled() {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool VolumeControlDevice::UpdateHandles(void) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool VolumeControlDevice::VerifyReady(uint16_t handle) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool VolumeControlDevice::set_volume_control_service_handles(
+    const gatt::Service& service) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool VolumeControlDevice::subscribe_for_notifications(tGATT_IF gatt_if,
+                                                      uint16_t handle,
+                                                      uint16_t ccc_handle,
+                                                      GATT_WRITE_OP_CB cb) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+uint16_t VolumeControlDevice::find_ccc_handle(uint16_t chrc_handle) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+void VolumeControlDevice::ControlPointOperation(uint8_t opcode,
+                                                const std::vector<uint8_t>* arg,
+                                                GATT_WRITE_OP_CB cb,
+                                                void* cb_data) {
+  mock_function_count_map[__func__]++;
+}
+void VolumeControlDevice::Disconnect(tGATT_IF gatt_if) {
+  mock_function_count_map[__func__]++;
+}
+void VolumeControlDevice::EnqueueRemainingRequests(
+    tGATT_IF gatt_if, GATT_READ_OP_CB chrc_read_cb,
+    GATT_WRITE_OP_CB cccd_write_cb) {
+  mock_function_count_map[__func__]++;
+}
+void VolumeControlDevice::ResetHandles(void) {
+  mock_function_count_map[__func__]++;
+}
diff --git a/system/test/mock/mock_btcore_module.cc b/system/test/mock/mock_btcore_module.cc
new file mode 100644
index 00000000000..c83cb9deb61
--- /dev/null
+++ b/system/test/mock/mock_btcore_module.cc
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:8
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include <base/logging.h>
+#include <dlfcn.h>
+#include <string.h>
+#include <mutex>
+#include <unordered_map>
+#include "btcore/include/module.h"
+#include "common/message_loop_thread.h"
+#include "osi/include/allocator.h"
+#include "osi/include/log.h"
+#include "osi/include/osi.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+bool module_init(const module_t* module) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool module_start_up(const module_t* module) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+const module_t* get_module(const char* name) {
+  mock_function_count_map[__func__]++;
+  return nullptr;
+}
+void module_management_start(void) { mock_function_count_map[__func__]++; }
+void module_clean_up(const module_t* module) {
+  mock_function_count_map[__func__]++;
+}
+void module_management_stop(void) { mock_function_count_map[__func__]++; }
+void module_shut_down(const module_t* module) {
+  mock_function_count_map[__func__]++;
+}
diff --git a/system/test/mock/mock_common_address_obfuscator.cc b/system/test/mock/mock_common_address_obfuscator.cc
new file mode 100644
index 00000000000..77ff20e0f54
--- /dev/null
+++ b/system/test/mock/mock_common_address_obfuscator.cc
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:4
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include <base/logging.h>
+#include <openssl/hmac.h>
+#include <algorithm>
+#include "bt_trace.h"
+#include "common/address_obfuscator.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+namespace bluetooth {
+namespace common {
+
+bool AddressObfuscator::IsInitialized() {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool AddressObfuscator::IsSaltValid(const Octet32& salt_256bit) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+std::string AddressObfuscator::Obfuscate(const RawAddress& address) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+void AddressObfuscator::Initialize(const Octet32& salt_256bit) {
+  mock_function_count_map[__func__]++;
+  salt_256bit_ = salt_256bit;
+}
+
+}  // namespace common
+}  // namespace bluetooth
diff --git a/system/test/mock/mock_common_message_loop_thread.cc b/system/test/mock/mock_common_message_loop_thread.cc
new file mode 100644
index 00000000000..7562a1d2c4e
--- /dev/null
+++ b/system/test/mock/mock_common_message_loop_thread.cc
@@ -0,0 +1,250 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "common/message_loop_thread.h"
+
+#include <sys/syscall.h>
+#include <unistd.h>
+#include <thread>
+
+#include <base/strings/stringprintf.h>
+
+#include "gd/common/init_flags.h"
+#include "osi/include/log.h"
+
+namespace bluetooth {
+
+namespace common {
+
+static constexpr int kRealTimeFifoSchedulingPriority = 1;
+
+MessageLoopThread::MessageLoopThread(const std::string& thread_name)
+    : MessageLoopThread(thread_name, false) {}
+
+MessageLoopThread::MessageLoopThread(const std::string& thread_name,
+                                     bool is_main)
+    : thread_name_(thread_name),
+      message_loop_(nullptr),
+      run_loop_(nullptr),
+      thread_(nullptr),
+      thread_id_(-1),
+      linux_tid_(-1),
+      weak_ptr_factory_(this),
+      shutting_down_(false),
+      is_main_(is_main),
+      rust_thread_(nullptr) {}
+
+MessageLoopThread::~MessageLoopThread() { ShutDown(); }
+
+void MessageLoopThread::StartUp() {
+  if (is_main_ && init_flags::gd_rust_is_enabled()) {
+    rust_thread_ = new ::rust::Box<shim::rust::MessageLoopThread>(
+        shim::rust::main_message_loop_thread_create());
+    auto rust_id =
+        bluetooth::shim::rust::main_message_loop_thread_start(**rust_thread_);
+    thread_id_ = rust_id;
+    linux_tid_ = rust_id;
+    return;
+  }
+
+  std::promise<void> start_up_promise;
+  std::future<void> start_up_future = start_up_promise.get_future();
+  {
+    std::lock_guard<std::recursive_mutex> api_lock(api_mutex_);
+    if (thread_ != nullptr) {
+      LOG(WARNING) << __func__ << ": thread " << *this << " is already started";
+
+      return;
+    }
+    thread_ = new std::thread(&MessageLoopThread::RunThread, this,
+                              std::move(start_up_promise));
+  }
+  start_up_future.wait();
+}
+
+bool MessageLoopThread::DoInThread(const base::Location& from_here,
+                                   base::OnceClosure task) {
+  return DoInThreadDelayed(from_here, std::move(task), base::TimeDelta());
+}
+
+bool MessageLoopThread::DoInThreadDelayed(const base::Location& from_here,
+                                          base::OnceClosure task,
+                                          const base::TimeDelta& delay) {
+  std::lock_guard<std::recursive_mutex> api_lock(api_mutex_);
+  if (is_main_ && init_flags::gd_rust_is_enabled()) {
+    if (rust_thread_ == nullptr) {
+      LOG(ERROR) << __func__ << ": rust thread is null for thread " << *this
+                 << ", from " << from_here.ToString();
+      return false;
+    }
+
+    shim::rust::main_message_loop_thread_do_delayed(
+        **rust_thread_,
+        std::make_unique<shim::rust::OnceClosure>(std::move(task)),
+        delay.InMilliseconds());
+    return true;
+  }
+
+  if (message_loop_ == nullptr) {
+    LOG(ERROR) << __func__ << ": message loop is null for thread " << *this
+               << ", from " << from_here.ToString();
+    return false;
+  }
+  if (!message_loop_->task_runner()->PostDelayedTask(from_here, std::move(task),
+                                                     delay)) {
+    LOG(ERROR) << __func__
+               << ": failed to post task to message loop for thread " << *this
+               << ", from " << from_here.ToString();
+    return false;
+  }
+  return true;
+}
+
+void MessageLoopThread::ShutDown() {
+  {
+    if (is_main_ && init_flags::gd_rust_is_enabled()) {
+      delete rust_thread_;
+      thread_id_ = -1;
+      linux_tid_ = -1;
+      return;
+    }
+
+    std::lock_guard<std::recursive_mutex> api_lock(api_mutex_);
+    if (thread_ == nullptr) {
+      LOG(INFO) << __func__ << ": thread " << *this << " is already stopped";
+      return;
+    }
+    if (message_loop_ == nullptr) {
+      LOG(INFO) << __func__ << ": message_loop_ is null. Already stopping";
+      return;
+    }
+    if (shutting_down_) {
+      LOG(INFO) << __func__ << ": waiting for thread to join";
+      return;
+    }
+    shutting_down_ = true;
+    CHECK_NE(thread_id_, base::PlatformThread::CurrentId())
+        << __func__ << " should not be called on the thread itself. "
+        << "Otherwise, deadlock may happen.";
+    if (!message_loop_->task_runner()->PostTask(
+            FROM_HERE, run_loop_->QuitWhenIdleClosure())) {
+      LOG(FATAL) << __func__
+                 << ": failed to post task to message loop for thread "
+                 << *this;
+    }
+  }
+  thread_->join();
+  {
+    std::lock_guard<std::recursive_mutex> api_lock(api_mutex_);
+    delete thread_;
+    thread_ = nullptr;
+    shutting_down_ = false;
+  }
+}
+
+base::PlatformThreadId MessageLoopThread::GetThreadId() const {
+  std::lock_guard<std::recursive_mutex> api_lock(api_mutex_);
+  return thread_id_;
+}
+
+std::string MessageLoopThread::GetName() const { return thread_name_; }
+
+std::string MessageLoopThread::ToString() const {
+  std::lock_guard<std::recursive_mutex> api_lock(api_mutex_);
+  return base::StringPrintf("%s(%d)", thread_name_.c_str(), thread_id_);
+}
+
+bool MessageLoopThread::IsRunning() const {
+  std::lock_guard<std::recursive_mutex> api_lock(api_mutex_);
+  return thread_id_ != -1;
+}
+
+// Non API method, should not be protected by API mutex
+void MessageLoopThread::RunThread(MessageLoopThread* thread,
+                                  std::promise<void> start_up_promise) {
+  thread->Run(std::move(start_up_promise));
+}
+
+btbase::AbstractMessageLoop* MessageLoopThread::message_loop() const {
+  ASSERT_LOG(!is_main_,
+             "you are not allowed to get the main thread's message loop");
+
+  std::lock_guard<std::recursive_mutex> api_lock(api_mutex_);
+  return message_loop_;
+}
+
+bool MessageLoopThread::EnableRealTimeScheduling() {
+  std::lock_guard<std::recursive_mutex> api_lock(api_mutex_);
+
+  if (!IsRunning()) {
+    LOG(ERROR) << __func__ << ": thread " << *this << " is not running";
+    return false;
+  }
+
+  struct sched_param rt_params = {.sched_priority =
+                                      kRealTimeFifoSchedulingPriority};
+  int rc = sched_setscheduler(linux_tid_, SCHED_FIFO, &rt_params);
+  if (rc != 0) {
+    LOG(ERROR) << __func__ << ": unable to set SCHED_FIFO priority "
+               << kRealTimeFifoSchedulingPriority << " for linux_tid "
+               << std::to_string(linux_tid_) << ", thread " << *this
+               << ", error: " << strerror(errno);
+    return false;
+  }
+  return true;
+}
+
+base::WeakPtr<MessageLoopThread> MessageLoopThread::GetWeakPtr() {
+  std::lock_guard<std::recursive_mutex> api_lock(api_mutex_);
+  return weak_ptr_factory_.GetWeakPtr();
+}
+
+void MessageLoopThread::Run(std::promise<void> start_up_promise) {
+  {
+    std::lock_guard<std::recursive_mutex> api_lock(api_mutex_);
+    if (is_main_ && init_flags::gd_rust_is_enabled()) {
+      return;
+    }
+
+    LOG(INFO) << __func__ << ": message loop starting for thread "
+              << thread_name_;
+    base::PlatformThread::SetName(thread_name_);
+    message_loop_ = new btbase::AbstractMessageLoop();
+    run_loop_ = new base::RunLoop();
+    thread_id_ = base::PlatformThread::CurrentId();
+    linux_tid_ = static_cast<pid_t>(syscall(SYS_gettid));
+    start_up_promise.set_value();
+  }
+
+  // Blocking until ShutDown() is called
+  run_loop_->Run();
+
+  {
+    std::lock_guard<std::recursive_mutex> api_lock(api_mutex_);
+    thread_id_ = -1;
+    linux_tid_ = -1;
+    delete message_loop_;
+    message_loop_ = nullptr;
+    delete run_loop_;
+    run_loop_ = nullptr;
+    LOG(INFO) << __func__ << ": message loop finished for thread "
+              << thread_name_;
+  }
+}
+
+}  // namespace common
+
+}  // namespace bluetooth
diff --git a/system/test/mock/mock_common_metric_id_allocator.cc b/system/test/mock/mock_common_metric_id_allocator.cc
new file mode 100644
index 00000000000..c374db1f46c
--- /dev/null
+++ b/system/test/mock/mock_common_metric_id_allocator.cc
@@ -0,0 +1,104 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:11
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include <base/logging.h>
+#include <functional>
+#include <mutex>
+#include <thread>
+#include "common/metric_id_allocator.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+namespace {
+
+const size_t paired_device_cache_capacity{10};
+const std::string paired_device_cache_log_tag("Mock");
+}  // namespace
+
+namespace bluetooth {
+namespace common {
+
+const int MetricIdAllocator::kMinId = 0;
+
+MetricIdAllocator::MetricIdAllocator()
+    : paired_device_cache_(paired_device_cache_capacity,
+                           paired_device_cache_log_tag),
+      temporary_device_cache_(paired_device_cache_capacity,
+                              paired_device_cache_log_tag) {
+  next_id_ = 0;
+  initialized_ = true;
+}
+
+class MockMetricIdAllocator : public MetricIdAllocator {
+ public:
+  MockMetricIdAllocator() {}
+};
+
+MockMetricIdAllocator metric_id_allocator;
+
+MetricIdAllocator& MetricIdAllocator::GetInstance() {
+  mock_function_count_map[__func__]++;
+  return metric_id_allocator;
+}
+MetricIdAllocator::~MetricIdAllocator() {}
+bool MetricIdAllocator::Close() {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool MetricIdAllocator::Init(
+    const std::unordered_map<RawAddress, int>& paired_device_map,
+    Callback save_id_callback, Callback forget_device_callback) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool MetricIdAllocator::IsEmpty() const {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool MetricIdAllocator::IsValidId(const int id) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool MetricIdAllocator::SaveDevice(const RawAddress& mac_address) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+int MetricIdAllocator::AllocateId(const RawAddress& mac_address) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+void MetricIdAllocator::ForgetDevice(const RawAddress& mac_address) {
+  mock_function_count_map[__func__]++;
+}
+void MetricIdAllocator::ForgetDevicePostprocess(const RawAddress& mac_address,
+                                                const int id) {
+  mock_function_count_map[__func__]++;
+}
+
+}  // namespace common
+}  // namespace bluetooth
diff --git a/system/test/mock/mock_common_metrics.cc b/system/test/mock/mock_common_metrics.cc
new file mode 100644
index 00000000000..01612fb8ba5
--- /dev/null
+++ b/system/test/mock/mock_common_metrics.cc
@@ -0,0 +1,207 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:36
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include "common/metrics.h"
+
+#if 0
+#include <base/base64.h>
+#include <base/logging.h>
+#include <include/hardware/bt_av.h>
+#include <statslog.h>
+#include <unistd.h>
+#include <algorithm>
+#include <array>
+#include <cerrno>
+#include <chrono>
+#include <cstdint>
+#include <cstring>
+#include <memory>
+#include <mutex>
+#include "address_obfuscator.h"
+#include "bluetooth/metrics/bluetooth.pb.h"
+#include "leaky_bonded_queue.h"
+#include "metric_id_allocator.h"
+#include "osi/include/osi.h"
+#include "stack/include/btm_api_types.h"
+#include "time_util.h"
+#endif
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+namespace bluetooth {
+namespace common {
+
+void A2dpSessionMetrics::Update(const A2dpSessionMetrics& metrics) {
+  mock_function_count_map[__func__]++;
+}
+
+struct BluetoothMetricsLogger::impl {
+  int mock{123};
+};
+
+BluetoothMetricsLogger::BluetoothMetricsLogger() {}
+void BluetoothMetricsLogger::Build() { mock_function_count_map[__func__]++; }
+void BluetoothMetricsLogger::CutoffSession() {
+  mock_function_count_map[__func__]++;
+}
+void BluetoothMetricsLogger::LogA2dpSession(
+    const A2dpSessionMetrics& a2dp_session_metrics) {
+  mock_function_count_map[__func__]++;
+}
+void BluetoothMetricsLogger::LogBluetoothSessionDeviceInfo(
+    uint32_t device_class, device_type_t device_type) {
+  mock_function_count_map[__func__]++;
+}
+void BluetoothMetricsLogger::LogBluetoothSessionEnd(
+    disconnect_reason_t disconnect_reason, uint64_t timestamp_ms) {
+  mock_function_count_map[__func__]++;
+}
+void BluetoothMetricsLogger::LogBluetoothSessionStart(
+    connection_tech_t connection_tech_type, uint64_t timestamp_ms) {
+  mock_function_count_map[__func__]++;
+}
+void BluetoothMetricsLogger::LogHeadsetProfileRfcConnection(
+    tBTA_SERVICE_ID service_id) {
+  mock_function_count_map[__func__]++;
+}
+void BluetoothMetricsLogger::LogPairEvent(uint32_t disconnect_reason,
+                                          uint64_t timestamp_ms,
+                                          uint32_t device_class,
+                                          device_type_t device_type) {
+  mock_function_count_map[__func__]++;
+}
+void BluetoothMetricsLogger::LogScanEvent(bool start,
+                                          const std::string& initator,
+                                          scan_tech_t type, uint32_t results,
+                                          uint64_t timestamp_ms) {
+  mock_function_count_map[__func__]++;
+}
+void BluetoothMetricsLogger::LogWakeEvent(wake_event_type_t type,
+                                          const std::string& requestor,
+                                          const std::string& name,
+                                          uint64_t timestamp_ms) {
+  mock_function_count_map[__func__]++;
+}
+void BluetoothMetricsLogger::Reset() { mock_function_count_map[__func__]++; }
+void BluetoothMetricsLogger::ResetLog() { mock_function_count_map[__func__]++; }
+void BluetoothMetricsLogger::ResetSession() {
+  mock_function_count_map[__func__]++;
+}
+void BluetoothMetricsLogger::WriteBase64(int fd) {
+  mock_function_count_map[__func__]++;
+}
+void BluetoothMetricsLogger::WriteBase64String(std::string* serialized) {
+  mock_function_count_map[__func__]++;
+}
+void BluetoothMetricsLogger::WriteString(std::string* serialized) {
+  mock_function_count_map[__func__]++;
+}
+void LogA2dpAudioOverrunEvent(const RawAddress& address,
+                              uint64_t encoding_interval_millis,
+                              int num_dropped_buffers,
+                              int num_dropped_encoded_frames,
+                              int num_dropped_encoded_bytes) {
+  mock_function_count_map[__func__]++;
+}
+void LogA2dpAudioUnderrunEvent(const RawAddress& address,
+                               uint64_t encoding_interval_millis,
+                               int num_missing_pcm_bytes) {
+  mock_function_count_map[__func__]++;
+}
+void LogA2dpPlaybackEvent(const RawAddress& address, int playback_state,
+                          int audio_coding_mode) {
+  mock_function_count_map[__func__]++;
+}
+void LogBluetoothHalCrashReason(const RawAddress& address, uint32_t error_code,
+                                uint32_t vendor_error_code) {
+  mock_function_count_map[__func__]++;
+}
+void LogClassicPairingEvent(const RawAddress& address, uint16_t handle,
+                            uint32_t hci_cmd, uint16_t hci_event,
+                            uint16_t cmd_status, uint16_t reason_code,
+                            int64_t event_value) {
+  mock_function_count_map[__func__]++;
+}
+void LogHciTimeoutEvent(uint32_t hci_cmd) {
+  mock_function_count_map[__func__]++;
+}
+void LogLinkLayerConnectionEvent(const RawAddress* address,
+                                 uint32_t connection_handle,
+                                 android::bluetooth::DirectionEnum direction,
+                                 uint16_t link_type, uint32_t hci_cmd,
+                                 uint16_t hci_event, uint16_t hci_ble_event,
+                                 uint16_t cmd_status, uint16_t reason_code) {
+  mock_function_count_map[__func__]++;
+}
+void LogManufacturerInfo(const RawAddress& address,
+                         android::bluetooth::DeviceInfoSrcEnum source_type,
+                         const std::string& source_name,
+                         const std::string& manufacturer,
+                         const std::string& model,
+                         const std::string& hardware_version,
+                         const std::string& software_version) {
+  mock_function_count_map[__func__]++;
+}
+void LogReadFailedContactCounterResult(const RawAddress& address,
+                                       uint16_t handle, uint32_t cmd_status,
+                                       int32_t failed_contact_counter) {
+  mock_function_count_map[__func__]++;
+}
+void LogReadRssiResult(const RawAddress& address, uint16_t handle,
+                       uint32_t cmd_status, int8_t rssi) {
+  mock_function_count_map[__func__]++;
+}
+void LogReadTxPowerLevelResult(const RawAddress& address, uint16_t handle,
+                               uint32_t cmd_status,
+                               int32_t transmit_power_level) {
+  mock_function_count_map[__func__]++;
+}
+void LogRemoteVersionInfo(uint16_t handle, uint8_t status, uint8_t version,
+                          uint16_t manufacturer_name, uint16_t subversion) {
+  mock_function_count_map[__func__]++;
+}
+void LogSdpAttribute(const RawAddress& address, uint16_t protocol_uuid,
+                     uint16_t attribute_id, size_t attribute_size,
+                     const char* attribute_value) {
+  mock_function_count_map[__func__]++;
+}
+void LogSmpPairingEvent(const RawAddress& address, uint8_t smp_cmd,
+                        android::bluetooth::DirectionEnum direction,
+                        uint8_t smp_fail_reason) {
+  mock_function_count_map[__func__]++;
+}
+void LogSocketConnectionState(
+    const RawAddress& address, int port, int type,
+    android::bluetooth::SocketConnectionstateEnum connection_state,
+    int64_t tx_bytes, int64_t rx_bytes, int uid, int server_port,
+    android::bluetooth::SocketRoleEnum socket_role) {
+  mock_function_count_map[__func__]++;
+}
+
+}  // namespace common
+}  // namespace bluetooth
diff --git a/system/test/mock/mock_common_repeating_timer.cc b/system/test/mock/mock_common_repeating_timer.cc
new file mode 100644
index 00000000000..f92e31626d0
--- /dev/null
+++ b/system/test/mock/mock_common_repeating_timer.cc
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:8
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include "common/message_loop_thread.h"
+#include "common/repeating_timer.h"
+#include "common/time_util.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+using namespace bluetooth::common;
+
+RepeatingTimer::~RepeatingTimer() { mock_function_count_map[__func__]++; }
+bool RepeatingTimer::IsScheduled() const {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool RepeatingTimer::SchedulePeriodic(
+    const base::WeakPtr<MessageLoopThread>& thread,
+    const base::Location& from_here, base::Closure task,
+    base::TimeDelta period) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+void RepeatingTimer::Cancel() {
+  mock_function_count_map[__func__]++;
+  expected_time_next_task_us_ = 0;
+}
+void RepeatingTimer::CancelAndWait() { mock_function_count_map[__func__]++; }
+void RepeatingTimer::CancelClosure(std::promise<void> promise) {
+  mock_function_count_map[__func__]++;
+}
+void RepeatingTimer::CancelHelper(std::promise<void> promise) {
+  mock_function_count_map[__func__]++;
+}
+void RepeatingTimer::RunTask() { mock_function_count_map[__func__]++; }
diff --git a/system/test/mock/mock_common_stop_watch_legacy.cc b/system/test/mock/mock_common_stop_watch_legacy.cc
new file mode 100644
index 00000000000..c3d7b4afde5
--- /dev/null
+++ b/system/test/mock/mock_common_stop_watch_legacy.cc
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:4
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include <base/logging.h>
+#include <iomanip>
+#include <sstream>
+#include <utility>
+#include "common/stop_watch_legacy.h"
+#include "osi/include/log.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+namespace bluetooth {
+namespace common {
+
+StopWatchLegacy::StopWatchLegacy(std::string text)
+    : text_(std::move(text)),
+      start_time_(std::chrono::high_resolution_clock::now()) {
+  mock_function_count_map[__func__]++;
+}
+StopWatchLegacy::~StopWatchLegacy() { mock_function_count_map[__func__]++; }
+void StopWatchLegacy::DumpStopWatchLog() {
+  mock_function_count_map[__func__]++;
+}
+void StopWatchLegacy::RecordLog(std::string log) {
+  mock_function_count_map[__func__]++;
+}
+
+}  // namespace common
+}  // namespace bluetooth
diff --git a/system/test/mock/mock_common_time_util.cc b/system/test/mock/mock_common_time_util.cc
new file mode 100644
index 00000000000..e29368e8bb0
--- /dev/null
+++ b/system/test/mock/mock_common_time_util.cc
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:3
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include <sys/time.h>
+#include <time.h>
+#include "common/time_util.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+namespace bluetooth {
+namespace common {
+
+uint64_t time_get_os_boottime_ms() {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint64_t time_get_os_boottime_us() {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint64_t time_gettimeofday_us() {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+
+}  // namespace common
+}  // namespace bluetooth
diff --git a/system/test/mock/mock_frameworks_libaudio.cc b/system/test/mock/mock_frameworks_libaudio.cc
new file mode 100644
index 00000000000..e4f55d41925
--- /dev/null
+++ b/system/test/mock/mock_frameworks_libaudio.cc
@@ -0,0 +1,305 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:60
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#undef __INTRODUCED_IN
+#define __INTRODUCED_IN(x)
+
+#include <aaudio/AAudio.h>
+#include <aaudio/AAudioTesting.h>
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+aaudio_allowed_capture_policy_t AAudioStream_getAllowedCapturePolicy(
+    AAudioStream* stream) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+aaudio_content_type_t AAudioStream_getContentType(AAudioStream* stream) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+aaudio_direction_t AAudioStream_getDirection(AAudioStream* stream) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+aaudio_format_t AAudioStream_getFormat(AAudioStream* stream) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+aaudio_input_preset_t AAudioStream_getInputPreset(AAudioStream* stream) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+aaudio_performance_mode_t AAudioStream_getPerformanceMode(
+    AAudioStream* stream) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+aaudio_policy_t AAudio_getMMapPolicy() {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+aaudio_result_t AAudioStreamBuilder_delete(AAudioStreamBuilder* builder) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+aaudio_result_t AAudioStreamBuilder_openStream(AAudioStreamBuilder* builder,
+                                               AAudioStream** streamPtr) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+aaudio_result_t AAudioStream_close(AAudioStream* stream) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+aaudio_result_t AAudioStream_getTimestamp(AAudioStream* stream,
+                                          clockid_t clockid,
+                                          int64_t* framePosition,
+                                          int64_t* timeNanoseconds) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+aaudio_result_t AAudioStream_read(AAudioStream* stream, void* buffer,
+                                  int32_t numFrames,
+                                  int64_t timeoutNanoseconds) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+aaudio_result_t AAudioStream_release(AAudioStream* stream) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+aaudio_result_t AAudioStream_requestFlush(AAudioStream* stream) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+aaudio_result_t AAudioStream_requestPause(AAudioStream* stream) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+aaudio_result_t AAudioStream_requestStart(AAudioStream* stream) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+aaudio_result_t AAudioStream_requestStop(AAudioStream* stream) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+aaudio_result_t AAudioStream_setBufferSizeInFrames(AAudioStream* stream,
+                                                   int32_t requestedFrames) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+aaudio_result_t AAudioStream_waitForStateChange(
+    AAudioStream* stream, aaudio_stream_state_t inputState,
+    aaudio_stream_state_t* nextState, int64_t timeoutNanoseconds) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+aaudio_result_t AAudioStream_write(AAudioStream* stream, const void* buffer,
+                                   int32_t numFrames,
+                                   int64_t timeoutNanoseconds) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+aaudio_result_t AAudio_createStreamBuilder(AAudioStreamBuilder** builder) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+aaudio_result_t AAudio_setMMapPolicy(aaudio_policy_t policy) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+aaudio_sharing_mode_t AAudioStream_getSharingMode(AAudioStream* stream) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+aaudio_stream_state_t AAudioStream_getState(AAudioStream* stream) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+aaudio_usage_t AAudioStream_getUsage(AAudioStream* stream) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+bool AAudioStream_isMMapUsed(AAudioStream* stream) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool AAudioStream_isPrivacySensitive(AAudioStream* stream) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+const char* AAudio_convertResultToText(aaudio_result_t returnCode) {
+  mock_function_count_map[__func__]++;
+  return nullptr;
+}
+const char* AAudio_convertStreamStateToText(aaudio_stream_state_t state) {
+  mock_function_count_map[__func__]++;
+  return nullptr;
+}
+int32_t AAudioStream_getBufferCapacityInFrames(AAudioStream* stream) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+int32_t AAudioStream_getBufferSizeInFrames(AAudioStream* stream) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+int32_t AAudioStream_getChannelCount(AAudioStream* stream) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+int32_t AAudioStream_getDeviceId(AAudioStream* stream) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+int32_t AAudioStream_getFramesPerBurst(AAudioStream* stream) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+int32_t AAudioStream_getFramesPerDataCallback(AAudioStream* stream) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+int32_t AAudioStream_getSampleRate(AAudioStream* stream) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+int32_t AAudioStream_getSamplesPerFrame(AAudioStream* stream) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+int32_t AAudioStream_getSessionId(AAudioStream* stream) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+int32_t AAudioStream_getXRunCount(AAudioStream* stream) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+int64_t AAudioStream_getFramesRead(AAudioStream* stream) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+int64_t AAudioStream_getFramesWritten(AAudioStream* stream) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+void AAudioStreamBuilder_setAllowedCapturePolicy(
+    AAudioStreamBuilder* builder, aaudio_allowed_capture_policy_t policy) {
+  mock_function_count_map[__func__]++;
+  return;
+}
+void AAudioStreamBuilder_setBufferCapacityInFrames(AAudioStreamBuilder* builder,
+                                                   int32_t frames) {
+  mock_function_count_map[__func__]++;
+  return;
+}
+void AAudioStreamBuilder_setChannelCount(AAudioStreamBuilder* builder,
+                                         int32_t channelCount) {
+  mock_function_count_map[__func__]++;
+  return;
+}
+void AAudioStreamBuilder_setContentType(AAudioStreamBuilder* builder,
+                                        aaudio_content_type_t contentType) {
+  mock_function_count_map[__func__]++;
+  return;
+}
+void AAudioStreamBuilder_setDataCallback(AAudioStreamBuilder* builder,
+                                         AAudioStream_dataCallback callback,
+                                         void* userData) {
+  mock_function_count_map[__func__]++;
+  return;
+}
+void AAudioStreamBuilder_setDeviceId(AAudioStreamBuilder* builder,
+                                     int32_t deviceId) {
+  mock_function_count_map[__func__]++;
+  return;
+}
+void AAudioStreamBuilder_setDirection(AAudioStreamBuilder* builder,
+                                      aaudio_direction_t direction) {
+  mock_function_count_map[__func__]++;
+  return;
+}
+void AAudioStreamBuilder_setErrorCallback(AAudioStreamBuilder* builder,
+                                          AAudioStream_errorCallback callback,
+                                          void* userData) {
+  mock_function_count_map[__func__]++;
+  return;
+}
+void AAudioStreamBuilder_setFormat(AAudioStreamBuilder* builder,
+                                   aaudio_format_t format) {
+  mock_function_count_map[__func__]++;
+  return;
+}
+void AAudioStreamBuilder_setFramesPerDataCallback(AAudioStreamBuilder* builder,
+                                                  int32_t frames) {
+  mock_function_count_map[__func__]++;
+  return;
+}
+void AAudioStreamBuilder_setInputPreset(AAudioStreamBuilder* builder,
+                                        aaudio_input_preset_t inputPreset) {
+  mock_function_count_map[__func__]++;
+  return;
+}
+void AAudioStreamBuilder_setPerformanceMode(AAudioStreamBuilder* builder,
+                                            aaudio_performance_mode_t mode) {
+  mock_function_count_map[__func__]++;
+  return;
+}
+void AAudioStreamBuilder_setPrivacySensitive(AAudioStreamBuilder* builder,
+                                             bool privacySensitive) {
+  mock_function_count_map[__func__]++;
+  return;
+}
+void AAudioStreamBuilder_setSampleRate(AAudioStreamBuilder* builder,
+                                       int32_t sampleRate) {
+  mock_function_count_map[__func__]++;
+  return;
+}
+void AAudioStreamBuilder_setSamplesPerFrame(AAudioStreamBuilder* builder,
+                                            int32_t samplesPerFrame) {
+  mock_function_count_map[__func__]++;
+  return;
+}
+void AAudioStreamBuilder_setSessionId(AAudioStreamBuilder* builder,
+                                      aaudio_session_id_t sessionId) {
+  mock_function_count_map[__func__]++;
+  return;
+}
+void AAudioStreamBuilder_setSharingMode(AAudioStreamBuilder* builder,
+                                        aaudio_sharing_mode_t sharingMode) {
+  mock_function_count_map[__func__]++;
+  return;
+}
+void AAudioStreamBuilder_setUsage(AAudioStreamBuilder* builder,
+                                  aaudio_usage_t usage) {
+  mock_function_count_map[__func__]++;
+  return;
+}
diff --git a/system/test/mock/mock_hci_btsnoop_mem.cc b/system/test/mock/mock_hci_btsnoop_mem.cc
new file mode 100644
index 00000000000..039a6124a01
--- /dev/null
+++ b/system/test/mock/mock_hci_btsnoop_mem.cc
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:3
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include <base/logging.h>
+#include "gd/common/init_flags.h"
+#include "hci/include/btsnoop_mem.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+void activity_attribution_set_callback(activity_attribution_cb cb) {
+  mock_function_count_map[__func__]++;
+}
+void btsnoop_mem_capture(const BT_HDR* packet, uint64_t timestamp_us) {
+  mock_function_count_map[__func__]++;
+}
+void btsnoop_mem_set_callback(btsnoop_data_cb cb) {
+  mock_function_count_map[__func__]++;
+}
diff --git a/system/test/mock/mock_hci_packet_factory.cc b/system/test/mock/mock_hci_packet_factory.cc
new file mode 100644
index 00000000000..4c288314c64
--- /dev/null
+++ b/system/test/mock/mock_hci_packet_factory.cc
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:2
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include <base/logging.h>
+#include "bt_types.h"
+#include "buffer_allocator.h"
+#include "hci_internals.h"
+#include "hci_layer.h"
+#include "hci_packet_factory.h"
+#include "hcidefs.h"
+#include "hcimsgs.h"
+#include "osi/include/allocator.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+const hci_packet_factory_t* hci_packet_factory_get_interface() {
+  mock_function_count_map[__func__]++;
+  return nullptr;
+}
diff --git a/system/test/mock/mock_hci_packet_parser.cc b/system/test/mock/mock_hci_packet_parser.cc
new file mode 100644
index 00000000000..d25725e43db
--- /dev/null
+++ b/system/test/mock/mock_hci_packet_parser.cc
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:3
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include "hci/include/hci_packet_parser.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+const hci_packet_parser_t* hci_packet_parser_get_interface() {
+  mock_function_count_map[__func__]++;
+  return nullptr;
+}
+const hci_packet_parser_t* hci_packet_parser_get_test_interface(
+    allocator_t* buffer_allocator_interface) {
+  mock_function_count_map[__func__]++;
+  return nullptr;
+}
diff --git a/system/test/mock/mock_l2cap_l2c_api.cc b/system/test/mock/mock_l2cap_l2c_api.cc
new file mode 100644
index 00000000000..85f2f4fafb0
--- /dev/null
+++ b/system/test/mock/mock_l2cap_l2c_api.cc
@@ -0,0 +1,177 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:33
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include <cstdint>
+#include "stack/include/l2c_api.h"
+#include "types/raw_address.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+bool L2CA_ConnectCreditBasedRsp(const RawAddress& p_bd_addr, uint8_t id,
+                                std::vector<uint16_t>& accepted_lcids,
+                                uint16_t result, tL2CAP_LE_CFG_INFO* p_cfg) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool L2CA_ConnectFixedChnl(uint16_t fixed_cid, const RawAddress& rem_bda) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool L2CA_DisconnectLECocReq(uint16_t cid) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool L2CA_DisconnectReq(uint16_t cid) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool L2CA_GetPeerFeatures(const RawAddress& bd_addr, uint32_t* p_ext_feat,
+                          uint8_t* p_chnl_mask) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool L2CA_GetPeerLECocConfig(uint16_t lcid, tL2CAP_LE_CFG_INFO* peer_cfg) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool L2CA_GetRemoteCid(uint16_t lcid, uint16_t* rcid) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool L2CA_IsLinkEstablished(const RawAddress& bd_addr,
+                            tBT_TRANSPORT transport) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool L2CA_ReconfigCreditBasedConnsReq(const RawAddress& bda,
+                                      std::vector<uint16_t>& lcids,
+                                      tL2CAP_LE_CFG_INFO* p_cfg) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool L2CA_RegisterFixedChannel(uint16_t fixed_cid,
+                               tL2CAP_FIXED_CHNL_REG* p_freg) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool L2CA_RemoveFixedChnl(uint16_t fixed_cid, const RawAddress& rem_bda) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool L2CA_SetAclPriority(const RawAddress& bd_addr, tL2CAP_PRIORITY priority) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool L2CA_SetChnlFlushability(uint16_t cid, bool is_flushable) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool L2CA_SetLeGattTimeout(const RawAddress& rem_bda, uint16_t idle_tout) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool L2CA_SetIdleTimeoutByBdAddr(const RawAddress& bd_addr, uint16_t timeout,
+                                 tBT_TRANSPORT transport) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool L2CA_SetTxPriority(uint16_t cid, tL2CAP_CHNL_PRIORITY priority) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+std::vector<uint16_t> L2CA_ConnectCreditBasedReq(uint16_t psm,
+                                                 const RawAddress& p_bd_addr,
+                                                 tL2CAP_LE_CFG_INFO* p_cfg) {
+  mock_function_count_map[__func__]++;
+  std::vector<uint16_t> v;
+  return v;
+}
+tBT_TRANSPORT l2c_get_transport_from_fixed_cid(uint16_t fixed_cid) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint16_t L2CA_AllocateLePSM(void) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint16_t L2CA_ConnectLECocReq(uint16_t psm, const RawAddress& p_bd_addr,
+                              tL2CAP_LE_CFG_INFO* p_cfg, uint16_t sec_level) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint16_t L2CA_ConnectReq(uint16_t psm, const RawAddress& p_bd_addr) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint16_t L2CA_ConnectReq2(uint16_t psm, const RawAddress& p_bd_addr,
+                          uint16_t sec_level) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint16_t L2CA_FlushChannel(uint16_t lcid, uint16_t num_to_flush) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint16_t L2CA_Register(uint16_t psm, const tL2CAP_APPL_INFO& p_cb_info,
+                       bool enable_snoop, tL2CAP_ERTM_INFO* p_ertm_info,
+                       uint16_t my_mtu, uint16_t required_remote_mtu) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint16_t L2CA_Register2(uint16_t psm, const tL2CAP_APPL_INFO& p_cb_info,
+                        bool enable_snoop, tL2CAP_ERTM_INFO* p_ertm_info,
+                        uint16_t my_mtu, uint16_t required_remote_mtu,
+                        uint16_t sec_level) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint16_t L2CA_RegisterLECoc(uint16_t psm, const tL2CAP_APPL_INFO& p_cb_info,
+                            uint16_t sec_level, tL2CAP_LE_CFG_INFO cfg) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint16_t L2CA_SendFixedChnlData(uint16_t fixed_cid, const RawAddress& rem_bda,
+                                BT_HDR* p_buf) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint8_t L2CA_DataWrite(uint16_t cid, BT_HDR* p_data) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint8_t L2CA_LECocDataWrite(uint16_t cid, BT_HDR* p_data) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint8_t L2CA_SetTraceLevel(uint8_t new_level) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+void L2CA_Deregister(uint16_t psm) { mock_function_count_map[__func__]++; }
+void L2CA_DeregisterLECoc(uint16_t psm) { mock_function_count_map[__func__]++; }
+void L2CA_FreeLePSM(uint16_t psm) { mock_function_count_map[__func__]++; }
diff --git a/system/test/mock/mock_l2cap_main.cc b/system/test/mock/mock_l2cap_main.cc
new file mode 100644
index 00000000000..677858e122c
--- /dev/null
+++ b/system/test/mock/mock_l2cap_main.cc
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:9
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include <string.h>
+#include "bt_common.h"
+#include "bt_target.h"
+#include "hci/include/btsnoop.h"
+#include "hcimsgs.h"
+#include "l2c_api.h"
+#include "l2c_int.h"
+#include "l2cdefs.h"
+#include "main/shim/shim.h"
+#include "osi/include/log.h"
+#include "osi/include/osi.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+uint8_t l2c_data_write(uint16_t cid, BT_HDR* p_data, uint16_t flags) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+void l2c_ccb_timer_timeout(void* data) { mock_function_count_map[__func__]++; }
+void l2c_fcrb_ack_timer_timeout(void* data) {
+  mock_function_count_map[__func__]++;
+}
+void l2c_free(void) { mock_function_count_map[__func__]++; }
+void l2c_init(void) { mock_function_count_map[__func__]++; }
+void l2c_lcb_timer_timeout(void* data) { mock_function_count_map[__func__]++; }
+void l2c_process_held_packets(bool timed_out) {
+  mock_function_count_map[__func__]++;
+}
+void l2c_rcv_acl_data(BT_HDR* p_msg) { mock_function_count_map[__func__]++; }
+void l2c_receive_hold_timer_timeout(UNUSED_ATTR void* data) {
+  mock_function_count_map[__func__]++;
+}
diff --git a/system/test/mock/mock_main_shim.cc b/system/test/mock/mock_main_shim.cc
new file mode 100644
index 00000000000..a5226ba599f
--- /dev/null
+++ b/system/test/mock/mock_main_shim.cc
@@ -0,0 +1,93 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:14
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#define LOG_TAG "bt_shim"
+#include "gd/common/init_flags.h"
+#include "main/shim/entry.h"
+#include "main/shim/shim.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+bool MOCK_bluetooth_shim_is_gd_acl_enabled_{false};
+
+bool bluetooth::shim::is_any_gd_enabled() {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool bluetooth::shim::is_gd_acl_enabled() {
+  mock_function_count_map[__func__]++;
+  return MOCK_bluetooth_shim_is_gd_acl_enabled_;
+}
+bool bluetooth::shim::is_gd_advertising_enabled() {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool bluetooth::shim::is_gd_scanning_enabled() {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool bluetooth::shim::is_gd_controller_enabled() {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool bluetooth::shim::is_gd_hci_enabled() {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool bluetooth::shim::is_gd_l2cap_enabled() {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool bluetooth::shim::is_gd_security_enabled() {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool bluetooth::shim::is_gd_shim_enabled() {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool bluetooth::shim::is_gd_stack_started_up() {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool bluetooth::shim::is_gd_link_policy_enabled() {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+future_t* GeneralShutDown() {
+  mock_function_count_map[__func__]++;
+  return nullptr;
+}
+future_t* IdleModuleStartUp() {
+  mock_function_count_map[__func__]++;
+  return nullptr;
+}
+future_t* ShimModuleStartUp() {
+  mock_function_count_map[__func__]++;
+  return nullptr;
+}
diff --git a/system/test/mock/mock_main_shim_BtifConfigInterface.cc b/system/test/mock/mock_main_shim_BtifConfigInterface.cc
new file mode 100644
index 00000000000..1981aef8b9f
--- /dev/null
+++ b/system/test/mock/mock_main_shim_BtifConfigInterface.cc
@@ -0,0 +1,90 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <string>
+
+#include "main/shim/config.h"
+
+bool bluetooth::shim::BtifConfigInterface::HasSection(
+    const std::string& section) {
+  return false;
+}
+bool bluetooth::shim::BtifConfigInterface::HasProperty(
+    const std::string& section, const std::string& property) {
+  return false;
+}
+bool bluetooth::shim::BtifConfigInterface::GetInt(const std::string& section,
+                                                  const std::string& key,
+                                                  int* value) {
+  return false;
+}
+bool bluetooth::shim::BtifConfigInterface::SetInt(const std::string& section,
+                                                  const std::string& key,
+                                                  int value) {
+  return false;
+}
+bool bluetooth::shim::BtifConfigInterface::GetUint64(const std::string& section,
+                                                     const std::string& key,
+                                                     uint64_t* value) {
+  return false;
+}
+bool bluetooth::shim::BtifConfigInterface::SetUint64(const std::string& section,
+                                                     const std::string& key,
+                                                     uint64_t value) {
+  return false;
+}
+bool bluetooth::shim::BtifConfigInterface::GetStr(const std::string& section,
+                                                  const std::string& key,
+                                                  char* value,
+                                                  int* size_bytes) {
+  return false;
+}
+std::optional<std::string> bluetooth::shim::BtifConfigInterface::GetStr(
+    const std::string& section, const std::string& key) {
+  return std::string();
+}
+bool bluetooth::shim::BtifConfigInterface::SetStr(const std::string& section,
+                                                  const std::string& key,
+                                                  const std::string& value) {
+  return false;
+}
+bool bluetooth::shim::BtifConfigInterface::GetBin(const std::string& section,
+                                                  const std::string& key,
+                                                  uint8_t* value,
+                                                  size_t* length) {
+  return false;
+}
+size_t bluetooth::shim::BtifConfigInterface::GetBinLength(
+    const std::string& section, const std::string& key) {
+  return 0;
+}
+bool bluetooth::shim::BtifConfigInterface::SetBin(const std::string& section,
+                                                  const std::string& key,
+                                                  const uint8_t* value,
+                                                  size_t length) {
+  return false;
+}
+bool bluetooth::shim::BtifConfigInterface::RemoveProperty(
+    const std::string& section, const std::string& key) {
+  return false;
+}
+std::vector<std::string>
+bluetooth::shim::BtifConfigInterface::GetPersistentDevices() {
+  return std::vector<std::string>();
+}
+void bluetooth::shim::BtifConfigInterface::Save(){};
+void bluetooth::shim::BtifConfigInterface::Flush(){};
+void bluetooth::shim::BtifConfigInterface::Clear(){};
diff --git a/system/test/mock/mock_main_shim_activity_attribution.cc b/system/test/mock/mock_main_shim_activity_attribution.cc
new file mode 100644
index 00000000000..8dc746b2b7d
--- /dev/null
+++ b/system/test/mock/mock_main_shim_activity_attribution.cc
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:3
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include "btif/include/btif_common.h"
+#include "main/shim/activity_attribution.h"
+#include "main/shim/entry.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+ActivityAttributionInterface*
+bluetooth::shim::get_activity_attribution_instance() {
+  mock_function_count_map[__func__]++;
+  return nullptr;
+}
+void bluetooth::shim::init_activity_attribution() {
+  mock_function_count_map[__func__]++;
+}
diff --git a/system/test/mock/mock_main_shim_controller.cc b/system/test/mock/mock_main_shim_controller.cc
new file mode 100644
index 00000000000..d3ff4b801e4
--- /dev/null
+++ b/system/test/mock/mock_main_shim_controller.cc
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:9
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include "device/include/controller.h"
+#include "main/shim/controller.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+const controller_t* bluetooth::shim::controller_get_interface() {
+  mock_function_count_map[__func__]++;
+  return nullptr;
+}
diff --git a/system/test/mock/mock_main_shim_dumpsys.cc b/system/test/mock/mock_main_shim_dumpsys.cc
new file mode 100644
index 00000000000..d6c1d851fdf
--- /dev/null
+++ b/system/test/mock/mock_main_shim_dumpsys.cc
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:4
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include "main/shim/dumpsys.h"
+#include "main/shim/entry.h"
+#include "main/shim/shim.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+void bluetooth::shim::RegisterDumpsysFunction(const void* token,
+                                              DumpsysFunction func) {
+  mock_function_count_map[__func__]++;
+}
+void bluetooth::shim::Dump(int fd, const char** args) {
+  mock_function_count_map[__func__]++;
+}
+void bluetooth::shim::UnregisterDumpsysFunction(const void* token) {
+  mock_function_count_map[__func__]++;
+}
diff --git a/system/test/mock/mock_main_shim_le_advertising_manager.cc b/system/test/mock/mock_main_shim_le_advertising_manager.cc
new file mode 100644
index 00000000000..21b2ceec971
--- /dev/null
+++ b/system/test/mock/mock_main_shim_le_advertising_manager.cc
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:3
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include "btif/include/btif_common.h"
+#include "gd/common/init_flags.h"
+#include "include/hardware/ble_advertiser.h"
+#include "main/shim/le_advertising_manager.h"
+#include "stack/include/ble_advertiser.h"
+
+#include <vector>
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+BleAdvertiserInterface* bluetooth::shim::get_ble_advertiser_instance() {
+  mock_function_count_map[__func__]++;
+  return nullptr;
+}
+void bluetooth::shim::init_advertising_manager() {
+  mock_function_count_map[__func__]++;
+}
diff --git a/system/test/mock/mock_main_shim_le_scanning_manager.cc b/system/test/mock/mock_main_shim_le_scanning_manager.cc
new file mode 100644
index 00000000000..2649ea37a41
--- /dev/null
+++ b/system/test/mock/mock_main_shim_le_scanning_manager.cc
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:3
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include "include/hardware/ble_scanner.h"
+#include "main/shim/le_scanning_manager.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+BleScannerInterface* bluetooth::shim::get_ble_scanner_instance() {
+  mock_function_count_map[__func__]++;
+  return nullptr;
+}
+void bluetooth::shim::init_scanning_manager() {
+  mock_function_count_map[__func__]++;
+}
diff --git a/system/test/mock/mock_main_shim_metric_id_api.cc b/system/test/mock/mock_main_shim_metric_id_api.cc
new file mode 100644
index 00000000000..4c5e3f4996c
--- /dev/null
+++ b/system/test/mock/mock_main_shim_metric_id_api.cc
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:7
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include "gd/common/metric_id_manager.h"
+#include "main/shim/metric_id_api.h"
+#include "main/shim/shim.h"
+#include "types/raw_address.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+namespace bluetooth {
+namespace shim {
+
+bool InitMetricIdAllocator(
+    const std::unordered_map<RawAddress, int>& paired_device_map,
+    CallbackLegacy save_id_callback, CallbackLegacy forget_device_callback) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool CloseMetricIdAllocator() {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool IsEmptyMetricIdAllocator() {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool IsValidIdFromMetricIdAllocator(const int id) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool SaveDeviceOnMetricIdAllocator(const RawAddress& raw_address) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+int AllocateIdFromMetricIdAllocator(const RawAddress& raw_address) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+void ForgetDeviceFromMetricIdAllocator(const RawAddress& raw_address) {
+  mock_function_count_map[__func__]++;
+}
+
+}  // namespace shim
+}  // namespace bluetooth
diff --git a/system/test/mock/mock_main_shim_metrics_api.cc b/system/test/mock/mock_main_shim_metrics_api.cc
new file mode 100644
index 00000000000..0d39d736e76
--- /dev/null
+++ b/system/test/mock/mock_main_shim_metrics_api.cc
@@ -0,0 +1,100 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:12
+ */
+
+#include <cstdint>
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include "gd/common/metrics.h"
+#include "main/shim/metrics_api.h"
+#include "types/raw_address.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+void bluetooth::shim::LogMetricA2dpAudioOverrunEvent(
+    const RawAddress& raw_address, uint64_t encoding_interval_millis,
+    int num_dropped_buffers, int num_dropped_encoded_frames,
+    int num_dropped_encoded_bytes) {
+  mock_function_count_map[__func__]++;
+}
+void bluetooth::shim::LogMetricA2dpAudioUnderrunEvent(
+    const RawAddress& raw_address, uint64_t encoding_interval_millis,
+    int num_missing_pcm_bytes) {
+  mock_function_count_map[__func__]++;
+}
+void bluetooth::shim::LogMetricA2dpPlaybackEvent(const RawAddress& raw_address,
+                                                 int playback_state,
+                                                 int audio_coding_mode) {
+  mock_function_count_map[__func__]++;
+}
+void bluetooth::shim::LogMetricClassicPairingEvent(
+    const RawAddress& raw_address, uint16_t handle, uint32_t hci_cmd,
+    uint16_t hci_event, uint16_t cmd_status, uint16_t reason_code,
+    int64_t event_value) {
+  mock_function_count_map[__func__]++;
+}
+void bluetooth::shim::LogMetricManufacturerInfo(
+    const RawAddress& raw_address,
+    android::bluetooth::DeviceInfoSrcEnum source_type,
+    const std::string& source_name, const std::string& manufacturer,
+    const std::string& model, const std::string& hardware_version,
+    const std::string& software_version) {
+  mock_function_count_map[__func__]++;
+}
+void bluetooth::shim::LogMetricReadFailedContactCounterResult(
+    const RawAddress& raw_address, uint16_t handle, uint32_t cmd_status,
+    int32_t failed_contact_counter) {
+  mock_function_count_map[__func__]++;
+}
+void bluetooth::shim::LogMetricReadRssiResult(const RawAddress& raw_address,
+                                              uint16_t handle,
+                                              uint32_t cmd_status,
+                                              int8_t rssi) {
+  mock_function_count_map[__func__]++;
+}
+void bluetooth::shim::LogMetricReadTxPowerLevelResult(
+    const RawAddress& raw_address, uint16_t handle, uint32_t cmd_status,
+    int32_t transmit_power_level) {
+  mock_function_count_map[__func__]++;
+}
+void bluetooth::shim::LogMetricSdpAttribute(const RawAddress& raw_address,
+                                            uint16_t protocol_uuid,
+                                            uint16_t attribute_id,
+                                            size_t attribute_size,
+                                            const char* attribute_value) {
+  mock_function_count_map[__func__]++;
+}
+void bluetooth::shim::LogMetricSmpPairingEvent(
+    const RawAddress& raw_address, uint8_t smp_cmd,
+    android::bluetooth::DirectionEnum direction, uint8_t smp_fail_reason) {
+  mock_function_count_map[__func__]++;
+}
+void bluetooth::shim::LogMetricSocketConnectionState(
+    const RawAddress& raw_address, int port, int type,
+    android::bluetooth::SocketConnectionstateEnum connection_state,
+    int64_t tx_bytes, int64_t rx_bytes, int uid, int server_port,
+    android::bluetooth::SocketRoleEnum socket_role) {
+  mock_function_count_map[__func__]++;
+}
diff --git a/system/test/mock/mock_stack_a2dp_api.cc b/system/test/mock/mock_stack_a2dp_api.cc
new file mode 100644
index 00000000000..5ca56717af2
--- /dev/null
+++ b/system/test/mock/mock_stack_a2dp_api.cc
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:9
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include <string.h>
+#include "a2dp_api.h"
+#include "a2dp_int.h"
+#include "avdt_api.h"
+#include "bt_common.h"
+#include "bt_target.h"
+#include "osi/include/log.h"
+#include "sdpdefs.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+tA2DP_STATUS A2DP_AddRecord(uint16_t service_uuid, char* p_service_name,
+                            char* p_provider_name, uint16_t features,
+                            uint32_t sdp_handle) {
+  mock_function_count_map[__func__]++;
+  return A2DP_SUCCESS;
+}
+tA2DP_STATUS A2DP_FindService(uint16_t service_uuid, const RawAddress& bd_addr,
+                              tA2DP_SDP_DB_PARAMS* p_db,
+                              tA2DP_FIND_CBACK* p_cback) {
+  mock_function_count_map[__func__]++;
+  return A2DP_SUCCESS;
+}
+uint16_t A2DP_GetAvdtpVersion() {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint8_t A2DP_BitsSet(uint64_t num) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint8_t A2DP_SetTraceLevel(uint8_t new_level) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+void A2DP_Init(void) { mock_function_count_map[__func__]++; }
+void a2dp_set_avdt_sdp_ver(uint16_t avdt_sdp_ver) {
+  mock_function_count_map[__func__]++;
+}
diff --git a/system/test/mock/mock_stack_a2dp_codec_config.cc b/system/test/mock/mock_stack_a2dp_codec_config.cc
new file mode 100644
index 00000000000..8d013282647
--- /dev/null
+++ b/system/test/mock/mock_stack_a2dp_codec_config.cc
@@ -0,0 +1,351 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:67
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include <base/logging.h>
+#include <inttypes.h>
+#include "a2dp_aac.h"
+#include "a2dp_codec_api.h"
+#include "a2dp_sbc.h"
+#include "a2dp_vendor.h"
+#include "bta/av/bta_av_int.h"
+#include "osi/include/log.h"
+#include "osi/include/properties.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+A2dpCodecConfig* A2dpCodecConfig::createCodec(
+    btav_a2dp_codec_index_t codec_index,
+    btav_a2dp_codec_priority_t codec_priority) {
+  mock_function_count_map[__func__]++;
+  return nullptr;
+}
+A2dpCodecConfig* A2dpCodecs::findSinkCodecConfig(const uint8_t* p_codec_info) {
+  mock_function_count_map[__func__]++;
+  return nullptr;
+}
+A2dpCodecConfig* A2dpCodecs::findSourceCodecConfig(
+    const uint8_t* p_codec_info) {
+  mock_function_count_map[__func__]++;
+  return nullptr;
+}
+A2dpCodecConfig::A2dpCodecConfig(btav_a2dp_codec_index_t codec_index,
+                                 const std::string& name,
+                                 btav_a2dp_codec_priority_t codec_priority)
+    : codec_index_(codec_index),
+      name_(name),
+      default_codec_priority_(codec_priority) {
+  mock_function_count_map[__func__]++;
+}
+A2dpCodecConfig::~A2dpCodecConfig() { mock_function_count_map[__func__]++; }
+A2dpCodecs::A2dpCodecs(
+    const std::vector<btav_a2dp_codec_config_t>& codec_priorities)
+    : current_codec_config_(nullptr) {
+  mock_function_count_map[__func__]++;
+}
+A2dpCodecs::~A2dpCodecs() { mock_function_count_map[__func__]++; }
+bool A2DP_AdjustCodec(uint8_t* p_codec_info) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool A2DP_BuildCodecHeader(const uint8_t* p_codec_info, BT_HDR* p_buf,
+                           uint16_t frames_per_packet) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool A2DP_CodecEquals(const uint8_t* p_codec_info_a,
+                      const uint8_t* p_codec_info_b) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool A2DP_CodecTypeEquals(const uint8_t* p_codec_info_a,
+                          const uint8_t* p_codec_info_b) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool A2DP_GetPacketTimestamp(const uint8_t* p_codec_info, const uint8_t* p_data,
+                             uint32_t* p_timestamp) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool A2DP_InitCodecConfig(btav_a2dp_codec_index_t codec_index,
+                          AvdtpSepConfig* p_cfg) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool A2DP_IsPeerSinkCodecValid(const uint8_t* p_codec_info) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool A2DP_IsPeerSourceCodecSupported(const uint8_t* p_codec_info) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool A2DP_IsPeerSourceCodecValid(const uint8_t* p_codec_info) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool A2DP_IsSinkCodecSupported(const uint8_t* p_codec_info) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool A2DP_IsSinkCodecValid(const uint8_t* p_codec_info) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool A2DP_IsSourceCodecValid(const uint8_t* p_codec_info) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool A2DP_UsesRtpHeader(bool content_protection_enabled,
+                        const uint8_t* p_codec_info) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool A2dpCodecConfig::codecConfigIsValid(
+    const btav_a2dp_codec_config_t& codec_config) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool A2dpCodecConfig::copyOutOtaCodecConfig(uint8_t* p_codec_info) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool A2dpCodecConfig::getCodecSpecificConfig(tBT_A2DP_OFFLOAD* p_a2dp_offload) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool A2dpCodecConfig::isCodecConfigEmpty(
+    const btav_a2dp_codec_config_t& codec_config) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool A2dpCodecConfig::isValid() const {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool A2dpCodecConfig::setCodecUserConfig(
+    const btav_a2dp_codec_config_t& codec_user_config,
+    const btav_a2dp_codec_config_t& codec_audio_config,
+    const tA2DP_ENCODER_INIT_PEER_PARAMS* p_peer_params,
+    const uint8_t* p_peer_codec_info, bool is_capability,
+    uint8_t* p_result_codec_config, bool* p_restart_input,
+    bool* p_restart_output, bool* p_config_updated) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool A2dpCodecs::getCodecConfigAndCapabilities(
+    btav_a2dp_codec_config_t* p_codec_config,
+    std::vector<btav_a2dp_codec_config_t>* p_codecs_local_capabilities,
+    std::vector<btav_a2dp_codec_config_t>* p_codecs_selectable_capabilities) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool A2dpCodecs::init() {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool A2dpCodecs::isSupportedCodec(btav_a2dp_codec_index_t codec_index) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool A2dpCodecs::setCodecAudioConfig(
+    const btav_a2dp_codec_config_t& codec_audio_config,
+    const tA2DP_ENCODER_INIT_PEER_PARAMS* p_peer_params,
+    const uint8_t* p_peer_sink_capabilities, uint8_t* p_result_codec_config,
+    bool* p_restart_output, bool* p_config_updated) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool A2dpCodecs::setCodecConfig(const uint8_t* p_peer_codec_info,
+                                bool is_capability,
+                                uint8_t* p_result_codec_config,
+                                bool select_current_codec) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool A2dpCodecs::setCodecOtaConfig(
+    const uint8_t* p_ota_codec_config,
+    const tA2DP_ENCODER_INIT_PEER_PARAMS* p_peer_params,
+    uint8_t* p_result_codec_config, bool* p_restart_input,
+    bool* p_restart_output, bool* p_config_updated) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool A2dpCodecs::setCodecUserConfig(
+    const btav_a2dp_codec_config_t& codec_user_config,
+    const tA2DP_ENCODER_INIT_PEER_PARAMS* p_peer_params,
+    const uint8_t* p_peer_sink_capabilities, uint8_t* p_result_codec_config,
+    bool* p_restart_input, bool* p_restart_output, bool* p_config_updated) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool A2dpCodecs::setPeerSinkCodecCapabilities(
+    const uint8_t* p_peer_codec_capabilities) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool A2dpCodecs::setPeerSourceCodecCapabilities(
+    const uint8_t* p_peer_codec_capabilities) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool A2dpCodecs::setSinkCodecConfig(const uint8_t* p_peer_codec_info,
+                                    bool is_capability,
+                                    uint8_t* p_result_codec_config,
+                                    bool select_current_codec) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+btav_a2dp_codec_config_t A2dpCodecConfig::getCodecAudioConfig() {
+  mock_function_count_map[__func__]++;
+  btav_a2dp_codec_config_t config;
+  return config;
+}
+btav_a2dp_codec_config_t A2dpCodecConfig::getCodecCapability() {
+  mock_function_count_map[__func__]++;
+  btav_a2dp_codec_config_t config;
+  return config;
+}
+btav_a2dp_codec_config_t A2dpCodecConfig::getCodecConfig() {
+  mock_function_count_map[__func__]++;
+  btav_a2dp_codec_config_t config;
+  return config;
+}
+btav_a2dp_codec_config_t A2dpCodecConfig::getCodecLocalCapability() {
+  mock_function_count_map[__func__]++;
+  btav_a2dp_codec_config_t config;
+  return config;
+}
+btav_a2dp_codec_config_t A2dpCodecConfig::getCodecSelectableCapability() {
+  mock_function_count_map[__func__]++;
+  btav_a2dp_codec_config_t config;
+  return config;
+}
+btav_a2dp_codec_config_t A2dpCodecConfig::getCodecUserConfig() {
+  mock_function_count_map[__func__]++;
+  btav_a2dp_codec_config_t config;
+  return config;
+}
+btav_a2dp_codec_index_t A2DP_SinkCodecIndex(const uint8_t* p_codec_info) {
+  mock_function_count_map[__func__]++;
+  return BTAV_A2DP_CODEC_INDEX_MAX;
+}
+btav_a2dp_codec_index_t A2DP_SourceCodecIndex(const uint8_t* p_codec_info) {
+  mock_function_count_map[__func__]++;
+  return BTAV_A2DP_CODEC_INDEX_MAX;
+}
+const char* A2DP_CodecIndexStr(btav_a2dp_codec_index_t codec_index) {
+  mock_function_count_map[__func__]++;
+  return nullptr;
+}
+const char* A2DP_CodecName(const uint8_t* p_codec_info) {
+  mock_function_count_map[__func__]++;
+  return nullptr;
+}
+const tA2DP_DECODER_INTERFACE* A2DP_GetDecoderInterface(
+    const uint8_t* p_codec_info) {
+  mock_function_count_map[__func__]++;
+  return nullptr;
+}
+const tA2DP_ENCODER_INTERFACE* A2DP_GetEncoderInterface(
+    const uint8_t* p_codec_info) {
+  mock_function_count_map[__func__]++;
+  return nullptr;
+}
+int A2DP_GetSinkTrackChannelType(const uint8_t* p_codec_info) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+int A2DP_GetTrackBitsPerSample(const uint8_t* p_codec_info) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+int A2DP_GetTrackChannelCount(const uint8_t* p_codec_info) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+int A2DP_GetTrackSampleRate(const uint8_t* p_codec_info) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+int A2dpCodecConfig::getTrackBitRate() const {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+std::string A2DP_CodecInfoString(const uint8_t* p_codec_info) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+std::string A2dpCodecConfig::codecBitsPerSample2Str(
+    btav_a2dp_codec_bits_per_sample_t codec_bits_per_sample) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+std::string A2dpCodecConfig::codecChannelMode2Str(
+    btav_a2dp_codec_channel_mode_t codec_channel_mode) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+std::string A2dpCodecConfig::codecConfig2Str(
+    const btav_a2dp_codec_config_t& codec_config) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+std::string A2dpCodecConfig::codecSampleRate2Str(
+    btav_a2dp_codec_sample_rate_t codec_sample_rate) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+tA2DP_CODEC_TYPE A2DP_GetCodecType(const uint8_t* p_codec_info) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint8_t A2DP_GetMediaType(const uint8_t* p_codec_info) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint8_t A2dpCodecConfig::getAudioBitsPerSample() {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+void A2DP_InitDefaultCodec(uint8_t* p_codec_info) {
+  mock_function_count_map[__func__]++;
+}
+void A2dpCodecConfig::debug_codec_dump(int fd) {
+  mock_function_count_map[__func__]++;
+}
+void A2dpCodecConfig::setCodecPriority(
+    btav_a2dp_codec_priority_t codec_priority) {
+  mock_function_count_map[__func__]++;
+}
+void A2dpCodecConfig::setDefaultCodecPriority() {
+  mock_function_count_map[__func__]++;
+}
+void A2dpCodecs::debug_codec_dump(int fd) {
+  mock_function_count_map[__func__]++;
+}
diff --git a/system/test/mock/mock_stack_acl.cc b/system/test/mock/mock_stack_acl.cc
new file mode 100644
index 00000000000..b0975b11cfa
--- /dev/null
+++ b/system/test/mock/mock_stack_acl.cc
@@ -0,0 +1,452 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:127
+ */
+
+#include <cstdint>
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include "stack/acl/acl.h"
+#include "stack/include/acl_api.h"
+#include "stack/include/hci_error_code.h"
+#include "types/bt_transport.h"
+#include "types/hci_role.h"
+#include "types/raw_address.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+bool IsEprAvailable(const tACL_CONN& p_acl) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool ACL_SupportTransparentSynchronousData(const RawAddress& bd_addr) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool BTM_BLE_IS_RESOLVE_BDA(const RawAddress& x) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool BTM_IsAclConnectionUp(const RawAddress& remote_bda,
+                           tBT_TRANSPORT transport) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool BTM_IsAclConnectionUpAndHandleValid(const RawAddress& remote_bda,
+                                         tBT_TRANSPORT transport) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool BTM_IsAclConnectionUpFromHandle(uint16_t hci_handle) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool BTM_IsBleConnection(uint16_t hci_handle) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool BTM_IsPhy2mSupported(const RawAddress& remote_bda,
+                          tBT_TRANSPORT transport) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool BTM_ReadRemoteConnectionAddr(const RawAddress& pseudo_addr,
+                                  RawAddress& conn_addr,
+                                  tBLE_ADDR_TYPE* p_addr_type) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool BTM_ReadRemoteVersion(const RawAddress& addr, uint8_t* lmp_version,
+                           uint16_t* manufacturer, uint16_t* lmp_sub_version) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool acl_create_le_connection(const RawAddress& bd_addr) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool acl_create_le_connection_with_id(uint8_t id, const RawAddress& bd_addr) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool acl_is_role_switch_allowed() {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool acl_is_switch_role_idle(const RawAddress& bd_addr,
+                             tBT_TRANSPORT transport) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool acl_peer_supports_ble_2m_phy(uint16_t hci_handle) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool acl_peer_supports_ble_coded_phy(uint16_t hci_handle) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool acl_peer_supports_ble_connection_parameters_request(
+    const RawAddress& remote_bda) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool acl_peer_supports_ble_packet_extension(uint16_t hci_handle) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool acl_peer_supports_sniff_subrating(const RawAddress& remote_bda) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool acl_refresh_remote_address(const RawAddress& identity_address,
+                                tBLE_ADDR_TYPE identity_address_type,
+                                const RawAddress& bda, tBLE_ADDR_TYPE rra_type,
+                                const RawAddress& rpa) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool acl_set_peer_le_features_from_handle(uint16_t hci_handle,
+                                          const uint8_t* p) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool sco_peer_supports_esco_2m_phy(const RawAddress& remote_bda) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool sco_peer_supports_esco_3m_phy(const RawAddress& remote_bda) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+const RawAddress acl_address_from_handle(uint16_t handle) {
+  mock_function_count_map[__func__]++;
+  return RawAddress::kEmpty;
+}
+void acl_send_data_packet_br_edr([[maybe_unused]] const RawAddress& bd_addr,
+                                 BT_HDR* p_buf) {
+  mock_function_count_map[__func__]++;
+}
+void acl_create_classic_connection(const RawAddress& bd_addr,
+                                   bool there_are_high_priority_channels,
+                                   bool is_bonding) {
+  mock_function_count_map[__func__]++;
+}
+tACL_CONN* acl_get_connection_from_address(const RawAddress& bd_addr,
+                                           tBT_TRANSPORT transport) {
+  mock_function_count_map[__func__]++;
+  return nullptr;
+}
+tACL_CONN* acl_get_connection_from_handle(uint16_t handle) {
+  mock_function_count_map[__func__]++;
+  return nullptr;
+}
+tBTM_STATUS BTM_GetLinkSuperTout(const RawAddress& remote_bda,
+                                 uint16_t* p_timeout) {
+  mock_function_count_map[__func__]++;
+  return BTM_SUCCESS;
+}
+tBTM_STATUS BTM_GetRole(const RawAddress& remote_bd_addr, tHCI_ROLE* p_role) {
+  mock_function_count_map[__func__]++;
+  return BTM_SUCCESS;
+}
+tBTM_STATUS BTM_ReadFailedContactCounter(const RawAddress& remote_bda,
+                                         tBTM_CMPL_CB* p_cb) {
+  mock_function_count_map[__func__]++;
+  return BTM_SUCCESS;
+}
+tBTM_STATUS BTM_ReadRSSI(const RawAddress& remote_bda, tBTM_CMPL_CB* p_cb) {
+  mock_function_count_map[__func__]++;
+  return BTM_SUCCESS;
+}
+tBTM_STATUS BTM_ReadTxPower(const RawAddress& remote_bda,
+                            tBT_TRANSPORT transport, tBTM_CMPL_CB* p_cb) {
+  mock_function_count_map[__func__]++;
+  return BTM_SUCCESS;
+}
+tBTM_STATUS BTM_SetLinkSuperTout(const RawAddress& remote_bda,
+                                 uint16_t timeout) {
+  mock_function_count_map[__func__]++;
+  return BTM_SUCCESS;
+}
+tBTM_STATUS BTM_SwitchRoleToCentral(const RawAddress& remote_bd_addr) {
+  mock_function_count_map[__func__]++;
+  return BTM_SUCCESS;
+}
+tBTM_STATUS btm_remove_acl(const RawAddress& bd_addr, tBT_TRANSPORT transport) {
+  mock_function_count_map[__func__]++;
+  return BTM_SUCCESS;
+}
+uint16_t BTM_GetHCIConnHandle(const RawAddress& remote_bda,
+                              tBT_TRANSPORT transport) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint16_t BTM_GetMaxPacketSize(const RawAddress& addr) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint16_t mock_stack_acl_num_links = 0;
+uint16_t BTM_GetNumAclLinks(void) {
+  mock_function_count_map[__func__]++;
+  return mock_stack_acl_num_links;
+}
+uint16_t acl_get_supported_packet_types() {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+tHCI_REASON btm_get_acl_disc_reason_code(void) {
+  mock_function_count_map[__func__]++;
+  return HCI_SUCCESS;
+}
+uint8_t BTM_GetPeerSCA(const RawAddress& remote_bda, tBT_TRANSPORT transport) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint8_t BTM_SetTraceLevel(uint8_t new_level) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint8_t acl_link_role_from_handle(uint16_t handle) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint8_t btm_handle_to_acl_index(uint16_t hci_handle) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint8_t* BTM_ReadRemoteFeatures(const RawAddress& addr) {
+  mock_function_count_map[__func__]++;
+  return nullptr;
+}
+void ACL_RegisterClient(struct acl_client_callback_s* callbacks) {
+  mock_function_count_map[__func__]++;
+}
+void ACL_UnregisterClient(struct acl_client_callback_s* callbacks) {
+  mock_function_count_map[__func__]++;
+}
+void BTM_ReadConnectionAddr(const RawAddress& remote_bda,
+                            RawAddress& local_conn_addr,
+                            tBLE_ADDR_TYPE* p_addr_type) {
+  mock_function_count_map[__func__]++;
+}
+void BTM_RequestPeerSCA(const RawAddress& remote_bda, tBT_TRANSPORT transport) {
+  mock_function_count_map[__func__]++;
+}
+void BTM_acl_after_controller_started(const controller_t* controller) {
+  mock_function_count_map[__func__]++;
+}
+void BTM_block_role_switch_for(const RawAddress& peer_addr) {
+  mock_function_count_map[__func__]++;
+}
+void BTM_block_sniff_mode_for(const RawAddress& peer_addr) {
+  mock_function_count_map[__func__]++;
+}
+void BTM_default_block_role_switch() { mock_function_count_map[__func__]++; }
+void BTM_default_unblock_role_switch() { mock_function_count_map[__func__]++; }
+void BTM_unblock_role_switch_for(const RawAddress& peer_addr) {
+  mock_function_count_map[__func__]++;
+}
+void BTM_unblock_sniff_mode_for(const RawAddress& peer_addr) {
+  mock_function_count_map[__func__]++;
+}
+void acl_accept_connection_request(const RawAddress& bd_addr, uint8_t role) {
+  mock_function_count_map[__func__]++;
+}
+void acl_disconnect_after_role_switch(uint16_t conn_handle,
+                                      tHCI_STATUS reason) {
+  mock_function_count_map[__func__]++;
+}
+void acl_disconnect_from_handle(uint16_t handle, tHCI_STATUS reason) {
+  mock_function_count_map[__func__]++;
+}
+void acl_link_segments_xmitted(BT_HDR* p_msg) {
+  mock_function_count_map[__func__]++;
+}
+void acl_packets_completed(uint16_t handle, uint16_t credits) {
+  mock_function_count_map[__func__]++;
+}
+void acl_process_extended_features(uint16_t handle, uint8_t current_page_number,
+                                   uint8_t max_page_number, uint64_t features) {
+  mock_function_count_map[__func__]++;
+}
+void acl_process_num_completed_pkts(uint8_t* p, uint8_t evt_len) {
+  mock_function_count_map[__func__]++;
+}
+void acl_rcv_acl_data(BT_HDR* p_msg) { mock_function_count_map[__func__]++; }
+void acl_reject_connection_request(const RawAddress& bd_addr, uint8_t reason) {
+  mock_function_count_map[__func__]++;
+}
+void acl_send_data_packet_ble(const RawAddress& bd_addr, BT_HDR* p_buf) {
+  mock_function_count_map[__func__]++;
+}
+void acl_set_disconnect_reason(tHCI_STATUS acl_disc_reason) {
+  mock_function_count_map[__func__]++;
+}
+void acl_write_automatic_flush_timeout(const RawAddress& bd_addr,
+                                       uint16_t flush_timeout_in_ticks) {
+  mock_function_count_map[__func__]++;
+}
+void btm_acl_chk_peer_pkt_type_support(tACL_CONN* p, uint16_t* p_pkt_type) {
+  mock_function_count_map[__func__]++;
+}
+void btm_acl_connected(const RawAddress& bda, uint16_t handle,
+                       tHCI_STATUS status, uint8_t enc_mode) {
+  mock_function_count_map[__func__]++;
+}
+void btm_acl_connection_request(const RawAddress& bda, uint8_t* dc) {
+  mock_function_count_map[__func__]++;
+}
+void btm_acl_created(const RawAddress& bda, uint16_t hci_handle,
+                     tHCI_ROLE link_role, tBT_TRANSPORT transport) {
+  mock_function_count_map[__func__]++;
+}
+void btm_acl_device_down(void) { mock_function_count_map[__func__]++; }
+void btm_acl_disconnected(tHCI_STATUS status, uint16_t handle,
+                          tHCI_REASON reason) {
+  mock_function_count_map[__func__]++;
+}
+void btm_acl_encrypt_change(uint16_t handle, uint8_t status,
+                            uint8_t encr_enable) {
+  mock_function_count_map[__func__]++;
+}
+void btm_acl_notif_conn_collision(const RawAddress& bda) {
+  mock_function_count_map[__func__]++;
+}
+void btm_acl_paging(BT_HDR* p, const RawAddress& bda) {
+  mock_function_count_map[__func__]++;
+}
+void btm_acl_process_sca_cmpl_pkt(uint8_t len, uint8_t* data) {
+  mock_function_count_map[__func__]++;
+}
+void btm_acl_removed(uint16_t handle) { mock_function_count_map[__func__]++; }
+void btm_acl_reset_paging(void) { mock_function_count_map[__func__]++; }
+void btm_acl_resubmit_page(void) { mock_function_count_map[__func__]++; }
+void btm_acl_role_changed(tHCI_STATUS hci_status, const RawAddress& bd_addr,
+                          tHCI_ROLE new_role) {
+  mock_function_count_map[__func__]++;
+}
+void btm_acl_set_paging(bool value) { mock_function_count_map[__func__]++; }
+void btm_acl_update_conn_addr(uint16_t handle, const RawAddress& address) {
+  mock_function_count_map[__func__]++;
+}
+void btm_acl_update_inquiry_status(uint8_t status) {
+  mock_function_count_map[__func__]++;
+}
+void btm_ble_refresh_local_resolvable_private_addr(
+    const RawAddress& pseudo_addr, const RawAddress& local_rpa) {
+  mock_function_count_map[__func__]++;
+}
+void btm_cont_rswitch_from_handle(uint16_t hci_handle) {
+  mock_function_count_map[__func__]++;
+}
+void btm_establish_continue_from_address(const RawAddress& bda,
+                                         tBT_TRANSPORT transport) {
+  mock_function_count_map[__func__]++;
+}
+void btm_process_remote_ext_features(tACL_CONN* p_acl_cb,
+                                     uint8_t num_read_pages) {
+  mock_function_count_map[__func__]++;
+}
+void btm_process_remote_version_complete(uint8_t status, uint16_t handle,
+                                         uint8_t lmp_version,
+                                         uint16_t manufacturer,
+                                         uint16_t lmp_subversion) {
+  mock_function_count_map[__func__]++;
+}
+void btm_read_automatic_flush_timeout_complete(uint8_t* p) {
+  mock_function_count_map[__func__]++;
+}
+void btm_read_failed_contact_counter_complete(uint8_t* p) {
+  mock_function_count_map[__func__]++;
+}
+void btm_read_failed_contact_counter_timeout(UNUSED_ATTR void* data) {
+  mock_function_count_map[__func__]++;
+}
+void btm_read_link_quality_complete(uint8_t* p) {
+  mock_function_count_map[__func__]++;
+}
+void btm_read_link_quality_timeout(UNUSED_ATTR void* data) {
+  mock_function_count_map[__func__]++;
+}
+void btm_read_remote_ext_features(uint16_t handle, uint8_t page_number) {
+  mock_function_count_map[__func__]++;
+}
+void btm_read_remote_ext_features_complete(uint16_t handle, uint8_t page_num,
+                                           uint8_t max_page,
+                                           uint8_t* features) {
+  mock_function_count_map[__func__]++;
+}
+void btm_read_remote_ext_features_complete_raw(uint8_t* p, uint8_t evt_len) {
+  mock_function_count_map[__func__]++;
+}
+void btm_read_remote_ext_features_failed(uint8_t status, uint16_t handle) {
+  mock_function_count_map[__func__]++;
+}
+void btm_read_remote_features_complete(uint16_t handle, uint8_t* features) {
+  mock_function_count_map[__func__]++;
+}
+void btm_read_remote_features_complete_raw(uint8_t* p) {
+  mock_function_count_map[__func__]++;
+}
+void btm_read_remote_version_complete(tHCI_STATUS status, uint16_t handle,
+                                      uint8_t lmp_version,
+                                      uint16_t manufacturer,
+                                      uint16_t lmp_subversion) {
+  mock_function_count_map[__func__]++;
+}
+void btm_read_remote_version_complete_raw(uint8_t* p) {
+  mock_function_count_map[__func__]++;
+}
+void btm_read_rssi_complete(uint8_t* p) { mock_function_count_map[__func__]++; }
+void btm_read_rssi_timeout(UNUSED_ATTR void* data) {
+  mock_function_count_map[__func__]++;
+}
+void btm_read_tx_power_complete(uint8_t* p, bool is_ble) {
+  mock_function_count_map[__func__]++;
+}
+void btm_read_tx_power_timeout(UNUSED_ATTR void* data) {
+  mock_function_count_map[__func__]++;
+}
+void btm_rejectlist_role_change_device(const RawAddress& bd_addr,
+                                       uint8_t hci_status) {
+  mock_function_count_map[__func__]++;
+}
+void btm_set_link_policy(tACL_CONN* conn, tLINK_POLICY policy) {
+  mock_function_count_map[__func__]++;
+}
+void btm_set_packet_types_from_address(const RawAddress& bd_addr,
+                                       uint16_t pkt_types) {
+  mock_function_count_map[__func__]++;
+}
+void hci_btm_set_link_supervision_timeout(tACL_CONN& link, uint16_t timeout) {
+  mock_function_count_map[__func__]++;
+}
+void on_acl_br_edr_connected(const RawAddress& bda, uint16_t handle,
+                             uint8_t enc_mode) {
+  mock_function_count_map[__func__]++;
+}
+void on_acl_br_edr_failed(const RawAddress& bda, tHCI_STATUS status) {
+  mock_function_count_map[__func__]++;
+}
diff --git a/system/test/mock/mock_stack_avct_api.cc b/system/test/mock/mock_stack_avct_api.cc
new file mode 100644
index 00000000000..4c20810a6a6
--- /dev/null
+++ b/system/test/mock/mock_stack_avct_api.cc
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:9
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include <string.h>
+#include "avct_api.h"
+#include "bt_common.h"
+#include "bt_target.h"
+#include "bt_types.h"
+#include "bt_utils.h"
+#include "bta/include/bta_api.h"
+#include "btm_api.h"
+#include "l2c_api.h"
+#include "l2cdefs.h"
+#include "osi/include/osi.h"
+#include "stack/avct/avct_int.h"
+#include "stack/btm/btm_sec.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+uint16_t AVCT_CreateBrowse(uint8_t handle, uint8_t role) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint16_t AVCT_CreateConn(uint8_t* p_handle, tAVCT_CC* p_cc,
+                         const RawAddress& peer_addr) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint16_t AVCT_GetBrowseMtu(uint8_t handle) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint16_t AVCT_GetPeerMtu(uint8_t handle) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint16_t AVCT_MsgReq(uint8_t handle, uint8_t label, uint8_t cr, BT_HDR* p_msg) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint16_t AVCT_RemoveBrowse(uint8_t handle) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint16_t AVCT_RemoveConn(uint8_t handle) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+void AVCT_Deregister(void) { mock_function_count_map[__func__]++; }
+void AVCT_Register() { mock_function_count_map[__func__]++; }
diff --git a/system/test/mock/mock_stack_avdt_api.cc b/system/test/mock/mock_stack_avdt_api.cc
new file mode 100644
index 00000000000..e3051687cea
--- /dev/null
+++ b/system/test/mock/mock_stack_avdt_api.cc
@@ -0,0 +1,147 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:26
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include <string.h>
+#include "avdt_api.h"
+#include "avdt_int.h"
+#include "avdtc_api.h"
+#include "bt_target.h"
+#include "bt_types.h"
+#include "bta/include/bta_api.h"
+#include "btm_api.h"
+#include "btu.h"
+#include "l2c_api.h"
+#include "main/shim/dumpsys.h"
+#include "osi/include/log.h"
+#include "stack/btm/btm_sec.h"
+#include "stack/include/a2dp_codec_api.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+uint16_t AVDT_CloseReq(uint8_t handle) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint16_t AVDT_ConfigRsp(uint8_t handle, uint8_t label, uint8_t error_code,
+                        uint8_t category) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint16_t AVDT_ConnectReq(const RawAddress& bd_addr, uint8_t channel_index,
+                         tAVDT_CTRL_CBACK* p_cback) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint16_t AVDT_CreateStream(uint8_t peer_id, uint8_t* p_handle,
+                           const AvdtpStreamConfig& avdtp_stream_config) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint16_t AVDT_DelayReport(uint8_t handle, uint8_t seid, uint16_t delay) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint16_t AVDT_DisconnectReq(const RawAddress& bd_addr,
+                            tAVDT_CTRL_CBACK* p_cback) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint16_t AVDT_DiscoverReq(const RawAddress& bd_addr, uint8_t channel_index,
+                          tAVDT_SEP_INFO* p_sep_info, uint8_t max_seps,
+                          tAVDT_CTRL_CBACK* p_cback) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint16_t AVDT_GetCapReq(const RawAddress& bd_addr, uint8_t channel_index,
+                        uint8_t seid, AvdtpSepConfig* p_cfg,
+                        tAVDT_CTRL_CBACK* p_cback, bool get_all_cap) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint16_t AVDT_GetL2CapChannel(uint8_t handle) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint16_t AVDT_OpenReq(uint8_t handle, const RawAddress& bd_addr,
+                      uint8_t channel_index, uint8_t seid,
+                      AvdtpSepConfig* p_cfg) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint16_t AVDT_ReconfigReq(uint8_t handle, AvdtpSepConfig* p_cfg) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint16_t AVDT_RemoveStream(uint8_t handle) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint16_t AVDT_SecurityReq(uint8_t handle, uint8_t* p_data, uint16_t len) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint16_t AVDT_SecurityRsp(uint8_t handle, uint8_t label, uint8_t error_code,
+                          uint8_t* p_data, uint16_t len) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint16_t AVDT_StartReq(uint8_t* p_handles, uint8_t num_handles) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint16_t AVDT_SuspendReq(uint8_t* p_handles, uint8_t num_handles) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint16_t AVDT_WriteReqOpt(uint8_t handle, BT_HDR* p_pkt, uint32_t time_stamp,
+                          uint8_t m_pt, tAVDT_DATA_OPT_MASK opt) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint8_t AVDT_SetTraceLevel(uint8_t new_level) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+void AVDT_AbortReq(uint8_t handle) { mock_function_count_map[__func__]++; }
+void AVDT_Deregister(void) { mock_function_count_map[__func__]++; }
+void AVDT_Register(AvdtpRcb* p_reg, tAVDT_CTRL_CBACK* p_cback) {
+  mock_function_count_map[__func__]++;
+}
+void avdt_ccb_idle_ccb_timer_timeout(void* data) {
+  mock_function_count_map[__func__]++;
+}
+void avdt_ccb_ret_ccb_timer_timeout(void* data) {
+  mock_function_count_map[__func__]++;
+}
+void avdt_ccb_rsp_ccb_timer_timeout(void* data) {
+  mock_function_count_map[__func__]++;
+}
+void avdt_scb_transport_channel_timer_timeout(void* data) {
+  mock_function_count_map[__func__]++;
+}
+void stack_debug_avdtp_api_dump(int fd) { mock_function_count_map[__func__]++; }
diff --git a/system/test/mock/mock_stack_avrc_api.cc b/system/test/mock/mock_stack_avrc_api.cc
new file mode 100644
index 00000000000..8214af36c5c
--- /dev/null
+++ b/system/test/mock/mock_stack_avrc_api.cc
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:14
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include <base/logging.h>
+#include <string.h>
+#include "bt_common.h"
+#include "osi/include/fixed_queue.h"
+#include "osi/include/log.h"
+#include "osi/include/osi.h"
+#include "osi/include/properties.h"
+#include "stack/avrc/avrc_int.h"
+#include "stack/include/avrc_api.h"
+#include "stack/include/btu.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+uint16_t AVRC_Close(uint8_t handle) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint16_t AVRC_CloseBrowse(uint8_t handle) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint16_t AVRC_GetProfileVersion() {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint16_t AVRC_MsgReq(uint8_t handle, uint8_t label, uint8_t ctype,
+                     BT_HDR* p_pkt) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint16_t AVRC_Open(uint8_t* p_handle, tAVRC_CONN_CB* p_ccb,
+                   const RawAddress& peer_addr) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint16_t AVRC_OpenBrowse(uint8_t handle, uint8_t conn_role) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint16_t AVRC_PassCmd(uint8_t handle, uint8_t label, tAVRC_MSG_PASS* p_msg) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint16_t AVRC_PassRsp(uint8_t handle, uint8_t label, tAVRC_MSG_PASS* p_msg) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+void avrc_flush_cmd_q(uint8_t handle) { mock_function_count_map[__func__]++; }
+void avrc_process_timeout(void* data) { mock_function_count_map[__func__]++; }
+void avrc_send_next_vendor_cmd(uint8_t handle) {
+  mock_function_count_map[__func__]++;
+}
+void avrc_start_cmd_timer(uint8_t handle, uint8_t label, uint8_t msg_mask) {
+  mock_function_count_map[__func__]++;
+}
diff --git a/system/test/mock/mock_stack_avrc_bld_ct.cc b/system/test/mock/mock_stack_avrc_bld_ct.cc
new file mode 100644
index 00000000000..011fe60e8b8
--- /dev/null
+++ b/system/test/mock/mock_stack_avrc_bld_ct.cc
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:2
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include <string.h>
+#include "avrc_api.h"
+#include "avrc_defs.h"
+#include "bt_common.h"
+#include "stack/avrc/avrc_int.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+tAVRC_STS AVRC_BldCommand(tAVRC_COMMAND* p_cmd, BT_HDR** pp_pkt) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
diff --git a/system/test/mock/mock_stack_avrc_bld_tg.cc b/system/test/mock/mock_stack_avrc_bld_tg.cc
new file mode 100644
index 00000000000..96ebee02591
--- /dev/null
+++ b/system/test/mock/mock_stack_avrc_bld_tg.cc
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:3
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include <base/logging.h>
+#include <string.h>
+#include "avrc_api.h"
+#include "avrc_defs.h"
+#include "bt_common.h"
+#include "bt_utils.h"
+#include "osi/include/osi.h"
+#include "stack/avrc/avrc_int.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+tAVRC_STS AVRC_BldResponse(uint8_t handle, tAVRC_RESPONSE* p_rsp,
+                           BT_HDR** pp_pkt) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+tAVRC_STS avrc_bld_group_navigation_rsp(uint16_t navi_id, BT_HDR* p_pkt) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
diff --git a/system/test/mock/mock_stack_avrc_pars.ct.cc b/system/test/mock/mock_stack_avrc_pars.ct.cc
new file mode 100644
index 00000000000..d4d4ee43f8d
--- /dev/null
+++ b/system/test/mock/mock_stack_avrc_pars.ct.cc
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:4
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include <string.h>
+#include "avrc_api.h"
+#include "avrc_defs.h"
+#include "bt_common.h"
+#include "bt_utils.h"
+#include "osi/include/log.h"
+#include "osi/include/osi.h"
+#include "stack/avrc/avrc_int.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+tAVRC_STS AVRC_Ctrl_ParsResponse(tAVRC_MSG* p_msg, tAVRC_RESPONSE* p_result,
+                                 uint8_t* p_buf, uint16_t* buf_len) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+tAVRC_STS AVRC_ParsResponse(tAVRC_MSG* p_msg, tAVRC_RESPONSE* p_result,
+                            UNUSED_ATTR uint8_t* p_buf,
+                            UNUSED_ATTR uint16_t buf_len) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+tAVRC_STS avrc_parse_notification_rsp(uint8_t* p_stream, uint16_t len,
+                                      tAVRC_REG_NOTIF_RSP* p_rsp) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
diff --git a/system/test/mock/mock_stack_avrc_pars_tg.cc b/system/test/mock/mock_stack_avrc_pars_tg.cc
new file mode 100644
index 00000000000..9033d59007d
--- /dev/null
+++ b/system/test/mock/mock_stack_avrc_pars_tg.cc
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:4
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include <string.h>
+#include "avrc_api.h"
+#include "avrc_defs.h"
+#include "bt_common.h"
+#include "osi/include/log.h"
+#include "stack/avrc/avrc_int.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+tAVRC_STS AVRC_Ctrl_ParsCommand(tAVRC_MSG* p_msg, tAVRC_COMMAND* p_result) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+tAVRC_STS AVRC_ParsCommand(tAVRC_MSG* p_msg, tAVRC_COMMAND* p_result,
+                           uint8_t* p_buf, uint16_t buf_len) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
diff --git a/system/test/mock/mock_stack_avrc_sdp.cc b/system/test/mock/mock_stack_avrc_sdp.cc
new file mode 100644
index 00000000000..52209bb6420
--- /dev/null
+++ b/system/test/mock/mock_stack_avrc_sdp.cc
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:7
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include <string.h>
+
+#include "bt_common.h"
+#include "stack/avrc/avrc_int.h"
+#include "stack/include/avrc_api.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+uint16_t AVRC_AddRecord(uint16_t service_uuid, const char* p_service_name,
+                        const char* p_provider_name, uint16_t categories,
+                        uint32_t sdp_handle, bool browse_supported,
+                        uint16_t profile_version, uint16_t cover_art_psm) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint16_t AVRC_FindService(uint16_t service_uuid, const RawAddress& bd_addr,
+                          tAVRC_SDP_DB_PARAMS* p_db,
+                          const tAVRC_FIND_CBACK& find_cback) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint16_t AVRC_RemoveRecord(uint32_t sdp_handle) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint8_t AVRC_SetTraceLevel(uint8_t new_level) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+void AVRC_Init(void) { mock_function_count_map[__func__]++; }
diff --git a/system/test/mock/mock_stack_bnep_api.cc b/system/test/mock/mock_stack_bnep_api.cc
new file mode 100644
index 00000000000..0743317acae
--- /dev/null
+++ b/system/test/mock/mock_stack_bnep_api.cc
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:11
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include <string.h>
+#include "bta/include/bta_api.h"
+#include "stack/bnep/bnep_int.h"
+#include "stack/btm/btm_sec.h"
+#include "stack/include/bnep_api.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+using namespace bluetooth;
+
+tBNEP_RESULT BNEP_Connect(const RawAddress& p_rem_bda, const Uuid& src_uuid,
+                          const Uuid& dst_uuid, uint16_t* p_handle,
+                          uint32_t mx_chan_id) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+tBNEP_RESULT BNEP_ConnectResp(uint16_t handle, tBNEP_RESULT resp) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+tBNEP_RESULT BNEP_Disconnect(uint16_t handle) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+tBNEP_RESULT BNEP_Register(tBNEP_REGISTER* p_reg_info) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+tBNEP_RESULT BNEP_SetMulticastFilters(uint16_t handle, uint16_t num_filters,
+                                      uint8_t* p_start_array,
+                                      uint8_t* p_end_array) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+tBNEP_RESULT BNEP_SetProtocolFilters(uint16_t handle, uint16_t num_filters,
+                                     uint16_t* p_start_array,
+                                     uint16_t* p_end_array) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+tBNEP_RESULT BNEP_Write(uint16_t handle, const RawAddress& p_dest_addr,
+                        uint8_t* p_data, uint16_t len, uint16_t protocol,
+                        const RawAddress* p_src_addr, bool fw_ext_present) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+tBNEP_RESULT BNEP_WriteBuf(uint16_t handle, const RawAddress& p_dest_addr,
+                           BT_HDR* p_buf, uint16_t protocol,
+                           const RawAddress* p_src_addr, bool fw_ext_present) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint8_t BNEP_SetTraceLevel(uint8_t new_level) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+void BNEP_Deregister(void) { mock_function_count_map[__func__]++; }
+void BNEP_Init(void) { mock_function_count_map[__func__]++; }
diff --git a/system/test/mock/mock_stack_btm.cc b/system/test/mock/mock_stack_btm.cc
new file mode 100644
index 00000000000..12f62afa490
--- /dev/null
+++ b/system/test/mock/mock_stack_btm.cc
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ */
+
+#include "stack/include/btm_ble_api_types.h"
+#include "stack/include/btm_client_interface.h"
+#include "types/raw_address.h"
+
+bool BTM_HasEirService(const uint32_t* p_eir_uuid, uint16_t uuid16) {
+  return false;
+}
+tBTM_INQ_INFO* BTM_InqDbFirst(void) { return nullptr; }
+tBTM_INQ_INFO* BTM_InqDbNext(tBTM_INQ_INFO* p_cur) { return nullptr; }
+tBTM_INQ_INFO* BTM_InqDbRead(const RawAddress& p_bda) { return nullptr; }
+tBTM_STATUS BTM_CancelRemoteDeviceName(void) { return BTM_SUCCESS; }
+tBTM_STATUS BTM_ClearInqDb(const RawAddress* p_bda) { return BTM_SUCCESS; }
+tBTM_STATUS BTM_ReadRemoteDeviceName(const RawAddress& remote_bda,
+                                     tBTM_CMPL_CB* p_cb,
+                                     tBT_TRANSPORT transport) {
+  return BTM_SUCCESS;
+}
+tBTM_STATUS BTM_SetConnectability(uint16_t page_mode) { return BTM_SUCCESS; }
+tBTM_STATUS BTM_StartInquiry(tBTM_INQ_RESULTS_CB* p_results_cb,
+                             tBTM_CMPL_CB* p_cmpl_cb) {
+  return BTM_SUCCESS;
+}
+tBTM_STATUS BTM_WriteEIR(BT_HDR* p_buff) { return BTM_SUCCESS; }
+tBTM_STATUS BTM_SetDiscoverability(uint16_t inq_mode) { return BTM_SUCCESS; }
+tBTM_STATUS BTM_BleGetEnergyInfo(tBTM_BLE_ENERGY_INFO_CBACK* p_ener_cback) {
+  return BTM_SUCCESS;
+}
+uint16_t BTM_IsInquiryActive(void) { return 0; }
+uint8_t BTM_GetEirSupportedServices(uint32_t* p_eir_uuid, uint8_t** p,
+                                    uint8_t max_num_uuid16,
+                                    uint8_t* p_num_uuid16) {
+  return 0;
+}
+void BTM_AddEirService(uint32_t* p_eir_uuid, uint16_t uuid16) {}
+void BTM_BleReadControllerFeatures(tBTM_BLE_CTRL_FEATURES_CBACK* p_vsc_cback) {}
+void BTM_CancelInquiry(void) {}
+void BTM_RemoveEirService(uint32_t* p_eir_uuid, uint16_t uuid16) {}
+bool BTM_is_sniff_allowed_for(const RawAddress& peer_addr) { return false; }
+uint8_t BTM_GetAcceptlistSize() { return 0; }
+
+struct btm_client_interface_s btm_client_interface = {};
+
+struct btm_client_interface_s& get_btm_client_interface() {
+  return btm_client_interface;
+}
diff --git a/system/test/mock/mock_stack_btm_ble.cc b/system/test/mock/mock_stack_btm_ble.cc
new file mode 100644
index 00000000000..835b1d230d1
--- /dev/null
+++ b/system/test/mock/mock_stack_btm_ble.cc
@@ -0,0 +1,256 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:50
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include <cstdint>
+#include "device/include/controller.h"
+#include "main/shim/btm_api.h"
+#include "main/shim/l2c_api.h"
+#include "main/shim/shim.h"
+#include "stack/btm/btm_dev.h"
+#include "stack/btm/btm_int_types.h"
+#include "stack/btm/security_device_record.h"
+#include "stack/crypto_toolbox/crypto_toolbox.h"
+#include "stack/include/acl_api.h"
+#include "stack/include/bt_types.h"
+#include "stack/include/btm_api.h"
+#include "stack/include/btu.h"
+#include "stack/include/gatt_api.h"
+#include "stack/include/l2cap_security_interface.h"
+#include "stack/include/l2cdefs.h"
+#include "stack/include/smp_api.h"
+#include "types/raw_address.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+bool BTM_BleDataSignature(const RawAddress& bd_addr, uint8_t* p_text,
+                          uint16_t len, BLE_SIGNATURE signature) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool BTM_BleVerifySignature(const RawAddress& bd_addr, uint8_t* p_orig,
+                            uint16_t len, uint32_t counter, uint8_t* p_comp) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool BTM_ReadConnectedTransportAddress(RawAddress* remote_bda,
+                                       tBT_TRANSPORT transport) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool BTM_UseLeLink(const RawAddress& bd_addr) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool btm_ble_get_acl_remote_addr(uint16_t hci_handle, RawAddress& conn_addr,
+                                 tBLE_ADDR_TYPE* p_addr_type) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool btm_ble_get_enc_key_type(const RawAddress& bd_addr, uint8_t* p_key_types) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool btm_get_local_div(const RawAddress& bd_addr, uint16_t* p_div) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+static Octet16 octet16;
+
+const Octet16& BTM_GetDeviceDHK() {
+  mock_function_count_map[__func__]++;
+  return octet16;
+}
+const Octet16& BTM_GetDeviceEncRoot() {
+  mock_function_count_map[__func__]++;
+  return octet16;
+}
+const Octet16& BTM_GetDeviceIDRoot() {
+  mock_function_count_map[__func__]++;
+  return octet16;
+}
+tBTM_SEC_ACTION btm_ble_determine_security_act(bool is_originator,
+                                               const RawAddress& bdaddr,
+                                               uint16_t security_required) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+tBTM_STATUS BTM_SetBleDataLength(const RawAddress& bd_addr,
+                                 uint16_t tx_pdu_length) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+tBTM_STATUS btm_ble_set_encryption(const RawAddress& bd_addr,
+                                   tBTM_BLE_SEC_ACT sec_act,
+                                   uint8_t link_role) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+tBTM_STATUS btm_ble_start_encrypt(const RawAddress& bda, bool use_stk,
+                                  Octet16* p_stk) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+tBTM_STATUS btm_proc_smp_cback(tSMP_EVT event, const RawAddress& bd_addr,
+                               tSMP_EVT_DATA* p_data) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+tL2CAP_LE_RESULT_CODE btm_ble_start_sec_check(const RawAddress& bd_addr,
+                                              uint16_t psm, bool is_originator,
+                                              tBTM_SEC_CALLBACK* p_callback,
+                                              void* p_ref_data) {
+  mock_function_count_map[__func__]++;
+  return L2CAP_LE_RESULT_CONN_OK;
+}
+uint8_t btm_ble_br_keys_req(tBTM_SEC_DEV_REC* p_dev_rec,
+                            tBTM_LE_IO_REQ* p_data) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint8_t btm_ble_io_capabilities_req(tBTM_SEC_DEV_REC* p_dev_rec,
+                                    tBTM_LE_IO_REQ* p_data) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint8_t btm_ble_read_sec_key_size(const RawAddress& bd_addr) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+void BTM_BleConfirmReply(const RawAddress& bd_addr, uint8_t res) {
+  mock_function_count_map[__func__]++;
+}
+void BTM_BleLoadLocalKeys(uint8_t key_type, tBTM_BLE_LOCAL_KEYS* p_key) {
+  mock_function_count_map[__func__]++;
+}
+void BTM_BleOobDataReply(const RawAddress& bd_addr, uint8_t res, uint8_t len,
+                         uint8_t* p_data) {
+  mock_function_count_map[__func__]++;
+}
+void BTM_BlePasskeyReply(const RawAddress& bd_addr, uint8_t res,
+                         uint32_t passkey) {
+  mock_function_count_map[__func__]++;
+}
+void BTM_BleReadPhy(
+    const RawAddress& bd_addr,
+    base::Callback<void(uint8_t tx_phy, uint8_t rx_phy, uint8_t status)> cb) {
+  mock_function_count_map[__func__]++;
+}
+void BTM_BleReceiverTest(uint8_t rx_freq, tBTM_CMPL_CB* p_cmd_cmpl_cback) {
+  mock_function_count_map[__func__]++;
+}
+void BTM_BleSecureConnectionOobDataReply(const RawAddress& bd_addr,
+                                         uint8_t* p_c, uint8_t* p_r) {
+  mock_function_count_map[__func__]++;
+}
+void BTM_BleSetPhy(const RawAddress& bd_addr, uint8_t tx_phys, uint8_t rx_phys,
+                   uint16_t phy_options) {
+  mock_function_count_map[__func__]++;
+}
+void BTM_BleSetPrefConnParams(const RawAddress& bd_addr, uint16_t min_conn_int,
+                              uint16_t max_conn_int,
+                              uint16_t peripheral_latency,
+                              uint16_t supervision_tout) {
+  mock_function_count_map[__func__]++;
+}
+void BTM_BleTestEnd(tBTM_CMPL_CB* p_cmd_cmpl_cback) {
+  mock_function_count_map[__func__]++;
+}
+void BTM_BleTransmitterTest(uint8_t tx_freq, uint8_t test_data_len,
+                            uint8_t packet_payload,
+                            tBTM_CMPL_CB* p_cmd_cmpl_cback) {
+  mock_function_count_map[__func__]++;
+}
+void BTM_ReadDevInfo(const RawAddress& remote_bda, tBT_DEVICE_TYPE* p_dev_type,
+                     tBLE_ADDR_TYPE* p_addr_type) {
+  mock_function_count_map[__func__]++;
+}
+void BTM_SecAddBleDevice(const RawAddress& bd_addr, tBT_DEVICE_TYPE dev_type,
+                         tBLE_ADDR_TYPE addr_type) {
+  mock_function_count_map[__func__]++;
+}
+void BTM_SecAddBleKey(const RawAddress& bd_addr, tBTM_LE_KEY_VALUE* p_le_key,
+                      tBTM_LE_KEY_TYPE key_type) {
+  mock_function_count_map[__func__]++;
+}
+void BTM_SecurityGrant(const RawAddress& bd_addr, uint8_t res) {
+  mock_function_count_map[__func__]++;
+}
+void btm_ble_connected(const RawAddress& bda, uint16_t handle, uint8_t enc_mode,
+                       uint8_t role, tBLE_ADDR_TYPE addr_type,
+                       bool addr_matched) {
+  mock_function_count_map[__func__]++;
+}
+void btm_ble_connected_from_address_with_type(
+    const tBLE_BD_ADDR& address_with_type, uint16_t handle, uint8_t enc_mode,
+    uint8_t role, bool addr_matched) {
+  mock_function_count_map[__func__]++;
+}
+void btm_ble_increment_sign_ctr(const RawAddress& bd_addr, bool is_local) {
+  mock_function_count_map[__func__]++;
+}
+void btm_ble_link_encrypted(const RawAddress& bd_addr, uint8_t encr_enable) {
+  mock_function_count_map[__func__]++;
+}
+void btm_ble_link_sec_check(const RawAddress& bd_addr,
+                            tBTM_LE_AUTH_REQ auth_req,
+                            tBTM_BLE_SEC_REQ_ACT* p_sec_req_act) {
+  mock_function_count_map[__func__]++;
+}
+void btm_ble_ltk_request(uint16_t handle, uint8_t rand[8], uint16_t ediv) {
+  mock_function_count_map[__func__]++;
+}
+void btm_ble_ltk_request_reply(const RawAddress& bda, bool use_stk,
+                               const Octet16& stk) {
+  mock_function_count_map[__func__]++;
+}
+void btm_ble_rand_enc_complete(uint8_t* p, uint16_t op_code,
+                               tBTM_RAND_ENC_CB* p_enc_cplt_cback) {
+  mock_function_count_map[__func__]++;
+}
+void btm_ble_set_random_address(const RawAddress& random_bda) {
+  mock_function_count_map[__func__]++;
+}
+void btm_ble_test_command_complete(uint8_t* p) {
+  mock_function_count_map[__func__]++;
+}
+void btm_ble_update_sec_key_size(const RawAddress& bd_addr,
+                                 uint8_t enc_key_size) {
+  mock_function_count_map[__func__]++;
+}
+void btm_sec_save_le_key(const RawAddress& bd_addr, tBTM_LE_KEY_TYPE key_type,
+                         tBTM_LE_KEY_VALUE* p_keys, bool pass_to_application) {
+  mock_function_count_map[__func__]++;
+}
+void doNothing(uint8_t* data, uint16_t len) {
+  mock_function_count_map[__func__]++;
+}
+void read_phy_cb(
+    base::Callback<void(uint8_t tx_phy, uint8_t rx_phy, uint8_t status)> cb,
+    uint8_t* data, uint16_t len) {
+  mock_function_count_map[__func__]++;
+}
diff --git a/system/test/mock/mock_stack_btm_ble_adv_filter.cc b/system/test/mock/mock_stack_btm_ble_adv_filter.cc
new file mode 100644
index 00000000000..c65dea059a9
--- /dev/null
+++ b/system/test/mock/mock_stack_btm_ble_adv_filter.cc
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:6
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include <base/bind.h>
+#include <base/bind_helpers.h>
+#include <string.h>
+#include <algorithm>
+#include <vector>
+#include "bt_target.h"
+#include "bt_types.h"
+#include "btm_ble_api.h"
+#include "btm_int.h"
+#include "btu.h"
+#include "device/include/controller.h"
+#include "hcidefs.h"
+#include "hcimsgs.h"
+#include "stack/btm/btm_ble_int.h"
+#include "stack/btm/btm_int_types.h"
+#include "utils/include/bt_utils.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+void BTM_BleAdvFilterParamSetup(
+    int action, tBTM_BLE_PF_FILT_INDEX filt_index,
+    std::unique_ptr<btgatt_filt_param_setup_t> p_filt_params,
+    tBTM_BLE_PF_PARAM_CB cb) {
+  mock_function_count_map[__func__]++;
+}
+void BTM_BleEnableDisableFilterFeature(uint8_t enable,
+                                       tBTM_BLE_PF_STATUS_CBACK p_stat_cback) {
+  mock_function_count_map[__func__]++;
+}
+void BTM_LE_PF_clear(tBTM_BLE_PF_FILT_INDEX filt_index,
+                     tBTM_BLE_PF_CFG_CBACK cb) {
+  mock_function_count_map[__func__]++;
+}
+void BTM_LE_PF_set(tBTM_BLE_PF_FILT_INDEX filt_index,
+                   std::vector<ApcfCommand> commands,
+                   tBTM_BLE_PF_CFG_CBACK cb) {
+  mock_function_count_map[__func__]++;
+}
+void btm_ble_adv_filter_init(void) { mock_function_count_map[__func__]++; }
diff --git a/system/test/mock/mock_stack_btm_ble_batchscan.cc b/system/test/mock/mock_stack_btm_ble_batchscan.cc
new file mode 100644
index 00000000000..143783b02c5
--- /dev/null
+++ b/system/test/mock/mock_stack_btm_ble_batchscan.cc
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:7
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include <base/bind.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <string.h>
+#include <vector>
+#include "bt_target.h"
+#include "bt_types.h"
+#include "btm_ble_api.h"
+#include "btm_int.h"
+#include "btu.h"
+#include "device/include/controller.h"
+#include "hcimsgs.h"
+#include "stack/btm/btm_int_types.h"
+#include "utils/include/bt_utils.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+void BTM_BleDisableBatchScan(base::Callback<void(uint8_t)> cb) {
+  mock_function_count_map[__func__]++;
+}
+void BTM_BleEnableBatchScan(tBTM_BLE_BATCH_SCAN_MODE scan_mode,
+                            uint32_t scan_interval, uint32_t scan_window,
+                            tBLE_ADDR_TYPE addr_type,
+                            tBTM_BLE_DISCARD_RULE discard_rule,
+                            base::Callback<void(uint8_t)> cb) {
+  mock_function_count_map[__func__]++;
+}
+void BTM_BleReadScanReports(tBTM_BLE_BATCH_SCAN_MODE scan_mode,
+                            tBTM_BLE_SCAN_REP_CBACK cb) {
+  mock_function_count_map[__func__]++;
+}
+void BTM_BleSetStorageConfig(uint8_t batch_scan_full_max,
+                             uint8_t batch_scan_trunc_max,
+                             uint8_t batch_scan_notify_threshold,
+                             base::Callback<void(uint8_t)> cb,
+                             tBTM_BLE_SCAN_THRESHOLD_CBACK* p_thres_cback,
+                             tBTM_BLE_REF_VALUE ref_value) {
+  mock_function_count_map[__func__]++;
+}
+void BTM_BleTrackAdvertiser(tBTM_BLE_TRACK_ADV_CBACK* p_track_cback,
+                            tBTM_BLE_REF_VALUE ref_value) {
+  mock_function_count_map[__func__]++;
+}
+void btm_ble_batchscan_init(void) { mock_function_count_map[__func__]++; }
diff --git a/system/test/mock/mock_stack_btm_ble_gap.cc b/system/test/mock/mock_stack_btm_ble_gap.cc
new file mode 100644
index 00000000000..582a2dc4004
--- /dev/null
+++ b/system/test/mock/mock_stack_btm_ble_gap.cc
@@ -0,0 +1,213 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:47
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include <base/bind.h>
+#include <base/strings/string_number_conversions.h>
+#include <cstdint>
+#include <list>
+#include <memory>
+#include <vector>
+#include "common/time_util.h"
+#include "device/include/controller.h"
+#include "main/shim/acl_api.h"
+#include "main/shim/btm_api.h"
+#include "main/shim/shim.h"
+#include "osi/include/log.h"
+#include "stack/btm/btm_ble_int.h"
+#include "stack/btm/btm_ble_int_types.h"
+#include "stack/btm/btm_dev.h"
+#include "stack/btm/btm_int_types.h"
+#include "stack/gatt/gatt_int.h"
+#include "stack/include/acl_api.h"
+#include "stack/include/advertise_data_parser.h"
+#include "stack/include/bt_types.h"
+#include "stack/include/btm_api_types.h"
+#include "stack/include/gap_api.h"
+#include "stack/include/hci_error_code.h"
+#include "stack/include/hcimsgs.h"
+#include "stack/include/inq_hci_link_interface.h"
+#include "types/raw_address.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+bool BTM_BleConfigPrivacy(bool privacy_mode) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool BTM_BleLocalPrivacyEnabled(void) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool btm_ble_cancel_remote_name(const RawAddress& remote_bda) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool btm_ble_clear_topology_mask(tBTM_BLE_STATE_MASK request_state_mask) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool btm_ble_set_topology_mask(tBTM_BLE_STATE_MASK request_state_mask) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool btm_ble_topology_check(tBTM_BLE_STATE_MASK request_state_mask) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+tBTM_STATUS BTM_BleObserve(bool start, uint8_t duration,
+                           tBTM_INQ_RESULTS_CB* p_results_cb,
+                           tBTM_CMPL_CB* p_cmpl_cb) {
+  mock_function_count_map[__func__]++;
+  return BTM_SUCCESS;
+}
+tBTM_STATUS btm_ble_read_remote_name(const RawAddress& remote_bda,
+                                     tBTM_CMPL_CB* p_cb) {
+  mock_function_count_map[__func__]++;
+  return BTM_SUCCESS;
+}
+tBTM_STATUS btm_ble_set_connectability(uint16_t combined_mode) {
+  mock_function_count_map[__func__]++;
+  return BTM_SUCCESS;
+}
+tBTM_STATUS btm_ble_set_discoverability(uint16_t combined_mode) {
+  mock_function_count_map[__func__]++;
+  return BTM_SUCCESS;
+}
+tBTM_STATUS btm_ble_start_adv(void) {
+  mock_function_count_map[__func__]++;
+  return BTM_SUCCESS;
+}
+tBTM_STATUS btm_ble_start_inquiry(uint8_t duration) {
+  mock_function_count_map[__func__]++;
+  return BTM_SUCCESS;
+}
+tBTM_STATUS btm_ble_stop_adv(void) {
+  mock_function_count_map[__func__]++;
+  return BTM_SUCCESS;
+}
+uint16_t BTM_BleReadConnectability() {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint16_t BTM_BleReadDiscoverability() {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint8_t BTM_BleMaxMultiAdvInstanceCount(void) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+void BTM_BleGetDynamicAudioBuffer(
+    tBTM_BT_DYNAMIC_AUDIO_BUFFER_CB p_dynamic_audio_buffer_cb[]) {
+  mock_function_count_map[__func__]++;
+}
+void BTM_BleGetVendorCapabilities(tBTM_BLE_VSC_CB* p_cmn_vsc_cb) {
+  mock_function_count_map[__func__]++;
+}
+void BTM_BleSetScanParams(uint32_t scan_interval, uint32_t scan_window,
+                          tBLE_SCAN_MODE scan_mode,
+                          base::Callback<void(uint8_t)> cb) {
+  mock_function_count_map[__func__]++;
+}
+void btm_ble_decrement_link_topology_mask(uint8_t link_role) {
+  mock_function_count_map[__func__]++;
+}
+void btm_ble_dir_adv_tout(void) { mock_function_count_map[__func__]++; }
+void btm_ble_free() { mock_function_count_map[__func__]++; }
+void btm_ble_increment_link_topology_mask(uint8_t link_role) {
+  mock_function_count_map[__func__]++;
+}
+void btm_ble_init(void) { mock_function_count_map[__func__]++; }
+void btm_ble_process_adv_addr(RawAddress& bda, uint8_t* addr_type) {
+  mock_function_count_map[__func__]++;
+}
+void btm_ble_process_adv_pkt(uint8_t data_len, uint8_t* data) {
+  mock_function_count_map[__func__]++;
+}
+void btm_ble_process_adv_pkt_cont(uint16_t evt_type, uint8_t addr_type,
+                                  const RawAddress& bda, uint8_t primary_phy,
+                                  uint8_t secondary_phy,
+                                  uint8_t advertising_sid, int8_t tx_power,
+                                  int8_t rssi, uint16_t periodic_adv_int,
+                                  uint8_t data_len, uint8_t* data) {
+  mock_function_count_map[__func__]++;
+}
+void btm_ble_process_adv_pkt_cont_for_inquiry(
+    uint16_t evt_type, uint8_t addr_type, const RawAddress& bda,
+    uint8_t primary_phy, uint8_t secondary_phy, uint8_t advertising_sid,
+    int8_t tx_power, int8_t rssi, uint16_t periodic_adv_int,
+    std::vector<uint8_t> advertising_data) {
+  mock_function_count_map[__func__]++;
+}
+void btm_ble_process_ext_adv_pkt(uint8_t data_len, uint8_t* data) {
+  mock_function_count_map[__func__]++;
+}
+void btm_ble_process_phy_update_pkt(uint8_t len, uint8_t* data) {
+  mock_function_count_map[__func__]++;
+}
+void btm_ble_read_remote_features_complete(uint8_t* p) {
+  mock_function_count_map[__func__]++;
+}
+void btm_ble_read_remote_name_cmpl(bool status, const RawAddress& bda,
+                                   uint16_t length, char* p_name) {
+  mock_function_count_map[__func__]++;
+}
+void btm_ble_set_adv_flag(uint16_t connect_mode, uint16_t disc_mode) {
+  mock_function_count_map[__func__]++;
+}
+void btm_ble_start_scan() { mock_function_count_map[__func__]++; }
+void btm_ble_stop_inquiry(void) { mock_function_count_map[__func__]++; }
+void btm_ble_stop_scan(void) { mock_function_count_map[__func__]++; }
+void btm_ble_update_dmt_flag_bits(uint8_t* adv_flag_value,
+                                  const uint16_t connect_mode,
+                                  const uint16_t disc_mode) {
+  mock_function_count_map[__func__]++;
+}
+void btm_ble_update_inq_result(tINQ_DB_ENT* p_i, uint8_t addr_type,
+                               const RawAddress& bda, uint16_t evt_type,
+                               uint8_t primary_phy, uint8_t secondary_phy,
+                               uint8_t advertising_sid, int8_t tx_power,
+                               int8_t rssi, uint16_t periodic_adv_int,
+                               std::vector<uint8_t> const& data) {
+  mock_function_count_map[__func__]++;
+}
+void btm_ble_update_mode_operation(uint8_t link_role, const RawAddress* bd_addr,
+                                   tHCI_STATUS status) {
+  mock_function_count_map[__func__]++;
+}
+void btm_ble_write_adv_enable_complete(uint8_t* p) {
+  mock_function_count_map[__func__]++;
+}
+void btm_clear_all_pending_le_entry(void) {
+  mock_function_count_map[__func__]++;
+}
+void btm_send_hci_set_scan_params(uint8_t scan_type, uint16_t scan_int,
+                                  uint16_t scan_win, uint8_t addr_type_own,
+                                  uint8_t scan_filter_policy) {
+  mock_function_count_map[__func__]++;
+}
diff --git a/system/test/mock/mock_stack_btm_ble_multi_adv.cc b/system/test/mock/mock_stack_btm_ble_multi_adv.cc
new file mode 100644
index 00000000000..12664bd6a08
--- /dev/null
+++ b/system/test/mock/mock_stack_btm_ble_multi_adv.cc
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:11
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include <base/bind.h>
+#include <base/bind_helpers.h>
+#include <base/location.h>
+#include <base/logging.h>
+#include <base/memory/weak_ptr.h>
+#include <base/strings/string_number_conversions.h>
+#include <base/time/time.h>
+#include <string.h>
+#include <queue>
+#include <vector>
+#include "ble_advertiser.h"
+#include "ble_advertiser_hci_interface.h"
+#include "bt_target.h"
+#include "btm_int_types.h"
+#include "device/include/controller.h"
+#include "osi/include/alarm.h"
+#include "stack/btm/btm_ble_int.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+void BleAdvertisingManager::CleanUp() { mock_function_count_map[__func__]++; }
+void btm_ble_adv_init() { mock_function_count_map[__func__]++; }
+base::WeakPtr<BleAdvertisingManager> BleAdvertisingManager::Get() {
+  mock_function_count_map[__func__]++;
+  return nullptr;
+}
+bool BleAdvertisingManager::IsInitialized() {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+void test_timeout_cb(uint8_t status) { mock_function_count_map[__func__]++; }
+void BleAdvertisingManager::Initialize(BleAdvertiserHciInterface* interface) {
+  mock_function_count_map[__func__]++;
+}
+void btm_ble_multi_adv_cleanup(void) { mock_function_count_map[__func__]++; }
+void testRecomputeTimeout1() { mock_function_count_map[__func__]++; }
+void testRecomputeTimeout2() { mock_function_count_map[__func__]++; }
+void testRecomputeTimeout3() { mock_function_count_map[__func__]++; }
diff --git a/system/test/mock/mock_stack_btm_dev.cc b/system/test/mock/mock_stack_btm_dev.cc
new file mode 100644
index 00000000000..52573462dc8
--- /dev/null
+++ b/system/test/mock/mock_stack_btm_dev.cc
@@ -0,0 +1,112 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:16
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "bt_common.h"
+#include "bt_types.h"
+#include "btm_api.h"
+#include "btu.h"
+#include "device/include/controller.h"
+#include "hcidefs.h"
+#include "hcimsgs.h"
+#include "l2c_api.h"
+#include "main/shim/btm_api.h"
+#include "main/shim/shim.h"
+#include "stack/btm/btm_dev.h"
+#include "stack/include/acl_api.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+bool BTM_SecAddDevice(const RawAddress& bd_addr, DEV_CLASS dev_class,
+                      BD_NAME bd_name, uint8_t* features, LinkKey* p_link_key,
+                      uint8_t key_type, uint8_t pin_length) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool BTM_SecDeleteDevice(const RawAddress& bd_addr) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool btm_dev_support_role_switch(const RawAddress& bd_addr) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool btm_set_bond_type_dev(const RawAddress& bd_addr,
+                           tBTM_SEC_DEV_REC::tBTM_BOND_TYPE bond_type) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool is_address_equal(void* data, void* context) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool is_handle_equal(void* data, void* context) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+char* BTM_SecReadDevName(const RawAddress& bd_addr) {
+  mock_function_count_map[__func__]++;
+  return nullptr;
+}
+tBTM_SEC_DEV_REC* btm_find_dev(const RawAddress& bd_addr) {
+  mock_function_count_map[__func__]++;
+  return nullptr;
+}
+tBTM_SEC_DEV_REC* btm_find_dev_by_handle(uint16_t handle) {
+  mock_function_count_map[__func__]++;
+  return nullptr;
+}
+tBTM_SEC_DEV_REC* btm_find_or_alloc_dev(const RawAddress& bd_addr) {
+  mock_function_count_map[__func__]++;
+  return nullptr;
+}
+tBTM_SEC_DEV_REC* btm_sec_alloc_dev(const RawAddress& bd_addr) {
+  mock_function_count_map[__func__]++;
+  return nullptr;
+}
+tBTM_SEC_DEV_REC* btm_sec_allocate_dev_rec(void) {
+  mock_function_count_map[__func__]++;
+  return nullptr;
+}
+tBTM_SEC_DEV_REC::tBTM_BOND_TYPE btm_get_bond_type_dev(
+    const RawAddress& bd_addr) {
+  mock_function_count_map[__func__]++;
+  return tBTM_SEC_DEV_REC::BOND_TYPE_UNKNOWN;
+}
+void BTM_SecClearSecurityFlags(const RawAddress& bd_addr) {
+  mock_function_count_map[__func__]++;
+}
+void btm_consolidate_dev(tBTM_SEC_DEV_REC* p_target_rec) {
+  mock_function_count_map[__func__]++;
+}
+void wipe_secrets_and_remove(tBTM_SEC_DEV_REC* p_dev_rec) {
+  mock_function_count_map[__func__]++;
+}
diff --git a/system/test/mock/mock_stack_btm_devctl.cc b/system/test/mock/mock_stack_btm_devctl.cc
new file mode 100644
index 00000000000..e51b253b8c9
--- /dev/null
+++ b/system/test/mock/mock_stack_btm_devctl.cc
@@ -0,0 +1,124 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:21
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include <base/logging.h>
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+#include "bt_types.h"
+#include "bta/dm/bta_dm_int.h"
+#include "bta/sys/bta_sys.h"
+#include "btcore/include/module.h"
+#include "btif/include/btif_bqr.h"
+#include "btm_int.h"
+#include "btu.h"
+#include "common/message_loop_thread.h"
+#include "device/include/controller.h"
+#include "hci/include/hci_layer.h"
+#include "hcimsgs.h"
+#include "main/shim/btm_api.h"
+#include "main/shim/controller.h"
+#include "main/shim/shim.h"
+#include "osi/include/osi.h"
+#include "stack/btm/btm_ble_int.h"
+#include "stack/gatt/connection_manager.h"
+#include "stack/include/acl_api.h"
+#include "stack/include/l2cap_controller_interface.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+bool BTM_IsDeviceUp(void) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+tBTM_STATUS BTM_BT_Quality_Report_VSE_Register(
+    bool is_register, tBTM_BT_QUALITY_REPORT_RECEIVER* p_bqr_report_receiver) {
+  mock_function_count_map[__func__]++;
+  return BTM_SUCCESS;
+}
+tBTM_STATUS BTM_DeleteStoredLinkKey(const RawAddress* bd_addr,
+                                    tBTM_CMPL_CB* p_cb) {
+  mock_function_count_map[__func__]++;
+  return BTM_SUCCESS;
+}
+tBTM_STATUS BTM_EnableTestMode(void) {
+  mock_function_count_map[__func__]++;
+  return BTM_SUCCESS;
+}
+tBTM_STATUS BTM_ReadLocalDeviceName(char** p_name) {
+  mock_function_count_map[__func__]++;
+  return BTM_SUCCESS;
+}
+tBTM_STATUS BTM_ReadLocalDeviceNameFromController(
+    tBTM_CMPL_CB* p_rln_cmpl_cback) {
+  mock_function_count_map[__func__]++;
+  return BTM_SUCCESS;
+}
+tBTM_STATUS BTM_RegisterForVSEvents(tBTM_VS_EVT_CB* p_cb, bool is_register) {
+  mock_function_count_map[__func__]++;
+  return BTM_SUCCESS;
+}
+tBTM_STATUS BTM_SetDeviceClass(DEV_CLASS dev_class) {
+  mock_function_count_map[__func__]++;
+  return BTM_SUCCESS;
+}
+tBTM_STATUS BTM_SetLocalDeviceName(char* p_name) {
+  mock_function_count_map[__func__]++;
+  return BTM_SUCCESS;
+}
+uint8_t* BTM_ReadDeviceClass(void) {
+  mock_function_count_map[__func__]++;
+  return nullptr;
+}
+void BTM_VendorSpecificCommand(uint16_t opcode, uint8_t param_len,
+                               uint8_t* p_param_buf, tBTM_VSC_CMPL_CB* p_cb) {
+  mock_function_count_map[__func__]++;
+}
+void BTM_WritePageTimeout(uint16_t timeout) {
+  mock_function_count_map[__func__]++;
+}
+void BTM_WriteVoiceSettings(uint16_t settings) {
+  mock_function_count_map[__func__]++;
+}
+void BTM_db_reset(void) { mock_function_count_map[__func__]++; }
+void BTM_reset_complete() { mock_function_count_map[__func__]++; }
+void btm_delete_stored_link_key_complete(uint8_t* p) {
+  mock_function_count_map[__func__]++;
+}
+void btm_dev_free() { mock_function_count_map[__func__]++; }
+void btm_dev_init() { mock_function_count_map[__func__]++; }
+void btm_read_local_name_complete(uint8_t* p, UNUSED_ATTR uint16_t evt_len) {
+  mock_function_count_map[__func__]++;
+}
+void btm_vendor_specific_evt(uint8_t* p, uint8_t evt_len) {
+  mock_function_count_map[__func__]++;
+}
+void btm_vsc_complete(uint8_t* p, uint16_t opcode, uint16_t evt_len,
+                      tBTM_VSC_CMPL_CB* p_vsc_cplt_cback) {
+  mock_function_count_map[__func__]++;
+}
diff --git a/system/test/mock/mock_stack_btm_main.cc b/system/test/mock/mock_stack_btm_main.cc
new file mode 100644
index 00000000000..1744bc32d96
--- /dev/null
+++ b/system/test/mock/mock_stack_btm_main.cc
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:7
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include <memory>
+#include <string>
+#include "bt_target.h"
+#include "bt_types.h"
+#include "main/shim/dumpsys.h"
+#include "stack/btm/btm_int_types.h"
+#include "stack/include/btm_client_interface.h"
+#include "stack_config.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+void BTM_LogHistory(const std::string& tag, const RawAddress& bd_addr,
+                    const std::string& msg) {
+  mock_function_count_map[__func__]++;
+}
+void BTM_LogHistory(const std::string& tag, const RawAddress& bd_addr,
+                    const std::string& msg, const std::string& extra) {
+  mock_function_count_map[__func__]++;
+}
+void BTM_LogHistory(const std::string& tag, const tBLE_BD_ADDR& ble_bd_addr,
+                    const std::string& msg) {
+  mock_function_count_map[__func__]++;
+}
+void BTM_LogHistory(const std::string& tag, const tBLE_BD_ADDR& ble_bd_addr,
+                    const std::string& msg, const std::string& extra) {
+  mock_function_count_map[__func__]++;
+}
+void btm_free(void) { mock_function_count_map[__func__]++; }
+void btm_init(void) { mock_function_count_map[__func__]++; }
diff --git a/system/test/mock/mock_stack_btm_scn.cc b/system/test/mock/mock_stack_btm_scn.cc
new file mode 100644
index 00000000000..fb76009f5f4
--- /dev/null
+++ b/system/test/mock/mock_stack_btm_scn.cc
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:3
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include <cstdint>
+#include "stack/btm/btm_int_types.h"
+#include "stack/include/rfcdefs.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+bool BTM_FreeSCN(uint8_t scn) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool BTM_TryAllocateSCN(uint8_t scn) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+uint8_t BTM_AllocateSCN(void) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
diff --git a/system/test/mock/mock_stack_btm_sco.cc b/system/test/mock/mock_stack_btm_sco.cc
new file mode 100644
index 00000000000..1542c5d9b29
--- /dev/null
+++ b/system/test/mock/mock_stack_btm_sco.cc
@@ -0,0 +1,125 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:23
+ */
+
+#include <cstdint>
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include "stack/include/btm_api_types.h"
+#include "stack/include/btm_status.h"
+#include "stack/include/hci_error_code.h"
+#include "types/class_of_device.h"
+#include "types/raw_address.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+bool BTM_IsScoActiveByBdaddr(const RawAddress& remote_bda) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool btm_is_sco_active(uint16_t handle) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool btm_sco_removed(uint16_t hci_handle, tHCI_REASON reason) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+const RawAddress* BTM_ReadScoBdAddr(uint16_t sco_inx) {
+  mock_function_count_map[__func__]++;
+  return nullptr;
+}
+tBTM_STATUS BTM_ChangeEScoLinkParms(uint16_t sco_inx,
+                                    tBTM_CHG_ESCO_PARAMS* p_parms) {
+  mock_function_count_map[__func__]++;
+  return BTM_SUCCESS;
+}
+tBTM_STATUS BTM_CreateSco(const RawAddress* remote_bda, bool is_orig,
+                          uint16_t pkt_types, uint16_t* p_sco_inx,
+                          tBTM_SCO_CB* p_conn_cb, tBTM_SCO_CB* p_disc_cb) {
+  mock_function_count_map[__func__]++;
+  return BTM_SUCCESS;
+}
+tBTM_STATUS BTM_RegForEScoEvts(uint16_t sco_inx,
+                               tBTM_ESCO_CBACK* p_esco_cback) {
+  mock_function_count_map[__func__]++;
+  return BTM_SUCCESS;
+}
+tBTM_STATUS BTM_RemoveSco(uint16_t sco_inx) {
+  mock_function_count_map[__func__]++;
+  return BTM_SUCCESS;
+}
+tBTM_STATUS BTM_SetEScoMode(enh_esco_params_t* p_parms) {
+  mock_function_count_map[__func__]++;
+  return BTM_SUCCESS;
+}
+uint8_t BTM_GetNumScoLinks(void) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+void BTM_EScoConnRsp(uint16_t sco_inx, uint8_t hci_status,
+                     enh_esco_params_t* p_parms) {
+  mock_function_count_map[__func__]++;
+}
+void BTM_RemoveSco(const RawAddress& bda) {
+  mock_function_count_map[__func__]++;
+}
+void btm_esco_proc_conn_chg(uint8_t status, uint16_t handle,
+                            uint8_t tx_interval, uint8_t retrans_window,
+                            uint16_t rx_pkt_len, uint16_t tx_pkt_len) {
+  mock_function_count_map[__func__]++;
+}
+void btm_route_sco_data(BT_HDR* p_msg) { mock_function_count_map[__func__]++; }
+void btm_sco_acl_removed(const RawAddress* bda) {
+  mock_function_count_map[__func__]++;
+}
+void btm_sco_chk_pend_rolechange(uint16_t hci_handle) {
+  mock_function_count_map[__func__]++;
+}
+void btm_sco_chk_pend_unpark(tHCI_STATUS hci_status, uint16_t hci_handle) {
+  mock_function_count_map[__func__]++;
+}
+void btm_sco_conn_req(const RawAddress& bda, const DEV_CLASS& dev_class,
+                      uint8_t link_type) {
+  mock_function_count_map[__func__]++;
+}
+void btm_sco_connected(tHCI_STATUS hci_status, const RawAddress& bda,
+                       uint16_t hci_handle, tBTM_ESCO_DATA* p_esco_data) {
+  mock_function_count_map[__func__]++;
+}
+void btm_sco_disc_chk_pend_for_modechange(uint16_t hci_handle) {
+  mock_function_count_map[__func__]++;
+}
+void btm_sco_on_esco_connect_request(
+    const RawAddress& bda, const bluetooth::types::ClassOfDevice& cod) {
+  mock_function_count_map[__func__]++;
+}
+void btm_sco_on_sco_connect_request(
+    const RawAddress& bda, const bluetooth::types::ClassOfDevice& cod) {
+  mock_function_count_map[__func__]++;
+}
+void btm_sco_on_disconnected(uint16_t hci_handle, tHCI_REASON reason) {
+  mock_function_count_map[__func__]++;
+}
diff --git a/system/test/mock/mock_stack_btm_sec.cc b/system/test/mock/mock_stack_btm_sec.cc
new file mode 100644
index 00000000000..c21f4e50386
--- /dev/null
+++ b/system/test/mock/mock_stack_btm_sec.cc
@@ -0,0 +1,297 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:66
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include <base/strings/stringprintf.h>
+#include <frameworks/proto_logging/stats/enums/bluetooth/enums.pb.h>
+#include <frameworks/proto_logging/stats/enums/bluetooth/hci/enums.pb.h>
+#include <string.h>
+#include "bt_types.h"
+#include "btif/include/btif_storage.h"
+#include "common/metrics.h"
+#include "common/time_util.h"
+#include "device/include/controller.h"
+#include "hcimsgs.h"
+#include "l2c_api.h"
+#include "main/shim/btm_api.h"
+#include "main/shim/dumpsys.h"
+#include "main/shim/shim.h"
+#include "osi/include/log.h"
+#include "osi/include/osi.h"
+#include "stack/btm/btm_dev.h"
+#include "stack/btm/btm_sec.h"
+#include "stack/include/acl_api.h"
+#include "stack/include/acl_hci_link_interface.h"
+#include "stack/include/btm_status.h"
+#include "stack/include/l2cap_security_interface.h"
+#include "stack/smp/smp_int.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+bool BTM_BothEndsSupportSecureConnections(const RawAddress& bd_addr) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool BTM_GetSecurityFlags(const RawAddress& bd_addr, uint8_t* p_sec_flags) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool BTM_GetSecurityFlagsByTransport(const RawAddress& bd_addr,
+                                     uint8_t* p_sec_flags,
+                                     tBT_TRANSPORT transport) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool BTM_IsAuthenticated(const RawAddress& bd_addr, tBT_TRANSPORT transport) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool BTM_IsEncrypted(const RawAddress& bd_addr, tBT_TRANSPORT transport) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool BTM_IsLinkKeyAuthed(const RawAddress& bd_addr, tBT_TRANSPORT transport) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool BTM_IsLinkKeyKnown(const RawAddress& bd_addr, tBT_TRANSPORT transport) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool BTM_PeerSupportsSecureConnections(const RawAddress& bd_addr) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool BTM_SecAddRmtNameNotifyCallback(tBTM_RMT_NAME_CALLBACK* p_callback) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool BTM_SecDeleteRmtNameNotifyCallback(tBTM_RMT_NAME_CALLBACK* p_callback) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool BTM_SecIsSecurityPending(const RawAddress& bd_addr) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool BTM_SecRegister(const tBTM_APPL_INFO* p_cb_info) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool BTM_SetSecurityLevel(bool is_originator, const char* p_name,
+                          uint8_t service_id, uint16_t sec_level, uint16_t psm,
+                          uint32_t mx_proto_id, uint32_t mx_chan_id) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool btm_sec_is_a_bonded_dev(const RawAddress& bda) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool is_sec_state_equal(void* data, void* context) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool is_state_getting_name(void* data, void* context) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+const uint8_t* btm_get_dev_class(const RawAddress& bda) {
+  mock_function_count_map[__func__]++;
+  return nullptr;
+}
+tBTM_LINK_KEY_TYPE BTM_SecGetDeviceLinkKeyType(const RawAddress& bd_addr) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+tBTM_SEC_DEV_REC* btm_sec_find_dev_by_sec_state(uint8_t state) {
+  mock_function_count_map[__func__]++;
+  return nullptr;
+}
+tBTM_SEC_SERV_REC* btm_sec_find_first_serv(bool is_originator, uint16_t psm) {
+  mock_function_count_map[__func__]++;
+  return nullptr;
+}
+tBTM_STATUS BTM_SecBond(const RawAddress& bd_addr, tBLE_ADDR_TYPE addr_type,
+                        tBT_TRANSPORT transport, int device_type,
+                        uint8_t pin_len, uint8_t* p_pin) {
+  mock_function_count_map[__func__]++;
+  return BTM_SUCCESS;
+}
+tBTM_STATUS BTM_SecBondCancel(const RawAddress& bd_addr) {
+  mock_function_count_map[__func__]++;
+  return BTM_SUCCESS;
+}
+tBTM_STATUS BTM_SetEncryption(const RawAddress& bd_addr,
+                              tBT_TRANSPORT transport,
+                              tBTM_SEC_CALLBACK* p_callback, void* p_ref_data,
+                              tBTM_BLE_SEC_ACT sec_act) {
+  mock_function_count_map[__func__]++;
+  return BTM_SUCCESS;
+}
+tBTM_STATUS btm_sec_bond_by_transport(const RawAddress& bd_addr,
+                                      tBT_TRANSPORT transport, uint8_t pin_len,
+                                      uint8_t* p_pin) {
+  mock_function_count_map[__func__]++;
+  return BTM_SUCCESS;
+}
+tBTM_STATUS btm_sec_disconnect(uint16_t handle, tHCI_STATUS reason) {
+  mock_function_count_map[__func__]++;
+  return BTM_SUCCESS;
+}
+tBTM_STATUS btm_sec_execute_procedure(tBTM_SEC_DEV_REC* p_dev_rec) {
+  mock_function_count_map[__func__]++;
+  return BTM_SUCCESS;
+}
+tBTM_STATUS btm_sec_l2cap_access_req(const RawAddress& bd_addr, uint16_t psm,
+                                     bool is_originator,
+                                     tBTM_SEC_CALLBACK* p_callback,
+                                     void* p_ref_data) {
+  mock_function_count_map[__func__]++;
+  return BTM_SUCCESS;
+}
+tBTM_STATUS btm_sec_l2cap_access_req_by_requirement(
+    const RawAddress& bd_addr, uint16_t security_required, bool is_originator,
+    tBTM_SEC_CALLBACK* p_callback, void* p_ref_data) {
+  mock_function_count_map[__func__]++;
+  return BTM_SUCCESS;
+}
+tBTM_STATUS btm_sec_mx_access_request(const RawAddress& bd_addr,
+                                      bool is_originator,
+                                      uint16_t security_required,
+                                      tBTM_SEC_CALLBACK* p_callback,
+                                      void* p_ref_data) {
+  mock_function_count_map[__func__]++;
+  return BTM_SUCCESS;
+}
+uint16_t BTM_GetClockOffset(const RawAddress& remote_bda) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint8_t BTM_SecClrService(uint8_t service_id) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint8_t BTM_SecClrServiceByPsm(uint16_t psm) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+void BTM_ConfirmReqReply(tBTM_STATUS res, const RawAddress& bd_addr) {
+  mock_function_count_map[__func__]++;
+}
+void BTM_PINCodeReply(const RawAddress& bd_addr, uint8_t res, uint8_t pin_len,
+                      uint8_t* p_pin) {
+  mock_function_count_map[__func__]++;
+}
+void BTM_PasskeyReqReply(tBTM_STATUS res, const RawAddress& bd_addr,
+                         uint32_t passkey) {
+  mock_function_count_map[__func__]++;
+}
+void BTM_ReadLocalOobData(void) { mock_function_count_map[__func__]++; }
+void BTM_RemoteOobDataReply(tBTM_STATUS res, const RawAddress& bd_addr,
+                            const Octet16& c, const Octet16& r) {
+  mock_function_count_map[__func__]++;
+}
+void BTM_SetPinType(uint8_t pin_type, PIN_CODE pin_code, uint8_t pin_code_len) {
+  mock_function_count_map[__func__]++;
+}
+void NotifyBondingCanceled(tBTM_STATUS btm_status) {
+  mock_function_count_map[__func__]++;
+}
+void btm_create_conn_cancel_complete(uint8_t* p) {
+  mock_function_count_map[__func__]++;
+}
+void btm_io_capabilities_req(const RawAddress& p) {
+  mock_function_count_map[__func__]++;
+}
+void btm_io_capabilities_rsp(uint8_t* p) {
+  mock_function_count_map[__func__]++;
+}
+void btm_proc_sp_req_evt(tBTM_SP_EVT event, uint8_t* p) {
+  mock_function_count_map[__func__]++;
+}
+void btm_read_local_oob_complete(uint8_t* p) {
+  mock_function_count_map[__func__]++;
+}
+void btm_rem_oob_req(uint8_t* p) { mock_function_count_map[__func__]++; }
+void btm_sec_abort_access_req(const RawAddress& bd_addr) {
+  mock_function_count_map[__func__]++;
+}
+void btm_sec_auth_complete(uint16_t handle, tHCI_STATUS status) {
+  mock_function_count_map[__func__]++;
+}
+void btm_sec_check_pending_reqs(void) { mock_function_count_map[__func__]++; }
+void btm_sec_clear_ble_keys(tBTM_SEC_DEV_REC* p_dev_rec) {
+  mock_function_count_map[__func__]++;
+}
+void btm_sec_conn_req(const RawAddress& bda, uint8_t* dc) {
+  mock_function_count_map[__func__]++;
+}
+void btm_sec_connected(const RawAddress& bda, uint16_t handle,
+                       tHCI_STATUS status, uint8_t enc_mode) {
+  mock_function_count_map[__func__]++;
+}
+void btm_sec_dev_rec_cback_event(tBTM_SEC_DEV_REC* p_dev_rec,
+                                 tBTM_STATUS btm_status, bool is_le_transport) {
+  mock_function_count_map[__func__]++;
+}
+void btm_sec_dev_reset(void) { mock_function_count_map[__func__]++; }
+void btm_sec_disconnected(uint16_t handle, tHCI_REASON reason) {
+  mock_function_count_map[__func__]++;
+}
+void btm_sec_encrypt_change(uint16_t handle, tHCI_STATUS status,
+                            uint8_t encr_enable) {
+  mock_function_count_map[__func__]++;
+}
+void btm_sec_link_key_notification(const RawAddress& p_bda,
+                                   const Octet16& link_key, uint8_t key_type) {
+  mock_function_count_map[__func__]++;
+}
+void btm_sec_link_key_request(uint8_t* p_event) {
+  mock_function_count_map[__func__]++;
+}
+void btm_sec_pin_code_request(uint8_t* p_event) {
+  mock_function_count_map[__func__]++;
+}
+void btm_sec_rmt_host_support_feat_evt(uint8_t* p) {
+  mock_function_count_map[__func__]++;
+}
+void btm_sec_rmt_name_request_complete(const RawAddress* p_bd_addr,
+                                       uint8_t* p_bd_name, tHCI_STATUS status) {
+  mock_function_count_map[__func__]++;
+}
+void btm_sec_set_peer_sec_caps(uint16_t hci_handle, bool ssp_supported,
+                               bool sc_supported,
+                               bool hci_role_switch_supported) {
+  mock_function_count_map[__func__]++;
+}
+void btm_sec_update_clock_offset(uint16_t handle, uint16_t clock_offset) {
+  mock_function_count_map[__func__]++;
+}
+void btm_simple_pair_complete(uint8_t* p) {
+  mock_function_count_map[__func__]++;
+}
diff --git a/system/test/mock/mock_stack_btu_task.cc b/system/test/mock/mock_stack_btu_task.cc
new file mode 100644
index 00000000000..f4ba8399b55
--- /dev/null
+++ b/system/test/mock/mock_stack_btu_task.cc
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:7
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include <base/bind.h>
+#include <base/logging.h>
+#include <base/run_loop.h>
+#include <base/threading/thread.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "bta/sys/bta_sys.h"
+#include "btcore/include/module.h"
+#include "bte.h"
+#include "btif/include/btif_common.h"
+#include "btm_iso_api.h"
+#include "common/message_loop_thread.h"
+#include "osi/include/log.h"
+#include "osi/include/osi.h"
+#include "stack/include/acl_hci_link_interface.h"
+#include "stack/include/btu.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+bluetooth::common::MessageLoopThread* get_main_thread() {
+  mock_function_count_map[__func__]++;
+  return nullptr;
+}
+bt_status_t do_in_main_thread(const base::Location& from_here,
+                              base::OnceClosure task) {
+  mock_function_count_map[__func__]++;
+  return BT_STATUS_SUCCESS;
+}
+bt_status_t do_in_main_thread_delayed(const base::Location& from_here,
+                                      base::OnceClosure task,
+                                      const base::TimeDelta& delay) {
+  mock_function_count_map[__func__]++;
+  return BT_STATUS_SUCCESS;
+}
+void btu_hci_msg_process(BT_HDR* p_msg) { mock_function_count_map[__func__]++; }
+void main_thread_shut_down() { mock_function_count_map[__func__]++; }
+void main_thread_start_up() { mock_function_count_map[__func__]++; }
+void post_on_bt_main(BtMainClosure closure) {
+  mock_function_count_map[__func__]++;
+}
diff --git a/system/test/mock/mock_stack_gap_conn.cc b/system/test/mock/mock_stack_gap_conn.cc
new file mode 100644
index 00000000000..6600a0deed4
--- /dev/null
+++ b/system/test/mock/mock_stack_gap_conn.cc
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:13
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include <base/strings/stringprintf.h>
+#include <string.h>
+#include "bt_target.h"
+#include "device/include/controller.h"
+#include "gap_api.h"
+#include "l2c_api.h"
+#include "l2cdefs.h"
+#include "osi/include/fixed_queue.h"
+#include "osi/include/mutex.h"
+#include "stack/btm/btm_sec.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+const RawAddress* GAP_ConnGetRemoteAddr(uint16_t gap_handle) {
+  mock_function_count_map[__func__]++;
+  return nullptr;
+}
+int GAP_GetRxQueueCnt(uint16_t handle, uint32_t* p_rx_queue_count) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint16_t GAP_ConnClose(uint16_t gap_handle) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint16_t GAP_ConnGetL2CAPCid(uint16_t gap_handle) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint16_t GAP_ConnGetRemMtuSize(uint16_t gap_handle) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint16_t GAP_ConnOpen(const char* p_serv_name, uint8_t service_id,
+                      bool is_server, const RawAddress* p_rem_bda, uint16_t psm,
+                      uint16_t le_mps, tL2CAP_CFG_INFO* p_cfg,
+                      tL2CAP_ERTM_INFO* ertm_info, uint16_t security,
+                      tGAP_CONN_CALLBACK* p_cb, tBT_TRANSPORT transport) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint16_t GAP_ConnReadData(uint16_t gap_handle, uint8_t* p_data,
+                          uint16_t max_len, uint16_t* p_len) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint16_t GAP_ConnWriteData(uint16_t gap_handle, BT_HDR* msg) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+void GAP_Init(void) { mock_function_count_map[__func__]++; }
+void gap_tx_complete_ind(uint16_t l2cap_cid, uint16_t sdu_sent) {
+  mock_function_count_map[__func__]++;
+}
diff --git a/system/test/mock/mock_stack_gatt.cc b/system/test/mock/mock_stack_gatt.cc
new file mode 100644
index 00000000000..6ae3c8eda4f
--- /dev/null
+++ b/system/test/mock/mock_stack_gatt.cc
@@ -0,0 +1,159 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:27
+ */
+
+#include <cstdint>
+#include <map>
+#include <string>
+
+#include "stack/gatt/gatt_int.h"
+#include "stack/include/gatt_api.h"
+#include "types/bluetooth/uuid.h"
+#include "types/bt_transport.h"
+#include "types/raw_address.h"
+
+using namespace bluetooth;
+
+extern std::map<std::string, int> mock_function_count_map;
+tGATT_HDL_LIST_ELEM elem;  // gatt_add_an_item_to_list
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+bool GATTS_DeleteService(tGATT_IF gatt_if, Uuid* p_svc_uuid,
+                         uint16_t svc_inst) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool GATTS_NVRegister(tGATT_APPL_INFO* p_cb_info) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool GATT_CancelConnect(tGATT_IF gatt_if, const RawAddress& bd_addr,
+                        bool is_direct) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool GATT_Connect(tGATT_IF gatt_if, const RawAddress& bd_addr, bool is_direct,
+                  tBT_TRANSPORT transport, bool opportunistic) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool GATT_Connect(tGATT_IF gatt_if, const RawAddress& bd_addr, bool is_direct,
+                  tBT_TRANSPORT transport, bool opportunistic,
+                  uint8_t initiating_phys) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool GATT_GetConnIdIfConnected(tGATT_IF gatt_if, const RawAddress& bd_addr,
+                               uint16_t* p_conn_id, tBT_TRANSPORT transport) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool GATT_GetConnectionInfor(uint16_t conn_id, tGATT_IF* p_gatt_if,
+                             RawAddress& bd_addr, tBT_TRANSPORT* p_transport) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool is_active_service(const Uuid& app_uuid128, Uuid* p_svc_uuid,
+                       uint16_t start_handle) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+tGATT_HDL_LIST_ELEM& gatt_add_an_item_to_list(uint16_t s_handle) {
+  mock_function_count_map[__func__]++;
+  return elem;
+}
+tGATT_IF GATT_Register(const Uuid& app_uuid128, tGATT_CBACK* p_cb_info,
+                       bool eatt_support) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+tGATT_STATUS GATTC_ConfigureMTU(uint16_t conn_id, uint16_t mtu) {
+  mock_function_count_map[__func__]++;
+  return GATT_SUCCESS;
+}
+tGATT_STATUS GATTC_Discover(uint16_t conn_id, tGATT_DISC_TYPE disc_type,
+                            uint16_t start_handle, uint16_t end_handle) {
+  mock_function_count_map[__func__]++;
+  return GATT_SUCCESS;
+}
+tGATT_STATUS GATTC_Discover(uint16_t conn_id, tGATT_DISC_TYPE disc_type,
+                            uint16_t start_handle, uint16_t end_handle,
+                            const Uuid& uuid) {
+  mock_function_count_map[__func__]++;
+  return GATT_SUCCESS;
+}
+tGATT_STATUS GATTC_ExecuteWrite(uint16_t conn_id, bool is_execute) {
+  mock_function_count_map[__func__]++;
+  return GATT_SUCCESS;
+}
+tGATT_STATUS GATTC_Read(uint16_t conn_id, tGATT_READ_TYPE type,
+                        tGATT_READ_PARAM* p_read) {
+  mock_function_count_map[__func__]++;
+  return GATT_SUCCESS;
+}
+tGATT_STATUS GATTC_SendHandleValueConfirm(uint16_t conn_id, uint16_t cid) {
+  mock_function_count_map[__func__]++;
+  return GATT_SUCCESS;
+}
+tGATT_STATUS GATTC_Write(uint16_t conn_id, tGATT_WRITE_TYPE type,
+                         tGATT_VALUE* p_write) {
+  mock_function_count_map[__func__]++;
+  return GATT_SUCCESS;
+}
+tGATT_STATUS GATTS_AddService(tGATT_IF gatt_if, btgatt_db_element_t* service,
+                              int count) {
+  mock_function_count_map[__func__]++;
+  return GATT_SUCCESS;
+}
+tGATT_STATUS GATTS_HandleValueIndication(uint16_t conn_id, uint16_t attr_handle,
+                                         uint16_t val_len, uint8_t* p_val) {
+  mock_function_count_map[__func__]++;
+  return GATT_SUCCESS;
+}
+tGATT_STATUS GATTS_HandleValueNotification(uint16_t conn_id,
+                                           uint16_t attr_handle,
+                                           uint16_t val_len, uint8_t* p_val) {
+  mock_function_count_map[__func__]++;
+  return GATT_SUCCESS;
+}
+tGATT_STATUS GATTS_SendRsp(uint16_t conn_id, uint32_t trans_id,
+                           tGATT_STATUS status, tGATTS_RSP* p_msg) {
+  mock_function_count_map[__func__]++;
+  return GATT_SUCCESS;
+}
+tGATT_STATUS GATT_Disconnect(uint16_t conn_id) {
+  mock_function_count_map[__func__]++;
+  return GATT_SUCCESS;
+}
+void GATTS_AddHandleRange(tGATTS_HNDL_RANGE* p_hndl_range) {
+  mock_function_count_map[__func__]++;
+}
+void GATTS_StopService(uint16_t service_handle) {
+  mock_function_count_map[__func__]++;
+}
+void GATT_Deregister(tGATT_IF gatt_if) { mock_function_count_map[__func__]++; }
+void GATT_SetIdleTimeout(const RawAddress& bd_addr, uint16_t idle_tout,
+                         tBT_TRANSPORT transport) {
+  mock_function_count_map[__func__]++;
+}
+void GATT_StartIf(tGATT_IF gatt_if) { mock_function_count_map[__func__]++; }
diff --git a/system/test/mock/mock_stack_gatt_connection_manager.cc b/system/test/mock/mock_stack_gatt_connection_manager.cc
new file mode 100644
index 00000000000..d1341c7d0a3
--- /dev/null
+++ b/system/test/mock/mock_stack_gatt_connection_manager.cc
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:16
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include <base/bind.h>
+#include <base/callback.h>
+#include <base/location.h>
+#include <base/logging.h>
+#include <map>
+#include <memory>
+#include <set>
+#include "internal_include/bt_trace.h"
+#include "main/shim/shim.h"
+#include "osi/include/alarm.h"
+#include "osi/include/log.h"
+#include "stack/btm/btm_ble_bgconn.h"
+#include "stack/gatt/connection_manager.h"
+#include "stack/include/l2c_api.h"
+
+using namespace connection_manager;
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+bool connection_manager::background_connect_add(uint8_t app_id,
+                                                const RawAddress& address) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool connection_manager::background_connect_remove(uint8_t app_id,
+                                                   const RawAddress& address) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool connection_manager::direct_connect_add(uint8_t app_id,
+                                            const RawAddress& address) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool connection_manager::direct_connect_remove(uint8_t app_id,
+                                               const RawAddress& address) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool connection_manager::remove_unconditional(const RawAddress& address) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+std::set<tAPP_ID> connection_manager::get_apps_connecting_to(
+    const RawAddress& address) {
+  mock_function_count_map[__func__]++;
+  return std::set<tAPP_ID>();
+}
+void connection_manager::dump(int fd) { mock_function_count_map[__func__]++; }
+void connection_manager::on_app_deregistered(uint8_t app_id) {
+  mock_function_count_map[__func__]++;
+}
+void connection_manager::on_connection_complete(const RawAddress& address) {
+  mock_function_count_map[__func__]++;
+}
+void connection_manager::reset(bool after_reset) {
+  mock_function_count_map[__func__]++;
+}
diff --git a/system/test/mock/mock_stack_gatt_main.cc b/system/test/mock/mock_stack_gatt_main.cc
new file mode 100644
index 00000000000..db36dc9b554
--- /dev/null
+++ b/system/test/mock/mock_stack_gatt_main.cc
@@ -0,0 +1,113 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:23
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include "bt_common.h"
+#include "bt_target.h"
+#include "bt_utils.h"
+#include "btif_storage.h"
+#include "btm_ble_int.h"
+#include "device/include/interop.h"
+#include "l2c_api.h"
+#include "osi/include/osi.h"
+#include "stack/btm/btm_dev.h"
+#include "stack/btm/btm_sec.h"
+#include "stack/gatt/gatt_int.h"
+#include "stack/include/l2cap_acl_interface.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+void gatt_init(void) { mock_function_count_map[__func__]++; }
+bool gatt_act_connect(tGATT_REG* p_reg, const RawAddress& bd_addr,
+                      tBT_TRANSPORT transport, int8_t initiating_phys) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool gatt_connect(const RawAddress& rem_bda, tGATT_TCB* p_tcb,
+                  tBT_TRANSPORT transport, uint8_t initiating_phys,
+                  tGATT_IF gatt_if) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool gatt_disconnect(tGATT_TCB* p_tcb) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool gatt_update_app_hold_link_status(tGATT_IF gatt_if, tGATT_TCB* p_tcb,
+                                      bool is_add) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+tGATT_CH_STATE gatt_get_ch_state(tGATT_TCB* p_tcb) {
+  mock_function_count_map[__func__]++;
+  return GATT_CH_CLOSE;
+}
+void gatt_add_a_bonded_dev_for_srv_chg(const RawAddress& bda) {
+  mock_function_count_map[__func__]++;
+}
+void gatt_chk_srv_chg(tGATTS_SRV_CHG* p_srv_chg_clt) {
+  mock_function_count_map[__func__]++;
+}
+void gatt_data_process(tGATT_TCB& tcb, uint16_t cid, BT_HDR* p_buf) {
+  mock_function_count_map[__func__]++;
+}
+void gatt_find_in_device_record(const RawAddress& bd_addr,
+                                tBLE_BD_ADDR* address_with_type) {
+  mock_function_count_map[__func__]++;
+}
+void gatt_free(void) { mock_function_count_map[__func__]++; }
+void gatt_init_srv_chg(void) { mock_function_count_map[__func__]++; }
+void gatt_l2cif_config_cfm_cback(uint16_t lcid, uint16_t initiator,
+                                 tL2CAP_CFG_INFO* p_cfg) {
+  mock_function_count_map[__func__]++;
+}
+void gatt_l2cif_config_ind_cback(uint16_t lcid, tL2CAP_CFG_INFO* p_cfg) {
+  mock_function_count_map[__func__]++;
+}
+void gatt_l2cif_disconnect_ind_cback(uint16_t lcid, bool ack_needed) {
+  mock_function_count_map[__func__]++;
+}
+void gatt_notify_conn_update(const RawAddress& remote, uint16_t interval,
+                             uint16_t latency, uint16_t timeout,
+                             tHCI_STATUS status) {
+  mock_function_count_map[__func__]++;
+}
+void gatt_notify_phy_updated(tGATT_STATUS status, uint16_t handle,
+                             uint8_t tx_phy, uint8_t rx_phy) {
+  mock_function_count_map[__func__]++;
+}
+void gatt_proc_srv_chg(void) { mock_function_count_map[__func__]++; }
+void gatt_send_srv_chg_ind(const RawAddress& peer_bda) {
+  mock_function_count_map[__func__]++;
+}
+void gatt_set_ch_state(tGATT_TCB* p_tcb, tGATT_CH_STATE ch_state) {
+  mock_function_count_map[__func__]++;
+}
+void gatt_update_app_use_link_flag(tGATT_IF gatt_if, tGATT_TCB* p_tcb,
+                                   bool is_add, bool check_acl_link) {
+  mock_function_count_map[__func__]++;
+}
diff --git a/system/test/mock/mock_stack_hidd_api.cc b/system/test/mock/mock_stack_hidd_api.cc
new file mode 100644
index 00000000000..992e361cf70
--- /dev/null
+++ b/system/test/mock/mock_stack_hidd_api.cc
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:16
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "bt_types.h"
+#include "btm_api.h"
+#include "btu.h"
+#include "hidd_api.h"
+#include "hiddefs.h"
+#include "stack/btm/btm_sec.h"
+#include "stack/hid/hidd_int.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+tHID_STATUS HID_DevAddRecord(uint32_t handle, char* p_name, char* p_description,
+                             char* p_provider, uint16_t subclass,
+                             uint16_t desc_len, uint8_t* p_desc_data) {
+  mock_function_count_map[__func__]++;
+  return HID_SUCCESS;
+}
+tHID_STATUS HID_DevConnect(void) {
+  mock_function_count_map[__func__]++;
+  return HID_SUCCESS;
+}
+tHID_STATUS HID_DevDeregister(void) {
+  mock_function_count_map[__func__]++;
+  return HID_SUCCESS;
+}
+tHID_STATUS HID_DevDisconnect(void) {
+  mock_function_count_map[__func__]++;
+  return HID_SUCCESS;
+}
+tHID_STATUS HID_DevGetDevice(RawAddress* addr) {
+  mock_function_count_map[__func__]++;
+  return HID_SUCCESS;
+}
+tHID_STATUS HID_DevPlugDevice(const RawAddress& addr) {
+  mock_function_count_map[__func__]++;
+  return HID_SUCCESS;
+}
+tHID_STATUS HID_DevRegister(tHID_DEV_HOST_CALLBACK* host_cback) {
+  mock_function_count_map[__func__]++;
+  return HID_SUCCESS;
+}
+tHID_STATUS HID_DevReportError(uint8_t error) {
+  mock_function_count_map[__func__]++;
+  return HID_SUCCESS;
+}
+tHID_STATUS HID_DevSendReport(uint8_t channel, uint8_t type, uint8_t id,
+                              uint16_t len, uint8_t* p_data) {
+  mock_function_count_map[__func__]++;
+  return HID_SUCCESS;
+}
+tHID_STATUS HID_DevSetIncomingPolicy(bool allow) {
+  mock_function_count_map[__func__]++;
+  return HID_SUCCESS;
+}
+tHID_STATUS HID_DevSetIncomingQos(uint8_t service_type, uint32_t token_rate,
+                                  uint32_t token_bucket_size,
+                                  uint32_t peak_bandwidth, uint32_t latency,
+                                  uint32_t delay_variation) {
+  mock_function_count_map[__func__]++;
+  return HID_SUCCESS;
+}
+tHID_STATUS HID_DevSetOutgoingQos(uint8_t service_type, uint32_t token_rate,
+                                  uint32_t token_bucket_size,
+                                  uint32_t peak_bandwidth, uint32_t latency,
+                                  uint32_t delay_variation) {
+  mock_function_count_map[__func__]++;
+  return HID_SUCCESS;
+}
+tHID_STATUS HID_DevUnplugDevice(const RawAddress& addr) {
+  mock_function_count_map[__func__]++;
+  return HID_SUCCESS;
+}
+tHID_STATUS HID_DevVirtualCableUnplug(void) {
+  mock_function_count_map[__func__]++;
+  return HID_SUCCESS;
+}
+uint8_t HID_DevSetTraceLevel(uint8_t new_level) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+void HID_DevInit(void) { mock_function_count_map[__func__]++; }
diff --git a/system/test/mock/mock_stack_hidh.cc b/system/test/mock/mock_stack_hidh.cc
new file mode 100644
index 00000000000..79cbcc4a008
--- /dev/null
+++ b/system/test/mock/mock_stack_hidh.cc
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:11
+ */
+
+#include <cstdint>
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include "stack/include/hiddefs.h"
+#include "stack/include/hidh_api.h"
+#include "stack/include/sdp_api.h"
+#include "types/raw_address.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+tHID_STATUS HID_HostAddDev(const RawAddress& addr, uint16_t attr_mask,
+                           uint8_t* handle) {
+  mock_function_count_map[__func__]++;
+  return HID_SUCCESS;
+}
+tHID_STATUS HID_HostCloseDev(uint8_t dev_handle) {
+  mock_function_count_map[__func__]++;
+  return HID_SUCCESS;
+}
+tHID_STATUS HID_HostDeregister(void) {
+  mock_function_count_map[__func__]++;
+  return HID_SUCCESS;
+}
+tHID_STATUS HID_HostGetSDPRecord(const RawAddress& addr,
+                                 tSDP_DISCOVERY_DB* p_db, uint32_t db_len,
+                                 tHID_HOST_SDP_CALLBACK* sdp_cback) {
+  mock_function_count_map[__func__]++;
+  return HID_SUCCESS;
+}
+tHID_STATUS HID_HostOpenDev(uint8_t dev_handle) {
+  mock_function_count_map[__func__]++;
+  return HID_SUCCESS;
+}
+tHID_STATUS HID_HostRegister(tHID_HOST_DEV_CALLBACK* dev_cback) {
+  mock_function_count_map[__func__]++;
+  return HID_SUCCESS;
+}
+tHID_STATUS HID_HostRemoveDev(uint8_t dev_handle) {
+  mock_function_count_map[__func__]++;
+  return HID_SUCCESS;
+}
+tHID_STATUS HID_HostWriteDev(uint8_t dev_handle, uint8_t t_type, uint8_t param,
+                             uint16_t data, uint8_t report_id, BT_HDR* pbuf) {
+  mock_function_count_map[__func__]++;
+  return HID_SUCCESS;
+}
+uint8_t HID_HostSetTraceLevel(uint8_t new_level) {
+  mock_function_count_map[__func__]++;
+  return HID_SUCCESS;
+}
+void HID_HostInit(void) { mock_function_count_map[__func__]++; }
+void hidh_get_str_attr(tSDP_DISC_REC* p_rec, uint16_t attr_id, uint16_t max_len,
+                       char* str) {
+  mock_function_count_map[__func__]++;
+}
diff --git a/system/test/mock/mock_stack_l2cap_api.cc b/system/test/mock/mock_stack_l2cap_api.cc
new file mode 100644
index 00000000000..85f2f4fafb0
--- /dev/null
+++ b/system/test/mock/mock_stack_l2cap_api.cc
@@ -0,0 +1,177 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:33
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include <cstdint>
+#include "stack/include/l2c_api.h"
+#include "types/raw_address.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+bool L2CA_ConnectCreditBasedRsp(const RawAddress& p_bd_addr, uint8_t id,
+                                std::vector<uint16_t>& accepted_lcids,
+                                uint16_t result, tL2CAP_LE_CFG_INFO* p_cfg) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool L2CA_ConnectFixedChnl(uint16_t fixed_cid, const RawAddress& rem_bda) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool L2CA_DisconnectLECocReq(uint16_t cid) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool L2CA_DisconnectReq(uint16_t cid) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool L2CA_GetPeerFeatures(const RawAddress& bd_addr, uint32_t* p_ext_feat,
+                          uint8_t* p_chnl_mask) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool L2CA_GetPeerLECocConfig(uint16_t lcid, tL2CAP_LE_CFG_INFO* peer_cfg) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool L2CA_GetRemoteCid(uint16_t lcid, uint16_t* rcid) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool L2CA_IsLinkEstablished(const RawAddress& bd_addr,
+                            tBT_TRANSPORT transport) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool L2CA_ReconfigCreditBasedConnsReq(const RawAddress& bda,
+                                      std::vector<uint16_t>& lcids,
+                                      tL2CAP_LE_CFG_INFO* p_cfg) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool L2CA_RegisterFixedChannel(uint16_t fixed_cid,
+                               tL2CAP_FIXED_CHNL_REG* p_freg) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool L2CA_RemoveFixedChnl(uint16_t fixed_cid, const RawAddress& rem_bda) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool L2CA_SetAclPriority(const RawAddress& bd_addr, tL2CAP_PRIORITY priority) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool L2CA_SetChnlFlushability(uint16_t cid, bool is_flushable) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool L2CA_SetLeGattTimeout(const RawAddress& rem_bda, uint16_t idle_tout) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool L2CA_SetIdleTimeoutByBdAddr(const RawAddress& bd_addr, uint16_t timeout,
+                                 tBT_TRANSPORT transport) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool L2CA_SetTxPriority(uint16_t cid, tL2CAP_CHNL_PRIORITY priority) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+std::vector<uint16_t> L2CA_ConnectCreditBasedReq(uint16_t psm,
+                                                 const RawAddress& p_bd_addr,
+                                                 tL2CAP_LE_CFG_INFO* p_cfg) {
+  mock_function_count_map[__func__]++;
+  std::vector<uint16_t> v;
+  return v;
+}
+tBT_TRANSPORT l2c_get_transport_from_fixed_cid(uint16_t fixed_cid) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint16_t L2CA_AllocateLePSM(void) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint16_t L2CA_ConnectLECocReq(uint16_t psm, const RawAddress& p_bd_addr,
+                              tL2CAP_LE_CFG_INFO* p_cfg, uint16_t sec_level) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint16_t L2CA_ConnectReq(uint16_t psm, const RawAddress& p_bd_addr) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint16_t L2CA_ConnectReq2(uint16_t psm, const RawAddress& p_bd_addr,
+                          uint16_t sec_level) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint16_t L2CA_FlushChannel(uint16_t lcid, uint16_t num_to_flush) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint16_t L2CA_Register(uint16_t psm, const tL2CAP_APPL_INFO& p_cb_info,
+                       bool enable_snoop, tL2CAP_ERTM_INFO* p_ertm_info,
+                       uint16_t my_mtu, uint16_t required_remote_mtu) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint16_t L2CA_Register2(uint16_t psm, const tL2CAP_APPL_INFO& p_cb_info,
+                        bool enable_snoop, tL2CAP_ERTM_INFO* p_ertm_info,
+                        uint16_t my_mtu, uint16_t required_remote_mtu,
+                        uint16_t sec_level) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint16_t L2CA_RegisterLECoc(uint16_t psm, const tL2CAP_APPL_INFO& p_cb_info,
+                            uint16_t sec_level, tL2CAP_LE_CFG_INFO cfg) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint16_t L2CA_SendFixedChnlData(uint16_t fixed_cid, const RawAddress& rem_bda,
+                                BT_HDR* p_buf) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint8_t L2CA_DataWrite(uint16_t cid, BT_HDR* p_data) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint8_t L2CA_LECocDataWrite(uint16_t cid, BT_HDR* p_data) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint8_t L2CA_SetTraceLevel(uint8_t new_level) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+void L2CA_Deregister(uint16_t psm) { mock_function_count_map[__func__]++; }
+void L2CA_DeregisterLECoc(uint16_t psm) { mock_function_count_map[__func__]++; }
+void L2CA_FreeLePSM(uint16_t psm) { mock_function_count_map[__func__]++; }
diff --git a/system/test/mock/mock_stack_l2cap_main.cc b/system/test/mock/mock_stack_l2cap_main.cc
new file mode 100644
index 00000000000..677858e122c
--- /dev/null
+++ b/system/test/mock/mock_stack_l2cap_main.cc
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:9
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include <string.h>
+#include "bt_common.h"
+#include "bt_target.h"
+#include "hci/include/btsnoop.h"
+#include "hcimsgs.h"
+#include "l2c_api.h"
+#include "l2c_int.h"
+#include "l2cdefs.h"
+#include "main/shim/shim.h"
+#include "osi/include/log.h"
+#include "osi/include/osi.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+uint8_t l2c_data_write(uint16_t cid, BT_HDR* p_data, uint16_t flags) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+void l2c_ccb_timer_timeout(void* data) { mock_function_count_map[__func__]++; }
+void l2c_fcrb_ack_timer_timeout(void* data) {
+  mock_function_count_map[__func__]++;
+}
+void l2c_free(void) { mock_function_count_map[__func__]++; }
+void l2c_init(void) { mock_function_count_map[__func__]++; }
+void l2c_lcb_timer_timeout(void* data) { mock_function_count_map[__func__]++; }
+void l2c_process_held_packets(bool timed_out) {
+  mock_function_count_map[__func__]++;
+}
+void l2c_rcv_acl_data(BT_HDR* p_msg) { mock_function_count_map[__func__]++; }
+void l2c_receive_hold_timer_timeout(UNUSED_ATTR void* data) {
+  mock_function_count_map[__func__]++;
+}
diff --git a/system/test/mock/mock_stack_pan_api.cc b/system/test/mock/mock_stack_pan_api.cc
new file mode 100644
index 00000000000..cb452b3347f
--- /dev/null
+++ b/system/test/mock/mock_stack_pan_api.cc
@@ -0,0 +1,93 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:11
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include <base/logging.h>
+#include <string.h>
+#include "bnep_api.h"
+#include "bt_common.h"
+#include "bt_types.h"
+#include "bta_sys.h"
+#include "btm_api.h"
+#include "hcidefs.h"
+#include "l2c_api.h"
+#include "pan_api.h"
+#include "sdp_api.h"
+#include "sdpdefs.h"
+#include "stack/btm/btm_sec.h"
+#include "stack/pan/pan_int.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+tBNEP_RESULT PAN_SetMulticastFilters(uint16_t handle,
+                                     uint16_t num_mcast_filters,
+                                     uint8_t* p_start_array,
+                                     uint8_t* p_end_array) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+tPAN_RESULT PAN_Connect(const RawAddress& rem_bda, uint8_t src_role,
+                        uint8_t dst_role, uint16_t* handle) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+tPAN_RESULT PAN_Disconnect(uint16_t handle) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+tPAN_RESULT PAN_SetProtocolFilters(uint16_t handle, uint16_t num_filters,
+                                   uint16_t* p_start_array,
+                                   uint16_t* p_end_array) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+tPAN_RESULT PAN_SetRole(uint8_t role, const char* p_user_name,
+                        const char* p_nap_name) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+tPAN_RESULT PAN_Write(uint16_t handle, const RawAddress& dst,
+                      const RawAddress& src, uint16_t protocol, uint8_t* p_data,
+                      uint16_t len, bool ext) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+tPAN_RESULT PAN_WriteBuf(uint16_t handle, const RawAddress& dst,
+                         const RawAddress& src, uint16_t protocol,
+                         BT_HDR* p_buf, bool ext) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint8_t PAN_SetTraceLevel(uint8_t new_level) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+void PAN_Deregister(void) { mock_function_count_map[__func__]++; }
+void PAN_Init(void) { mock_function_count_map[__func__]++; }
+void PAN_Register(tPAN_REGISTER* p_register) {
+  mock_function_count_map[__func__]++;
+}
diff --git a/system/test/mock/mock_stack_rfcomm_port_api.cc b/system/test/mock/mock_stack_rfcomm_port_api.cc
new file mode 100644
index 00000000000..c2b619901d7
--- /dev/null
+++ b/system/test/mock/mock_stack_rfcomm_port_api.cc
@@ -0,0 +1,130 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:20
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include <base/logging.h>
+#include <string.h>
+#include "bt_common.h"
+#include "l2c_api.h"
+#include "osi/include/log.h"
+#include "osi/include/mutex.h"
+#include "port_api.h"
+#include "rfcdefs.h"
+#include "sdp_api.h"
+#include "stack/include/btm_api_types.h"
+#include "stack/rfcomm/port_int.h"
+#include "stack/rfcomm/rfc_int.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+bool PORT_IsOpening(RawAddress* bd_addr) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+const char* PORT_GetResultString(const uint8_t result_code) {
+  mock_function_count_map[__func__]++;
+  return nullptr;
+}
+int PORT_CheckConnection(uint16_t handle, RawAddress* bd_addr,
+                         uint16_t* p_lcid) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+int PORT_ClearKeepHandleFlag(uint16_t port_handle) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+int PORT_FlowControl_MaxCredit(uint16_t handle, bool enable) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+int PORT_GetState(uint16_t handle, tPORT_STATE* p_settings) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+int PORT_ReadData(uint16_t handle, char* p_data, uint16_t max_len,
+                  uint16_t* p_len) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+int PORT_SetDataCOCallback(uint16_t port_handle,
+                           tPORT_DATA_CO_CALLBACK* p_port_cb) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+int PORT_SetEventCallback(uint16_t port_handle, tPORT_CALLBACK* p_port_cb) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+int PORT_SetEventMask(uint16_t port_handle, uint32_t mask) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+int PORT_SetState(uint16_t handle, tPORT_STATE* p_settings) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+int PORT_WriteData(uint16_t handle, const char* p_data, uint16_t max_len,
+                   uint16_t* p_len) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+int PORT_WriteDataCO(uint16_t handle, int* p_len) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+int RFCOMM_CreateConnection(uint16_t uuid, uint8_t scn, bool is_server,
+                            uint16_t mtu, const RawAddress& bd_addr,
+                            uint16_t* p_handle, tPORT_CALLBACK* p_mgmt_cb) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+int RFCOMM_CreateConnectionWithSecurity(uint16_t uuid, uint8_t scn,
+                                        bool is_server, uint16_t mtu,
+                                        const RawAddress& bd_addr,
+                                        uint16_t* p_handle,
+                                        tPORT_CALLBACK* p_mgmt_cb,
+                                        uint16_t sec_mask) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+int RFCOMM_RemoveConnection(uint16_t handle) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+int RFCOMM_RemoveServer(uint16_t handle) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+uint8_t PORT_SetTraceLevel(uint8_t new_level) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+void RFCOMM_ClearSecurityRecord(uint32_t scn) {
+  mock_function_count_map[__func__]++;
+}
+void RFCOMM_Init(void) { mock_function_count_map[__func__]++; }
diff --git a/system/test/mock/mock_stack_sdp.cc b/system/test/mock/mock_stack_sdp.cc
new file mode 100644
index 00000000000..ef39c6331f1
--- /dev/null
+++ b/system/test/mock/mock_stack_sdp.cc
@@ -0,0 +1,113 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ */
+
+#include <string.h>
+
+#include "bt_target.h"
+
+#include "sdp_api.h"
+
+#include "osi/include/osi.h"
+
+using bluetooth::Uuid;
+
+bool SDP_InitDiscoveryDb(tSDP_DISCOVERY_DB* p_db, uint32_t len,
+                         uint16_t num_uuid, const Uuid* p_uuid_list,
+                         uint16_t num_attr, uint16_t* p_attr_list) {
+  return false;
+}
+
+bool SDP_CancelServiceSearch(tSDP_DISCOVERY_DB* p_db) { return false; }
+
+bool SDP_ServiceSearchRequest(const RawAddress& p_bd_addr,
+                              tSDP_DISCOVERY_DB* p_db,
+                              tSDP_DISC_CMPL_CB* p_cb) {
+  return false;
+}
+
+bool SDP_ServiceSearchAttributeRequest(const RawAddress& p_bd_addr,
+                                       tSDP_DISCOVERY_DB* p_db,
+                                       tSDP_DISC_CMPL_CB* p_cb) {
+  return false;
+}
+bool SDP_ServiceSearchAttributeRequest2(const RawAddress& p_bd_addr,
+                                        tSDP_DISCOVERY_DB* p_db,
+                                        tSDP_DISC_CMPL_CB2* p_cb2,
+                                        void* user_data) {
+  return false;
+}
+
+tSDP_DISC_ATTR* SDP_FindAttributeInRec(tSDP_DISC_REC* p_rec, uint16_t attr_id) {
+  return (NULL);
+}
+
+bool SDP_FindServiceUUIDInRec(tSDP_DISC_REC* p_rec, Uuid* p_uuid) {
+  return false;
+}
+
+bool SDP_FindServiceUUIDInRec_128bit(tSDP_DISC_REC* p_rec, Uuid* p_uuid) {
+  return false;
+}
+
+tSDP_DISC_REC* SDP_FindServiceInDb(tSDP_DISCOVERY_DB* p_db,
+                                   uint16_t service_uuid,
+                                   tSDP_DISC_REC* p_start_rec) {
+  return (NULL);
+}
+
+tSDP_DISC_REC* SDP_FindServiceInDb_128bit(tSDP_DISCOVERY_DB* p_db,
+                                          tSDP_DISC_REC* p_start_rec) {
+  return (NULL);
+}
+
+tSDP_DISC_REC* SDP_FindServiceUUIDInDb(tSDP_DISCOVERY_DB* p_db,
+                                       const Uuid& uuid,
+                                       tSDP_DISC_REC* p_start_rec) {
+  return (NULL);
+}
+
+bool SDP_FindProtocolListElemInRec(tSDP_DISC_REC* p_rec, uint16_t layer_uuid,
+                                   tSDP_PROTOCOL_ELEM* p_elem) {
+  return (false);
+}
+
+bool SDP_FindProfileVersionInRec(tSDP_DISC_REC* p_rec, uint16_t profile_uuid,
+                                 uint16_t* p_version) {
+  return (false);
+}
+
+uint16_t SDP_DiDiscover(const RawAddress& remote_device,
+                        tSDP_DISCOVERY_DB* p_db, uint32_t len,
+                        tSDP_DISC_CMPL_CB* p_cb) {
+  return 0;
+}
+
+uint8_t SDP_GetNumDiRecords(tSDP_DISCOVERY_DB* p_db) { return 0; }
+
+uint16_t SDP_GetDiRecord(uint8_t get_record_index,
+                         tSDP_DI_GET_RECORD* p_device_info,
+                         tSDP_DISCOVERY_DB* p_db) {
+  return 0;
+}
+uint16_t SDP_SetLocalDiRecord(tSDP_DI_RECORD* p_device_info,
+                              uint32_t* p_handle) {
+  return 0;
+}
+uint8_t SDP_SetTraceLevel(uint8_t new_level) { return 0; }
diff --git a/system/test/mock/mock_stack_sdp_db.cc b/system/test/mock/mock_stack_sdp_db.cc
new file mode 100644
index 00000000000..d2686cd1aab
--- /dev/null
+++ b/system/test/mock/mock_stack_sdp_db.cc
@@ -0,0 +1,102 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:14
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include <stdio.h>
+#include <string.h>
+#include "bt_common.h"
+#include "bt_target.h"
+#include "stack/include/sdp_api.h"
+#include "stack/sdp/sdpint.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+bool SDP_AddAdditionProtoLists(uint32_t handle, uint16_t num_elem,
+                               tSDP_PROTO_LIST_ELEM* p_proto_list) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool SDP_AddAttribute(uint32_t handle, uint16_t attr_id, uint8_t attr_type,
+                      uint32_t attr_len, uint8_t* p_val) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool SDP_AddLanguageBaseAttrIDList(uint32_t handle, uint16_t lang,
+                                   uint16_t char_enc, uint16_t base_id) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool SDP_AddProfileDescriptorList(uint32_t handle, uint16_t profile_uuid,
+                                  uint16_t version) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool SDP_AddProtocolList(uint32_t handle, uint16_t num_elem,
+                         tSDP_PROTOCOL_ELEM* p_elem_list) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool SDP_AddSequence(uint32_t handle, uint16_t attr_id, uint16_t num_elem,
+                     uint8_t type[], uint8_t len[], uint8_t* p_val[]) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool SDP_AddServiceClassIdList(uint32_t handle, uint16_t num_services,
+                               uint16_t* p_service_uuids) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool SDP_AddUuidSequence(uint32_t handle, uint16_t attr_id, uint16_t num_uuids,
+                         uint16_t* p_uuids) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool SDP_DeleteAttribute(uint32_t handle, uint16_t attr_id) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool SDP_DeleteRecord(uint32_t handle) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+tSDP_ATTRIBUTE* sdp_db_find_attr_in_rec(tSDP_RECORD* p_rec, uint16_t start_attr,
+                                        uint16_t end_attr) {
+  mock_function_count_map[__func__]++;
+  return nullptr;
+}
+tSDP_RECORD* sdp_db_find_record(uint32_t handle) {
+  mock_function_count_map[__func__]++;
+  return nullptr;
+}
+tSDP_RECORD* sdp_db_service_search(tSDP_RECORD* p_rec, tSDP_UUID_SEQ* p_seq) {
+  mock_function_count_map[__func__]++;
+  return nullptr;
+}
+uint32_t SDP_CreateRecord(void) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
diff --git a/system/test/mock/mock_stack_sdp_main.cc b/system/test/mock/mock_stack_sdp_main.cc
new file mode 100644
index 00000000000..df95fd39c8f
--- /dev/null
+++ b/system/test/mock/mock_stack_sdp_main.cc
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:5
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include <string.h>
+#include "bt_common.h"
+#include "bt_target.h"
+#include "hcidefs.h"
+#include "l2c_api.h"
+#include "l2cdefs.h"
+#include "osi/include/osi.h"
+#include "sdp_api.h"
+#include "stack/btm/btm_sec.h"
+#include "stack/sdp/sdpint.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+tCONN_CB* sdp_conn_originate(const RawAddress& p_bd_addr) {
+  mock_function_count_map[__func__]++;
+  return nullptr;
+}
+void sdp_conn_timer_timeout(void* data) { mock_function_count_map[__func__]++; }
+void sdp_disconnect(tCONN_CB* p_ccb, uint16_t reason) {
+  mock_function_count_map[__func__]++;
+}
+void sdp_free(void) { mock_function_count_map[__func__]++; }
+void sdp_init(void) { mock_function_count_map[__func__]++; }
diff --git a/system/test/mock/mock_stack_smp_api.cc b/system/test/mock/mock_stack_smp_api.cc
new file mode 100644
index 00000000000..58cf1deee08
--- /dev/null
+++ b/system/test/mock/mock_stack_smp_api.cc
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:11
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include <string.h>
+#include "bt_target.h"
+#include "hcimsgs.h"
+#include "main/shim/shim.h"
+#include "stack/btm/btm_dev.h"
+#include "stack/include/l2c_api.h"
+#include "stack/include/l2cdefs.h"
+#include "stack/include/smp_api.h"
+#include "stack/smp/smp_int.h"
+#include "stack_config.h"
+#include "utils/include/bt_utils.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+bool SMP_PairCancel(const RawAddress& bd_addr) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool SMP_Register(tSMP_CALLBACK* p_cback) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+tSMP_STATUS SMP_BR_PairWith(const RawAddress& bd_addr) {
+  mock_function_count_map[__func__]++;
+  return SMP_SUCCESS;
+}
+tSMP_STATUS SMP_Pair(const RawAddress& bd_addr) {
+  mock_function_count_map[__func__]++;
+  return SMP_SUCCESS;
+}
+uint8_t SMP_SetTraceLevel(uint8_t new_level) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+void SMP_ConfirmReply(const RawAddress& bd_addr, uint8_t res) {
+  mock_function_count_map[__func__]++;
+}
+void SMP_Init(void) { mock_function_count_map[__func__]++; }
+void SMP_OobDataReply(const RawAddress& bd_addr, tSMP_STATUS res, uint8_t len,
+                      uint8_t* p_data) {
+  mock_function_count_map[__func__]++;
+}
+void SMP_PasskeyReply(const RawAddress& bd_addr, uint8_t res,
+                      uint32_t passkey) {
+  mock_function_count_map[__func__]++;
+}
+void SMP_SecureConnectionOobDataReply(uint8_t* p_data) {
+  mock_function_count_map[__func__]++;
+}
+void SMP_SecurityGrant(const RawAddress& bd_addr, tSMP_STATUS res) {
+  mock_function_count_map[__func__]++;
+}
diff --git a/system/test/mock/mock_system_libfmq_eventflag.cc b/system/test/mock/mock_system_libfmq_eventflag.cc
new file mode 100644
index 00000000000..8bdcb5687c4
--- /dev/null
+++ b/system/test/mock/mock_system_libfmq_eventflag.cc
@@ -0,0 +1,99 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:11
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include <fmq/EventFlag.h>
+
+using namespace android;
+using namespace android::hardware;
+
+namespace android {
+namespace hardware {
+namespace details {
+
+void logError(const std::string& message) {}
+
+}  // namespace details
+}  // namespace hardware
+}  // namespace android
+
+#if 0
+#include <linux/futex.h>
+#include <string.h>
+#include <sys/mman.h>
+#include <sys/syscall.h>
+#include <unistd.h>
+#include <utils/Log.h>
+#include <utils/SystemClock.h>
+#include <new>
+#endif
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+EventFlag::EventFlag(int fd, off_t offset, status_t* status) {
+  mock_function_count_map[__func__]++;
+}
+EventFlag::EventFlag(std::atomic<uint32_t>* fwAddr, status_t* status) {
+  mock_function_count_map[__func__]++;
+}
+EventFlag::~EventFlag() { mock_function_count_map[__func__]++; }
+status_t EventFlag::createEventFlag(int fd, off_t offset, EventFlag** flag) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+status_t EventFlag::createEventFlag(std::atomic<uint32_t>* fwAddr,
+                                    EventFlag** flag) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+status_t EventFlag::deleteEventFlag(EventFlag** evFlag) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+status_t EventFlag::unmapEventFlagWord(std::atomic<uint32_t>* efWordPtr,
+                                       bool* efWordNeedsUnmapping) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+status_t EventFlag::wait(uint32_t bitmask, uint32_t* efState,
+                         int64_t timeoutNanoSeconds, bool retry) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+status_t EventFlag::waitHelper(uint32_t bitmask, uint32_t* efState,
+                               int64_t timeoutNanoSeconds) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+status_t EventFlag::wake(uint32_t bitmask) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+void EventFlag::addNanosecondsToCurrentTime(int64_t nanoSeconds,
+                                            struct timespec* waitTime) {
+  mock_function_count_map[__func__]++;
+}
diff --git a/system/test/mock/mock_udrv_ulinux_uipc.cc b/system/test/mock/mock_udrv_ulinux_uipc.cc
new file mode 100644
index 00000000000..f32f3998e43
--- /dev/null
+++ b/system/test/mock/mock_udrv_ulinux_uipc.cc
@@ -0,0 +1,100 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ *   Functions generated:12
+ */
+
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+#include <errno.h>
+#include <fcntl.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/mman.h>
+#include <sys/poll.h>
+#include <sys/prctl.h>
+#include <sys/select.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
+#include <sys/un.h>
+#include <unistd.h>
+#include <mutex>
+#include <set>
+#include "audio_a2dp_hw/include/audio_a2dp_hw.h"
+#include "bt_common.h"
+#include "bt_types.h"
+#include "bt_utils.h"
+#include "osi/include/osi.h"
+#include "osi/include/socket_utils/sockets.h"
+#include "uipc.h"
+
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+bool UIPC_Open(tUIPC_STATE& uipc, tUIPC_CH_ID ch_id, tUIPC_RCV_CBACK* p_cback,
+               const char* socket_path) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+bool UIPC_Send(tUIPC_STATE& uipc, tUIPC_CH_ID ch_id,
+               UNUSED_ATTR uint16_t msg_evt, const uint8_t* p_buf,
+               uint16_t msglen) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+int uipc_start_main_server_thread(tUIPC_STATE& uipc) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+std::unique_ptr<tUIPC_STATE> UIPC_Init() {
+  mock_function_count_map[__func__]++;
+  return nullptr;
+}
+const char* dump_uipc_event(tUIPC_EVENT event) {
+  mock_function_count_map[__func__]++;
+  return nullptr;
+}
+uint32_t UIPC_Read(tUIPC_STATE& uipc, tUIPC_CH_ID ch_id,
+                   UNUSED_ATTR uint16_t* p_msg_evt, uint8_t* p_buf,
+                   uint32_t len) {
+  mock_function_count_map[__func__]++;
+  return 0;
+}
+bool UIPC_Ioctl(tUIPC_STATE& uipc, tUIPC_CH_ID ch_id, uint32_t request,
+                void* param) {
+  mock_function_count_map[__func__]++;
+  return false;
+}
+void UIPC_Close(tUIPC_STATE& uipc, tUIPC_CH_ID ch_id) {
+  mock_function_count_map[__func__]++;
+}
+void uipc_close_locked(tUIPC_STATE& uipc, tUIPC_CH_ID ch_id) {
+  mock_function_count_map[__func__]++;
+}
+void uipc_main_cleanup(tUIPC_STATE& uipc) {
+  mock_function_count_map[__func__]++;
+}
+void uipc_stop_main_server_thread(tUIPC_STATE& uipc) {
+  mock_function_count_map[__func__]++;
+}
-- 
GitLab