OSDN Git Service

Point stack_btm_test to use common test/mocks
authorChris Manton <cmanton@google.com>
Wed, 5 May 2021 23:58:48 +0000 (16:58 -0700)
committerChris Manton <cmanton@google.com>
Sun, 9 May 2021 20:28:28 +0000 (13:28 -0700)
Bug: 183374320
Test: gd/cert/run
Tag: #refactor

Change-Id: I40c663f53914e6174ae531648c027b9cd0f7ab56

18 files changed:
stack/Android.bp
stack/test/btm/stack_btm_test.cc
test/Android.bp
test/mock/mock_activity_attribution.cc
test/mock/mock_btif_bqr.cc [moved from stack/test/common/mock_btif_bqr.cc with 100% similarity]
test/mock/mock_main_bte.cc [new file with mode: 0644]
test/mock/mock_main_bte.h [new file with mode: 0644]
test/mock/mock_main_shim_acl.cc
test/mock/mock_main_shim_acl_api.cc [moved from stack/test/common/mock_main_shim_acl_api.cc with 100% similarity]
test/mock/mock_main_shim_l2cap_api.cc [new file with mode: 0644]
test/mock/mock_main_shim_l2cap_api.h [new file with mode: 0644]
test/mock/mock_main_shim_link_policy.cc [new file with mode: 0644]
test/mock/mock_main_shim_link_policy.h [new file with mode: 0644]
test/mock/mock_main_shim_metrics_api.cc
test/mock/mock_main_shim_metrics_api.h [new file with mode: 0644]
test/mock/mock_stack_btu_hcif.cc [moved from stack/test/common/mock_btu_hcif.cc with 100% similarity]
test/mock/mock_stack_gatt_auth.cc [moved from stack/test/common/mock_gatt_gatt_auth.cc with 100% similarity]
test/mock/mock_stack_l2cap_utils.cc [moved from stack/test/common/mock_l2cap_l2c_utils.cc with 100% similarity]

index bb91dfb..1c70760 100644 (file)
@@ -687,11 +687,28 @@ cc_test {
     ],
     include_dirs: [
         "system/bt",
+        "system/bt/gd",
         "system/bt/vnd/ble",
     ],
