Snap for 7562097 from 4d5cc4db4296d48d31bd835c78647d6a060cdd5b to sdk-release

Change-Id: I9b5b28f01ccd23b581cd25f8fa47731c4ac7cb40
diff --git a/README.md b/README.md
index c7a6bcc..9c9f549 100644
--- a/README.md
+++ b/README.md
@@ -13,17 +13,21 @@
 * Bison 3.x.x (tested with 3.0.x, 3.2.x and 3.7.x)
 
 You'll want to download some pre-requisite packages as well. If you're currently
-configured for AOSP development, you should have all required packages.
-Otherwise, you can use the following apt-get list:
+configured for AOSP development, you should have most required packages.
+Otherwise, you can use the following apt-get list or use the bootstrap script
+(see below) to get a list of packages missing on your system:
 
 ```sh
 sudo apt-get install repo git-core gnupg flex bison gperf build-essential \
   zip curl zlib1g-dev gcc-multilib g++-multilib \
-  x11proto-core-dev libx11-dev lib32z-dev libncurses5 \
+  x11proto-core-dev libx11-dev libncurses5 \
   libgl1-mesa-dev libxml2-utils xsltproc unzip liblz4-tool libssl-dev \
   libc++-dev libevent-dev \
-  flatbuffers-compiler libflatbuffers1 \
-  openssl openssl-dev
+  flatbuffers-compiler libflatbuffers1 openssl \
+  libflatbuffers-dev libtinyxml2-dev \
+  libglib2.0-dev libevent-dev libnss3-dev libdbus-1-dev \
+  libprotobuf-dev ninja-build generate-ninja protobuf-compiler \
+  libre2-9
 ```
 
 You will also need a recent-ish version of Rust and Cargo. Please follow the
@@ -37,14 +41,20 @@
 git clone https://android.googlesource.com/platform/system/bt
 ```
 
-Install dependencies (require sudo access). This adds some Ubuntu dependencies
-and also installs GN (which is the build tool we're using).
+### Use bootstrap.py
 
+`bootstrap.py` is a helper script provided to set up your build environment. It
+will set up your build staging directory and also make sure you have all
+required system packages to build (should work on Debian and Ubuntu). You will
+still need to build some unpackaged dependencies.
+
+To use it:
 ```sh
-cd ~/fluoride/bt
-build/install_deps.sh
+./bootstrap.py --base-dir=path/to/staging/dir --bt-dir=path/to/bt/dir
 ```
 
+### Build dependencies
+
 The following third-party dependencies are necessary but currently unavailable
 via a package manager. You may have to build these from source and install them
 to your local environment.
@@ -52,24 +62,59 @@
 * libchrome
 * modp_b64
 
-We provide a script to produce debian packages for those components, please
-follow the instructions in build/dpkg/README.txt.
+We provide a script to produce debian packages for those components. Please
+see the instructions in build/dpkg/README.txt for more details.
+
+```sh
+cd build/dpkg
+mkdir -p outdir/{modp_b64,libchrome}
+
+# Build and install modp_b64
+pushd modp_b64
+./gen-src-pkg.sh $(readlink -f ../outdir/modp_b64)
+popd
+sudo dpkg -i outdir/modp_b64/*.dpkg
+
+# Build and install libchrome
+pushd libchrome
+./gen-src-pkg.sh $(readlink -f ../outdir/libchrome)
+popd
+sudo dpkg -i outdir/libchrome/*.dpkg
+```
 
 The googletest packages provided by Debian/Ubuntu (libgmock-dev and
 libgtest-dev) do not provide pkg-config files, so you can build your own
 googletest using the steps below:
 
+```sh
+git clone https://github.com/google/googletest.git -b release-1.10.0
+cd googletest        # Main directory of the cloned repository.
+mkdir build          # Create a directory to hold the build output.
+cd build
+cmake ..             # Generate native build scripts for GoogleTest.
+sudo make install -DCMAKE_INSTALL_PREFIX=/usr
+
+# Optional steps if pkgconfig isn't installed to desired location
+# Modify the source (/usr/lib/x86_64-linux-gnu) and target (/usr/lib) based on
+# your local installation.
+for f in $(ls /usr/lib/x86_64-linux-gnu/pkgconfig/{gtest,gmock}*); do \
+  ln -sf $f /usr/lib/pkgconfig/$(basename $f);
+done
 ```
-$ git clone https://github.com/google/googletest.git -b release-1.10.0
-$ cd googletest        # Main directory of the cloned repository.
-$ mkdir build          # Create a directory to hold the build output.
-$ cd build
-$ cmake ..             # Generate native build scripts for GoogleTest.
-$ sudo make install -DCMAKE_INSTALL_PREFIX=/usr
+
+### Rust dependencies
+
+**Note**: Handled by bootstrap script.
+
+Run the following to install Rust dependencies:
+```
+cargo install cxxbridge-cmd
 ```
 
 ### Stage your build environment
 
+**Note**: Handled by bootstrap script.
+
 For host build, we depend on a few other repositories:
 * [Platform2](https://chromium.googlesource.com/chromiumos/platform2/)
 * [Rust crates](https://chromium.googlesource.com/chromiumos/third_party/rust_crates/)
@@ -89,7 +134,10 @@
 ### Build
 
 We provide a build script to automate building assuming you've staged your build
-environment already as above.
+environment already as above. At this point, make sure you have all the
+pre-requisites installed (i.e. bootstrap script and other dependencies above) or
+you will see failures. In addition, you may need to set a `--libdir=` if your
+libraries are not stored in `/usr/lib64` by default.
 
 
 ```sh
@@ -114,9 +162,9 @@
 ### Run
 
 By default on Linux, we statically link libbluetooth so you can just run the
-binary directly:
+binary directly. By default, it will try to run on hci0 but you can pass it
+--hci=N, where N corresponds to /sys/class/bluetooth/hciN.
 
 ```sh
-cd ~/fluoride/bt/out/Default
-./bluetoothtbd -create-ipc-socket=fluoride
+$OUTPUT_DIR/debug/btadapterd --hci=$HCI INIT_gd_hci=true
 ```
diff --git a/bootstrap.py b/bootstrap.py
new file mode 100755
index 0000000..5d03f6e
--- /dev/null
+++ b/bootstrap.py
@@ -0,0 +1,243 @@
+#!/usr/bin/env python3
+
+#  Copyright 2021 Google, Inc.
+#
+#  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.
+""" Bootstrap script to help set up Linux build. """
+
+import argparse
+import os
+import subprocess
+
+PLATFORM2_GIT = 'https://chromium.googlesource.com/chromiumos/platform2'
+RUST_CRATES_GIT = 'https://chromium.googlesource.com/chromiumos/third_party/rust_crates'
+PROTO_LOGGING_GIT = 'https://android.googlesource.com/platform/frameworks/proto_logging'
+
+# List of packages required for linux build
+REQUIRED_APT_PACKAGES = [
+    'bison',
+    'build-essential',
+    'curl',
+    'flatbuffers-compiler',
+    'flex',
+    'g++-multilib',
+    'gcc-multilib',
+    'generate-ninja',
+    'gnupg',
+    'gperf',
+    'libc++-dev',
+    'libdbus-1-dev',
+    'libevent-dev',
+    'libevent-dev',
+    'libflatbuffers-dev',
+    'libflatbuffers1',
+    'libgl1-mesa-dev',
+    'libglib2.0-dev',
+    'liblz4-tool',
+    'libncurses5',
+    'libnss3-dev',
+    'libprotobuf-dev',
+    'libre2-9',
+    'libssl-dev',
+    'libtinyxml2-dev',
+    'libx11-dev',
+    'libxml2-utils',
+    'ninja-build',
+    'openssl',
+    'protobuf-compiler',
+    'unzip',
+    'x11proto-core-dev',
+    'xsltproc',
+    'zip',
+    'zlib1g-dev',
+]
+
+# List of cargo packages required for linux build
+REQUIRED_CARGO_PACKAGES = ['cxxbridge-cmd']
+
+APT_PKG_LIST = ['apt', '-qq', 'list']
+CARGO_PKG_LIST = ['cargo', 'install', '--list']
+
+
+class Bootstrap():
+
+    def __init__(self, base_dir, bt_dir):
+        """ Construct bootstrapper.
+
+        Args:
+            base_dir: Where to stage everything.
+            bt_dir: Where bluetooth source is kept (will be symlinked)
+        """
+        self.base_dir = os.path.abspath(base_dir)
+        self.bt_dir = os.path.abspath(bt_dir)
+
+        if not os.path.isdir(self.base_dir):
+            raise Exception('{} is not a valid directory'.format(self.base_dir))
+
+        if not os.path.isdir(self.bt_dir):
+            raise Exception('{} is not a valid directory'.format(self.bt_dir))
+
+        self.git_dir = os.path.join(self.base_dir, 'repos')
+        self.staging_dir = os.path.join(self.base_dir, 'staging')
+        self.output_dir = os.path.join(self.base_dir, 'output')
+        self.external_dir = os.path.join(self.base_dir, 'staging', 'external')
+
+        self.dir_setup_complete = os.path.join(self.base_dir, '.setup-complete')
+
+    def _setup_platform2(self):
+        """ Set up platform2.
+
+        This will check out all the git repos and symlink everything correctly.
+        """
+
+        # If already set up, exit early
+        if os.path.isfile(self.dir_setup_complete):
+            print('{} is already set-up'.format(self.base_dir))
+            return
+
+        # Create all directories we will need to use
+        for dirpath in [self.git_dir, self.staging_dir, self.output_dir, self.external_dir]:
+            os.makedirs(dirpath)
+
+        # Check out all repos in git directory
+        for repo in [PLATFORM2_GIT, RUST_CRATES_GIT, PROTO_LOGGING_GIT]:
+            subprocess.check_call(['git', 'clone', repo], cwd=self.git_dir)
+
+        # Symlink things
+        symlinks = [
+            (os.path.join(self.git_dir, 'platform2', 'common-mk'), os.path.join(self.staging_dir, 'common-mk')),
+            (os.path.join(self.git_dir, 'platform2', '.gn'), os.path.join(self.staging_dir, '.gn')),
+            (os.path.join(self.bt_dir), os.path.join(self.staging_dir, 'bt')),
+            (os.path.join(self.git_dir, 'rust_crates'), os.path.join(self.external_dir, 'rust')),
+            (os.path.join(self.git_dir, 'proto_logging'), os.path.join(self.external_dir, 'proto_logging')),
+        ]
+
+        # Create symlinks
+        for pairs in symlinks:
+            (src, dst) = pairs
+            os.symlink(src, dst)
+
+        # Write to setup complete file so we don't repeat this step
+        with open(self.dir_setup_complete, 'w') as f:
+            f.write('Setup complete.')
+
+    def _pretty_print_install(self, install_cmd, packages, line_limit=80):
+        """ Pretty print an install command.
+
+        Args:
+            install_cmd: Prefixed install command.
+            packages: Enumerate packages and append them to install command.
+            line_limit: Number of characters per line.
+
+        Return:
+            Array of lines to join and print.
+        """
+        install = [install_cmd]
+        line = '  '
+        # Remainder needed = space + len(pkg) + space + \
+        # Assuming 80 character lines, that's 80 - 3 = 77
+        line_limit = line_limit - 3
+        for pkg in packages:
+            if len(line) + len(pkg) < line_limit:
+                line = '{}{} '.format(line, pkg)
+            else:
+                install.append(line)
+                line = '  {} '.format(pkg)
+
+        if len(line) > 0:
+            install.append(line)
+
+        return install
+
+    def _check_package_installed(self, package, cmd, predicate):
+        """Check that the given package is installed.
+
+        Args:
+            package: Check that this package is installed.
+            cmd: Command prefix to check if installed (package appended to end)
+            predicate: Function/lambda to check if package is installed based
+                       on output. Takes string output and returns boolean.
+
+        Return:
+            True if package is installed.
+        """
+        try:
+            output = subprocess.check_output(cmd + [package], stderr=subprocess.STDOUT)
+            is_installed = predicate(output.decode('utf-8'))
+            print('  {} is {}'.format(package, 'installed' if is_installed else 'missing'))
+
+            return is_installed
+        except Exception as e:
+            print(e)
+            return False
+
+    def _print_missing_packages(self):
+        """Print any missing packages found via apt.
+
+        This will find any missing packages necessary for build using apt and
+        print it out as an apt-get install printf.
+        """
+        print('Checking for any missing packages...')
+        need_packages = []
+        for pkg in REQUIRED_APT_PACKAGES:
+            if not self._check_package_installed(pkg, APT_PKG_LIST, lambda output: 'installed' in output):
+                need_packages.append(pkg)
+
+        # No packages need to be installed
+        if len(need_packages) == 0:
+            print('All required packages are installed')
+            return
+
+        install = self._pretty_print_install('sudo apt-get install', need_packages)
+
+        # Print all lines so they can be run in cmdline
+        print('Missing system packages. Run the following command: ')
+        print(' \\\n'.join(install))
+
+    def _print_missing_rust_packages(self):
+        """Print any missing packages found via cargo.
+
+        This will find any missing packages necessary for build using cargo and
+        print it out as a cargo-install printf.
+        """
+        print('Checking for any missing cargo packages...')
+        need_packages = []
+
+        for pkg in REQUIRED_CARGO_PACKAGES:
+            if not self._check_package_installed(pkg, CARGO_PKG_LIST, lambda output: pkg in output):
+                need_packages.append(pkg)
+
+        # No packages to be installed
+        if len(need_packages) == 0:
+            print('All required cargo packages are installed')
+            return
+
+        install = self._pretty_print_install('cargo install', need_packages)
+        print('Missing cargo packages. Run the following command: ')
+        print(' \\\n'.join(install))
+
+    def bootstrap(self):
+        """ Bootstrap the Linux build."""
+        self._setup_platform2()
+        self._print_missing_packages()
+        self._print_missing_rust_packages()
+
+
+if __name__ == '__main__':
+    parser = argparse.ArgumentParser(description='Bootstrap Linux build')
+    parser.add_argument('--base-dir', help='Where to create build directories.', required=True)
+    parser.add_argument('--bt-dir', help='Path to system/bt', required=True)
+
+    args = parser.parse_args()
+    bootstrap = Bootstrap(args.base_dir, args.bt_dir)
+    bootstrap.bootstrap()
diff --git a/bta/Android.bp b/bta/Android.bp
index 9b33f72..dc4f171 100644
--- a/bta/Android.bp
+++ b/bta/Android.bp
@@ -173,6 +173,8 @@
         ":TestMockMainShim",
         ":TestMockStack",
         ":TestStubOsi",
+        "ar/bta_ar.cc",
+        "dm/bta_dm_api.cc",
         "dm/bta_dm_act.cc",
         "dm/bta_dm_cfg.cc",
         "dm/bta_dm_ci.cc",
diff --git a/bta/dm/bta_dm_act.cc b/bta/dm/bta_dm_act.cc
index a80ffa4..f95d8d2 100644
--- a/bta/dm/bta_dm_act.cc
+++ b/bta/dm/bta_dm_act.cc
@@ -269,7 +269,7 @@
  *
  ******************************************************************************/
 void bta_dm_init_cb(void) {
-  memset(&bta_dm_cb, 0, sizeof(bta_dm_cb));
+  bta_dm_cb = {};
   bta_dm_cb.disable_timer = alarm_new("bta_dm.disable_timer");
   bta_dm_cb.switch_delay_timer = alarm_new("bta_dm.switch_delay_timer");
   for (size_t i = 0; i < BTA_DM_NUM_PM_TIMER; i++) {
@@ -301,7 +301,7 @@
       alarm_free(bta_dm_cb.pm_timer[i].timer[j]);
     }
   }
-  memset(&bta_dm_cb, 0, sizeof(bta_dm_cb));
+  bta_dm_cb = {};
 }
 
 void BTA_dm_on_hw_off() {
@@ -401,7 +401,8 @@
      which forces
      the DM_ENABLE_EVT to be sent only after all the init steps are complete
      */
-  BTM_ReadLocalDeviceNameFromController(bta_dm_local_name_cback);
+  get_btm_client_interface().local.BTM_ReadLocalDeviceNameFromController(
+      bta_dm_local_name_cback);
 
   bta_sys_rm_register(bta_dm_rm_cback);
 
@@ -508,7 +509,7 @@
 
 /** Sets local device name */
 void bta_dm_set_dev_name(const std::vector<uint8_t>& name) {
-  BTM_SetLocalDeviceName((char*)name.data());
+  BTM_SetLocalDeviceName((const char*)name.data());
   bta_dm_set_eir((char*)name.data());
 }
 
@@ -2883,6 +2884,7 @@
 
   /* Allocate a buffer to hold HCI command */
   BT_HDR* p_buf = (BT_HDR*)osi_malloc(BTM_CMD_BUF_SIZE);
+  ASSERT(p_buf != nullptr);
   p = (uint8_t*)p_buf + BTM_HCI_EIR_OFFSET;
 
   memset(p, 0x00, HCI_EXT_INQ_RESPONSE_LEN);
diff --git a/bta/dm/bta_dm_int.h b/bta/dm/bta_dm_int.h
index 996af21..4689b05 100644
--- a/bta/dm/bta_dm_int.h
+++ b/bta/dm/bta_dm_int.h
@@ -218,7 +218,7 @@
 #define BTA_DM_PM_EXECUTE 3
 typedef uint8_t tBTA_DM_PM_REQ;
 
-struct sBTA_DM_PEER_DEVICE {
+struct tBTA_DM_PEER_DEVICE {
   RawAddress peer_bdaddr;
   tBTA_DM_CONN_STATE conn_state;
   tBTA_PREF_ROLES pref_role;
@@ -229,7 +229,7 @@
   friend void bta_dm_pm_btm_status(const RawAddress& bd_addr,
                                    tBTM_PM_STATUS status, uint16_t value,
                                    tHCI_STATUS hci_status);
-  friend void bta_dm_pm_sniff(struct sBTA_DM_PEER_DEVICE* p_peer_dev,
+  friend void bta_dm_pm_sniff(struct tBTA_DM_PEER_DEVICE* p_peer_dev,
                               uint8_t index);
   friend void bta_dm_rm_cback(tBTA_SYS_CONN_STATUS status, uint8_t id,
                               uint8_t app_id, const RawAddress& peer_addr);
@@ -246,7 +246,6 @@
   bool remove_dev_pending;
   tBT_TRANSPORT transport;
 };
-typedef struct sBTA_DM_PEER_DEVICE tBTA_DM_PEER_DEVICE;
 
 /* structure to store list of
   active connections */
diff --git a/bta/test/bta_dm_cust_uuid_test.cc b/bta/test/bta_dm_cust_uuid_test.cc
index 205f7a7..39360f1 100644
--- a/bta/test/bta_dm_cust_uuid_test.cc
+++ b/bta/test/bta_dm_cust_uuid_test.cc
@@ -36,9 +36,7 @@
 
 class BtaCustUuid : public testing::Test {
  protected:
-  void SetUp() override {
-    memset(&bta_dm_cb, 0, sizeof(bta_dm_cb));
-  }
+  void SetUp() override { bta_dm_cb = {}; }
 };
 
 namespace {
diff --git a/bta/test/common/btm_api_mock.cc b/bta/test/common/btm_api_mock.cc
index 88d511a..e595c9d 100644
--- a/bta/test/common/btm_api_mock.cc
+++ b/bta/test/common/btm_api_mock.cc
@@ -24,11 +24,8 @@
   btm_interface = mock_btm_interface;
 }
 
-bool BTM_GetSecurityFlagsByTransport(const RawAddress& bd_addr,
-                                     uint8_t* p_sec_flags,
-                                     tBT_TRANSPORT transport) {
-  return btm_interface->GetSecurityFlagsByTransport(bd_addr, p_sec_flags,
-                                                    transport);
+bool BTM_IsEncrypted(const RawAddress& bd_addr, tBT_TRANSPORT transport) {
+  return btm_interface->BTM_IsEncrypted(bd_addr, transport);
 }
 
 tBTM_STATUS BTM_SetEncryption(const RawAddress& bd_addr,
diff --git a/bta/test/common/btm_api_mock.h b/bta/test/common/btm_api_mock.h
index d337b85..3c5c20f4 100644
--- a/bta/test/common/btm_api_mock.h
+++ b/bta/test/common/btm_api_mock.h
@@ -25,9 +25,8 @@
 
 class BtmInterface {
  public:
-  virtual bool GetSecurityFlagsByTransport(const RawAddress& bd_addr,
-                                           uint8_t* p_sec_flags,
-                                           tBT_TRANSPORT transport) = 0;
+  virtual bool BTM_IsEncrypted(const RawAddress& bd_addr,
+                               tBT_TRANSPORT transport) = 0;
   virtual tBTM_STATUS SetEncryption(const RawAddress& bd_addr,
                                     tBT_TRANSPORT transport,
                                     tBTM_SEC_CALLBACK* p_callback,
@@ -38,10 +37,8 @@
 
 class MockBtmInterface : public BtmInterface {
  public:
-  MOCK_METHOD((bool), GetSecurityFlagsByTransport,
-              (const RawAddress& bd_addr, uint8_t* p_sec_flags,
-               tBT_TRANSPORT transport),
-              (override));
+  MOCK_METHOD((bool), BTM_IsEncrypted,
+              (const RawAddress& bd_addr, tBT_TRANSPORT transport), (override));
   MOCK_METHOD((tBTM_STATUS), SetEncryption,
               (const RawAddress& bd_addr, tBT_TRANSPORT transport,
                tBTM_SEC_CALLBACK* p_callback, void* p_ref_data,
diff --git a/bta/vc/device.cc b/bta/vc/device.cc
index 9e059e7..0b5b258 100644
--- a/bta/vc/device.cc
+++ b/bta/vc/device.cc
@@ -228,12 +228,7 @@
 }
 
 bool VolumeControlDevice::IsEncryptionEnabled() {
-  uint8_t sec_flag = 0;
-  bool device_found =
-      BTM_GetSecurityFlagsByTransport(address, &sec_flag, BT_TRANSPORT_LE);
-  LOG(INFO) << __func__ << ": found=" << static_cast<int>(device_found)
-            << " sec_flag=" << loghex(sec_flag);
-  return device_found && (sec_flag & BTM_SEC_FLAG_ENCRYPTED);
+  return BTM_IsEncrypted(address, BT_TRANSPORT_LE);
 }
 
 bool VolumeControlDevice::EnableEncryption(tBTM_SEC_CALLBACK* callback) {
diff --git a/bta/vc/devices_test.cc b/bta/vc/devices_test.cc
index e1fb3d4..6763406 100644
--- a/bta/vc/devices_test.cc
+++ b/bta/vc/devices_test.cc
@@ -428,17 +428,12 @@
 }
 
 TEST_F(VolumeControlDeviceTest, test_check_link_encrypted) {
-  ON_CALL(btm_interface, GetSecurityFlagsByTransport(_, _, _))
-      .WillByDefault(
-          DoAll(SetArgPointee<1>(BTM_SEC_FLAG_ENCRYPTED), Return(true)));
+  ON_CALL(btm_interface, BTM_IsEncrypted(_, _))
+      .WillByDefault(DoAll(Return(true)));
   ASSERT_EQ(true, device->IsEncryptionEnabled());
 
-  ON_CALL(btm_interface, GetSecurityFlagsByTransport(_, _, _))
-      .WillByDefault(DoAll(SetArgPointee<1>(0), Return(false)));
-  ASSERT_NE(true, device->IsEncryptionEnabled());
-
-  ON_CALL(btm_interface, GetSecurityFlagsByTransport(_, _, _))
-      .WillByDefault(DoAll(SetArgPointee<1>(0), Return(true)));
+  ON_CALL(btm_interface, BTM_IsEncrypted(_, _))
+      .WillByDefault(DoAll(Return(false)));
   ASSERT_NE(true, device->IsEncryptionEnabled());
 }
 
diff --git a/bta/vc/vc_test.cc b/bta/vc/vc_test.cc
index dadea57..69fe509 100644
--- a/bta/vc/vc_test.cc
+++ b/bta/vc/vc_test.cc
@@ -250,9 +250,8 @@
 
   void TestConnect(const RawAddress& address) {
     // by default indicate link as encrypted
-    ON_CALL(btm_interface, GetSecurityFlagsByTransport(address, NotNull(), _))
-        .WillByDefault(
-            DoAll(SetArgPointee<1>(BTM_SEC_FLAG_ENCRYPTED), Return(true)));
+    ON_CALL(btm_interface, BTM_IsEncrypted(address, _))
+        .WillByDefault(DoAll(Return(true)));
 
     EXPECT_CALL(gatt_interface, Open(gatt_if, address, true, _));
     VolumeControl::Get()->Connect(address);
@@ -269,9 +268,8 @@
 
   void TestAddFromStorage(const RawAddress& address, bool auto_connect) {
     // by default indicate link as encrypted
-    ON_CALL(btm_interface, GetSecurityFlagsByTransport(address, NotNull(), _))
-        .WillByDefault(
-            DoAll(SetArgPointee<1>(BTM_SEC_FLAG_ENCRYPTED), Return(true)));
+    ON_CALL(btm_interface, BTM_IsEncrypted(address, _))
+        .WillByDefault(DoAll(Return(true)));
 
     if (auto_connect) {
       EXPECT_CALL(gatt_interface, Open(gatt_if, address, false, _));
@@ -360,8 +358,8 @@
   }
 
   void SetEncryptionResult(const RawAddress& address, bool success) {
-    ON_CALL(btm_interface, GetSecurityFlagsByTransport(address, NotNull(), _))
-        .WillByDefault(DoAll(SetArgPointee<1>(0), Return(true)));
+    ON_CALL(btm_interface, BTM_IsEncrypted(address, _))
+        .WillByDefault(DoAll(Return(false)));
     EXPECT_CALL(btm_interface,
                 SetEncryption(address, _, NotNull(), _, BTM_BLE_SEC_ENCRYPT))
         .WillOnce(Invoke(
diff --git a/btif/src/bluetooth.cc b/btif/src/bluetooth.cc
index 6619eee..1e299a6 100644
--- a/btif/src/bluetooth.cc
+++ b/btif/src/bluetooth.cc
@@ -630,6 +630,7 @@
 
     copy = (bt_property_t*)osi_calloc((sizeof(bt_property_t) * num_properties) +
                                       content_len);
+    ASSERT(copy != nullptr);
     uint8_t* content = (uint8_t*)(copy + num_properties);
 
     for (int i = 0; i < num_properties; i++) {
diff --git a/build/install_deps.sh b/build/install_deps.sh
deleted file mode 100755
index 4826b38..0000000
--- a/build/install_deps.sh
+++ /dev/null
@@ -1,58 +0,0 @@
-#!/bin/bash
-CLANG_PACKAGE=clang
-GNSHA1_URL="https://chromium.googlesource.com/chromium/buildtools/\
-  +/central/linux64/gn.sha1?format=TEXT"
-
-# Check if clang is already installed on current system
-clang_path=`which clang`
-if [ -f "$clang_path" ]; then
-  # if clang binary is avalable, check its version
-  clang_version=$($clang_path --version | grep clang | sed "s/.*version\s*\([0-9]*\.[0-9]*\).*/\1/")
-  IFS="." read -ra clang_version_array <<< "$clang_version"
-  clang_version_major=${clang_version_array[0]}
-  clang_version_minor=${clang_version_array[1]}
-  # if the version is greater than 3.5 then do not install clang here
-  if [ $clang_version_major -ge 3 ] && [ $clang_version_minor -ge 5 ]; then
-    echo "Detected clang $clang_version"
-    CLANG_PACKAGE=""
-  fi
-fi
-
-if [ ! -z "$CLANG_PACKAGE" ]; then
-  # Try to find clang from a known list
-  for clang_version in 12.0 11.0
-  do
-    clang_path=`which clang-$clang_version`
-    if [ -f "$clang_path" ]; then
-      echo "Detected clang-$clang_version"
-      CLANG_PACKAGE=""
-      break
-    fi
-  done
-fi
-
-if [ ! -z "$CLANG_PACKAGE" ]; then
-  echo "clang not found on current system, installing"
-  if [ -f /etc/lsb-release ]; then
-    # Ubuntu
-    ubuntu_version=$(lsb_release --release --short)
-    IFS="." read -ra ubuntu_version_array <<< "$ubuntu_version"
-    ubuntu_version_major=${ubuntu_version_array[0]}
-    ubuntu_version_minor=${ubuntu_version_array[1]}
-    if [ $ubuntu_version_major -lt 15 ]; then
-      echo "Choose clang-3.8 for Ubuntu 14 and below"
-      CLANG_PACKAGE=clang-3.8
-    fi
-  fi
-fi
-
-sudo apt-get -y install $CLANG_PACKAGE libevent-dev libc++-dev libc++abi-dev \
-  ninja-build libflatbuffers-dev libtinyxml2-dev
-
-gn_path=`which gn`
-if [ -z $gn_path ]; then
-  gnsha1=$(curl $GNSHA1_URL | base64 -d)
-  wget -O gn http://storage.googleapis.com/chromium-gn/$gnsha1
-  chmod a+x ./gn
-  sudo mv ./gn /usr/bin/
-fi
diff --git a/common/message_loop_thread.cc b/common/message_loop_thread.cc
index 643de64..21f2206 100644
--- a/common/message_loop_thread.cc
+++ b/common/message_loop_thread.cc
@@ -117,6 +117,7 @@
   {
     if (is_main_ && init_flags::gd_rust_is_enabled()) {
       delete rust_thread_;
+      rust_thread_ = nullptr;
       thread_id_ = -1;
       linux_tid_ = -1;
       return;
diff --git a/gd/dumpsys/bundler/bundler.gni b/gd/dumpsys/bundler/bundler.gni
index c3b893b..d58697a 100644
--- a/gd/dumpsys/bundler/bundler.gni
+++ b/gd/dumpsys/bundler/bundler.gni
@@ -58,7 +58,7 @@
 
       # headers get generated ito subdirectories based on relative path
       if (gen_header) {
-        header_name = string_replace(s, ".fbs", ".h")
+        header_name = string_replace(s, ".fbs", "_generated.h")
         outputs += [ "${target_gen_dir}/${header_name}" ]
       }
     }
diff --git a/gd/rust/linux/client/Cargo.toml b/gd/rust/linux/client/Cargo.toml
index 5cd23c5..9b4d7de 100644
--- a/gd/rust/linux/client/Cargo.toml
+++ b/gd/rust/linux/client/Cargo.toml
@@ -5,6 +5,7 @@
 
 [dependencies]
 rustyline = "8.0"
+rustyline-derive = "0.4.0"
 bt_topshim = { path = "../../topshim" }
 btstack = { path = "../stack" }
 manager_service = { path = "../mgmt" }
diff --git a/gd/rust/linux/client/src/command_handler.rs b/gd/rust/linux/client/src/command_handler.rs
index 787d317..48dbbe4 100644
--- a/gd/rust/linux/client/src/command_handler.rs
+++ b/gd/rust/linux/client/src/command_handler.rs
@@ -11,6 +11,7 @@
 
 use crate::console_yellow;
 use crate::print_info;
+use crate::{BluetoothDBus, BluetoothManagerDBus};
 
 struct BtCallback {
     objpath: String,
@@ -60,21 +61,37 @@
 }
 
 /// Handles string command entered from command line.
-pub struct CommandHandler<TBluetoothManager: IBluetoothManager, TBluetooth: IBluetooth> {
-    bluetooth_manager: Arc<Mutex<Box<TBluetoothManager>>>,
-    bluetooth: Arc<Mutex<Box<TBluetooth>>>,
+pub(crate) struct CommandHandler {
+    bluetooth_manager: Arc<Mutex<Box<BluetoothManagerDBus>>>,
+    bluetooth: Arc<Mutex<Box<BluetoothDBus>>>,
 
     is_bluetooth_callback_registered: bool,
+
+    commands: Vec<String>,
 }
 
-impl<TBluetoothManager: IBluetoothManager, TBluetooth: IBluetooth>
-    CommandHandler<TBluetoothManager, TBluetooth>
-{
+impl CommandHandler {
+    /// Creates a new CommandHandler.
+    ///
+    /// * `commands` - List of commands for `help`.
     pub fn new(
-        bluetooth_manager: Arc<Mutex<Box<TBluetoothManager>>>,
-        bluetooth: Arc<Mutex<Box<TBluetooth>>>,
-    ) -> CommandHandler<TBluetoothManager, TBluetooth> {
-        CommandHandler { bluetooth_manager, bluetooth, is_bluetooth_callback_registered: false }
+        bluetooth_manager: Arc<Mutex<Box<BluetoothManagerDBus>>>,
+        bluetooth: Arc<Mutex<Box<BluetoothDBus>>>,
+        commands: Vec<String>,
+    ) -> CommandHandler {
+        CommandHandler {
+            bluetooth_manager,
+            bluetooth,
+            is_bluetooth_callback_registered: false,
+            commands,
+        }
+    }
+
+    pub fn cmd_help(&self) {
+        println!("Available commands:");
+        for cmd in &self.commands {
+            println!("{}", cmd);
+        }
     }
 
     pub fn cmd_enable(&self, _cmd: String) {
diff --git a/gd/rust/linux/client/src/dbus_iface.rs b/gd/rust/linux/client/src/dbus_iface.rs
index 9640efb..22ce08c 100644
--- a/gd/rust/linux/client/src/dbus_iface.rs
+++ b/gd/rust/linux/client/src/dbus_iface.rs
@@ -21,6 +21,10 @@
 
 use crate::dbus_arg::{DBusArg, DBusArgError, RefArgToRust};
 
+fn make_object_path(idx: i32, name: &str) -> dbus::Path {
+    dbus::Path::new(format!("/org/chromium/bluetooth/hci{}/{}", idx, name)).unwrap()
+}
+
 impl_dbus_arg_enum!(BluetoothTransport);
 impl_dbus_arg_enum!(BtSspVariant);
 
@@ -115,14 +119,17 @@
 }
 
 impl BluetoothDBus {
-    pub(crate) fn new(conn: Arc<SyncConnection>, cr: Arc<Mutex<Crossroads>>) -> BluetoothDBus {
-        // TODO: Adapter client should dynamically accept hci # and be initialized
+    pub(crate) fn new(
+        conn: Arc<SyncConnection>,
+        cr: Arc<Mutex<Crossroads>>,
+        index: i32,
+    ) -> BluetoothDBus {
         BluetoothDBus {
             client_proxy: ClientDBusProxy {
                 conn: conn.clone(),
                 cr: cr,
                 bus_name: String::from("org.chromium.bluetooth"),
-                objpath: dbus::Path::new("/org/chromium/bluetooth/adapter0").unwrap(),
+                objpath: make_object_path(index, "adapter"),
                 interface: String::from("org.chromium.bluetooth.Bluetooth"),
             },
         }
diff --git a/gd/rust/linux/client/src/editor.rs b/gd/rust/linux/client/src/editor.rs
index b7ede2c..10a1dd9 100644
--- a/gd/rust/linux/client/src/editor.rs
+++ b/gd/rust/linux/client/src/editor.rs
@@ -2,7 +2,13 @@
 
 use futures::Future;
 
-use rustyline::{Config, Editor};
+use rustyline::completion::Completer;
+use rustyline::error::ReadlineError;
+use rustyline::highlight::Highlighter;
+use rustyline::hint::Hinter;
+use rustyline::validate::Validator;
+use rustyline::{CompletionType, Config, Editor};
+use rustyline_derive::Helper;
 
 use std::pin::Pin;
 use std::sync::{Arc, Mutex};
@@ -10,13 +16,50 @@
 
 use crate::console_blue;
 
+#[derive(Helper)]
+struct BtHelper {
+    commands: Vec<String>,
+}
+
+impl Completer for BtHelper {
+    type Candidate = String;
+
+    // Returns completion based on supported commands.
+    // TODO: Add support to autocomplete BT address, command parameters, etc.
+    fn complete(
+        &self,
+        line: &str,
+        pos: usize,
+        _ctx: &rustyline::Context<'_>,
+    ) -> Result<(usize, Vec<String>), ReadlineError> {
+        let slice = &line[..pos];
+        let mut completions = vec![];
+
+        for cmd in self.commands.iter() {
+            if cmd.starts_with(slice) {
+                completions.push(cmd.clone());
+            }
+        }
+
+        Ok((0, completions))
+    }
+}
+
+impl Hinter for BtHelper {
+    type Hint = String;
+}
+
+impl Highlighter for BtHelper {}
+
+impl Validator for BtHelper {}
+
 /// A future that does async readline().
 ///
 /// async readline() is implemented by spawning a thread for the blocking readline(). While this
 /// readline() thread is blocked, it yields back to executor and will wake the executor up when the
 /// blocked thread has proceeded and got input from readline().
 pub struct AsyncReadline {
-    rl: Arc<Mutex<Editor<()>>>,
+    rl: Arc<Mutex<Editor<BtHelper>>>,
     result: Arc<Mutex<Option<rustyline::Result<String>>>>,
 }
 
@@ -44,15 +87,22 @@
 
 /// Wrapper of rustyline editor that supports async readline().
 pub struct AsyncEditor {
-    rl: Arc<Mutex<Editor<()>>>,
+    rl: Arc<Mutex<Editor<BtHelper>>>,
 }
 
 impl AsyncEditor {
     /// Creates new async rustyline editor.
-    pub fn new() -> AsyncEditor {
-        let builder = Config::builder().auto_add_history(true).history_ignore_dups(true);
+    ///
+    /// * `commands` - List of commands for autocomplete.
+    pub fn new(commands: Vec<String>) -> AsyncEditor {
+        let builder = Config::builder()
+            .auto_add_history(true)
+            .history_ignore_dups(true)
+            .completion_type(CompletionType::List);
         let config = builder.build();
-        let rl = rustyline::Editor::<()>::with_config(config);
+        let mut rl = rustyline::Editor::with_config(config);
+        let helper = BtHelper { commands };
+        rl.set_helper(Some(helper));
         AsyncEditor { rl: Arc::new(Mutex::new(rl)) }
     }
 
diff --git a/gd/rust/linux/client/src/main.rs b/gd/rust/linux/client/src/main.rs
index be7e6a0..808b1fe 100644
--- a/gd/rust/linux/client/src/main.rs
+++ b/gd/rust/linux/client/src/main.rs
@@ -50,11 +50,13 @@
 }
 
 // This creates the API implementations over D-Bus.
-fn create_api_dbus(conn: Arc<SyncConnection>, cr: Arc<Mutex<Crossroads>>) -> API {
-    let bluetooth = Arc::new(Mutex::new(Box::new(BluetoothDBus::new(conn.clone(), cr.clone()))));
+fn create_api_dbus(conn: Arc<SyncConnection>, cr: Arc<Mutex<Crossroads>>, idx: i32) -> API {
     let bluetooth_manager =
         Arc::new(Mutex::new(Box::new(BluetoothManagerDBus::new(conn.clone(), cr.clone()))));
 
+    let bluetooth =
+        Arc::new(Mutex::new(Box::new(BluetoothDBus::new(conn.clone(), cr.clone(), idx))));
+
     API { bluetooth_manager, bluetooth }
 }
 
@@ -90,7 +92,9 @@
             }),
         );
 
-        let api = create_api_dbus(conn, cr);
+        // We only need hci index 0 for now.
+        // TODO: Have a mechanism (e.g. CLI argument or btclient command) to select the hci index.
+        let api = create_api_dbus(conn, cr, 0);
 
         // TODO: Registering the callback should be done when btmanagerd is ready (detect with
         // ObjectManager).
@@ -98,9 +102,26 @@
             objpath: String::from("/org/chromium/bluetooth/client/bluetooth_manager_callback"),
         }));
 
-        let mut handler = CommandHandler::new(api.bluetooth_manager.clone(), api.bluetooth.clone());
+        // TODO(b/193719802): Refactor this into a dedicated "Help" data structure.
+        let commands = vec![
+            String::from("help"),
+            String::from("enable"),
+            String::from("disable"),
+            String::from("get_address"),
+            String::from("start_discovery"),
+            String::from("cancel_discovery"),
+            String::from("create_bond"),
+        ];
+
+        let mut handler = CommandHandler::new(
+            api.bluetooth_manager.clone(),
+            api.bluetooth.clone(),
+            commands.clone(),
+        );
 
         let mut handle_cmd = move |cmd: String| match cmd.split(' ').collect::<Vec<&str>>()[0] {
+            "help" => handler.cmd_help(),
+
             "enable" => handler.cmd_enable(cmd),
             "disable" => handler.cmd_disable(cmd),
             "get_address" => handler.cmd_get_address(cmd),
@@ -115,7 +136,7 @@
             _ => print_info!("Command \"{}\" not recognized", cmd),
         };
 
-        let editor = AsyncEditor::new();
+        let editor = AsyncEditor::new(commands.clone());
 
         loop {
             let result = editor.readline().await;
diff --git a/gd/rust/linux/mgmt/src/bin/btmanagerd/state_machine.rs b/gd/rust/linux/mgmt/src/bin/btmanagerd/state_machine.rs
index 61189cd..fdcdf84 100644
--- a/gd/rust/linux/mgmt/src/bin/btmanagerd/state_machine.rs
+++ b/gd/rust/linux/mgmt/src/bin/btmanagerd/state_machine.rs
@@ -5,7 +5,7 @@
 use nix::unistd::Pid;
 use regex::Regex;
 use std::process::{Child, Command, Stdio};
-use std::sync::{Arc, Mutex};
+use std::sync::Arc;
 use std::time::Duration;
 use tokio::io::unix::AsyncFd;
 use tokio::sync::mpsc;
@@ -265,7 +265,7 @@
                 {
                     prev_state = *context.state_machine.state.lock().unwrap();
                 }
-                let mut hci = 0;
+                let hci;
 
                 match action {
                     AdapterStateActions::StartBluetooth(i) => {
@@ -487,6 +487,9 @@
 }
 
 impl ManagerStateMachine<NativeSubprocess> {
+    // NativeSubprocess is not used but is still useful for testing in Linux without upstart.
+    // Don't remove just yet.
+    #[allow(dead_code)]
     pub fn new_native() -> ManagerStateMachine<NativeSubprocess> {
         ManagerStateMachine::new(NativeSubprocess::new())
     }
diff --git a/gd/rust/linux/service/src/main.rs b/gd/rust/linux/service/src/main.rs
index ae4b57f..9e5104a 100644
--- a/gd/rust/linux/service/src/main.rs
+++ b/gd/rust/linux/service/src/main.rs
@@ -27,9 +27,6 @@
 mod iface_bluetooth_media;
 
 const DBUS_SERVICE_NAME: &str = "org.chromium.bluetooth";
-const OBJECT_BLUETOOTH: &str = "/org/chromium/bluetooth/adapter";
-const OBJECT_BLUETOOTH_GATT: &str = "/org/chromium/bluetooth/gatt";
-const OBJECT_BLUETOOTH_MEDIA: &str = "/org/chromium/bluetooth/media";
 
 /// Check command line arguments for target hci adapter (--hci=N). If no adapter
 /// is set, default to 0.
@@ -46,6 +43,10 @@
     0
 }
 
+fn make_object_name(idx: i32, name: &str) -> String {
+    String::from(format!("/org/chromium/bluetooth/hci{}/{}", idx, name))
+}
+
 /// Runs the Bluetooth daemon serving D-Bus IPC.
 fn main() -> Result<(), Box<dyn Error>> {
     let (tx, rx) = Stack::create_channel();
@@ -103,7 +104,7 @@
 
         // Register D-Bus method handlers of IBluetooth.
         iface_bluetooth::export_bluetooth_dbus_obj(
-            String::from(format!("{}{}", OBJECT_BLUETOOTH, adapter_index)),
+            make_object_name(adapter_index, "adapter"),
             conn.clone(),
             &mut cr,
             bluetooth,
@@ -111,7 +112,7 @@
         );
         // Register D-Bus method handlers of IBluetoothGatt.
         iface_bluetooth_gatt::export_bluetooth_gatt_dbus_obj(
-            String::from(format!("{}{}", OBJECT_BLUETOOTH_GATT, adapter_index)),
+            make_object_name(adapter_index, "gatt"),
             conn.clone(),
             &mut cr,
             bluetooth_gatt,
@@ -119,7 +120,7 @@
         );
 
         iface_bluetooth_media::export_bluetooth_media_dbus_obj(
-            String::from(format!("{}{}", OBJECT_BLUETOOTH_MEDIA, adapter_index)),
+            make_object_name(adapter_index, "media"),
             conn.clone(),
             &mut cr,
             bluetooth_media,
diff --git a/main/shim/btm_api.h b/main/shim/btm_api.h
index 82dcc5f..bf5ed84 100644
--- a/main/shim/btm_api.h
+++ b/main/shim/btm_api.h
@@ -871,7 +871,7 @@
  * Returns          BTM_CMD_STARTED if successful, otherwise an error
  *
  ******************************************************************************/
-tBTM_STATUS BTM_SetLocalDeviceName(char* p_name);
+tBTM_STATUS BTM_SetLocalDeviceName(const char* p_name);
 
 /*******************************************************************************
  *
diff --git a/osi/Android.bp b/osi/Android.bp
index 611e37f..97a507d 100644
--- a/osi/Android.bp
+++ b/osi/Android.bp
@@ -45,6 +45,13 @@
     },
 }
 
+filegroup {
+  name: "OsiCompatSources",
+  srcs: [
+    "src/compat.cc",
+  ],
+}
+
 // libosi static library for target
 cc_library_static {
     name: "libosi",
@@ -52,12 +59,12 @@
     // TODO(mcchou): Remove socket_utils sources after platform specific
     // dependencies are abstracted.
     srcs: [
+        ":OsiCompatSources",
         "src/alarm.cc",
         "src/allocation_tracker.cc",
         "src/allocator.cc",
         "src/array.cc",
         "src/buffer.cc",
-        "src/compat.cc",
         "src/config.cc",
         "src/fixed_queue.cc",
         "src/future.cc",
@@ -73,6 +80,7 @@
         "src/socket_utils/socket_local_client.cc",
         "src/socket_utils/socket_local_server.cc",
         "src/thread.cc",
+        "src/thread_scheduler.cc",
         "src/wakelock.cc",
     ],
     shared_libs: [
diff --git a/osi/include/properties.h b/osi/include/properties.h
index b186f4f..8617612 100644
--- a/osi/include/properties.h
+++ b/osi/include/properties.h
@@ -20,7 +20,10 @@
 
 #include <cstdint>
 
+#ifndef PROPERTY_VALUE_MAX
 #define PROPERTY_VALUE_MAX 92
+#endif  // PROPERTY_VALUE_MAX
+
 #define BUILD_SANITY_PROPERTY_VALUE_MAX 92
 
 // Get value associated with key |key| into |value|.
diff --git a/osi/include/thread_scheduler.h b/osi/include/thread_scheduler.h
new file mode 100644
index 0000000..e377268
--- /dev/null
+++ b/osi/include/thread_scheduler.h
@@ -0,0 +1,20 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+bool thread_scheduler_enable_real_time(pid_t pid);
+bool thread_scheduler_get_priority_range(int& min, int& max);
diff --git a/osi/src/thread_scheduler.cc b/osi/src/thread_scheduler.cc
new file mode 100644
index 0000000..b001c2c
--- /dev/null
+++ b/osi/src/thread_scheduler.cc
@@ -0,0 +1,34 @@
+/*
+ * 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 <sched.h>
+#include <sys/types.h>
+
+namespace {
+constexpr int kRealTimeFifoSchedulingPriority = 1;
+}  // namespace
+
+bool thread_scheduler_enable_real_time(pid_t linux_tid) {
+  struct sched_param rt_params = {.sched_priority =
+                                      kRealTimeFifoSchedulingPriority};
+  return sched_setscheduler(linux_tid, SCHED_FIFO, &rt_params) == 0;
+}
+
+bool thread_scheduler_get_priority_range(int& min, int& max) {
+  min = sched_get_priority_min(SCHED_FIFO);
+  max = sched_get_priority_max(SCHED_FIFO);
+  return (min != -1 && max != -1) ? true : false;
+}
diff --git a/stack/Android.bp b/stack/Android.bp
index 502c266..c231662 100644
--- a/stack/Android.bp
+++ b/stack/Android.bp
@@ -1012,6 +1012,7 @@
         "BluetoothGeneratedPackets_h",
     ],
     srcs: [
+        ":OsiCompatSources",
         ":TestMockBta",
         ":TestMockBtif",
         ":TestMockHci",
diff --git a/stack/btm/btm_devctl.cc b/stack/btm/btm_devctl.cc
index 598c64f..0ecdde0 100644
--- a/stack/btm/btm_devctl.cc
+++ b/stack/btm/btm_devctl.cc
@@ -313,7 +313,7 @@
  * Returns          status of the operation
  *
  ******************************************************************************/
-tBTM_STATUS BTM_SetLocalDeviceName(char* p_name) {
+tBTM_STATUS BTM_SetLocalDeviceName(const char* p_name) {
   uint8_t* p;
 
   if (!p_name || !p_name[0] || (strlen((char*)p_name) > BD_NAME_LEN))
diff --git a/stack/gap/gap_ble.cc b/stack/gap/gap_ble.cc
index f6b047c..e3175cc 100644
--- a/stack/gap/gap_ble.cc
+++ b/stack/gap/gap_ble.cc
@@ -502,7 +502,7 @@
           break;
 
         case GATT_UUID_GAP_DEVICE_NAME:
-          BTM_SetLocalDeviceName((char*)p_value->p_dev_name);
+          BTM_SetLocalDeviceName((const char*)p_value->p_dev_name);
           break;
 
         case GATT_UUID_GAP_CENTRAL_ADDR_RESOL:
diff --git a/stack/include/btm_api.h b/stack/include/btm_api.h
index 8cf6ac8..0428311 100644
--- a/stack/include/btm_api.h
+++ b/stack/include/btm_api.h
@@ -71,7 +71,7 @@
  * Returns          BTM_CMD_STARTED if successful, otherwise an error
  *
  ******************************************************************************/
-tBTM_STATUS BTM_SetLocalDeviceName(char* p_name);
+tBTM_STATUS BTM_SetLocalDeviceName(const char* p_name);
 
 /*******************************************************************************
  *
diff --git a/stack/include/btm_client_interface.h b/stack/include/btm_client_interface.h
index 52333cb..c63a0f2 100644
--- a/stack/include/btm_client_interface.h
+++ b/stack/include/btm_client_interface.h
@@ -201,7 +201,7 @@
   struct {
     tBTM_STATUS (*BTM_ReadLocalDeviceNameFromController)(
         tBTM_CMPL_CB* p_rln_cmpl_cback);
-    tBTM_STATUS (*BTM_SetLocalDeviceName)(char* p_name);
+    tBTM_STATUS (*BTM_SetLocalDeviceName)(const char* p_name);
     tBTM_STATUS (*BTM_SetDeviceClass)(DEV_CLASS dev_class);
     bool (*BTM_IsDeviceUp)();
     uint8_t* (*BTM_ReadDeviceClass)();
diff --git a/stack/test/common/mock_bta_dm_act.cc b/stack/test/common/mock_bta_dm_act.cc
deleted file mode 100644
index 0b64f6f..0000000
--- a/stack/test/common/mock_bta_dm_act.cc
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright 2020 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:53
- */
-
-#include <map>
-#include <string>
-
-extern std::map<std::string, int> mock_function_count_map;
-
-#include "bta/dm/bta_dm_int.h"
-#include "types/raw_address.h"
-
-#ifndef UNUSED_ATTR
-#define UNUSED_ATTR
-#endif
-
-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_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, tBT_DEVICE_TYPE 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_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_execute_queued_request() { mock_function_count_map[__func__]++; }
-bool bta_dm_is_search_request_queued() {
-  mock_function_count_map[__func__]++;
-  return false;
-}
-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__]++;
-}
diff --git a/stack/test/common/mock_main_shim_btm_api.cc b/stack/test/common/mock_main_shim_btm_api.cc
deleted file mode 100644
index 927cb73..0000000
--- a/stack/test/common/mock_main_shim_btm_api.cc
+++ /dev/null
@@ -1,466 +0,0 @@
-/*
- * Copyright 2020 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:85
- */
-
-#include <map>
-#include <string>
-
-extern std::map<std::string, int> mock_function_count_map;
-
-#include <base/callback.h>
-#include <mutex>
-#include "common/metric_id_allocator.h"
-#include "common/time_util.h"
-#include "device/include/controller.h"
-#include "main/shim/btm_api.h"
-#include "main/shim/controller.h"
-#include "main/shim/link_policy.h"
-#include "main/shim/shim.h"
-#include "stack/btm/btm_int_types.h"
-#include "types/raw_address.h"
-
-#ifndef UNUSED_ATTR
-#define UNUSED_ATTR
-#endif
-
-Octet16 octet16;
-
-bool bluetooth::shim::BTM_BleDataSignature(const RawAddress& bd_addr,
-                                           uint8_t* p_text, uint16_t len,
-                                           BLE_SIGNATURE signature) {
-  mock_function_count_map[__func__]++;
-  return false;
-}
-bool bluetooth::shim::BTM_BleLocalPrivacyEnabled(void) {
-  mock_function_count_map[__func__]++;
-  return false;
-}
-bool bluetooth::shim::BTM_BleSecurityProcedureIsRunning(
-    const RawAddress& bd_addr) {
-  mock_function_count_map[__func__]++;
-  return false;
-}
-bool bluetooth::shim::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 bluetooth::shim::BTM_GetLeSecurityState(const RawAddress& bd_addr,
-                                             uint8_t* p_le_dev_sec_flags,
-                                             uint8_t* p_le_key_size) {
-  mock_function_count_map[__func__]++;
-  return false;
-}
-bool bluetooth::shim::BTM_HasEirService(const uint32_t* p_eir_uuid,
-                                        uint16_t uuid16) {
-  mock_function_count_map[__func__]++;
-  return false;
-}
-bool bluetooth::shim::BTM_ReadConnectedTransportAddress(
-    RawAddress* remote_bda, tBT_TRANSPORT transport) {
-  mock_function_count_map[__func__]++;
-  return false;
-}
-bool bluetooth::shim::BTM_ReadRemoteConnectionAddr(
-    const RawAddress& pseudo_addr, RawAddress& conn_addr,
-    tBLE_ADDR_TYPE* p_addr_type) {
-  mock_function_count_map[__func__]++;
-  return false;
-}
-bool bluetooth::shim::BTM_SecAddDevice(const RawAddress& bd_addr,
-                                       DEV_CLASS dev_class, BD_NAME bd_name,
-                                       uint8_t* features, LinkKey* link_key,
-                                       uint8_t key_type, uint8_t pin_length) {
-  mock_function_count_map[__func__]++;
-  return false;
-}
-bool bluetooth::shim::BTM_SecAddRmtNameNotifyCallback(
-    tBTM_RMT_NAME_CALLBACK* p_callback) {
-  mock_function_count_map[__func__]++;
-  return false;
-}
-bool bluetooth::shim::BTM_SecDeleteDevice(const RawAddress& bd_addr) {
-  mock_function_count_map[__func__]++;
-  return false;
-}
-bool bluetooth::shim::BTM_SecDeleteRmtNameNotifyCallback(
-    tBTM_RMT_NAME_CALLBACK* p_callback) {
-  mock_function_count_map[__func__]++;
-  return false;
-}
-bool bluetooth::shim::BTM_SecRegister(const tBTM_APPL_INFO* bta_callbacks) {
-  mock_function_count_map[__func__]++;
-  return false;
-}
-bool bluetooth::shim::BTM_UseLeLink(const RawAddress& raw_address) {
-  mock_function_count_map[__func__]++;
-  return false;
-}
-char* bluetooth::shim::BTM_SecReadDevName(const RawAddress& address) {
-  mock_function_count_map[__func__]++;
-  return nullptr;
-}
-const Octet16& bluetooth::shim::BTM_GetDeviceEncRoot() {
-  mock_function_count_map[__func__]++;
-  return octet16;
-}
-const Octet16& bluetooth::shim::BTM_GetDeviceDHK() {
-  mock_function_count_map[__func__]++;
-  return octet16;
-}
-const Octet16& bluetooth::shim::BTM_GetDeviceIDRoot() {
-  mock_function_count_map[__func__]++;
-  return octet16;
-}
-tBTM_EIR_SEARCH_RESULT bluetooth::shim::BTM_HasInquiryEirService(
-    tBTM_INQ_RESULTS* p_results, uint16_t uuid16) {
-  mock_function_count_map[__func__]++;
-  return 0;
-}
-tBTM_INQ_INFO* bluetooth::shim::BTM_InqDbFirst(void) {
-  mock_function_count_map[__func__]++;
-  return nullptr;
-}
-tBTM_INQ_INFO* bluetooth::shim::BTM_InqDbNext(tBTM_INQ_INFO* p_cur) {
-  mock_function_count_map[__func__]++;
-  return nullptr;
-}
-tBTM_INQ_INFO* bluetooth::shim::BTM_InqDbRead(const RawAddress& p_bda) {
-  mock_function_count_map[__func__]++;
-  return nullptr;
-}
-tBTM_STATUS bluetooth::shim::BTM_BleObserve(bool start, uint8_t duration_sec,
-                                            tBTM_INQ_RESULTS_CB* p_results_cb,
-                                            tBTM_CMPL_CB* p_cmpl_cb) {
-  mock_function_count_map[__func__]++;
-  return BTM_SUCCESS;
-}
-tBTM_STATUS bluetooth::shim::BTM_CancelRemoteDeviceName(void) {
-  mock_function_count_map[__func__]++;
-  return BTM_SUCCESS;
-}
-tBTM_STATUS bluetooth::shim::BTM_ClearInqDb(const RawAddress* p_bda) {
-  mock_function_count_map[__func__]++;
-  return BTM_SUCCESS;
-}
-tBTM_STATUS bluetooth::shim::BTM_ReadRemoteDeviceName(
-    const RawAddress& raw_address, tBTM_CMPL_CB* callback,
-    tBT_TRANSPORT transport) {
-  mock_function_count_map[__func__]++;
-  return BTM_SUCCESS;
-}
-tBTM_STATUS bluetooth::shim::BTM_SecBond(const RawAddress& bd_addr,
-                                         tBLE_ADDR_TYPE addr_type,
-                                         tBT_TRANSPORT transport,
-                                         tBT_DEVICE_TYPE device_type) {
-  mock_function_count_map[__func__]++;
-  return BTM_SUCCESS;
-}
-tBTM_STATUS bluetooth::shim::BTM_SecBondCancel(const RawAddress& bd_addr) {
-  mock_function_count_map[__func__]++;
-  return BTM_SUCCESS;
-}
-tBTM_STATUS bluetooth::shim::BTM_SetConnectability(uint16_t page_mode,
-                                                   uint16_t window,
-                                                   uint16_t interval) {
-  mock_function_count_map[__func__]++;
-  return BTM_SUCCESS;
-}
-tBTM_STATUS bluetooth::shim::BTM_SetDeviceClass(DEV_CLASS dev_class) {
-  mock_function_count_map[__func__]++;
-  return BTM_SUCCESS;
-}
-tBTM_STATUS bluetooth::shim::BTM_SetDiscoverability(uint16_t discoverable_mode,
-                                                    uint16_t window,
-                                                    uint16_t interval) {
-  mock_function_count_map[__func__]++;
-  return BTM_SUCCESS;
-}
-tBTM_STATUS bluetooth::shim::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 bluetooth::shim::BTM_SetInquiryMode(uint8_t inquiry_mode) {
-  mock_function_count_map[__func__]++;
-  return BTM_SUCCESS;
-}
-tBTM_STATUS bluetooth::shim::BTM_StartInquiry(tBTM_INQ_RESULTS_CB* p_results_cb,
-                                              tBTM_CMPL_CB* p_cmpl_cb) {
-  mock_function_count_map[__func__]++;
-  return BTM_SUCCESS;
-}
-tBTM_STATUS bluetooth::shim::BTM_WriteEIR(BT_HDR* p_buff) {
-  mock_function_count_map[__func__]++;
-  return BTM_SUCCESS;
-}
-tBTM_STATUS bluetooth::shim::btm_sec_mx_access_request(
-    const RawAddress& bd_addr, bool is_originator,
-    uint16_t security_requirement, tBTM_SEC_CALLBACK* p_callback,
-    void* p_ref_data) {
-  mock_function_count_map[__func__]++;
-  return BTM_SUCCESS;
-}
-uint16_t bluetooth::shim::BTM_GetHCIConnHandle(const RawAddress& remote_bda,
-                                               tBT_TRANSPORT transport) {
-  mock_function_count_map[__func__]++;
-  return 0;
-}
-uint16_t bluetooth::shim::BTM_IsInquiryActive(void) {
-  mock_function_count_map[__func__]++;
-  return 0;
-}
-uint8_t bluetooth::shim::BTM_BleGetSupportedKeySize(const RawAddress& bd_addr) {
-  mock_function_count_map[__func__]++;
-  return 0;
-}
-uint8_t bluetooth::shim::BTM_BleMaxMultiAdvInstanceCount() {
-  mock_function_count_map[__func__]++;
-  return 0;
-}
-uint8_t bluetooth::shim::BTM_GetEirSupportedServices(uint32_t* p_eir_uuid,
-                                                     uint8_t** p,
-                                                     uint8_t max_num_uuid16,
-                                                     uint8_t* p_num_uuid16) {
-  mock_function_count_map[__func__]++;
-  return 0;
-}
-uint8_t bluetooth::shim::BTM_GetEirUuidList(uint8_t* p_eir, size_t eir_len,
-                                            uint8_t uuid_size,
-                                            uint8_t* p_num_uuid,
-                                            uint8_t* p_uuid_list,
-                                            uint8_t max_num_uuid) {
-  mock_function_count_map[__func__]++;
-  return 0;
-}
-void bluetooth::shim::BTM_AddEirService(uint32_t* p_eir_uuid, uint16_t uuid16) {
-  mock_function_count_map[__func__]++;
-}
-void bluetooth::shim::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 bluetooth::shim::BTM_BleEnableDisableFilterFeature(
-    uint8_t enable, tBTM_BLE_PF_STATUS_CBACK p_stat_cback) {
-  mock_function_count_map[__func__]++;
-}
-void bluetooth::shim::BTM_BleLoadLocalKeys(uint8_t key_type,
-                                           tBTM_BLE_LOCAL_KEYS* p_key) {
-  mock_function_count_map[__func__]++;
-}
-void bluetooth::shim::BTM_BleOobDataReply(const RawAddress& bd_addr,
-                                          uint8_t res, uint8_t len,
-                                          uint8_t* p_data) {
-  mock_function_count_map[__func__]++;
-}
-void bluetooth::shim::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 bluetooth::shim::BTM_BleReceiverTest(uint8_t rx_freq,
-                                          tBTM_CMPL_CB* p_cmd_cmpl_cback) {
-  mock_function_count_map[__func__]++;
-}
-void bluetooth::shim::BTM_BleSecureConnectionOobDataReply(
-    const RawAddress& bd_addr, uint8_t* p_c, uint8_t* p_r) {
-  mock_function_count_map[__func__]++;
-}
-void bluetooth::shim::BTM_BleSetConnScanParams(uint32_t scan_interval,
-                                               uint32_t scan_window) {
-  mock_function_count_map[__func__]++;
-}
-void bluetooth::shim::BTM_BleSetPhy(const RawAddress& bd_addr, uint8_t tx_phys,
-                                    uint8_t rx_phys, uint16_t phy_options) {
-  mock_function_count_map[__func__]++;
-}
-void bluetooth::shim::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 bluetooth::shim::BTM_BleTestEnd(tBTM_CMPL_CB* p_cmd_cmpl_cback) {
-  mock_function_count_map[__func__]++;
-}
-void bluetooth::shim::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 bluetooth::shim::BTM_BleUpdateAdvFilterPolicy(tBTM_BLE_AFP adv_policy) {
-  mock_function_count_map[__func__]++;
-}
-void bluetooth::shim::BTM_CancelInquiry(void) {
-  mock_function_count_map[__func__]++;
-}
-void bluetooth::shim::BTM_ConfirmReqReply(tBTM_STATUS res,
-                                          const RawAddress& bd_addr) {
-  mock_function_count_map[__func__]++;
-}
-void bluetooth::shim::BTM_EnableInterlacedInquiryScan() {
-  mock_function_count_map[__func__]++;
-}
-void bluetooth::shim::BTM_EnableInterlacedPageScan() {
-  mock_function_count_map[__func__]++;
-}
-void bluetooth::shim::BTM_LE_PF_addr_filter(tBTM_BLE_SCAN_COND_OP action,
-                                            tBTM_BLE_PF_FILT_INDEX filt_index,
-                                            tBLE_BD_ADDR addr,
-                                            tBTM_BLE_PF_CFG_CBACK cb) {
-  mock_function_count_map[__func__]++;
-}
-void bluetooth::shim::BTM_LE_PF_clear(tBTM_BLE_PF_FILT_INDEX filt_index,
-                                      tBTM_BLE_PF_CFG_CBACK cb) {
-  mock_function_count_map[__func__]++;
-}
-void bluetooth::shim::BTM_LE_PF_local_name(tBTM_BLE_SCAN_COND_OP action,
-                                           tBTM_BLE_PF_FILT_INDEX filt_index,
-                                           std::vector<uint8_t> name,
-                                           tBTM_BLE_PF_CFG_CBACK cb) {
-  mock_function_count_map[__func__]++;
-}
-void bluetooth::shim::BTM_LE_PF_manu_data(
-    tBTM_BLE_SCAN_COND_OP action, tBTM_BLE_PF_FILT_INDEX filt_index,
-    uint16_t company_id, uint16_t company_id_mask, std::vector<uint8_t> data,
-    std::vector<uint8_t> data_mask, tBTM_BLE_PF_CFG_CBACK cb) {
-  mock_function_count_map[__func__]++;
-}
-void bluetooth::shim::BTM_LE_PF_set(tBTM_BLE_PF_FILT_INDEX filt_index,
-                                    std::vector<ApcfCommand> commands,
-                                    tBTM_BLE_PF_CFG_CBACK cb) {
-  mock_function_count_map[__func__]++;
-}
-void bluetooth::shim::BTM_LE_PF_srvc_data(tBTM_BLE_SCAN_COND_OP action,
-                                          tBTM_BLE_PF_FILT_INDEX filt_index) {
-  mock_function_count_map[__func__]++;
-}
-void bluetooth::shim::BTM_LE_PF_srvc_data_pattern(
-    tBTM_BLE_SCAN_COND_OP action, tBTM_BLE_PF_FILT_INDEX filt_index,
-    std::vector<uint8_t> data, std::vector<uint8_t> data_mask,
-    tBTM_BLE_PF_CFG_CBACK cb) {
-  mock_function_count_map[__func__]++;
-}
-void bluetooth::shim::BTM_LE_PF_uuid_filter(tBTM_BLE_SCAN_COND_OP action,
-                                            tBTM_BLE_PF_FILT_INDEX filt_index,
-                                            tBTM_BLE_PF_COND_TYPE filter_type,
-                                            const bluetooth::Uuid& uuid,
-                                            tBTM_BLE_PF_LOGIC_TYPE cond_logic,
-                                            const bluetooth::Uuid& uuid_mask,
-                                            tBTM_BLE_PF_CFG_CBACK cb) {
-  mock_function_count_map[__func__]++;
-}
-void bluetooth::shim::BTM_PINCodeReply(const RawAddress& bd_addr,
-                                       tBTM_STATUS res, uint8_t pin_len,
-                                       uint8_t* p_pin) {
-  mock_function_count_map[__func__]++;
-}
-void bluetooth::shim::BTM_ReadConnectionAddr(const RawAddress& remote_bda,
-                                             RawAddress& local_conn_addr,
-                                             tBLE_ADDR_TYPE* p_addr_type) {
-  mock_function_count_map[__func__]++;
-}
-void bluetooth::shim::BTM_ReadDevInfo(const RawAddress& remote_bda,
-                                      tBT_DEVICE_TYPE* p_dev_type,
-                                      tBLE_ADDR_TYPE* p_addr_type) {
-  mock_function_count_map[__func__]++;
-}
-void bluetooth::shim::BTM_RemoteOobDataReply(tBTM_STATUS res,
-                                             const RawAddress& bd_addr,
-                                             const Octet16& c,
-                                             const Octet16& r) {
-  mock_function_count_map[__func__]++;
-}
-void bluetooth::shim::BTM_RemoveEirService(uint32_t* p_eir_uuid,
-                                           uint16_t uuid16) {
-  mock_function_count_map[__func__]++;
-}
-void bluetooth::shim::BTM_SecAddBleDevice(const RawAddress& bd_addr,
-                                          tBT_DEVICE_TYPE dev_type,
-                                          tBLE_ADDR_TYPE addr_type) {
-  mock_function_count_map[__func__]++;
-}
-void bluetooth::shim::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 bluetooth::shim::BTM_SecClearSecurityFlags(const RawAddress& bd_addr) {
-  mock_function_count_map[__func__]++;
-}
-void bluetooth::shim::BTM_SecurityGrant(const RawAddress& bd_addr,
-                                        uint8_t res) {
-  mock_function_count_map[__func__]++;
-}
-void bluetooth::shim::SendRemoteNameRequest(const RawAddress& raw_address) {
-  mock_function_count_map[__func__]++;
-}
-void btm_api_process_extended_inquiry_result(RawAddress raw_address,
-                                             uint8_t page_scan_rep_mode,
-                                             DEV_CLASS device_class,
-                                             uint16_t clock_offset, int8_t rssi,
-                                             const uint8_t* eir_data,
-                                             size_t eir_len) {
-  mock_function_count_map[__func__]++;
-}
-void btm_api_process_inquiry_result(const RawAddress& raw_address,
-                                    uint8_t page_scan_rep_mode,
-                                    DEV_CLASS device_class,
-                                    uint16_t clock_offset) {
-  mock_function_count_map[__func__]++;
-}
-void btm_api_process_inquiry_result_with_rssi(RawAddress raw_address,
-                                              uint8_t page_scan_rep_mode,
-                                              DEV_CLASS device_class,
-                                              uint16_t clock_offset,
-                                              int8_t rssi) {
-  mock_function_count_map[__func__]++;
-}
-tBTM_STATUS bluetooth::shim::BTM_SetPowerMode(uint16_t, tBTM_PM_PWR_MD const&) {
-  mock_function_count_map[__func__]++;
-  return BTM_SUCCESS;
-}
-void bluetooth::shim::btm_pm_on_mode_change(tHCI_STATUS status, uint16_t handle,
-                                            tHCI_MODE current_mode,
-                                            uint16_t interval) {
-  mock_function_count_map[__func__]++;
-}
-tBTM_STATUS bluetooth::shim::BTM_SetSsrParams(uint16_t, uint16_t max_lat,
-                                              uint16_t min_rmt_to,
-                                              uint16_t min_loc_to) {
-  mock_function_count_map[__func__]++;
-  return BTM_SUCCESS;
-}
-void bluetooth::shim::btm_pm_on_sniff_subrating(
-    tHCI_STATUS status, uint16_t handle, uint16_t maximum_transmit_latency,
-    uint16_t maximum_receive_latency,
-    UNUSED_ATTR uint16_t minimum_remote_timeout,
-    UNUSED_ATTR uint16_t minimum_local_timeout) {
-  mock_function_count_map[__func__]++;
-}
diff --git a/test/Android.bp b/test/Android.bp
index e4e7a8c..20c06de 100644
--- a/test/Android.bp
+++ b/test/Android.bp
@@ -160,6 +160,13 @@
 }
 
 filegroup {
+  name: "TestMockOsi",
+    srcs: [
+      "mock/mock_osi_*.cc",
+    ],
+}
+
+filegroup {
   name: "TestMockStackAcl",
   srcs: [
       "mock/mock_stack_acl*.cc",
@@ -228,3 +235,10 @@
       "common/main_handler.cc",
   ],
 }
+
+filegroup {
+  name: "TestCommonInitFlags",
+  srcs: [
+      "common/init_flags.cc",
+  ],
+}
diff --git a/test/common/init_flags.cc b/test/common/init_flags.cc
new file mode 100644
index 0000000..9b8585b
--- /dev/null
+++ b/test/common/init_flags.cc
@@ -0,0 +1,23 @@
+
+
+#include <map>
+#include <string>
+
+#include "gd/common/init_flags.h"
+
+namespace bluetooth {
+namespace common {
+
+bool InitFlags::logging_debug_enabled_for_all = false;
+std::unordered_map<std::string, bool>
+    InitFlags::logging_debug_explicit_tag_settings = {};
+void InitFlags::Load(const char** flags) {}
+void InitFlags::SetAll(bool value) {
+  InitFlags::logging_debug_enabled_for_all = value;
+}
+void InitFlags::SetAllForTesting() {
+  InitFlags::logging_debug_enabled_for_all = true;
+}
+
+}  // namespace common
+}  // namespace bluetooth
diff --git a/test/common/mock_functions.cc b/test/common/mock_functions.cc
new file mode 100644
index 0000000..20462b8
--- /dev/null
+++ b/test/common/mock_functions.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 <map>
+
+#include "osi/include/log.h"
+#include "test/common/mock_functions.h"
+
+// tLEGACY_TRACE_LEVEL
+// uint8_t btu_trace_level = 6;
+uint8_t appl_trace_level = 6;
+uint8_t btif_trace_level = 6;
+
+std::map<std::string, int> mock_function_count_map;
+
+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);
+  }
+}
diff --git a/test/common/mock_functions.h b/test/common/mock_functions.h
new file mode 100644
index 0000000..8889b86
--- /dev/null
+++ b/test/common/mock_functions.h
@@ -0,0 +1,22 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include <map>
+
+extern std::map<std::string, int> mock_function_count_map;
+void dump_mock_function_count_map();
diff --git a/test/mock/mock_bta_dm_act.cc b/test/mock/mock_bta_dm_act.cc
index 087935d..5fc6687 100644
--- a/test/mock/mock_bta_dm_act.cc
+++ b/test/mock/mock_bta_dm_act.cc
@@ -16,149 +16,369 @@
 
 /*
  * Generated mock file from original source file
- *   Functions generated:57
+ *   Functions generated:62
+ *
+ *  mockcify.pl ver 0.3.0
  */
 
+#include <cstdint>
+#include <functional>
 #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"
+// Mock include file to share data between tests and mock
+#include "test/mock/mock_bta_dm_act.h"
 
-#ifndef UNUSED_ATTR
-#define UNUSED_ATTR
-#endif
+// Mocked internal structures, if any
 
-void bta_dm_enable(tBTA_DM_SEC_CBACK* p_sec_cback) {
+namespace test {
+namespace mock {
+namespace bta_dm_act {
+
+// Function state capture and return values, if needed
+struct BTA_DmSetVisibility BTA_DmSetVisibility;
+struct BTA_dm_acl_down BTA_dm_acl_down;
+struct BTA_dm_acl_up BTA_dm_acl_up;
+struct BTA_dm_notify_remote_features_complete
+    BTA_dm_notify_remote_features_complete;
+struct BTA_dm_on_hw_off BTA_dm_on_hw_off;
+struct BTA_dm_on_hw_on BTA_dm_on_hw_on;
+struct BTA_dm_report_role_change BTA_dm_report_role_change;
+struct bta_dm_acl_up bta_dm_acl_up;
+struct bta_dm_add_ble_device bta_dm_add_ble_device;
+struct bta_dm_add_blekey bta_dm_add_blekey;
+struct bta_dm_add_device bta_dm_add_device;
+struct bta_dm_ble_config_local_privacy bta_dm_ble_config_local_privacy;
+struct bta_dm_ble_confirm_reply bta_dm_ble_confirm_reply;
+struct bta_dm_ble_csis_observe bta_dm_ble_csis_observe;
+struct bta_dm_ble_get_energy_info bta_dm_ble_get_energy_info;
+struct bta_dm_ble_observe bta_dm_ble_observe;
+struct bta_dm_ble_passkey_reply bta_dm_ble_passkey_reply;
+struct bta_dm_ble_scan bta_dm_ble_scan;
+struct bta_dm_ble_set_conn_params bta_dm_ble_set_conn_params;
+struct bta_dm_ble_set_data_length bta_dm_ble_set_data_length;
+struct bta_dm_ble_update_conn_params bta_dm_ble_update_conn_params;
+struct bta_dm_bond bta_dm_bond;
+struct bta_dm_bond_cancel bta_dm_bond_cancel;
+struct bta_dm_check_if_only_hd_connected bta_dm_check_if_only_hd_connected;
+struct bta_dm_ci_rmt_oob_act bta_dm_ci_rmt_oob_act;
+struct bta_dm_close_acl bta_dm_close_acl;
+struct bta_dm_close_gatt_conn bta_dm_close_gatt_conn;
+struct bta_dm_confirm bta_dm_confirm;
+struct bta_dm_deinit_cb bta_dm_deinit_cb;
+struct bta_dm_disable bta_dm_disable;
+struct bta_dm_disc_result bta_dm_disc_result;
+struct bta_dm_disc_rmt_name bta_dm_disc_rmt_name;
+struct bta_dm_discover bta_dm_discover;
+struct bta_dm_eir_update_cust_uuid bta_dm_eir_update_cust_uuid;
+struct bta_dm_eir_update_uuid bta_dm_eir_update_uuid;
+struct bta_dm_enable bta_dm_enable;
+struct bta_dm_encrypt_cback bta_dm_encrypt_cback;
+struct bta_dm_execute_queued_request bta_dm_execute_queued_request;
+struct bta_dm_free_sdp_db bta_dm_free_sdp_db;
+struct bta_dm_init_cb bta_dm_init_cb;
+struct bta_dm_inq_cmpl bta_dm_inq_cmpl;
+struct bta_dm_is_search_request_queued bta_dm_is_search_request_queued;
+struct bta_dm_pin_reply bta_dm_pin_reply;
+struct bta_dm_proc_open_evt bta_dm_proc_open_evt;
+struct bta_dm_process_remove_device bta_dm_process_remove_device;
+struct bta_dm_queue_disc bta_dm_queue_disc;
+struct bta_dm_queue_search bta_dm_queue_search;
+struct bta_dm_remove_device bta_dm_remove_device;
+struct bta_dm_rm_cback bta_dm_rm_cback;
+struct bta_dm_rmt_name bta_dm_rmt_name;
+struct bta_dm_sdp_result bta_dm_sdp_result;
+struct bta_dm_search_cancel bta_dm_search_cancel;
+struct bta_dm_search_cancel_cmpl bta_dm_search_cancel_cmpl;
+struct bta_dm_search_cancel_notify bta_dm_search_cancel_notify;
+struct bta_dm_search_clear_queue bta_dm_search_clear_queue;
+struct bta_dm_search_cmpl bta_dm_search_cmpl;
+struct bta_dm_search_result bta_dm_search_result;
+struct bta_dm_search_start bta_dm_search_start;
+struct bta_dm_set_dev_name bta_dm_set_dev_name;
+struct bta_dm_set_encryption bta_dm_set_encryption;
+struct btm_dm_start_gatt_discovery btm_dm_start_gatt_discovery;
+struct handle_remote_features_complete handle_remote_features_complete;
+
+}  // namespace bta_dm_act
+}  // namespace mock
+}  // namespace test
+
+// Mocked functions, if any
+bool BTA_DmSetVisibility(bt_scan_mode_t mode) {
   mock_function_count_map[__func__]++;
+  return test::mock::bta_dm_act::BTA_DmSetVisibility(mode);
 }
 void BTA_dm_acl_down(const RawAddress bd_addr, tBT_TRANSPORT transport) {
   mock_function_count_map[__func__]++;
+  test::mock::bta_dm_act::BTA_dm_acl_down(bd_addr, transport);
 }
 void BTA_dm_acl_up(const RawAddress bd_addr, tBT_TRANSPORT transport) {
   mock_function_count_map[__func__]++;
+  test::mock::bta_dm_act::BTA_dm_acl_up(bd_addr, transport);
 }
 void BTA_dm_notify_remote_features_complete(const RawAddress bd_addr) {
   mock_function_count_map[__func__]++;
+  test::mock::bta_dm_act::BTA_dm_notify_remote_features_complete(bd_addr);
 }
-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_on_hw_off() {
+  mock_function_count_map[__func__]++;
+  test::mock::bta_dm_act::BTA_dm_on_hw_off();
+}
+void BTA_dm_on_hw_on() {
+  mock_function_count_map[__func__]++;
+  test::mock::bta_dm_act::BTA_dm_on_hw_on();
+}
 void BTA_dm_report_role_change(const RawAddress bd_addr, tHCI_ROLE new_role,
                                tHCI_STATUS hci_status) {
   mock_function_count_map[__func__]++;
+  test::mock::bta_dm_act::BTA_dm_report_role_change(bd_addr, new_role,
+                                                    hci_status);
 }
 void bta_dm_acl_up(const RawAddress& bd_addr, tBT_TRANSPORT transport) {
   mock_function_count_map[__func__]++;
+  test::mock::bta_dm_act::bta_dm_acl_up(bd_addr, transport);
+}
+void bta_dm_add_ble_device(const RawAddress& bd_addr, tBLE_ADDR_TYPE addr_type,
+                           tBT_DEVICE_TYPE dev_type) {
+  mock_function_count_map[__func__]++;
+  test::mock::bta_dm_act::bta_dm_add_ble_device(bd_addr, addr_type, dev_type);
+}
+void bta_dm_add_blekey(const RawAddress& bd_addr, tBTA_LE_KEY_VALUE blekey,
+                       tBTM_LE_KEY_TYPE key_type) {
+  mock_function_count_map[__func__]++;
+  test::mock::bta_dm_act::bta_dm_add_blekey(bd_addr, blekey, key_type);
 }
 void bta_dm_add_device(std::unique_ptr<tBTA_DM_API_ADD_DEVICE> msg) {
   mock_function_count_map[__func__]++;
+  test::mock::bta_dm_act::bta_dm_add_device(std::move(msg));
+}
+void bta_dm_ble_config_local_privacy(bool privacy_enable) {
+  mock_function_count_map[__func__]++;
+  test::mock::bta_dm_act::bta_dm_ble_config_local_privacy(privacy_enable);
+}
+void bta_dm_ble_confirm_reply(const RawAddress& bd_addr, bool accept) {
+  mock_function_count_map[__func__]++;
+  test::mock::bta_dm_act::bta_dm_ble_confirm_reply(bd_addr, accept);
+}
+void bta_dm_ble_csis_observe(bool observe, tBTA_DM_SEARCH_CBACK* p_cback) {
+  mock_function_count_map[__func__]++;
+  test::mock::bta_dm_act::bta_dm_ble_csis_observe(observe, p_cback);
+}
+void bta_dm_ble_get_energy_info(
+    tBTA_BLE_ENERGY_INFO_CBACK* p_energy_info_cback) {
+  mock_function_count_map[__func__]++;
+  test::mock::bta_dm_act::bta_dm_ble_get_energy_info(p_energy_info_cback);
+}
+void bta_dm_ble_observe(bool start, uint8_t duration,
+                        tBTA_DM_SEARCH_CBACK* p_cback) {
+  mock_function_count_map[__func__]++;
+  test::mock::bta_dm_act::bta_dm_ble_observe(start, duration, p_cback);
+}
+void bta_dm_ble_passkey_reply(const RawAddress& bd_addr, bool accept,
+                              uint32_t passkey) {
+  mock_function_count_map[__func__]++;
+  test::mock::bta_dm_act::bta_dm_ble_passkey_reply(bd_addr, accept, passkey);
+}
+void bta_dm_ble_scan(bool start, uint8_t duration_sec) {
+  mock_function_count_map[__func__]++;
+  test::mock::bta_dm_act::bta_dm_ble_scan(start, duration_sec);
+}
+void bta_dm_ble_set_conn_params(const RawAddress& bd_addr,
+                                uint16_t conn_int_min, uint16_t conn_int_max,
+                                uint16_t peripheral_latency,
+                                uint16_t supervision_tout) {
+  mock_function_count_map[__func__]++;
+  test::mock::bta_dm_act::bta_dm_ble_set_conn_params(
+      bd_addr, conn_int_min, conn_int_max, peripheral_latency,
+      supervision_tout);
+}
+void bta_dm_ble_set_data_length(const RawAddress& bd_addr) {
+  mock_function_count_map[__func__]++;
+  test::mock::bta_dm_act::bta_dm_ble_set_data_length(bd_addr);
+}
+void bta_dm_ble_update_conn_params(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__]++;
+  test::mock::bta_dm_act::bta_dm_ble_update_conn_params(
+      bd_addr, min_int, max_int, latency, timeout, min_ce_len, max_ce_len);
 }
 void bta_dm_bond(const RawAddress& bd_addr, tBLE_ADDR_TYPE addr_type,
                  tBT_TRANSPORT transport, tBT_DEVICE_TYPE device_type) {
   mock_function_count_map[__func__]++;
+  test::mock::bta_dm_act::bta_dm_bond(bd_addr, addr_type, transport,
+                                      device_type);
 }
 void bta_dm_bond_cancel(const RawAddress& bd_addr) {
   mock_function_count_map[__func__]++;
+  test::mock::bta_dm_act::bta_dm_bond_cancel(bd_addr);
+}
+bool bta_dm_check_if_only_hd_connected(const RawAddress& peer_addr) {
+  mock_function_count_map[__func__]++;
+  return test::mock::bta_dm_act::bta_dm_check_if_only_hd_connected(peer_addr);
 }
 void bta_dm_ci_rmt_oob_act(std::unique_ptr<tBTA_DM_CI_RMT_OOB> msg) {
   mock_function_count_map[__func__]++;
+  test::mock::bta_dm_act::bta_dm_ci_rmt_oob_act(std::move(msg));
 }
 void bta_dm_close_acl(const RawAddress& bd_addr, bool remove_dev,
                       tBT_TRANSPORT transport) {
   mock_function_count_map[__func__]++;
+  test::mock::bta_dm_act::bta_dm_close_acl(bd_addr, remove_dev, transport);
+}
+void bta_dm_close_gatt_conn(tBTA_DM_MSG* p_data) {
+  mock_function_count_map[__func__]++;
+  test::mock::bta_dm_act::bta_dm_close_gatt_conn(p_data);
 }
 void bta_dm_confirm(const RawAddress& bd_addr, bool accept) {
   mock_function_count_map[__func__]++;
+  test::mock::bta_dm_act::bta_dm_confirm(bd_addr, accept);
 }
-void bta_dm_deinit_cb(void) { mock_function_count_map[__func__]++; }
-void bta_dm_disable() { mock_function_count_map[__func__]++; }
+void bta_dm_deinit_cb(void) {
+  mock_function_count_map[__func__]++;
+  test::mock::bta_dm_act::bta_dm_deinit_cb();
+}
+void bta_dm_disable() {
+  mock_function_count_map[__func__]++;
+  test::mock::bta_dm_act::bta_dm_disable();
+}
 void bta_dm_disc_result(tBTA_DM_MSG* p_data) {
   mock_function_count_map[__func__]++;
+  test::mock::bta_dm_act::bta_dm_disc_result(p_data);
 }
 void bta_dm_disc_rmt_name(tBTA_DM_MSG* p_data) {
   mock_function_count_map[__func__]++;
+  test::mock::bta_dm_act::bta_dm_disc_rmt_name(p_data);
 }
 void bta_dm_discover(tBTA_DM_MSG* p_data) {
   mock_function_count_map[__func__]++;
+  test::mock::bta_dm_act::bta_dm_discover(p_data);
 }
-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_eir_update_cust_uuid(const tBTA_CUSTOM_UUID& curr, bool adding) {
+  mock_function_count_map[__func__]++;
+  test::mock::bta_dm_act::bta_dm_eir_update_cust_uuid(curr, adding);
+}
+void bta_dm_eir_update_uuid(uint16_t uuid16, bool adding) {
+  mock_function_count_map[__func__]++;
+  test::mock::bta_dm_act::bta_dm_eir_update_uuid(uuid16, adding);
+}
+void bta_dm_enable(tBTA_DM_SEC_CBACK* p_sec_cback) {
+  mock_function_count_map[__func__]++;
+  test::mock::bta_dm_act::bta_dm_enable(p_sec_cback);
+}
+void bta_dm_encrypt_cback(const RawAddress* bd_addr, tBT_TRANSPORT transport,
+                          void* p_ref_data, tBTM_STATUS result) {
+  mock_function_count_map[__func__]++;
+  test::mock::bta_dm_act::bta_dm_encrypt_cback(bd_addr, transport, p_ref_data,
+                                               result);
+}
+void bta_dm_execute_queued_request() {
+  mock_function_count_map[__func__]++;
+  test::mock::bta_dm_act::bta_dm_execute_queued_request();
+}
+void bta_dm_free_sdp_db() {
+  mock_function_count_map[__func__]++;
+  test::mock::bta_dm_act::bta_dm_free_sdp_db();
+}
+void bta_dm_init_cb(void) {
+  mock_function_count_map[__func__]++;
+  test::mock::bta_dm_act::bta_dm_init_cb();
+}
+void bta_dm_inq_cmpl(uint8_t num) {
+  mock_function_count_map[__func__]++;
+  test::mock::bta_dm_act::bta_dm_inq_cmpl(num);
+}
+bool bta_dm_is_search_request_queued() {
+  mock_function_count_map[__func__]++;
+  return test::mock::bta_dm_act::bta_dm_is_search_request_queued();
+}
 void bta_dm_pin_reply(std::unique_ptr<tBTA_DM_API_PIN_REPLY> msg) {
   mock_function_count_map[__func__]++;
+  test::mock::bta_dm_act::bta_dm_pin_reply(std::move(msg));
+}
+void bta_dm_proc_open_evt(tBTA_GATTC_OPEN* p_data) {
+  mock_function_count_map[__func__]++;
+  test::mock::bta_dm_act::bta_dm_proc_open_evt(p_data);
 }
 void bta_dm_process_remove_device(const RawAddress& bd_addr) {
   mock_function_count_map[__func__]++;
+  test::mock::bta_dm_act::bta_dm_process_remove_device(bd_addr);
 }
 void bta_dm_queue_disc(tBTA_DM_MSG* p_data) {
   mock_function_count_map[__func__]++;
+  test::mock::bta_dm_act::bta_dm_queue_disc(p_data);
 }
 void bta_dm_queue_search(tBTA_DM_MSG* p_data) {
   mock_function_count_map[__func__]++;
+  test::mock::bta_dm_act::bta_dm_queue_search(p_data);
 }
 void bta_dm_remove_device(const RawAddress& bd_addr) {
   mock_function_count_map[__func__]++;
+  test::mock::bta_dm_act::bta_dm_remove_device(bd_addr);
 }
 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__]++;
+  test::mock::bta_dm_act::bta_dm_rm_cback(status, id, app_id, peer_addr);
 }
 void bta_dm_rmt_name(tBTA_DM_MSG* p_data) {
   mock_function_count_map[__func__]++;
+  test::mock::bta_dm_act::bta_dm_rmt_name(p_data);
 }
 void bta_dm_sdp_result(tBTA_DM_MSG* p_data) {
   mock_function_count_map[__func__]++;
+  test::mock::bta_dm_act::bta_dm_sdp_result(p_data);
 }
-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_execute_queued_request() { mock_function_count_map[__func__]++; }
-bool bta_dm_is_search_request_queued() {
+void bta_dm_search_cancel() {
   mock_function_count_map[__func__]++;
-  return false;
+  test::mock::bta_dm_act::bta_dm_search_cancel();
 }
-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_cancel_cmpl() {
+  mock_function_count_map[__func__]++;
+  test::mock::bta_dm_act::bta_dm_search_cancel_cmpl();
+}
+void bta_dm_search_cancel_notify() {
+  mock_function_count_map[__func__]++;
+  test::mock::bta_dm_act::bta_dm_search_cancel_notify();
+}
+void bta_dm_search_clear_queue() {
+  mock_function_count_map[__func__]++;
+  test::mock::bta_dm_act::bta_dm_search_clear_queue();
+}
+void bta_dm_search_cmpl() {
+  mock_function_count_map[__func__]++;
+  test::mock::bta_dm_act::bta_dm_search_cmpl();
+}
 void bta_dm_search_result(tBTA_DM_MSG* p_data) {
   mock_function_count_map[__func__]++;
+  test::mock::bta_dm_act::bta_dm_search_result(p_data);
 }
 void bta_dm_search_start(tBTA_DM_MSG* p_data) {
   mock_function_count_map[__func__]++;
+  test::mock::bta_dm_act::bta_dm_search_start(p_data);
 }
 void bta_dm_set_dev_name(const std::vector<uint8_t>& name) {
   mock_function_count_map[__func__]++;
+  test::mock::bta_dm_act::bta_dm_set_dev_name(name);
 }
-bool BTA_DmSetVisibility(bt_scan_mode_t mode) {
+void bta_dm_set_encryption(const RawAddress& bd_addr, tBT_TRANSPORT transport,
+                           tBTA_DM_ENCRYPT_CBACK* p_callback,
+                           tBTM_BLE_SEC_ACT sec_act) {
   mock_function_count_map[__func__]++;
-  return false;
+  test::mock::bta_dm_act::bta_dm_set_encryption(bd_addr, transport, p_callback,
+                                                sec_act);
+}
+void btm_dm_start_gatt_discovery(const RawAddress& bd_addr) {
+  mock_function_count_map[__func__]++;
+  test::mock::bta_dm_act::btm_dm_start_gatt_discovery(bd_addr);
 }
 void handle_remote_features_complete(const RawAddress& bd_addr) {
   mock_function_count_map[__func__]++;
+  test::mock::bta_dm_act::handle_remote_features_complete(bd_addr);
 }
-bool bta_dm_check_if_only_hd_connected(const RawAddress& peer_addr) {
-  mock_function_count_map[__func__]++;
-  return false;
-}
+
+// END mockcify generation
diff --git a/test/mock/mock_bta_dm_act.h b/test/mock/mock_bta_dm_act.h
new file mode 100644
index 0000000..95716b6
--- /dev/null
+++ b/test/mock/mock_bta_dm_act.h
@@ -0,0 +1,764 @@
+/*
+ * 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:62
+ *
+ *  mockcify.pl ver 0.3.0
+ */
+
+#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 from (or add to ) the inclusion set.
+#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 "gap_api.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/fixed_queue.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"
+
+// Mocked compile conditionals, if any
+
+namespace test {
+namespace mock {
+namespace bta_dm_act {
+
+// Shared state between mocked functions and tests
+// Name: BTA_DmSetVisibility
+// Params: bt_scan_mode_t mode
+// Return: bool
+struct BTA_DmSetVisibility {
+  bool return_value{false};
+  std::function<bool(bt_scan_mode_t mode)> body{
+      [this](bt_scan_mode_t mode) { return return_value; }};
+  bool operator()(bt_scan_mode_t mode) { return body(mode); };
+};
+extern struct BTA_DmSetVisibility BTA_DmSetVisibility;
+
+// Name: BTA_dm_acl_down
+// Params: const RawAddress bd_addr, tBT_TRANSPORT transport
+// Return: void
+struct BTA_dm_acl_down {
+  std::function<void(const RawAddress bd_addr, tBT_TRANSPORT transport)> body{
+      [](const RawAddress bd_addr, tBT_TRANSPORT transport) {}};
+  void operator()(const RawAddress bd_addr, tBT_TRANSPORT transport) {
+    body(bd_addr, transport);
+  };
+};
+extern struct BTA_dm_acl_down BTA_dm_acl_down;
+
+// Name: BTA_dm_acl_up
+// Params: const RawAddress bd_addr, tBT_TRANSPORT transport
+// Return: void
+struct BTA_dm_acl_up {
+  std::function<void(const RawAddress bd_addr, tBT_TRANSPORT transport)> body{
+      [](const RawAddress bd_addr, tBT_TRANSPORT transport) {}};
+  void operator()(const RawAddress bd_addr, tBT_TRANSPORT transport) {
+    body(bd_addr, transport);
+  };
+};
+extern struct BTA_dm_acl_up BTA_dm_acl_up;
+
+// Name: BTA_dm_notify_remote_features_complete
+// Params: const RawAddress bd_addr
+// Return: void
+struct BTA_dm_notify_remote_features_complete {
+  std::function<void(const RawAddress bd_addr)> body{
+      [](const RawAddress bd_addr) {}};
+  void operator()(const RawAddress bd_addr) { body(bd_addr); };
+};
+extern struct BTA_dm_notify_remote_features_complete
+    BTA_dm_notify_remote_features_complete;
+
+// Name: BTA_dm_on_hw_off
+// Params:
+// Return: void
+struct BTA_dm_on_hw_off {
+  std::function<void()> body{[]() {}};
+  void operator()() { body(); };
+};
+extern struct BTA_dm_on_hw_off BTA_dm_on_hw_off;
+
+// Name: BTA_dm_on_hw_on
+// Params:
+// Return: void
+struct BTA_dm_on_hw_on {
+  std::function<void()> body{[]() {}};
+  void operator()() { body(); };
+};
+extern struct BTA_dm_on_hw_on BTA_dm_on_hw_on;
+
+// Name: BTA_dm_report_role_change
+// Params: const RawAddress bd_addr, tHCI_ROLE new_role, tHCI_STATUS hci_status
+// Return: void
+struct BTA_dm_report_role_change {
+  std::function<void(const RawAddress bd_addr, tHCI_ROLE new_role,
+                     tHCI_STATUS hci_status)>
+      body{[](const RawAddress bd_addr, tHCI_ROLE new_role,
+              tHCI_STATUS hci_status) {}};
+  void operator()(const RawAddress bd_addr, tHCI_ROLE new_role,
+                  tHCI_STATUS hci_status) {
+    body(bd_addr, new_role, hci_status);
+  };
+};
+extern struct BTA_dm_report_role_change BTA_dm_report_role_change;
+
+// Name: bta_dm_acl_up
+// Params: const RawAddress& bd_addr, tBT_TRANSPORT transport
+// Return: void
+struct bta_dm_acl_up {
+  std::function<void(const RawAddress& bd_addr, tBT_TRANSPORT transport)> body{
+      [](const RawAddress& bd_addr, tBT_TRANSPORT transport) {}};
+  void operator()(const RawAddress& bd_addr, tBT_TRANSPORT transport) {
+    body(bd_addr, transport);
+  };
+};
+extern struct bta_dm_acl_up bta_dm_acl_up;
+
+// Name: bta_dm_add_ble_device
+// Params: const RawAddress& bd_addr, tBLE_ADDR_TYPE addr_type, tBT_DEVICE_TYPE
+// dev_type Return: void
+struct bta_dm_add_ble_device {
+  std::function<void(const RawAddress& bd_addr, tBLE_ADDR_TYPE addr_type,
+                     tBT_DEVICE_TYPE dev_type)>
+      body{[](const RawAddress& bd_addr, tBLE_ADDR_TYPE addr_type,
+              tBT_DEVICE_TYPE dev_type) {}};
+  void operator()(const RawAddress& bd_addr, tBLE_ADDR_TYPE addr_type,
+                  tBT_DEVICE_TYPE dev_type) {
+    body(bd_addr, addr_type, dev_type);
+  };
+};
+extern struct bta_dm_add_ble_device bta_dm_add_ble_device;
+
+// Name: bta_dm_add_blekey
+// Params: const RawAddress& bd_addr, tBTA_LE_KEY_VALUE blekey, tBTM_LE_KEY_TYPE
+// key_type Return: void
+struct bta_dm_add_blekey {
+  std::function<void(const RawAddress& bd_addr, tBTA_LE_KEY_VALUE blekey,
+                     tBTM_LE_KEY_TYPE key_type)>
+      body{[](const RawAddress& bd_addr, tBTA_LE_KEY_VALUE blekey,
+              tBTM_LE_KEY_TYPE key_type) {}};
+  void operator()(const RawAddress& bd_addr, tBTA_LE_KEY_VALUE blekey,
+                  tBTM_LE_KEY_TYPE key_type) {
+    body(bd_addr, blekey, key_type);
+  };
+};
+extern struct bta_dm_add_blekey bta_dm_add_blekey;
+
+// Name: bta_dm_add_device
+// Params: std::unique_ptr<tBTA_DM_API_ADD_DEVICE> msg
+// Return: void
+struct bta_dm_add_device {
+  std::function<void(std::unique_ptr<tBTA_DM_API_ADD_DEVICE> msg)> body{
+      [](std::unique_ptr<tBTA_DM_API_ADD_DEVICE> msg) {}};
+  void operator()(std::unique_ptr<tBTA_DM_API_ADD_DEVICE> msg) {
+    body(std::move(msg));
+  };
+};
+extern struct bta_dm_add_device bta_dm_add_device;
+
+// Name: bta_dm_ble_config_local_privacy
+// Params: bool privacy_enable
+// Return: void
+struct bta_dm_ble_config_local_privacy {
+  std::function<void(bool privacy_enable)> body{[](bool privacy_enable) {}};
+  void operator()(bool privacy_enable) { body(privacy_enable); };
+};
+extern struct bta_dm_ble_config_local_privacy bta_dm_ble_config_local_privacy;
+
+// Name: bta_dm_ble_confirm_reply
+// Params: const RawAddress& bd_addr, bool accept
+// Return: void
+struct bta_dm_ble_confirm_reply {
+  std::function<void(const RawAddress& bd_addr, bool accept)> body{
+      [](const RawAddress& bd_addr, bool accept) {}};
+  void operator()(const RawAddress& bd_addr, bool accept) {
+    body(bd_addr, accept);
+  };
+};
+extern struct bta_dm_ble_confirm_reply bta_dm_ble_confirm_reply;
+
+// Name: bta_dm_ble_csis_observe
+// Params: bool observe, tBTA_DM_SEARCH_CBACK* p_cback
+// Return: void
+struct bta_dm_ble_csis_observe {
+  std::function<void(bool observe, tBTA_DM_SEARCH_CBACK* p_cback)> body{
+      [](bool observe, tBTA_DM_SEARCH_CBACK* p_cback) {}};
+  void operator()(bool observe, tBTA_DM_SEARCH_CBACK* p_cback) {
+    body(observe, p_cback);
+  };
+};
+extern struct bta_dm_ble_csis_observe bta_dm_ble_csis_observe;
+
+// Name: bta_dm_ble_get_energy_info
+// Params: tBTA_BLE_ENERGY_INFO_CBACK* p_energy_info_cback
+// Return: void
+struct bta_dm_ble_get_energy_info {
+  std::function<void(tBTA_BLE_ENERGY_INFO_CBACK* p_energy_info_cback)> body{
+      [](tBTA_BLE_ENERGY_INFO_CBACK* p_energy_info_cback) {}};
+  void operator()(tBTA_BLE_ENERGY_INFO_CBACK* p_energy_info_cback) {
+    body(p_energy_info_cback);
+  };
+};
+extern struct bta_dm_ble_get_energy_info bta_dm_ble_get_energy_info;
+
+// Name: bta_dm_ble_observe
+// Params: bool start, uint8_t duration, tBTA_DM_SEARCH_CBACK* p_cback
+// Return: void
+struct bta_dm_ble_observe {
+  std::function<void(bool start, uint8_t duration,
+                     tBTA_DM_SEARCH_CBACK* p_cback)>
+      body{[](bool start, uint8_t duration, tBTA_DM_SEARCH_CBACK* p_cback) {}};
+  void operator()(bool start, uint8_t duration, tBTA_DM_SEARCH_CBACK* p_cback) {
+    body(start, duration, p_cback);
+  };
+};
+extern struct bta_dm_ble_observe bta_dm_ble_observe;
+
+// Name: bta_dm_ble_passkey_reply
+// Params: const RawAddress& bd_addr, bool accept, uint32_t passkey
+// Return: void
+struct bta_dm_ble_passkey_reply {
+  std::function<void(const RawAddress& bd_addr, bool accept, uint32_t passkey)>
+      body{[](const RawAddress& bd_addr, bool accept, uint32_t passkey) {}};
+  void operator()(const RawAddress& bd_addr, bool accept, uint32_t passkey) {
+    body(bd_addr, accept, passkey);
+  };
+};
+extern struct bta_dm_ble_passkey_reply bta_dm_ble_passkey_reply;
+
+// Name: bta_dm_ble_scan
+// Params: bool start, uint8_t duration_sec
+// Return: void
+struct bta_dm_ble_scan {
+  std::function<void(bool start, uint8_t duration_sec)> body{
+      [](bool start, uint8_t duration_sec) {}};
+  void operator()(bool start, uint8_t duration_sec) {
+    body(start, duration_sec);
+  };
+};
+extern struct bta_dm_ble_scan bta_dm_ble_scan;
+
+// Name: bta_dm_ble_set_conn_params
+// Params: const RawAddress& bd_addr, uint16_t conn_int_min, uint16_t
+// conn_int_max, uint16_t peripheral_latency, uint16_t supervision_tout Return:
+// void
+struct bta_dm_ble_set_conn_params {
+  std::function<void(const RawAddress& bd_addr, uint16_t conn_int_min,
+                     uint16_t conn_int_max, uint16_t peripheral_latency,
+                     uint16_t supervision_tout)>
+      body{[](const RawAddress& bd_addr, uint16_t conn_int_min,
+              uint16_t conn_int_max, uint16_t peripheral_latency,
+              uint16_t supervision_tout) {}};
+  void operator()(const RawAddress& bd_addr, uint16_t conn_int_min,
+                  uint16_t conn_int_max, uint16_t peripheral_latency,
+                  uint16_t supervision_tout) {
+    body(bd_addr, conn_int_min, conn_int_max, peripheral_latency,
+         supervision_tout);
+  };
+};
+extern struct bta_dm_ble_set_conn_params bta_dm_ble_set_conn_params;
+
+// Name: bta_dm_ble_set_data_length
+// Params: const RawAddress& bd_addr
+// Return: void
+struct bta_dm_ble_set_data_length {
+  std::function<void(const RawAddress& bd_addr)> body{
+      [](const RawAddress& bd_addr) {}};
+  void operator()(const RawAddress& bd_addr) { body(bd_addr); };
+};
+extern struct bta_dm_ble_set_data_length bta_dm_ble_set_data_length;
+
+// Name: bta_dm_ble_update_conn_params
+// Params: 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
+// Return: void
+struct bta_dm_ble_update_conn_params {
+  std::function<void(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)>
+      body{[](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) {}};
+  void operator()(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) {
+    body(bd_addr, min_int, max_int, latency, timeout, min_ce_len, max_ce_len);
+  };
+};
+extern struct bta_dm_ble_update_conn_params bta_dm_ble_update_conn_params;
+
+// Name: bta_dm_bond
+// Params: const RawAddress& bd_addr, tBLE_ADDR_TYPE addr_type, tBT_TRANSPORT
+// transport, tBT_DEVICE_TYPE device_type Return: void
+struct bta_dm_bond {
+  std::function<void(const RawAddress& bd_addr, tBLE_ADDR_TYPE addr_type,
+                     tBT_TRANSPORT transport, tBT_DEVICE_TYPE device_type)>
+      body{[](const RawAddress& bd_addr, tBLE_ADDR_TYPE addr_type,
+              tBT_TRANSPORT transport, tBT_DEVICE_TYPE device_type) {}};
+  void operator()(const RawAddress& bd_addr, tBLE_ADDR_TYPE addr_type,
+                  tBT_TRANSPORT transport, tBT_DEVICE_TYPE device_type) {
+    body(bd_addr, addr_type, transport, device_type);
+  };
+};
+extern struct bta_dm_bond bta_dm_bond;
+
+// Name: bta_dm_bond_cancel
+// Params: const RawAddress& bd_addr
+// Return: void
+struct bta_dm_bond_cancel {
+  std::function<void(const RawAddress& bd_addr)> body{
+      [](const RawAddress& bd_addr) {}};
+  void operator()(const RawAddress& bd_addr) { body(bd_addr); };
+};
+extern struct bta_dm_bond_cancel bta_dm_bond_cancel;
+
+// Name: bta_dm_check_if_only_hd_connected
+// Params: const RawAddress& peer_addr
+// Return: bool
+struct bta_dm_check_if_only_hd_connected {
+  bool return_value{false};
+  std::function<bool(const RawAddress& peer_addr)> body{
+      [this](const RawAddress& peer_addr) { return return_value; }};
+  bool operator()(const RawAddress& peer_addr) { return body(peer_addr); };
+};
+extern struct bta_dm_check_if_only_hd_connected
+    bta_dm_check_if_only_hd_connected;
+
+// Name: bta_dm_ci_rmt_oob_act
+// Params: std::unique_ptr<tBTA_DM_CI_RMT_OOB> msg
+// Return: void
+struct bta_dm_ci_rmt_oob_act {
+  std::function<void(std::unique_ptr<tBTA_DM_CI_RMT_OOB> msg)> body{
+      [](std::unique_ptr<tBTA_DM_CI_RMT_OOB> msg) {}};
+  void operator()(std::unique_ptr<tBTA_DM_CI_RMT_OOB> msg) {
+    body(std::move(msg));
+  };
+};
+extern struct bta_dm_ci_rmt_oob_act bta_dm_ci_rmt_oob_act;
+
+// Name: bta_dm_close_acl
+// Params: const RawAddress& bd_addr, bool remove_dev, tBT_TRANSPORT transport
+// Return: void
+struct bta_dm_close_acl {
+  std::function<void(const RawAddress& bd_addr, bool remove_dev,
+                     tBT_TRANSPORT transport)>
+      body{[](const RawAddress& bd_addr, bool remove_dev,
+              tBT_TRANSPORT transport) {}};
+  void operator()(const RawAddress& bd_addr, bool remove_dev,
+                  tBT_TRANSPORT transport) {
+    body(bd_addr, remove_dev, transport);
+  };
+};
+extern struct bta_dm_close_acl bta_dm_close_acl;
+
+// Name: bta_dm_close_gatt_conn
+// Params:  tBTA_DM_MSG* p_data
+// Return: void
+struct bta_dm_close_gatt_conn {
+  std::function<void(tBTA_DM_MSG* p_data)> body{[](tBTA_DM_MSG* p_data) {}};
+  void operator()(tBTA_DM_MSG* p_data) { body(p_data); };
+};
+extern struct bta_dm_close_gatt_conn bta_dm_close_gatt_conn;
+
+// Name: bta_dm_confirm
+// Params: const RawAddress& bd_addr, bool accept
+// Return: void
+struct bta_dm_confirm {
+  std::function<void(const RawAddress& bd_addr, bool accept)> body{
+      [](const RawAddress& bd_addr, bool accept) {}};
+  void operator()(const RawAddress& bd_addr, bool accept) {
+    body(bd_addr, accept);
+  };
+};
+extern struct bta_dm_confirm bta_dm_confirm;
+
+// Name: bta_dm_deinit_cb
+// Params: void
+// Return: void
+struct bta_dm_deinit_cb {
+  std::function<void(void)> body{[](void) {}};
+  void operator()(void) { body(); };
+};
+extern struct bta_dm_deinit_cb bta_dm_deinit_cb;
+
+// Name: bta_dm_disable
+// Params:
+// Return: void
+struct bta_dm_disable {
+  std::function<void()> body{[]() {}};
+  void operator()() { body(); };
+};
+extern struct bta_dm_disable bta_dm_disable;
+
+// Name: bta_dm_disc_result
+// Params: tBTA_DM_MSG* p_data
+// Return: void
+struct bta_dm_disc_result {
+  std::function<void(tBTA_DM_MSG* p_data)> body{[](tBTA_DM_MSG* p_data) {}};
+  void operator()(tBTA_DM_MSG* p_data) { body(p_data); };
+};
+extern struct bta_dm_disc_result bta_dm_disc_result;
+
+// Name: bta_dm_disc_rmt_name
+// Params: tBTA_DM_MSG* p_data
+// Return: void
+struct bta_dm_disc_rmt_name {
+  std::function<void(tBTA_DM_MSG* p_data)> body{[](tBTA_DM_MSG* p_data) {}};
+  void operator()(tBTA_DM_MSG* p_data) { body(p_data); };
+};
+extern struct bta_dm_disc_rmt_name bta_dm_disc_rmt_name;
+
+// Name: bta_dm_discover
+// Params: tBTA_DM_MSG* p_data
+// Return: void
+struct bta_dm_discover {
+  std::function<void(tBTA_DM_MSG* p_data)> body{[](tBTA_DM_MSG* p_data) {}};
+  void operator()(tBTA_DM_MSG* p_data) { body(p_data); };
+};
+extern struct bta_dm_discover bta_dm_discover;
+
+// Name: bta_dm_eir_update_cust_uuid
+// Params: const tBTA_CUSTOM_UUID& curr, bool adding
+// Return: void
+struct bta_dm_eir_update_cust_uuid {
+  std::function<void(const tBTA_CUSTOM_UUID& curr, bool adding)> body{
+      [](const tBTA_CUSTOM_UUID& curr, bool adding) {}};
+  void operator()(const tBTA_CUSTOM_UUID& curr, bool adding) {
+    body(curr, adding);
+  };
+};
+extern struct bta_dm_eir_update_cust_uuid bta_dm_eir_update_cust_uuid;
+
+// Name: bta_dm_eir_update_uuid
+// Params: uint16_t uuid16, bool adding
+// Return: void
+struct bta_dm_eir_update_uuid {
+  std::function<void(uint16_t uuid16, bool adding)> body{
+      [](uint16_t uuid16, bool adding) {}};
+  void operator()(uint16_t uuid16, bool adding) { body(uuid16, adding); };
+};
+extern struct bta_dm_eir_update_uuid bta_dm_eir_update_uuid;
+
+// Name: bta_dm_enable
+// Params: tBTA_DM_SEC_CBACK* p_sec_cback
+// Return: void
+struct bta_dm_enable {
+  std::function<void(tBTA_DM_SEC_CBACK* p_sec_cback)> body{
+      [](tBTA_DM_SEC_CBACK* p_sec_cback) {}};
+  void operator()(tBTA_DM_SEC_CBACK* p_sec_cback) { body(p_sec_cback); };
+};
+extern struct bta_dm_enable bta_dm_enable;
+
+// Name: bta_dm_encrypt_cback
+// Params: const RawAddress* bd_addr, tBT_TRANSPORT transport, void* p_ref_data,
+// tBTM_STATUS result Return: void
+struct bta_dm_encrypt_cback {
+  std::function<void(const RawAddress* bd_addr, tBT_TRANSPORT transport,
+                     void* p_ref_data, tBTM_STATUS result)>
+      body{[](const RawAddress* bd_addr, tBT_TRANSPORT transport,
+              void* p_ref_data, tBTM_STATUS result) {}};
+  void operator()(const RawAddress* bd_addr, tBT_TRANSPORT transport,
+                  void* p_ref_data, tBTM_STATUS result) {
+    body(bd_addr, transport, p_ref_data, result);
+  };
+};
+extern struct bta_dm_encrypt_cback bta_dm_encrypt_cback;
+
+// Name: bta_dm_execute_queued_request
+// Params:
+// Return: void
+struct bta_dm_execute_queued_request {
+  std::function<void()> body{[]() {}};
+  void operator()() { body(); };
+};
+extern struct bta_dm_execute_queued_request bta_dm_execute_queued_request;
+
+// Name: bta_dm_free_sdp_db
+// Params:
+// Return: void
+struct bta_dm_free_sdp_db {
+  std::function<void()> body{[]() {}};
+  void operator()() { body(); };
+};
+extern struct bta_dm_free_sdp_db bta_dm_free_sdp_db;
+
+// Name: bta_dm_init_cb
+// Params: void
+// Return: void
+struct bta_dm_init_cb {
+  std::function<void(void)> body{[](void) {}};
+  void operator()(void) { body(); };
+};
+extern struct bta_dm_init_cb bta_dm_init_cb;
+
+// Name: bta_dm_inq_cmpl
+// Params: uint8_t num
+// Return: void
+struct bta_dm_inq_cmpl {
+  std::function<void(uint8_t num)> body{[](uint8_t num) {}};
+  void operator()(uint8_t num) { body(num); };
+};
+extern struct bta_dm_inq_cmpl bta_dm_inq_cmpl;
+
+// Name: bta_dm_is_search_request_queued
+// Params:
+// Return: bool
+struct bta_dm_is_search_request_queued {
+  bool return_value{false};
+  std::function<bool()> body{[this]() { return return_value; }};
+  bool operator()() { return body(); };
+};
+extern struct bta_dm_is_search_request_queued bta_dm_is_search_request_queued;
+
+// Name: bta_dm_pin_reply
+// Params: std::unique_ptr<tBTA_DM_API_PIN_REPLY> msg
+// Return: void
+struct bta_dm_pin_reply {
+  std::function<void(std::unique_ptr<tBTA_DM_API_PIN_REPLY> msg)> body{
+      [](std::unique_ptr<tBTA_DM_API_PIN_REPLY> msg) {}};
+  void operator()(std::unique_ptr<tBTA_DM_API_PIN_REPLY> msg) {
+    body(std::move(msg));
+  };
+};
+extern struct bta_dm_pin_reply bta_dm_pin_reply;
+
+// Name: bta_dm_proc_open_evt
+// Params: tBTA_GATTC_OPEN* p_data
+// Return: void
+struct bta_dm_proc_open_evt {
+  std::function<void(tBTA_GATTC_OPEN* p_data)> body{
+      [](tBTA_GATTC_OPEN* p_data) {}};
+  void operator()(tBTA_GATTC_OPEN* p_data) { body(p_data); };
+};
+extern struct bta_dm_proc_open_evt bta_dm_proc_open_evt;
+
+// Name: bta_dm_process_remove_device
+// Params: const RawAddress& bd_addr
+// Return: void
+struct bta_dm_process_remove_device {
+  std::function<void(const RawAddress& bd_addr)> body{
+      [](const RawAddress& bd_addr) {}};
+  void operator()(const RawAddress& bd_addr) { body(bd_addr); };
+};
+extern struct bta_dm_process_remove_device bta_dm_process_remove_device;
+
+// Name: bta_dm_queue_disc
+// Params: tBTA_DM_MSG* p_data
+// Return: void
+struct bta_dm_queue_disc {
+  std::function<void(tBTA_DM_MSG* p_data)> body{[](tBTA_DM_MSG* p_data) {}};
+  void operator()(tBTA_DM_MSG* p_data) { body(p_data); };
+};
+extern struct bta_dm_queue_disc bta_dm_queue_disc;
+
+// Name: bta_dm_queue_search
+// Params: tBTA_DM_MSG* p_data
+// Return: void
+struct bta_dm_queue_search {
+  std::function<void(tBTA_DM_MSG* p_data)> body{[](tBTA_DM_MSG* p_data) {}};
+  void operator()(tBTA_DM_MSG* p_data) { body(p_data); };
+};
+extern struct bta_dm_queue_search bta_dm_queue_search;
+
+// Name: bta_dm_remove_device
+// Params: const RawAddress& bd_addr
+// Return: void
+struct bta_dm_remove_device {
+  std::function<void(const RawAddress& bd_addr)> body{
+      [](const RawAddress& bd_addr) {}};
+  void operator()(const RawAddress& bd_addr) { body(bd_addr); };
+};
+extern struct bta_dm_remove_device bta_dm_remove_device;
+
+// Name: bta_dm_rm_cback
+// Params: tBTA_SYS_CONN_STATUS status, uint8_t id, uint8_t app_id, const
+// RawAddress& peer_addr Return: void
+struct bta_dm_rm_cback {
+  std::function<void(tBTA_SYS_CONN_STATUS status, uint8_t id, uint8_t app_id,
+                     const RawAddress& peer_addr)>
+      body{[](tBTA_SYS_CONN_STATUS status, uint8_t id, uint8_t app_id,
+              const RawAddress& peer_addr) {}};
+  void operator()(tBTA_SYS_CONN_STATUS status, uint8_t id, uint8_t app_id,
+                  const RawAddress& peer_addr) {
+    body(status, id, app_id, peer_addr);
+  };
+};
+extern struct bta_dm_rm_cback bta_dm_rm_cback;
+
+// Name: bta_dm_rmt_name
+// Params: tBTA_DM_MSG* p_data
+// Return: void
+struct bta_dm_rmt_name {
+  std::function<void(tBTA_DM_MSG* p_data)> body{[](tBTA_DM_MSG* p_data) {}};
+  void operator()(tBTA_DM_MSG* p_data) { body(p_data); };
+};
+extern struct bta_dm_rmt_name bta_dm_rmt_name;
+
+// Name: bta_dm_sdp_result
+// Params: tBTA_DM_MSG* p_data
+// Return: void
+struct bta_dm_sdp_result {
+  std::function<void(tBTA_DM_MSG* p_data)> body{[](tBTA_DM_MSG* p_data) {}};
+  void operator()(tBTA_DM_MSG* p_data) { body(p_data); };
+};
+extern struct bta_dm_sdp_result bta_dm_sdp_result;
+
+// Name: bta_dm_search_cancel
+// Params:
+// Return: void
+struct bta_dm_search_cancel {
+  std::function<void()> body{[]() {}};
+  void operator()() { body(); };
+};
+extern struct bta_dm_search_cancel bta_dm_search_cancel;
+
+// Name: bta_dm_search_cancel_cmpl
+// Params:
+// Return: void
+struct bta_dm_search_cancel_cmpl {
+  std::function<void()> body{[]() {}};
+  void operator()() { body(); };
+};
+extern struct bta_dm_search_cancel_cmpl bta_dm_search_cancel_cmpl;
+
+// Name: bta_dm_search_cancel_notify
+// Params:
+// Return: void
+struct bta_dm_search_cancel_notify {
+  std::function<void()> body{[]() {}};
+  void operator()() { body(); };
+};
+extern struct bta_dm_search_cancel_notify bta_dm_search_cancel_notify;
+
+// Name: bta_dm_search_clear_queue
+// Params:
+// Return: void
+struct bta_dm_search_clear_queue {
+  std::function<void()> body{[]() {}};
+  void operator()() { body(); };
+};
+extern struct bta_dm_search_clear_queue bta_dm_search_clear_queue;
+
+// Name: bta_dm_search_cmpl
+// Params:
+// Return: void
+struct bta_dm_search_cmpl {
+  std::function<void()> body{[]() {}};
+  void operator()() { body(); };
+};
+extern struct bta_dm_search_cmpl bta_dm_search_cmpl;
+
+// Name: bta_dm_search_result
+// Params: tBTA_DM_MSG* p_data
+// Return: void
+struct bta_dm_search_result {
+  std::function<void(tBTA_DM_MSG* p_data)> body{[](tBTA_DM_MSG* p_data) {}};
+  void operator()(tBTA_DM_MSG* p_data) { body(p_data); };
+};
+extern struct bta_dm_search_result bta_dm_search_result;
+
+// Name: bta_dm_search_start
+// Params: tBTA_DM_MSG* p_data
+// Return: void
+struct bta_dm_search_start {
+  std::function<void(tBTA_DM_MSG* p_data)> body{[](tBTA_DM_MSG* p_data) {}};
+  void operator()(tBTA_DM_MSG* p_data) { body(p_data); };
+};
+extern struct bta_dm_search_start bta_dm_search_start;
+
+// Name: bta_dm_set_dev_name
+// Params: const std::vector<uint8_t>& name
+// Return: void
+struct bta_dm_set_dev_name {
+  std::function<void(const std::vector<uint8_t>& name)> body{
+      [](const std::vector<uint8_t>& name) {}};
+  void operator()(const std::vector<uint8_t>& name) { body(name); };
+};
+extern struct bta_dm_set_dev_name bta_dm_set_dev_name;
+
+// Name: bta_dm_set_encryption
+// Params: const RawAddress& bd_addr, tBT_TRANSPORT transport,
+// tBTA_DM_ENCRYPT_CBACK* p_callback, tBTM_BLE_SEC_ACT sec_act Return: void
+struct bta_dm_set_encryption {
+  std::function<void(const RawAddress& bd_addr, tBT_TRANSPORT transport,
+                     tBTA_DM_ENCRYPT_CBACK* p_callback,
+                     tBTM_BLE_SEC_ACT sec_act)>
+      body{[](const RawAddress& bd_addr, tBT_TRANSPORT transport,
+              tBTA_DM_ENCRYPT_CBACK* p_callback, tBTM_BLE_SEC_ACT sec_act) {}};
+  void operator()(const RawAddress& bd_addr, tBT_TRANSPORT transport,
+                  tBTA_DM_ENCRYPT_CBACK* p_callback, tBTM_BLE_SEC_ACT sec_act) {
+    body(bd_addr, transport, p_callback, sec_act);
+  };
+};
+extern struct bta_dm_set_encryption bta_dm_set_encryption;
+
+// Name: btm_dm_start_gatt_discovery
+// Params: const RawAddress& bd_addr
+// Return: void
+struct btm_dm_start_gatt_discovery {
+  std::function<void(const RawAddress& bd_addr)> body{
+      [](const RawAddress& bd_addr) {}};
+  void operator()(const RawAddress& bd_addr) { body(bd_addr); };
+};
+extern struct btm_dm_start_gatt_discovery btm_dm_start_gatt_discovery;
+
+// Name: handle_remote_features_complete
+// Params: const RawAddress& bd_addr
+// Return: void
+struct handle_remote_features_complete {
+  std::function<void(const RawAddress& bd_addr)> body{
+      [](const RawAddress& bd_addr) {}};
+  void operator()(const RawAddress& bd_addr) { body(bd_addr); };
+};
+extern struct handle_remote_features_complete handle_remote_features_complete;
+
+}  // namespace bta_dm_act
+}  // namespace mock
+}  // namespace test
+
+// END mockcify generation
\ No newline at end of file
diff --git a/test/mock/mock_bta_dm_api.cc b/test/mock/mock_bta_dm_api.cc
index 3a7d3ca..d7fb22e 100644
--- a/test/mock/mock_bta_dm_api.cc
+++ b/test/mock/mock_bta_dm_api.cc
@@ -16,136 +16,232 @@
 
 /*
  * Generated mock file from original source file
- *   Functions generated:33
+ *   Functions generated:34
+ *
+ *  mockcify.pl ver 0.3.0
  */
 
+#include <cstdint>
+#include <functional>
 #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"
+// Mock include file to share data between tests and mock
+#include "test/mock/mock_bta_dm_api.h"
 
-#ifndef UNUSED_ATTR
-#define UNUSED_ATTR
-#endif
+// Mocked internal structures, if any
 
-void BTA_dm_init() { mock_function_count_map[__func__]++; }
-bool BTA_DmGetConnectionState(const RawAddress& bd_addr) {
+namespace test {
+namespace mock {
+namespace bta_dm_api {
+
+// Function state capture and return values, if needed
+struct BTA_AddEirUuid BTA_AddEirUuid;
+struct BTA_DmAddBleDevice BTA_DmAddBleDevice;
+struct BTA_DmAddBleKey BTA_DmAddBleKey;
+struct BTA_DmAddDevice BTA_DmAddDevice;
+struct BTA_DmBleConfigLocalPrivacy BTA_DmBleConfigLocalPrivacy;
+struct BTA_DmBleConfirmReply BTA_DmBleConfirmReply;
+struct BTA_DmBleCsisObserve BTA_DmBleCsisObserve;
+struct BTA_DmBleGetEnergyInfo BTA_DmBleGetEnergyInfo;
+struct BTA_DmBleObserve BTA_DmBleObserve;
+struct BTA_DmBlePasskeyReply BTA_DmBlePasskeyReply;
+struct BTA_DmBleRequestMaxTxDataLength BTA_DmBleRequestMaxTxDataLength;
+struct BTA_DmBleScan BTA_DmBleScan;
+struct BTA_DmBleSecurityGrant BTA_DmBleSecurityGrant;
+struct BTA_DmBleUpdateConnectionParams BTA_DmBleUpdateConnectionParams;
+struct BTA_DmBond BTA_DmBond;
+struct BTA_DmBondCancel BTA_DmBondCancel;
+struct BTA_DmCloseACL BTA_DmCloseACL;
+struct BTA_DmConfirm BTA_DmConfirm;
+struct BTA_DmDiscover BTA_DmDiscover;
+struct BTA_DmGetConnectionState BTA_DmGetConnectionState;
+struct BTA_DmLocalOob BTA_DmLocalOob;
+struct BTA_DmPinReply BTA_DmPinReply;
+struct BTA_DmRemoveDevice BTA_DmRemoveDevice;
+struct BTA_DmSearch BTA_DmSearch;
+struct BTA_DmSearchCancel BTA_DmSearchCancel;
+struct BTA_DmSetBlePrefConnParams BTA_DmSetBlePrefConnParams;
+struct BTA_DmSetDeviceName BTA_DmSetDeviceName;
+struct BTA_DmSetEncryption BTA_DmSetEncryption;
+struct BTA_DmSetLocalDiRecord BTA_DmSetLocalDiRecord;
+struct BTA_EnableTestMode BTA_EnableTestMode;
+struct BTA_GetEirService BTA_GetEirService;
+struct BTA_RemoveEirUuid BTA_RemoveEirUuid;
+struct BTA_VendorInit BTA_VendorInit;
+struct BTA_dm_init BTA_dm_init;
+
+}  // namespace bta_dm_api
+}  // namespace mock
+}  // namespace test
+
+// Mocked functions, if any
+void BTA_AddEirUuid(uint16_t uuid16) {
   mock_function_count_map[__func__]++;
-  return false;
+  test::mock::bta_dm_api::BTA_AddEirUuid(uuid16);
 }
-tBTA_STATUS BTA_DmRemoveDevice(const RawAddress& bd_addr) {
-  mock_function_count_map[__func__]++;
-  return BTA_SUCCESS;
-}
-tBTA_STATUS BTA_DmSetLocalDiRecord(tSDP_DI_RECORD* p_device_info,
-                                   uint32_t* p_handle) {
-  mock_function_count_map[__func__]++;
-  return BTA_SUCCESS;
-}
-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__]++;
+  test::mock::bta_dm_api::BTA_DmAddBleDevice(bd_addr, addr_type, dev_type);
 }
 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__]++;
+  test::mock::bta_dm_api::BTA_DmAddBleKey(bd_addr, p_le_key, key_type);
 }
 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__]++;
+  test::mock::bta_dm_api::BTA_DmAddDevice(bd_addr, dev_class, link_key,
+                                          key_type, pin_length);
 }
 void BTA_DmBleConfigLocalPrivacy(bool privacy_enable) {
   mock_function_count_map[__func__]++;
+  test::mock::bta_dm_api::BTA_DmBleConfigLocalPrivacy(privacy_enable);
 }
 void BTA_DmBleConfirmReply(const RawAddress& bd_addr, bool accept) {
   mock_function_count_map[__func__]++;
+  test::mock::bta_dm_api::BTA_DmBleConfirmReply(bd_addr, accept);
+}
+void BTA_DmBleCsisObserve(bool observe, tBTA_DM_SEARCH_CBACK* p_results_cb) {
+  mock_function_count_map[__func__]++;
+  test::mock::bta_dm_api::BTA_DmBleCsisObserve(observe, p_results_cb);
 }
 void BTA_DmBleGetEnergyInfo(tBTA_BLE_ENERGY_INFO_CBACK* p_cmpl_cback) {
   mock_function_count_map[__func__]++;
+  test::mock::bta_dm_api::BTA_DmBleGetEnergyInfo(p_cmpl_cback);
+}
+void BTA_DmBleObserve(bool start, uint8_t duration,
+                      tBTA_DM_SEARCH_CBACK* p_results_cb) {
+  mock_function_count_map[__func__]++;
+  test::mock::bta_dm_api::BTA_DmBleObserve(start, duration, p_results_cb);
 }
 void BTA_DmBlePasskeyReply(const RawAddress& bd_addr, bool accept,
                            uint32_t passkey) {
   mock_function_count_map[__func__]++;
+  test::mock::bta_dm_api::BTA_DmBlePasskeyReply(bd_addr, accept, passkey);
 }
 void BTA_DmBleRequestMaxTxDataLength(const RawAddress& remote_device) {
   mock_function_count_map[__func__]++;
+  test::mock::bta_dm_api::BTA_DmBleRequestMaxTxDataLength(remote_device);
+}
+void BTA_DmBleScan(bool start, uint8_t duration) {
+  mock_function_count_map[__func__]++;
+  test::mock::bta_dm_api::BTA_DmBleScan(start, duration);
 }
 void BTA_DmBleSecurityGrant(const RawAddress& bd_addr,
                             tBTA_DM_BLE_SEC_GRANT res) {
   mock_function_count_map[__func__]++;
+  test::mock::bta_dm_api::BTA_DmBleSecurityGrant(bd_addr, res);
 }
 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__]++;
+  test::mock::bta_dm_api::BTA_DmBleUpdateConnectionParams(
+      bd_addr, min_int, max_int, latency, timeout, min_ce_len, max_ce_len);
 }
 void BTA_DmBond(const RawAddress& bd_addr, tBLE_ADDR_TYPE addr_type,
                 tBT_TRANSPORT transport, tBT_DEVICE_TYPE device_type) {
   mock_function_count_map[__func__]++;
+  test::mock::bta_dm_api::BTA_DmBond(bd_addr, addr_type, transport,
+                                     device_type);
 }
 void BTA_DmBondCancel(const RawAddress& bd_addr) {
   mock_function_count_map[__func__]++;
+  test::mock::bta_dm_api::BTA_DmBondCancel(bd_addr);
 }
 void BTA_DmCloseACL(const RawAddress& bd_addr, bool remove_dev,
                     tBT_TRANSPORT transport) {
   mock_function_count_map[__func__]++;
+  test::mock::bta_dm_api::BTA_DmCloseACL(bd_addr, remove_dev, transport);
 }
 void BTA_DmConfirm(const RawAddress& bd_addr, bool accept) {
   mock_function_count_map[__func__]++;
+  test::mock::bta_dm_api::BTA_DmConfirm(bd_addr, accept);
 }
 void BTA_DmDiscover(const RawAddress& bd_addr, tBTA_DM_SEARCH_CBACK* p_cback,
                     tBT_TRANSPORT transport, bool is_bonding_or_sd) {
   mock_function_count_map[__func__]++;
+  test::mock::bta_dm_api::BTA_DmDiscover(bd_addr, p_cback, transport,
+                                         is_bonding_or_sd);
 }
-void BTA_DmLocalOob(void) { mock_function_count_map[__func__]++; }
+bool BTA_DmGetConnectionState(const RawAddress& bd_addr) {
+  mock_function_count_map[__func__]++;
+  return test::mock::bta_dm_api::BTA_DmGetConnectionState(bd_addr);
+}
+void BTA_DmLocalOob(void) {
+  mock_function_count_map[__func__]++;
+  test::mock::bta_dm_api::BTA_DmLocalOob();
+}
 void BTA_DmPinReply(const RawAddress& bd_addr, bool accept, uint8_t pin_len,
                     uint8_t* p_pin) {
   mock_function_count_map[__func__]++;
+  test::mock::bta_dm_api::BTA_DmPinReply(bd_addr, accept, pin_len, p_pin);
+}
+tBTA_STATUS BTA_DmRemoveDevice(const RawAddress& bd_addr) {
+  mock_function_count_map[__func__]++;
+  return test::mock::bta_dm_api::BTA_DmRemoveDevice(bd_addr);
 }
 void BTA_DmSearch(tBTA_DM_SEARCH_CBACK* p_cback, bool is_bonding_or_sdp) {
   mock_function_count_map[__func__]++;
+  test::mock::bta_dm_api::BTA_DmSearch(p_cback, is_bonding_or_sdp);
 }
-void BTA_DmSearchCancel(void) { mock_function_count_map[__func__]++; }
+void BTA_DmSearchCancel(void) {
+  mock_function_count_map[__func__]++;
+  test::mock::bta_dm_api::BTA_DmSearchCancel();
+}
 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__]++;
+  test::mock::bta_dm_api::BTA_DmSetBlePrefConnParams(
+      bd_addr, min_conn_int, max_conn_int, peripheral_latency,
+      supervision_tout);
 }
-void BTA_DmSetDeviceName(char* p_name) { mock_function_count_map[__func__]++; }
+void BTA_DmSetDeviceName(char* p_name) {
+  mock_function_count_map[__func__]++;
+  test::mock::bta_dm_api::BTA_DmSetDeviceName(p_name);
+}
 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__]++;
+  test::mock::bta_dm_api::BTA_DmSetEncryption(bd_addr, transport, p_callback,
+                                              sec_act);
 }
-void BTA_EnableTestMode(void) { mock_function_count_map[__func__]++; }
+tBTA_STATUS BTA_DmSetLocalDiRecord(tSDP_DI_RECORD* p_device_info,
+                                   uint32_t* p_handle) {
+  mock_function_count_map[__func__]++;
+  return test::mock::bta_dm_api::BTA_DmSetLocalDiRecord(p_device_info,
+                                                        p_handle);
+}
+void BTA_EnableTestMode(void) {
+  mock_function_count_map[__func__]++;
+  test::mock::bta_dm_api::BTA_EnableTestMode();
+}
 void BTA_GetEirService(uint8_t* p_eir, size_t eir_len,
                        tBTA_SERVICE_MASK* p_services) {
   mock_function_count_map[__func__]++;
+  test::mock::bta_dm_api::BTA_GetEirService(p_eir, eir_len, p_services);
 }
-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) {
+void BTA_RemoveEirUuid(uint16_t uuid16) {
   mock_function_count_map[__func__]++;
+  test::mock::bta_dm_api::BTA_RemoveEirUuid(uuid16);
 }
-void BTA_DmBleScan(bool start, uint8_t duration) {
+void BTA_VendorInit(void) {
   mock_function_count_map[__func__]++;
+  test::mock::bta_dm_api::BTA_VendorInit();
 }
-void BTA_DmBleCsisObserve(bool observe, tBTA_DM_SEARCH_CBACK* p_results_cb) {
+void BTA_dm_init() {
   mock_function_count_map[__func__]++;
+  test::mock::bta_dm_api::BTA_dm_init();
 }
-void BTA_VendorInit(void) { mock_function_count_map[__func__]++; }
+
+// END mockcify generation
diff --git a/test/mock/mock_bta_dm_api.h b/test/mock/mock_bta_dm_api.h
new file mode 100644
index 0000000..324b9ec
--- /dev/null
+++ b/test/mock/mock_bta_dm_api.h
@@ -0,0 +1,488 @@
+/*
+ * 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:34
+ *
+ *  mockcify.pl ver 0.3.0
+ */
+
+#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 from (or add to ) the inclusion set.
+#include <base/bind.h>
+
+#include <map>
+#include <string>
+#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"
+
+// Mocked compile conditionals, if any
+
+namespace test {
+namespace mock {
+namespace bta_dm_api {
+
+// Shared state between mocked functions and tests
+// Name: BTA_AddEirUuid
+// Params: uint16_t uuid16
+// Return: void
+struct BTA_AddEirUuid {
+  std::function<void(uint16_t uuid16)> body{[](uint16_t uuid16) {}};
+  void operator()(uint16_t uuid16) { body(uuid16); };
+};
+extern struct BTA_AddEirUuid BTA_AddEirUuid;
+
+// Name: BTA_DmAddBleDevice
+// Params: const RawAddress& bd_addr, tBLE_ADDR_TYPE addr_type, tBT_DEVICE_TYPE
+// dev_type Return: void
+struct BTA_DmAddBleDevice {
+  std::function<void(const RawAddress& bd_addr, tBLE_ADDR_TYPE addr_type,
+                     tBT_DEVICE_TYPE dev_type)>
+      body{[](const RawAddress& bd_addr, tBLE_ADDR_TYPE addr_type,
+              tBT_DEVICE_TYPE dev_type) {}};
+  void operator()(const RawAddress& bd_addr, tBLE_ADDR_TYPE addr_type,
+                  tBT_DEVICE_TYPE dev_type) {
+    body(bd_addr, addr_type, dev_type);
+  };
+};
+extern struct BTA_DmAddBleDevice BTA_DmAddBleDevice;
+
+// Name: BTA_DmAddBleKey
+// Params: const RawAddress& bd_addr, tBTA_LE_KEY_VALUE* p_le_key,
+// tBTM_LE_KEY_TYPE key_type Return: void
+struct BTA_DmAddBleKey {
+  std::function<void(const RawAddress& bd_addr, tBTA_LE_KEY_VALUE* p_le_key,
+                     tBTM_LE_KEY_TYPE key_type)>
+      body{[](const RawAddress& bd_addr, tBTA_LE_KEY_VALUE* p_le_key,
+              tBTM_LE_KEY_TYPE key_type) {}};
+  void operator()(const RawAddress& bd_addr, tBTA_LE_KEY_VALUE* p_le_key,
+                  tBTM_LE_KEY_TYPE key_type) {
+    body(bd_addr, p_le_key, key_type);
+  };
+};
+extern struct BTA_DmAddBleKey BTA_DmAddBleKey;
+
+// Name: BTA_DmAddDevice
+// Params: const RawAddress& bd_addr, DEV_CLASS dev_class, const LinkKey&
+// link_key, uint8_t key_type, uint8_t pin_length Return: void
+struct BTA_DmAddDevice {
+  std::function<void(const RawAddress& bd_addr, DEV_CLASS dev_class,
+                     const LinkKey& link_key, uint8_t key_type,
+                     uint8_t pin_length)>
+      body{[](const RawAddress& bd_addr, DEV_CLASS dev_class,
+              const LinkKey& link_key, uint8_t key_type,
+              uint8_t pin_length) {}};
+  void operator()(const RawAddress& bd_addr, DEV_CLASS dev_class,
+                  const LinkKey& link_key, uint8_t key_type,
+                  uint8_t pin_length) {
+    body(bd_addr, dev_class, link_key, key_type, pin_length);
+  };
+};
+extern struct BTA_DmAddDevice BTA_DmAddDevice;
+
+// Name: BTA_DmBleConfigLocalPrivacy
+// Params: bool privacy_enable
+// Return: void
+struct BTA_DmBleConfigLocalPrivacy {
+  std::function<void(bool privacy_enable)> body{[](bool privacy_enable) {}};
+  void operator()(bool privacy_enable) { body(privacy_enable); };
+};
+extern struct BTA_DmBleConfigLocalPrivacy BTA_DmBleConfigLocalPrivacy;
+
+// Name: BTA_DmBleConfirmReply
+// Params: const RawAddress& bd_addr, bool accept
+// Return: void
+struct BTA_DmBleConfirmReply {
+  std::function<void(const RawAddress& bd_addr, bool accept)> body{
+      [](const RawAddress& bd_addr, bool accept) {}};
+  void operator()(const RawAddress& bd_addr, bool accept) {
+    body(bd_addr, accept);
+  };
+};
+extern struct BTA_DmBleConfirmReply BTA_DmBleConfirmReply;
+
+// Name: BTA_DmBleCsisObserve
+// Params: bool observe, tBTA_DM_SEARCH_CBACK* p_results_cb
+// Return: void
+struct BTA_DmBleCsisObserve {
+  std::function<void(bool observe, tBTA_DM_SEARCH_CBACK* p_results_cb)> body{
+      [](bool observe, tBTA_DM_SEARCH_CBACK* p_results_cb) {}};
+  void operator()(bool observe, tBTA_DM_SEARCH_CBACK* p_results_cb) {
+    body(observe, p_results_cb);
+  };
+};
+extern struct BTA_DmBleCsisObserve BTA_DmBleCsisObserve;
+
+// Name: BTA_DmBleGetEnergyInfo
+// Params: tBTA_BLE_ENERGY_INFO_CBACK* p_cmpl_cback
+// Return: void
+struct BTA_DmBleGetEnergyInfo {
+  std::function<void(tBTA_BLE_ENERGY_INFO_CBACK* p_cmpl_cback)> body{
+      [](tBTA_BLE_ENERGY_INFO_CBACK* p_cmpl_cback) {}};
+  void operator()(tBTA_BLE_ENERGY_INFO_CBACK* p_cmpl_cback) {
+    body(p_cmpl_cback);
+  };
+};
+extern struct BTA_DmBleGetEnergyInfo BTA_DmBleGetEnergyInfo;
+
+// Name: BTA_DmBleObserve
+// Params: bool start, uint8_t duration, tBTA_DM_SEARCH_CBACK* p_results_cb
+// Return: void
+struct BTA_DmBleObserve {
+  std::function<void(bool start, uint8_t duration,
+                     tBTA_DM_SEARCH_CBACK* p_results_cb)>
+      body{[](bool start, uint8_t duration,
+              tBTA_DM_SEARCH_CBACK* p_results_cb) {}};
+  void operator()(bool start, uint8_t duration,
+                  tBTA_DM_SEARCH_CBACK* p_results_cb) {
+    body(start, duration, p_results_cb);
+  };
+};
+extern struct BTA_DmBleObserve BTA_DmBleObserve;
+
+// Name: BTA_DmBlePasskeyReply
+// Params: const RawAddress& bd_addr, bool accept, uint32_t passkey
+// Return: void
+struct BTA_DmBlePasskeyReply {
+  std::function<void(const RawAddress& bd_addr, bool accept, uint32_t passkey)>
+      body{[](const RawAddress& bd_addr, bool accept, uint32_t passkey) {}};
+  void operator()(const RawAddress& bd_addr, bool accept, uint32_t passkey) {
+    body(bd_addr, accept, passkey);
+  };
+};
+extern struct BTA_DmBlePasskeyReply BTA_DmBlePasskeyReply;
+
+// Name: BTA_DmBleRequestMaxTxDataLength
+// Params: const RawAddress& remote_device
+// Return: void
+struct BTA_DmBleRequestMaxTxDataLength {
+  std::function<void(const RawAddress& remote_device)> body{
+      [](const RawAddress& remote_device) {}};
+  void operator()(const RawAddress& remote_device) { body(remote_device); };
+};
+extern struct BTA_DmBleRequestMaxTxDataLength BTA_DmBleRequestMaxTxDataLength;
+
+// Name: BTA_DmBleScan
+// Params: bool start, uint8_t duration
+// Return: void
+struct BTA_DmBleScan {
+  std::function<void(bool start, uint8_t duration)> body{
+      [](bool start, uint8_t duration) {}};
+  void operator()(bool start, uint8_t duration) { body(start, duration); };
+};
+extern struct BTA_DmBleScan BTA_DmBleScan;
+
+// Name: BTA_DmBleSecurityGrant
+// Params: const RawAddress& bd_addr, tBTA_DM_BLE_SEC_GRANT res
+// Return: void
+struct BTA_DmBleSecurityGrant {
+  std::function<void(const RawAddress& bd_addr, tBTA_DM_BLE_SEC_GRANT res)>
+      body{[](const RawAddress& bd_addr, tBTA_DM_BLE_SEC_GRANT res) {}};
+  void operator()(const RawAddress& bd_addr, tBTA_DM_BLE_SEC_GRANT res) {
+    body(bd_addr, res);
+  };
+};
+extern struct BTA_DmBleSecurityGrant BTA_DmBleSecurityGrant;
+
+// Name: BTA_DmBleUpdateConnectionParams
+// Params: 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
+// Return: void
+struct BTA_DmBleUpdateConnectionParams {
+  std::function<void(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)>
+      body{[](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) {}};
+  void operator()(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) {
+    body(bd_addr, min_int, max_int, latency, timeout, min_ce_len, max_ce_len);
+  };
+};
+extern struct BTA_DmBleUpdateConnectionParams BTA_DmBleUpdateConnectionParams;
+
+// Name: BTA_DmBond
+// Params: const RawAddress& bd_addr, tBLE_ADDR_TYPE addr_type, tBT_TRANSPORT
+// transport, tBT_DEVICE_TYPE device_type Return: void
+struct BTA_DmBond {
+  std::function<void(const RawAddress& bd_addr, tBLE_ADDR_TYPE addr_type,
+                     tBT_TRANSPORT transport, tBT_DEVICE_TYPE device_type)>
+      body{[](const RawAddress& bd_addr, tBLE_ADDR_TYPE addr_type,
+              tBT_TRANSPORT transport, tBT_DEVICE_TYPE device_type) {}};
+  void operator()(const RawAddress& bd_addr, tBLE_ADDR_TYPE addr_type,
+                  tBT_TRANSPORT transport, tBT_DEVICE_TYPE device_type) {
+    body(bd_addr, addr_type, transport, device_type);
+  };
+};
+extern struct BTA_DmBond BTA_DmBond;
+
+// Name: BTA_DmBondCancel
+// Params: const RawAddress& bd_addr
+// Return: void
+struct BTA_DmBondCancel {
+  std::function<void(const RawAddress& bd_addr)> body{
+      [](const RawAddress& bd_addr) {}};
+  void operator()(const RawAddress& bd_addr) { body(bd_addr); };
+};
+extern struct BTA_DmBondCancel BTA_DmBondCancel;
+
+// Name: BTA_DmCloseACL
+// Params: const RawAddress& bd_addr, bool remove_dev, tBT_TRANSPORT transport
+// Return: void
+struct BTA_DmCloseACL {
+  std::function<void(const RawAddress& bd_addr, bool remove_dev,
+                     tBT_TRANSPORT transport)>
+      body{[](const RawAddress& bd_addr, bool remove_dev,
+              tBT_TRANSPORT transport) {}};
+  void operator()(const RawAddress& bd_addr, bool remove_dev,
+                  tBT_TRANSPORT transport) {
+    body(bd_addr, remove_dev, transport);
+  };
+};
+extern struct BTA_DmCloseACL BTA_DmCloseACL;
+
+// Name: BTA_DmConfirm
+// Params: const RawAddress& bd_addr, bool accept
+// Return: void
+struct BTA_DmConfirm {
+  std::function<void(const RawAddress& bd_addr, bool accept)> body{
+      [](const RawAddress& bd_addr, bool accept) {}};
+  void operator()(const RawAddress& bd_addr, bool accept) {
+    body(bd_addr, accept);
+  };
+};
+extern struct BTA_DmConfirm BTA_DmConfirm;
+
+// Name: BTA_DmDiscover
+// Params: const RawAddress& bd_addr, tBTA_DM_SEARCH_CBACK* p_cback,
+// tBT_TRANSPORT transport, bool is_bonding_or_sd Return: void
+struct BTA_DmDiscover {
+  std::function<void(const RawAddress& bd_addr, tBTA_DM_SEARCH_CBACK* p_cback,
+                     tBT_TRANSPORT transport, bool is_bonding_or_sd)>
+      body{[](const RawAddress& bd_addr, tBTA_DM_SEARCH_CBACK* p_cback,
+              tBT_TRANSPORT transport, bool is_bonding_or_sd) {}};
+  void operator()(const RawAddress& bd_addr, tBTA_DM_SEARCH_CBACK* p_cback,
+                  tBT_TRANSPORT transport, bool is_bonding_or_sd) {
+    body(bd_addr, p_cback, transport, is_bonding_or_sd);
+  };
+};
+extern struct BTA_DmDiscover BTA_DmDiscover;
+
+// Name: BTA_DmGetConnectionState
+// Params: const RawAddress& bd_addr
+// Return: bool
+struct BTA_DmGetConnectionState {
+  bool return_value{false};
+  std::function<bool(const RawAddress& bd_addr)> body{
+      [this](const RawAddress& bd_addr) { return return_value; }};
+  bool operator()(const RawAddress& bd_addr) { return body(bd_addr); };
+};
+extern struct BTA_DmGetConnectionState BTA_DmGetConnectionState;
+
+// Name: BTA_DmLocalOob
+// Params: void
+// Return: void
+struct BTA_DmLocalOob {
+  std::function<void(void)> body{[](void) {}};
+  void operator()(void) { body(); };
+};
+extern struct BTA_DmLocalOob BTA_DmLocalOob;
+
+// Name: BTA_DmPinReply
+// Params: const RawAddress& bd_addr, bool accept, uint8_t pin_len, uint8_t*
+// p_pin Return: void
+struct BTA_DmPinReply {
+  std::function<void(const RawAddress& bd_addr, bool accept, uint8_t pin_len,
+                     uint8_t* p_pin)>
+      body{[](const RawAddress& bd_addr, bool accept, uint8_t pin_len,
+              uint8_t* p_pin) {}};
+  void operator()(const RawAddress& bd_addr, bool accept, uint8_t pin_len,
+                  uint8_t* p_pin) {
+    body(bd_addr, accept, pin_len, p_pin);
+  };
+};
+extern struct BTA_DmPinReply BTA_DmPinReply;
+
+// Name: BTA_DmRemoveDevice
+// Params: const RawAddress& bd_addr
+// Return: tBTA_STATUS
+struct BTA_DmRemoveDevice {
+  tBTA_STATUS return_value{0};
+  std::function<tBTA_STATUS(const RawAddress& bd_addr)> body{
+      [this](const RawAddress& bd_addr) { return return_value; }};
+  tBTA_STATUS operator()(const RawAddress& bd_addr) { return body(bd_addr); };
+};
+extern struct BTA_DmRemoveDevice BTA_DmRemoveDevice;
+
+// Name: BTA_DmSearch
+// Params: tBTA_DM_SEARCH_CBACK* p_cback, bool is_bonding_or_sdp
+// Return: void
+struct BTA_DmSearch {
+  std::function<void(tBTA_DM_SEARCH_CBACK* p_cback, bool is_bonding_or_sdp)>
+      body{[](tBTA_DM_SEARCH_CBACK* p_cback, bool is_bonding_or_sdp) {}};
+  void operator()(tBTA_DM_SEARCH_CBACK* p_cback, bool is_bonding_or_sdp) {
+    body(p_cback, is_bonding_or_sdp);
+  };
+};
+extern struct BTA_DmSearch BTA_DmSearch;
+
+// Name: BTA_DmSearchCancel
+// Params: void
+// Return: void
+struct BTA_DmSearchCancel {
+  std::function<void(void)> body{[](void) {}};
+  void operator()(void) { body(); };
+};
+extern struct BTA_DmSearchCancel BTA_DmSearchCancel;
+
+// Name: BTA_DmSetBlePrefConnParams
+// Params: const RawAddress& bd_addr, uint16_t min_conn_int, uint16_t
+// max_conn_int, uint16_t peripheral_latency, uint16_t supervision_tout Return:
+// void
+struct BTA_DmSetBlePrefConnParams {
+  std::function<void(const RawAddress& bd_addr, uint16_t min_conn_int,
+                     uint16_t max_conn_int, uint16_t peripheral_latency,
+                     uint16_t supervision_tout)>
+      body{[](const RawAddress& bd_addr, uint16_t min_conn_int,
+              uint16_t max_conn_int, uint16_t peripheral_latency,
+              uint16_t supervision_tout) {}};
+  void operator()(const RawAddress& bd_addr, uint16_t min_conn_int,
+                  uint16_t max_conn_int, uint16_t peripheral_latency,
+                  uint16_t supervision_tout) {
+    body(bd_addr, min_conn_int, max_conn_int, peripheral_latency,
+         supervision_tout);
+  };
+};
+extern struct BTA_DmSetBlePrefConnParams BTA_DmSetBlePrefConnParams;
+
+// Name: BTA_DmSetDeviceName
+// Params: char* p_name
+// Return: void
+struct BTA_DmSetDeviceName {
+  std::function<void(char* p_name)> body{[](char* p_name) {}};
+  void operator()(char* p_name) { body(p_name); };
+};
+extern struct BTA_DmSetDeviceName BTA_DmSetDeviceName;
+
+// Name: BTA_DmSetEncryption
+// Params: const RawAddress& bd_addr, tBT_TRANSPORT transport,
+// tBTA_DM_ENCRYPT_CBACK* p_callback, tBTM_BLE_SEC_ACT sec_act Return: void
+struct BTA_DmSetEncryption {
+  std::function<void(const RawAddress& bd_addr, tBT_TRANSPORT transport,
+                     tBTA_DM_ENCRYPT_CBACK* p_callback,
+                     tBTM_BLE_SEC_ACT sec_act)>
+      body{[](const RawAddress& bd_addr, tBT_TRANSPORT transport,
+              tBTA_DM_ENCRYPT_CBACK* p_callback, tBTM_BLE_SEC_ACT sec_act) {}};
+  void operator()(const RawAddress& bd_addr, tBT_TRANSPORT transport,
+                  tBTA_DM_ENCRYPT_CBACK* p_callback, tBTM_BLE_SEC_ACT sec_act) {
+    body(bd_addr, transport, p_callback, sec_act);
+  };
+};
+extern struct BTA_DmSetEncryption BTA_DmSetEncryption;
+
+// Name: BTA_DmSetLocalDiRecord
+// Params: tSDP_DI_RECORD* p_device_info, uint32_t* p_handle
+// Return: tBTA_STATUS
+struct BTA_DmSetLocalDiRecord {
+  tBTA_STATUS return_value{0};
+  std::function<tBTA_STATUS(tSDP_DI_RECORD* p_device_info, uint32_t* p_handle)>
+      body{[this](tSDP_DI_RECORD* p_device_info, uint32_t* p_handle) {
+        return return_value;
+      }};
+  tBTA_STATUS operator()(tSDP_DI_RECORD* p_device_info, uint32_t* p_handle) {
+    return body(p_device_info, p_handle);
+  };
+};
+extern struct BTA_DmSetLocalDiRecord BTA_DmSetLocalDiRecord;
+
+// Name: BTA_EnableTestMode
+// Params: void
+// Return: void
+struct BTA_EnableTestMode {
+  std::function<void(void)> body{[](void) {}};
+  void operator()(void) { body(); };
+};
+extern struct BTA_EnableTestMode BTA_EnableTestMode;
+
+// Name: BTA_GetEirService
+// Params: uint8_t* p_eir, size_t eir_len, tBTA_SERVICE_MASK* p_services
+// Return: void
+struct BTA_GetEirService {
+  std::function<void(uint8_t* p_eir, size_t eir_len,
+                     tBTA_SERVICE_MASK* p_services)>
+      body{
+          [](uint8_t* p_eir, size_t eir_len, tBTA_SERVICE_MASK* p_services) {}};
+  void operator()(uint8_t* p_eir, size_t eir_len,
+                  tBTA_SERVICE_MASK* p_services) {
+    body(p_eir, eir_len, p_services);
+  };
+};
+extern struct BTA_GetEirService BTA_GetEirService;
+
+// Name: BTA_RemoveEirUuid
+// Params: uint16_t uuid16
+// Return: void
+struct BTA_RemoveEirUuid {
+  std::function<void(uint16_t uuid16)> body{[](uint16_t uuid16) {}};
+  void operator()(uint16_t uuid16) { body(uuid16); };
+};
+extern struct BTA_RemoveEirUuid BTA_RemoveEirUuid;
+
+// Name: BTA_VendorInit
+// Params: void
+// Return: void
+struct BTA_VendorInit {
+  std::function<void(void)> body{[](void) {}};
+  void operator()(void) { body(); };
+};
+extern struct BTA_VendorInit BTA_VendorInit;
+
+// Name: BTA_dm_init
+// Params:
+// Return: void
+struct BTA_dm_init {
+  std::function<void()> body{[]() {}};
+  void operator()() { body(); };
+};
+extern struct BTA_dm_init BTA_dm_init;
+
+}  // namespace bta_dm_api
+}  // namespace mock
+}  // namespace test
+
+// END mockcify generation
\ No newline at end of file
diff --git a/test/mock/mock_bta_hh_utils.cc b/test/mock/mock_bta_hh_utils.cc
new file mode 100644
index 0000000..2f77f71
--- /dev/null
+++ b/test/mock/mock_bta_hh_utils.cc
@@ -0,0 +1,110 @@
+/*
+ * 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.3.0
+ */
+
+#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_bta_hh_utils.h"
+
+// Mocked internal structures, if any
+
+namespace test {
+namespace mock {
+namespace bta_hh_utils {
+
+// Function state capture and return values, if needed
+struct bta_hh_add_device_to_list bta_hh_add_device_to_list;
+struct bta_hh_clean_up_kdev bta_hh_clean_up_kdev;
+struct bta_hh_cleanup_disable bta_hh_cleanup_disable;
+struct bta_hh_dev_handle_to_cb_idx bta_hh_dev_handle_to_cb_idx;
+struct bta_hh_find_cb bta_hh_find_cb;
+struct bta_hh_get_cb bta_hh_get_cb;
+struct bta_hh_read_ssr_param bta_hh_read_ssr_param;
+struct bta_hh_tod_spt bta_hh_tod_spt;
+struct bta_hh_trace_dev_db bta_hh_trace_dev_db;
+struct bta_hh_update_di_info bta_hh_update_di_info;
+
+}  // namespace bta_hh_utils
+}  // namespace mock
+}  // namespace test
+
+// Mocked functions, if any
+void bta_hh_add_device_to_list(tBTA_HH_DEV_CB* p_cb, uint8_t handle,
+                               uint16_t attr_mask,
+                               const tHID_DEV_DSCP_INFO* p_dscp_info,
+                               uint8_t sub_class, uint16_t ssr_max_latency,
+                               uint16_t ssr_min_tout, uint8_t app_id) {
+  mock_function_count_map[__func__]++;
+  test::mock::bta_hh_utils::bta_hh_add_device_to_list(
+      p_cb, handle, attr_mask, p_dscp_info, sub_class, ssr_max_latency,
+      ssr_min_tout, app_id);
+}
+void bta_hh_clean_up_kdev(tBTA_HH_DEV_CB* p_cb) {
+  mock_function_count_map[__func__]++;
+  test::mock::bta_hh_utils::bta_hh_clean_up_kdev(p_cb);
+}
+void bta_hh_cleanup_disable(tBTA_HH_STATUS status) {
+  mock_function_count_map[__func__]++;
+  test::mock::bta_hh_utils::bta_hh_cleanup_disable(status);
+}
+uint8_t bta_hh_dev_handle_to_cb_idx(uint8_t dev_handle) {
+  mock_function_count_map[__func__]++;
+  return test::mock::bta_hh_utils::bta_hh_dev_handle_to_cb_idx(dev_handle);
+}
+uint8_t bta_hh_find_cb(const RawAddress& bda) {
+  mock_function_count_map[__func__]++;
+  return test::mock::bta_hh_utils::bta_hh_find_cb(bda);
+}
+tBTA_HH_DEV_CB* bta_hh_get_cb(const RawAddress& bda) {
+  mock_function_count_map[__func__]++;
+  return test::mock::bta_hh_utils::bta_hh_get_cb(bda);
+}
+tBTA_HH_STATUS bta_hh_read_ssr_param(const RawAddress& bd_addr,
+                                     uint16_t* p_max_ssr_lat,
+                                     uint16_t* p_min_ssr_tout) {
+  mock_function_count_map[__func__]++;
+  return test::mock::bta_hh_utils::bta_hh_read_ssr_param(bd_addr, p_max_ssr_lat,
+                                                         p_min_ssr_tout);
+}
+bool bta_hh_tod_spt(tBTA_HH_DEV_CB* p_cb, uint8_t sub_class) {
+  mock_function_count_map[__func__]++;
+  return test::mock::bta_hh_utils::bta_hh_tod_spt(p_cb, sub_class);
+}
+void bta_hh_trace_dev_db(void) {
+  mock_function_count_map[__func__]++;
+  test::mock::bta_hh_utils::bta_hh_trace_dev_db();
+}
+void bta_hh_update_di_info(tBTA_HH_DEV_CB* p_cb, uint16_t vendor_id,
+                           uint16_t product_id, uint16_t version,
+                           uint8_t flag) {
+  mock_function_count_map[__func__]++;
+  test::mock::bta_hh_utils::bta_hh_update_di_info(p_cb, vendor_id, product_id,
+                                                  version, flag);
+}
+// Mocked functions complete
+// END mockcify generation
diff --git a/test/mock/mock_bta_hh_utils.h b/test/mock/mock_bta_hh_utils.h
new file mode 100644
index 0000000..7407a80
--- /dev/null
+++ b/test/mock/mock_bta_hh_utils.h
@@ -0,0 +1,190 @@
+/*
+ * 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.3.0
+ */
+
+#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 from (or add to ) the inclusion set.
+#include <string.h>
+
+#include <cstring>
+
+#include "bt_target.h"
+#include "bt_trace.h"
+#include "bta/hh/bta_hh_int.h"
+#include "btif/include/btif_storage.h"
+#include "device/include/interop.h"
+#include "osi/include/osi.h"
+#include "stack/include/acl_api.h"
+#include "stack/include/btm_client_interface.h"
+#include "types/raw_address.h"
+
+// Mocked compile conditionals, if any
+
+namespace test {
+namespace mock {
+namespace bta_hh_utils {
+
+// Shared state between mocked functions and tests
+// Name: bta_hh_add_device_to_list
+// Params: tBTA_HH_DEV_CB* p_cb, uint8_t handle, uint16_t attr_mask, const
+// tHID_DEV_DSCP_INFO* p_dscp_info, uint8_t sub_class, uint16_t ssr_max_latency,
+// uint16_t ssr_min_tout, uint8_t app_id Return: void
+struct bta_hh_add_device_to_list {
+  std::function<void(tBTA_HH_DEV_CB* p_cb, uint8_t handle, uint16_t attr_mask,
+                     const tHID_DEV_DSCP_INFO* p_dscp_info, uint8_t sub_class,
+                     uint16_t ssr_max_latency, uint16_t ssr_min_tout,
+                     uint8_t app_id)>
+      body{[](tBTA_HH_DEV_CB* p_cb, uint8_t handle, uint16_t attr_mask,
+              const tHID_DEV_DSCP_INFO* p_dscp_info, uint8_t sub_class,
+              uint16_t ssr_max_latency, uint16_t ssr_min_tout,
+              uint8_t app_id) {}};
+  void operator()(tBTA_HH_DEV_CB* p_cb, uint8_t handle, uint16_t attr_mask,
+                  const tHID_DEV_DSCP_INFO* p_dscp_info, uint8_t sub_class,
+                  uint16_t ssr_max_latency, uint16_t ssr_min_tout,
+                  uint8_t app_id) {
+    body(p_cb, handle, attr_mask, p_dscp_info, sub_class, ssr_max_latency,
+         ssr_min_tout, app_id);
+  };
+};
+extern struct bta_hh_add_device_to_list bta_hh_add_device_to_list;
+
+// Name: bta_hh_clean_up_kdev
+// Params: tBTA_HH_DEV_CB* p_cb
+// Return: void
+struct bta_hh_clean_up_kdev {
+  std::function<void(tBTA_HH_DEV_CB* p_cb)> body{[](tBTA_HH_DEV_CB* p_cb) {}};
+  void operator()(tBTA_HH_DEV_CB* p_cb) { body(p_cb); };
+};
+extern struct bta_hh_clean_up_kdev bta_hh_clean_up_kdev;
+
+// Name: bta_hh_cleanup_disable
+// Params: tBTA_HH_STATUS status
+// Return: void
+struct bta_hh_cleanup_disable {
+  std::function<void(tBTA_HH_STATUS status)> body{[](tBTA_HH_STATUS status) {}};
+  void operator()(tBTA_HH_STATUS status) { body(status); };
+};
+extern struct bta_hh_cleanup_disable bta_hh_cleanup_disable;
+
+// Name: bta_hh_dev_handle_to_cb_idx
+// Params: uint8_t dev_handle
+// Return: uint8_t
+struct bta_hh_dev_handle_to_cb_idx {
+  uint8_t return_value{0};
+  std::function<uint8_t(uint8_t dev_handle)> body{
+      [this](uint8_t dev_handle) { return return_value; }};
+  uint8_t operator()(uint8_t dev_handle) { return body(dev_handle); };
+};
+extern struct bta_hh_dev_handle_to_cb_idx bta_hh_dev_handle_to_cb_idx;
+
+// Name: bta_hh_find_cb
+// Params: const RawAddress& bda
+// Return: uint8_t
+struct bta_hh_find_cb {
+  uint8_t return_value{0};
+  std::function<uint8_t(const RawAddress& bda)> body{
+      [this](const RawAddress& bda) { return return_value; }};
+  uint8_t operator()(const RawAddress& bda) { return body(bda); };
+};
+extern struct bta_hh_find_cb bta_hh_find_cb;
+
+// Name: bta_hh_get_cb
+// Params: const RawAddress& bda
+// Return: tBTA_HH_DEV_CB*
+struct bta_hh_get_cb {
+  tBTA_HH_DEV_CB* return_value{0};
+  std::function<tBTA_HH_DEV_CB*(const RawAddress& bda)> body{
+      [this](const RawAddress& bda) { return return_value; }};
+  tBTA_HH_DEV_CB* operator()(const RawAddress& bda) { return body(bda); };
+};
+extern struct bta_hh_get_cb bta_hh_get_cb;
+
+// Name: bta_hh_read_ssr_param
+// Params: const RawAddress& bd_addr, uint16_t* p_max_ssr_lat, uint16_t*
+// p_min_ssr_tout Return: tBTA_HH_STATUS
+struct bta_hh_read_ssr_param {
+  tBTA_HH_STATUS return_value{0};
+  std::function<tBTA_HH_STATUS(const RawAddress& bd_addr,
+                               uint16_t* p_max_ssr_lat,
+                               uint16_t* p_min_ssr_tout)>
+      body{[this](const RawAddress& bd_addr, uint16_t* p_max_ssr_lat,
+                  uint16_t* p_min_ssr_tout) { return return_value; }};
+  tBTA_HH_STATUS operator()(const RawAddress& bd_addr, uint16_t* p_max_ssr_lat,
+                            uint16_t* p_min_ssr_tout) {
+    return body(bd_addr, p_max_ssr_lat, p_min_ssr_tout);
+  };
+};
+extern struct bta_hh_read_ssr_param bta_hh_read_ssr_param;
+
+// Name: bta_hh_tod_spt
+// Params: tBTA_HH_DEV_CB* p_cb, uint8_t sub_class
+// Return: bool
+struct bta_hh_tod_spt {
+  bool return_value{false};
+  std::function<bool(tBTA_HH_DEV_CB* p_cb, uint8_t sub_class)> body{
+      [this](tBTA_HH_DEV_CB* p_cb, uint8_t sub_class) { return return_value; }};
+  bool operator()(tBTA_HH_DEV_CB* p_cb, uint8_t sub_class) {
+    return body(p_cb, sub_class);
+  };
+};
+extern struct bta_hh_tod_spt bta_hh_tod_spt;
+
+// Name: bta_hh_trace_dev_db
+// Params: void
+// Return: void
+struct bta_hh_trace_dev_db {
+  std::function<void(void)> body{[](void) {}};
+  void operator()(void) { body(); };
+};
+extern struct bta_hh_trace_dev_db bta_hh_trace_dev_db;
+
+// Name: bta_hh_update_di_info
+// Params: tBTA_HH_DEV_CB* p_cb, uint16_t vendor_id, uint16_t product_id,
+// uint16_t version, uint8_t flag Return: void
+struct bta_hh_update_di_info {
+  std::function<void(tBTA_HH_DEV_CB* p_cb, uint16_t vendor_id,
+                     uint16_t product_id, uint16_t version, uint8_t flag)>
+      body{[](tBTA_HH_DEV_CB* p_cb, uint16_t vendor_id, uint16_t product_id,
+              uint16_t version, uint8_t flag) {}};
+  void operator()(tBTA_HH_DEV_CB* p_cb, uint16_t vendor_id, uint16_t product_id,
+                  uint16_t version, uint8_t flag) {
+    body(p_cb, vendor_id, product_id, version, flag);
+  };
+};
+extern struct bta_hh_update_di_info bta_hh_update_di_info;
+
+}  // namespace bta_hh_utils
+}  // namespace mock
+}  // namespace test
+
+// END mockcify generation
\ No newline at end of file
diff --git a/test/mock/mock_bta_sys_main.cc b/test/mock/mock_bta_sys_main.cc
index 9871349..5b74faa 100644
--- a/test/mock/mock_bta_sys_main.cc
+++ b/test/mock/mock_bta_sys_main.cc
@@ -17,48 +17,84 @@
 /*
  * Generated mock file from original source file
  *   Functions generated:10
+ *
+ *  mockcify.pl ver 0.3.0
  */
 
+#include <cstdint>
+#include <functional>
 #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"
+// Mock include file to share data between tests and mock
+#include "test/mock/mock_bta_sys_main.h"
 
-#ifndef UNUSED_ATTR
-#define UNUSED_ATTR
-#endif
+// Mocked internal structures, if any
 
-bool bta_sys_is_register(uint8_t id) {
+namespace test {
+namespace mock {
+namespace bta_sys_main {
+
+// Function state capture and return values, if needed
+struct BTA_sys_signal_hw_error BTA_sys_signal_hw_error;
+struct bta_set_forward_hw_failures bta_set_forward_hw_failures;
+struct bta_sys_deregister bta_sys_deregister;
+struct bta_sys_disable bta_sys_disable;
+struct bta_sys_init bta_sys_init;
+struct bta_sys_is_register bta_sys_is_register;
+struct bta_sys_register bta_sys_register;
+struct bta_sys_sendmsg bta_sys_sendmsg;
+struct bta_sys_sendmsg_delayed bta_sys_sendmsg_delayed;
+struct bta_sys_start_timer bta_sys_start_timer;
+
+}  // namespace bta_sys_main
+}  // namespace mock
+}  // namespace test
+
+// Mocked functions, if any
+void BTA_sys_signal_hw_error() {
   mock_function_count_map[__func__]++;
-  return false;
+  test::mock::bta_sys_main::BTA_sys_signal_hw_error();
 }
-void BTA_sys_signal_hw_error() { mock_function_count_map[__func__]++; }
 void bta_set_forward_hw_failures(bool value) {
   mock_function_count_map[__func__]++;
+  test::mock::bta_sys_main::bta_set_forward_hw_failures(value);
 }
-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_deregister(uint8_t id) {
+  mock_function_count_map[__func__]++;
+  test::mock::bta_sys_main::bta_sys_deregister(id);
+}
+void bta_sys_disable() {
+  mock_function_count_map[__func__]++;
+  test::mock::bta_sys_main::bta_sys_disable();
+}
+void bta_sys_init(void) {
+  mock_function_count_map[__func__]++;
+  test::mock::bta_sys_main::bta_sys_init();
+}
+bool bta_sys_is_register(uint8_t id) {
+  mock_function_count_map[__func__]++;
+  return test::mock::bta_sys_main::bta_sys_is_register(id);
+}
 void bta_sys_register(uint8_t id, const tBTA_SYS_REG* p_reg) {
   mock_function_count_map[__func__]++;
+  test::mock::bta_sys_main::bta_sys_register(id, p_reg);
 }
-void bta_sys_sendmsg(void* p_msg) { mock_function_count_map[__func__]++; }
+void bta_sys_sendmsg(void* p_msg) {
+  mock_function_count_map[__func__]++;
+  test::mock::bta_sys_main::bta_sys_sendmsg(p_msg);
+}
 void bta_sys_sendmsg_delayed(void* p_msg, const base::TimeDelta& delay) {
   mock_function_count_map[__func__]++;
+  test::mock::bta_sys_main::bta_sys_sendmsg_delayed(p_msg, delay);
 }
 void bta_sys_start_timer(alarm_t* alarm, uint64_t interval_ms, uint16_t event,
                          uint16_t layer_specific) {
   mock_function_count_map[__func__]++;
+  test::mock::bta_sys_main::bta_sys_start_timer(alarm, interval_ms, event,
+                                                layer_specific);
 }
+// Mocked functions complete
+// END mockcify generation
diff --git a/test/mock/mock_bta_sys_main.h b/test/mock/mock_bta_sys_main.h
new file mode 100644
index 0000000..95bc473
--- /dev/null
+++ b/test/mock/mock_bta_sys_main.h
@@ -0,0 +1,166 @@
+/*
+ * 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.3.0
+ */
+
+#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 from (or add to ) the inclusion set.
+#include <base/bind.h>
+
+#include <cstring>
+#include <map>
+#include <string>
+
+#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"
+
+// Mocked compile conditionals, if any
+
+namespace test {
+namespace mock {
+namespace bta_sys_main {
+
+// Shared state between mocked functions and tests
+// Name: BTA_sys_signal_hw_error
+// Params:
+// Return: void
+struct BTA_sys_signal_hw_error {
+  std::function<void()> body{[]() {}};
+  void operator()() { body(); };
+};
+extern struct BTA_sys_signal_hw_error BTA_sys_signal_hw_error;
+
+// Name: bta_set_forward_hw_failures
+// Params: bool value
+// Return: void
+struct bta_set_forward_hw_failures {
+  std::function<void(bool value)> body{[](bool value) {}};
+  void operator()(bool value) { body(value); };
+};
+extern struct bta_set_forward_hw_failures bta_set_forward_hw_failures;
+
+// Name: bta_sys_deregister
+// Params: uint8_t id
+// Return: void
+struct bta_sys_deregister {
+  std::function<void(uint8_t id)> body{[](uint8_t id) {}};
+  void operator()(uint8_t id) { body(id); };
+};
+extern struct bta_sys_deregister bta_sys_deregister;
+
+// Name: bta_sys_disable
+// Params:
+// Return: void
+struct bta_sys_disable {
+  std::function<void()> body{[]() {}};
+  void operator()() { body(); };
+};
+extern struct bta_sys_disable bta_sys_disable;
+
+// Name: bta_sys_init
+// Params: void
+// Return: void
+struct bta_sys_init {
+  std::function<void(void)> body{[](void) {}};
+  void operator()(void) { body(); };
+};
+extern struct bta_sys_init bta_sys_init;
+
+// Name: bta_sys_is_register
+// Params: uint8_t id
+// Return: bool
+struct bta_sys_is_register {
+  bool return_value{false};
+  std::function<bool(uint8_t id)> body{
+      [this](uint8_t id) { return return_value; }};
+  bool operator()(uint8_t id) { return body(id); };
+};
+extern struct bta_sys_is_register bta_sys_is_register;
+
+// Name: bta_sys_register
+// Params: uint8_t id, const tBTA_SYS_REG* p_reg
+// Return: void
+struct bta_sys_register {
+  std::function<void(uint8_t id, const tBTA_SYS_REG* p_reg)> body{
+      [](uint8_t id, const tBTA_SYS_REG* p_reg) {}};
+  void operator()(uint8_t id, const tBTA_SYS_REG* p_reg) { body(id, p_reg); };
+};
+extern struct bta_sys_register bta_sys_register;
+
+// Name: bta_sys_sendmsg
+// Params: void* p_msg
+// Return: void
+struct bta_sys_sendmsg {
+  std::function<void(void* p_msg)> body{[](void* p_msg) {}};
+  void operator()(void* p_msg) { body(p_msg); };
+};
+extern struct bta_sys_sendmsg bta_sys_sendmsg;
+
+// Name: bta_sys_sendmsg_delayed
+// Params: void* p_msg, const base::TimeDelta& delay
+// Return: void
+struct bta_sys_sendmsg_delayed {
+  std::function<void(void* p_msg, const base::TimeDelta& delay)> body{
+      [](void* p_msg, const base::TimeDelta& delay) {}};
+  void operator()(void* p_msg, const base::TimeDelta& delay) {
+    body(p_msg, delay);
+  };
+};
+extern struct bta_sys_sendmsg_delayed bta_sys_sendmsg_delayed;
+
+// Name: bta_sys_start_timer
+// Params: alarm_t* alarm, uint64_t interval_ms, uint16_t event, uint16_t
+// layer_specific Return: void
+struct bta_sys_start_timer {
+  std::function<void(alarm_t* alarm, uint64_t interval_ms, uint16_t event,
+                     uint16_t layer_specific)>
+      body{[](alarm_t* alarm, uint64_t interval_ms, uint16_t event,
+              uint16_t layer_specific) {}};
+  void operator()(alarm_t* alarm, uint64_t interval_ms, uint16_t event,
+                  uint16_t layer_specific) {
+    body(alarm, interval_ms, event, layer_specific);
+  };
+};
+extern struct bta_sys_start_timer bta_sys_start_timer;
+
+}  // namespace bta_sys_main
+}  // namespace mock
+}  // namespace test
+
+// END mockcify generation
\ No newline at end of file
diff --git a/test/mock/mock_btcore_module.cc b/test/mock/mock_btcore_module.cc
index c83cb9d..1b53b7a 100644
--- a/test/mock/mock_btcore_module.cc
+++ b/test/mock/mock_btcore_module.cc
@@ -16,46 +16,68 @@
 
 /*
  * Generated mock file from original source file
- *   Functions generated:8
+ *   Functions generated:7
+ *
+ *  mockcify.pl ver 0.3.0
  */
 
+#include <cstdint>
+#include <functional>
 #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"
+// Mock include file to share data between tests and mock
+#include "test/mock/mock_btcore_module.h"
 
-#ifndef UNUSED_ATTR
-#define UNUSED_ATTR
-#endif
+// Mocked internal structures, if any
 
+namespace test {
+namespace mock {
+namespace btcore_module {
+
+// Function state capture and return values, if needed
+struct get_module get_module;
+struct module_clean_up module_clean_up;
+struct module_init module_init;
+struct module_management_start module_management_start;
+struct module_management_stop module_management_stop;
+struct module_shut_down module_shut_down;
+struct module_start_up module_start_up;
+
+}  // namespace btcore_module
+}  // namespace mock
+}  // namespace test
+
+// Mocked functions, if any
+const module_t* get_module(const char* name) {
+  mock_function_count_map[__func__]++;
+  return test::mock::btcore_module::get_module(name);
+}
+void module_clean_up(const module_t* module) {
+  mock_function_count_map[__func__]++;
+  test::mock::btcore_module::module_clean_up(module);
+}
 bool module_init(const module_t* module) {
   mock_function_count_map[__func__]++;
-  return false;
+  return test::mock::btcore_module::module_init(module);
+}
+void module_management_start(void) {
+  mock_function_count_map[__func__]++;
+  test::mock::btcore_module::module_management_start();
+}
+void module_management_stop(void) {
+  mock_function_count_map[__func__]++;
+  test::mock::btcore_module::module_management_stop();
+}
+void module_shut_down(const module_t* module) {
+  mock_function_count_map[__func__]++;
+  test::mock::btcore_module::module_shut_down(module);
 }
 bool module_start_up(const module_t* module) {
   mock_function_count_map[__func__]++;
-  return false;
+  return test::mock::btcore_module::module_start_up(module);
 }
-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__]++;
-}
+// Mocked functions complete
+// END mockcify generation
diff --git a/test/mock/mock_btcore_module.h b/test/mock/mock_btcore_module.h
new file mode 100644
index 0000000..31bbb54
--- /dev/null
+++ b/test/mock/mock_btcore_module.h
@@ -0,0 +1,133 @@
+/*
+ * 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
+ *
+ *  mockcify.pl ver 0.3.0
+ */
+
+#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 from (or add to ) the inclusion set.
+#include <base/logging.h>
+#include <dlfcn.h>
+#include <string.h>
+
+#include <mutex>
+#include <unordered_map>
+
+#include "btcore/include/module.h"
+#include "check.h"
+#include "common/message_loop_thread.h"
+#include "osi/include/allocator.h"
+#include "osi/include/log.h"
+#include "osi/include/osi.h"
+
+// Mocked compile conditionals, if any
+
+namespace test {
+namespace mock {
+namespace btcore_module {
+
+// Shared state between mocked functions and tests
+// Name: get_module
+// Params: const char* name
+// Return: const module_t*
+struct get_module {
+  const module_t* return_value{0};
+  std::function<const module_t*(const char* name)> body{
+      [this](const char* name) { return return_value; }};
+  const module_t* operator()(const char* name) { return body(name); };
+};
+extern struct get_module get_module;
+
+// Name: module_clean_up
+// Params: const module_t* module
+// Return: void
+struct module_clean_up {
+  std::function<void(const module_t* module)> body{
+      [](const module_t* module) {}};
+  void operator()(const module_t* module) { body(module); };
+};
+extern struct module_clean_up module_clean_up;
+
+// Name: module_init
+// Params: const module_t* module
+// Return: bool
+struct module_init {
+  bool return_value{false};
+  std::function<bool(const module_t* module)> body{
+      [this](const module_t* module) { return return_value; }};
+  bool operator()(const module_t* module) { return body(module); };
+};
+extern struct module_init module_init;
+
+// Name: module_management_start
+// Params: void
+// Return: void
+struct module_management_start {
+  std::function<void(void)> body{[](void) {}};
+  void operator()(void) { body(); };
+};
+extern struct module_management_start module_management_start;
+
+// Name: module_management_stop
+// Params: void
+// Return: void
+struct module_management_stop {
+  std::function<void(void)> body{[](void) {}};
+  void operator()(void) { body(); };
+};
+extern struct module_management_stop module_management_stop;
+
+// Name: module_shut_down
+// Params: const module_t* module
+// Return: void
+struct module_shut_down {
+  std::function<void(const module_t* module)> body{
+      [](const module_t* module) {}};
+  void operator()(const module_t* module) { body(module); };
+};
+extern struct module_shut_down module_shut_down;
+
+// Name: module_start_up
+// Params: const module_t* module
+// Return: bool
+struct module_start_up {
+  bool return_value{false};
+  std::function<bool(const module_t* module)> body{
+      [this](const module_t* module) { return return_value; }};
+  bool operator()(const module_t* module) { return body(module); };
+};
+extern struct module_start_up module_start_up;
+
+}  // namespace btcore_module
+}  // namespace mock
+}  // namespace test
+
+// END mockcify generation
\ No newline at end of file
diff --git a/test/mock/mock_common_message_loop_thread.cc b/test/mock/mock_common_message_loop_thread.cc
index 7562a1d..cdad37a 100644
--- a/test/mock/mock_common_message_loop_thread.cc
+++ b/test/mock/mock_common_message_loop_thread.cc
@@ -117,6 +117,7 @@
   {
     if (is_main_ && init_flags::gd_rust_is_enabled()) {
       delete rust_thread_;
+      rust_thread_ = nullptr;
       thread_id_ = -1;
       linux_tid_ = -1;
       return;
diff --git a/test/mock/mock_device_esco_parameters.cc b/test/mock/mock_device_esco_parameters.cc
new file mode 100644
index 0000000..86410fe
--- /dev/null
+++ b/test/mock/mock_device_esco_parameters.cc
@@ -0,0 +1,53 @@
+/*
+ * 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:1
+ *
+ *  mockcify.pl ver 0.3.0
+ */
+
+#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_device_esco_parameters.h"
+
+// Mocked internal structures, if any
+
+namespace test {
+namespace mock {
+namespace device_esco_parameters {
+
+// Function state capture and return values, if needed
+struct esco_parameters_for_codec esco_parameters_for_codec;
+
+}  // namespace device_esco_parameters
+}  // namespace mock
+}  // namespace test
+
+// Mocked functions, if any
+enh_esco_params_t esco_parameters_for_codec(esco_codec_t codec) {
+  mock_function_count_map[__func__]++;
+  return test::mock::device_esco_parameters::esco_parameters_for_codec(codec);
+}
+// Mocked functions complete
+// END mockcify generation
diff --git a/test/mock/mock_device_esco_parameters.h b/test/mock/mock_device_esco_parameters.h
new file mode 100644
index 0000000..46116d9
--- /dev/null
+++ b/test/mock/mock_device_esco_parameters.h
@@ -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:1
+ *
+ *  mockcify.pl ver 0.3.0
+ */
+
+#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 from (or add to ) the inclusion set.
+#include "base/logging.h"
+#include "check.h"
+#include "device/include/esco_parameters.h"
+
+// Mocked compile conditionals, if any
+
+namespace test {
+namespace mock {
+namespace device_esco_parameters {
+
+// Shared state between mocked functions and tests
+// Name: esco_parameters_for_codec
+// Params: esco_codec_t codec
+// Return: enh_esco_params_t
+struct esco_parameters_for_codec {
+  enh_esco_params_t return_value{};
+  std::function<enh_esco_params_t(esco_codec_t codec)> body{
+      [this](esco_codec_t codec) { return return_value; }};
+  enh_esco_params_t operator()(esco_codec_t codec) { return body(codec); };
+};
+extern struct esco_parameters_for_codec esco_parameters_for_codec;
+
+}  // namespace device_esco_parameters
+}  // namespace mock
+}  // namespace test
+
+// END mockcify generation
diff --git a/test/mock/mock_osi_alarm.cc b/test/mock/mock_osi_alarm.cc
new file mode 100644
index 0000000..c171558
--- /dev/null
+++ b/test/mock/mock_osi_alarm.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:10
+ *
+ *  mockcify.pl ver 0.3.0
+ */
+
+#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_osi_alarm.h"
+
+// Mocked internal structures, if any
+
+namespace test {
+namespace mock {
+namespace osi_alarm {
+
+// Function state capture and return values, if needed
+struct alarm_cancel alarm_cancel;
+struct alarm_cleanup alarm_cleanup;
+struct alarm_debug_dump alarm_debug_dump;
+struct alarm_free alarm_free;
+struct alarm_get_remaining_ms alarm_get_remaining_ms;
+struct alarm_is_scheduled alarm_is_scheduled;
+struct alarm_new alarm_new;
+struct alarm_new_periodic alarm_new_periodic;
+struct alarm_set alarm_set;
+struct alarm_set_on_mloop alarm_set_on_mloop;
+
+}  // namespace osi_alarm
+}  // namespace mock
+}  // namespace test
+
+// Mocked functions, if any
+void alarm_cancel(alarm_t* alarm) {
+  mock_function_count_map[__func__]++;
+  test::mock::osi_alarm::alarm_cancel(alarm);
+}
+void alarm_cleanup(void) {
+  mock_function_count_map[__func__]++;
+  test::mock::osi_alarm::alarm_cleanup();
+}
+void alarm_debug_dump(int fd) {
+  mock_function_count_map[__func__]++;
+  test::mock::osi_alarm::alarm_debug_dump(fd);
+}
+void alarm_free(alarm_t* alarm) {
+  mock_function_count_map[__func__]++;
+  test::mock::osi_alarm::alarm_free(alarm);
+}
+uint64_t alarm_get_remaining_ms(const alarm_t* alarm) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_alarm::alarm_get_remaining_ms(alarm);
+}
+bool alarm_is_scheduled(const alarm_t* alarm) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_alarm::alarm_is_scheduled(alarm);
+}
+alarm_t* alarm_new(const char* name) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_alarm::alarm_new(name);
+}
+alarm_t* alarm_new_periodic(const char* name) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_alarm::alarm_new_periodic(name);
+}
+void alarm_set(alarm_t* alarm, uint64_t interval_ms, alarm_callback_t cb,
+               void* data) {
+  mock_function_count_map[__func__]++;
+  test::mock::osi_alarm::alarm_set(alarm, interval_ms, cb, data);
+}
+void alarm_set_on_mloop(alarm_t* alarm, uint64_t interval_ms,
+                        alarm_callback_t cb, void* data) {
+  mock_function_count_map[__func__]++;
+  test::mock::osi_alarm::alarm_set_on_mloop(alarm, interval_ms, cb, data);
+}
+// Mocked functions complete
+// END mockcify generation
diff --git a/test/mock/mock_osi_alarm.h b/test/mock/mock_osi_alarm.h
new file mode 100644
index 0000000..d1afdca
--- /dev/null
+++ b/test/mock/mock_osi_alarm.h
@@ -0,0 +1,185 @@
+/*
+ * 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.3.0
+ */
+
+#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 from (or add to ) the inclusion set.
+#include <base/cancelable_callback.h>
+#include <base/logging.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <hardware/bluetooth.h>
+#include <inttypes.h>
+#include <malloc.h>
+#include <pthread.h>
+#include <signal.h>
+#include <string.h>
+#include <time.h>
+
+#include <mutex>
+
+#include "check.h"
+#include "internal_include/bt_target.h"
+#include "osi/include/alarm.h"
+#include "osi/include/allocator.h"
+#include "osi/include/fixed_queue.h"
+#include "osi/include/list.h"
+#include "osi/include/log.h"
+#include "osi/include/osi.h"
+#include "osi/include/semaphore.h"
+#include "osi/include/thread.h"
+#include "osi/include/wakelock.h"
+#include "stack/include/btu.h"
+
+// Mocked compile conditionals, if any
+
+namespace test {
+namespace mock {
+namespace osi_alarm {
+
+// Shared state between mocked functions and tests
+// Name: alarm_cancel
+// Params: alarm_t* alarm
+// Return: void
+struct alarm_cancel {
+  std::function<void(alarm_t* alarm)> body{[](alarm_t* alarm) {}};
+  void operator()(alarm_t* alarm) { body(alarm); };
+};
+extern struct alarm_cancel alarm_cancel;
+
+// Name: alarm_cleanup
+// Params: void
+// Return: void
+struct alarm_cleanup {
+  std::function<void(void)> body{[](void) {}};
+  void operator()(void) { body(); };
+};
+extern struct alarm_cleanup alarm_cleanup;
+
+// Name: alarm_debug_dump
+// Params: int fd
+// Return: void
+struct alarm_debug_dump {
+  std::function<void(int fd)> body{[](int fd) {}};
+  void operator()(int fd) { body(fd); };
+};
+extern struct alarm_debug_dump alarm_debug_dump;
+
+// Name: alarm_free
+// Params: alarm_t* alarm
+// Return: void
+struct alarm_free {
+  std::function<void(alarm_t* alarm)> body{[](alarm_t* alarm) {}};
+  void operator()(alarm_t* alarm) { body(alarm); };
+};
+extern struct alarm_free alarm_free;
+
+// Name: alarm_get_remaining_ms
+// Params: const alarm_t* alarm
+// Return: uint64_t
+struct alarm_get_remaining_ms {
+  uint64_t return_value{0};
+  std::function<uint64_t(const alarm_t* alarm)> body{
+      [this](const alarm_t* alarm) { return return_value; }};
+  uint64_t operator()(const alarm_t* alarm) { return body(alarm); };
+};
+extern struct alarm_get_remaining_ms alarm_get_remaining_ms;
+
+// Name: alarm_is_scheduled
+// Params: const alarm_t* alarm
+// Return: bool
+struct alarm_is_scheduled {
+  bool return_value{false};
+  std::function<bool(const alarm_t* alarm)> body{
+      [this](const alarm_t* alarm) { return return_value; }};
+  bool operator()(const alarm_t* alarm) { return body(alarm); };
+};
+extern struct alarm_is_scheduled alarm_is_scheduled;
+
+// Name: alarm_new
+// Params: const char* name
+// Return: alarm_t*
+struct alarm_new {
+  alarm_t* return_value{0};
+  std::function<alarm_t*(const char* name)> body{
+      [this](const char* name) { return return_value; }};
+  alarm_t* operator()(const char* name) { return body(name); };
+};
+extern struct alarm_new alarm_new;
+
+// Name: alarm_new_periodic
+// Params: const char* name
+// Return: alarm_t*
+struct alarm_new_periodic {
+  alarm_t* return_value{0};
+  std::function<alarm_t*(const char* name)> body{
+      [this](const char* name) { return return_value; }};
+  alarm_t* operator()(const char* name) { return body(name); };
+};
+extern struct alarm_new_periodic alarm_new_periodic;
+
+// Name: alarm_set
+// Params: alarm_t* alarm, uint64_t interval_ms, alarm_callback_t cb, void* data
+// Return: void
+struct alarm_set {
+  std::function<void(alarm_t* alarm, uint64_t interval_ms, alarm_callback_t cb,
+                     void* data)>
+      body{[](alarm_t* alarm, uint64_t interval_ms, alarm_callback_t cb,
+              void* data) {}};
+  void operator()(alarm_t* alarm, uint64_t interval_ms, alarm_callback_t cb,
+                  void* data) {
+    body(alarm, interval_ms, cb, data);
+  };
+};
+extern struct alarm_set alarm_set;
+
+// Name: alarm_set_on_mloop
+// Params: alarm_t* alarm, uint64_t interval_ms, alarm_callback_t cb, void* data
+// Return: void
+struct alarm_set_on_mloop {
+  std::function<void(alarm_t* alarm, uint64_t interval_ms, alarm_callback_t cb,
+                     void* data)>
+      body{[](alarm_t* alarm, uint64_t interval_ms, alarm_callback_t cb,
+              void* data) {}};
+  void operator()(alarm_t* alarm, uint64_t interval_ms, alarm_callback_t cb,
+                  void* data) {
+    body(alarm, interval_ms, cb, data);
+  };
+};
+extern struct alarm_set_on_mloop alarm_set_on_mloop;
+
+}  // namespace osi_alarm
+}  // namespace mock
+}  // namespace test
+
+// END mockcify generation
\ No newline at end of file
diff --git a/test/mock/mock_osi_allocation_tracker.cc b/test/mock/mock_osi_allocation_tracker.cc
new file mode 100644
index 0000000..277343f
--- /dev/null
+++ b/test/mock/mock_osi_allocation_tracker.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:8
+ *
+ *  mockcify.pl ver 0.3.0
+ */
+
+#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_osi_allocation_tracker.h"
+
+// Mocked internal structures, if any
+
+namespace test {
+namespace mock {
+namespace osi_allocation_tracker {
+
+// Function state capture and return values, if needed
+struct allocation_tracker_expect_no_allocations
+    allocation_tracker_expect_no_allocations;
+struct allocation_tracker_init allocation_tracker_init;
+struct allocation_tracker_notify_alloc allocation_tracker_notify_alloc;
+struct allocation_tracker_notify_free allocation_tracker_notify_free;
+struct allocation_tracker_reset allocation_tracker_reset;
+struct allocation_tracker_resize_for_canary
+    allocation_tracker_resize_for_canary;
+struct allocation_tracker_uninit allocation_tracker_uninit;
+struct osi_allocator_debug_dump osi_allocator_debug_dump;
+
+}  // namespace osi_allocation_tracker
+}  // namespace mock
+}  // namespace test
+
+// Mocked functions, if any
+size_t allocation_tracker_expect_no_allocations(void) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_allocation_tracker::
+      allocation_tracker_expect_no_allocations();
+}
+void allocation_tracker_init(void) {
+  mock_function_count_map[__func__]++;
+  test::mock::osi_allocation_tracker::allocation_tracker_init();
+}
+void* allocation_tracker_notify_alloc(uint8_t allocator_id, void* ptr,
+                                      size_t requested_size) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_allocation_tracker::allocation_tracker_notify_alloc(
+      allocator_id, ptr, requested_size);
+}
+void* allocation_tracker_notify_free(uint8_t allocator_id, void* ptr) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_allocation_tracker::allocation_tracker_notify_free(
+      allocator_id, ptr);
+}
+void allocation_tracker_reset(void) {
+  mock_function_count_map[__func__]++;
+  test::mock::osi_allocation_tracker::allocation_tracker_reset();
+}
+size_t allocation_tracker_resize_for_canary(size_t size) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_allocation_tracker::
+      allocation_tracker_resize_for_canary(size);
+}
+void allocation_tracker_uninit(void) {
+  mock_function_count_map[__func__]++;
+  test::mock::osi_allocation_tracker::allocation_tracker_uninit();
+}
+void osi_allocator_debug_dump(int fd) {
+  mock_function_count_map[__func__]++;
+  test::mock::osi_allocation_tracker::osi_allocator_debug_dump(fd);
+}
+// Mocked functions complete
+// END mockcify generation
diff --git a/test/mock/mock_osi_allocation_tracker.h b/test/mock/mock_osi_allocation_tracker.h
new file mode 100644
index 0000000..32ceab0
--- /dev/null
+++ b/test/mock/mock_osi_allocation_tracker.h
@@ -0,0 +1,148 @@
+/*
+ * 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
+ *
+ *  mockcify.pl ver 0.3.0
+ */
+
+#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 from (or add to ) the inclusion set.
+#include <base/logging.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <mutex>
+#include <unordered_map>
+
+#include "check.h"
+#include "osi/include/allocation_tracker.h"
+#include "osi/include/allocator.h"
+#include "osi/include/log.h"
+#include "osi/include/osi.h"
+
+// Mocked compile conditionals, if any
+
+namespace test {
+namespace mock {
+namespace osi_allocation_tracker {
+
+// Shared state between mocked functions and tests
+// Name: allocation_tracker_expect_no_allocations
+// Params: void
+// Return: size_t
+struct allocation_tracker_expect_no_allocations {
+  size_t return_value{0};
+  std::function<size_t(void)> body{[this](void) { return return_value; }};
+  size_t operator()(void) { return body(); };
+};
+extern struct allocation_tracker_expect_no_allocations
+    allocation_tracker_expect_no_allocations;
+
+// Name: allocation_tracker_init
+// Params: void
+// Return: void
+struct allocation_tracker_init {
+  std::function<void(void)> body{[](void) {}};
+  void operator()(void) { body(); };
+};
+extern struct allocation_tracker_init allocation_tracker_init;
+
+// Name: allocation_tracker_notify_alloc
+// Params: uint8_t allocator_id, void* ptr, size_t requested_size
+// Return: void*
+struct allocation_tracker_notify_alloc {
+  void* return_value{};
+  std::function<void*(uint8_t allocator_id, void* ptr, size_t requested_size)>
+      body{[this](uint8_t allocator_id, void* ptr, size_t requested_size) {
+        return return_value;
+      }};
+  void* operator()(uint8_t allocator_id, void* ptr, size_t requested_size) {
+    return body(allocator_id, ptr, requested_size);
+  };
+};
+extern struct allocation_tracker_notify_alloc allocation_tracker_notify_alloc;
+
+// Name: allocation_tracker_notify_free
+// Params:  uint8_t allocator_id, void* ptr
+// Return: void*
+struct allocation_tracker_notify_free {
+  void* return_value{};
+  std::function<void*(uint8_t allocator_id, void* ptr)> body{
+      [this](uint8_t allocator_id, void* ptr) { return return_value; }};
+  void* operator()(uint8_t allocator_id, void* ptr) {
+    return body(allocator_id, ptr);
+  };
+};
+extern struct allocation_tracker_notify_free allocation_tracker_notify_free;
+
+// Name: allocation_tracker_reset
+// Params: void
+// Return: void
+struct allocation_tracker_reset {
+  std::function<void(void)> body{[](void) {}};
+  void operator()(void) { body(); };
+};
+extern struct allocation_tracker_reset allocation_tracker_reset;
+
+// Name: allocation_tracker_resize_for_canary
+// Params: size_t size
+// Return: size_t
+struct allocation_tracker_resize_for_canary {
+  size_t return_value{0};
+  std::function<size_t(size_t size)> body{
+      [this](size_t size) { return return_value; }};
+  size_t operator()(size_t size) { return body(size); };
+};
+extern struct allocation_tracker_resize_for_canary
+    allocation_tracker_resize_for_canary;
+
+// Name: allocation_tracker_uninit
+// Params: void
+// Return: void
+struct allocation_tracker_uninit {
+  std::function<void(void)> body{[](void) {}};
+  void operator()(void) { body(); };
+};
+extern struct allocation_tracker_uninit allocation_tracker_uninit;
+
+// Name: osi_allocator_debug_dump
+// Params: int fd
+// Return: void
+struct osi_allocator_debug_dump {
+  std::function<void(int fd)> body{[](int fd) {}};
+  void operator()(int fd) { body(fd); };
+};
+extern struct osi_allocator_debug_dump osi_allocator_debug_dump;
+
+}  // namespace osi_allocation_tracker
+}  // namespace mock
+}  // namespace test
+
+// END mockcify generation
\ No newline at end of file
diff --git a/test/mock/mock_osi_allocator.cc b/test/mock/mock_osi_allocator.cc
new file mode 100644
index 0000000..d939085
--- /dev/null
+++ b/test/mock/mock_osi_allocator.cc
@@ -0,0 +1,78 @@
+/*
+ * 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
+ *
+ *  mockcify.pl ver 0.3.0
+ */
+
+#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_osi_allocator.h"
+
+// Mocked internal structures, if any
+
+namespace test {
+namespace mock {
+namespace osi_allocator {
+
+// Function state capture and return values, if needed
+struct osi_calloc osi_calloc;
+struct osi_free osi_free;
+struct osi_free_and_reset osi_free_and_reset;
+struct osi_malloc osi_malloc;
+struct osi_strdup osi_strdup;
+struct osi_strndup osi_strndup;
+
+}  // namespace osi_allocator
+}  // namespace mock
+}  // namespace test
+
+// Mocked functions, if any
+void* osi_calloc(size_t size) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_allocator::osi_calloc(size);
+}
+void osi_free(void* ptr) {
+  mock_function_count_map[__func__]++;
+  test::mock::osi_allocator::osi_free(ptr);
+}
+void osi_free_and_reset(void** p_ptr) {
+  mock_function_count_map[__func__]++;
+  test::mock::osi_allocator::osi_free_and_reset(p_ptr);
+}
+void* osi_malloc(size_t size) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_allocator::osi_malloc(size);
+}
+char* osi_strdup(const char* str) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_allocator::osi_strdup(str);
+}
+char* osi_strndup(const char* str, size_t len) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_allocator::osi_strndup(str, len);
+}
+// Mocked functions complete
+// END mockcify generation
diff --git a/test/mock/mock_osi_allocator.h b/test/mock/mock_osi_allocator.h
new file mode 100644
index 0000000..4f845f5
--- /dev/null
+++ b/test/mock/mock_osi_allocator.h
@@ -0,0 +1,118 @@
+/*
+ * 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
+ *
+ *  mockcify.pl ver 0.3.0
+ */
+
+#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 from (or add to ) the inclusion set.
+#include <base/logging.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "check.h"
+#include "osi/include/allocation_tracker.h"
+#include "osi/include/allocator.h"
+
+// Mocked compile conditionals, if any
+
+namespace test {
+namespace mock {
+namespace osi_allocator {
+
+// Shared state between mocked functions and tests
+// Name: osi_calloc
+// Params: size_t size
+// Return: void*
+struct osi_calloc {
+  void* return_value{};
+  std::function<void*(size_t size)> body{
+      [this](size_t size) { return return_value; }};
+  void* operator()(size_t size) { return body(size); };
+};
+extern struct osi_calloc osi_calloc;
+
+// Name: osi_free
+// Params: void* ptr
+// Return: void
+struct osi_free {
+  std::function<void(void* ptr)> body{[](void* ptr) {}};
+  void operator()(void* ptr) { body(ptr); };
+};
+extern struct osi_free osi_free;
+
+// Name: osi_free_and_reset
+// Params: void** p_ptr
+// Return: void
+struct osi_free_and_reset {
+  std::function<void(void** p_ptr)> body{[](void** p_ptr) {}};
+  void operator()(void** p_ptr) { body(p_ptr); };
+};
+extern struct osi_free_and_reset osi_free_and_reset;
+
+// Name: osi_malloc
+// Params: size_t size
+// Return: void*
+struct osi_malloc {
+  void* return_value{};
+  std::function<void*(size_t size)> body{
+      [this](size_t size) { return return_value; }};
+  void* operator()(size_t size) { return body(size); };
+};
+extern struct osi_malloc osi_malloc;
+
+// Name: osi_strdup
+// Params: const char* str
+// Return: char*
+struct osi_strdup {
+  char* return_value{0};
+  std::function<char*(const char* str)> body{
+      [this](const char* str) { return return_value; }};
+  char* operator()(const char* str) { return body(str); };
+};
+extern struct osi_strdup osi_strdup;
+
+// Name: osi_strndup
+// Params: const char* str, size_t len
+// Return: char*
+struct osi_strndup {
+  char* return_value{0};
+  std::function<char*(const char* str, size_t len)> body{
+      [this](const char* str, size_t len) { return return_value; }};
+  char* operator()(const char* str, size_t len) { return body(str, len); };
+};
+extern struct osi_strndup osi_strndup;
+
+}  // namespace osi_allocator
+}  // namespace mock
+}  // namespace test
+
+// END mockcify generation
\ No newline at end of file
diff --git a/test/mock/mock_osi_config.cc b/test/mock/mock_osi_config.cc
new file mode 100644
index 0000000..7e57df6
--- /dev/null
+++ b/test/mock/mock_osi_config.cc
@@ -0,0 +1,179 @@
+/*
+ * 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:24
+ *
+ *  mockcify.pl ver 0.3.0
+ */
+
+#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_osi_config.h"
+
+// Mocked internal structures, if any
+
+namespace test {
+namespace mock {
+namespace osi_config {
+
+// Function state capture and return values, if needed
+struct checksum_read checksum_read;
+struct checksum_save checksum_save;
+struct config_get_bool config_get_bool;
+struct config_get_int config_get_int;
+struct config_get_string config_get_string;
+struct config_get_uint64 config_get_uint64;
+struct config_has_key config_has_key;
+struct config_has_section config_has_section;
+struct config_new config_new;
+struct config_new_clone config_new_clone;
+struct config_new_empty config_new_empty;
+struct config_remove_key config_remove_key;
+struct config_remove_section config_remove_section;
+struct config_save config_save;
+struct config_set_bool config_set_bool;
+struct config_set_int config_set_int;
+struct config_set_string config_set_string;
+struct config_set_uint64 config_set_uint64;
+struct config_t_Find config_t_Find;
+struct config_t_Has config_t_Has;
+struct section_t_Find section_t_Find;
+struct section_t_Has section_t_Has;
+struct section_t_Set section_t_Set;
+
+}  // namespace osi_config
+}  // namespace mock
+}  // namespace test
+
+// Mocked functions, if any
+std::string checksum_read(const char* filename) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_config::checksum_read(filename);
+}
+bool checksum_save(const std::string& checksum, const std::string& filename) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_config::checksum_save(checksum, filename);
+}
+bool config_get_bool(const config_t& config, const std::string& section,
+                     const std::string& key, bool def_value) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_config::config_get_bool(config, section, key,
+                                                 def_value);
+}
+int config_get_int(const config_t& config, const std::string& section,
+                   const std::string& key, int def_value) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_config::config_get_int(config, section, key,
+                                                def_value);
+}
+const std::string* config_get_string(const config_t& config,
+                                     const std::string& section,
+                                     const std::string& key,
+                                     const std::string* def_value) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_config::config_get_string(config, section, key,
+                                                   def_value);
+}
+uint64_t config_get_uint64(const config_t& config, const std::string& section,
+                           const std::string& key, uint64_t def_value) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_config::config_get_uint64(config, section, key,
+                                                   def_value);
+}
+bool config_has_key(const config_t& config, const std::string& section,
+                    const std::string& key) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_config::config_has_key(config, section, key);
+}
+bool config_has_section(const config_t& config, const std::string& section) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_config::config_has_section(config, section);
+}
+std::unique_ptr<config_t> config_new(const char* filename) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_config::config_new(filename);
+}
+std::unique_ptr<config_t> config_new_clone(const config_t& src) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_config::config_new_clone(src);
+}
+std::unique_ptr<config_t> config_new_empty(void) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_config::config_new_empty();
+}
+bool config_remove_key(config_t* config, const std::string& section,
+                       const std::string& key) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_config::config_remove_key(config, section, key);
+}
+bool config_remove_section(config_t* config, const std::string& section) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_config::config_remove_section(config, section);
+}
+bool config_save(const config_t& config, const std::string& filename) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_config::config_save(config, filename);
+}
+void config_set_bool(config_t* config, const std::string& section,
+                     const std::string& key, bool value) {
+  mock_function_count_map[__func__]++;
+  test::mock::osi_config::config_set_bool(config, section, key, value);
+}
+void config_set_int(config_t* config, const std::string& section,
+                    const std::string& key, int value) {
+  mock_function_count_map[__func__]++;
+  test::mock::osi_config::config_set_int(config, section, key, value);
+}
+void config_set_string(config_t* config, const std::string& section,
+                       const std::string& key, const std::string& value) {
+  mock_function_count_map[__func__]++;
+  test::mock::osi_config::config_set_string(config, section, key, value);
+}
+void config_set_uint64(config_t* config, const std::string& section,
+                       const std::string& key, uint64_t value) {
+  mock_function_count_map[__func__]++;
+  test::mock::osi_config::config_set_uint64(config, section, key, value);
+}
+std::list<section_t>::iterator config_t::Find(const std::string& section) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_config::config_t_Find(section);
+}
+bool config_t::Has(const std::string& key) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_config::config_t_Has(key);
+}
+std::list<entry_t>::iterator section_t::Find(const std::string& key) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_config::section_t_Find(key);
+}
+bool section_t::Has(const std::string& key) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_config::section_t_Has(key);
+}
+void section_t::Set(std::string key, std::string value) {
+  mock_function_count_map[__func__]++;
+  test::mock::osi_config::section_t_Set(key, value);
+}
+// Mocked functions complete
+// END mockcify generation
diff --git a/test/mock/mock_osi_config.h b/test/mock/mock_osi_config.h
new file mode 100644
index 0000000..4924b07
--- /dev/null
+++ b/test/mock/mock_osi_config.h
@@ -0,0 +1,393 @@
+/*
+ * 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:24
+ *
+ *  mockcify.pl ver 0.3.0
+ */
+
+#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 from (or add to ) the inclusion set.
+#include <base/files/file_util.h>
+#include <base/logging.h>
+#include <ctype.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <libgen.h>
+#include <log/log.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+#include <sstream>
+#include <type_traits>
+
+#include "check.h"
+#include "osi/include/config.h"
+
+// Mocked compile conditionals, if any
+
+namespace test {
+namespace mock {
+namespace osi_config {
+
+// Shared state between mocked functions and tests
+// Name: checksum_read
+// Params: const char* filename
+// Return: std::string
+struct checksum_read {
+  std::string return_value{std::string()};
+  std::function<std::string(const char* filename)> body{
+      [this](const char* filename) { return return_value; }};
+  std::string operator()(const char* filename) { return body(filename); };
+};
+extern struct checksum_read checksum_read;
+
+// Name: checksum_save
+// Params: const std::string& checksum, const std::string& filename
+// Return: bool
+struct checksum_save {
+  bool return_value{false};
+  std::function<bool(const std::string& checksum, const std::string& filename)>
+      body{[this](const std::string& checksum, const std::string& filename) {
+        return return_value;
+      }};
+  bool operator()(const std::string& checksum, const std::string& filename) {
+    return body(checksum, filename);
+  };
+};
+extern struct checksum_save checksum_save;
+
+// Name: config_get_bool
+// Params: const config_t& config, const std::string& section, const
+// std::string& key, bool def_value Return: bool
+struct config_get_bool {
+  bool return_value{false};
+  std::function<bool(const config_t& config, const std::string& section,
+                     const std::string& key, bool def_value)>
+      body{[this](const config_t& config, const std::string& section,
+                  const std::string& key,
+                  bool def_value) { return return_value; }};
+  bool operator()(const config_t& config, const std::string& section,
+                  const std::string& key, bool def_value) {
+    return body(config, section, key, def_value);
+  };
+};
+extern struct config_get_bool config_get_bool;
+
+// Name: config_get_int
+// Params: const config_t& config, const std::string& section, const
+// std::string& key, int def_value Return: int
+struct config_get_int {
+  int return_value{0};
+  std::function<int(const config_t& config, const std::string& section,
+                    const std::string& key, int def_value)>
+      body{[this](const config_t& config, const std::string& section,
+                  const std::string& key,
+                  int def_value) { return return_value; }};
+  int operator()(const config_t& config, const std::string& section,
+                 const std::string& key, int def_value) {
+    return body(config, section, key, def_value);
+  };
+};
+extern struct config_get_int config_get_int;
+
+// Name: config_get_string
+// Params: const config_t& config, const std::string& section, const
+// std::string& key, const std::string* def_value Return: const std::string*
+struct config_get_string {
+  const std::string* return_value{0};
+  std::function<const std::string*(
+      const config_t& config, const std::string& section,
+      const std::string& key, const std::string* def_value)>
+      body{[this](const config_t& config, const std::string& section,
+                  const std::string& key,
+                  const std::string* def_value) { return return_value; }};
+  const std::string* operator()(const config_t& config,
+                                const std::string& section,
+                                const std::string& key,
+                                const std::string* def_value) {
+    return body(config, section, key, def_value);
+  };
+};
+extern struct config_get_string config_get_string;
+
+// Name: config_get_uint64
+// Params: const config_t& config, const std::string& section, const
+// std::string& key, uint64_t def_value Return: uint64_t
+struct config_get_uint64 {
+  uint64_t return_value{0};
+  std::function<uint64_t(const config_t& config, const std::string& section,
+                         const std::string& key, uint64_t def_value)>
+      body{[this](const config_t& config, const std::string& section,
+                  const std::string& key,
+                  uint64_t def_value) { return return_value; }};
+  uint64_t operator()(const config_t& config, const std::string& section,
+                      const std::string& key, uint64_t def_value) {
+    return body(config, section, key, def_value);
+  };
+};
+extern struct config_get_uint64 config_get_uint64;
+
+// Name: config_has_key
+// Params: const config_t& config, const std::string& section, const
+// std::string& key Return: bool
+struct config_has_key {
+  bool return_value{false};
+  std::function<bool(const config_t& config, const std::string& section,
+                     const std::string& key)>
+      body{[this](const config_t& config, const std::string& section,
+                  const std::string& key) { return return_value; }};
+  bool operator()(const config_t& config, const std::string& section,
+                  const std::string& key) {
+    return body(config, section, key);
+  };
+};
+extern struct config_has_key config_has_key;
+
+// Name: config_has_section
+// Params: const config_t& config, const std::string& section
+// Return: bool
+struct config_has_section {
+  bool return_value{false};
+  std::function<bool(const config_t& config, const std::string& section)> body{
+      [this](const config_t& config, const std::string& section) {
+        return return_value;
+      }};
+  bool operator()(const config_t& config, const std::string& section) {
+    return body(config, section);
+  };
+};
+extern struct config_has_section config_has_section;
+
+// Name: config_new
+// Params: const char* filename
+// Return: std::unique_ptr<config_t>
+struct config_new {
+  std::function<std::unique_ptr<config_t>(const char* filename)> body{
+      [](const char* filename) { return std::make_unique<config_t>(); }};
+  std::unique_ptr<config_t> operator()(const char* filename) {
+    return body(filename);
+  };
+};
+extern struct config_new config_new;
+
+// Name: config_new_clone
+// Params: const config_t& src
+// Return: std::unique_ptr<config_t>
+struct config_new_clone {
+  std::function<std::unique_ptr<config_t>(const config_t& src)> body{
+      [](const config_t& src) { return std::make_unique<config_t>(); }};
+  std::unique_ptr<config_t> operator()(const config_t& src) {
+    return body(src);
+  };
+};
+extern struct config_new_clone config_new_clone;
+
+// Name: config_new_empty
+// Params: void
+// Return: std::unique_ptr<config_t>
+struct config_new_empty {
+  std::function<std::unique_ptr<config_t>(void)> body{
+      [](void) { return std::make_unique<config_t>(); }};
+  std::unique_ptr<config_t> operator()(void) { return body(); };
+};
+extern struct config_new_empty config_new_empty;
+
+// Name: config_remove_key
+// Params: config_t* config, const std::string& section, const std::string& key
+// Return: bool
+struct config_remove_key {
+  bool return_value{false};
+  std::function<bool(config_t* config, const std::string& section,
+                     const std::string& key)>
+      body{[this](config_t* config, const std::string& section,
+                  const std::string& key) { return return_value; }};
+  bool operator()(config_t* config, const std::string& section,
+                  const std::string& key) {
+    return body(config, section, key);
+  };
+};
+extern struct config_remove_key config_remove_key;
+
+// Name: config_remove_section
+// Params: config_t* config, const std::string& section
+// Return: bool
+struct config_remove_section {
+  bool return_value{false};
+  std::function<bool(config_t* config, const std::string& section)> body{
+      [this](config_t* config, const std::string& section) {
+        return return_value;
+      }};
+  bool operator()(config_t* config, const std::string& section) {
+    return body(config, section);
+  };
+};
+extern struct config_remove_section config_remove_section;
+
+// Name: config_save
+// Params: const config_t& config, const std::string& filename
+// Return: bool
+struct config_save {
+  bool return_value{false};
+  std::function<bool(const config_t& config, const std::string& filename)> body{
+      [this](const config_t& config, const std::string& filename) {
+        return return_value;
+      }};
+  bool operator()(const config_t& config, const std::string& filename) {
+    return body(config, filename);
+  };
+};
+extern struct config_save config_save;
+
+// Name: config_set_bool
+// Params: config_t* config, const std::string& section, const std::string& key,
+// bool value Return: void
+struct config_set_bool {
+  std::function<void(config_t* config, const std::string& section,
+                     const std::string& key, bool value)>
+      body{[](config_t* config, const std::string& section,
+              const std::string& key, bool value) {}};
+  void operator()(config_t* config, const std::string& section,
+                  const std::string& key, bool value) {
+    body(config, section, key, value);
+  };
+};
+extern struct config_set_bool config_set_bool;
+
+// Name: config_set_int
+// Params: config_t* config, const std::string& section, const std::string& key,
+// int value Return: void
+struct config_set_int {
+  std::function<void(config_t* config, const std::string& section,
+                     const std::string& key, int value)>
+      body{[](config_t* config, const std::string& section,
+              const std::string& key, int value) {}};
+  void operator()(config_t* config, const std::string& section,
+                  const std::string& key, int value) {
+    body(config, section, key, value);
+  };
+};
+extern struct config_set_int config_set_int;
+
+// Name: config_set_string
+// Params: config_t* config, const std::string& section, const std::string& key,
+// const std::string& value Return: void
+struct config_set_string {
+  std::function<void(config_t* config, const std::string& section,
+                     const std::string& key, const std::string& value)>
+      body{[](config_t* config, const std::string& section,
+              const std::string& key, const std::string& value) {}};
+  void operator()(config_t* config, const std::string& section,
+                  const std::string& key, const std::string& value) {
+    body(config, section, key, value);
+  };
+};
+extern struct config_set_string config_set_string;
+
+// Name: config_set_uint64
+// Params: config_t* config, const std::string& section, const std::string& key,
+// uint64_t value Return: void
+struct config_set_uint64 {
+  std::function<void(config_t* config, const std::string& section,
+                     const std::string& key, uint64_t value)>
+      body{[](config_t* config, const std::string& section,
+              const std::string& key, uint64_t value) {}};
+  void operator()(config_t* config, const std::string& section,
+                  const std::string& key, uint64_t value) {
+    body(config, section, key, value);
+  };
+};
+extern struct config_set_uint64 config_set_uint64;
+
+// Name: config_t::Find
+// Params: const std::string& section
+// Return: std::list<section_t>::iterator
+struct config_t_Find {
+  std::list<section_t> section_;
+  std::function<std::list<section_t>::iterator(const std::string& section)>
+      body{[this](const std::string& section) { return section_.begin(); }};
+  std::list<section_t>::iterator operator()(const std::string& section) {
+    return body(section);
+  };
+};
+extern struct config_t_Find config_t_Find;
+
+// Name: config_t_Has
+// Params: const std::string& key
+// Return: bool
+struct config_t_Has {
+  bool return_value{false};
+  std::function<bool(const std::string& key)> body{
+      [this](const std::string& key) { return return_value; }};
+  bool operator()(const std::string& key) { return body(key); };
+};
+extern struct config_t_Has config_t_Has;
+
+// Name: section_t_Find
+// Params: const std::string& key
+// Return: std::list<entry_t>::iterator
+struct section_t_Find {
+  std::list<entry_t> list_;
+  std::function<std::list<entry_t>::iterator(const std::string& key)> body{
+      [this](const std::string& key) { return list_.begin(); }};
+  std::list<entry_t>::iterator operator()(const std::string& key) {
+    return body(key);
+  };
+};
+extern struct section_t_Find section_t_Find;
+
+// Name: section_t_Has
+// Params: const std::string& key
+// Return: bool
+struct section_t_Has {
+  bool return_value{false};
+  std::function<bool(const std::string& key)> body{
+      [this](const std::string& key) { return return_value; }};
+  bool operator()(const std::string& key) { return body(key); };
+};
+extern struct section_t_Has section_t_Has;
+
+// Name: section_t_Set
+// Params: std::string key, std::string value
+// Return: void
+struct section_t_Set {
+  std::function<void(std::string key, std::string value)> body{
+      [](std::string key, std::string value) {}};
+  void operator()(std::string key, std::string value) { body(key, value); };
+};
+extern struct section_t_Set section_t_Set;
+
+}  // namespace osi_config
+}  // namespace mock
+}  // namespace test
+
+// END mockcify generation
diff --git a/test/mock/mock_osi_fixed_queue.cc b/test/mock/mock_osi_fixed_queue.cc
new file mode 100644
index 0000000..5157049
--- /dev/null
+++ b/test/mock/mock_osi_fixed_queue.cc
@@ -0,0 +1,141 @@
+/*
+ * 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:18
+ *
+ *  mockcify.pl ver 0.3.0
+ */
+
+#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_osi_fixed_queue.h"
+
+// Mocked internal structures, if any
+
+namespace test {
+namespace mock {
+namespace osi_fixed_queue {
+
+// Function state capture and return values, if needed
+struct fixed_queue_capacity fixed_queue_capacity;
+struct fixed_queue_dequeue fixed_queue_dequeue;
+struct fixed_queue_enqueue fixed_queue_enqueue;
+struct fixed_queue_flush fixed_queue_flush;
+struct fixed_queue_free fixed_queue_free;
+struct fixed_queue_get_dequeue_fd fixed_queue_get_dequeue_fd;
+struct fixed_queue_get_enqueue_fd fixed_queue_get_enqueue_fd;
+struct fixed_queue_get_list fixed_queue_get_list;
+struct fixed_queue_is_empty fixed_queue_is_empty;
+struct fixed_queue_length fixed_queue_length;
+struct fixed_queue_new fixed_queue_new;
+struct fixed_queue_register_dequeue fixed_queue_register_dequeue;
+struct fixed_queue_try_dequeue fixed_queue_try_dequeue;
+struct fixed_queue_try_enqueue fixed_queue_try_enqueue;
+struct fixed_queue_try_peek_first fixed_queue_try_peek_first;
+struct fixed_queue_try_peek_last fixed_queue_try_peek_last;
+struct fixed_queue_try_remove_from_queue fixed_queue_try_remove_from_queue;
+struct fixed_queue_unregister_dequeue fixed_queue_unregister_dequeue;
+
+}  // namespace osi_fixed_queue
+}  // namespace mock
+}  // namespace test
+
+// Mocked functions, if any
+size_t fixed_queue_capacity(fixed_queue_t* queue) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_fixed_queue::fixed_queue_capacity(queue);
+}
+void* fixed_queue_dequeue(fixed_queue_t* queue) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_fixed_queue::fixed_queue_dequeue(queue);
+}
+void fixed_queue_enqueue(fixed_queue_t* queue, void* data) {
+  mock_function_count_map[__func__]++;
+  test::mock::osi_fixed_queue::fixed_queue_enqueue(queue, data);
+}
+void fixed_queue_flush(fixed_queue_t* queue, fixed_queue_free_cb free_cb) {
+  mock_function_count_map[__func__]++;
+  test::mock::osi_fixed_queue::fixed_queue_flush(queue, free_cb);
+}
+void fixed_queue_free(fixed_queue_t* queue, fixed_queue_free_cb free_cb) {
+  mock_function_count_map[__func__]++;
+  test::mock::osi_fixed_queue::fixed_queue_free(queue, free_cb);
+}
+int fixed_queue_get_dequeue_fd(const fixed_queue_t* queue) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_fixed_queue::fixed_queue_get_dequeue_fd(queue);
+}
+int fixed_queue_get_enqueue_fd(const fixed_queue_t* queue) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_fixed_queue::fixed_queue_get_enqueue_fd(queue);
+}
+list_t* fixed_queue_get_list(fixed_queue_t* queue) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_fixed_queue::fixed_queue_get_list(queue);
+}
+bool fixed_queue_is_empty(fixed_queue_t* queue) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_fixed_queue::fixed_queue_is_empty(queue);
+}
+size_t fixed_queue_length(fixed_queue_t* queue) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_fixed_queue::fixed_queue_length(queue);
+}
+fixed_queue_t* fixed_queue_new(size_t capacity) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_fixed_queue::fixed_queue_new(capacity);
+}
+void fixed_queue_register_dequeue(fixed_queue_t* queue, reactor_t* reactor,
+                                  fixed_queue_cb ready_cb, void* context) {
+  mock_function_count_map[__func__]++;
+  test::mock::osi_fixed_queue::fixed_queue_register_dequeue(queue, reactor,
+                                                            ready_cb, context);
+}
+void* fixed_queue_try_dequeue(fixed_queue_t* queue) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_fixed_queue::fixed_queue_try_dequeue(queue);
+}
+bool fixed_queue_try_enqueue(fixed_queue_t* queue, void* data) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_fixed_queue::fixed_queue_try_enqueue(queue, data);
+}
+void* fixed_queue_try_peek_first(fixed_queue_t* queue) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_fixed_queue::fixed_queue_try_peek_first(queue);
+}
+void* fixed_queue_try_peek_last(fixed_queue_t* queue) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_fixed_queue::fixed_queue_try_peek_last(queue);
+}
+void* fixed_queue_try_remove_from_queue(fixed_queue_t* queue, void* data) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_fixed_queue::fixed_queue_try_remove_from_queue(queue,
+                                                                        data);
+}
+void fixed_queue_unregister_dequeue(fixed_queue_t* queue) {
+  mock_function_count_map[__func__]++;
+  test::mock::osi_fixed_queue::fixed_queue_unregister_dequeue(queue);
+}
+// Mocked functions complete
+// END mockcify generation
diff --git a/test/mock/mock_osi_fixed_queue.h b/test/mock/mock_osi_fixed_queue.h
new file mode 100644
index 0000000..0534ef8
--- /dev/null
+++ b/test/mock/mock_osi_fixed_queue.h
@@ -0,0 +1,267 @@
+/*
+ * 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:18
+ *
+ *  mockcify.pl ver 0.3.0
+ */
+
+#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 from (or add to ) the inclusion set.
+#include <base/logging.h>
+#include <string.h>
+
+#include <mutex>
+
+#include "check.h"
+#include "osi/include/allocator.h"
+#include "osi/include/fixed_queue.h"
+#include "osi/include/list.h"
+#include "osi/include/osi.h"
+#include "osi/include/reactor.h"
+#include "osi/include/semaphore.h"
+
+// Mocked compile conditionals, if any
+
+namespace test {
+namespace mock {
+namespace osi_fixed_queue {
+
+// Shared state between mocked functions and tests
+// Name: fixed_queue_capacity
+// Params: fixed_queue_t* queue
+// Return: size_t
+struct fixed_queue_capacity {
+  size_t return_value{0};
+  std::function<size_t(fixed_queue_t* queue)> body{
+      [this](fixed_queue_t* queue) { return return_value; }};
+  size_t operator()(fixed_queue_t* queue) { return body(queue); };
+};
+extern struct fixed_queue_capacity fixed_queue_capacity;
+
+// Name: fixed_queue_dequeue
+// Params: fixed_queue_t* queue
+// Return: void*
+struct fixed_queue_dequeue {
+  void* return_value{};
+  std::function<void*(fixed_queue_t* queue)> body{
+      [this](fixed_queue_t* queue) { return return_value; }};
+  void* operator()(fixed_queue_t* queue) { return body(queue); };
+};
+extern struct fixed_queue_dequeue fixed_queue_dequeue;
+
+// Name: fixed_queue_enqueue
+// Params: fixed_queue_t* queue, void* data
+// Return: void
+struct fixed_queue_enqueue {
+  std::function<void(fixed_queue_t* queue, void* data)> body{
+      [](fixed_queue_t* queue, void* data) {}};
+  void operator()(fixed_queue_t* queue, void* data) { body(queue, data); };
+};
+extern struct fixed_queue_enqueue fixed_queue_enqueue;
+
+// Name: fixed_queue_flush
+// Params: fixed_queue_t* queue, fixed_queue_free_cb free_cb
+// Return: void
+struct fixed_queue_flush {
+  std::function<void(fixed_queue_t* queue, fixed_queue_free_cb free_cb)> body{
+      [](fixed_queue_t* queue, fixed_queue_free_cb free_cb) {}};
+  void operator()(fixed_queue_t* queue, fixed_queue_free_cb free_cb) {
+    body(queue, free_cb);
+  };
+};
+extern struct fixed_queue_flush fixed_queue_flush;
+
+// Name: fixed_queue_free
+// Params: fixed_queue_t* queue, fixed_queue_free_cb free_cb
+// Return: void
+struct fixed_queue_free {
+  std::function<void(fixed_queue_t* queue, fixed_queue_free_cb free_cb)> body{
+      [](fixed_queue_t* queue, fixed_queue_free_cb free_cb) {}};
+  void operator()(fixed_queue_t* queue, fixed_queue_free_cb free_cb) {
+    body(queue, free_cb);
+  };
+};
+extern struct fixed_queue_free fixed_queue_free;
+
+// Name: fixed_queue_get_dequeue_fd
+// Params: const fixed_queue_t* queue
+// Return: int
+struct fixed_queue_get_dequeue_fd {
+  int return_value{0};
+  std::function<int(const fixed_queue_t* queue)> body{
+      [this](const fixed_queue_t* queue) { return return_value; }};
+  int operator()(const fixed_queue_t* queue) { return body(queue); };
+};
+extern struct fixed_queue_get_dequeue_fd fixed_queue_get_dequeue_fd;
+
+// Name: fixed_queue_get_enqueue_fd
+// Params: const fixed_queue_t* queue
+// Return: int
+struct fixed_queue_get_enqueue_fd {
+  int return_value{0};
+  std::function<int(const fixed_queue_t* queue)> body{
+      [this](const fixed_queue_t* queue) { return return_value; }};
+  int operator()(const fixed_queue_t* queue) { return body(queue); };
+};
+extern struct fixed_queue_get_enqueue_fd fixed_queue_get_enqueue_fd;
+
+// Name: fixed_queue_get_list
+// Params: fixed_queue_t* queue
+// Return: list_t*
+struct fixed_queue_get_list {
+  list_t* return_value{0};
+  std::function<list_t*(fixed_queue_t* queue)> body{
+      [this](fixed_queue_t* queue) { return return_value; }};
+  list_t* operator()(fixed_queue_t* queue) { return body(queue); };
+};
+extern struct fixed_queue_get_list fixed_queue_get_list;
+
+// Name: fixed_queue_is_empty
+// Params: fixed_queue_t* queue
+// Return: bool
+struct fixed_queue_is_empty {
+  bool return_value{false};
+  std::function<bool(fixed_queue_t* queue)> body{
+      [this](fixed_queue_t* queue) { return return_value; }};
+  bool operator()(fixed_queue_t* queue) { return body(queue); };
+};
+extern struct fixed_queue_is_empty fixed_queue_is_empty;
+
+// Name: fixed_queue_length
+// Params: fixed_queue_t* queue
+// Return: size_t
+struct fixed_queue_length {
+  size_t return_value{0};
+  std::function<size_t(fixed_queue_t* queue)> body{
+      [this](fixed_queue_t* queue) { return return_value; }};
+  size_t operator()(fixed_queue_t* queue) { return body(queue); };
+};
+extern struct fixed_queue_length fixed_queue_length;
+
+// Name: fixed_queue_new
+// Params: size_t capacity
+// Return: fixed_queue_t*
+struct fixed_queue_new {
+  fixed_queue_t* return_value{0};
+  std::function<fixed_queue_t*(size_t capacity)> body{
+      [this](size_t capacity) { return return_value; }};
+  fixed_queue_t* operator()(size_t capacity) { return body(capacity); };
+};
+extern struct fixed_queue_new fixed_queue_new;
+
+// Name: fixed_queue_register_dequeue
+// Params: fixed_queue_t* queue, reactor_t* reactor, fixed_queue_cb ready_cb,
+// void* context Return: void
+struct fixed_queue_register_dequeue {
+  std::function<void(fixed_queue_t* queue, reactor_t* reactor,
+                     fixed_queue_cb ready_cb, void* context)>
+      body{[](fixed_queue_t* queue, reactor_t* reactor, fixed_queue_cb ready_cb,
+              void* context) {}};
+  void operator()(fixed_queue_t* queue, reactor_t* reactor,
+                  fixed_queue_cb ready_cb, void* context) {
+    body(queue, reactor, ready_cb, context);
+  };
+};
+extern struct fixed_queue_register_dequeue fixed_queue_register_dequeue;
+
+// Name: fixed_queue_try_dequeue
+// Params: fixed_queue_t* queue
+// Return: void*
+struct fixed_queue_try_dequeue {
+  void* return_value{};
+  std::function<void*(fixed_queue_t* queue)> body{
+      [this](fixed_queue_t* queue) { return return_value; }};
+  void* operator()(fixed_queue_t* queue) { return body(queue); };
+};
+extern struct fixed_queue_try_dequeue fixed_queue_try_dequeue;
+
+// Name: fixed_queue_try_enqueue
+// Params: fixed_queue_t* queue, void* data
+// Return: bool
+struct fixed_queue_try_enqueue {
+  bool return_value{false};
+  std::function<bool(fixed_queue_t* queue, void* data)> body{
+      [this](fixed_queue_t* queue, void* data) { return return_value; }};
+  bool operator()(fixed_queue_t* queue, void* data) {
+    return body(queue, data);
+  };
+};
+extern struct fixed_queue_try_enqueue fixed_queue_try_enqueue;
+
+// Name: fixed_queue_try_peek_first
+// Params: fixed_queue_t* queue
+// Return: void*
+struct fixed_queue_try_peek_first {
+  void* return_value{};
+  std::function<void*(fixed_queue_t* queue)> body{
+      [this](fixed_queue_t* queue) { return return_value; }};
+  void* operator()(fixed_queue_t* queue) { return body(queue); };
+};
+extern struct fixed_queue_try_peek_first fixed_queue_try_peek_first;
+
+// Name: fixed_queue_try_peek_last
+// Params: fixed_queue_t* queue
+// Return: void*
+struct fixed_queue_try_peek_last {
+  void* return_value{};
+  std::function<void*(fixed_queue_t* queue)> body{
+      [this](fixed_queue_t* queue) { return return_value; }};
+  void* operator()(fixed_queue_t* queue) { return body(queue); };
+};
+extern struct fixed_queue_try_peek_last fixed_queue_try_peek_last;
+
+// Name: fixed_queue_try_remove_from_queue
+// Params: fixed_queue_t* queue, void* data
+// Return: void*
+struct fixed_queue_try_remove_from_queue {
+  void* return_value{};
+  std::function<void*(fixed_queue_t* queue, void* data)> body{
+      [this](fixed_queue_t* queue, void* data) { return return_value; }};
+  void* operator()(fixed_queue_t* queue, void* data) {
+    return body(queue, data);
+  };
+};
+extern struct fixed_queue_try_remove_from_queue
+    fixed_queue_try_remove_from_queue;
+
+// Name: fixed_queue_unregister_dequeue
+// Params: fixed_queue_t* queue
+// Return: void
+struct fixed_queue_unregister_dequeue {
+  std::function<void(fixed_queue_t* queue)> body{[](fixed_queue_t* queue) {}};
+  void operator()(fixed_queue_t* queue) { body(queue); };
+};
+extern struct fixed_queue_unregister_dequeue fixed_queue_unregister_dequeue;
+
+}  // namespace osi_fixed_queue
+}  // namespace mock
+}  // namespace test
+
+// END mockcify generation
\ No newline at end of file
diff --git a/test/mock/mock_osi_future.cc b/test/mock/mock_osi_future.cc
new file mode 100644
index 0000000..cd6f570
--- /dev/null
+++ b/test/mock/mock_osi_future.cc
@@ -0,0 +1,73 @@
+/*
+ * 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
+ *
+ *  mockcify.pl ver 0.3.0
+ */
+
+#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_osi_future.h"
+
+// Mocked internal structures, if any
+
+namespace test {
+namespace mock {
+namespace osi_future {
+
+// Function state capture and return values, if needed
+struct future_await future_await;
+struct future_new future_new;
+struct future_new_named future_new_named;
+struct future_new_immediate future_new_immediate;
+struct future_ready future_ready;
+
+}  // namespace osi_future
+}  // namespace mock
+}  // namespace test
+
+// Mocked functions, if any
+void* future_await(future_t* future) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_future::future_await(future);
+}
+future_t* future_new(void) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_future::future_new();
+}
+future_t* future_new_named(const char* name) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_future::future_new_named(name);
+}
+future_t* future_new_immediate(void* value) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_future::future_new_immediate(value);
+}
+void future_ready(future_t* future, void* value) {
+  mock_function_count_map[__func__]++;
+  test::mock::osi_future::future_ready(future, value);
+}
+// Mocked functions complete
+// END mockcify generation
diff --git a/test/mock/mock_osi_future.h b/test/mock/mock_osi_future.h
new file mode 100644
index 0000000..7d95b85
--- /dev/null
+++ b/test/mock/mock_osi_future.h
@@ -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:4
+ *
+ *  mockcify.pl ver 0.3.0
+ */
+
+#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 from (or add to ) the inclusion set.
+#include <base/logging.h>
+
+#include "check.h"
+#include "osi/include/allocator.h"
+#include "osi/include/future.h"
+#include "osi/include/log.h"
+#include "osi/include/osi.h"
+#include "osi/include/semaphore.h"
+
+// Mocked compile conditionals, if any
+
+namespace test {
+namespace mock {
+namespace osi_future {
+
+// Shared state between mocked functions and tests
+// Name: future_await
+// Params: future_t* future
+// Return: void*
+struct future_await {
+  void* return_value{};
+  std::function<void*(future_t* future)> body{
+      [this](future_t* future) { return return_value; }};
+  void* operator()(future_t* future) { return body(future); };
+};
+extern struct future_await future_await;
+
+// Name: future_new
+// Params: void
+// Return: future_t*
+struct future_new {
+  future_t* return_value{0};
+  std::function<future_t*(void)> body{[this](void) { return return_value; }};
+  future_t* operator()(void) { return body(); };
+};
+extern struct future_new future_new;
+
+// Name: future_new_named
+// Params: const char* name
+// Return: future_t*
+struct future_new_named {
+  future_t* return_value{0};
+  std::function<future_t*(const char* name)> body{
+      [this](const char* name) { return return_value; }};
+  future_t* operator()(const char* name) { return body(name); };
+};
+extern struct future_new_named future_new_named;
+
+// Name: future_new_immediate
+// Params: void* value
+// Return: future_t*
+struct future_new_immediate {
+  future_t* return_value{0};
+  std::function<future_t*(void* value)> body{[this](void* value) {
+    CHECK(0);
+    return return_value;
+  }};
+  future_t* operator()(void* value) { return body(value); };
+};
+extern struct future_new_immediate future_new_immediate;
+
+// Name: future_ready
+// Params: future_t* future, void* value
+// Return: void
+struct future_ready {
+  std::function<void(future_t* future, void* value)> body{
+      [](future_t* future, void* value) {}};
+  void operator()(future_t* future, void* value) { body(future, value); };
+};
+extern struct future_ready future_ready;
+
+}  // namespace osi_future
+}  // namespace mock
+}  // namespace test
+
+// END mockcify generation
diff --git a/test/mock/mock_osi_list.cc b/test/mock/mock_osi_list.cc
new file mode 100644
index 0000000..2d4cd77
--- /dev/null
+++ b/test/mock/mock_osi_list.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:19
+ *
+ *  mockcify.pl ver 0.3.0
+ */
+
+#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_osi_list.h"
+
+// Mocked internal structures, if any
+
+namespace test {
+namespace mock {
+namespace osi_list {
+
+// Function state capture and return values, if needed
+struct list_append list_append;
+struct list_back list_back;
+struct list_back_node list_back_node;
+struct list_begin list_begin;
+struct list_clear list_clear;
+struct list_contains list_contains;
+struct list_end list_end;
+struct list_foreach list_foreach;
+struct list_free list_free;
+struct list_front list_front;
+struct list_insert_after list_insert_after;
+struct list_is_empty list_is_empty;
+struct list_length list_length;
+struct list_new list_new;
+struct list_new_internal list_new_internal;
+struct list_next list_next;
+struct list_node list_node;
+struct list_prepend list_prepend;
+struct list_remove list_remove;
+
+}  // namespace osi_list
+}  // namespace mock
+}  // namespace test
+
+// Mocked functions, if any
+bool list_append(list_t* list, void* data) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_list::list_append(list, data);
+}
+void* list_back(const list_t* list) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_list::list_back(list);
+}
+list_node_t* list_back_node(const list_t* list) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_list::list_back_node(list);
+}
+list_node_t* list_begin(const list_t* list) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_list::list_begin(list);
+}
+void list_clear(list_t* list) {
+  mock_function_count_map[__func__]++;
+  test::mock::osi_list::list_clear(list);
+}
+bool list_contains(const list_t* list, const void* data) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_list::list_contains(list, data);
+}
+list_node_t* list_end(const list_t* list) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_list::list_end(list);
+}
+list_node_t* list_foreach(const list_t* list, list_iter_cb callback,
+                          void* context) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_list::list_foreach(list, callback, context);
+}
+void list_free(list_t* list) {
+  mock_function_count_map[__func__]++;
+  test::mock::osi_list::list_free(list);
+}
+void* list_front(const list_t* list) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_list::list_front(list);
+}
+bool list_insert_after(list_t* list, list_node_t* prev_node, void* data) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_list::list_insert_after(list, prev_node, data);
+}
+bool list_is_empty(const list_t* list) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_list::list_is_empty(list);
+}
+size_t list_length(const list_t* list) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_list::list_length(list);
+}
+list_t* list_new(list_free_cb callback) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_list::list_new(callback);
+}
+list_t* list_new_internal(list_free_cb callback,
+                          const allocator_t* zeroed_allocator) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_list::list_new_internal(callback, zeroed_allocator);
+}
+list_node_t* list_next(const list_node_t* node) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_list::list_next(node);
+}
+void* list_node(const list_node_t* node) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_list::list_node(node);
+}
+bool list_prepend(list_t* list, void* data) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_list::list_prepend(list, data);
+}
+bool list_remove(list_t* list, void* data) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_list::list_remove(list, data);
+}
+// Mocked functions complete
+// END mockcify generation
diff --git a/test/mock/mock_osi_list.h b/test/mock/mock_osi_list.h
new file mode 100644
index 0000000..55b1ee2
--- /dev/null
+++ b/test/mock/mock_osi_list.h
@@ -0,0 +1,278 @@
+/*
+ * 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
+ *
+ *  mockcify.pl ver 0.3.0
+ */
+
+#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 from (or add to ) the inclusion set.
+#include <base/logging.h>
+
+#include "check.h"
+#include "osi/include/allocator.h"
+#include "osi/include/list.h"
+#include "osi/include/osi.h"
+
+// Mocked compile conditionals, if any
+
+namespace test {
+namespace mock {
+namespace osi_list {
+
+// Shared state between mocked functions and tests
+// Name: list_append
+// Params: list_t* list, void* data
+// Return: bool
+struct list_append {
+  bool return_value{false};
+  std::function<bool(list_t* list, void* data)> body{
+      [this](list_t* list, void* data) { return return_value; }};
+  bool operator()(list_t* list, void* data) { return body(list, data); };
+};
+extern struct list_append list_append;
+
+// Name: list_back
+// Params: const list_t* list
+// Return: void*
+struct list_back {
+  void* return_value{};
+  std::function<void*(const list_t* list)> body{
+      [this](const list_t* list) { return return_value; }};
+  void* operator()(const list_t* list) { return body(list); };
+};
+extern struct list_back list_back;
+
+// Name: list_back_node
+// Params: const list_t* list
+// Return: list_node_t*
+struct list_back_node {
+  list_node_t* return_value{0};
+  std::function<list_node_t*(const list_t* list)> body{
+      [this](const list_t* list) { return return_value; }};
+  list_node_t* operator()(const list_t* list) { return body(list); };
+};
+extern struct list_back_node list_back_node;
+
+// Name: list_begin
+// Params: const list_t* list
+// Return: list_node_t*
+struct list_begin {
+  list_node_t* return_value{0};
+  std::function<list_node_t*(const list_t* list)> body{
+      [this](const list_t* list) { return return_value; }};
+  list_node_t* operator()(const list_t* list) { return body(list); };
+};
+extern struct list_begin list_begin;
+
+// Name: list_clear
+// Params: list_t* list
+// Return: void
+struct list_clear {
+  std::function<void(list_t* list)> body{[](list_t* list) {}};
+  void operator()(list_t* list) { body(list); };
+};
+extern struct list_clear list_clear;
+
+// Name: list_contains
+// Params: const list_t* list, const void* data
+// Return: bool
+struct list_contains {
+  bool return_value{false};
+  std::function<bool(const list_t* list, const void* data)> body{
+      [this](const list_t* list, const void* data) { return return_value; }};
+  bool operator()(const list_t* list, const void* data) {
+    return body(list, data);
+  };
+};
+extern struct list_contains list_contains;
+
+// Name: list_end
+// Params:  const list_t* list
+// Return: list_node_t*
+struct list_end {
+  list_node_t* return_value{0};
+  std::function<list_node_t*(const list_t* list)> body{
+      [this](const list_t* list) { return return_value; }};
+  list_node_t* operator()(const list_t* list) { return body(list); };
+};
+extern struct list_end list_end;
+
+// Name: list_foreach
+// Params: const list_t* list, list_iter_cb callback, void* context
+// Return: list_node_t*
+struct list_foreach {
+  list_node_t* return_value{0};
+  std::function<list_node_t*(const list_t* list, list_iter_cb callback,
+                             void* context)>
+      body{[this](const list_t* list, list_iter_cb callback, void* context) {
+        return return_value;
+      }};
+  list_node_t* operator()(const list_t* list, list_iter_cb callback,
+                          void* context) {
+    return body(list, callback, context);
+  };
+};
+extern struct list_foreach list_foreach;
+
+// Name: list_free
+// Params: list_t* list
+// Return: void
+struct list_free {
+  std::function<void(list_t* list)> body{[](list_t* list) {}};
+  void operator()(list_t* list) { body(list); };
+};
+extern struct list_free list_free;
+
+// Name: list_front
+// Params: const list_t* list
+// Return: void*
+struct list_front {
+  void* return_value{};
+  std::function<void*(const list_t* list)> body{
+      [this](const list_t* list) { return return_value; }};
+  void* operator()(const list_t* list) { return body(list); };
+};
+extern struct list_front list_front;
+
+// Name: list_insert_after
+// Params: list_t* list, list_node_t* prev_node, void* data
+// Return: bool
+struct list_insert_after {
+  bool return_value{false};
+  std::function<bool(list_t* list, list_node_t* prev_node, void* data)> body{
+      [this](list_t* list, list_node_t* prev_node, void* data) {
+        return return_value;
+      }};
+  bool operator()(list_t* list, list_node_t* prev_node, void* data) {
+    return body(list, prev_node, data);
+  };
+};
+extern struct list_insert_after list_insert_after;
+
+// Name: list_is_empty
+// Params: const list_t* list
+// Return: bool
+struct list_is_empty {
+  bool return_value{false};
+  std::function<bool(const list_t* list)> body{
+      [this](const list_t* list) { return return_value; }};
+  bool operator()(const list_t* list) { return body(list); };
+};
+extern struct list_is_empty list_is_empty;
+
+// Name: list_length
+// Params: const list_t* list
+// Return: size_t
+struct list_length {
+  size_t return_value{0};
+  std::function<size_t(const list_t* list)> body{
+      [this](const list_t* list) { return return_value; }};
+  size_t operator()(const list_t* list) { return body(list); };
+};
+extern struct list_length list_length;
+
+// Name: list_new
+// Params: list_free_cb callback
+// Return: list_t*
+struct list_new {
+  list_t* return_value{0};
+  std::function<list_t*(list_free_cb callback)> body{
+      [this](list_free_cb callback) { return return_value; }};
+  list_t* operator()(list_free_cb callback) { return body(callback); };
+};
+extern struct list_new list_new;
+
+// Name: list_new_internal
+// Params: list_free_cb callback, const allocator_t* zeroed_allocator
+// Return: list_t*
+struct list_new_internal {
+  list_t* return_value{0};
+  std::function<list_t*(list_free_cb callback,
+                        const allocator_t* zeroed_allocator)>
+      body{[this](list_free_cb callback, const allocator_t* zeroed_allocator) {
+        return return_value;
+      }};
+  list_t* operator()(list_free_cb callback,
+                     const allocator_t* zeroed_allocator) {
+    return body(callback, zeroed_allocator);
+  };
+};
+extern struct list_new_internal list_new_internal;
+
+// Name: list_next
+// Params: const list_node_t* node
+// Return: list_node_t*
+struct list_next {
+  list_node_t* return_value{0};
+  std::function<list_node_t*(const list_node_t* node)> body{
+      [this](const list_node_t* node) { return return_value; }};
+  list_node_t* operator()(const list_node_t* node) { return body(node); };
+};
+extern struct list_next list_next;
+
+// Name: list_node
+// Params: const list_node_t* node
+// Return: void*
+struct list_node {
+  void* return_value{};
+  std::function<void*(const list_node_t* node)> body{
+      [this](const list_node_t* node) { return return_value; }};
+  void* operator()(const list_node_t* node) { return body(node); };
+};
+extern struct list_node list_node;
+
+// Name: list_prepend
+// Params: list_t* list, void* data
+// Return: bool
+struct list_prepend {
+  bool return_value{false};
+  std::function<bool(list_t* list, void* data)> body{
+      [this](list_t* list, void* data) { return return_value; }};
+  bool operator()(list_t* list, void* data) { return body(list, data); };
+};
+extern struct list_prepend list_prepend;
+
+// Name: list_remove
+// Params: list_t* list, void* data
+// Return: bool
+struct list_remove {
+  bool return_value{false};
+  std::function<bool(list_t* list, void* data)> body{
+      [this](list_t* list, void* data) { return return_value; }};
+  bool operator()(list_t* list, void* data) { return body(list, data); };
+};
+extern struct list_remove list_remove;
+
+}  // namespace osi_list
+}  // namespace mock
+}  // namespace test
+
+// END mockcify generation
\ No newline at end of file
diff --git a/test/mock/mock_osi_properties.cc b/test/mock/mock_osi_properties.cc
new file mode 100644
index 0000000..393f4b8
--- /dev/null
+++ b/test/mock/mock_osi_properties.cc
@@ -0,0 +1,69 @@
+/*
+ * 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
+ *
+ *  mockcify.pl ver 0.3.0
+ */
+
+#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_osi_properties.h"
+
+// Mocked internal structures, if any
+
+namespace test {
+namespace mock {
+namespace osi_properties {
+
+// Function state capture and return values, if needed
+struct osi_property_get osi_property_get;
+struct osi_property_get_bool osi_property_get_bool;
+struct osi_property_get_int32 osi_property_get_int32;
+struct osi_property_set osi_property_set;
+
+}  // namespace osi_properties
+}  // namespace mock
+}  // namespace test
+
+// Mocked functions, if any
+int osi_property_get(const char* key, char* value, const char* default_value) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_properties::osi_property_get(key, value,
+                                                      default_value);
+}
+bool osi_property_get_bool(const char* key, bool default_value) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_properties::osi_property_get_bool(key, default_value);
+}
+int32_t osi_property_get_int32(const char* key, int32_t default_value) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_properties::osi_property_get_int32(key, default_value);
+}
+int osi_property_set(const char* key, const char* value) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_properties::osi_property_set(key, value);
+}
+// Mocked functions complete
+// END mockcify generation
diff --git a/test/mock/mock_osi_properties.h b/test/mock/mock_osi_properties.h
new file mode 100644
index 0000000..67f01e1
--- /dev/null
+++ b/test/mock/mock_osi_properties.h
@@ -0,0 +1,107 @@
+/*
+ * 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
+ *
+ *  mockcify.pl ver 0.3.0
+ */
+
+#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 from (or add to ) the inclusion set.
+#include <cutils/properties.h>
+#include <string.h>
+
+#include "osi/include/properties.h"
+
+// Mocked compile conditionals, if any
+
+namespace test {
+namespace mock {
+namespace osi_properties {
+
+// Shared state between mocked functions and tests
+// Name: osi_property_get
+// Params: const char* key, char* value, const char* default_value
+// Return: int
+struct osi_property_get {
+  int return_value{0};
+  std::function<int(const char* key, char* value, const char* default_value)>
+      body{[this](const char* key, char* value, const char* default_value) {
+        return return_value;
+      }};
+  int operator()(const char* key, char* value, const char* default_value) {
+    return body(key, value, default_value);
+  };
+};
+extern struct osi_property_get osi_property_get;
+
+// Name: osi_property_get_bool
+// Params: const char* key, bool default_value
+// Return: bool
+struct osi_property_get_bool {
+  bool return_value{false};
+  std::function<bool(const char* key, bool default_value)> body{
+      [this](const char* key, bool default_value) { return return_value; }};
+  bool operator()(const char* key, bool default_value) {
+    return body(key, default_value);
+  };
+};
+extern struct osi_property_get_bool osi_property_get_bool;
+
+// Name: osi_property_get_int32
+// Params: const char* key, int32_t default_value
+// Return: int32_t
+struct osi_property_get_int32 {
+  int32_t return_value{0};
+  std::function<int32_t(const char* key, int32_t default_value)> body{
+      [this](const char* key, int32_t default_value) { return return_value; }};
+  int32_t operator()(const char* key, int32_t default_value) {
+    return body(key, default_value);
+  };
+};
+extern struct osi_property_get_int32 osi_property_get_int32;
+
+// Name: osi_property_set
+// Params: const char* key, const char* value
+// Return: int
+struct osi_property_set {
+  int return_value{0};
+  std::function<int(const char* key, const char* value)> body{
+      [this](const char* key, const char* value) { return return_value; }};
+  int operator()(const char* key, const char* value) {
+    return body(key, value);
+  };
+};
+extern struct osi_property_set osi_property_set;
+
+}  // namespace osi_properties
+}  // namespace mock
+}  // namespace test
+
+// END mockcify generation
\ No newline at end of file
diff --git a/test/mock/mock_osi_ringbuffer.cc b/test/mock/mock_osi_ringbuffer.cc
new file mode 100644
index 0000000..da9497c
--- /dev/null
+++ b/test/mock/mock_osi_ringbuffer.cc
@@ -0,0 +1,89 @@
+/*
+ * 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
+ *
+ *  mockcify.pl ver 0.3.0
+ */
+
+#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_osi_ringbuffer.h"
+
+// Mocked internal structures, if any
+
+namespace test {
+namespace mock {
+namespace osi_ringbuffer {
+
+// Function state capture and return values, if needed
+struct ringbuffer_available ringbuffer_available;
+struct ringbuffer_delete ringbuffer_delete;
+struct ringbuffer_free ringbuffer_free;
+struct ringbuffer_init ringbuffer_init;
+struct ringbuffer_insert ringbuffer_insert;
+struct ringbuffer_peek ringbuffer_peek;
+struct ringbuffer_pop ringbuffer_pop;
+struct ringbuffer_size ringbuffer_size;
+
+}  // namespace osi_ringbuffer
+}  // namespace mock
+}  // namespace test
+
+// Mocked functions, if any
+size_t ringbuffer_available(const ringbuffer_t* rb) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_ringbuffer::ringbuffer_available(rb);
+}
+size_t ringbuffer_delete(ringbuffer_t* rb, size_t length) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_ringbuffer::ringbuffer_delete(rb, length);
+}
+void ringbuffer_free(ringbuffer_t* rb) {
+  mock_function_count_map[__func__]++;
+  test::mock::osi_ringbuffer::ringbuffer_free(rb);
+}
+ringbuffer_t* ringbuffer_init(const size_t size) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_ringbuffer::ringbuffer_init(size);
+}
+size_t ringbuffer_insert(ringbuffer_t* rb, const uint8_t* p, size_t length) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_ringbuffer::ringbuffer_insert(rb, p, length);
+}
+size_t ringbuffer_peek(const ringbuffer_t* rb, off_t offset, uint8_t* p,
+                       size_t length) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_ringbuffer::ringbuffer_peek(rb, offset, p, length);
+}
+size_t ringbuffer_pop(ringbuffer_t* rb, uint8_t* p, size_t length) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_ringbuffer::ringbuffer_pop(rb, p, length);
+}
+size_t ringbuffer_size(const ringbuffer_t* rb) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_ringbuffer::ringbuffer_size(rb);
+}
+// Mocked functions complete
+// END mockcify generation
diff --git a/test/mock/mock_osi_ringbuffer.h b/test/mock/mock_osi_ringbuffer.h
new file mode 100644
index 0000000..2f0a538
--- /dev/null
+++ b/test/mock/mock_osi_ringbuffer.h
@@ -0,0 +1,156 @@
+/*
+ * 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
+ *
+ *  mockcify.pl ver 0.3.0
+ */
+
+#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 from (or add to ) the inclusion set.
+#include <base/logging.h>
+#include <stdlib.h>
+
+#include "check.h"
+#include "osi/include/allocator.h"
+#include "osi/include/ringbuffer.h"
+
+// Mocked compile conditionals, if any
+
+namespace test {
+namespace mock {
+namespace osi_ringbuffer {
+
+// Shared state between mocked functions and tests
+// Name: ringbuffer_available
+// Params: const ringbuffer_t* rb
+// Return: size_t
+struct ringbuffer_available {
+  size_t return_value{0};
+  std::function<size_t(const ringbuffer_t* rb)> body{
+      [this](const ringbuffer_t* rb) { return return_value; }};
+  size_t operator()(const ringbuffer_t* rb) { return body(rb); };
+};
+extern struct ringbuffer_available ringbuffer_available;
+
+// Name: ringbuffer_delete
+// Params: ringbuffer_t* rb, size_t length
+// Return: size_t
+struct ringbuffer_delete {
+  size_t return_value{0};
+  std::function<size_t(ringbuffer_t* rb, size_t length)> body{
+      [this](ringbuffer_t* rb, size_t length) { return return_value; }};
+  size_t operator()(ringbuffer_t* rb, size_t length) {
+    return body(rb, length);
+  };
+};
+extern struct ringbuffer_delete ringbuffer_delete;
+
+// Name: ringbuffer_free
+// Params: ringbuffer_t* rb
+// Return: void
+struct ringbuffer_free {
+  std::function<void(ringbuffer_t* rb)> body{[](ringbuffer_t* rb) {}};
+  void operator()(ringbuffer_t* rb) { body(rb); };
+};
+extern struct ringbuffer_free ringbuffer_free;
+
+// Name: ringbuffer_init
+// Params: const size_t size
+// Return: ringbuffer_t*
+struct ringbuffer_init {
+  ringbuffer_t* return_value{0};
+  std::function<ringbuffer_t*(const size_t size)> body{
+      [this](const size_t size) { return return_value; }};
+  ringbuffer_t* operator()(const size_t size) { return body(size); };
+};
+extern struct ringbuffer_init ringbuffer_init;
+
+// Name: ringbuffer_insert
+// Params: ringbuffer_t* rb, const uint8_t* p, size_t length
+// Return: size_t
+struct ringbuffer_insert {
+  size_t return_value{0};
+  std::function<size_t(ringbuffer_t* rb, const uint8_t* p, size_t length)> body{
+      [this](ringbuffer_t* rb, const uint8_t* p, size_t length) {
+        return return_value;
+      }};
+  size_t operator()(ringbuffer_t* rb, const uint8_t* p, size_t length) {
+    return body(rb, p, length);
+  };
+};
+extern struct ringbuffer_insert ringbuffer_insert;
+
+// Name: ringbuffer_peek
+// Params: const ringbuffer_t* rb, off_t offset, uint8_t* p, size_t length
+// Return: size_t
+struct ringbuffer_peek {
+  size_t return_value{0};
+  std::function<size_t(const ringbuffer_t* rb, off_t offset, uint8_t* p,
+                       size_t length)>
+      body{[this](const ringbuffer_t* rb, off_t offset, uint8_t* p,
+                  size_t length) { return return_value; }};
+  size_t operator()(const ringbuffer_t* rb, off_t offset, uint8_t* p,
+                    size_t length) {
+    return body(rb, offset, p, length);
+  };
+};
+extern struct ringbuffer_peek ringbuffer_peek;
+
+// Name: ringbuffer_pop
+// Params: ringbuffer_t* rb, uint8_t* p, size_t length
+// Return: size_t
+struct ringbuffer_pop {
+  size_t return_value{0};
+  std::function<size_t(ringbuffer_t* rb, uint8_t* p, size_t length)> body{
+      [this](ringbuffer_t* rb, uint8_t* p, size_t length) {
+        return return_value;
+      }};
+  size_t operator()(ringbuffer_t* rb, uint8_t* p, size_t length) {
+    return body(rb, p, length);
+  };
+};
+extern struct ringbuffer_pop ringbuffer_pop;
+
+// Name: ringbuffer_size
+// Params: const ringbuffer_t* rb
+// Return: size_t
+struct ringbuffer_size {
+  size_t return_value{0};
+  std::function<size_t(const ringbuffer_t* rb)> body{
+      [this](const ringbuffer_t* rb) { return return_value; }};
+  size_t operator()(const ringbuffer_t* rb) { return body(rb); };
+};
+extern struct ringbuffer_size ringbuffer_size;
+
+}  // namespace osi_ringbuffer
+}  // namespace mock
+}  // namespace test
+
+// END mockcify generation
\ No newline at end of file
diff --git a/test/mock/mock_osi_semaphore.cc b/test/mock/mock_osi_semaphore.cc
new file mode 100644
index 0000000..4a69c0e
--- /dev/null
+++ b/test/mock/mock_osi_semaphore.cc
@@ -0,0 +1,78 @@
+/*
+ * 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
+ *
+ *  mockcify.pl ver 0.3.0
+ */
+
+#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_osi_semaphore.h"
+
+// Mocked internal structures, if any
+
+namespace test {
+namespace mock {
+namespace osi_semaphore {
+
+// Function state capture and return values, if needed
+struct semaphore_free semaphore_free;
+struct semaphore_get_fd semaphore_get_fd;
+struct semaphore_new semaphore_new;
+struct semaphore_post semaphore_post;
+struct semaphore_try_wait semaphore_try_wait;
+struct semaphore_wait semaphore_wait;
+
+}  // namespace osi_semaphore
+}  // namespace mock
+}  // namespace test
+
+// Mocked functions, if any
+void semaphore_free(semaphore_t* semaphore) {
+  mock_function_count_map[__func__]++;
+  test::mock::osi_semaphore::semaphore_free(semaphore);
+}
+int semaphore_get_fd(const semaphore_t* semaphore) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_semaphore::semaphore_get_fd(semaphore);
+}
+semaphore_t* semaphore_new(unsigned int value) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_semaphore::semaphore_new(value);
+}
+void semaphore_post(semaphore_t* semaphore) {
+  mock_function_count_map[__func__]++;
+  test::mock::osi_semaphore::semaphore_post(semaphore);
+}
+bool semaphore_try_wait(semaphore_t* semaphore) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_semaphore::semaphore_try_wait(semaphore);
+}
+void semaphore_wait(semaphore_t* semaphore) {
+  mock_function_count_map[__func__]++;
+  test::mock::osi_semaphore::semaphore_wait(semaphore);
+}
+// Mocked functions complete
+// END mockcify generation
diff --git a/test/mock/mock_osi_semaphore.h b/test/mock/mock_osi_semaphore.h
new file mode 100644
index 0000000..ca862ea
--- /dev/null
+++ b/test/mock/mock_osi_semaphore.h
@@ -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:6
+ *
+ *  mockcify.pl ver 0.3.0
+ */
+
+#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 from (or add to ) the inclusion set.
+#include <base/logging.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <malloc.h>
+#include <string.h>
+#include <sys/eventfd.h>
+#include <unistd.h>
+
+#include "check.h"
+#include "osi/include/allocator.h"
+#include "osi/include/log.h"
+#include "osi/include/osi.h"
+#include "osi/include/semaphore.h"
+
+// Mocked compile conditionals, if any
+
+namespace test {
+namespace mock {
+namespace osi_semaphore {
+
+// Shared state between mocked functions and tests
+// Name: semaphore_free
+// Params: semaphore_t* semaphore
+// Return: void
+struct semaphore_free {
+  std::function<void(semaphore_t* semaphore)> body{
+      [](semaphore_t* semaphore) {}};
+  void operator()(semaphore_t* semaphore) { body(semaphore); };
+};
+extern struct semaphore_free semaphore_free;
+
+// Name: semaphore_get_fd
+// Params: const semaphore_t* semaphore
+// Return: int
+struct semaphore_get_fd {
+  int return_value{0};
+  std::function<int(const semaphore_t* semaphore)> body{
+      [this](const semaphore_t* semaphore) { return return_value; }};
+  int operator()(const semaphore_t* semaphore) { return body(semaphore); };
+};
+extern struct semaphore_get_fd semaphore_get_fd;
+
+// Name: semaphore_new
+// Params: unsigned int value
+// Return: semaphore_t*
+struct semaphore_new {
+  semaphore_t* return_value{0};
+  std::function<semaphore_t*(unsigned int value)> body{
+      [this](unsigned int value) { return return_value; }};
+  semaphore_t* operator()(unsigned int value) { return body(value); };
+};
+extern struct semaphore_new semaphore_new;
+
+// Name: semaphore_post
+// Params: semaphore_t* semaphore
+// Return: void
+struct semaphore_post {
+  std::function<void(semaphore_t* semaphore)> body{
+      [](semaphore_t* semaphore) {}};
+  void operator()(semaphore_t* semaphore) { body(semaphore); };
+};
+extern struct semaphore_post semaphore_post;
+
+// Name: semaphore_try_wait
+// Params: semaphore_t* semaphore
+// Return: bool
+struct semaphore_try_wait {
+  bool return_value{false};
+  std::function<bool(semaphore_t* semaphore)> body{
+      [this](semaphore_t* semaphore) { return return_value; }};
+  bool operator()(semaphore_t* semaphore) { return body(semaphore); };
+};
+extern struct semaphore_try_wait semaphore_try_wait;
+
+// Name: semaphore_wait
+// Params: semaphore_t* semaphore
+// Return: void
+struct semaphore_wait {
+  std::function<void(semaphore_t* semaphore)> body{
+      [](semaphore_t* semaphore) {}};
+  void operator()(semaphore_t* semaphore) { body(semaphore); };
+};
+extern struct semaphore_wait semaphore_wait;
+
+}  // namespace osi_semaphore
+}  // namespace mock
+}  // namespace test
+
+// END mockcify generation
\ No newline at end of file
diff --git a/test/mock/mock_osi_socket.cc b/test/mock/mock_osi_socket.cc
new file mode 100644
index 0000000..541a3a3
--- /dev/null
+++ b/test/mock/mock_osi_socket.cc
@@ -0,0 +1,107 @@
+/*
+ * 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
+ *
+ *  mockcify.pl ver 0.3.0
+ */
+
+#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_osi_socket.h"
+
+// Mocked internal structures, if any
+
+namespace test {
+namespace mock {
+namespace osi_socket {
+
+// Function state capture and return values, if needed
+struct socket_accept socket_accept;
+struct socket_bytes_available socket_bytes_available;
+struct socket_free socket_free;
+struct socket_listen socket_listen;
+struct socket_new socket_new;
+struct socket_new_from_fd socket_new_from_fd;
+struct socket_read socket_read;
+struct socket_register socket_register;
+struct socket_unregister socket_unregister;
+struct socket_write socket_write;
+struct socket_write_and_transfer_fd socket_write_and_transfer_fd;
+
+}  // namespace osi_socket
+}  // namespace mock
+}  // namespace test
+
+// Mocked functions, if any
+socket_t* socket_accept(const socket_t* socket) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_socket::socket_accept(socket);
+}
+ssize_t socket_bytes_available(const socket_t* socket) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_socket::socket_bytes_available(socket);
+}
+void socket_free(socket_t* socket) {
+  mock_function_count_map[__func__]++;
+  test::mock::osi_socket::socket_free(socket);
+}
+bool socket_listen(const socket_t* socket, port_t port) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_socket::socket_listen(socket, port);
+}
+socket_t* socket_new(void) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_socket::socket_new();
+}
+socket_t* socket_new_from_fd(int fd) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_socket::socket_new_from_fd(fd);
+}
+ssize_t socket_read(const socket_t* socket, void* buf, size_t count) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_socket::socket_read(socket, buf, count);
+}
+void socket_register(socket_t* socket, reactor_t* reactor, void* context,
+                     socket_cb read_cb, socket_cb write_cb) {
+  mock_function_count_map[__func__]++;
+  test::mock::osi_socket::socket_register(socket, reactor, context, read_cb,
+                                          write_cb);
+}
+void socket_unregister(socket_t* socket) {
+  mock_function_count_map[__func__]++;
+  test::mock::osi_socket::socket_unregister(socket);
+}
+ssize_t socket_write(const socket_t* socket, const void* buf, size_t count) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_socket::socket_write(socket, buf, count);
+}
+ssize_t socket_write_and_transfer_fd(const socket_t* socket, const void* buf,
+                                     size_t count, int fd) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_socket::socket_write_and_transfer_fd(socket, buf,
+                                                              count, fd);
+}
+// Mocked functions complete
+// END mockcify generation
diff --git a/test/mock/mock_osi_socket.h b/test/mock/mock_osi_socket.h
new file mode 100644
index 0000000..5296b03
--- /dev/null
+++ b/test/mock/mock_osi_socket.h
@@ -0,0 +1,199 @@
+/*
+ * 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
+ *
+ *  mockcify.pl ver 0.3.0
+ */
+
+#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 from (or add to ) the inclusion set.
+#include <asm/ioctls.h>
+#include <base/logging.h>
+#include <errno.h>
+#include <netinet/in.h>
+#include <string.h>
+#include <sys/ioctl.h>
+#include <sys/socket.h>
+#include <unistd.h>
+
+#include "check.h"
+#include "osi/include/allocator.h"
+#include "osi/include/log.h"
+#include "osi/include/osi.h"
+#include "osi/include/reactor.h"
+#include "osi/include/socket.h"
+
+// Mocked compile conditionals, if any
+
+namespace test {
+namespace mock {
+namespace osi_socket {
+
+// Shared state between mocked functions and tests
+// Name: socket_accept
+// Params: const socket_t* socket
+// Return: socket_t*
+struct socket_accept {
+  socket_t* return_value{0};
+  std::function<socket_t*(const socket_t* socket)> body{
+      [this](const socket_t* socket) { return return_value; }};
+  socket_t* operator()(const socket_t* socket) { return body(socket); };
+};
+extern struct socket_accept socket_accept;
+
+// Name: socket_bytes_available
+// Params: const socket_t* socket
+// Return: ssize_t
+struct socket_bytes_available {
+  ssize_t return_value{0};
+  std::function<ssize_t(const socket_t* socket)> body{
+      [this](const socket_t* socket) { return return_value; }};
+  ssize_t operator()(const socket_t* socket) { return body(socket); };
+};
+extern struct socket_bytes_available socket_bytes_available;
+
+// Name: socket_free
+// Params: socket_t* socket
+// Return: void
+struct socket_free {
+  std::function<void(socket_t* socket)> body{[](socket_t* socket) {}};
+  void operator()(socket_t* socket) { body(socket); };
+};
+extern struct socket_free socket_free;
+
+// Name: socket_listen
+// Params: const socket_t* socket, port_t port
+// Return: bool
+struct socket_listen {
+  bool return_value{false};
+  std::function<bool(const socket_t* socket, port_t port)> body{
+      [this](const socket_t* socket, port_t port) { return return_value; }};
+  bool operator()(const socket_t* socket, port_t port) {
+    return body(socket, port);
+  };
+};
+extern struct socket_listen socket_listen;
+
+// Name: socket_new
+// Params: void
+// Return: socket_t*
+struct socket_new {
+  socket_t* return_value{0};
+  std::function<socket_t*(void)> body{[this](void) { return return_value; }};
+  socket_t* operator()(void) { return body(); };
+};
+extern struct socket_new socket_new;
+
+// Name: socket_new_from_fd
+// Params: int fd
+// Return: socket_t*
+struct socket_new_from_fd {
+  socket_t* return_value{0};
+  std::function<socket_t*(int fd)> body{
+      [this](int fd) { return return_value; }};
+  socket_t* operator()(int fd) { return body(fd); };
+};
+extern struct socket_new_from_fd socket_new_from_fd;
+
+// Name: socket_read
+// Params: const socket_t* socket, void* buf, size_t count
+// Return: ssize_t
+struct socket_read {
+  ssize_t return_value{0};
+  std::function<ssize_t(const socket_t* socket, void* buf, size_t count)> body{
+      [this](const socket_t* socket, void* buf, size_t count) {
+        return return_value;
+      }};
+  ssize_t operator()(const socket_t* socket, void* buf, size_t count) {
+    return body(socket, buf, count);
+  };
+};
+extern struct socket_read socket_read;
+
+// Name: socket_register
+// Params: socket_t* socket, reactor_t* reactor, void* context, socket_cb
+// read_cb, socket_cb write_cb Return: void
+struct socket_register {
+  std::function<void(socket_t* socket, reactor_t* reactor, void* context,
+                     socket_cb read_cb, socket_cb write_cb)>
+      body{[](socket_t* socket, reactor_t* reactor, void* context,
+              socket_cb read_cb, socket_cb write_cb) {}};
+  void operator()(socket_t* socket, reactor_t* reactor, void* context,
+                  socket_cb read_cb, socket_cb write_cb) {
+    body(socket, reactor, context, read_cb, write_cb);
+  };
+};
+extern struct socket_register socket_register;
+
+// Name: socket_unregister
+// Params: socket_t* socket
+// Return: void
+struct socket_unregister {
+  std::function<void(socket_t* socket)> body{[](socket_t* socket) {}};
+  void operator()(socket_t* socket) { body(socket); };
+};
+extern struct socket_unregister socket_unregister;
+
+// Name: socket_write
+// Params: const socket_t* socket, const void* buf, size_t count
+// Return: ssize_t
+struct socket_write {
+  ssize_t return_value{0};
+  std::function<ssize_t(const socket_t* socket, const void* buf, size_t count)>
+      body{[this](const socket_t* socket, const void* buf, size_t count) {
+        return return_value;
+      }};
+  ssize_t operator()(const socket_t* socket, const void* buf, size_t count) {
+    return body(socket, buf, count);
+  };
+};
+extern struct socket_write socket_write;
+
+// Name: socket_write_and_transfer_fd
+// Params: const socket_t* socket, const void* buf, size_t count, int fd
+// Return: ssize_t
+struct socket_write_and_transfer_fd {
+  ssize_t return_value{0};
+  std::function<ssize_t(const socket_t* socket, const void* buf, size_t count,
+                        int fd)>
+      body{[this](const socket_t* socket, const void* buf, size_t count,
+                  int fd) { return return_value; }};
+  ssize_t operator()(const socket_t* socket, const void* buf, size_t count,
+                     int fd) {
+    return body(socket, buf, count, fd);
+  };
+};
+extern struct socket_write_and_transfer_fd socket_write_and_transfer_fd;
+
+}  // namespace osi_socket
+}  // namespace mock
+}  // namespace test
+
+// END mockcify generation
\ No newline at end of file
diff --git a/test/mock/mock_osi_thread.cc b/test/mock/mock_osi_thread.cc
new file mode 100644
index 0000000..3b8ade1
--- /dev/null
+++ b/test/mock/mock_osi_thread.cc
@@ -0,0 +1,103 @@
+/*
+ * 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
+ *
+ *  mockcify.pl ver 0.3.0
+ */
+
+#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_osi_thread.h"
+
+// Mocked internal structures, if any
+
+namespace test {
+namespace mock {
+namespace osi_thread {
+
+// Function state capture and return values, if needed
+struct thread_free thread_free;
+struct thread_get_reactor thread_get_reactor;
+struct thread_is_self thread_is_self;
+struct thread_join thread_join;
+struct thread_name thread_name;
+struct thread_new thread_new;
+struct thread_new_sized thread_new_sized;
+struct thread_post thread_post;
+struct thread_set_priority thread_set_priority;
+struct thread_set_rt_priority thread_set_rt_priority;
+struct thread_stop thread_stop;
+
+}  // namespace osi_thread
+}  // namespace mock
+}  // namespace test
+
+// Mocked functions, if any
+void thread_free(thread_t* thread) {
+  mock_function_count_map[__func__]++;
+  test::mock::osi_thread::thread_free(thread);
+}
+reactor_t* thread_get_reactor(const thread_t* thread) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_thread::thread_get_reactor(thread);
+}
+bool thread_is_self(const thread_t* thread) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_thread::thread_is_self(thread);
+}
+void thread_join(thread_t* thread) {
+  mock_function_count_map[__func__]++;
+  test::mock::osi_thread::thread_join(thread);
+}
+const char* thread_name(const thread_t* thread) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_thread::thread_name(thread);
+}
+thread_t* thread_new(const char* name) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_thread::thread_new(name);
+}
+thread_t* thread_new_sized(const char* name, size_t work_queue_capacity) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_thread::thread_new_sized(name, work_queue_capacity);
+}
+bool thread_post(thread_t* thread, thread_fn func, void* context) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_thread::thread_post(thread, func, context);
+}
+bool thread_set_priority(thread_t* thread, int priority) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_thread::thread_set_priority(thread, priority);
+}
+bool thread_set_rt_priority(thread_t* thread, int priority) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_thread::thread_set_rt_priority(thread, priority);
+}
+void thread_stop(thread_t* thread) {
+  mock_function_count_map[__func__]++;
+  test::mock::osi_thread::thread_stop(thread);
+}
+// Mocked functions complete
+// END mockcify generation
diff --git a/test/mock/mock_osi_thread.h b/test/mock/mock_osi_thread.h
new file mode 100644
index 0000000..7bcab08
--- /dev/null
+++ b/test/mock/mock_osi_thread.h
@@ -0,0 +1,196 @@
+/*
+ * 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
+ *
+ *  mockcify.pl ver 0.3.0
+ */
+
+#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 from (or add to ) the inclusion set.
+#include <base/logging.h>
+#include <errno.h>
+#include <malloc.h>
+#include <pthread.h>
+#include <string.h>
+#include <sys/prctl.h>
+#include <sys/resource.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#include <atomic>
+
+#include "check.h"
+#include "osi/include/allocator.h"
+#include "osi/include/compat.h"
+#include "osi/include/fixed_queue.h"
+#include "osi/include/log.h"
+#include "osi/include/reactor.h"
+#include "osi/include/semaphore.h"
+#include "osi/include/thread.h"
+
+// Mocked compile conditionals, if any
+
+namespace test {
+namespace mock {
+namespace osi_thread {
+
+// Shared state between mocked functions and tests
+// Name: thread_free
+// Params: thread_t* thread
+// Return: void
+struct thread_free {
+  std::function<void(thread_t* thread)> body{[](thread_t* thread) {}};
+  void operator()(thread_t* thread) { body(thread); };
+};
+extern struct thread_free thread_free;
+
+// Name: thread_get_reactor
+// Params: const thread_t* thread
+// Return: reactor_t*
+struct thread_get_reactor {
+  reactor_t* return_value{0};
+  std::function<reactor_t*(const thread_t* thread)> body{
+      [this](const thread_t* thread) { return return_value; }};
+  reactor_t* operator()(const thread_t* thread) { return body(thread); };
+};
+extern struct thread_get_reactor thread_get_reactor;
+
+// Name: thread_is_self
+// Params: const thread_t* thread
+// Return: bool
+struct thread_is_self {
+  bool return_value{false};
+  std::function<bool(const thread_t* thread)> body{
+      [this](const thread_t* thread) { return return_value; }};
+  bool operator()(const thread_t* thread) { return body(thread); };
+};
+extern struct thread_is_self thread_is_self;
+
+// Name: thread_join
+// Params: thread_t* thread
+// Return: void
+struct thread_join {
+  std::function<void(thread_t* thread)> body{[](thread_t* thread) {}};
+  void operator()(thread_t* thread) { body(thread); };
+};
+extern struct thread_join thread_join;
+
+// Name: thread_name
+// Params: const thread_t* thread
+// Return: const char*
+struct thread_name {
+  const char* return_value{0};
+  std::function<const char*(const thread_t* thread)> body{
+      [this](const thread_t* thread) { return return_value; }};
+  const char* operator()(const thread_t* thread) { return body(thread); };
+};
+extern struct thread_name thread_name;
+
+// Name: thread_new
+// Params: const char* name
+// Return: thread_t*
+struct thread_new {
+  thread_t* return_value{0};
+  std::function<thread_t*(const char* name)> body{
+      [this](const char* name) { return return_value; }};
+  thread_t* operator()(const char* name) { return body(name); };
+};
+extern struct thread_new thread_new;
+
+// Name: thread_new_sized
+// Params: const char* name, size_t work_queue_capacity
+// Return: thread_t*
+struct thread_new_sized {
+  thread_t* return_value{0};
+  std::function<thread_t*(const char* name, size_t work_queue_capacity)> body{
+      [this](const char* name, size_t work_queue_capacity) {
+        return return_value;
+      }};
+  thread_t* operator()(const char* name, size_t work_queue_capacity) {
+    return body(name, work_queue_capacity);
+  };
+};
+extern struct thread_new_sized thread_new_sized;
+
+// Name: thread_post
+// Params: thread_t* thread, thread_fn func, void* context
+// Return: bool
+struct thread_post {
+  bool return_value{false};
+  std::function<bool(thread_t* thread, thread_fn func, void* context)> body{
+      [this](thread_t* thread, thread_fn func, void* context) {
+        return return_value;
+      }};
+  bool operator()(thread_t* thread, thread_fn func, void* context) {
+    return body(thread, func, context);
+  };
+};
+extern struct thread_post thread_post;
+
+// Name: thread_set_priority
+// Params: thread_t* thread, int priority
+// Return: bool
+struct thread_set_priority {
+  bool return_value{false};
+  std::function<bool(thread_t* thread, int priority)> body{
+      [this](thread_t* thread, int priority) { return return_value; }};
+  bool operator()(thread_t* thread, int priority) {
+    return body(thread, priority);
+  };
+};
+extern struct thread_set_priority thread_set_priority;
+
+// Name: thread_set_rt_priority
+// Params: thread_t* thread, int priority
+// Return: bool
+struct thread_set_rt_priority {
+  bool return_value{false};
+  std::function<bool(thread_t* thread, int priority)> body{
+      [this](thread_t* thread, int priority) { return return_value; }};
+  bool operator()(thread_t* thread, int priority) {
+    return body(thread, priority);
+  };
+};
+extern struct thread_set_rt_priority thread_set_rt_priority;
+
+// Name: thread_stop
+// Params: thread_t* thread
+// Return: void
+struct thread_stop {
+  std::function<void(thread_t* thread)> body{[](thread_t* thread) {}};
+  void operator()(thread_t* thread) { body(thread); };
+};
+extern struct thread_stop thread_stop;
+
+}  // namespace osi_thread
+}  // namespace mock
+}  // namespace test
+
+// END mockcify generation
\ No newline at end of file
diff --git a/test/mock/mock_osi_thread_scheduler.cc b/test/mock/mock_osi_thread_scheduler.cc
new file mode 100644
index 0000000..2efbb5b
--- /dev/null
+++ b/test/mock/mock_osi_thread_scheduler.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:2
+ *
+ *  mockcify.pl ver 0.3.0
+ */
+
+#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_osi_thread_scheduler.h"
+
+// Mocked internal structures, if any
+
+namespace test {
+namespace mock {
+namespace osi_thread_scheduler {
+
+// Function state capture and return values, if needed
+struct thread_scheduler_enable_real_time thread_scheduler_enable_real_time;
+struct thread_scheduler_get_priority_range thread_scheduler_get_priority_range;
+
+}  // namespace osi_thread_scheduler
+}  // namespace mock
+}  // namespace test
+
+// Mocked functions, if any
+bool thread_scheduler_enable_real_time(pid_t linux_tid) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_thread_scheduler::thread_scheduler_enable_real_time(
+      linux_tid);
+}
+bool thread_scheduler_get_priority_range(int& min, int& max) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_thread_scheduler::thread_scheduler_get_priority_range(
+      min, max);
+}
+// Mocked functions complete
+// END mockcify generation
diff --git a/test/mock/mock_osi_thread_scheduler.h b/test/mock/mock_osi_thread_scheduler.h
new file mode 100644
index 0000000..da88a94
--- /dev/null
+++ b/test/mock/mock_osi_thread_scheduler.h
@@ -0,0 +1,73 @@
+/*
+ * 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
+ *
+ *  mockcify.pl ver 0.3.0
+ */
+
+#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 from (or add to ) the inclusion set.
+
+// Mocked compile conditionals, if any
+
+namespace test {
+namespace mock {
+namespace osi_thread_scheduler {
+
+// Shared state between mocked functions and tests
+// Name: osi_enable_real_time_scheduling
+// Params: pid_t linux_tid
+// Return: bool
+struct thread_scheduler_enable_real_time {
+  bool return_value{false};
+  std::function<bool(pid_t linux_tid)> body{
+      [this](pid_t linux_tid) { return return_value; }};
+  bool operator()(pid_t linux_tid) { return body(linux_tid); };
+};
+extern struct thread_scheduler_enable_real_time
+    thread_scheduler_enable_real_time;
+
+// Name: osi_fifo_scheduing_priority_range
+// Params: int& min, int& max
+// Return: bool
+struct thread_scheduler_get_priority_range {
+  bool return_value{false};
+  std::function<bool(int& min, int& max)> body{
+      [this](int& min, int& max) { return return_value; }};
+  bool operator()(int& min, int& max) { return body(min, max); };
+};
+extern struct thread_scheduler_get_priority_range
+    thread_scheduler_get_priority_range;
+
+}  // namespace osi_thread_scheduler
+}  // namespace mock
+}  // namespace test
+
+// END mockcify generation
diff --git a/test/mock/mock_osi_wakelock.cc b/test/mock/mock_osi_wakelock.cc
new file mode 100644
index 0000000..6c359de
--- /dev/null
+++ b/test/mock/mock_osi_wakelock.cc
@@ -0,0 +1,78 @@
+/*
+ * 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
+ *
+ *  mockcify.pl ver 0.3.0
+ */
+
+#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_osi_wakelock.h"
+
+// Mocked internal structures, if any
+
+namespace test {
+namespace mock {
+namespace osi_wakelock {
+
+// Function state capture and return values, if needed
+struct wakelock_acquire wakelock_acquire;
+struct wakelock_cleanup wakelock_cleanup;
+struct wakelock_debug_dump wakelock_debug_dump;
+struct wakelock_release wakelock_release;
+struct wakelock_set_os_callouts wakelock_set_os_callouts;
+struct wakelock_set_paths wakelock_set_paths;
+
+}  // namespace osi_wakelock
+}  // namespace mock
+}  // namespace test
+
+// Mocked functions, if any
+bool wakelock_acquire(void) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_wakelock::wakelock_acquire();
+}
+void wakelock_cleanup(void) {
+  mock_function_count_map[__func__]++;
+  test::mock::osi_wakelock::wakelock_cleanup();
+}
+void wakelock_debug_dump(int fd) {
+  mock_function_count_map[__func__]++;
+  test::mock::osi_wakelock::wakelock_debug_dump(fd);
+}
+bool wakelock_release(void) {
+  mock_function_count_map[__func__]++;
+  return test::mock::osi_wakelock::wakelock_release();
+}
+void wakelock_set_os_callouts(bt_os_callouts_t* callouts) {
+  mock_function_count_map[__func__]++;
+  test::mock::osi_wakelock::wakelock_set_os_callouts(callouts);
+}
+void wakelock_set_paths(const char* lock_path, const char* unlock_path) {
+  mock_function_count_map[__func__]++;
+  test::mock::osi_wakelock::wakelock_set_paths(lock_path, unlock_path);
+}
+// Mocked functions complete
+// END mockcify generation
diff --git a/test/mock/mock_osi_wakelock.h b/test/mock/mock_osi_wakelock.h
new file mode 100644
index 0000000..80d0309
--- /dev/null
+++ b/test/mock/mock_osi_wakelock.h
@@ -0,0 +1,133 @@
+/*
+ * 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
+ *
+ *  mockcify.pl ver 0.3.0
+ */
+
+#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 from (or add to ) the inclusion set.
+#include <errno.h>
+#include <fcntl.h>
+#include <hardware/bluetooth.h>
+#include <inttypes.h>
+#include <limits.h>
+#include <pthread.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <time.h>
+#include <unistd.h>
+
+#include <mutex>
+#include <string>
+
+#include "base/logging.h"
+#include "check.h"
+#include "common/metrics.h"
+#include "osi/include/alarm.h"
+#include "osi/include/allocator.h"
+#include "osi/include/log.h"
+#include "osi/include/osi.h"
+#include "osi/include/thread.h"
+#include "osi/include/wakelock.h"
+
+// Mocked compile conditionals, if any
+
+namespace test {
+namespace mock {
+namespace osi_wakelock {
+
+// Shared state between mocked functions and tests
+// Name: wakelock_acquire
+// Params: void
+// Return: bool
+struct wakelock_acquire {
+  bool return_value{false};
+  std::function<bool(void)> body{[this](void) { return return_value; }};
+  bool operator()(void) { return body(); };
+};
+extern struct wakelock_acquire wakelock_acquire;
+
+// Name: wakelock_cleanup
+// Params: void
+// Return: void
+struct wakelock_cleanup {
+  std::function<void(void)> body{[](void) {}};
+  void operator()(void) { body(); };
+};
+extern struct wakelock_cleanup wakelock_cleanup;
+
+// Name: wakelock_debug_dump
+// Params: int fd
+// Return: void
+struct wakelock_debug_dump {
+  std::function<void(int fd)> body{[](int fd) {}};
+  void operator()(int fd) { body(fd); };
+};
+extern struct wakelock_debug_dump wakelock_debug_dump;
+
+// Name: wakelock_release
+// Params: void
+// Return: bool
+struct wakelock_release {
+  bool return_value{false};
+  std::function<bool(void)> body{[this](void) { return return_value; }};
+  bool operator()(void) { return body(); };
+};
+extern struct wakelock_release wakelock_release;
+
+// Name: wakelock_set_os_callouts
+// Params: bt_os_callouts_t* callouts
+// Return: void
+struct wakelock_set_os_callouts {
+  std::function<void(bt_os_callouts_t* callouts)> body{
+      [](bt_os_callouts_t* callouts) {}};
+  void operator()(bt_os_callouts_t* callouts) { body(callouts); };
+};
+extern struct wakelock_set_os_callouts wakelock_set_os_callouts;
+
+// Name: wakelock_set_paths
+// Params: const char* lock_path, const char* unlock_path
+// Return: void
+struct wakelock_set_paths {
+  std::function<void(const char* lock_path, const char* unlock_path)> body{
+      [](const char* lock_path, const char* unlock_path) {}};
+  void operator()(const char* lock_path, const char* unlock_path) {
+    body(lock_path, unlock_path);
+  };
+};
+extern struct wakelock_set_paths wakelock_set_paths;
+
+}  // namespace osi_wakelock
+}  // namespace mock
+}  // namespace test
+
+// END mockcify generation
\ No newline at end of file
diff --git a/test/mock/mock_stack_btm_devctl.cc b/test/mock/mock_stack_btm_devctl.cc
index ea3d41a..5aeab02 100644
--- a/test/mock/mock_stack_btm_devctl.cc
+++ b/test/mock/mock_stack_btm_devctl.cc
@@ -86,7 +86,7 @@
   mock_function_count_map[__func__]++;
   return BTM_SUCCESS;
 }