+    generated_headers: [
+        "BluetoothGeneratedBundlerSchema_h_bfbs",
+        "BluetoothGeneratedDumpsysDataSchema_h",
+        "BluetoothGeneratedPackets_h",
+    ],
     srcs: crypto_toolbox_srcs + [
+        ":BluetoothBtaaSources_host",
+        ":BluetoothHalSources_hci_host",
+        ":BluetoothOsSources_host",
+        ":TestMockBta",
+        ":TestMockBtif",
         ":TestMockDevice",
         ":TestMockLegacyHciCommands",
+        ":TestMockMainBte",
+        ":TestMockMainShim",
+        ":TestMockStackBtu",
+        ":TestMockStackGap",
+        ":TestMockStackGatt",
+        ":TestMockStackSmp",
         ":TestStackL2cap",
         "acl/acl.cc",
         "acl/ble_acl.cc",
@@ -720,39 +737,19 @@ cc_test {
         "metrics/stack_metrics_logging.cc",
         "test/btm/stack_btm_test.cc",
         "test/btm/peer_packet_types_test.cc",
-        "test/common/mock_bta_dm_act.cc",
-        "test/common/mock_bta_sys_conn.cc",
-        "test/common/mock_btif_bqr.cc",
-        "test/common/mock_btif_dm.cc",
-        "test/common/mock_btif_storage.cc",
-        "test/common/mock_btu_hcif.cc",
-        "test/common/mock_gap_gap_ble.cc",
-        "test/common/mock_gatt_connection_manager.cc",
-        "test/common/mock_gatt_gatt_auth.cc",
-        "test/common/mock_gatt_main.cc",
-        "test/common/mock_hci_packet_parser.cc",
-        "test/common/mock_l2cap_l2c_utils.cc",
-        "test/common/mock_main_bte_main.cc",
-        "test/common/mock_main_shim.cc",
-        "test/common/mock_main_shim_acl_api.cc",
-        "test/common/mock_main_shim_l2c_api.cc",
-        "test/common/mock_main_shim_btm_api.cc",
-        "test/common/mock_main_shim_link_policy.cc",
-        "test/common/mock_smp_smp_act.cc",
-        "test/common/mock_smp_smp_api.cc",
     ],
     static_libs: [
         "libbt-common",
         "libbt-protos-lite",
-        "libbte",
+        "libbtdevice",
         "libgmock",
         "liblog",
         "libosi",
-        "libbtdevice",
     ],
     shared_libs: [
-        "libprotobuf-cpp-lite",
         "libcrypto",
+        "libflatbuffers-cpp",
+        "libprotobuf-cpp-lite",
     ],
     sanitize: {
         address: true,
@@ -898,9 +895,10 @@ cc_test {
         "libosi",
     ],
     shared_libs: [
+        "libbinder_ndk",
         "libcrypto",
-        "libprotobuf-cpp-lite",
         "libflatbuffers-cpp",
+        "libprotobuf-cpp-lite",
     ],
     sanitize: {
         address: true,
index 22e4d85..f2880c6 100644 (file)
 #include <gtest/gtest.h>
 #include <map>
 
+#include "btif/include/btif_hh.h"
 #include "hci/include/hci_layer.h"
 #include "hci/include/hci_packet_factory.h"
+#include "hci/include/packet_fragmenter.h"
 #include "internal_include/stack_config.h"
 #include "osi/include/osi.h"
 #include "stack/btm/btm_int_types.h"
 #include "stack/include/acl_api.h"
 #include "stack/include/acl_hci_link_interface.h"
 #include "stack/include/btm_client_interface.h"
-#include "types/raw_address.h"
-
+#include "stack/l2cap/l2c_int.h"
 #include "test/mock/mock_hcic_hcicmds.h"
+#include "types/raw_address.h"
 
 namespace mock = test::mock::hcic_hcicmds;
 
 extern tBTM_CB btm_cb;
 
-bluetooth::common::MessageLoopThread* get_main_thread() { return nullptr; }
+uint8_t appl_trace_level = BT_TRACE_LEVEL_VERBOSE;
+btif_hh_cb_t btif_hh_cb;
+tL2C_CB l2cb;
 
 const hci_packet_factory_t* hci_packet_factory_get_interface() {
   return nullptr;
 }
 const hci_t* hci_layer_get_interface() { return nullptr; }
 
-bt_status_t do_in_main_thread(const base::Location& from_here,
-                              base::OnceClosure task) {
-  return BT_STATUS_SUCCESS;
-}
 void LogMsg(uint32_t trace_set_mask, const char* fmt_str, ...) {}
 
 const std::string kSmpOptions("mock smp options");
@@ -59,6 +59,7 @@ bool get_pts_crosskey_sdp_disable(void) { return false; }
 const std::string* get_pts_smp_options(void) { return &kSmpOptions; }
 int get_pts_smp_failure_case(void) { return 123; }
 config_t* get_all(void) { return nullptr; }
+const packet_fragmenter_t* packet_fragmenter_get_interface() { return nullptr; }
 
 stack_config_t mock_stack_config{
     .get_trace_config_enabled = get_trace_config_enabled,
@@ -76,7 +77,7 @@ const stack_config_t* stack_config_get_interface(void) {
 
 std::map<std::string, int> mock_function_count_map;
 
-bool MOCK_bluetooth_shim_is_gd_acl_enabled_;
+extern bool MOCK_bluetooth_shim_is_gd_acl_enabled_;
 
 namespace {
 
index 3193183..a17c04f 100644 (file)
@@ -104,6 +104,13 @@ filegroup {
 }
 
 filegroup {
+    name: "TestMockMainShimFlags",
+    srcs: [
+      "mock/mock_main_shim.cc",
+    ],
+}
+
+filegroup {
   name: "TestMockBtif",
   srcs: [
       "mock/mock_btif*.cc",
@@ -165,3 +172,31 @@ filegroup {
       "mock/mock_stack_metrics*.cc",
   ],
 }
+
+filegroup {
+  name: "TestMockStackGap",
+  srcs: [
+      "mock/mock_stack_gap*.cc",
+  ],
+}
+
+filegroup {
+  name: "TestMockStackGatt",
+  srcs: [
+      "mock/mock_stack_gatt*.cc",
+  ],
+}
+
+filegroup {
+  name: "TestMockStackBtu",
+  srcs: [
+      "mock/mock_stack_btu*.cc",
+  ],
+}
+
+filegroup {
+  name: "TestMockMainBte",
+  srcs: [
+      "mock/mock_main_bte*.cc",
+  ],
+}
index e5cb2d9..6879796 100644 (file)
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#include "module.h"
+#include "gd/module.h"
 
 #include "btif/include/btif_activity_attribution.h"
 #include "main/shim/activity_attribution.h"
diff --git a/test/mock/mock_main_bte.cc b/test/mock/mock_main_bte.cc
new file mode 100644 (file)
index 0000000..c0734f5
--- /dev/null
@@ -0,0 +1,68 @@
+/*
+ * 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
+ *
+ *  mockcify.pl ver 0.2
+ */
+
+#include <cstdint>
+#include <functional>
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+// Mock include file to share data between tests and mock
+#include "test/mock/mock_main_bte.h"
+
+// Mocked compile conditionals, if any
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+// Mocked internal structures, if any
+
+namespace test {
+namespace mock {
+namespace main_bte {
+
+// Function state capture and return values, if needed
+struct post_to_main_message_loop post_to_main_message_loop;
+struct bte_main_init bte_main_init;
+struct bte_main_hci_send bte_main_hci_send;
+
+}  // namespace main_bte
+}  // namespace mock
+}  // namespace test
+
+// Mocked functions, if any
+void post_to_main_message_loop(const base::Location& from_here, BT_HDR* p_msg) {
+  mock_function_count_map[__func__]++;
+  test::mock::main_bte::post_to_main_message_loop(from_here, p_msg);
+}
+void bte_main_init(void) {
+  mock_function_count_map[__func__]++;
+  test::mock::main_bte::bte_main_init();
+}
+void bte_main_hci_send(BT_HDR* p_msg, uint16_t event) {
+  mock_function_count_map[__func__]++;
+  test::mock::main_bte::bte_main_hci_send(p_msg, event);
+}
+
+// END mockcify generation
diff --git a/test/mock/mock_main_bte.h b/test/mock/mock_main_bte.h
new file mode 100644 (file)
index 0000000..3ef95e1
--- /dev/null
@@ -0,0 +1,96 @@
+/*
+ * 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
+ *
+ *  mockcify.pl ver 0.2
+ */
+
+#include <cstdint>
+#include <functional>
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+// Original included files, if any
+// NOTE: Since this is a mock file with mock definitions some number of
+//       include files may not be required.  The include-what-you-use
+//       still applies, but crafting proper inclusion is out of scope
+//       for this effort.  This compilation unit may compile as-is, or
+//       may need attention to prune the inclusion set.
+#include <base/logging.h>
+#include <hardware/bluetooth.h>
+#include "bt_common.h"
+#include "btcore/include/module.h"
+#include "bte.h"
+#include "btif/include/btif_config.h"
+#include "btu.h"
+#include "device/include/interop.h"
+#include "hci/include/btsnoop.h"
+#include "hci/include/hci_layer.h"
+#include "main/shim/hci_layer.h"
+#include "main/shim/shim.h"
+#include "osi/include/log.h"
+#include "osi/include/osi.h"
+#include "stack_config.h"
+
+// Mocked compile conditionals, if any
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+namespace test {
+namespace mock {
+namespace main_bte {
+
+// Shared state between mocked functions and tests
+// Name: post_to_main_message_loop
+// Params: const base::Location& from_here, BT_HDR* p_msg
+// Returns: void
+struct post_to_main_message_loop {
+  std::function<void(const base::Location& from_here, BT_HDR* p_msg)> body{
+      [](const base::Location& from_here, BT_HDR* p_msg) {}};
+  void operator()(const base::Location& from_here, BT_HDR* p_msg) {
+    body(from_here, p_msg);
+  };
+};
+extern struct post_to_main_message_loop post_to_main_message_loop;
+// Name: bte_main_init
+// Params: void
+// Returns: void
+struct bte_main_init {
+  std::function<void(void)> body{[](void) {}};
+  void operator()(void) { body(); };
+};
+extern struct bte_main_init bte_main_init;
+// Name: bte_main_hci_send
+// Params: BT_HDR* p_msg, uint16_t event
+// Returns: void
+struct bte_main_hci_send {
+  std::function<void(BT_HDR* p_msg, uint16_t event)> body{
+      [](BT_HDR* p_msg, uint16_t event) {}};
+  void operator()(BT_HDR* p_msg, uint16_t event) { body(p_msg, event); };
+};
+extern struct bte_main_hci_send bte_main_hci_send;
+
+}  // namespace main_bte
+}  // namespace mock
+}  // namespace test
+
+// END mockcify generation
index ad43a76..ae7c9e5 100644 (file)
@@ -33,34 +33,4 @@ extern std::map<std::string, int> mock_function_count_map;
 #define UNUSED_ATTR
 #endif
 
-void bluetooth::shim::ACL_CreateClassicConnection(
-    const RawAddress& raw_address) {
-  mock_function_count_map[__func__]++;
-}
-void bluetooth::shim::ACL_CancelClassicConnection(
-    const RawAddress& raw_address) {
-  mock_function_count_map[__func__]++;
-}
-bool bluetooth::shim::ACL_AcceptLeConnectionFrom(
-    const tBLE_BD_ADDR& legacy_address_with_type, bool is_direct) {
-  mock_function_count_map[__func__]++;
-  return true;
-}
-void bluetooth::shim::ACL_IgnoreLeConnectionFrom(
-    const tBLE_BD_ADDR& legacy_address_with_type) {
-  mock_function_count_map[__func__]++;
-}
-void bluetooth::shim::ACL_IgnoreAllLeConnections() {
-  mock_function_count_map[__func__]++;
-}
-void bluetooth::shim::ACL_ConfigureLePrivacy(bool is_le_privacy_enabled) {
-  mock_function_count_map[__func__]++;
-}
-void bluetooth::shim::ACL_Disconnect(uint16_t handle, bool is_classic,
-                                     tHCI_STATUS reason) {
-  mock_function_count_map[__func__]++;
-}
 void bluetooth::shim::ACL_Shutdown() { mock_function_count_map[__func__]++; }
-void bluetooth::shim::ACL_WriteData(uint16_t handle, BT_HDR* p_buf) {
-  mock_function_count_map[__func__]++;
-}
diff --git a/test/mock/mock_main_shim_l2cap_api.cc b/test/mock/mock_main_shim_l2cap_api.cc
new file mode 100644 (file)
index 0000000..d934cac
--- /dev/null
@@ -0,0 +1,343 @@
+/*
+ * 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:45
+ *
+ *  mockcify.pl ver 0.2
+ */
+
+#include <cstdint>
+#include <functional>
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+// Mock include file to share data between tests and mock
+#include "test/mock/mock_main_shim_l2cap_api.h"
+
+// Mocked compile conditionals, if any
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+// Mocked internal structures, if any
+
+namespace test {
+namespace mock {
+namespace main_shim_l2cap_api {
+
+// Function state capture and return values, if needed
+struct L2CA_ReadRemoteVersion L2CA_ReadRemoteVersion;
+struct L2CA_ReadRemoteFeatures L2CA_ReadRemoteFeatures;
+struct L2CA_UseLegacySecurityModule L2CA_UseLegacySecurityModule;
+struct L2CA_Register L2CA_Register;
+struct L2CA_Deregister L2CA_Deregister;
+struct L2CA_ConnectReq L2CA_ConnectReq;
+struct L2CA_DisconnectReq L2CA_DisconnectReq;
+struct L2CA_DataWrite L2CA_DataWrite;
+struct L2CA_ReconfigCreditBasedConnsReq L2CA_ReconfigCreditBasedConnsReq;
+struct L2CA_ConnectCreditBasedReq L2CA_ConnectCreditBasedReq;
+struct L2CA_ConnectCreditBasedRsp L2CA_ConnectCreditBasedRsp;
+struct L2CA_SetIdleTimeoutByBdAddr L2CA_SetIdleTimeoutByBdAddr;
+struct L2CA_SetAclPriority L2CA_SetAclPriority;
+struct L2CA_SetAclPriority2 L2CA_SetAclPriority2;
+struct L2CA_GetPeerFeatures L2CA_GetPeerFeatures;
+struct L2CA_RegisterFixedChannel L2CA_RegisterFixedChannel;
+struct L2CA_ConnectFixedChnl L2CA_ConnectFixedChnl;
+struct L2CA_SendFixedChnlData L2CA_SendFixedChnlData;
+struct L2CA_RemoveFixedChnl L2CA_RemoveFixedChnl;
+struct L2CA_GetLeHandle L2CA_GetLeHandle;
+struct L2CA_LeConnectionUpdate L2CA_LeConnectionUpdate;
+struct L2CA_EnableUpdateBleConnParams L2CA_EnableUpdateBleConnParams;
+struct L2CA_GetRemoteCid L2CA_GetRemoteCid;
+struct L2CA_SetTxPriority L2CA_SetTxPriority;
+struct L2CA_SetLeGattTimeout L2CA_SetLeGattTimeout;
+struct L2CA_SetChnlFlushability L2CA_SetChnlFlushability;
+struct L2CA_FlushChannel L2CA_FlushChannel;
+struct L2CA_IsLinkEstablished L2CA_IsLinkEstablished;
+struct L2CA_IsLeLink L2CA_IsLeLink;
+struct L2CA_ReadConnectionAddr L2CA_ReadConnectionAddr;
+struct L2CA_ReadRemoteConnectionAddr L2CA_ReadRemoteConnectionAddr;
+struct L2CA_GetBleConnRole L2CA_GetBleConnRole;
+struct L2CA_ConnectForSecurity L2CA_ConnectForSecurity;
+struct L2CA_SetBondingState L2CA_SetBondingState;
+struct L2CA_DisconnectLink L2CA_DisconnectLink;
+struct L2CA_GetNumLinks L2CA_GetNumLinks;
+struct L2CA_AllocateLePSM L2CA_AllocateLePSM;
+struct L2CA_FreeLePSM L2CA_FreeLePSM;
+struct L2CA_RegisterLECoc L2CA_RegisterLECoc;
+struct L2CA_DeregisterLECoc L2CA_DeregisterLECoc;
+struct L2CA_ConnectLECocReq L2CA_ConnectLECocReq;
+struct L2CA_GetPeerLECocConfig L2CA_GetPeerLECocConfig;
+struct L2CA_DisconnectLECocReq L2CA_DisconnectLECocReq;
+struct L2CA_LECocDataWrite L2CA_LECocDataWrite;
+struct L2CA_SwitchRoleToCentral L2CA_SwitchRoleToCentral;
+
+}  // namespace main_shim_l2cap_api
+}  // namespace mock
+}  // namespace test
+
+// Mocked functions, if any
+bool bluetooth::shim::L2CA_ReadRemoteVersion(const RawAddress& addr,
+                                             uint8_t* lmp_version,
+                                             uint16_t* manufacturer,
+                                             uint16_t* lmp_sub_version) {
+  mock_function_count_map[__func__]++;
+  return test::mock::main_shim_l2cap_api::L2CA_ReadRemoteVersion(
+      addr, lmp_version, manufacturer, lmp_sub_version);
+}
+uint8_t* bluetooth::shim::L2CA_ReadRemoteFeatures(const RawAddress& addr) {
+  mock_function_count_map[__func__]++;
+  return test::mock::main_shim_l2cap_api::L2CA_ReadRemoteFeatures(addr);
+}
+void bluetooth::shim::L2CA_UseLegacySecurityModule() {
+  mock_function_count_map[__func__]++;
+  test::mock::main_shim_l2cap_api::L2CA_UseLegacySecurityModule();
+}
+uint16_t bluetooth::shim::L2CA_Register(
+    uint16_t client_psm, const tL2CAP_APPL_INFO& callbacks, 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 test::mock::main_shim_l2cap_api::L2CA_Register(
+      client_psm, callbacks, enable_snoop, p_ertm_info, my_mtu,
+      required_remote_mtu, sec_level);
+}
+void bluetooth::shim::L2CA_Deregister(uint16_t psm) {
+  mock_function_count_map[__func__]++;
+  test::mock::main_shim_l2cap_api::L2CA_Deregister(psm);
+}
+uint16_t bluetooth::shim::L2CA_ConnectReq(uint16_t psm,
+                                          const RawAddress& raw_address) {
+  mock_function_count_map[__func__]++;
+  return test::mock::main_shim_l2cap_api::L2CA_ConnectReq(psm, raw_address);
+}
+bool bluetooth::shim::L2CA_DisconnectReq(uint16_t cid) {
+  mock_function_count_map[__func__]++;
+  return test::mock::main_shim_l2cap_api::L2CA_DisconnectReq(cid);
+}
+uint8_t bluetooth::shim::L2CA_DataWrite(uint16_t cid, BT_HDR* p_data) {
+  mock_function_count_map[__func__]++;
+  return test::mock::main_shim_l2cap_api::L2CA_DataWrite(cid, p_data);
+}
+bool bluetooth::shim::L2CA_ReconfigCreditBasedConnsReq(
+    const RawAddress& bd_addr, std::vector<uint16_t>& lcids,
+    tL2CAP_LE_CFG_INFO* p_cfg) {
+  mock_function_count_map[__func__]++;
+  return test::mock::main_shim_l2cap_api::L2CA_ReconfigCreditBasedConnsReq(
+      bd_addr, lcids, p_cfg);
+}
+std::vector<uint16_t> bluetooth::shim::L2CA_ConnectCreditBasedReq(
+    uint16_t psm, const RawAddress& p_bd_addr, tL2CAP_LE_CFG_INFO* p_cfg) {
+  mock_function_count_map[__func__]++;
+  return test::mock::main_shim_l2cap_api::L2CA_ConnectCreditBasedReq(
+      psm, p_bd_addr, p_cfg);
+}
+bool bluetooth::shim::L2CA_ConnectCreditBasedRsp(
+    const RawAddress& 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 test::mock::main_shim_l2cap_api::L2CA_ConnectCreditBasedRsp(
+      bd_addr, id, accepted_lcids, result, p_cfg);
+}
+bool bluetooth::shim::L2CA_SetIdleTimeoutByBdAddr(const RawAddress& bd_addr,
+                                                  uint16_t timeout,
+                                                  tBT_TRANSPORT transport) {
+  mock_function_count_map[__func__]++;
+  return test::mock::main_shim_l2cap_api::L2CA_SetIdleTimeoutByBdAddr(
+      bd_addr, timeout, transport);
+}
+bool bluetooth::shim::L2CA_SetAclPriority(uint16_t handle, bool high_priority) {
+  mock_function_count_map[__func__]++;
+  return test::mock::main_shim_l2cap_api::L2CA_SetAclPriority(handle,
+                                                              high_priority);
+}
+bool bluetooth::shim::L2CA_SetAclPriority(const RawAddress& bd_addr,
+                                          tL2CAP_PRIORITY priority) {
+  mock_function_count_map[__func__]++;
+  return test::mock::main_shim_l2cap_api::L2CA_SetAclPriority2(bd_addr,
+                                                               priority);
+}
+bool bluetooth::shim::L2CA_GetPeerFeatures(const RawAddress& bd_addr,
+                                           uint32_t* p_ext_feat,
+                                           uint8_t* p_chnl_mask) {
+  mock_function_count_map[__func__]++;
+  return test::mock::main_shim_l2cap_api::L2CA_GetPeerFeatures(
+      bd_addr, p_ext_feat, p_chnl_mask);
+}
+bool bluetooth::shim::L2CA_RegisterFixedChannel(uint16_t cid,
+                                                tL2CAP_FIXED_CHNL_REG* p_freg) {
+  mock_function_count_map[__func__]++;
+  return test::mock::main_shim_l2cap_api::L2CA_RegisterFixedChannel(cid,
+                                                                    p_freg);
+}
+bool bluetooth::shim::L2CA_ConnectFixedChnl(uint16_t cid,
+                                            const RawAddress& rem_bda) {
+  mock_function_count_map[__func__]++;
+  return test::mock::main_shim_l2cap_api::L2CA_ConnectFixedChnl(cid, rem_bda);
+}
+uint16_t bluetooth::shim::L2CA_SendFixedChnlData(uint16_t cid,
+                                                 const RawAddress& rem_bda,
+                                                 BT_HDR* p_buf) {
+  mock_function_count_map[__func__]++;
+  return test::mock::main_shim_l2cap_api::L2CA_SendFixedChnlData(cid, rem_bda,
+                                                                 p_buf);
+}
+bool bluetooth::shim::L2CA_RemoveFixedChnl(uint16_t cid,
+                                           const RawAddress& rem_bda) {
+  mock_function_count_map[__func__]++;
+  return test::mock::main_shim_l2cap_api::L2CA_RemoveFixedChnl(cid, rem_bda);
+}
+uint16_t bluetooth::shim::L2CA_GetLeHandle(const RawAddress& rem_bda) {
+  mock_function_count_map[__func__]++;
+  return test::mock::main_shim_l2cap_api::L2CA_GetLeHandle(rem_bda);
+}
+void bluetooth::shim::L2CA_LeConnectionUpdate(
+    const RawAddress& rem_bda, 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__]++;
+  test::mock::main_shim_l2cap_api::L2CA_LeConnectionUpdate(
+      rem_bda, min_int, max_int, latency, timeout, min_ce_len, max_ce_len);
+}
+bool bluetooth::shim::L2CA_EnableUpdateBleConnParams(const RawAddress& rem_bda,
+                                                     bool enable) {
+  mock_function_count_map[__func__]++;
+  return test::mock::main_shim_l2cap_api::L2CA_EnableUpdateBleConnParams(
+      rem_bda, enable);
+}
+bool bluetooth::shim::L2CA_GetRemoteCid(uint16_t lcid, uint16_t* rcid) {
+  mock_function_count_map[__func__]++;
+  return test::mock::main_shim_l2cap_api::L2CA_GetRemoteCid(lcid, rcid);
+}
+bool bluetooth::shim::L2CA_SetTxPriority(uint16_t cid,
+                                         tL2CAP_CHNL_PRIORITY priority) {
+  mock_function_count_map[__func__]++;
+  return test::mock::main_shim_l2cap_api::L2CA_SetTxPriority(cid, priority);
+}
+bool bluetooth::shim::L2CA_SetLeGattTimeout(const RawAddress& rem_bda,
+                                            uint16_t idle_tout) {
+  mock_function_count_map[__func__]++;
+  return test::mock::main_shim_l2cap_api::L2CA_SetLeGattTimeout(rem_bda,
+                                                                idle_tout);
+}
+bool bluetooth::shim::L2CA_SetChnlFlushability(uint16_t cid,
+                                               bool is_flushable) {
+  mock_function_count_map[__func__]++;
+  return test::mock::main_shim_l2cap_api::L2CA_SetChnlFlushability(
+      cid, is_flushable);
+}
+uint16_t bluetooth::shim::L2CA_FlushChannel(uint16_t lcid,
+                                            uint16_t num_to_flush) {
+  mock_function_count_map[__func__]++;
+  return test::mock::main_shim_l2cap_api::L2CA_FlushChannel(lcid, num_to_flush);
+}
+bool bluetooth::shim::L2CA_IsLinkEstablished(const RawAddress& bd_addr,
+                                             tBT_TRANSPORT transport) {
+  mock_function_count_map[__func__]++;
+  return test::mock::main_shim_l2cap_api::L2CA_IsLinkEstablished(bd_addr,
+                                                                 transport);
+}
+bool bluetooth::shim::L2CA_IsLeLink(uint16_t acl_handle) {
+  mock_function_count_map[__func__]++;
+  return test::mock::main_shim_l2cap_api::L2CA_IsLeLink(acl_handle);
+}
+void bluetooth::shim::L2CA_ReadConnectionAddr(const RawAddress& pseudo_addr,
+                                              RawAddress& conn_addr,
+                                              uint8_t* p_addr_type) {
+  mock_function_count_map[__func__]++;
+  test::mock::main_shim_l2cap_api::L2CA_ReadConnectionAddr(
+      pseudo_addr, conn_addr, p_addr_type);
+}
+bool bluetooth::shim::L2CA_ReadRemoteConnectionAddr(
+    const RawAddress& pseudo_addr, RawAddress& conn_addr,
+    uint8_t* p_addr_type) {
+  mock_function_count_map[__func__]++;
+  return test::mock::main_shim_l2cap_api::L2CA_ReadRemoteConnectionAddr(
+      pseudo_addr, conn_addr, p_addr_type);
+}
+hci_role_t bluetooth::shim::L2CA_GetBleConnRole(const RawAddress& bd_addr) {
+  mock_function_count_map[__func__]++;
+  return test::mock::main_shim_l2cap_api::L2CA_GetBleConnRole(bd_addr);
+}
+void bluetooth::shim::L2CA_ConnectForSecurity(const RawAddress& bd_addr) {
+  mock_function_count_map[__func__]++;
+  test::mock::main_shim_l2cap_api::L2CA_ConnectForSecurity(bd_addr);
+}
+void bluetooth::shim::L2CA_SetBondingState(const RawAddress& bd_addr,
+                                           bool is_bonding) {
+  mock_function_count_map[__func__]++;
+  test::mock::main_shim_l2cap_api::L2CA_SetBondingState(bd_addr, is_bonding);
+}
+void bluetooth::shim::L2CA_DisconnectLink(const RawAddress& remote) {
+  mock_function_count_map[__func__]++;
+  test::mock::main_shim_l2cap_api::L2CA_DisconnectLink(remote);
+}
+uint16_t bluetooth::shim::L2CA_GetNumLinks() {
+  mock_function_count_map[__func__]++;
+  return test::mock::main_shim_l2cap_api::L2CA_GetNumLinks();
+}
+uint16_t bluetooth::shim::L2CA_AllocateLePSM() {
+  mock_function_count_map[__func__]++;
+  return test::mock::main_shim_l2cap_api::L2CA_AllocateLePSM();
+}
+void bluetooth::shim::L2CA_FreeLePSM(uint16_t psm) {
+  mock_function_count_map[__func__]++;
+  test::mock::main_shim_l2cap_api::L2CA_FreeLePSM(psm);
+}
+uint16_t bluetooth::shim::L2CA_RegisterLECoc(uint16_t psm,
+                                             const tL2CAP_APPL_INFO& callbacks,
+                                             uint16_t sec_level,
+                                             tL2CAP_LE_CFG_INFO cfg) {
+  mock_function_count_map[__func__]++;
+  return test::mock::main_shim_l2cap_api::L2CA_RegisterLECoc(psm, callbacks,
+                                                             sec_level, cfg);
+}
+void bluetooth::shim::L2CA_DeregisterLECoc(uint16_t psm) {
+  mock_function_count_map[__func__]++;
+  test::mock::main_shim_l2cap_api::L2CA_DeregisterLECoc(psm);
+}
+uint16_t bluetooth::shim::L2CA_ConnectLECocReq(uint16_t psm,
+                                               const RawAddress& p_bd_addr,
+                                               tL2CAP_LE_CFG_INFO* p_cfg) {
+  mock_function_count_map[__func__]++;
+  return test::mock::main_shim_l2cap_api::L2CA_ConnectLECocReq(psm, p_bd_addr,
+                                                               p_cfg);
+}
+bool bluetooth::shim::L2CA_GetPeerLECocConfig(uint16_t cid,
+                                              tL2CAP_LE_CFG_INFO* peer_cfg) {
+  mock_function_count_map[__func__]++;
+  return test::mock::main_shim_l2cap_api::L2CA_GetPeerLECocConfig(cid,
+                                                                  peer_cfg);
+}
+bool bluetooth::shim::L2CA_DisconnectLECocReq(uint16_t cid) {
+  mock_function_count_map[__func__]++;
+  return test::mock::main_shim_l2cap_api::L2CA_DisconnectLECocReq(cid);
+}
+uint8_t bluetooth::shim::L2CA_LECocDataWrite(uint16_t cid, BT_HDR* p_data) {
+  mock_function_count_map[__func__]++;
+  return test::mock::main_shim_l2cap_api::L2CA_LECocDataWrite(cid, p_data);
+}
+void bluetooth::shim::L2CA_SwitchRoleToCentral(const RawAddress& addr) {
+  mock_function_count_map[__func__]++;
+  test::mock::main_shim_l2cap_api::L2CA_SwitchRoleToCentral(addr);
+}
+
+// END mockcify generation
diff --git a/test/mock/mock_main_shim_l2cap_api.h b/test/mock/mock_main_shim_l2cap_api.h
new file mode 100644 (file)
index 0000000..778ddbc
--- /dev/null
@@ -0,0 +1,590 @@
+/*
+ * 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:45
+ *
+ *  mockcify.pl ver 0.2
+ */
+
+#include <cstdint>
+#include <functional>
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+// Original included files, if any
+// NOTE: Since this is a mock file with mock definitions some number of
+//       include files may not be required.  The include-what-you-use
+//       still applies, but crafting proper inclusion is out of scope
+//       for this effort.  This compilation unit may compile as-is, or
+//       may need attention to prune the inclusion set.
+#include "gd/module.h"
+
+#include <future>
+#include <unordered_map>
+#include <unordered_set>
+#include "bta/include/bta_dm_acl.h"
+#include "gd/l2cap/classic/l2cap_classic_module.h"
+#include "gd/l2cap/le/l2cap_le_module.h"
+#include "gd/os/log.h"
+#include "gd/os/queue.h"
+#include "main/shim/acl_api.h"
+#include "main/shim/btm.h"
+#include "main/shim/entry.h"
+#include "main/shim/helpers.h"
+#include "main/shim/l2c_api.h"
+#include "main/shim/stack.h"
+#include "osi/include/allocator.h"
+#include "stack/btm/btm_ble_int.h"
+#include "stack/btm/btm_sec.h"
+#include "stack/include/acl_hci_link_interface.h"
+#include "stack/include/ble_acl_interface.h"
+#include "stack/include/btm_api.h"
+#include "stack/include/btu.h"
+#include "stack/include/gatt_api.h"
+#include "stack/include/sco_hci_link_interface.h"
+
+// Mocked compile conditionals, if any
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+namespace test {
+namespace mock {
+namespace main_shim_l2cap_api {
+
+// Shared state between mocked functions and tests
+// Name: L2CA_ReadRemoteVersion
+// Params: const RawAddress& addr, uint8_t* lmp_version, uint16_t* manufacturer,
+// uint16_t* lmp_sub_version Returns: bool
+struct L2CA_ReadRemoteVersion {
+  std::function<bool(const RawAddress& addr, uint8_t* lmp_version,
+                     uint16_t* manufacturer, uint16_t* lmp_sub_version)>
+      body{[](const RawAddress& addr, uint8_t* lmp_version,
+              uint16_t* manufacturer,
+              uint16_t* lmp_sub_version) { return false; }};
+  bool operator()(const RawAddress& addr, uint8_t* lmp_version,
+                  uint16_t* manufacturer, uint16_t* lmp_sub_version) {
+    return body(addr, lmp_version, manufacturer, lmp_sub_version);
+  };
+};
+extern struct L2CA_ReadRemoteVersion L2CA_ReadRemoteVersion;
+// Name: L2CA_ReadRemoteFeatures
+// Params: const RawAddress& addr
+// Returns: uint8_t*
+struct L2CA_ReadRemoteFeatures {
+  std::function<uint8_t*(const RawAddress& addr)> body{
+      [](const RawAddress& addr) { return nullptr; }};
+  uint8_t* operator()(const RawAddress& addr) { return body(addr); };
+};
+extern struct L2CA_ReadRemoteFeatures L2CA_ReadRemoteFeatures;
+// Name: L2CA_UseLegacySecurityModule
+// Params:
+// Returns: void
+struct L2CA_UseLegacySecurityModule {
+  std::function<void()> body{[]() {}};
+  void operator()() { body(); };
+};
+extern struct L2CA_UseLegacySecurityModule L2CA_UseLegacySecurityModule;
+// Name: L2CA_Register
+// Params: uint16_t client_psm, const tL2CAP_APPL_INFO& callbacks, bool
+// enable_snoop, tL2CAP_ERTM_INFO* p_ertm_info, uint16_t my_mtu, uint16_t
+// required_remote_mtu, uint16_t sec_level Returns: uint16_t
+struct L2CA_Register {
+  std::function<uint16_t(uint16_t client_psm, const tL2CAP_APPL_INFO& callbacks,
+                         bool enable_snoop, tL2CAP_ERTM_INFO* p_ertm_info,
+                         uint16_t my_mtu, uint16_t required_remote_mtu,
+                         uint16_t sec_level)>
+      body{[](uint16_t client_psm, const tL2CAP_APPL_INFO& callbacks,
+              bool enable_snoop, tL2CAP_ERTM_INFO* p_ertm_info, uint16_t my_mtu,
+              uint16_t required_remote_mtu, uint16_t sec_level) { return 0; }};
+  uint16_t operator()(uint16_t client_psm, const tL2CAP_APPL_INFO& callbacks,
+                      bool enable_snoop, tL2CAP_ERTM_INFO* p_ertm_info,
+                      uint16_t my_mtu, uint16_t required_remote_mtu,
+                      uint16_t sec_level) {
+    return body(client_psm, callbacks, enable_snoop, p_ertm_info, my_mtu,
+                required_remote_mtu, sec_level);
+  };
+};
+extern struct L2CA_Register L2CA_Register;
+// Name: L2CA_Deregister
+// Params: uint16_t psm
+// Returns: void
+struct L2CA_Deregister {
+  std::function<void(uint16_t psm)> body{[](uint16_t psm) {}};
+  void operator()(uint16_t psm) { body(psm); };
+};
+extern struct L2CA_Deregister L2CA_Deregister;
+// Name: L2CA_ConnectReq
+// Params: uint16_t psm, const RawAddress& raw_address
+// Returns: uint16_t
+struct L2CA_ConnectReq {
+  std::function<uint16_t(uint16_t psm, const RawAddress& raw_address)> body{
+      [](uint16_t psm, const RawAddress& raw_address) { return 0; }};
+  uint16_t operator()(uint16_t psm, const RawAddress& raw_address) {
+    return body(psm, raw_address);
+  };
+};
+extern struct L2CA_ConnectReq L2CA_ConnectReq;
+// Name: L2CA_DisconnectReq
+// Params: uint16_t cid
+// Returns: bool
+struct L2CA_DisconnectReq {
+  std::function<bool(uint16_t cid)> body{[](uint16_t cid) { return false; }};
+  bool operator()(uint16_t cid) { return body(cid); };
+};
+extern struct L2CA_DisconnectReq L2CA_DisconnectReq;
+// Name: L2CA_DataWrite
+// Params: uint16_t cid, BT_HDR* p_data
+// Returns: uint8_t
+struct L2CA_DataWrite {
+  std::function<uint8_t(uint16_t cid, BT_HDR* p_data)> body{
+      [](uint16_t cid, BT_HDR* p_data) { return 0; }};
+  uint8_t operator()(uint16_t cid, BT_HDR* p_data) {
+    return body(cid, p_data);
+  };
+};
+extern struct L2CA_DataWrite L2CA_DataWrite;
+// Name: L2CA_ReconfigCreditBasedConnsReq
+// Params: const RawAddress& bd_addr, std::vector<uint16_t>& lcids,
+// tL2CAP_LE_CFG_INFO* p_cfg Returns: bool
+struct L2CA_ReconfigCreditBasedConnsReq {
+  std::function<bool(const RawAddress& bd_addr, std::vector<uint16_t>& lcids,
+                     tL2CAP_LE_CFG_INFO* p_cfg)>
+      body{[](const RawAddress& bd_addr, std::vector<uint16_t>& lcids,
+              tL2CAP_LE_CFG_INFO* p_cfg) { return false; }};
+  bool operator()(const RawAddress& bd_addr, std::vector<uint16_t>& lcids,
+                  tL2CAP_LE_CFG_INFO* p_cfg) {
+    return body(bd_addr, lcids, p_cfg);
+  };
+};
+extern struct L2CA_ReconfigCreditBasedConnsReq L2CA_ReconfigCreditBasedConnsReq;
+// Name: L2CA_ConnectCreditBasedReq
+// Params: uint16_t psm, const RawAddress& p_bd_addr, tL2CAP_LE_CFG_INFO* p_cfg
+// Returns: std::vector<uint16_t>
+struct L2CA_ConnectCreditBasedReq {
+  std::vector<uint16_t> cids;
+  std::function<std::vector<uint16_t>(uint16_t psm, const RawAddress& p_bd_addr,
+                                      tL2CAP_LE_CFG_INFO* p_cfg)>
+      body{[this](uint16_t psm, const RawAddress& p_bd_addr,
+                  tL2CAP_LE_CFG_INFO* p_cfg) { return cids; }};
+  std::vector<uint16_t> operator()(uint16_t psm, const RawAddress& p_bd_addr,
+                                   tL2CAP_LE_CFG_INFO* p_cfg) {
+    return body(psm, p_bd_addr, p_cfg);
+  };
+};
+extern struct L2CA_ConnectCreditBasedReq L2CA_ConnectCreditBasedReq;
+// Name: L2CA_ConnectCreditBasedRsp
+// Params: const RawAddress& bd_addr, uint8_t id, std::vector<uint16_t>&
+// accepted_lcids, uint16_t result, tL2CAP_LE_CFG_INFO* p_cfg Returns: bool
+struct L2CA_ConnectCreditBasedRsp {
+  std::function<bool(const RawAddress& bd_addr, uint8_t id,
+                     std::vector<uint16_t>& accepted_lcids, uint16_t result,
+                     tL2CAP_LE_CFG_INFO* p_cfg)>
+      body{[](const RawAddress& bd_addr, uint8_t id,
+              std::vector<uint16_t>& accepted_lcids, uint16_t result,
+              tL2CAP_LE_CFG_INFO* p_cfg) { return false; }};
+  bool operator()(const RawAddress& bd_addr, uint8_t id,
+                  std::vector<uint16_t>& accepted_lcids, uint16_t result,
+                  tL2CAP_LE_CFG_INFO* p_cfg) {
+    return body(bd_addr, id, accepted_lcids, result, p_cfg);
+  };
+};
+extern struct L2CA_ConnectCreditBasedRsp L2CA_ConnectCreditBasedRsp;
+// Name: L2CA_SetIdleTimeoutByBdAddr
+// Params: const RawAddress& bd_addr, uint16_t timeout, tBT_TRANSPORT transport
+// Returns: bool
+struct L2CA_SetIdleTimeoutByBdAddr {
+  std::function<bool(const RawAddress& bd_addr, uint16_t timeout,
+                     tBT_TRANSPORT transport)>
+      body{[](const RawAddress& bd_addr, uint16_t timeout,
+              tBT_TRANSPORT transport) { return false; }};
+  bool operator()(const RawAddress& bd_addr, uint16_t timeout,
+                  tBT_TRANSPORT transport) {
+    return body(bd_addr, timeout, transport);
+  };
+};
+extern struct L2CA_SetIdleTimeoutByBdAddr L2CA_SetIdleTimeoutByBdAddr;
+// Name: L2CA_SetAclPriority
+// Params: uint16_t handle, bool high_priority
+// Returns: bool
+struct L2CA_SetAclPriority {
+  std::function<bool(uint16_t handle, bool high_priority)> body{
+      [](uint16_t handle, bool high_priority) { return false; }};
+  bool operator()(uint16_t handle, bool high_priority) {
+    return body(handle, high_priority);
+  };
+};
+extern struct L2CA_SetAclPriority L2CA_SetAclPriority;
+// Name: L2CA_SetAclPriority
+// Params: const RawAddress& bd_addr, tL2CAP_PRIORITY priority
+// Returns: bool
+struct L2CA_SetAclPriority2 {
+  std::function<bool(const RawAddress& bd_addr, tL2CAP_PRIORITY priority)> body{
+      [](const RawAddress& bd_addr, tL2CAP_PRIORITY priority) {
+        return false;
+      }};
+  bool operator()(const RawAddress& bd_addr, tL2CAP_PRIORITY priority) {
+    return body(bd_addr, priority);
+  };
+};
+extern struct L2CA_SetAclPriority2 L2CA_SetAclPriority2;
+// Name: L2CA_GetPeerFeatures
+// Params: const RawAddress& bd_addr, uint32_t* p_ext_feat, uint8_t* p_chnl_mask
+// Returns: bool
+struct L2CA_GetPeerFeatures {
+  std::function<bool(const RawAddress& bd_addr, uint32_t* p_ext_feat,
+                     uint8_t* p_chnl_mask)>
+      body{[](const RawAddress& bd_addr, uint32_t* p_ext_feat,
+              uint8_t* p_chnl_mask) { return false; }};
+  bool operator()(const RawAddress& bd_addr, uint32_t* p_ext_feat,
+                  uint8_t* p_chnl_mask) {
+    return body(bd_addr, p_ext_feat, p_chnl_mask);
+  };
+};
+extern struct L2CA_GetPeerFeatures L2CA_GetPeerFeatures;
+// Name: L2CA_RegisterFixedChannel
+// Params: uint16_t cid, tL2CAP_FIXED_CHNL_REG* p_freg
+// Returns: bool
+struct L2CA_RegisterFixedChannel {
+  std::function<bool(uint16_t cid, tL2CAP_FIXED_CHNL_REG* p_freg)> body{
+      [](uint16_t cid, tL2CAP_FIXED_CHNL_REG* p_freg) { return false; }};
+  bool operator()(uint16_t cid, tL2CAP_FIXED_CHNL_REG* p_freg) {
+    return body(cid, p_freg);
+  };
+};
+extern struct L2CA_RegisterFixedChannel L2CA_RegisterFixedChannel;
+// Name: L2CA_ConnectFixedChnl
+// Params: uint16_t cid, const RawAddress& rem_bda
+// Returns: bool
+struct L2CA_ConnectFixedChnl {
+  std::function<bool(uint16_t cid, const RawAddress& rem_bda)> body{
+      [](uint16_t cid, const RawAddress& rem_bda) { return false; }};
+  bool operator()(uint16_t cid, const RawAddress& rem_bda) {
+    return body(cid, rem_bda);
+  };
+};
+extern struct L2CA_ConnectFixedChnl L2CA_ConnectFixedChnl;
+// Name: L2CA_SendFixedChnlData
+// Params: uint16_t cid, const RawAddress& rem_bda, BT_HDR* p_buf
+// Returns: uint16_t
+struct L2CA_SendFixedChnlData {
+  std::function<uint16_t(uint16_t cid, const RawAddress& rem_bda,
+                         BT_HDR* p_buf)>
+      body{[](uint16_t cid, const RawAddress& rem_bda, BT_HDR* p_buf) {
+        return 0;
+      }};
+  uint16_t operator()(uint16_t cid, const RawAddress& rem_bda, BT_HDR* p_buf) {
+    return body(cid, rem_bda, p_buf);
+  };
+};
+extern struct L2CA_SendFixedChnlData L2CA_SendFixedChnlData;
+// Name: L2CA_RemoveFixedChnl
+// Params: uint16_t cid, const RawAddress& rem_bda
+// Returns: bool
+struct L2CA_RemoveFixedChnl {
+  std::function<bool(uint16_t cid, const RawAddress& rem_bda)> body{
+      [](uint16_t cid, const RawAddress& rem_bda) { return false; }};
+  bool operator()(uint16_t cid, const RawAddress& rem_bda) {
+    return body(cid, rem_bda);
+  };
+};
+extern struct L2CA_RemoveFixedChnl L2CA_RemoveFixedChnl;
+// Name: L2CA_GetLeHandle
+// Params: const RawAddress& rem_bda
+// Returns: uint16_t
+struct L2CA_GetLeHandle {
+  std::function<uint16_t(const RawAddress& rem_bda)> body{
+      [](const RawAddress& rem_bda) { return 0; }};
+  uint16_t operator()(const RawAddress& rem_bda) { return body(rem_bda); };
+};
+extern struct L2CA_GetLeHandle L2CA_GetLeHandle;
+// Name: L2CA_LeConnectionUpdate
+// Params: const RawAddress& rem_bda, uint16_t min_int, uint16_t max_int,
+// uint16_t latency, uint16_t timeout, uint16_t min_ce_len, uint16_t max_ce_len
+// Returns: void
+struct L2CA_LeConnectionUpdate {
+  std::function<void(const RawAddress& rem_bda, uint16_t min_int,
+                     uint16_t max_int, uint16_t latency, uint16_t timeout,
+                     uint16_t min_ce_len, uint16_t max_ce_len)>
+      body{[](const RawAddress& rem_bda, uint16_t min_int, uint16_t max_int,
+              uint16_t latency, uint16_t timeout, uint16_t min_ce_len,
+              uint16_t max_ce_len) {}};
+  void operator()(const RawAddress& rem_bda, uint16_t min_int, uint16_t max_int,
+                  uint16_t latency, uint16_t timeout, uint16_t min_ce_len,
+                  uint16_t max_ce_len) {
+    body(rem_bda, min_int, max_int, latency, timeout, min_ce_len, max_ce_len);
+  };
+};
+extern struct L2CA_LeConnectionUpdate L2CA_LeConnectionUpdate;
+// Name: L2CA_EnableUpdateBleConnParams
+// Params: const RawAddress& rem_bda, bool enable
+// Returns: bool
+struct L2CA_EnableUpdateBleConnParams {
+  std::function<bool(const RawAddress& rem_bda, bool enable)> body{
+      [](const RawAddress& rem_bda, bool enable) { return false; }};
+  bool operator()(const RawAddress& rem_bda, bool enable) {
+    return body(rem_bda, enable);
+  };
+};
+extern struct L2CA_EnableUpdateBleConnParams L2CA_EnableUpdateBleConnParams;
+// Name: L2CA_GetRemoteCid
+// Params: uint16_t lcid, uint16_t* rcid
+// Returns: bool
+struct L2CA_GetRemoteCid {
+  std::function<bool(uint16_t lcid, uint16_t* rcid)> body{
+      [](uint16_t lcid, uint16_t* rcid) { return false; }};
+  bool operator()(uint16_t lcid, uint16_t* rcid) { return body(lcid, rcid); };
+};
+extern struct L2CA_GetRemoteCid L2CA_GetRemoteCid;
+// Name: L2CA_SetTxPriority
+// Params: uint16_t cid, tL2CAP_CHNL_PRIORITY priority
+// Returns: bool
+struct L2CA_SetTxPriority {
+  std::function<bool(uint16_t cid, tL2CAP_CHNL_PRIORITY priority)> body{
+      [](uint16_t cid, tL2CAP_CHNL_PRIORITY priority) { return false; }};
+  bool operator()(uint16_t cid, tL2CAP_CHNL_PRIORITY priority) {
+    return body(cid, priority);
+  };
+};
+extern struct L2CA_SetTxPriority L2CA_SetTxPriority;
+// Name: L2CA_SetLeGattTimeout
+// Params: const RawAddress& rem_bda, uint16_t idle_tout
+// Returns: bool
+struct L2CA_SetLeGattTimeout {
+  std::function<bool(const RawAddress& rem_bda, uint16_t idle_tout)> body{
+      [](const RawAddress& rem_bda, uint16_t idle_tout) { return false; }};
+  bool operator()(const RawAddress& rem_bda, uint16_t idle_tout) {
+    return body(rem_bda, idle_tout);
+  };
+};
+extern struct L2CA_SetLeGattTimeout L2CA_SetLeGattTimeout;
+// Name: L2CA_SetChnlFlushability
+// Params: uint16_t cid, bool is_flushable
+// Returns: bool
+struct L2CA_SetChnlFlushability {
+  std::function<bool(uint16_t cid, bool is_flushable)> body{
+      [](uint16_t cid, bool is_flushable) { return false; }};
+  bool operator()(uint16_t cid, bool is_flushable) {
+    return body(cid, is_flushable);
+  };
+};
+extern struct L2CA_SetChnlFlushability L2CA_SetChnlFlushability;
+// Name: L2CA_FlushChannel
+// Params: uint16_t lcid, uint16_t num_to_flush
+// Returns: uint16_t
+struct L2CA_FlushChannel {
+  std::function<uint16_t(uint16_t lcid, uint16_t num_to_flush)> body{
+      [](uint16_t lcid, uint16_t num_to_flush) { return 0; }};
+  uint16_t operator()(uint16_t lcid, uint16_t num_to_flush) {
+    return body(lcid, num_to_flush);
+  };
+};
+extern struct L2CA_FlushChannel L2CA_FlushChannel;
+// Name: L2CA_IsLinkEstablished
+// Params: const RawAddress& bd_addr, tBT_TRANSPORT transport
+// Returns: bool
+struct L2CA_IsLinkEstablished {
+  std::function<bool(const RawAddress& bd_addr, tBT_TRANSPORT transport)> body{
+      [](const RawAddress& bd_addr, tBT_TRANSPORT transport) { return false; }};
+  bool operator()(const RawAddress& bd_addr, tBT_TRANSPORT transport) {
+    return body(bd_addr, transport);
+  };
+};
+extern struct L2CA_IsLinkEstablished L2CA_IsLinkEstablished;
+// Name: L2CA_IsLeLink
+// Params: uint16_t acl_handle
+// Returns: bool
+struct L2CA_IsLeLink {
+  std::function<bool(uint16_t acl_handle)> body{
+      [](uint16_t acl_handle) { return false; }};
+  bool operator()(uint16_t acl_handle) { return body(acl_handle); };
+};
+extern struct L2CA_IsLeLink L2CA_IsLeLink;
+// Name: L2CA_ReadConnectionAddr
+// Params: const RawAddress& pseudo_addr, RawAddress& conn_addr, uint8_t*
+// p_addr_type Returns: void
+struct L2CA_ReadConnectionAddr {
+  std::function<void(const RawAddress& pseudo_addr, RawAddress& conn_addr,
+                     uint8_t* p_addr_type)>
+      body{[](const RawAddress& pseudo_addr, RawAddress& conn_addr,
+              uint8_t* p_addr_type) {}};
+  void operator()(const RawAddress& pseudo_addr, RawAddress& conn_addr,
+                  uint8_t* p_addr_type) {
+    body(pseudo_addr, conn_addr, p_addr_type);
+  };
+};
+extern struct L2CA_ReadConnectionAddr L2CA_ReadConnectionAddr;
+// Name: L2CA_ReadRemoteConnectionAddr
+// Params: const RawAddress& pseudo_addr, RawAddress& conn_addr, uint8_t*
+// p_addr_type Returns: bool
+struct L2CA_ReadRemoteConnectionAddr {
+  std::function<bool(const RawAddress& pseudo_addr, RawAddress& conn_addr,
+                     uint8_t* p_addr_type)>
+      body{[](const RawAddress& pseudo_addr, RawAddress& conn_addr,
+              uint8_t* p_addr_type) { return false; }};
+  bool operator()(const RawAddress& pseudo_addr, RawAddress& conn_addr,
+                  uint8_t* p_addr_type) {
+    return body(pseudo_addr, conn_addr, p_addr_type);
+  };
+};
+extern struct L2CA_ReadRemoteConnectionAddr L2CA_ReadRemoteConnectionAddr;
+// Name: L2CA_GetBleConnRole
+// Params: const RawAddress& bd_addr
+// Returns: hci_role_t
+struct L2CA_GetBleConnRole {
+  std::function<hci_role_t(const RawAddress& bd_addr)> body{
+      [](const RawAddress& bd_addr) { return HCI_ROLE_CENTRAL; }};
+  hci_role_t operator()(const RawAddress& bd_addr) { return body(bd_addr); };
+};
+extern struct L2CA_GetBleConnRole L2CA_GetBleConnRole;
+// Name: L2CA_ConnectForSecurity
+// Params: const RawAddress& bd_addr
+// Returns: void
+struct L2CA_ConnectForSecurity {
+  std::function<void(const RawAddress& bd_addr)> body{
+      [](const RawAddress& bd_addr) {}};
+  void operator()(const RawAddress& bd_addr) { body(bd_addr); };
+};
+extern struct L2CA_ConnectForSecurity L2CA_ConnectForSecurity;
+// Name: L2CA_SetBondingState
+// Params: const RawAddress& bd_addr, bool is_bonding
+// Returns: void
+struct L2CA_SetBondingState {
+  std::function<void(const RawAddress& bd_addr, bool is_bonding)> body{
+      [](const RawAddress& bd_addr, bool is_bonding) {}};
+  void operator()(const RawAddress& bd_addr, bool is_bonding) {
+    body(bd_addr, is_bonding);
+  };
+};
+extern struct L2CA_SetBondingState L2CA_SetBondingState;
+// Name: L2CA_DisconnectLink
+// Params: const RawAddress& remote
+// Returns: void
+struct L2CA_DisconnectLink {
+  std::function<void(const RawAddress& remote)> body{
+      [](const RawAddress& remote) {}};
+  void operator()(const RawAddress& remote) { body(remote); };
+};
+extern struct L2CA_DisconnectLink L2CA_DisconnectLink;
+// Name: L2CA_GetNumLinks
+// Params:
+// Returns: uint16_t
+struct L2CA_GetNumLinks {
+  std::function<uint16_t()> body{[]() { return 0; }};
+  uint16_t operator()() { return body(); };
+};
+extern struct L2CA_GetNumLinks L2CA_GetNumLinks;
+// Name: L2CA_AllocateLePSM
+// Params:
+// Returns: uint16_t
+struct L2CA_AllocateLePSM {
+  std::function<uint16_t()> body{[]() { return 0; }};
+  uint16_t operator()() { return body(); };
+};
+extern struct L2CA_AllocateLePSM L2CA_AllocateLePSM;
+// Name: L2CA_FreeLePSM
+// Params: uint16_t psm
+// Returns: void
+struct L2CA_FreeLePSM {
+  std::function<void(uint16_t psm)> body{[](uint16_t psm) {}};
+  void operator()(uint16_t psm) { body(psm); };
+};
+extern struct L2CA_FreeLePSM L2CA_FreeLePSM;
+// Name: L2CA_RegisterLECoc
+// Params: uint16_t psm, const tL2CAP_APPL_INFO& callbacks, uint16_t sec_level,
+// tL2CAP_LE_CFG_INFO cfg Returns: uint16_t
+struct L2CA_RegisterLECoc {
+  std::function<uint16_t(uint16_t psm, const tL2CAP_APPL_INFO& callbacks,
+                         uint16_t sec_level, tL2CAP_LE_CFG_INFO cfg)>
+      body{[](uint16_t psm, const tL2CAP_APPL_INFO& callbacks,
+              uint16_t sec_level, tL2CAP_LE_CFG_INFO cfg) { return 0; }};
+  uint16_t operator()(uint16_t psm, const tL2CAP_APPL_INFO& callbacks,
+                      uint16_t sec_level, tL2CAP_LE_CFG_INFO cfg) {
+    return body(psm, callbacks, sec_level, cfg);
+  };
+};
+extern struct L2CA_RegisterLECoc L2CA_RegisterLECoc;
+// Name: L2CA_DeregisterLECoc
+// Params: uint16_t psm
+// Returns: void
+struct L2CA_DeregisterLECoc {
+  std::function<void(uint16_t psm)> body{[](uint16_t psm) {}};
+  void operator()(uint16_t psm) { body(psm); };
+};
+extern struct L2CA_DeregisterLECoc L2CA_DeregisterLECoc;
+// Name: L2CA_ConnectLECocReq
+// Params: uint16_t psm, const RawAddress& p_bd_addr, tL2CAP_LE_CFG_INFO* p_cfg
+// Returns: uint16_t
+struct L2CA_ConnectLECocReq {
+  std::function<uint16_t(uint16_t psm, const RawAddress& p_bd_addr,
+                         tL2CAP_LE_CFG_INFO* p_cfg)>
+      body{[](uint16_t psm, const RawAddress& p_bd_addr,
+              tL2CAP_LE_CFG_INFO* p_cfg) { return 0; }};
+  uint16_t operator()(uint16_t psm, const RawAddress& p_bd_addr,
+                      tL2CAP_LE_CFG_INFO* p_cfg) {
+    return body(psm, p_bd_addr, p_cfg);
+  };
+};
+extern struct L2CA_ConnectLECocReq L2CA_ConnectLECocReq;
+// Name: L2CA_GetPeerLECocConfig
+// Params: uint16_t cid, tL2CAP_LE_CFG_INFO* peer_cfg
+// Returns: bool
+struct L2CA_GetPeerLECocConfig {
+  std::function<bool(uint16_t cid, tL2CAP_LE_CFG_INFO* peer_cfg)> body{
+      [](uint16_t cid, tL2CAP_LE_CFG_INFO* peer_cfg) { return false; }};
+  bool operator()(uint16_t cid, tL2CAP_LE_CFG_INFO* peer_cfg) {
+    return body(cid, peer_cfg);
+  };
+};
+extern struct L2CA_GetPeerLECocConfig L2CA_GetPeerLECocConfig;
+// Name: L2CA_DisconnectLECocReq
+// Params: uint16_t cid
+// Returns: bool
+struct L2CA_DisconnectLECocReq {
+  std::function<bool(uint16_t cid)> body{[](uint16_t cid) { return false; }};
+  bool operator()(uint16_t cid) { return body(cid); };
+};
+extern struct L2CA_DisconnectLECocReq L2CA_DisconnectLECocReq;
+// Name: L2CA_LECocDataWrite
+// Params: uint16_t cid, BT_HDR* p_data
+// Returns: uint8_t
+struct L2CA_LECocDataWrite {
+  std::function<uint8_t(uint16_t cid, BT_HDR* p_data)> body{
+      [](uint16_t cid, BT_HDR* p_data) { return 0; }};
+  uint8_t operator()(uint16_t cid, BT_HDR* p_data) {
+    return body(cid, p_data);
+  };
+};
+extern struct L2CA_LECocDataWrite L2CA_LECocDataWrite;
+// Name: L2CA_SwitchRoleToCentral
+// Params: const RawAddress& addr
+// Returns: void
+struct L2CA_SwitchRoleToCentral {
+  std::function<void(const RawAddress& addr)> body{
+      [](const RawAddress& addr) {}};
+  void operator()(const RawAddress& addr) { body(addr); };
+};
+extern struct L2CA_SwitchRoleToCentral L2CA_SwitchRoleToCentral;
+
+}  // namespace main_shim_l2cap_api
+}  // namespace mock
+}  // namespace test
+
+// END mockcify generation
diff --git a/test/mock/mock_main_shim_link_policy.cc b/test/mock/mock_main_shim_link_policy.cc
new file mode 100644 (file)
index 0000000..06b4bbb
--- /dev/null
@@ -0,0 +1,121 @@
+/*
+ * 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
+ *
+ *  mockcify.pl ver 0.2
+ */
+
+#include <cstdint>
+#include <functional>
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+// Mock include file to share data between tests and mock
+#include "test/mock/mock_main_shim_link_policy.h"
+
+// Mocked compile conditionals, if any
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+// Mocked internal structures, if any
+
+namespace test {
+namespace mock {
+namespace main_shim_link_policy {
+
+// Function state capture and return values, if needed
+struct set_active_mode set_active_mode;
+struct set_hold_mode set_hold_mode;
+struct set_sniff_mode set_sniff_mode;
+struct controller_supports_link_policy_mode
+    controller_supports_link_policy_mode;
+struct RegisterLinkPolicyClient RegisterLinkPolicyClient;
+struct UnregisterLinkPolicyClient UnregisterLinkPolicyClient;
+struct BTM_SetPowerMode BTM_SetPowerMode;
+struct btm_pm_on_mode_change btm_pm_on_mode_change;
+struct BTM_SetSsrParams BTM_SetSsrParams;
+struct btm_pm_on_sniff_subrating btm_pm_on_sniff_subrating;
+
+}  // namespace main_shim_link_policy
+}  // namespace mock
+}  // namespace test
+
+// Mocked functions, if any
+tBTM_STATUS set_active_mode(tACL_CONN& p_acl) {
+  mock_function_count_map[__func__]++;
+  return test::mock::main_shim_link_policy::set_active_mode(p_acl);
+}
+tBTM_STATUS set_hold_mode(tACL_CONN& p_acl, uint16_t max, uint16_t min) {
+  mock_function_count_map[__func__]++;
+  return test::mock::main_shim_link_policy::set_hold_mode(p_acl, max, min);
+}
+tBTM_STATUS set_sniff_mode(tACL_CONN& p_acl, uint16_t max_interval,
+                           uint16_t min_interval, uint16_t attempt,
+                           uint16_t timeout) {
+  mock_function_count_map[__func__]++;
+  return test::mock::main_shim_link_policy::set_sniff_mode(
+      p_acl, max_interval, min_interval, attempt, timeout);
+}
+bool controller_supports_link_policy_mode(const tBTM_PM_MODE& mode,
+                                          bool interop_check) {
+  mock_function_count_map[__func__]++;
+  return test::mock::main_shim_link_policy::
+      controller_supports_link_policy_mode(mode, interop_check);
+}
+bool bluetooth::shim::RegisterLinkPolicyClient(tBTM_PM_STATUS_CBACK* p_cb) {
+  mock_function_count_map[__func__]++;
+  return test::mock::main_shim_link_policy::RegisterLinkPolicyClient(p_cb);
+}
+bool bluetooth::shim::UnregisterLinkPolicyClient(tBTM_PM_STATUS_CBACK* p_cb) {
+  mock_function_count_map[__func__]++;
+  return test::mock::main_shim_link_policy::UnregisterLinkPolicyClient(p_cb);
+}
+tBTM_STATUS bluetooth::shim::BTM_SetPowerMode(uint16_t handle,
+                                              const tBTM_PM_PWR_MD& new_mode) {
+  mock_function_count_map[__func__]++;
+  return test::mock::main_shim_link_policy::BTM_SetPowerMode(handle, new_mode);
+}
+void bluetooth::shim::btm_pm_on_mode_change(tHCI_STATUS status, uint16_t handle,
+                                            tHCI_MODE hci_mode,
+                                            uint16_t interval) {
+  mock_function_count_map[__func__]++;
+  test::mock::main_shim_link_policy::btm_pm_on_mode_change(status, handle,
+                                                           hci_mode, interval);
+}
+tBTM_STATUS bluetooth::shim::BTM_SetSsrParams(uint16_t handle, uint16_t max_lat,
+                                              uint16_t min_rmt_to,
+                                              uint16_t min_loc_to) {
+  mock_function_count_map[__func__]++;
+  return test::mock::main_shim_link_policy::BTM_SetSsrParams(
+      handle, max_lat, min_rmt_to, min_loc_to);
+}
+void bluetooth::shim::btm_pm_on_sniff_subrating(
+    tHCI_STATUS status, uint16_t handle, uint16_t maximum_transmit_latency,
+    UNUSED_ATTR uint16_t maximum_receive_latency,
+    uint16_t minimum_remote_timeout, uint16_t minimum_local_timeout) {
+  mock_function_count_map[__func__]++;
+  test::mock::main_shim_link_policy::btm_pm_on_sniff_subrating(
+      status, handle, maximum_transmit_latency, maximum_receive_latency,
+      minimum_remote_timeout, minimum_local_timeout);
+}
+
+// END mockcify generation
diff --git a/test/mock/mock_main_shim_link_policy.h b/test/mock/mock_main_shim_link_policy.h
new file mode 100644 (file)
index 0000000..fe0f4cf
--- /dev/null
@@ -0,0 +1,201 @@
+/*
+ * 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
+ *
+ *  mockcify.pl ver 0.2
+ */
+
+#include <cstdint>
+#include <functional>
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+// Original included files, if any
+// NOTE: Since this is a mock file with mock definitions some number of
+//       include files may not be required.  The include-what-you-use
+//       still applies, but crafting proper inclusion is out of scope
+//       for this effort.  This compilation unit may compile as-is, or
+//       may need attention to prune the inclusion set.
+#include <base/bind.h>
+#include <base/location.h>
+#include <base/strings/stringprintf.h>
+#include <cstdint>
+#include <memory>
+#include "device/include/interop.h"
+#include "gd/module.h"
+#include "hci/controller.h"
+#include "main/shim/controller.h"
+#include "main/shim/dumpsys.h"
+#include "main/shim/link_policy.h"
+#include "main/shim/stack.h"
+#include "osi/include/log.h"
+#include "stack/btm/btm_int_types.h"
+#include "stack/include/btm_api.h"
+#include "stack/include/btm_api_types.h"
+#include "stack/include/btm_ble_api_types.h"
+#include "stack/include/hci_error_code.h"
+#include "stack/include/hcidefs.h"
+
+// Mocked compile conditionals, if any
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+namespace test {
+namespace mock {
+namespace main_shim_link_policy {
+
+// Shared state between mocked functions and tests
+// Name: set_active_mode
+// Params: tACL_CONN& p_acl
+// Returns: tBTM_STATUS
+struct set_active_mode {
+  std::function<tBTM_STATUS(tACL_CONN& p_acl)> body{
+      [](tACL_CONN& p_acl) { return 0; }};
+  tBTM_STATUS operator()(tACL_CONN& p_acl) { return body(p_acl); };
+};
+extern struct set_active_mode set_active_mode;
+// Name: set_hold_mode
+// Params: tACL_CONN& p_acl, uint16_t max, uint16_t min
+// Returns: tBTM_STATUS
+struct set_hold_mode {
+  std::function<tBTM_STATUS(tACL_CONN& p_acl, uint16_t max, uint16_t min)> body{
+      [](tACL_CONN& p_acl, uint16_t max, uint16_t min) { return 0; }};
+  tBTM_STATUS operator()(tACL_CONN& p_acl, uint16_t max, uint16_t min) {
+    return body(p_acl, max, min);
+  };
+};
+extern struct set_hold_mode set_hold_mode;
+// Name: set_sniff_mode
+// Params: tACL_CONN& p_acl, uint16_t max_interval, uint16_t min_interval,
+// uint16_t attempt, uint16_t timeout Returns: tBTM_STATUS
+struct set_sniff_mode {
+  std::function<tBTM_STATUS(tACL_CONN& p_acl, uint16_t max_interval,
+                            uint16_t min_interval, uint16_t attempt,
+                            uint16_t timeout)>
+      body{[](tACL_CONN& p_acl, uint16_t max_interval, uint16_t min_interval,
+              uint16_t attempt, uint16_t timeout) { return 0; }};
+  tBTM_STATUS operator()(tACL_CONN& p_acl, uint16_t max_interval,
+                         uint16_t min_interval, uint16_t attempt,
+                         uint16_t timeout) {
+    return body(p_acl, max_interval, min_interval, attempt, timeout);
+  };
+};
+extern struct set_sniff_mode set_sniff_mode;
+// Name: controller_supports_link_policy_mode
+// Params: const tBTM_PM_MODE& mode, bool interop_check
+// Returns: bool
+struct controller_supports_link_policy_mode {
+  std::function<bool(const tBTM_PM_MODE& mode, bool interop_check)> body{
+      [](const tBTM_PM_MODE& mode, bool interop_check) { return false; }};
+  bool operator()(const tBTM_PM_MODE& mode, bool interop_check) {
+    return body(mode, interop_check);
+  };
+};
+extern struct controller_supports_link_policy_mode
+    controller_supports_link_policy_mode;
+// Name: bluetooth::shim::RegisterLinkPolicyClient
+// Params: tBTM_PM_STATUS_CBACK* p_cb
+// Returns: bool
+struct RegisterLinkPolicyClient {
+  std::function<bool(tBTM_PM_STATUS_CBACK* p_cb)> body{
+      [](tBTM_PM_STATUS_CBACK* p_cb) { return false; }};
+  bool operator()(tBTM_PM_STATUS_CBACK* p_cb) { return body(p_cb); };
+};
+extern struct RegisterLinkPolicyClient RegisterLinkPolicyClient;
+// Name: bluetooth::shim::UnregisterLinkPolicyClient
+// Params: tBTM_PM_STATUS_CBACK* p_cb
+// Returns: bool
+struct UnregisterLinkPolicyClient {
+  std::function<bool(tBTM_PM_STATUS_CBACK* p_cb)> body{
+      [](tBTM_PM_STATUS_CBACK* p_cb) { return false; }};
+  bool operator()(tBTM_PM_STATUS_CBACK* p_cb) { return body(p_cb); };
+};
+extern struct UnregisterLinkPolicyClient UnregisterLinkPolicyClient;
+// Name: bluetooth::shim::BTM_SetPowerMode
+// Params: uint16_t handle, const tBTM_PM_PWR_MD& new_mode
+// Returns: tBTM_STATUS
+struct BTM_SetPowerMode {
+  std::function<tBTM_STATUS(uint16_t handle, const tBTM_PM_PWR_MD& new_mode)>
+      body{[](uint16_t handle, const tBTM_PM_PWR_MD& new_mode) { return 0; }};
+  tBTM_STATUS operator()(uint16_t handle, const tBTM_PM_PWR_MD& new_mode) {
+    return body(handle, new_mode);
+  };
+};
+extern struct BTM_SetPowerMode BTM_SetPowerMode;
+// Name: bluetooth::shim::btm_pm_on_mode_change
+// Params: tHCI_STATUS status, uint16_t handle, tHCI_MODE hci_mode, uint16_t
+// interval Returns: void
+struct btm_pm_on_mode_change {
+  std::function<void(tHCI_STATUS status, uint16_t handle, tHCI_MODE hci_mode,
+                     uint16_t interval)>
+      body{[](tHCI_STATUS status, uint16_t handle, tHCI_MODE hci_mode,
+              uint16_t interval) {}};
+  void operator()(tHCI_STATUS status, uint16_t handle, tHCI_MODE hci_mode,
+                  uint16_t interval) {
+    body(status, handle, hci_mode, interval);
+  };
+};
+extern struct btm_pm_on_mode_change btm_pm_on_mode_change;
+// Name: bluetooth::shim::BTM_SetSsrParams
+// Params: uint16_t handle, uint16_t max_lat, uint16_t min_rmt_to, uint16_t
+// min_loc_to Returns: tBTM_STATUS
+struct BTM_SetSsrParams {
+  std::function<tBTM_STATUS(uint16_t handle, uint16_t max_lat,
+                            uint16_t min_rmt_to, uint16_t min_loc_to)>
+      body{[](uint16_t handle, uint16_t max_lat, uint16_t min_rmt_to,
+              uint16_t min_loc_to) { return 0; }};
+  tBTM_STATUS operator()(uint16_t handle, uint16_t max_lat, uint16_t min_rmt_to,
+                         uint16_t min_loc_to) {
+    return body(handle, max_lat, min_rmt_to, min_loc_to);
+  };
+};
+extern struct BTM_SetSsrParams BTM_SetSsrParams;
+// Name: bluetooth::shim::btm_pm_on_sniff_subrating
+// Params:  tHCI_STATUS status, uint16_t handle, uint16_t
+// maximum_transmit_latency, UNUSED_ATTR uint16_t maximum_receive_latency,
+// uint16_t minimum_remote_timeout, uint16_t minimum_local_timeout Returns: void
+struct btm_pm_on_sniff_subrating {
+  std::function<void(
+      tHCI_STATUS status, uint16_t handle, uint16_t maximum_transmit_latency,
+      UNUSED_ATTR uint16_t maximum_receive_latency,
+      uint16_t minimum_remote_timeout, uint16_t minimum_local_timeout)>
+      body{[](tHCI_STATUS status, uint16_t handle,
+              uint16_t maximum_transmit_latency,
+              UNUSED_ATTR uint16_t maximum_receive_latency,
+              uint16_t minimum_remote_timeout,
+              uint16_t minimum_local_timeout) {}};
+  void operator()(tHCI_STATUS status, uint16_t handle,
+                  uint16_t maximum_transmit_latency,
+                  UNUSED_ATTR uint16_t maximum_receive_latency,
+                  uint16_t minimum_remote_timeout,
+                  uint16_t minimum_local_timeout) {
+    body(status, handle, maximum_transmit_latency, maximum_receive_latency,
+         minimum_remote_timeout, minimum_local_timeout);
+  };
+};
+extern struct btm_pm_on_sniff_subrating btm_pm_on_sniff_subrating;
+
+}  // namespace main_shim_link_policy
+}  // namespace mock
+}  // namespace test
+
+// END mockcify generation
index 7891973..76c5e3c 100644 (file)
 /*
  * Generated mock file from original source file
  *   Functions generated:12
+ *
+ *  mockcify.pl ver 0.2
  */
 
 #include <cstdint>
+#include <functional>
 #include <map>
 #include <string>
 
 extern std::map<std::string, int> mock_function_count_map;
 
+// Original included files, if any
+// NOTE: Since this is a mock file with mock definitions some number of
+//       include files may not be required.  The include-what-you-use
+//       still applies, but crafting proper inclusion is out of scope
+//       for this effort.  This compilation unit may compile as-is, or
+//       may need attention to prune the inclusion set.
+#include "gd/hci/address.h"
 #include "gd/os/metrics.h"
+#include "main/shim/helpers.h"
 #include "main/shim/metrics_api.h"
 #include "types/raw_address.h"
 
+// Mock include file to share data between tests and mock
+#include "test/mock/mock_main_shim_metrics_api.h"
+
+// Mocked compile conditionals, if any
 #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) {
+// Mocked internal structures, if any
+
+namespace test {
+namespace mock {
+namespace main_shim_metrics_api {
+
+// Function state capture and return values, if needed
+struct LogMetricLinkLayerConnectionEvent LogMetricLinkLayerConnectionEvent;
+struct LogMetricA2dpAudioUnderrunEvent LogMetricA2dpAudioUnderrunEvent;
+struct LogMetricA2dpAudioOverrunEvent LogMetricA2dpAudioOverrunEvent;
+struct LogMetricA2dpPlaybackEvent LogMetricA2dpPlaybackEvent;
+struct LogMetricReadRssiResult LogMetricReadRssiResult;
+struct LogMetricReadFailedContactCounterResult
+    LogMetricReadFailedContactCounterResult;
+struct LogMetricReadTxPowerLevelResult LogMetricReadTxPowerLevelResult;
+struct LogMetricSmpPairingEvent LogMetricSmpPairingEvent;
+struct LogMetricClassicPairingEvent LogMetricClassicPairingEvent;
+struct LogMetricSdpAttribute LogMetricSdpAttribute;
+struct LogMetricSocketConnectionState LogMetricSocketConnectionState;
+struct LogMetricManufacturerInfo LogMetricManufacturerInfo;
+
+}  // namespace main_shim_metrics_api
+}  // namespace mock
+}  // namespace test
+
+// Mocked functions, if any
+void bluetooth::shim::LogMetricLinkLayerConnectionEvent(
+    const RawAddress* raw_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__]++;
+  test::mock::main_shim_metrics_api::LogMetricLinkLayerConnectionEvent(
+      raw_address, connection_handle, direction, link_type, hci_cmd, hci_event,
+      hci_ble_event, cmd_status, reason_code);
 }
 void bluetooth::shim::LogMetricA2dpAudioUnderrunEvent(
     const RawAddress& raw_address, uint64_t encoding_interval_millis,
     int num_missing_pcm_bytes) {
   mock_function_count_map[__func__]++;
+  test::mock::main_shim_metrics_api::LogMetricA2dpAudioUnderrunEvent(
+      raw_address, encoding_interval_millis, num_missing_pcm_bytes);
+}
+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__]++;
+  test::mock::main_shim_metrics_api::LogMetricA2dpAudioOverrunEvent(
+      raw_address, encoding_interval_millis, num_dropped_buffers,
+      num_dropped_encoded_frames, num_dropped_encoded_bytes);
 }
 void bluetooth::shim::LogMetricA2dpPlaybackEvent(const RawAddress& raw_address,
                                                  int playback_state,
                                                  int audio_coding_mode) {
   mock_function_count_map[__func__]++;
+  test::mock::main_shim_metrics_api::LogMetricA2dpPlaybackEvent(
+      raw_address, playback_state, audio_coding_mode);
 }
-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) {
+void bluetooth::shim::LogMetricReadRssiResult(const RawAddress& raw_address,
+                                              uint16_t handle,
+                                              uint32_t cmd_status,
+                                              int8_t rssi) {
   mock_function_count_map[__func__]++;
+  test::mock::main_shim_metrics_api::LogMetricReadRssiResult(
+      raw_address, handle, cmd_status, rssi);
 }
 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__]++;
+  test::mock::main_shim_metrics_api::LogMetricReadFailedContactCounterResult(
+      raw_address, handle, cmd_status, failed_contact_counter);
 }
 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__]++;