-tBTM_STATUS BTM_SetLocalDeviceName(char* p_name) {
+tBTM_STATUS BTM_SetLocalDeviceName(const char* p_name) {
   mock_function_count_map[__func__]++;
   return BTM_SUCCESS;
 }
diff --git a/test/mock/mock_utils_bt.cc b/test/mock/mock_utils_bt.cc
new file mode 100644
index 0000000..5b6bfc2
--- /dev/null
+++ b/test/mock/mock_utils_bt.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:1
+ *
+ *  mockcify.pl ver 0.3.0
+ */
+
+#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_utils_bt.h"
+
+// Legacy module structure
+#if 0
+EXPORT_SYMBOL extern const module_t module_s = {.name = BT_UTILS_MODULE,
+                                                .init = nullptr,
+                                                .start_up = nullptr,
+                                                .shut_down = nullptr,
+                                                .clean_up = nullptr,
+                                                .dependencies = {nullptr}};
+#endif
+// Mocked internal structures, if any
+
+namespace test {
+namespace mock {
+namespace utils_bt {
+
+// Function state capture and return values, if needed
+struct raise_priority_a2dp raise_priority_a2dp;
+
+}  // namespace utils_bt
+}  // namespace mock
+}  // namespace test
+
+// Mocked functions, if any
+void raise_priority_a2dp(tHIGH_PRIORITY_TASK high_task) {
+  mock_function_count_map[__func__]++;
+  test::mock::utils_bt::raise_priority_a2dp(high_task);
+}
+// Mocked functions complete
+// END mockcify generation
diff --git a/test/mock/mock_utils_bt.h b/test/mock/mock_utils_bt.h
new file mode 100644
index 0000000..1b0b8a1
--- /dev/null
+++ b/test/mock/mock_utils_bt.h
@@ -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:1
+ *
+ *  mockcify.pl ver 0.3.0
+ */
+
+#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 from (or add to ) the inclusion set.
+#include <errno.h>
+#include <processgroup/sched_policy.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/resource.h>
+#include <unistd.h>
+
+#include <mutex>
+
+#include "bt_types.h"
+#include "bt_utils.h"
+#include "btcore/include/module.h"
+#include "osi/include/compat.h"
+#include "osi/include/log.h"
+#include "osi/include/properties.h"
+
+// Mocked compile conditionals, if any
+
+namespace test {
+namespace mock {
+namespace utils_bt {
+
+// Shared state between mocked functions and tests
+// Name: raise_priority_a2dp
+// Params: tHIGH_PRIORITY_TASK high_task
+// Return: void
+struct raise_priority_a2dp {
+  std::function<void(tHIGH_PRIORITY_TASK high_task)> body{
+      [](tHIGH_PRIORITY_TASK high_task) {}};
+  void operator()(tHIGH_PRIORITY_TASK high_task) { body(high_task); };
+};
+extern struct raise_priority_a2dp raise_priority_a2dp;
+
+}  // namespace utils_bt
+}  // namespace mock
+}  // namespace test
+
+// END mockcify generation
\ No newline at end of file