+  test::mock::main_shim_metrics_api::LogMetricReadTxPowerLevelResult(
+      raw_address, handle, cmd_status, transmit_power_level);
+}
+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__]++;
+  test::mock::main_shim_metrics_api::LogMetricSmpPairingEvent(
+      raw_address, smp_cmd, direction, smp_fail_reason);
+}
+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__]++;
+  test::mock::main_shim_metrics_api::LogMetricClassicPairingEvent(
+      raw_address, handle, hci_cmd, hci_event, cmd_status, reason_code,
+      event_value);
 }
 void bluetooth::shim::LogMetricSdpAttribute(const RawAddress& raw_address,
                                             uint16_t protocol_uuid,
@@ -85,11 +151,9 @@ void bluetooth::shim::LogMetricSdpAttribute(const RawAddress& raw_address,
                                             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__]++;
+  test::mock::main_shim_metrics_api::LogMetricSdpAttribute(
+      raw_address, protocol_uuid, attribute_id, attribute_size,
+      attribute_value);
 }
 void bluetooth::shim::LogMetricSocketConnectionState(
     const RawAddress& raw_address, int port, int type,
@@ -97,4 +161,20 @@ void bluetooth::shim::LogMetricSocketConnectionState(
     int64_t tx_bytes, int64_t rx_bytes, int uid, int server_port,
     android::bluetooth::SocketRoleEnum socket_role) {
   mock_function_count_map[__func__]++;
+  test::mock::main_shim_metrics_api::LogMetricSocketConnectionState(
+      raw_address, port, type, connection_state, tx_bytes, rx_bytes, uid,
+      server_port, socket_role);
 }
+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__]++;
+  test::mock::main_shim_metrics_api::LogMetricManufacturerInfo(
+      raw_address, source_type, source_name, manufacturer, model,
+      hardware_version, software_version);
+}
+
+// END mockcify generation
diff --git a/test/mock/mock_main_shim_metrics_api.h b/test/mock/mock_main_shim_metrics_api.h
new file mode 100644 (file)
index 0000000..aba10a8
--- /dev/null
@@ -0,0 +1,287 @@
+/*
+ * 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
+ *
+ *  mockcify.pl ver 0.2
+ */
+
+#include <cstdint>
+#include <functional>
+#include <map>
+#include <string>
+
+extern std::map<std::string, int> mock_function_count_map;
+
+// Original included files, if any
+// NOTE: Since this is a mock file with mock definitions some number of
+//       include files may not be required.  The include-what-you-use
+//       still applies, but crafting proper inclusion is out of scope
+//       for this effort.  This compilation unit may compile as-is, or
+//       may need attention to prune the inclusion set.
+#include "gd/hci/address.h"
+#include "gd/os/metrics.h"
+#include "main/shim/helpers.h"
+#include "main/shim/metrics_api.h"
+#include "types/raw_address.h"
+
+// Mocked compile conditionals, if any
+#ifndef UNUSED_ATTR
+#define UNUSED_ATTR
+#endif
+
+namespace test {
+namespace mock {
+namespace main_shim_metrics_api {
+
+// Shared state between mocked functions and tests
+// Name: LogMetricLinkLayerConnectionEvent
+// Params: const RawAddress* raw_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 Returns: void
+struct LogMetricLinkLayerConnectionEvent {
+  std::function<void(const RawAddress* raw_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)>
+      body{[](const RawAddress* raw_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) {}};
+  void operator()(const RawAddress* raw_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) {
+    body(raw_address, connection_handle, direction, link_type, hci_cmd,
+         hci_event, hci_ble_event, cmd_status, reason_code);
+  };
+};
+extern struct LogMetricLinkLayerConnectionEvent
+    LogMetricLinkLayerConnectionEvent;
+// Name: LogMetricA2dpAudioUnderrunEvent
+// Params: const RawAddress& raw_address, uint64_t encoding_interval_millis, int
+// num_missing_pcm_bytes Returns: void
+struct LogMetricA2dpAudioUnderrunEvent {
+  std::function<void(const RawAddress& raw_address,
+                     uint64_t encoding_interval_millis,
+                     int num_missing_pcm_bytes)>
+      body{[](const RawAddress& raw_address, uint64_t encoding_interval_millis,
+              int num_missing_pcm_bytes) {}};
+  void operator()(const RawAddress& raw_address,
+                  uint64_t encoding_interval_millis,
+                  int num_missing_pcm_bytes) {
+    body(raw_address, encoding_interval_millis, num_missing_pcm_bytes);
+  };
+};
+extern struct LogMetricA2dpAudioUnderrunEvent LogMetricA2dpAudioUnderrunEvent;
+// Name: LogMetricA2dpAudioOverrunEvent
+// Params: const RawAddress& raw_address, uint64_t encoding_interval_millis, int
+// num_dropped_buffers, int num_dropped_encoded_frames, int
+// num_dropped_encoded_bytes Returns: void
+struct LogMetricA2dpAudioOverrunEvent {
+  std::function<void(const RawAddress& raw_address,
+                     uint64_t encoding_interval_millis, int num_dropped_buffers,
+                     int num_dropped_encoded_frames,
+                     int num_dropped_encoded_bytes)>
+      body{[](const RawAddress& raw_address, uint64_t encoding_interval_millis,
+              int num_dropped_buffers, int num_dropped_encoded_frames,
+              int num_dropped_encoded_bytes) {}};
+  void operator()(const RawAddress& raw_address,
+                  uint64_t encoding_interval_millis, int num_dropped_buffers,
+                  int num_dropped_encoded_frames,
+                  int num_dropped_encoded_bytes) {
+    body(raw_address, encoding_interval_millis, num_dropped_buffers,
+         num_dropped_encoded_frames, num_dropped_encoded_bytes);
+  };
+};
+extern struct LogMetricA2dpAudioOverrunEvent LogMetricA2dpAudioOverrunEvent;
+// Name: LogMetricA2dpPlaybackEvent
+// Params: const RawAddress& raw_address, int playback_state, int
+// audio_coding_mode Returns: void
+struct LogMetricA2dpPlaybackEvent {
+  std::function<void(const RawAddress& raw_address, int playback_state,
+                     int audio_coding_mode)>
+      body{[](const RawAddress& raw_address, int playback_state,
+              int audio_coding_mode) {}};
+  void operator()(const RawAddress& raw_address, int playback_state,
+                  int audio_coding_mode) {
+    body(raw_address, playback_state, audio_coding_mode);
+  };
+};
+extern struct LogMetricA2dpPlaybackEvent LogMetricA2dpPlaybackEvent;
+// Name: LogMetricReadRssiResult
+// Params: const RawAddress& raw_address, uint16_t handle, uint32_t cmd_status,
+// int8_t rssi Returns: void
+struct LogMetricReadRssiResult {
+  std::function<void(const RawAddress& raw_address, uint16_t handle,
+                     uint32_t cmd_status, int8_t rssi)>
+      body{[](const RawAddress& raw_address, uint16_t handle,
+              uint32_t cmd_status, int8_t rssi) {}};
+  void operator()(const RawAddress& raw_address, uint16_t handle,
+                  uint32_t cmd_status, int8_t rssi) {
+    body(raw_address, handle, cmd_status, rssi);
+  };
+};
+extern struct LogMetricReadRssiResult LogMetricReadRssiResult;
+// Name: LogMetricReadFailedContactCounterResult
+// Params: const RawAddress& raw_address, uint16_t handle, uint32_t cmd_status,
+// int32_t failed_contact_counter Returns: void
+struct LogMetricReadFailedContactCounterResult {
+  std::function<void(const RawAddress& raw_address, uint16_t handle,
+                     uint32_t cmd_status, int32_t failed_contact_counter)>
+      body{[](const RawAddress& raw_address, uint16_t handle,
+              uint32_t cmd_status, int32_t failed_contact_counter) {}};
+  void operator()(const RawAddress& raw_address, uint16_t handle,
+                  uint32_t cmd_status, int32_t failed_contact_counter) {
+    body(raw_address, handle, cmd_status, failed_contact_counter);
+  };
+};
+extern struct LogMetricReadFailedContactCounterResult
+    LogMetricReadFailedContactCounterResult;
+// Name: LogMetricReadTxPowerLevelResult
+// Params: const RawAddress& raw_address, uint16_t handle, uint32_t cmd_status,
+// int32_t transmit_power_level Returns: void
+struct LogMetricReadTxPowerLevelResult {
+  std::function<void(const RawAddress& raw_address, uint16_t handle,
+                     uint32_t cmd_status, int32_t transmit_power_level)>
+      body{[](const RawAddress& raw_address, uint16_t handle,
+              uint32_t cmd_status, int32_t transmit_power_level) {}};
+  void operator()(const RawAddress& raw_address, uint16_t handle,
+                  uint32_t cmd_status, int32_t transmit_power_level) {
+    body(raw_address, handle, cmd_status, transmit_power_level);
+  };
+};
+extern struct LogMetricReadTxPowerLevelResult LogMetricReadTxPowerLevelResult;
+// Name: LogMetricSmpPairingEvent
+// Params: const RawAddress& raw_address, uint8_t smp_cmd,
+// android::bluetooth::DirectionEnum direction, uint8_t smp_fail_reason Returns:
+// void
+struct LogMetricSmpPairingEvent {
+  std::function<void(const RawAddress& raw_address, uint8_t smp_cmd,
+                     android::bluetooth::DirectionEnum direction,
+                     uint8_t smp_fail_reason)>
+      body{[](const RawAddress& raw_address, uint8_t smp_cmd,
+              android::bluetooth::DirectionEnum direction,
+              uint8_t smp_fail_reason) {}};
+  void operator()(const RawAddress& raw_address, uint8_t smp_cmd,
+                  android::bluetooth::DirectionEnum direction,
+                  uint8_t smp_fail_reason) {
+    body(raw_address, smp_cmd, direction, smp_fail_reason);
+  };
+};
+extern struct LogMetricSmpPairingEvent LogMetricSmpPairingEvent;
+// Name: LogMetricClassicPairingEvent
+// Params: 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 Returns: void
+struct LogMetricClassicPairingEvent {
+  std::function<void(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)>
+      body{[](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) {}};
+  void operator()(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) {
+    body(raw_address, handle, hci_cmd, hci_event, cmd_status, reason_code,
+         event_value);
+  };
+};
+extern struct LogMetricClassicPairingEvent LogMetricClassicPairingEvent;
+// Name: LogMetricSdpAttribute
+// Params: const RawAddress& raw_address, uint16_t protocol_uuid, uint16_t
+// attribute_id, size_t attribute_size, const char* attribute_value Returns:
+// void
+struct LogMetricSdpAttribute {
+  std::function<void(const RawAddress& raw_address, uint16_t protocol_uuid,
+                     uint16_t attribute_id, size_t attribute_size,
+                     const char* attribute_value)>
+      body{[](const RawAddress& raw_address, uint16_t protocol_uuid,
+              uint16_t attribute_id, size_t attribute_size,
+              const char* attribute_value) {}};
+  void operator()(const RawAddress& raw_address, uint16_t protocol_uuid,
+                  uint16_t attribute_id, size_t attribute_size,
+                  const char* attribute_value) {
+    body(raw_address, protocol_uuid, attribute_id, attribute_size,
+         attribute_value);
+  };
+};
+extern struct LogMetricSdpAttribute LogMetricSdpAttribute;
+// Name: LogMetricSocketConnectionState
+// Params: 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 Returns: void
+struct LogMetricSocketConnectionState {
+  std::function<void(
+      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)>
+      body{[](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) {}};
+  void operator()(
+      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) {
+    body(raw_address, port, type, connection_state, tx_bytes, rx_bytes, uid,
+         server_port, socket_role);
+  };
+};
+extern struct LogMetricSocketConnectionState LogMetricSocketConnectionState;
+// Name: LogMetricManufacturerInfo
+// Params: 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 Returns: void
+struct LogMetricManufacturerInfo {
+  std::function<void(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)>
+      body{[](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) {}};
+  void operator()(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) {
+    body(raw_address, source_type, source_name, manufacturer, model,
+         hardware_version, software_version);
+  };
+};
+extern struct LogMetricManufacturerInfo LogMetricManufacturerInfo;
+
+}  // namespace main_shim_metrics_api
+}  // namespace mock
+}  // namespace test
+
+// END mockcify generation
\ No newline at end of file