Snap for 8730993 from 7b7755997f85f05bf35be8f193242687ecb12c5a to mainline-tzdata3-release

Change-Id: I53156b7efcc1b6d7ea78ea34cb66d303d6c850dc
diff --git a/PREUPLOAD.cfg b/PREUPLOAD.cfg
index 657c8df..7fb1636 100644
--- a/PREUPLOAD.cfg
+++ b/PREUPLOAD.cfg
@@ -3,8 +3,4 @@
 
 [Builtin Hooks]
 clang_format = true
-rustfmt = true
-
-[Builtin Hooks Options]
-rustfmt = --config-path=rustfmt.toml
 
diff --git a/conf/libnfc-nci.conf b/conf/libnfc-nci.conf
index ce28052..f07f0ed 100644
--- a/conf/libnfc-nci.conf
+++ b/conf/libnfc-nci.conf
@@ -80,11 +80,3 @@
 # AID_MATCHING_EXACT_OR_PREFIX 0x01
 # AID_MATCHING_PREFIX_ONLY 0x02
 AID_MATCHING_MODE=0x01
-
-###############################################################################
-# NCI_RESET_TYPE options
-# Default 0x00, reset configurations everytime.
-# 0x01, reset configurations only once every boot.
-# 0x02, keep configurations.
-NCI_RESET_TYPE=0x00
-
diff --git a/rustfmt.toml b/rustfmt.toml
deleted file mode 100644
index 617d425..0000000
--- a/rustfmt.toml
+++ /dev/null
@@ -1,5 +0,0 @@
-# Android Format Style
-
-edition = "2018"
-use_small_heuristics = "Max"
-newline_style = "Unix"
diff --git a/src/Android.bp b/src/Android.bp
index f71c2e1..f691c4a 100644
--- a/src/Android.bp
+++ b/src/Android.bp
@@ -18,6 +18,7 @@
         "libcutils",
         "liblog",
         "libdl",
+        "libhardware",
         "libz",
         "libchrome",
         "libbase",
@@ -29,9 +30,6 @@
         "android.hardware.nfc@1.0",
         "android.hardware.nfc@1.1",
         "android.hardware.nfc@1.2",
-        // Add for AIDL
-        "android.hardware.nfc-V1-ndk",
-        "libbinder_ndk",
     ],
     static_libs: [
         "libnfcutils",
@@ -122,15 +120,6 @@
         "nfa/include",
         "fuzzers/inc",
     ],
-    fuzz_config: {
-       cc: [
-            "android-security-assurance-redteam@google.com",
-            "zachoverflow@google.com",
-            "jackcwyu@google.com",
-            "georgekgchang@google.com",
-            "alisher@google.com",
-        ],
-    },
 }
 
 cc_fuzz {
@@ -139,7 +128,6 @@
     srcs: [
         "nfc/nci/*.cc",
         "nfc/nfc/*.cc",
-        "adaptation/debug_lmrt.cc",
         "gki/common/*.cc",
         "gki/ulinux/*.cc",
         "fuzzers/*.cc",
@@ -197,98 +185,3 @@
         "fuzzers/llcp/*.cc",
     ],
 }
-
-cc_library_static {
-    name: "nfc_integration_fuzzer_proto",
-    owner: "google",
-    host_supported: true,
-    srcs: ["fuzzers/integration/nfc_integration_fuzzer.proto"],
-    proto: {
-        type: "full",
-        export_proto_headers: true,
-    },
-    shared_libs: ["libprotobuf-cpp-full"],
-}
-
-cc_fuzz {
-    name: "nfc_integration_fuzzer",
-    defaults: ["nfc_fuzzer_defaults"],
-    srcs: [
-        "adaptation/debug_nfcsnoop.cc",
-        "fuzzers/integration/*.cc",
-        "fuzzers/integration/fakes/*.cc",
-        "gki/common/gki_buffer.cc",
-        "adaptation/debug_lmrt.cc",
-        "nfa/ce/*.cc",
-        "nfa/dm/*.cc",
-        "nfa/ee/*.cc",
-        "nfa/hci/*.cc",
-        "nfa/p2p/*.cc",
-        "nfa/rw/*.cc",
-        "nfa/sys/*.cc",
-        "nfc/llcp/*.cc",
-        "nfc/nci/*.cc",
-        "nfc/ndef/*.cc",
-        "nfc/nfc/*.cc",
-        "nfc/tags/*.cc",
-    ],
-    cflags: [
-        "-DNFC_INTEGRATION_FUZZER",
-    ],
-    local_include_dirs: [
-        "fuzzers/integration",
-        "fuzzers/integration/fakes",
-    ],
-    static_libs: [
-        "libprotobuf-mutator",
-        "libutils",
-        "nfc_integration_fuzzer_proto",
-    ],
-    shared_libs: [
-        "libprotobuf-cpp-full",
-        "libz",
-    ]
-}
-
-genrule {
-    name: "NfcGeneratedPackets_rust",
-    tools: [
-        "bluetooth_packetgen",
-    ],
-    cmd: "$(location bluetooth_packetgen) --include=system/nfc/src --out=$(genDir) $(in) --rust",
-    srcs: [
-        "nci_packets.pdl",
-    ],
-    out: [
-        "nci_packets.rs",
-    ],
-}
-
-rust_library {
-    name: "libnfc_packets",
-    defaults: ["nfc_rust_defaults"],
-    crate_name: "nfc_packets",
-    srcs: ["rust/packets/lib.rs", ":NfcGeneratedPackets_rust"],
-    host_supported: true,
-    proc_macros: ["libnum_derive"],
-    rustlibs: [
-        "libbytes",
-        "libnum_traits",
-        "libthiserror",
-        "liblog_rust",
-    ],
-}
-
-rust_test_host {
-    name: "libnfc_packets_test",
-    defaults: ["nfc_rust_defaults"],
-    srcs: ["rust/packets/lib.rs", ":NfcGeneratedPackets_rust"],
-    test_suites: ["general-tests"],
-    proc_macros: ["libnum_derive"],
-    rustlibs: [
-        "libbytes",
-        "libnum_traits",
-        "libthiserror",
-        "liblog_rust",
-    ],
-}
diff --git a/src/adaptation/NfcAdaptation.cc b/src/adaptation/NfcAdaptation.cc
index b39a539..7c6a857 100644
--- a/src/adaptation/NfcAdaptation.cc
+++ b/src/adaptation/NfcAdaptation.cc
@@ -15,18 +15,6 @@
  *  limitations under the License.
  *
  ******************************************************************************/
-#include <aidl/android/hardware/nfc/BnNfc.h>
-#include <aidl/android/hardware/nfc/BnNfcClientCallback.h>
-#include <aidl/android/hardware/nfc/INfc.h>
-#include <android/binder_ibinder.h>
-#include <android/binder_manager.h>
-#include <android/binder_process.h>
-// syslog.h and base/logging.h both try to #define LOG_INFO and LOG_WARNING.
-// We need to #undef these two before including base/logging.h.
-// libchrome => logging.h
-// aidl => syslog.h
-#undef LOG_INFO
-#undef LOG_WARNING
 #include <android-base/stringprintf.h>
 #include <android/hardware/nfc/1.1/INfc.h>
 #include <android/hardware/nfc/1.2/INfc.h>
@@ -62,18 +50,6 @@
 using NfcVendorConfigV1_2 = android::hardware::nfc::V1_2::NfcConfig;
 using android::hardware::nfc::V1_1::INfcClientCallback;
 using android::hardware::hidl_vec;
-using INfcAidl = ::aidl::android::hardware::nfc::INfc;
-using NfcAidlConfig = ::aidl::android::hardware::nfc::NfcConfig;
-using AidlPresenceCheckAlgorithm =
-    ::aidl::android::hardware::nfc::PresenceCheckAlgorithm;
-using INfcAidlClientCallback =
-    ::aidl::android::hardware::nfc::INfcClientCallback;
-using NfcAidlEvent = ::aidl::android::hardware::nfc::NfcEvent;
-using NfcAidlStatus = ::aidl::android::hardware::nfc::NfcStatus;
-using ::aidl::android::hardware::nfc::NfcCloseType;
-using Status = ::ndk::ScopedAStatus;
-
-std::string NFC_AIDL_HAL_SERVICE_NAME = "android.hardware.nfc.INfc/default";
 
 extern bool nfc_debug_enabled;
 
@@ -83,23 +59,19 @@
 
 NfcAdaptation* NfcAdaptation::mpInstance = nullptr;
 ThreadMutex NfcAdaptation::sLock;
+tHAL_NFC_CBACK* NfcAdaptation::mHalCallback = nullptr;
+tHAL_NFC_DATA_CBACK* NfcAdaptation::mHalDataCallback = nullptr;
 ThreadCondVar NfcAdaptation::mHalOpenCompletedEvent;
 ThreadCondVar NfcAdaptation::mHalCloseCompletedEvent;
 sp<INfc> NfcAdaptation::mHal;
 sp<INfcV1_1> NfcAdaptation::mHal_1_1;
 sp<INfcV1_2> NfcAdaptation::mHal_1_2;
 INfcClientCallback* NfcAdaptation::mCallback;
-std::shared_ptr<INfcAidlClientCallback> mAidlCallback;
-::ndk::ScopedAIBinder_DeathRecipient mDeathRecipient;
-std::shared_ptr<INfcAidl> mAidlHal;
 
 bool nfc_debug_enabled = false;
-bool nfc_nci_reset_keep_cfg_enabled = false;
-uint8_t nfc_nci_reset_type = 0x00;
 std::string nfc_storage_path;
 uint8_t appl_dta_mode_flag = 0x00;
 bool isDownloadFirmwareCompleted = false;
-bool use_aidl = false;
 
 extern tNFA_DM_CFG nfa_dm_cfg;
 extern tNFA_PROPRIETARY_CFG nfa_proprietary_cfg;
@@ -110,31 +82,25 @@
 // Whitelist for hosts allowed to create a pipe
 // See ADM_CREATE_PIPE command in the ETSI test specification
 // ETSI TS 102 622, section 6.1.3.1
-static std::vector<uint8_t> host_allowlist;
+static std::vector<uint8_t> host_whitelist;
 
 namespace {
 void initializeGlobalDebugEnabledFlag() {
   nfc_debug_enabled =
       (NfcConfig::getUnsigned(NAME_NFC_DEBUG_ENABLED, 0) != 0) ? true : false;
 
-  bool debug_enabled = property_get_bool("persist.nfc.debug_enabled", false);
-
-  nfc_debug_enabled = (nfc_debug_enabled || debug_enabled);
+  char valueStr[PROPERTY_VALUE_MAX] = {0};
+  int len = property_get("nfc.debug_enabled", valueStr, "");
+  if (len > 0) {
+    // let Android property override .conf variable
+    unsigned debug_enabled = 0;
+    sscanf(valueStr, "%u", &debug_enabled);
+    nfc_debug_enabled = (debug_enabled == 0) ? false : true;
+  }
 
   DLOG_IF(INFO, nfc_debug_enabled)
       << StringPrintf("%s: level=%u", __func__, nfc_debug_enabled);
 }
-
-// initialize NciResetType Flag
-// NCI_RESET_TYPE
-// 0x00 default, reset configurations every time.
-// 0x01, reset configurations only once every boot.
-// 0x02, keep configurations.
-void initializeNciResetTypeFlag() {
-  nfc_nci_reset_type = NfcConfig::getUnsigned(NAME_NCI_RESET_TYPE, 0);
-  DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
-      "%s: nfc_nci_reset_type=%u", __func__, nfc_nci_reset_type);
-}
 }  // namespace
 
 class NfcClientCallback : public INfcClientCallback {
@@ -181,91 +147,13 @@
       const wp<::android::hidl::base::V1_0::IBase>& /* who */) {
     ALOGE(
         "NfcHalDeathRecipient::serviceDied - Nfc-Hal service died. Killing "
-        "NfcService");
+        "NfcServie");
     if (mNfcDeathHal) {
       mNfcDeathHal->unlinkToDeath(this);
     }
     mNfcDeathHal = NULL;
     abort();
   }
-  void finalize() {
-    if (mNfcDeathHal) {
-      mNfcDeathHal->unlinkToDeath(this);
-    } else {
-      DLOG_IF(INFO, nfc_debug_enabled)
-          << StringPrintf("%s: mNfcDeathHal is not set", __func__);
-    }
-
-    ALOGI("NfcHalDeathRecipient::destructor - NfcService");
-    mNfcDeathHal = NULL;
-  }
-};
-
-class NfcAidlClientCallback
-    : public ::aidl::android::hardware::nfc::BnNfcClientCallback {
- public:
-  NfcAidlClientCallback(tHAL_NFC_CBACK* eventCallback,
-                        tHAL_NFC_DATA_CBACK dataCallback) {
-    mEventCallback = eventCallback;
-    mDataCallback = dataCallback;
-  };
-  virtual ~NfcAidlClientCallback() = default;
-
-  ::ndk::ScopedAStatus sendEvent(NfcAidlEvent event,
-                                 NfcAidlStatus event_status) override {
-    uint8_t e_num;
-    uint8_t s_num;
-    switch (event) {
-      case NfcAidlEvent::OPEN_CPLT:
-        e_num = HAL_NFC_OPEN_CPLT_EVT;
-        break;
-      case NfcAidlEvent::CLOSE_CPLT:
-        e_num = HAL_NFC_CLOSE_CPLT_EVT;
-        break;
-      case NfcAidlEvent::POST_INIT_CPLT:
-        e_num = HAL_NFC_POST_INIT_CPLT_EVT;
-        break;
-      case NfcAidlEvent::PRE_DISCOVER_CPLT:
-        e_num = HAL_NFC_PRE_DISCOVER_CPLT_EVT;
-        break;
-      case NfcAidlEvent::HCI_NETWORK_RESET:
-        e_num = HAL_HCI_NETWORK_RESET;
-        break;
-      case NfcAidlEvent::ERROR:
-      default:
-        e_num = HAL_NFC_ERROR_EVT;
-    }
-    switch (event_status) {
-      case NfcAidlStatus::OK:
-        s_num = HAL_NFC_STATUS_OK;
-        break;
-      case NfcAidlStatus::FAILED:
-        s_num = HAL_NFC_STATUS_FAILED;
-        break;
-      case NfcAidlStatus::ERR_TRANSPORT:
-        s_num = HAL_NFC_STATUS_ERR_TRANSPORT;
-        break;
-      case NfcAidlStatus::ERR_CMD_TIMEOUT:
-        s_num = HAL_NFC_STATUS_ERR_CMD_TIMEOUT;
-        break;
-      case NfcAidlStatus::REFUSED:
-        s_num = HAL_NFC_STATUS_REFUSED;
-        break;
-      default:
-        s_num = HAL_NFC_STATUS_FAILED;
-    }
-    mEventCallback(e_num, (tHAL_NFC_STATUS)s_num);
-    return ::ndk::ScopedAStatus::ok();
-  };
-  ::ndk::ScopedAStatus sendData(const std::vector<uint8_t>& data) override {
-    std::vector<uint8_t> copy = data;
-    mDataCallback(copy.size(), &copy[0]);
-    return ::ndk::ScopedAStatus::ok();
-  };
-
- private:
-  tHAL_NFC_CBACK* mEventCallback;
-  tHAL_NFC_DATA_CBACK* mDataCallback;
 };
 
 /*******************************************************************************
@@ -278,9 +166,8 @@
 **
 *******************************************************************************/
 NfcAdaptation::NfcAdaptation() {
+  mNfcHalDeathRecipient = new NfcHalDeathRecipient(mHal);
   memset(&mHalEntryFuncs, 0, sizeof(mHalEntryFuncs));
-  mDeathRecipient = ::ndk::ScopedAIBinder_DeathRecipient(
-      AIBinder_DeathRecipient_new(NfcAdaptation::HalAidlBinderDied));
 }
 
 /*******************************************************************************
@@ -316,10 +203,7 @@
 void NfcAdaptation::GetVendorConfigs(
     std::map<std::string, ConfigValue>& configMap) {
   NfcVendorConfigV1_2 configValue;
-  NfcAidlConfig aidlConfigValue;
-  if (mAidlHal) {
-    mAidlHal->getConfig(&aidlConfigValue);
-  } else if (mHal_1_2) {
+  if (mHal_1_2) {
     mHal_1_2->getConfig_1_2(
         [&configValue](NfcVendorConfigV1_2 config) { configValue = config; });
   } else if (mHal_1_1) {
@@ -329,68 +213,7 @@
     });
   }
 
-  if (mAidlHal) {
-    std::vector<int8_t> nfaPropCfg = {
-        aidlConfigValue.nfaProprietaryCfg.protocol18092Active,
-        aidlConfigValue.nfaProprietaryCfg.protocolBPrime,
-        aidlConfigValue.nfaProprietaryCfg.protocolDual,
-        aidlConfigValue.nfaProprietaryCfg.protocol15693,
-        aidlConfigValue.nfaProprietaryCfg.protocolKovio,
-        aidlConfigValue.nfaProprietaryCfg.protocolMifare,
-        aidlConfigValue.nfaProprietaryCfg.discoveryPollKovio,
-        aidlConfigValue.nfaProprietaryCfg.discoveryPollBPrime,
-        aidlConfigValue.nfaProprietaryCfg.discoveryListenBPrime};
-    configMap.emplace(NAME_NFA_PROPRIETARY_CFG, ConfigValue(nfaPropCfg));
-    configMap.emplace(NAME_NFA_POLL_BAIL_OUT_MODE,
-                      ConfigValue(aidlConfigValue.nfaPollBailOutMode ? 1 : 0));
-    if (aidlConfigValue.offHostRouteUicc.size() != 0) {
-      configMap.emplace(NAME_OFFHOST_ROUTE_UICC,
-                        ConfigValue(aidlConfigValue.offHostRouteUicc));
-    }
-    if (aidlConfigValue.offHostRouteEse.size() != 0) {
-      configMap.emplace(NAME_OFFHOST_ROUTE_ESE,
-                        ConfigValue(aidlConfigValue.offHostRouteEse));
-    }
-    // AIDL byte would be int8_t in C++.
-    // Here we force cast int8_t to uint8_t for ConfigValue
-    configMap.emplace(
-        NAME_DEFAULT_OFFHOST_ROUTE,
-        ConfigValue((uint8_t)aidlConfigValue.defaultOffHostRoute));
-    configMap.emplace(NAME_DEFAULT_ROUTE,
-                      ConfigValue((uint8_t)aidlConfigValue.defaultRoute));
-    configMap.emplace(
-        NAME_DEFAULT_NFCF_ROUTE,
-        ConfigValue((uint8_t)aidlConfigValue.defaultOffHostRouteFelica));
-    configMap.emplace(NAME_DEFAULT_ISODEP_ROUTE,
-                      ConfigValue((uint8_t)aidlConfigValue.defaultIsoDepRoute));
-    configMap.emplace(
-        NAME_DEFAULT_SYS_CODE_ROUTE,
-        ConfigValue((uint8_t)aidlConfigValue.defaultSystemCodeRoute));
-    configMap.emplace(
-        NAME_DEFAULT_SYS_CODE_PWR_STATE,
-        ConfigValue((uint8_t)aidlConfigValue.defaultSystemCodePowerState));
-    configMap.emplace(NAME_OFF_HOST_SIM_PIPE_ID,
-                      ConfigValue((uint8_t)aidlConfigValue.offHostSIMPipeId));
-    configMap.emplace(NAME_OFF_HOST_ESE_PIPE_ID,
-                      ConfigValue((uint8_t)aidlConfigValue.offHostESEPipeId));
-
-    configMap.emplace(NAME_ISO_DEP_MAX_TRANSCEIVE,
-                      ConfigValue(aidlConfigValue.maxIsoDepTransceiveLength));
-    if (aidlConfigValue.hostAllowlist.size() != 0) {
-      configMap.emplace(NAME_DEVICE_HOST_ALLOW_LIST,
-                        ConfigValue(aidlConfigValue.hostAllowlist));
-    }
-    /* For Backwards compatibility */
-    if (aidlConfigValue.presenceCheckAlgorithm ==
-        AidlPresenceCheckAlgorithm::ISO_DEP_NAK) {
-      configMap.emplace(NAME_PRESENCE_CHECK_ALGORITHM,
-                        ConfigValue((uint32_t)NFA_RW_PRES_CHK_ISO_DEP_NAK));
-    } else {
-      configMap.emplace(
-          NAME_PRESENCE_CHECK_ALGORITHM,
-          ConfigValue((uint32_t)aidlConfigValue.presenceCheckAlgorithm));
-    }
-  } else if (mHal_1_1 || mHal_1_2) {
+  if (mHal_1_1 || mHal_1_2) {
     std::vector<uint8_t> nfaPropCfg = {
         configValue.v1_1.nfaProprietaryCfg.protocol18092Active,
         configValue.v1_1.nfaProprietaryCfg.protocolBPrime,
@@ -432,7 +255,7 @@
     configMap.emplace(NAME_ISO_DEP_MAX_TRANSCEIVE,
                       ConfigValue(configValue.v1_1.maxIsoDepTransceiveLength));
     if (configValue.v1_1.hostWhitelist.size() != 0) {
-      configMap.emplace(NAME_DEVICE_HOST_ALLOW_LIST,
+      configMap.emplace(NAME_DEVICE_HOST_WHITE_LIST,
                         ConfigValue(configValue.v1_1.hostWhitelist));
     }
     /* For Backwards compatibility */
@@ -466,7 +289,6 @@
   logging::SetLogItems(false, false, false, false);
 
   initializeGlobalDebugEnabledFlag();
-  initializeNciResetTypeFlag();
 
   DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: enter", func);
 
@@ -478,9 +300,9 @@
     if (dm_config.size() > 1) nfa_dm_cfg.auto_read_ndef = dm_config[1];
     if (dm_config.size() > 2) nfa_dm_cfg.auto_presence_check = dm_config[2];
     if (dm_config.size() > 3) nfa_dm_cfg.presence_check_option = dm_config[3];
-    // NOTE: The timeout value is not configurable here because the endianness
+    // NOTE: The timeout value is not configurable here because the endianess
     // of a byte array is ambiguous and needlessly difficult to configure.
-    // If this value needs to be configurable, a numeric config option should
+    // If this value needs to be configgurable, a numeric config option should
     // be used.
   }
 
@@ -521,12 +343,12 @@
       nfa_proprietary_cfg.pro_discovery_b_prime_listen = p_config[8];
   }
 
-  // Configure allowlist of HCI host ID's
+  // Configure whitelist of HCI host ID's
   // See specification: ETSI TS 102 622, section 6.1.3.1
-  if (NfcConfig::hasKey(NAME_DEVICE_HOST_ALLOW_LIST)) {
-    host_allowlist = NfcConfig::getBytes(NAME_DEVICE_HOST_ALLOW_LIST);
-    nfa_hci_cfg.num_allowlist_host = host_allowlist.size();
-    nfa_hci_cfg.p_allowlist = &host_allowlist[0];
+  if (NfcConfig::hasKey(NAME_DEVICE_HOST_WHITE_LIST)) {
+    host_whitelist = NfcConfig::getBytes(NAME_DEVICE_HOST_WHITE_LIST);
+    nfa_hci_cfg.num_whitelist_host = host_whitelist.size();
+    nfa_hci_cfg.p_whitelist = &host_whitelist[0];
   }
 
   verify_stack_non_volatile_store();
@@ -571,17 +393,12 @@
 
   NfcConfig::clear();
 
-  if (mHal != nullptr) {
-    mNfcHalDeathRecipient->finalize();
-  }
   DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: exit", func);
   delete this;
 }
 
 void NfcAdaptation::FactoryReset() {
-  if (mAidlHal != nullptr) {
-    mAidlHal->factoryReset();
-  } else if (mHal_1_2 != nullptr) {
+  if (mHal_1_2 != nullptr) {
     mHal_1_2->factoryReset();
   } else if (mHal_1_1 != nullptr) {
     mHal_1_1->factoryReset();
@@ -589,19 +406,13 @@
 }
 
 void NfcAdaptation::DeviceShutdown() {
-  if (mAidlHal != nullptr) {
-    mAidlHal->close(NfcCloseType::HOST_SWITCHED_OFF);
-    AIBinder_unlinkToDeath(mAidlHal->asBinder().get(), mDeathRecipient.get(),
-                           this);
-  } else {
-    if (mHal_1_2 != nullptr) {
-      mHal_1_2->closeForPowerOffCase();
-    } else if (mHal_1_1 != nullptr) {
-      mHal_1_1->closeForPowerOffCase();
-    }
-    if (mHal != nullptr) {
-      mHal->unlinkToDeath(mNfcHalDeathRecipient);
-    }
+  if (mHal_1_2 != nullptr) {
+    mHal_1_2->closeForPowerOffCase();
+  } else if (mHal_1_1 != nullptr) {
+    mHal_1_1->closeForPowerOffCase();
+  }
+  if (mHal) {
+    mHal->unlinkToDeath(mNfcHalDeathRecipient);
   }
 }
 
@@ -687,7 +498,7 @@
 **
 ** Function:    NfcAdaptation::InitializeHalDeviceContext
 **
-** Description: Check validity of current handle to the nfc HAL service
+** Description: Ask the generic Android HAL to find the Broadcom-specific HAL.
 **
 ** Returns:     None.
 **
@@ -706,35 +517,18 @@
   mHalEntryFuncs.power_cycle = HalPowerCycle;
   mHalEntryFuncs.get_max_ee = HalGetMaxNfcee;
   LOG(INFO) << StringPrintf("%s: INfc::getService()", func);
-  mAidlHal = nullptr;
-  mHal = mHal_1_1 = mHal_1_2 = nullptr;
-  if (!use_aidl) {
-    mHal = mHal_1_1 = mHal_1_2 = INfcV1_2::getService();
-  }
-  if (!use_aidl && mHal_1_2 == nullptr) {
+  mHal = mHal_1_1 = mHal_1_2 = INfcV1_2::getService();
+  if (mHal_1_2 == nullptr) {
     mHal = mHal_1_1 = INfcV1_1::getService();
     if (mHal_1_1 == nullptr) {
       mHal = INfc::getService();
     }
   }
-  if (mHal == nullptr) {
-    // Try get AIDL
-    ::ndk::SpAIBinder binder(
-        AServiceManager_getService(NFC_AIDL_HAL_SERVICE_NAME.c_str()));
-    mAidlHal = INfcAidl::fromBinder(binder);
-    if (mAidlHal != nullptr) {
-      use_aidl = true;
-      AIBinder_linkToDeath(mAidlHal->asBinder().get(), mDeathRecipient.get(),
-                           this /* cookie */);
-      mHal = mHal_1_1 = mHal_1_2 = nullptr;
-      LOG(INFO) << StringPrintf("%s: INfcAidl::fromBinder returned", func);
-    }
-    LOG_FATAL_IF(mAidlHal == nullptr, "Failed to retrieve the NFC AIDL!");
-  } else {
-    LOG(INFO) << StringPrintf("%s: INfc::getService() returned %p (%s)", func,
-                              mHal.get(),
-                              (mHal->isRemote() ? "remote" : "local"));
-    mNfcHalDeathRecipient = new NfcHalDeathRecipient(mHal);
+  LOG_FATAL_IF(mHal == nullptr, "Failed to retrieve the NFC HAL!");
+  LOG(INFO) << StringPrintf("%s: INfc::getService() returned %p (%s)", func,
+                            mHal.get(),
+                            (mHal->isRemote() ? "remote" : "local"));
+  if (mHal) {
     mHal->linkToDeath(mNfcHalDeathRecipient, 0);
   }
 }
@@ -782,22 +576,10 @@
                             tHAL_NFC_DATA_CBACK* p_data_cback) {
   const char* func = "NfcAdaptation::HalOpen";
   DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s", func);
-
-  if (mAidlHal != nullptr) {
-    mAidlCallback = ::ndk::SharedRefBase::make<NfcAidlClientCallback>(
-        p_hal_cback, p_data_cback);
-    Status status = mAidlHal->open(mAidlCallback);
-    if (!status.isOk()) {
-      LOG(ERROR) << "Open Error: "
-                 << ::aidl::android::hardware::nfc::toString(
-                        static_cast<NfcAidlStatus>(
-                            status.getServiceSpecificError()));
-    }
-  } else if (mHal_1_1 != nullptr) {
-    mCallback = new NfcClientCallback(p_hal_cback, p_data_cback);
+  mCallback = new NfcClientCallback(p_hal_cback, p_data_cback);
+  if (mHal_1_1 != nullptr) {
     mHal_1_1->open_1_1(mCallback);
   } else {
-    mCallback = new NfcClientCallback(p_hal_cback, p_data_cback);
     mHal->open(mCallback);
   }
 }
@@ -814,11 +596,42 @@
 void NfcAdaptation::HalClose() {
   const char* func = "NfcAdaptation::HalClose";
   DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s", func);
-  if (mAidlHal != nullptr) {
-    mAidlHal->close(NfcCloseType::DISABLE);
-  } else {
-    mHal->close();
-  }
+  mHal->close();
+}
+
+/*******************************************************************************
+**
+** Function:    NfcAdaptation::HalDeviceContextCallback
+**
+** Description: Translate generic Android HAL's callback into Broadcom-specific
+**              callback function.
+**
+** Returns:     None.
+**
+*******************************************************************************/
+void NfcAdaptation::HalDeviceContextCallback(nfc_event_t event,
+                                             nfc_status_t event_status) {
+  const char* func = "NfcAdaptation::HalDeviceContextCallback";
+  DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: event=%u", func, event);
+  if (mHalCallback) mHalCallback(event, (tHAL_NFC_STATUS)event_status);
+}
+
+/*******************************************************************************
+**
+** Function:    NfcAdaptation::HalDeviceContextDataCallback
+**
+** Description: Translate generic Android HAL's callback into Broadcom-specific
+**              callback function.
+**
+** Returns:     None.
+**
+*******************************************************************************/
+void NfcAdaptation::HalDeviceContextDataCallback(uint16_t data_len,
+                                                 uint8_t* p_data) {
+  const char* func = "NfcAdaptation::HalDeviceContextDataCallback";
+  DLOG_IF(INFO, nfc_debug_enabled)
+      << StringPrintf("%s: len=%u", func, data_len);
+  if (mHalDataCallback) mHalDataCallback(data_len, p_data);
 }
 
 /*******************************************************************************
@@ -833,16 +646,9 @@
 void NfcAdaptation::HalWrite(uint16_t data_len, uint8_t* p_data) {
   const char* func = "NfcAdaptation::HalWrite";
   DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s", func);
-
-  if (mAidlHal != nullptr) {
-    int ret;
-    std::vector<uint8_t> aidl_data(p_data, p_data + data_len);
-    mAidlHal->write(aidl_data, &ret);
-  } else {
-    ::android::hardware::nfc::V1_0::NfcData data;
-    data.setToExternal(p_data, data_len);
-    mHal->write(data);
-  }
+  ::android::hardware::nfc::V1_0::NfcData data;
+  data.setToExternal(p_data, data_len);
+  mHal->write(data);
 }
 
 /*******************************************************************************
@@ -858,14 +664,10 @@
                                        uint8_t* p_core_init_rsp_params) {
   const char* func = "NfcAdaptation::HalCoreInitialized";
   DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s", func);
-  if (mAidlHal != nullptr) {
-    // AIDL coreInitialized doesn't send data to HAL.
-    mAidlHal->coreInitialized();
-  } else {
-    hidl_vec<uint8_t> data;
-    data.setToExternal(p_core_init_rsp_params, data_len);
-    mHal->coreInitialized(data);
-  }
+  hidl_vec<uint8_t> data;
+  data.setToExternal(p_core_init_rsp_params, data_len);
+
+  mHal->coreInitialized(data);
 }
 
 /*******************************************************************************
@@ -885,18 +687,9 @@
 bool NfcAdaptation::HalPrediscover() {
   const char* func = "NfcAdaptation::HalPrediscover";
   DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s", func);
-  if (mAidlHal != nullptr) {
-    Status status = mAidlHal->preDiscover();
-    if (status.isOk()) {
-      DLOG_IF(INFO, nfc_debug_enabled)
-          << StringPrintf("%s wait for NFC_PRE_DISCOVER_CPLT_EVT", func);
-      return true;
-    }
-  } else {
-    mHal->prediscover();
-  }
-
-  return false;
+  bool retval = FALSE;
+  mHal->prediscover();
+  return retval;
 }
 
 /*******************************************************************************
@@ -915,11 +708,7 @@
 void NfcAdaptation::HalControlGranted() {
   const char* func = "NfcAdaptation::HalControlGranted";
   DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s", func);
-  if (mAidlHal != nullptr) {
-    LOG(ERROR) << StringPrintf("Unsupported function %s", func);
-  } else {
-    mHal->controlGranted();
-  }
+  mHal->controlGranted();
 }
 
 /*******************************************************************************
@@ -934,11 +723,7 @@
 void NfcAdaptation::HalPowerCycle() {
   const char* func = "NfcAdaptation::HalPowerCycle";
   DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s", func);
-  if (mAidlHal != nullptr) {
-    mAidlHal->powerCycle();
-  } else {
-    mHal->powerCycle();
-  }
+  mHal->powerCycle();
 }
 
 /*******************************************************************************
@@ -1033,31 +818,6 @@
 
 /*******************************************************************************
 **
-** Function:    NfcAdaptation::HalAidlBinderDiedImpl
-**
-** Description: Abort nfc service when AIDL process died.
-**
-** Returns:     None.
-**
-*******************************************************************************/
-void NfcAdaptation::HalAidlBinderDiedImpl() {
-  LOG(WARNING) << __func__ << "INfc aidl hal died, resetting the state";
-  if (mAidlHal != nullptr) {
-    AIBinder_unlinkToDeath(mAidlHal->asBinder().get(), mDeathRecipient.get(),
-                           this);
-    mAidlHal = nullptr;
-  }
-  abort();
-}
-
-// static
-void NfcAdaptation::HalAidlBinderDied(void* cookie) {
-  auto thiz = static_cast<NfcAdaptation*>(cookie);
-  thiz->HalAidlBinderDiedImpl();
-}
-
-/*******************************************************************************
-**
 ** Function:    ThreadMutex::ThreadMutex()
 **
 ** Description: class constructor
diff --git a/src/adaptation/debug_lmrt.cc b/src/adaptation/debug_lmrt.cc
deleted file mode 100644
index 1ef3c7a..0000000
--- a/src/adaptation/debug_lmrt.cc
+++ /dev/null
@@ -1,156 +0,0 @@
-/**
- * Copyright (C) 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 "include/debug_lmrt.h"
-
-#include <android-base/logging.h>
-#include <android-base/stringprintf.h>
-
-using android::base::StringPrintf;
-
-extern bool nfc_debug_enabled;
-
-/* The payload of each RF_SET_LISTEN_MODE_ROUTING_CMD when commit routing */
-lmrt_payload_t lmrt_payloads;
-
-/* The committed routing table stored in tlv form  */
-std::vector<uint8_t> committed_lmrt_tlvs(0);
-
-/*******************************************************************************
-**
-** Function         debug_lmrt_init
-**
-** Description      initialize the lmrt_payloads
-**
-** Returns          None
-**
-*******************************************************************************/
-void debug_lmrt_init(void) {
-  std::vector<uint8_t> empty_more(0);
-  std::vector<uint8_t> empty_entry_count(0);
-  std::vector<std::vector<uint8_t>> empty_tlvs(0);
-
-  lmrt_payloads.more.swap(empty_more);
-  lmrt_payloads.entry_count.swap(empty_entry_count);
-  lmrt_payloads.tlvs.swap(empty_tlvs);
-}
-
-/*******************************************************************************
-**
-** Function         lmrt_log
-**
-** Description      print the listen mode routing configuration for debug use
-**
-** Returns          None
-**
-*******************************************************************************/
-void lmrt_log(void) {
-  if (!nfc_debug_enabled) return;
-
-  static const char hexmap[] = {'0', '1', '2', '3', '4', '5', '6', '7',
-                                '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
-
-  for (int i = 0; i < lmrt_payloads.more.size(); i++) {
-    std::string tlvs_str;
-    for (uint8_t byte : lmrt_payloads.tlvs[i]) {
-      tlvs_str.push_back(hexmap[byte >> 4]);
-      tlvs_str.push_back(hexmap[byte & 0x0F]);
-    }
-
-    LOG(INFO) << StringPrintf("lmrt_log: Packet %d/%d, %d more packet", i + 1,
-                              (int)lmrt_payloads.more.size(),
-                              lmrt_payloads.more[i]);
-    LOG(INFO) << StringPrintf("lmrt_log: %d entries in this packet",
-                              lmrt_payloads.entry_count[i]);
-
-    LOG(INFO) << StringPrintf("lmrt_log: tlv: %s", tlvs_str.c_str());
-  }
-}
-
-/*******************************************************************************
-**
-** Function         lmrt_capture
-**
-** Description      record the last RF_SET_LISTEN_MODE_ROUTING_CMD
-**
-** Returns          None
-**
-*******************************************************************************/
-void lmrt_capture(uint8_t* buf, uint8_t buf_size) {
-  if (buf == nullptr || buf_size < 5) return;
-
-  if (lmrt_payloads.more.size() > 0) {
-    if (lmrt_payloads.more.back() == 0) {
-      /* if the MORE setting of the last lmrt command is 0x00,
-       * that means the data in lmrt_payloads are obsolete, empty it */
-      debug_lmrt_init();
-    }
-  }
-
-  /* push_back the last lmrt command to lmrt_payloads */
-  lmrt_payloads.more.push_back(buf[3]);
-  lmrt_payloads.entry_count.push_back(buf[4]);
-  if (buf_size == 5) {
-    lmrt_payloads.tlvs.push_back(std::vector<uint8_t>(0));
-  } else {
-    lmrt_payloads.tlvs.push_back(std::vector<uint8_t>(buf + 5, buf + buf_size));
-  }
-}
-
-/*******************************************************************************
-**
-** Function         lmrt_update
-**
-** Description      Update the committed tlvs to committed_lmrt_tlvs
-**
-** Returns          None
-**
-*******************************************************************************/
-void lmrt_update(void) {
-  lmrt_log();
-  std::vector<uint8_t> temp(0);
-
-  /* combine all tlvs in lmrt_payloads.tlvs */
-  for (auto tlv : lmrt_payloads.tlvs) {
-    temp.insert(temp.end(), tlv.begin(), tlv.end());
-  }
-
-  committed_lmrt_tlvs.swap(temp);
-}
-
-/*******************************************************************************
-**
-** Function         lmrt_get_max_size
-**
-** Description      This function is used to get the max size of the routing
-**                  table from cache
-**
-** Returns          Max Routing Table Size
-**
-*******************************************************************************/
-int lmrt_get_max_size(void) { return nfc_cb.max_ce_table; }
-
-/*******************************************************************************
-**
-** Function         lmrt_get_tlvs
-**
-** Description      This function is used to get the committed listen mode
-**                  routing configuration command
-**
-** Returns          The committed listen mode routing configuration command
-**
-*******************************************************************************/
-std::vector<uint8_t>* lmrt_get_tlvs() { return &committed_lmrt_tlvs; }
diff --git a/src/adaptation/debug_nfcsnoop.cc b/src/adaptation/debug_nfcsnoop.cc
index da8508e..ce283c1 100644
--- a/src/adaptation/debug_nfcsnoop.cc
+++ b/src/adaptation/debug_nfcsnoop.cc
@@ -16,21 +16,20 @@
  *
  ******************************************************************************/
 
-#include "include/debug_nfcsnoop.h"
-
 #include <android-base/logging.h>
 #include <android-base/stringprintf.h>
-#include <cutils/properties.h>
-#include <fcntl.h>
 #include <resolv.h>
-#include <ringbuffer.h>
-#include <sys/stat.h>
-#include <sys/time.h>
 #include <zlib.h>
-
 #include <mutex>
 
+#include <ringbuffer.h>
+
+#include <cutils/properties.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+
 #include "bt_types.h"
+#include "include/debug_nfcsnoop.h"
 #include "nfc_int.h"
 
 #define USEC_PER_SEC 1000000ULL
@@ -51,33 +50,24 @@
 // Maximum line length in bugreport (should be multiple of 4 for base64 output)
 static const uint8_t MAX_LINE_LENGTH = 128;
 
-static const size_t BUFFER_SIZE = 2;
-static const size_t SYSTEM_BUFFER_INDEX = 0;
-static const size_t VENDOR_BUFFER_INDEX = 1;
-static const char* BUFFER_NAMES[BUFFER_SIZE] = {"LOG_SUMMARY",
-                                                "VS_LOG_SUMMARY"};
-
 static std::mutex buffer_mutex;
-static ringbuffer_t* buffers[BUFFER_SIZE] = {nullptr, nullptr};
-static uint64_t last_timestamp_ms[BUFFER_SIZE] = {0, 0};
+static ringbuffer_t* buffer = nullptr;
+static uint64_t last_timestamp_ms = 0;
 static bool isDebuggable = false;
 
 using android::base::StringPrintf;
 
 static void nfcsnoop_cb(const uint8_t* data, const size_t length,
-                        bool is_received, const uint64_t timestamp_us,
-                        size_t buffer_index) {
+                        bool is_received, const uint64_t timestamp_us) {
   nfcsnooz_header_t header;
 
   std::lock_guard<std::mutex> lock(buffer_mutex);
 
   // Make room in the ring buffer
 
-  while (ringbuffer_available(buffers[buffer_index]) <
-         (length + sizeof(nfcsnooz_header_t))) {
-    ringbuffer_pop(buffers[buffer_index], (uint8_t*)&header,
-                   sizeof(nfcsnooz_header_t));
-    ringbuffer_delete(buffers[buffer_index], header.length);
+  while (ringbuffer_available(buffer) < (length + sizeof(nfcsnooz_header_t))) {
+    ringbuffer_pop(buffer, (uint8_t*)&header, sizeof(nfcsnooz_header_t));
+    ringbuffer_delete(buffer, header.length);
   }
 
   // Insert data
@@ -85,17 +75,15 @@
   header.is_received = is_received ? 1 : 0;
 
   uint64_t delta_time_ms = 0;
-  if (last_timestamp_ms[buffer_index]) {
-    __builtin_sub_overflow(timestamp_us, last_timestamp_ms[buffer_index],
-                           &delta_time_ms);
+  if (last_timestamp_ms) {
+    __builtin_sub_overflow(timestamp_us, last_timestamp_ms, &delta_time_ms);
   }
   header.delta_time_ms = delta_time_ms;
 
-  last_timestamp_ms[buffer_index] = timestamp_us;
+  last_timestamp_ms = timestamp_us;
 
-  ringbuffer_insert(buffers[buffer_index], (uint8_t*)&header,
-                    sizeof(nfcsnooz_header_t));
-  ringbuffer_insert(buffers[buffer_index], data, length);
+  ringbuffer_insert(buffer, (uint8_t*)&header, sizeof(nfcsnooz_header_t));
+  ringbuffer_insert(buffer, data, length);
 }
 
 static bool nfcsnoop_compress(ringbuffer_t* rb_dst, ringbuffer_t* rb_src) {
@@ -145,120 +133,87 @@
                        static_cast<uint64_t>(tv.tv_usec);
   uint8_t* p = (uint8_t*)(packet + 1) + packet->offset;
   uint8_t mt = (*(p)&NCI_MT_MASK) >> NCI_MT_SHIFT;
-  uint8_t gid = *(p)&NCI_GID_MASK;
-  if (isDebuggable && ringbuffer_available(buffers[SYSTEM_BUFFER_INDEX]) <
-                          NFCSNOOP_MEM_BUFFER_THRESHOLD) {
+  if (isDebuggable &&
+      ringbuffer_available(buffer) < NFCSNOOP_MEM_BUFFER_THRESHOLD) {
     if (storeNfcSnoopLogs(DEFAULT_NFCSNOOP_PATH, DEFAULT_NFCSNOOP_FILE_SIZE)) {
       std::lock_guard<std::mutex> lock(buffer_mutex);
       // Free the buffer after the content is stored in log file
-      ringbuffer_free(buffers[SYSTEM_BUFFER_INDEX]);
-      buffers[SYSTEM_BUFFER_INDEX] = nullptr;
+      ringbuffer_free(buffer);
+      buffer = nullptr;
       // Allocate new buffer to store new NCI logs
       debug_nfcsnoop_init();
     }
   }
-
-  if (mt == NCI_MT_NTF && gid == NCI_GID_PROP) {
-    nfcsnoop_cb(p, p[2] + NCI_MSG_HDR_SIZE, is_received, timestamp,
-                VENDOR_BUFFER_INDEX);
-  } else if (mt == NCI_MT_DATA) {
-    nfcsnoop_cb(p, NCI_DATA_HDR_SIZE, is_received, timestamp,
-                SYSTEM_BUFFER_INDEX);
+  if (mt == NCI_MT_DATA) {
+    nfcsnoop_cb(p, NCI_DATA_HDR_SIZE, is_received, timestamp);
   } else if (packet->len > 2) {
-    nfcsnoop_cb(p, p[2] + NCI_MSG_HDR_SIZE, is_received, timestamp,
-                SYSTEM_BUFFER_INDEX);
+    nfcsnoop_cb(p, p[2] + NCI_MSG_HDR_SIZE, is_received, timestamp);
   }
 }
 
 void debug_nfcsnoop_init(void) {
-  for (size_t buffer_index = 0; buffer_index < BUFFER_SIZE; ++buffer_index) {
-    if (buffers[buffer_index] == nullptr) {
-      buffers[buffer_index] = ringbuffer_init(NFCSNOOP_MEM_BUFFER_SIZE);
-    }
-  }
+  if (buffer == nullptr) buffer = ringbuffer_init(NFCSNOOP_MEM_BUFFER_SIZE);
   isDebuggable = property_get_int32("ro.debuggable", 0);
 }
 
 void debug_nfcsnoop_dump(int fd) {
-  for (size_t buffer_index = 0; buffer_index < BUFFER_SIZE; ++buffer_index) {
-    if (buffers[buffer_index] == nullptr) {
-      dprintf(fd, "%s Nfcsnoop is not ready (%s)\n", __func__,
-              BUFFER_NAMES[buffer_index]);
-      return;
-    }
+  if (buffer == nullptr) {
+    dprintf(fd, "%s Nfcsnoop is not ready\n", __func__);
+    return;
   }
-  ringbuffer_t* ringbuffers[BUFFER_SIZE];
-  for (size_t buffer_index = 0; buffer_index < BUFFER_SIZE; ++buffer_index) {
-    ringbuffers[buffer_index] = ringbuffer_init(NFCSNOOP_MEM_BUFFER_SIZE);
-    if (ringbuffers[buffer_index] == nullptr) {
-      dprintf(fd, "%s Unable to allocate memory for compression (%s)", __func__,
-              BUFFER_NAMES[buffer_index]);
-      for (size_t previous_index = 0; previous_index < buffer_index;
-           ++previous_index) {
-        ringbuffer_free(ringbuffers[previous_index]);
-      }
-      return;
-    }
+  ringbuffer_t* ringbuffer = ringbuffer_init(NFCSNOOP_MEM_BUFFER_SIZE);
+  if (ringbuffer == nullptr) {
+    dprintf(fd, "%s Unable to allocate memory for compression", __func__);
+    return;
   }
 
+  // Prepend preamble
+
+  nfcsnooz_preamble_t preamble;
+  preamble.version = NFCSNOOZ_CURRENT_VERSION;
+  preamble.last_timestamp_ms = last_timestamp_ms;
+  ringbuffer_insert(ringbuffer, (uint8_t*)&preamble,
+                    sizeof(nfcsnooz_preamble_t));
+
   // Compress data
 
-  for (size_t buffer_index = 0; buffer_index < BUFFER_SIZE; ++buffer_index) {
-    // Prepend preamble
+  uint8_t b64_in[3] = {0};
+  char b64_out[5] = {0};
 
-    nfcsnooz_preamble_t preamble;
-    preamble.version = NFCSNOOZ_CURRENT_VERSION;
-    preamble.last_timestamp_ms = last_timestamp_ms[buffer_index];
+  size_t line_length = 0;
 
-    ringbuffer_insert(ringbuffers[buffer_index], (uint8_t*)&preamble,
-                      sizeof(nfcsnooz_preamble_t));
-
-    uint8_t b64_in[3] = {0};
-    char b64_out[5] = {0};
-
-    size_t line_length = 0;
-
-    bool rc;
-    {
-      std::lock_guard<std::mutex> lock(buffer_mutex);
-      dprintf(fd, "--- BEGIN:NFCSNOOP_%s (%zu bytes in) ---\n",
-              BUFFER_NAMES[buffer_index],
-              ringbuffer_size(buffers[buffer_index]));
-      rc = nfcsnoop_compress(ringbuffers[buffer_index], buffers[buffer_index]);
-    }
-
-    if (rc == false) {
-      dprintf(fd, "%s Log compression failed (%s)", __func__,
-              BUFFER_NAMES[buffer_index]);
-      goto error;
-    }
-
-    // Base64 encode & output
-
-    while (ringbuffer_size(ringbuffers[buffer_index]) > 0) {
-      size_t read = ringbuffer_pop(ringbuffers[buffer_index], b64_in, 3);
-      if (line_length >= MAX_LINE_LENGTH) {
-        dprintf(fd, "\n");
-        line_length = 0;
-      }
-      line_length += b64_ntop(b64_in, read, b64_out, 5);
-      dprintf(fd, "%s", b64_out);
-    }
-
-    dprintf(fd, "\n--- END:NFCSNOOP_%s ---\n", BUFFER_NAMES[buffer_index]);
+  bool rc;
+  {
+    std::lock_guard<std::mutex> lock(buffer_mutex);
+    dprintf(fd, "--- BEGIN:NFCSNOOP_LOG_SUMMARY (%zu bytes in) ---\n",
+            ringbuffer_size(buffer));
+    rc = nfcsnoop_compress(ringbuffer, buffer);
   }
 
+  if (rc == false) {
+    dprintf(fd, "%s Log compression failed", __func__);
+    goto error;
+  }
+
+  // Base64 encode & output
+
+  while (ringbuffer_size(ringbuffer) > 0) {
+    size_t read = ringbuffer_pop(ringbuffer, b64_in, 3);
+    if (line_length >= MAX_LINE_LENGTH) {
+      dprintf(fd, "\n");
+      line_length = 0;
+    }
+    line_length += b64_ntop(b64_in, read, b64_out, 5);
+    dprintf(fd, "%s", b64_out);
+  }
+
+  dprintf(fd, "\n--- END:NFCSNOOP_LOG_SUMMARY ---\n");
+
 error:
-  for (size_t buffer_index = 0; buffer_index < BUFFER_SIZE; ++buffer_index) {
-    ringbuffer_free(ringbuffers[buffer_index]);
-  }
+  ringbuffer_free(ringbuffer);
 }
 
 bool storeNfcSnoopLogs(std::string filepath, off_t maxFileSize) {
-#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
-  return true;
-#endif
-
   int fileStream;
   off_t fileSize;
   // check file size
diff --git a/src/fuzzers/fuzz_cmn.cc b/src/fuzzers/fuzz_cmn.cc
index 9d2fded..930026c 100644
--- a/src/fuzzers/fuzz_cmn.cc
+++ b/src/fuzzers/fuzz_cmn.cc
@@ -8,14 +8,6 @@
 
 uint8_t appl_dta_mode_flag = 0;
 bool nfc_debug_enabled = true;
-bool nfc_nci_reset_keep_cfg_enabled = false;
-uint8_t nfc_nci_reset_type = 0x00;
-
-namespace android {
-namespace util {
-void stats_write(int32_t, ...) {}
-}  // namespace util
-}  // namespace android
 
 #ifdef STANDALONE_FUZZER
 int main(int argc, char* argv[]) {
diff --git a/src/fuzzers/inc/statslog.h b/src/fuzzers/inc/statslog.h
index 84a88c2..c627aeb 100644
--- a/src/fuzzers/inc/statslog.h
+++ b/src/fuzzers/inc/statslog.h
@@ -13,7 +13,7 @@
   NFC_ERROR_OCCURRED,
 };
 
-void stats_write(int32_t, ...);
+void stats_write(int32_t, ...) {}
 }  // namespace util
 }  // namespace android
 
diff --git a/src/fuzzers/integration/fakes/base64_fakes.cc b/src/fuzzers/integration/fakes/base64_fakes.cc
deleted file mode 100644
index 6d4ab44..0000000
--- a/src/fuzzers/integration/fakes/base64_fakes.cc
+++ /dev/null
@@ -1,3 +0,0 @@
-#include <stdlib.h>
-
-extern "C" void __b64_ntop() { abort(); }
diff --git a/src/fuzzers/integration/fakes/gki_time_fakes.cc b/src/fuzzers/integration/fakes/gki_time_fakes.cc
deleted file mode 100644
index e9c7035..0000000
--- a/src/fuzzers/integration/fakes/gki_time_fakes.cc
+++ /dev/null
@@ -1,106 +0,0 @@
-#include "android-base/logging.h"
-#include "gki.h"
-
-// Timers are handled explicitly by the fuzzer
-void GKI_start_timer(unsigned char, int, bool) {}
-void GKI_stop_timer(uint8_t) {}
-
-uint32_t GKI_get_remaining_ticks(TIMER_LIST_Q*, TIMER_LIST_ENT*) {
-  CHECK(false);
-  return 0;
-}
-
-void GKI_init_timer_list(TIMER_LIST_Q* p_timer_listq) {
-  new (p_timer_listq) TIMER_LIST_Q;
-}
-
-void GKI_add_to_timer_list(TIMER_LIST_Q* p_timer_listq, TIMER_LIST_ENT* p_tle) {
-  if (!p_tle || !p_timer_listq || p_tle->ticks < 0) {
-    return;
-  }
-
-  p_tle->in_use = true;
-
-  auto it = p_timer_listq->begin();
-  while (it != p_timer_listq->end()) {
-    TIMER_LIST_ENT* p_successor = *it;
-
-    // Reached successor
-    if (p_tle->ticks <= p_successor->ticks) {
-      p_successor->ticks -= p_tle->ticks;
-      break;
-    }
-
-    // Account for predecessor ticks
-    if (p_successor->ticks > 0) {
-      p_tle->ticks -= p_successor->ticks;
-    }
-
-    it++;
-  }
-
-  p_timer_listq->insert(it, p_tle);
-}
-
-void GKI_remove_from_timer_list(TIMER_LIST_Q* p_timer_listq,
-                                TIMER_LIST_ENT* p_tle) {
-  if (!p_tle || !p_tle->in_use) {
-    return;
-  }
-
-  auto it = std::find(p_timer_listq->begin(), p_timer_listq->end(), p_tle);
-  if (it == p_timer_listq->end()) {
-    return;
-  }
-
-  auto successor_it = p_timer_listq->erase(it);
-
-  // Add remaining ticks to subsequent timer
-  if (successor_it != p_timer_listq->end()) {
-    (*successor_it)->ticks += p_tle->ticks;
-  }
-
-  p_tle->ticks = 0;
-  p_tle->in_use = false;
-}
-
-uint16_t GKI_update_timer_list(TIMER_LIST_Q* p_timer_listq,
-                               int32_t num_units_since_last_update) {
-  uint16_t num_time_out = 0;
-
-  for (auto it : *p_timer_listq) {
-    if (it->ticks <= 0) {
-      num_time_out++;
-      continue;
-    }
-
-    if (num_units_since_last_update <= 0) {
-      break;
-    }
-
-    int32_t temp_ticks = it->ticks;
-    it->ticks -= num_units_since_last_update;
-
-    // Check for timeout
-    if (it->ticks <= 0) {
-      it->ticks = 0;
-      num_time_out++;
-    }
-
-    // Decrement ticks to process
-    num_units_since_last_update -= temp_ticks;
-  }
-
-  return num_time_out;
-}
-
-bool GKI_timer_list_empty(TIMER_LIST_Q* p_timer_listq) {
-  return p_timer_listq->empty();
-}
-
-TIMER_LIST_ENT* GKI_timer_list_first(TIMER_LIST_Q* p_timer_listq) {
-  return *p_timer_listq->begin();
-}
-
-uint32_t g_tick_count = 0;
-uint32_t GKI_get_tick_count() { return g_tick_count++; }
diff --git a/src/fuzzers/integration/fakes/gki_ulinux_fakes.cc b/src/fuzzers/integration/fakes/gki_ulinux_fakes.cc
deleted file mode 100644
index 7ad96a4..0000000
--- a/src/fuzzers/integration/fakes/gki_ulinux_fakes.cc
+++ /dev/null
@@ -1,34 +0,0 @@
-#include "android-base/logging.h"
-#include "gki.h"
-#include "gki_int.h"
-
-tGKI_CB gki_cb;
-
-void* GKI_os_malloc(uint32_t size) { return malloc(size); }
-
-void GKI_os_free(void* p) {
-  if (p) {
-    free(p);
-  }
-}
-
-void GKI_exception(uint16_t, std::string s) { LOG(ERROR) << s; }
-
-// We fuzz in a single thread so locks and scheduling are not implemented
-
-void GKI_disable(void) {}
-void GKI_enable(void) {}
-
-void GKI_exit_task(unsigned char) { CHECK(false); }
-
-uint8_t GKI_get_taskid() { return NFC_TASK; }
-uint32_t GKI_get_os_tick_count() { return 0; }
-
-void GKI_sched_unlock() {}
-void GKI_sched_lock() {}
-
-uint8_t GKI_send_event(unsigned char, unsigned short) { return 0; }
-
-void GKI_shiftup(unsigned char*, unsigned char*, unsigned int) { CHECK(false); }
-
-uint16_t GKI_wait(unsigned short, unsigned int) { abort(); }
diff --git a/src/fuzzers/integration/fakes/hal_fakes.cc b/src/fuzzers/integration/fakes/hal_fakes.cc
deleted file mode 100644
index dd80339..0000000
--- a/src/fuzzers/integration/fakes/hal_fakes.cc
+++ /dev/null
@@ -1,82 +0,0 @@
-#include "hal_fakes.h"
-
-#include <android-base/logging.h>
-#include <android-base/stringprintf.h>
-
-#include "nci_defs.h"
-
-FakeHal* g_fake_hal;
-
-FakeHal::FakeHal() : hal_callback_(nullptr), data_callback_(nullptr) {
-  CHECK(!g_fake_hal);
-  g_fake_hal = this;
-}
-
-FakeHal::~FakeHal() { g_fake_hal = nullptr; }
-
-void FakeHal::FuzzedOpen(tHAL_NFC_CBACK* p_hal_cback,
-                         tHAL_NFC_DATA_CBACK* p_data_cback) {
-  hal_callback_ = p_hal_cback;
-  data_callback_ = p_data_cback;
-}
-
-void FakeHal::FuzzedClose() {
-  hal_callback_ = nullptr;
-  data_callback_ = nullptr;
-}
-
-void FakeHal::SimulateHALEvent(uint8_t event, tHAL_NFC_STATUS status) {
-  if (!hal_callback_) {
-    return;
-  }
-
-  hal_callback_(event, status);
-}
-
-void FakeHal::SimulatePacketArrival(uint8_t mt, uint8_t pbf, uint8_t gid,
-                                    uint8_t opcode, uint8_t* data,
-                                    size_t size) {
-  if (!data_callback_) {
-    return;
-  }
-
-  if (size > 255) {
-    return;
-  }
-
-  static uint8_t buffer[255 + 3];
-
-  buffer[0] = (mt << NCI_MT_SHIFT) | (pbf << NCI_PBF_SHIFT) | gid;
-  buffer[1] = (mt == NCI_MT_DATA) ? 0 : opcode;
-  buffer[2] = static_cast<uint8_t>(size);
-  memcpy(&buffer[3], data, size);
-
-  data_callback_(size + 3, buffer);
-}
-
-void FuzzedOpen(tHAL_NFC_CBACK* p_hal_cback,
-                tHAL_NFC_DATA_CBACK* p_data_cback) {
-  g_fake_hal->FuzzedOpen(p_hal_cback, p_data_cback);
-}
-
-void FuzzedClose() { g_fake_hal->FuzzedClose(); }
-
-void FuzzedCoreInitialized(uint16_t, uint8_t*) {}
-
-void FuzzedWrite(uint16_t size, uint8_t*) {
-  // Note: compromised firmware can observe writes to the HAL
-  LOG(DEBUG) << android::base::StringPrintf("Got a write of %d bytes", size);
-}
-
-bool FuzzedPrediscover() { return false; }
-
-void FuzzedControlGranted() {}
-
-tHAL_NFC_ENTRY fuzzed_hal_entry = {
-    .open = FuzzedOpen,
-    .close = FuzzedClose,
-    .core_initialized = FuzzedCoreInitialized,
-    .write = FuzzedWrite,
-    .prediscover = FuzzedPrediscover,
-    .control_granted = FuzzedControlGranted,
-};
diff --git a/src/fuzzers/integration/fakes/hal_fakes.h b/src/fuzzers/integration/fakes/hal_fakes.h
deleted file mode 100644
index b5190a2..0000000
--- a/src/fuzzers/integration/fakes/hal_fakes.h
+++ /dev/null
@@ -1,34 +0,0 @@
-#ifndef HAL_FAKES_H_
-#define HAL_FAKES_H_
-
-#include <android-base/logging.h>
-
-#include "nfc_hal_api.h"
-
-class FakeHal;
-
-extern FakeHal* g_fake_hal;
-
-// Captures HAL callbacks from entry_funcs and allows a client
-// to simulate HAL and data packet events.
-class FakeHal {
- public:
-  FakeHal();
-  ~FakeHal();
-
-  void FuzzedOpen(tHAL_NFC_CBACK* p_hal_cback,
-                  tHAL_NFC_DATA_CBACK* p_data_cback);
-  void FuzzedClose();
-
-  void SimulateHALEvent(uint8_t event, tHAL_NFC_STATUS status);
-  void SimulatePacketArrival(uint8_t mt, uint8_t pbf, uint8_t gid,
-                             uint8_t opcode, uint8_t* data, size_t size);
-
- private:
-  tHAL_NFC_CBACK* hal_callback_;
-  tHAL_NFC_DATA_CBACK* data_callback_;
-};
-
-extern tHAL_NFC_ENTRY fuzzed_hal_entry;
-
-#endif  // HAL_FAKES_H_
diff --git a/src/fuzzers/integration/fakes/nfc_adaptation_fakes.cc b/src/fuzzers/integration/fakes/nfc_adaptation_fakes.cc
deleted file mode 100644
index 5ef9169..0000000
--- a/src/fuzzers/integration/fakes/nfc_adaptation_fakes.cc
+++ /dev/null
@@ -1,30 +0,0 @@
-#include "NfcAdaptation.h"
-
-bool nfc_debug_enabled = false;
-uint8_t appl_dta_mode_flag = 0;
-bool nfc_nci_reset_keep_cfg_enabled = false;
-uint8_t nfc_nci_reset_type = 0x00;
-
-NfcAdaptation* NfcAdaptation::mpInstance = nullptr;
-
-NfcAdaptation& NfcAdaptation::GetInstance() {
-  if (!mpInstance) {
-    mpInstance = new NfcAdaptation;
-    mpInstance->InitializeHalDeviceContext();
-  }
-  return *mpInstance;
-}
-
-void NfcAdaptation::GetVendorConfigs(std::map<std::string, ConfigValue>&) {}
-
-NfcAdaptation::NfcAdaptation() {}
-NfcAdaptation::~NfcAdaptation() { mpInstance = nullptr; }
-
-void NfcAdaptation::InitializeHalDeviceContext() {}
-
-class NfcHalDeathRecipient : public virtual android::RefBase {};
-
-ThreadCondVar::ThreadCondVar() {}
-ThreadCondVar::~ThreadCondVar() {}
-ThreadMutex::~ThreadMutex() {}
-ThreadMutex::ThreadMutex() {}
diff --git a/src/fuzzers/integration/fakes/nfc_adaptation_libmain_fakes.cc b/src/fuzzers/integration/fakes/nfc_adaptation_libmain_fakes.cc
deleted file mode 100644
index 7f6d3a7..0000000
--- a/src/fuzzers/integration/fakes/nfc_adaptation_libmain_fakes.cc
+++ /dev/null
@@ -1,42 +0,0 @@
-#include <fuzzer/FuzzedDataProvider.h>
-
-#include "nfa_nv_ci.h"
-#include "nfa_nv_co.h"
-
-extern FuzzedDataProvider* g_fuzzed_data;
-
-void nfa_nv_co_read(uint8_t* pBuffer, uint16_t nbytes, uint8_t block) {
-  if (g_fuzzed_data->ConsumeBool()) {
-    nfa_nv_ci_read(0, NFA_NV_CO_FAIL, block);
-    return;
-  }
-
-  std::vector<uint8_t> bytes = g_fuzzed_data->ConsumeBytes<uint8_t>(nbytes);
-  memcpy(pBuffer, bytes.data(), bytes.size());
-  nfa_nv_ci_read(bytes.size(), NFA_NV_CO_OK, block);
-}
-
-void nfa_nv_co_write(const uint8_t* pBuffer, uint16_t nbytes,
-                     uint8_t /* block */) {
-  // Copy to detect invalid pBuffer/nbytes parameters
-  std::vector<uint8_t> bytes(pBuffer, pBuffer + nbytes);
-
-  if (g_fuzzed_data->ConsumeBool()) {
-    nfa_nv_ci_write(NFA_NV_CO_FAIL);
-    return;
-  }
-
-  nfa_nv_ci_write(NFA_NV_CO_OK);
-}
-
-extern void* nfa_mem_co_alloc(uint32_t num_bytes) {
-  // Avoid large allocations that harm fuzzer performance
-  if (num_bytes > 100000) {
-    return nullptr;
-  }
-  return malloc(num_bytes);
-}
-
-extern void nfa_mem_co_free(void* pBuffer) { free(pBuffer); }
-
-void delete_stack_non_volatile_store(bool) {}
diff --git a/src/fuzzers/integration/fakes/nfc_config_fakes.cc b/src/fuzzers/integration/fakes/nfc_config_fakes.cc
deleted file mode 100644
index 7141185..0000000
--- a/src/fuzzers/integration/fakes/nfc_config_fakes.cc
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <fuzzer/FuzzedDataProvider.h>
-
-#include "nfc_config.h"
-
-extern FuzzedDataProvider* g_fuzzed_data;
-
-bool NfcConfig::hasKey(const std::string&) {
-  return g_fuzzed_data->ConsumeBool();
-}
-
-unsigned NfcConfig::getUnsigned(const std::string&) {
-  return g_fuzzed_data->ConsumeIntegral<unsigned>();
-}
diff --git a/src/fuzzers/integration/fakes/statslog_fakes.cc b/src/fuzzers/integration/fakes/statslog_fakes.cc
deleted file mode 100644
index 0f9eca2..0000000
--- a/src/fuzzers/integration/fakes/statslog_fakes.cc
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <stdint.h>
-
-namespace android {
-namespace util {
-void stats_write(int32_t, ...) {}
-}  // namespace util
-}  // namespace android
diff --git a/src/fuzzers/integration/nfc_integration_fuzzer.cc b/src/fuzzers/integration/nfc_integration_fuzzer.cc
deleted file mode 100644
index d20fd2a..0000000
--- a/src/fuzzers/integration/nfc_integration_fuzzer.cc
+++ /dev/null
@@ -1,42 +0,0 @@
-#include <android-base/logging.h>
-#include <android-base/stringprintf.h>
-
-#include "debug_nfcsnoop.h"
-#include "fuzzers/integration/nfc_integration_fuzzer.pb.h"
-#include "gki_common.h"
-#include "gki_int.h"
-#include "nfa_ee_api.h"
-#include "nfc_integration_fuzzer_impl.h"
-#include "src/libfuzzer/libfuzzer_macro.h"
-
-extern bool nfa_poll_bail_out_mode;
-
-DEFINE_BINARY_PROTO_FUZZER(const Session& session) {
-  static bool init = false;
-  if (!init) {
-    nfa_poll_bail_out_mode = true;
-    // 0x90 is the protocol value on Pixel 4a. The default value (0xFF)
-    // will prevent Mifare from being discoverable.
-    p_nfa_proprietary_cfg->pro_protocol_mfc = 0x90;
-    debug_nfcsnoop_init();
-    gki_buffer_init();
-    gki_cb.com.OSRdyTbl[BTU_TASK] = TASK_READY;
-    gki_cb.com.OSRdyTbl[MMI_TASK] = TASK_READY;
-    gki_cb.com.OSRdyTbl[NFC_TASK] = TASK_READY;
-    init = true;
-  }
-
-  // Print the testcase in debug mode
-  if (android::base::GetMinimumLogSeverity() <= android::base::DEBUG) {
-    std::string str;
-    google::protobuf::TextFormat::PrintToString(session, &str);
-    LOG(INFO) << str;
-  }
-
-  NfcIntegrationFuzzer nfc_integration_fuzzer(&session);
-  if (!nfc_integration_fuzzer.Setup()) {
-    return;
-  }
-
-  nfc_integration_fuzzer.RunCommands();
-}
diff --git a/src/fuzzers/integration/nfc_integration_fuzzer.proto b/src/fuzzers/integration/nfc_integration_fuzzer.proto
deleted file mode 100644
index 90814b0..0000000
--- a/src/fuzzers/integration/nfc_integration_fuzzer.proto
+++ /dev/null
@@ -1,390 +0,0 @@
-syntax = "proto2";
-
-message Session {
-  repeated Command commands = 1;
-  optional bytes data_provider = 2;
-  optional SimulatePacketArrival setup_packet = 3;
-  optional DtaMode dta_mode = 4;
-}
-
-enum DtaMode {
-  FUZZER_NFA_DTA_DEFAULT_MODE = 0x1;
-  FUZZER_NFA_DTA_LLCP_MODE = 0x2;
-  FUZZER_NFA_DTA_HCEF_MODE = 0x4;
-  FUZZER_NFA_DTA_CR8 = 0x80;
-}
-
-message Command {
-  oneof command {
-    // HAL Simulation Messages
-    SimulatePacketArrival simulate_packet_arrival = 1;
-    SimulateHALEvent simulate_hal_event = 2;
-    SimulateStructuredPacket simulate_structured_packet = 3;
-    bytes send_raw_frame = 4;
-
-    // Asynchronous task handling
-    EmptyMessage do_nci_messages = 5;
-    EmptyMessage do_nfa_tasks = 6;
-    EmptyMessage simulate_timer_event = 7;
-    EmptyMessage simulate_quick_timer_event = 8;
-
-    // Configuration APIs
-    Select select = 9;
-    ConfigureUiccListenTech configure_uicc_listen_tech = 10;
-    EmptyMessage register_t3t = 11;
-    EmptyMessage start_rf_discovery = 12;
-    EmptyMessage stop_rf_discovery = 13;
-    EmptyMessage set_iso_listen_tech = 14;
-
-    // RW APIs
-    EmptyMessage rw_format_tag = 15;
-    RwPresenceCheck rw_presence_check = 16;
-    bool rw_set_tag_read_only = 17;
-
-    // EE APIs
-    EmptyMessage ee_update_now = 18;
-    EeAddAidRouting ee_add_aid_routing = 19;
-
-    // NDEF APIs
-    EmptyMessage read_ndef = 20;
-    EmptyMessage detect_ndef = 21;
-    WriteNdef write_ndef = 22;
-
-    // P2P APIs
-    P2pRegisterServer p2p_register_server = 23;
-    P2pAcceptConn p2p_accept_conn = 24;
-    EmptyMessage p2p_register_client = 25;
-    int32 p2p_deregister = 26;
-    P2pConnectBySap p2p_connect_by_sap = 27;
-    P2pConnectByName p2p_connect_by_name = 28;
-    P2pSendUi p2p_send_ui = 29;
-    P2pDisconnect p2p_disconnect = 30;
-    EmptyMessage pause_p2p = 31;
-    EmptyMessage resume_p2p = 32;
-    P2pReadData p2p_read_data = 33;
-    P2pSendData p2p_send_data = 34;
-  }
-}
-
-message ConfigureUiccListenTech {
-  optional int32 ee_handle = 1;
-  optional int32 tech_mask = 2;
-}
-
-message P2pDisconnect {
-  optional int32 handle = 1;
-  optional bool flush = 2;
-}
-
-message P2pSendUi {
-  optional int32 handle = 1;
-  optional int32 dsap = 2;
-  optional bytes data = 3;
-}
-
-message P2pConnectByName {
-  optional int32 client_handle = 1;
-  optional bytes service_name = 2;
-  optional int32 miu = 3;
-  optional int32 rw = 4;
-}
-
-message Select {
-  optional int32 rf_select_id = 1;
-  optional Protocol protocol = 2;
-  optional int32 rf_interface = 3;
-}
-
-message RwPresenceCheck {
-  enum PresChkOption {
-    FUZZING_NFA_RW_PRES_CHK_DEFAULT = 0;
-    FUZZING_NFA_RW_PRES_CHK_I_BLOCK = 1;
-    FUZZING_NFA_RW_PRES_CHK_ISO_DEP_NAK = 5;
-  }
-  optional PresChkOption option = 1;
-}
-
-message P2pConnectBySap {
-  optional int32 handle = 1;
-  optional int32 dsap = 2;
-  optional int32 miu = 3;
-  optional int32 rw = 4;
-}
-
-message P2pReadData {
-  optional int32 handle = 1;
-  optional int32 length = 2;
-}
-
-message P2pSendData {
-  optional int32 handle = 1;
-  optional bytes data = 2;
-}
-
-message P2pAcceptConn {
-  optional int32 handle = 1;
-  optional int32 miu = 2;
-  optional int32 rw = 3;
-}
-
-message P2pRegisterServer {
-  optional bytes service_name = 1;
-  optional int32 server_sap = 2;
-}
-
-message EeAddAidRouting {
-  optional int32 ee_handle = 1;
-  optional bytes aid = 2;
-  optional bool power_state = 3;
-  optional int32 aid_info = 4;
-}
-
-message EmptyMessage {}
-
-message SimulateStructuredPacket {
-  // Additional packet types, gids, and opcodes
-  // can be added here and in the child messages.
-  oneof packet {
-    MtNtf ntf = 1;
-  }
-}
-
-message MtNtf {
-  oneof gid {
-    RfManagementNtf rf_manage = 1;
-  }
-}
-
-message RfManagementNtf {
-  oneof opcode {
-    RfManageIntfActivated intf_activated = 1;
-  }
-}
-
-// RF_INTF_ACTIVATED_NTF message
-message RfManageIntfActivated {
-  optional int32 rf_discovery_id = 1;
-  optional Protocol rf_protocol = 2;
-  optional DiscoveryType data_mode = 3;
-  optional NfcBitRate tx_bitrate = 4;
-  optional NfcBitRate rx_bitrate = 5;
-  optional int32 buff_size = 6;
-  optional int32 num_buff = 7;
-  optional bytes rf_tech_param_buffer = 8;
-  optional bytes intf_param_buffer = 9;
-}
-
-enum NfcBitRate {
-  FUZZER_NCI_BIT_RATE_106 = 0x00;
-  FUZZER_NCI_BIT_RATE_212 = 0x01;
-  FUZZER_NCI_BIT_RATE_424 = 0x02;
-  FUZZER_NCI_BIT_RATE_848 = 0x03;
-  FUZZER_NCI_BIT_RATE_1696 = 0x04;
-  FUZZER_NCI_BIT_RATE_3392 = 0x05;
-  FUZZER_NCI_BIT_RATE_6784 = 0x06;
-}
-
-message NfcIntfFrame {
-  optional bytes param = 1;
-}
-
-message NfcIntfLaIsoDep {
-  optional int32 rats = 1;
-}
-
-message NfcIntfPaIsoDep {
-  optional bytes ats_res = 1;
-  optional bool nad_used = 2;
-  optional int32 fwi = 3;
-  optional int32 sfgi = 4;
-  optional bytes his_byte = 5;
-}
-
-message NfcIntfLbIsoDep {
-  optional bytes attrib_req = 1;
-  optional bytes hi_info = 2;
-  optional bytes nfcid0 = 3;
-}
-
-message NfcIntfPbIsoDep {
-  optional bytes attrib_res = 1;
-  optional bytes hi_info = 2;
-  optional int32 mbli = 3;
-}
-
-message NfcIntfLaNfcDep {
-  optional bytes atr_req = 1;
-  optional int32 max_payload_size = 2;
-  optional bytes gen_bytes = 3;
-}
-
-message NfcIntfPaNfcDep {
-  optional bytes atr_res = 1;
-  optional int32 max_payload_size = 2;
-  optional bytes gen_bytes = 3;
-  optional int32 waiting_time = 4;
-}
-
-message Protocol {
-  enum ProtocolValue {
-    FUZZER_PROTOCOL_UNKNOWN = 0;
-    FUZZER_PROTOCOL_T1T = 1;
-    FUZZER_PROTOCOL_T2T = 2;
-    FUZZER_PROTOCOL_T3T = 3;
-    FUZZER_PROTOCOL_T5T = 6;
-    FUZZER_PROTOCOL_ISO_DEP = 4;
-    FUZZER_PROTOCOL_NFC_DEP = 5;
-    // These are proprietary and must be converted at runtime
-    // based on the config.
-    // See src/include/vendor_cfg.h
-    FUZZER_PROTOCOL_MIFARE = 7;
-    FUZZER_PROTOCOL_ISO15693 = 8;
-    FUZZER_PROTOCOL_B_PRIME = 9;
-    FUZZER_PROTOCOL_KOVIO = 10;
-  }
-  // Only access this from within a helper function that
-  // does the runtime config-based conversion.
-  optional ProtocolValue value = 1;
-}
-
-message DiscoveryType {
-  enum DiscoveryTypeValue {
-    FUZZER_DISCOVERY_TYPE_POLL_A = 0x00;
-    FUZZER_DISCOVERY_TYPE_POLL_B = 0x01;
-    FUZZER_DISCOVERY_TYPE_POLL_F = 0x02;
-    FUZZER_DISCOVERY_TYPE_POLL_V = 0x06;
-    FUZZER_DISCOVERY_TYPE_POLL_A_ACTIVE = 0x03;
-    FUZZER_DISCOVERY_TYPE_POLL_F_ACTIVE = 0x05;
-    FUZZER_DISCOVERY_TYPE_LISTEN_A = 0x80;
-    FUZZER_DISCOVERY_TYPE_LISTEN_B = 0x81;
-    FUZZER_DISCOVERY_TYPE_LISTEN_F = 0x82;
-    FUZZER_DISCOVERY_TYPE_LISTEN_A_ACTIVE = 0x83;
-    FUZZER_DISCOVERY_TYPE_LISTEN_F_ACTIVE = 0x85;
-    FUZZER_DISCOVERY_TYPE_LISTEN_ISO15693 = 0x86;
-    // These are proprietary and must be converted at runtime
-    // based on the config.
-    FUZZER_DISCOVERY_TYPE_POLL_B_PRIME = 10;
-    FUZZER_DISCOVERY_TYPE_POLL_KOVIO = 11;
-    FUZZER_DISCOVERY_TYPE_LISTEN_B_PRIME = 12;
-  }
-  optional DiscoveryTypeValue value = 1;
-}
-
-message NfcRfPiso15693 {
-  optional int32 flag = 1;
-  optional bytes uid = 2;
-}
-
-message NfcRfPbParams {
-  optional bytes sensb_res = 1;
-  optional bytes nfcid0 = 2;
-}
-
-message NfcRfPfParams {
-  optional int32 bit_rate = 1;
-  optional bytes sensf_res = 2;
-  optional bytes nfcid2 = 3;
-  optional int32 mrti_check = 4;
-  optional int32 mrti_update = 5;
-}
-
-message NfcRfLfParams {
-  optional bytes nfcid2 = 1;
-}
-
-message NfcRfPiso15693Params {
-  optional int32 flag = 1;
-  optional int32 dsfid = 2;
-  optional bytes uid = 3;
-}
-
-message NfcRfPkovioParams {
-  optional bytes uid = 1;
-}
-
-message NfcRfAcmPParams {
-  optional bytes atr_res = 1;
-  optional int32 max_payload_size = 2;
-  optional bytes gen_bytes = 3;
-  optional int32 waiting_time = 4;
-}
-
-enum Mt {
-  FUZZER_NCI_MT_DATA = 0;
-  FUZZER_NCI_MT_CMD = 1;
-  FUZZER_NCI_MT_RSP = 2;
-  FUZZER_NCI_MT_NTF = 3;
-}
-
-enum Gid {
-  FUZZER_NCI_GID_CORE = 0x00;
-  FUZZER_NCI_GID_RF_MANAGE = 0x01;
-  FUZZER_NCI_GID_EE_MANAGE = 0x02;
-  FUZZER_NCI_GID_PROP = 0x0F;
-}
-
-enum Opcode {
-  option allow_alias = true;
-  FUZZER_NCI_MSG_CORE_RESET = 0;
-  FUZZER_NCI_MSG_CORE_INIT = 1;
-  FUZZER_NCI_MSG_CORE_SET_CONFIG = 2;
-  FUZZER_NCI_MSG_CORE_GET_CONFIG = 3;
-  FUZZER_NCI_MSG_CORE_CONN_CREATE = 4;
-  FUZZER_NCI_MSG_CORE_CONN_CLOSE = 5;
-  FUZZER_NCI_MSG_CORE_CONN_CREDITS = 6;
-  FUZZER_NCI_MSG_CORE_GEN_ERR_STATUS = 7;
-  FUZZER_NCI_MSG_CORE_INTF_ERR_STATUS = 8;
-  FUZZER_NCI_MSG_CORE_SET_POWER_SUB_STATE = 9;
-  FUZZER_NCI_MSG_RF_DISCOVER_MAP = 0;
-  FUZZER_NCI_MSG_RF_SET_ROUTING = 1;
-  FUZZER_NCI_MSG_RF_GET_ROUTING = 2;
-  FUZZER_NCI_MSG_RF_DISCOVER = 3;
-  FUZZER_NCI_MSG_RF_DISCOVER_SELECT = 4;
-  FUZZER_NCI_MSG_RF_INTF_ACTIVATED = 5;
-  FUZZER_NCI_MSG_RF_DEACTIVATE = 6;
-  FUZZER_NCI_MSG_RF_FIELD = 7;
-  FUZZER_NCI_MSG_RF_T3T_POLLING = 8;
-  FUZZER_NCI_MSG_RF_EE_ACTION = 9;
-  FUZZER_NCI_MSG_RF_EE_DISCOVERY_REQ = 10;
-  FUZZER_NCI_MSG_RF_PARAMETER_UPDATE = 11;
-  FUZZER_NCI_MSG_RF_ISO_DEP_NAK_PRESENCE = 16;
-  FUZZER_NCI_MSG_NFCEE_DISCOVER = 0;
-  FUZZER_NCI_MSG_NFCEE_MODE_SET = 1;
-  FUZZER_NCI_MSG_NFCEE_STATUS = 2;
-  FUZZER_NCI_MSG_NFCEE_POWER_LINK_CTRL = 3;
-}
-
-message SimulatePacketArrival {
-  optional bytes packet = 1;
-  optional Mt mt = 2;
-  optional Gid gid = 3;
-  optional Opcode opcode = 4;
-  optional bool pbf = 5;
-}
-
-enum HalEvent {
-  FUZZER_HAL_NFC_OPEN_CPLT_EVT = 0;
-  FUZZER_HAL_NFC_CLOSE_CPLT_EVT = 1;
-  FUZZER_HAL_NFC_POST_INIT_CPLT_EVT = 2;
-  FUZZER_HAL_NFC_PRE_DISCOVER_CPLT_EVT = 3;
-  FUZZER_HAL_NFC_REQUEST_CONTROL_EVT = 4;
-  FUZZER_HAL_NFC_RELEASE_CONTROL_EVT = 5;
-  FUZZER_HAL_NFC_ERROR_EVT = 6;
-}
-
-enum HalStatus {
-  FUZZER_HAL_NFC_STATUS_OK = 0;
-  FUZZER_HAL_NFC_STATUS_FAILED = 1;
-  FUZZER_HAL_NFC_STATUS_ERR_TRANSPORT = 2;
-  FUZZER_HAL_NFC_STATUS_ERR_CMD_TIMEOUT = 3;
-  FUZZER_HAL_NFC_STATUS_REFUSED = 4;
-}
-
-message SimulateHALEvent {
-  optional HalEvent hal_event = 1;
-  optional HalStatus hal_status = 2;
-}
-
-message WriteNdef {
-  optional uint32 size = 1;
-}
diff --git a/src/fuzzers/integration/nfc_integration_fuzzer_impl.cc b/src/fuzzers/integration/nfc_integration_fuzzer_impl.cc
deleted file mode 100644
index 2e2e8a2..0000000
--- a/src/fuzzers/integration/nfc_integration_fuzzer_impl.cc
+++ /dev/null
@@ -1,545 +0,0 @@
-#include "nfc_integration_fuzzer_impl.h"
-
-#include <android-base/logging.h>
-#include <android-base/stringprintf.h>
-#include <fuzzer/FuzzedDataProvider.h>
-
-#include "nfa_ce_api.h"
-#include "nfa_ee_api.h"
-#include "nfa_p2p_api.h"
-#include "nfa_rw_api.h"
-#include "nfa_sys.h"
-#include "nfc_api.h"
-#include "nfc_int.h"
-#include "nfc_task_helpers.h"
-
-extern uint32_t g_tick_count;
-
-FuzzedDataProvider* g_fuzzed_data;
-
-static bool g_saw_event = false;
-static tNFA_EE_DISCOVER_REQ g_ee_info;
-
-static void nfa_dm_callback(uint8_t event, tNFA_DM_CBACK_DATA*) {
-  g_saw_event = true;
-  LOG(INFO) << android::base::StringPrintf("nfa_dm_callback got event %d",
-                                           event);
-}
-
-static void nfa_conn_callback(uint8_t event, tNFA_CONN_EVT_DATA*) {
-  LOG(INFO) << android::base::StringPrintf("nfa_conn_callback got event %d",
-                                           event);
-  g_saw_event = true;
-}
-
-static void nfa_ee_callback(tNFA_EE_EVT event, tNFA_EE_CBACK_DATA* p_data) {
-  switch (event) {
-    case NFA_EE_DISCOVER_REQ_EVT: {
-      memcpy(&g_ee_info, &p_data->discover_req, sizeof(g_ee_info));
-      break;
-    }
-  }
-}
-
-// From packages/apps/Nfc/nci/jni/PeerToPeer.cpp
-#define LLCP_DATA_LINK_TIMEOUT 2000
-
-void nfc_process_timer_evt(void);
-void nfa_p2p_callback(tNFA_P2P_EVT, tNFA_P2P_EVT_DATA*) {}
-
-static tNFC_PROTOCOL GetProtocol(const Protocol& protocol) {
-  switch (protocol.value()) {
-    case Protocol::FUZZER_PROTOCOL_UNKNOWN: {
-      return NFC_PROTOCOL_UNKNOWN;
-    }
-    case Protocol::FUZZER_PROTOCOL_T1T: {
-      return NFC_PROTOCOL_T1T;
-    }
-    case Protocol::FUZZER_PROTOCOL_T2T: {
-      return NFC_PROTOCOL_T2T;
-    }
-    case Protocol::FUZZER_PROTOCOL_T3T: {
-      return NFC_PROTOCOL_T3T;
-    }
-    case Protocol::FUZZER_PROTOCOL_T5T: {
-      return NFC_PROTOCOL_T5T;
-    }
-    case Protocol::FUZZER_PROTOCOL_ISO_DEP: {
-      return NFC_PROTOCOL_ISO_DEP;
-    }
-    case Protocol::FUZZER_PROTOCOL_NFC_DEP: {
-      return NFC_PROTOCOL_NFC_DEP;
-    }
-    case Protocol::FUZZER_PROTOCOL_MIFARE: {
-      return NFC_PROTOCOL_MIFARE;
-    }
-    case Protocol::FUZZER_PROTOCOL_ISO15693: {
-      return NFC_PROTOCOL_ISO15693;
-    }
-    case Protocol::FUZZER_PROTOCOL_B_PRIME: {
-      return NFC_PROTOCOL_B_PRIME;
-    }
-    case Protocol::FUZZER_PROTOCOL_KOVIO: {
-      return NFC_PROTOCOL_KOVIO;
-    }
-  }
-}
-
-static tNFC_DISCOVERY_TYPE GetDiscovery(const DiscoveryType& type) {
-  switch (type.value()) {
-    case DiscoveryType::FUZZER_DISCOVERY_TYPE_POLL_A: {
-      return NFC_DISCOVERY_TYPE_POLL_A;
-    }
-    case DiscoveryType::FUZZER_DISCOVERY_TYPE_POLL_B: {
-      return NFC_DISCOVERY_TYPE_POLL_B;
-    }
-    case DiscoveryType::FUZZER_DISCOVERY_TYPE_POLL_F: {
-      return NFC_DISCOVERY_TYPE_POLL_F;
-    }
-    case DiscoveryType::FUZZER_DISCOVERY_TYPE_POLL_V: {
-      return NFC_DISCOVERY_TYPE_POLL_V;
-    }
-    case DiscoveryType::FUZZER_DISCOVERY_TYPE_POLL_A_ACTIVE: {
-      return NFC_DISCOVERY_TYPE_POLL_A_ACTIVE;
-    }
-    case DiscoveryType::FUZZER_DISCOVERY_TYPE_POLL_F_ACTIVE: {
-      return NFC_DISCOVERY_TYPE_POLL_F_ACTIVE;
-    }
-    case DiscoveryType::FUZZER_DISCOVERY_TYPE_LISTEN_A: {
-      return NFC_DISCOVERY_TYPE_LISTEN_A;
-    }
-    case DiscoveryType::FUZZER_DISCOVERY_TYPE_LISTEN_B: {
-      return NFC_DISCOVERY_TYPE_LISTEN_B;
-    }
-    case DiscoveryType::FUZZER_DISCOVERY_TYPE_LISTEN_F: {
-      return NFC_DISCOVERY_TYPE_LISTEN_F;
-    }
-    case DiscoveryType::FUZZER_DISCOVERY_TYPE_LISTEN_A_ACTIVE: {
-      return NFC_DISCOVERY_TYPE_LISTEN_A_ACTIVE;
-    }
-    case DiscoveryType::FUZZER_DISCOVERY_TYPE_LISTEN_F_ACTIVE: {
-      return NFC_DISCOVERY_TYPE_LISTEN_F_ACTIVE;
-    }
-    case DiscoveryType::FUZZER_DISCOVERY_TYPE_LISTEN_ISO15693: {
-      return NFC_DISCOVERY_TYPE_LISTEN_ISO15693;
-    }
-    case DiscoveryType::FUZZER_DISCOVERY_TYPE_POLL_B_PRIME: {
-      return NFC_DISCOVERY_TYPE_POLL_B_PRIME;
-    }
-    case DiscoveryType::FUZZER_DISCOVERY_TYPE_POLL_KOVIO: {
-      return NFC_DISCOVERY_TYPE_POLL_KOVIO;
-    }
-    case DiscoveryType::FUZZER_DISCOVERY_TYPE_LISTEN_B_PRIME: {
-      return NFC_DISCOVERY_TYPE_LISTEN_B_PRIME;
-    }
-  }
-}
-
-std::vector<uint8_t> SerializeTechParameters(
-    const tNFC_RF_TECH_PARAMS& params) {
-  std::vector<uint8_t> vec;
-
-  switch (params.mode) {
-    case NCI_DISCOVERY_TYPE_POLL_A: {
-      const tNFC_RF_PA_PARAMS* pa = &params.param.pa;
-      vec.push_back(pa->sens_res[0]);
-      vec.push_back(pa->sens_res[1]);
-      vec.push_back(pa->nfcid1_len);
-      vec.insert(vec.end(), pa->nfcid1, pa->nfcid1 + pa->nfcid1_len);
-
-      // sel_rsp of 0 is the same as not having it, so we just always send it
-      vec.push_back(1);
-      vec.push_back(pa->sel_rsp);
-
-      vec.push_back(pa->hr_len);
-      vec.insert(vec.end(), pa->hr, pa->hr + pa->hr_len);
-      break;
-    }
-    default: {
-      abort();
-    }
-  }
-
-  return vec;
-}
-
-// Serialize an NFC Activation event back to the spec wire format
-std::vector<uint8_t> SerializeNfcActivate(
-    const tNFC_ACTIVATE_DEVT& activate, uint8_t buff_size, uint8_t num_buff,
-    const std::string& rf_tech_param_buffer,
-    const std::string& intf_param_buffer) {
-  std::vector<uint8_t> packet;
-  packet.push_back(activate.rf_disc_id);
-  packet.push_back(activate.intf_param.type);
-  packet.push_back(activate.protocol);
-  packet.push_back(activate.rf_tech_param.mode);
-  packet.push_back(buff_size);
-  packet.push_back(num_buff);
-
-  std::vector<uint8_t> tech_parameters(
-      rf_tech_param_buffer.begin(),
-      rf_tech_param_buffer
-          .end());  // = SerializeTechParameters(activate.rf_tech_param);
-  if (tech_parameters.size() > 256) {
-    tech_parameters.resize(256);
-  }
-  packet.push_back(tech_parameters.size());
-  packet.insert(packet.end(), tech_parameters.begin(), tech_parameters.end());
-
-  packet.push_back(activate.data_mode);
-  packet.push_back(activate.tx_bitrate);
-  packet.push_back(activate.rx_bitrate);
-
-  std::vector<uint8_t> activation_parameters(intf_param_buffer.begin(),
-                                             intf_param_buffer.end());
-  if (activation_parameters.size() > 256) {
-    activation_parameters.resize(256);
-  }
-
-  packet.push_back(activation_parameters.size());
-  packet.insert(packet.end(), activation_parameters.begin(),
-                activation_parameters.end());
-  return packet;
-}
-
-void DoRfManageIntfActivated(const RfManageIntfActivated& activated) {
-  // The event we want to generate
-  tNFC_ACTIVATE_DEVT activate_event = {};
-  activate_event.rf_disc_id = activated.rf_discovery_id();
-  activate_event.protocol = GetProtocol(activated.rf_protocol());
-  activate_event.data_mode = GetDiscovery(activated.data_mode());
-  activate_event.tx_bitrate = activated.tx_bitrate();
-  activate_event.rx_bitrate = activated.rx_bitrate();
-  uint8_t buff_size = activated.buff_size();
-  uint8_t num_buff = activated.num_buff();
-
-  std::vector<uint8_t> packet = SerializeNfcActivate(
-      activate_event, buff_size, num_buff, activated.rf_tech_param_buffer(),
-      activated.intf_param_buffer());
-
-  g_fake_hal->SimulatePacketArrival(NCI_MT_NTF, 0, NCI_GID_RF_MANAGE,
-                                    NCI_MSG_RF_INTF_ACTIVATED, packet.data(),
-                                    packet.size());
-}
-
-void DoRfManagementNtf(const RfManagementNtf& ntf) {
-  switch (ntf.opcode_case()) {
-    case RfManagementNtf::kIntfActivated: {
-      DoRfManageIntfActivated(ntf.intf_activated());
-      break;
-    }
-    case RfManagementNtf::OPCODE_NOT_SET: {
-      break;
-    }
-  }
-}
-
-void DoMtNtf(const MtNtf& ntf) {
-  switch (ntf.gid_case()) {
-    case MtNtf::kRfManage: {
-      DoRfManagementNtf(ntf.rf_manage());
-      break;
-    }
-    case MtNtf::GID_NOT_SET: {
-      break;
-    }
-  }
-}
-
-void DoStructuredPacket(const SimulateStructuredPacket& packet) {
-  switch (packet.packet_case()) {
-    case SimulateStructuredPacket::kNtf: {
-      DoMtNtf(packet.ntf());
-      break;
-    }
-    case SimulateStructuredPacket::PACKET_NOT_SET: {
-      break;
-    }
-  }
-}
-
-void DoPacket(const SimulatePacketArrival& packet) {
-  uint8_t mt = packet.mt();
-  uint8_t pbf = packet.pbf();
-  uint8_t gid = packet.gid();
-  uint8_t opcode = static_cast<uint8_t>(packet.opcode());
-  bool need_flush = false;
-  if (mt == NCI_MT_DATA) {
-    // The gid field will be used as the connection ID. We should handle this
-    // a lot better but for now we let the existing gid enum get interpreted
-    // as a connection ID.
-    // gid = 0;
-    opcode = 0;
-  }
-
-  g_fake_hal->SimulatePacketArrival(mt, pbf, gid, opcode,
-                                    (unsigned char*)packet.packet().data(),
-                                    packet.packet().size());
-  if (need_flush) {
-    DoAllTasks(false);
-  }
-}
-
-void NfcIntegrationFuzzer::DoOneCommand(
-    std::vector<std::vector<uint8_t>>& bytes_container,
-    const Command& command) {
-  switch (command.command_case()) {
-    case Command::kSimulatePacketArrival: {
-      DoPacket(command.simulate_packet_arrival());
-      break;
-    }
-    case Command::kSimulateHalEvent: {
-      g_fake_hal->SimulateHALEvent(command.simulate_hal_event().hal_event(),
-                                   command.simulate_hal_event().hal_status());
-      break;
-    }
-    case Command::kSimulateStructuredPacket: {
-      DoStructuredPacket(command.simulate_structured_packet());
-      break;
-    }
-    case Command::kSendRawFrame: {
-      std::vector<uint8_t> frame(
-          command.send_raw_frame().data(),
-          command.send_raw_frame().data() + command.send_raw_frame().size());
-      NFA_SendRawFrame(frame.data(), frame.size(),
-                       /*presence check start delay*/ 0);
-      break;
-    }
-    case Command::kDoNciMessages: {
-      nfc_process_nci_messages();
-      break;
-    }
-    case Command::kDoNfaTasks: {
-      nfc_process_nfa_messages();
-      break;
-    }
-    case Command::kSimulateTimerEvent: {
-      nfc_process_timer_evt();
-      break;
-    }
-    case Command::kSimulateQuickTimerEvent: {
-      nfc_process_quick_timer_evt();
-      break;
-    }
-    case Command::kSelect: {
-      NFA_Select(command.select().rf_select_id(),
-                 GetProtocol(command.select().protocol()),
-                 command.select().rf_interface());
-      break;
-    }
-    case Command::kConfigureUiccListenTech: {
-      if (g_ee_info.num_ee > 0) {
-        uint8_t handle = command.configure_uicc_listen_tech().ee_handle();
-        handle = g_ee_info.ee_disc_info[handle % g_ee_info.num_ee].ee_handle;
-        NFA_CeConfigureUiccListenTech(
-            handle, command.configure_uicc_listen_tech().tech_mask());
-        NFA_EeClearDefaultTechRouting(handle, 0xFF);
-        NFA_EeSetDefaultTechRouting(handle, 0xFF, 0, 0, 0, 0, 0);
-      }
-      break;
-    }
-    case Command::kRegisterT3T: {
-      uint8_t nfcid2[NCI_RF_F_UID_LEN] = {};
-      uint8_t t3tPmm[NCI_T3T_PMM_LEN] = {};
-      NFA_CeRegisterFelicaSystemCodeOnDH(0, nfcid2, t3tPmm, nfa_conn_callback);
-      const uint8_t SYS_CODE_PWR_STATE_HOST = 0x01;
-      NFA_EeAddSystemCodeRouting(0, NCI_DH_ID, SYS_CODE_PWR_STATE_HOST);
-      break;
-    }
-    case Command::kStartRfDiscovery: {
-      NFA_StartRfDiscovery();
-      break;
-    }
-    case Command::kStopRfDiscovery: {
-      NFA_StopRfDiscovery();
-      break;
-    }
-    case Command::kSetIsoListenTech: {
-      NFA_CeSetIsoDepListenTech(
-          fuzzed_data_.ConsumeIntegralInRange<uint8_t>(0, 0xFF));
-      NFA_CeRegisterAidOnDH(nullptr, 0, nfa_conn_callback);
-      break;
-    }
-    case Command::kRwFormatTag: {
-      NFA_RwFormatTag();
-      break;
-    }
-    case Command::kRwPresenceCheck: {
-      NFA_RwPresenceCheck(command.rw_presence_check().option());
-      break;
-    }
-    case Command::kRwSetTagReadOnly: {
-      NFA_RwSetTagReadOnly(command.rw_set_tag_read_only());
-      break;
-    }
-    case Command::kEeUpdateNow: {
-      NFA_EeUpdateNow();
-      break;
-    }
-    case Command::kEeAddAidRouting: {
-      uint8_t handle = command.ee_add_aid_routing().ee_handle();
-      if (g_ee_info.num_ee) {
-        handle = g_ee_info.ee_disc_info[handle % g_ee_info.num_ee].ee_handle;
-      }
-      std::vector<uint8_t> aid(command.ee_add_aid_routing().aid().data(),
-                               command.ee_add_aid_routing().aid().data() +
-                                   command.ee_add_aid_routing().aid().size());
-      tNFA_EE_PWR_STATE power_state =
-          command.ee_add_aid_routing().power_state();
-      uint8_t aidInfo = command.ee_add_aid_routing().aid_info();
-      NFA_EeAddAidRouting(handle, aid.size(), aid.data(), power_state, aidInfo);
-      break;
-    }
-    case Command::kReadNdef: {
-      NFA_RwReadNDef();
-      break;
-    }
-    case Command::kDetectNdef: {
-      NFA_RwDetectNDef();
-      break;
-    }
-    case Command::kWriteNdef: {
-      bytes_container.emplace_back(command.write_ndef().size() % 1024);
-      NFA_RwWriteNDef(bytes_container.back().data(),
-                      bytes_container.back().size());
-      break;
-    }
-    case Command::kP2PRegisterServer: {
-      NFA_P2pSetLLCPConfig(LLCP_MAX_MIU, LLCP_OPT_VALUE, LLCP_WAITING_TIME,
-                           LLCP_LTO_VALUE, 0, 0, LLCP_DELAY_RESP_TIME,
-                           LLCP_DATA_LINK_TIMEOUT,
-                           LLCP_DELAY_TIME_TO_SEND_FIRST_PDU);
-      NFA_P2pRegisterServer(
-          command.p2p_register_server().server_sap() & 0xFF, NFA_P2P_DLINK_TYPE,
-          (char*)command.p2p_register_server().service_name().c_str(),
-          nfa_p2p_callback);
-      break;
-    }
-    case Command::kP2PAcceptConn: {
-      NFA_P2pAcceptConn(command.p2p_accept_conn().handle() & 0xFF,
-                        command.p2p_accept_conn().miu() & 0xFFFF,
-                        command.p2p_accept_conn().rw() & 0xFF);
-      break;
-    }
-    case Command::kP2PRegisterClient: {
-      NFA_P2pRegisterClient(NFA_P2P_DLINK_TYPE, nfa_p2p_callback);
-      break;
-    }
-    case Command::kP2PDeregister: {
-      NFA_P2pDeregister(command.p2p_deregister());
-      break;
-    }
-    case Command::kP2PConnectBySap: {
-      NFA_P2pConnectBySap(command.p2p_connect_by_sap().handle(),
-                          command.p2p_connect_by_sap().dsap(),
-                          command.p2p_connect_by_sap().miu(),
-                          command.p2p_connect_by_sap().rw());
-      break;
-    }
-    case Command::kP2PConnectByName: {
-      NFA_P2pConnectByName(
-          command.p2p_connect_by_name().client_handle(),
-          (char*)command.p2p_connect_by_name().service_name().c_str(),
-          command.p2p_connect_by_name().miu(),
-          command.p2p_connect_by_name().rw());
-      break;
-    }
-    case Command::kP2PSendUi: {
-      std::vector<uint8_t> buffer(command.p2p_send_ui().data().data(),
-                                  command.p2p_send_ui().data().data() +
-                                      command.p2p_send_ui().data().size());
-      NFA_P2pSendUI(command.p2p_send_ui().handle(),
-                    command.p2p_send_ui().dsap(), buffer.size(), buffer.data());
-      break;
-    }
-    case Command::kP2PDisconnect: {
-      NFA_P2pDisconnect(command.p2p_disconnect().handle(),
-                        command.p2p_disconnect().flush());
-      break;
-    }
-    case Command::kPauseP2P: {
-      NFA_PauseP2p();
-      break;
-    }
-    case Command::kResumeP2P: {
-      NFA_ResumeP2p();
-      break;
-    }
-    case Command::kP2PReadData: {
-      std::vector<uint8_t> buffer((size_t)command.p2p_read_data().length() %
-                                  1024);
-      bool is_more_data = false;
-      unsigned int actual_size = 0;
-      NFA_P2pReadData(command.p2p_read_data().handle(), buffer.size(),
-                      &actual_size, buffer.data(), &is_more_data);
-      break;
-    }
-    case Command::kP2PSendData: {
-      std::vector<uint8_t> buffer(command.p2p_send_data().data().data(),
-                                  command.p2p_send_data().data().data() +
-                                      command.p2p_send_data().data().size());
-      NFA_P2pSendData(command.p2p_send_data().handle(), buffer.size(),
-                      buffer.data());
-      break;
-    }
-    case Command::COMMAND_NOT_SET: {
-      break;
-    }
-  }
-}
-
-NfcIntegrationFuzzer::NfcIntegrationFuzzer(const Session* session)
-    : session_(session),
-      fuzzed_data_(
-          reinterpret_cast<const uint8_t*>(session->data_provider().data()),
-          session->data_provider().size()) {
-  g_fuzzed_data = &fuzzed_data_;
-}
-
-bool NfcIntegrationFuzzer::Setup() {
-  g_tick_count = 0;
-  memset(&g_ee_info, 0, sizeof(g_ee_info));
-  NFA_Init(&fuzzed_hal_entry);
-
-  NFA_Enable(nfa_dm_callback, nfa_conn_callback);
-  DoAllTasks(false);
-
-  NFA_EeRegister(nfa_ee_callback);
-  NFA_EeSetDefaultProtoRouting(NFC_DH_ID, NFA_PROTOCOL_MASK_ISO_DEP, 0, 0, 0, 0,
-                               0);
-
-  DoPacket(session_->setup_packet());
-  g_saw_event = false;
-  DoAllTasks(false);
-  if (!g_saw_event) {
-    return false;
-  }
-
-  NFA_EnableListening();
-  NFA_EnablePolling(NFA_TECHNOLOGY_MASK_A | NFA_TECHNOLOGY_MASK_B |
-                    NFA_TECHNOLOGY_MASK_F | NFA_TECHNOLOGY_MASK_V |
-                    NFA_TECHNOLOGY_MASK_B_PRIME | NFA_TECHNOLOGY_MASK_A_ACTIVE |
-                    NFA_TECHNOLOGY_MASK_F_ACTIVE | NFA_TECHNOLOGY_MASK_KOVIO);
-
-  NFA_EnableDtamode(static_cast<tNFA_eDtaModes>(session_->dta_mode()));
-  NFA_StartRfDiscovery();
-
-  DoAllTasks(false);
-  return true;
-}
-
-void NfcIntegrationFuzzer::RunCommands() {
-  for (const Command& command : session_->commands()) {
-    DoOneCommand(bytes_container_, command);
-  }
-}
-
-void NfcIntegrationFuzzer::TearDown() {
-  // Do any remaining tasks including pending timers
-  DoAllTasks(true);
-
-  // Issue a disable command then clear pending tasks
-  // and timers again
-  NFA_Disable(false);
-  DoAllTasks(true);
-}
diff --git a/src/fuzzers/integration/nfc_integration_fuzzer_impl.h b/src/fuzzers/integration/nfc_integration_fuzzer_impl.h
deleted file mode 100644
index b27e996..0000000
--- a/src/fuzzers/integration/nfc_integration_fuzzer_impl.h
+++ /dev/null
@@ -1,30 +0,0 @@
-#ifndef NFC_INTEGRATION_FUZZER_IMPL_H_
-#define NFC_INTEGRATION_FUZZER_IMPL_H_
-
-#include <fuzzer/FuzzedDataProvider.h>
-
-#include "fuzzers/integration/nfc_integration_fuzzer.pb.h"
-#include "hal_fakes.h"
-#include "nfa_api.h"
-
-class NfcIntegrationFuzzer {
- public:
-  NfcIntegrationFuzzer(const Session* session);
-  ~NfcIntegrationFuzzer() { TearDown(); }
-
-  bool Setup();
-  void RunCommands();
-
- private:
-  void DoOneCommand(std::vector<std::vector<uint8_t>>& bytes_container,
-                    const Command& command);
-
-  void TearDown();
-
-  const Session* session_;
-  FuzzedDataProvider fuzzed_data_;
-  FakeHal fake_hal_;
-  std::vector<std::vector<uint8_t>> bytes_container_;
-};
-
-#endif  // NFC_INTEGRATION_FUZZER_IMPL_H_
diff --git a/src/fuzzers/integration/nfc_task_helpers.cc b/src/fuzzers/integration/nfc_task_helpers.cc
deleted file mode 100644
index eea59a2..0000000
--- a/src/fuzzers/integration/nfc_task_helpers.cc
+++ /dev/null
@@ -1,91 +0,0 @@
-#include "nfc_task_helpers.h"
-
-#include <android-base/logging.h>
-
-#include "gki.h"
-#include "nfa_hci_int.h"
-#include "nfa_sys.h"
-#include "nfc_int.h"
-
-void nfa_hci_check_api_requests(void);
-void nfc_process_timer_evt(void);
-
-bool nfc_process_nci_messages() {
-  bool found_work = false;
-  NFC_HDR* p_msg;
-  bool free_buf;
-
-  /* Process all incoming NCI messages */
-  while ((p_msg = (NFC_HDR*)GKI_read_mbox(NFC_MBOX_ID)) != nullptr) {
-    found_work = true;
-    free_buf = true;
-
-    /* Determine the input message type. */
-    switch (p_msg->event & NFC_EVT_MASK) {
-      case BT_EVT_TO_NFC_NCI:
-        free_buf = nfc_ncif_process_event(p_msg);
-        break;
-
-      case BT_EVT_TO_START_TIMER:
-        /* Start nfc_task 1-sec resolution timer */
-        GKI_start_timer(NFC_TIMER_ID, GKI_SECS_TO_TICKS(1), true);
-        break;
-
-      case BT_EVT_TO_START_QUICK_TIMER:
-        /* Quick-timer is required for LLCP */
-        GKI_start_timer(NFC_QUICK_TIMER_ID,
-                        ((GKI_SECS_TO_TICKS(1) / QUICK_TIMER_TICKS_PER_SEC)),
-                        true);
-        break;
-
-      case BT_EVT_TO_NFC_MSGS:
-        nfc_main_handle_hal_evt((tNFC_HAL_EVT_MSG*)p_msg);
-        break;
-
-      default:
-        // Unknown message type
-        CHECK(false);
-        break;
-    }
-
-    if (free_buf) {
-      GKI_freebuf(p_msg);
-    }
-  }
-  return found_work;
-}
-
-void nfc_process_nfa_messages() {
-  NFC_HDR* p_msg;
-  while ((p_msg = (NFC_HDR*)GKI_read_mbox(NFA_MBOX_ID)) != nullptr) {
-    nfa_sys_event(p_msg);
-  }
-}
-
-void DoAllTasks(bool do_timers) {
-start:
-  bool found_work = false;
-  while (nfc_process_nci_messages()) {
-    found_work = true;
-  }
-
-  nfc_process_nfa_messages();
-
-  if (do_timers) {
-    nfc_process_timer_evt();
-    nfc_process_quick_timer_evt();
-  }
-
-  nfa_hci_check_api_requests();
-
-  nfa_sys_timer_update();
-
-  if (nfa_hci_cb.hci_state == NFA_HCI_STATE_IDLE &&
-      !GKI_queue_is_empty(&nfa_hci_cb.hci_api_q)) {
-    found_work = true;
-  }
-
-  if (found_work) {
-    goto start;
-  }
-}
diff --git a/src/fuzzers/integration/nfc_task_helpers.h b/src/fuzzers/integration/nfc_task_helpers.h
deleted file mode 100644
index eced63f..0000000
--- a/src/fuzzers/integration/nfc_task_helpers.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef NFC_TASK_HELPERS_H_
-#define NFC_TASK_HELPERS_H_
-
-bool nfc_process_nci_messages();
-void nfc_process_nfa_messages();
-void DoAllTasks(bool do_timers);
-
-#endif /* NFC_TASK_HELPERS_H_ */
diff --git a/src/gki/common/gki.h b/src/gki/common/gki.h
index 5dcafae..a6aa2e3 100644
--- a/src/gki/common/gki.h
+++ b/src/gki/common/gki.h
@@ -26,10 +26,6 @@
 #define NFC_STANDALONE FALSE
 #endif
 
-#ifdef NFC_INTEGRATION_FUZZER
-#include <list>
-#endif
-
 #include <string>
 
 #include "bt_types.h"
@@ -303,15 +299,6 @@
 
 /* Define a timer list entry
 */
-#ifdef NFC_INTEGRATION_FUZZER
-struct TIMER_LIST_ENT {
-  TIMER_CBACK* p_cback;
-  int32_t ticks;
-  uintptr_t param;
-  uint16_t event;
-  uint8_t in_use;
-};
-#else
 struct TIMER_LIST_ENT {
   TIMER_LIST_ENT* p_next;
   TIMER_LIST_ENT* p_prev;
@@ -321,19 +308,14 @@
   uint16_t event;
   uint8_t in_use;
 };
-#endif
 
 /* Define a timer list queue
 */
-#ifdef NFC_INTEGRATION_FUZZER
-typedef std::list<TIMER_LIST_ENT*> TIMER_LIST_Q;
-#else
 typedef struct {
   TIMER_LIST_ENT* p_first;
   TIMER_LIST_ENT* p_last;
   int32_t last_ticks;
 } TIMER_LIST_Q;
-#endif
 
 /***********************************************************************
 ** This queue is a general purpose buffer queue, for application use.
@@ -426,8 +408,6 @@
 extern void GKI_start_timer(uint8_t, int32_t, bool);
 extern void GKI_stop_timer(uint8_t);
 extern void GKI_timer_update(int32_t);
-extern bool GKI_timer_list_empty(TIMER_LIST_Q*);
-extern TIMER_LIST_ENT* GKI_timer_list_first(TIMER_LIST_Q*);
 extern uint16_t GKI_update_timer_list(TIMER_LIST_Q*, int32_t);
 extern uint32_t GKI_get_remaining_ticks(TIMER_LIST_Q*, TIMER_LIST_ENT*);
 extern uint16_t GKI_wait(uint16_t, uint32_t);
diff --git a/src/gki/common/gki_time.cc b/src/gki/common/gki_time.cc
index ff7ee2f..1265220 100644
--- a/src/gki/common/gki_time.cc
+++ b/src/gki/common/gki_time.cc
@@ -188,12 +188,6 @@
   uint8_t task_id = GKI_get_taskid();
   bool bad_timer = false;
 
-  if (task_id >= GKI_MAX_TASKS) {
-    LOG(ERROR) << StringPrintf("%s: invalid task_id:0x%02x. start timer failed",
-                               __func__, task_id);
-    return;
-  }
-
   if (ticks <= 0) ticks = 1;
 
   orig_ticks = ticks; /* save the ticks in case adjustment is necessary */
@@ -292,36 +286,35 @@
   uint8_t task_id = GKI_get_taskid();
 
   GKI_disable();
-  if (task_id < GKI_MAX_TASKS) {
-    switch (tnum) {
+
+  switch (tnum) {
 #if (GKI_NUM_TIMERS > 0)
-      case TIMER_0:
-        gki_cb.com.OSTaskTmr0R[task_id] = 0;
-        gki_cb.com.OSTaskTmr0[task_id] = 0;
-        break;
+    case TIMER_0:
+      gki_cb.com.OSTaskTmr0R[task_id] = 0;
+      gki_cb.com.OSTaskTmr0[task_id] = 0;
+      break;
 #endif
 
 #if (GKI_NUM_TIMERS > 1)
-      case TIMER_1:
-        gki_cb.com.OSTaskTmr1R[task_id] = 0;
-        gki_cb.com.OSTaskTmr1[task_id] = 0;
-        break;
+    case TIMER_1:
+      gki_cb.com.OSTaskTmr1R[task_id] = 0;
+      gki_cb.com.OSTaskTmr1[task_id] = 0;
+      break;
 #endif
 
 #if (GKI_NUM_TIMERS > 2)
-      case TIMER_2:
-        gki_cb.com.OSTaskTmr2R[task_id] = 0;
-        gki_cb.com.OSTaskTmr2[task_id] = 0;
-        break;
+    case TIMER_2:
+      gki_cb.com.OSTaskTmr2R[task_id] = 0;
+      gki_cb.com.OSTaskTmr2[task_id] = 0;
+      break;
 #endif
 
 #if (GKI_NUM_TIMERS > 3)
-      case TIMER_3:
-        gki_cb.com.OSTaskTmr3R[task_id] = 0;
-        gki_cb.com.OSTaskTmr3[task_id] = 0;
-        break;
+    case TIMER_3:
+      gki_cb.com.OSTaskTmr3R[task_id] = 0;
+      gki_cb.com.OSTaskTmr3[task_id] = 0;
+      break;
 #endif
-    }
   }
 
   if (gki_timers_is_timer_running() == false) {
@@ -690,14 +683,6 @@
   return (num_time_out);
 }
 
-bool GKI_timer_list_empty(TIMER_LIST_Q* p_timer_listq) {
-  return p_timer_listq->p_first == nullptr;
-}
-
-TIMER_LIST_ENT* GKI_timer_list_first(TIMER_LIST_Q* p_timer_listq) {
-  return p_timer_listq->p_first;
-}
-
 /*******************************************************************************
 **
 ** Function         GKI_get_remaining_ticks
diff --git a/src/gki/ulinux/gki_ulinux.cc b/src/gki/ulinux/gki_ulinux.cc
index d6d81ed..7262b5f 100644
--- a/src/gki/ulinux/gki_ulinux.cc
+++ b/src/gki/ulinux/gki_ulinux.cc
@@ -125,7 +125,7 @@
   pthread_mutexattr_init(&attr);
 
 #ifndef __CYGWIN__
-  pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
+  pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
 #endif
   p_os = &gki_cb.os;
   pthread_mutex_init(&p_os->GKI_mutex, &attr);
@@ -290,6 +290,8 @@
    * GKI_exception problem due to btu->hci sleep request events  */
   for (task_id = GKI_MAX_TASKS; task_id > 0; task_id--) {
     if (gki_cb.com.OSRdyTbl[task_id - 1] != TASK_DEAD) {
+      gki_cb.com.OSRdyTbl[task_id - 1] = TASK_DEAD;
+
       /* paranoi settings, make sure that we do not execute any mailbox events
        */
       gki_cb.com.OSWaitEvt[task_id - 1] &=
@@ -550,12 +552,13 @@
 
   gki_pthread_info_t* p_pthread_info = &gki_pthread_info[rtask];
   if (p_pthread_info->pCond != nullptr && p_pthread_info->pMutex != nullptr) {
+    int ret;
     DLOG_IF(INFO, nfc_debug_enabled)
         << StringPrintf("GKI_wait task=%i, pCond/pMutex = %p/%p", rtask,
                         p_pthread_info->pCond, p_pthread_info->pMutex);
-    pthread_mutex_lock(p_pthread_info->pMutex);
-    pthread_cond_signal(p_pthread_info->pCond);
-    pthread_mutex_unlock(p_pthread_info->pMutex);
+    ret = pthread_mutex_lock(p_pthread_info->pMutex);
+    ret = pthread_cond_signal(p_pthread_info->pCond);
+    ret = pthread_mutex_unlock(p_pthread_info->pMutex);
     p_pthread_info->pMutex = nullptr;
     p_pthread_info->pCond = nullptr;
   }
@@ -626,7 +629,7 @@
     if (gki_cb.com.OSTaskQFirst[rtask][3])
       gki_cb.com.OSWaitEvt[rtask] |= TASK_MBOX_3_EVT_MASK;
 
-    if (gki_cb.com.OSWaitEvt[rtask] == EVENT_MASK(GKI_SHUTDOWN_EVT)) {
+    if (gki_cb.com.OSRdyTbl[rtask] == TASK_DEAD) {
       gki_cb.com.OSWaitEvt[rtask] = 0;
       /* unlock thread_evt_mutex as pthread_cond_wait() does auto lock when cond
        * is met */
@@ -1070,11 +1073,6 @@
     return;
   }
   GKI_disable();
-  if (gki_cb.com.OSRdyTbl[task_id] == TASK_DEAD) {
-      GKI_enable();
-      LOG(WARNING) << StringPrintf("%s: task_id %d was already stopped.", __func__, task_id);
-      return;
-  }
   gki_cb.com.OSRdyTbl[task_id] = TASK_DEAD;
 
   /* Destroy mutex and condition variable objects */
diff --git a/src/include/NfcAdaptation.h b/src/include/NfcAdaptation.h
index 8bbb9c2..df12a44 100644
--- a/src/include/NfcAdaptation.h
+++ b/src/include/NfcAdaptation.h
@@ -16,14 +16,14 @@
  *
  ******************************************************************************/
 #pragma once
-
 #include <pthread.h>
-#include <utils/RefBase.h>
 
 #include "config.h"
 #include "nfc_hal_api.h"
 #include "nfc_target.h"
 
+#include <utils/RefBase.h>
+
 using ::android::sp;
 
 namespace android {
@@ -138,9 +138,4 @@
                                           nfc_status_t event_status);
   static void HalDownloadFirmwareDataCallback(uint16_t data_len,
                                               uint8_t* p_data);
-
-  // Death recipient callback that is called when INfcAidl dies.
-  // The cookie is a pointer to a NfcAdaptation object.
-  static void HalAidlBinderDied(void* cookie);
-  void HalAidlBinderDiedImpl();
 };
diff --git a/src/include/debug_lmrt.h b/src/include/debug_lmrt.h
deleted file mode 100644
index b050285..0000000
--- a/src/include/debug_lmrt.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/**
- * Copyright (C) 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.
- */
-
-#ifndef _DEBUG_LMRT_
-#define _DEBUG_LMRT_
-
-#include <stdint.h>
-
-#include <string>
-#include <vector>
-
-#include "nfc_int.h"
-
-/* The type definition of a group of RF_SET_LISTEN_MODE_ROUTING_CMD(s) */
-typedef struct lmrt_payload_t {
-  std::vector<uint8_t> more;
-  std::vector<uint8_t> entry_count;
-  std::vector<std::vector<uint8_t>> tlvs;
-} __attribute__((__packed__)) lmrt_payload_t;
-
-/*******************************************************************************
-**
-** Function         debug_lmrt_init
-**
-** Description      initialize the lmrt_payloads
-**
-** Returns          None
-**
-*******************************************************************************/
-void debug_lmrt_init(void);
-
-/*******************************************************************************
-**
-** Function         lmrt_log
-**
-** Description      print the listen mode routing configuration for debug use
-**
-** Returns          None
-**
-*******************************************************************************/
-void lmrt_log(void);
-
-/*******************************************************************************
-**
-** Function         lmrt_capture
-**
-** Description      record the last RF_SET_LISTEN_MODE_ROUTING_CMD
-**
-** Returns          None
-**
-*******************************************************************************/
-void lmrt_capture(uint8_t* buf, uint8_t buf_size);
-
-/*******************************************************************************
-**
-** Function         lmrt_update
-**
-** Description      Update the committed tlvs to committed_lmrt_tlvs
-**
-** Returns          None
-**
-*******************************************************************************/
-void lmrt_update(void);
-
-/*******************************************************************************
-**
-** Function         lmrt_get_max_size
-**
-** Description      This function is used to get the max size of the routing
-**                  table from cache
-**
-** Returns          Max Routing Table Size
-**
-*******************************************************************************/
-int lmrt_get_max_size(void);
-
-/*******************************************************************************
-**
-** Function         lmrt_get_tlvs
-**
-** Description      This function is used to get the committed listen mode
-**                  routing configuration command
-**
-** Returns          The committed listen mode routing configuration command
-**
-*******************************************************************************/
-std::vector<uint8_t>* lmrt_get_tlvs();
-
-#endif /* _DEBUG_LMRT_ */
diff --git a/src/include/debug_nfcsnoop.h b/src/include/debug_nfcsnoop.h
index d6e96cf..b846d69 100644
--- a/src/include/debug_nfcsnoop.h
+++ b/src/include/debug_nfcsnoop.h
@@ -19,9 +19,6 @@
 #define _DEBUG_NFCSNOOP_
 
 #include <stdint.h>
-
-#include <string>
-
 #include "nfc_target.h"
 #include "nfc_types.h"
 
diff --git a/src/include/hardware_nfc.h b/src/include/hardware_nfc.h
deleted file mode 100644
index b266541..0000000
--- a/src/include/hardware_nfc.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 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
-
-typedef uint8_t nfc_event_t;
-typedef uint8_t nfc_status_t;
-
-/*
- * The callback passed in from the NFC stack that the HAL
- * can use to pass events back to the stack.
- */
-typedef void(nfc_stack_callback_t)(nfc_event_t event,
-                                   nfc_status_t event_status);
-
-/*
- * The callback passed in from the NFC stack that the HAL
- * can use to pass incomming data to the stack.
- */
-typedef void(nfc_stack_data_callback_t)(uint16_t data_len, uint8_t* p_data);
-
-enum {
-  HAL_NFC_OPEN_CPLT_EVT = 0u,
-  HAL_NFC_CLOSE_CPLT_EVT = 1u,
-  HAL_NFC_POST_INIT_CPLT_EVT = 2u,
-  HAL_NFC_PRE_DISCOVER_CPLT_EVT = 3u,
-  HAL_NFC_REQUEST_CONTROL_EVT = 4u,
-  HAL_NFC_RELEASE_CONTROL_EVT = 5u,
-  HAL_NFC_ERROR_EVT = 6u,
-  HAL_HCI_NETWORK_RESET = 7u,
-};
-
-enum {
-  HAL_NFC_STATUS_OK = 0u,
-  HAL_NFC_STATUS_FAILED = 1u,
-  HAL_NFC_STATUS_ERR_TRANSPORT = 2u,
-  HAL_NFC_STATUS_ERR_CMD_TIMEOUT = 3u,
-  HAL_NFC_STATUS_REFUSED = 4u,
-};
diff --git a/src/include/nci_defs.h b/src/include/nci_defs.h
index 355f095..c23c39e 100644
--- a/src/include/nci_defs.h
+++ b/src/include/nci_defs.h
@@ -246,8 +246,6 @@
 
 #define NCI_CORE_PARAM_SIZE_CON_CLOSE 0x01     /* Conn ID (1 octet) */
 
-/* Keep the NCI configuration and perform NCI initialization. */
-#define NCI_RESET_TYPE_KEEP_CFG 0x00
 /* Reset the NCI configuration, and perform NCI initialization. */
 #define NCI_RESET_TYPE_RESET_CFG 0x01
 
diff --git a/src/include/nfc_config.h b/src/include/nfc_config.h
index 62e47be..aa7ac66 100644
--- a/src/include/nfc_config.h
+++ b/src/include/nfc_config.h
@@ -41,7 +41,7 @@
 #define NAME_RECOVERY_OPTION "RECOVERY_OPTION"
 #define NAME_ALWAYS_ON_SET_EE_POWER_AND_LINK_CONF \
   "ALWAYS_ON_SET_EE_POWER_AND_LINK_CONF"
-#define NAME_NCI_RESET_TYPE "NCI_RESET_TYPE"
+
 /* Configs from vendor interface */
 #define NAME_NFA_POLL_BAIL_OUT_MODE "NFA_POLL_BAIL_OUT_MODE"
 #define NAME_PRESENCE_CHECK_ALGORITHM "PRESENCE_CHECK_ALGORITHM"
@@ -57,7 +57,7 @@
 #define NAME_OFF_HOST_ESE_PIPE_ID "OFF_HOST_ESE_PIPE_ID"
 #define NAME_OFF_HOST_SIM_PIPE_ID "OFF_HOST_SIM_PIPE_ID"
 #define NAME_ISO_DEP_MAX_TRANSCEIVE "ISO_DEP_MAX_TRANSCEIVE"
-#define NAME_DEVICE_HOST_ALLOW_LIST "DEVICE_HOST_ALLOW_LIST"
+#define NAME_DEVICE_HOST_WHITE_LIST "DEVICE_HOST_WHITE_LIST"
 #define NAME_DEFAULT_ISODEP_ROUTE "DEFAULT_ISODEP_ROUTE"
 
 class NfcConfig {
diff --git a/src/include/nfc_hal_api.h b/src/include/nfc_hal_api.h
index 8934a63..205c6f7 100644
--- a/src/include/nfc_hal_api.h
+++ b/src/include/nfc_hal_api.h
@@ -23,8 +23,8 @@
  ******************************************************************************/
 #ifndef NFC_HAL_API_H
 #define NFC_HAL_API_H
+#include <hardware/nfc.h>
 #include "data_types.h"
-#include "hardware_nfc.h"
 #include "nfc_hal_target.h"
 
 typedef uint8_t tHAL_NFC_STATUS;
diff --git a/src/nci_packets.pdl b/src/nci_packets.pdl
deleted file mode 100644
index e8ecad2..0000000
--- a/src/nci_packets.pdl
+++ /dev/null
@@ -1,463 +0,0 @@
-little_endian_packets
-
-enum PacketBoundaryFlag : 1 {
-  COMPLETE_OR_FINAL = 0,
-  INCOMPLETE = 1,
-}
-
-enum NciMsgType : 3 {
-  DATA = 0,
-  COMMAND = 1,
-  RESPONSE = 2,
-  NOTIFICATION = 3,
-}
-
-enum Opcode : 8 {
-  CORE_RESET = 0x0,
-  CORE_INIT = 0x1,
-  CORE_SET_CONFIG = 0x2,
-  CORE_GET_CONFIG = 0x3,
-  CORE_CONN_CREATE = 0x4,
-  CORE_CONN_CLOSE = 0x5,
-  CORE_CONN_CREDITS = 0x6,
-  CORE_GENERIC_ERROR = 0x7,
-  CORE_INTERFACE_ERROR = 0x8,
-  CORE_SET_POWER_SUBSTATE = 0x9,
-  RF_DISCOVER_MAP = 0x40,
-  RF_SET_LISTEN_MODE_ROUTING = 0x41,
-  RF_GET_LISTEN_MODE_ROUTING = 0x42,
-  RF_DISCOVER = 0x43,
-  RF_DISCOVER_SELECT = 0x44,
-  RF_INTF_ACTIVATED = 0x45,
-  RF_DIACTIVATE = 0x46,
-  RF_FIELD_INFO = 0x47,
-  RF_T3T_POLLING = 0x48,
-  RF_NFCEE_ACTION = 0x49,
-  RF_NFCEE_DISCOVERY_REQ = 0x4A,
-  RF_PARAMETER_UPDATE = 0x4B,
-  RF_INTF_EXT_START = 0x4C,
-  RF_INTF_EXT_STOP = 0x4D,
-  RF_EXT_AGG_ABORT = 0x4E,
-  RF_NDEF_ABORT = 0x4F,
-  RF_ISO_DEP_NAK_PRESENCE = 0x50,
-  RF_SET_FORCED_NFCEE_ROUTING_CMD = 0x51,
-}
-
-enum Status : 8 {
-  OK = 0x00,
-  REJECTED = 0x01,
-  FAILED = 0x03,
-  NOT_INITIALIZED = 0x04,
-  SYNTAX_ERROR = 0x05,
-  SEMANTIC_ERROR = 0x06,
-  INVALID_PARAM = 0x09,
-  MESSAGE_SIZE_EXCEEDED = 0x0A,
-  OK_1_BIT = 0x11,
-  OK_2_BIT = 0x12,
-  OK_3_BIT = 0x13,
-  OK_4_BIT = 0x14,
-  OK_5_BIT = 0x15,
-  OK_6_BIT = 0x16,
-  OK_7_BIT = 0x17,
-  DISCOVERY_ALREADY_STARTED = 0xA0,
-  DISCOVERY_TARGET_ACTIVATION_FAILED = 0xA1,
-  DISCOVERY_TEAR_DOWN = 0xA2,
-  RF_FRAME_CORRUPTED = 0x02,
-  RF_TRANSMISSION_EXCEPTION = 0xB0,
-  RF_PROTOCOL_EXCEPTION = 0xB1,
-  RF_TIMEOUT_EXCEPTION = 0xB2,
-  RF_UNEXPECTED_DATA = 0xB3,
-  NFCEE_INTERFACE_ACTIVATION_FAILED = 0xC0,
-  NFCEE_TRANSMISSION_ERROR = 0xC1,
-  NFCEE_PROTOCOL_ERROR = 0xC2,
-  NFCEE_TIMEOUT_ERROR = 0xC3,
-}
-
-packet Nci {
-  gid : 4,
-  pbf : PacketBoundaryFlag,
-  mt : NciMsgType,
-  _payload_,
-}
-
-packet Command : Nci (mt = COMMAND) {
-  op : Opcode,
-  _size_(_payload_) : 8,
-  _payload_,
-}
-
-packet Response : Nci (mt = RESPONSE) {
-  cmd_op : Opcode,
-  _size_(_payload_) : 8,
-  _payload_,
-}
-
-packet Notification : Nci (mt = NOTIFICATION) {
-  cmd_op : Opcode,
-  _size_(_payload_) : 8,
-  _payload_,
-}
-
-packet Data {
-  conn_id : 4,
-  pbf : PacketBoundaryFlag,
-  _fixed_ =  0x0 : 3,
-  cr : 8,
-  _size_(_payload_) : 8,
-  _payload_,
-}
-
-enum ResetType : 8 {
-  KEEP_CONFIG = 0,
-  RESET_CONFIG = 1,
-}
-
-packet ResetCommand : Command (op = CORE_RESET) {
-  reset_type: ResetType,
-}
-
-test ResetCommand {
-  "\x20\x00\x01\x01",
-}
-
-packet ResetResponse : Response (cmd_op = CORE_RESET) {
-  status: Status,
-}
-
-test ResetResponse {
-  "\x40\x00\x01\x00",
-}
-
-enum ResetTrigger : 8 {
-  UNRECOVERABLE_ERROR = 0,
-  POWER_ON = 1,
-  RESET_COMMAND = 2,
-}
-
-enum NciVersion : 8 {
-  VERSION_1_0 = 0x10,
-  VERSION_1_1 = 0x11,
-  VERSION_2_0 = 0x20,
-}
-
-enum ConfigStatus : 8 {
-  CONFIG_KEPT = 0x00,
-  CONFIG_RESET = 0x01,
-}
-
-packet ResetNotification : Notification (cmd_op = CORE_RESET) {
-  trigger : ResetTrigger,
-  config_status : ConfigStatus,
-  nci_version : NciVersion,
-  manufacturer_id: 8,
-  _size_(mfsi) : 8,
-  mfsi : 8[],
-}
-
-test ResetNotification {
-  "\x60\x00\x1f\x02\x01\x20\x02\x1a\x05\x03\x03\x06\x88\x97\x01\x06\x00\x00\x44\x64\xd6\x00\x00\xec\x10\x00\x00\x00\x01\x00\x00\xee\xe7\x02",
-}
-
-enum FeatureEnable : 16 {
-  RFU = 0,
-}
-
-
-enum DiscConfMode : 2 {
-  DH_ONLY = 0x0,
-  DH_AND_EE = 0x1,
-}
-
-enum FeatureState : 1 {
-  DISABLED = 0,
-  AVAILABLE = 1,
-}
-
-struct PropCaps {
-  b7 : 1,
-  b6 : 1,
-  b5 : 1,
-  b4 : 1,
-  b3 : 1,
-  b2 : 1,
-  b1 : 1,
-  b0 : 1,
-}
-
-struct NfccFeatures {
-  disc_freq_conf : FeatureState,
-  disc_conf_mode : DiscConfMode,
-  hci_net_support : FeatureState,
-  active_comm_mode : FeatureState,
-  _reserved_ : 3,
-  _reserved_: 1,
-  tech_routing : FeatureState,
-  proto_routing : FeatureState,
-  aid_routing : FeatureState,
-  syc_code_routing : FeatureState,
-  apdu_pttn_routing : FeatureState,
-  forced_nfcee_routing : FeatureState,
-  _reserved_ : 1,
-  batt_off_st : FeatureState,
-  soff_st : FeatureState,
-  swon_subst : FeatureState,
-  rf_conf_soff: FeatureState,
-  _reserved_ : 4,
-  prop_caps: PropCaps,
-}
-
-enum Intf : 8 {
-  NFCEE_DIRECT_RF = 0x00,
-  FRAME_RF = 0x01,
-  ISO_DEP_RF = 0x02,
-  NFC_DEP_RF = 0x03,
-  NDEF_RF = 0x06,
-}
-
-enum Extns : 8 {
-  FR_AGREG_RF_EXT = 0x00,
-  LLCP_SYM_RF_EXT = 0x01,
-}
-
-struct ExtList {
-  ext : Extns,
-}
-
-struct RfInterface {
-  intf : 8,
-  _size_(extns) : 8,
-  extns : 8[],
-}
-
-packet InitCommand : Command (op = CORE_INIT) {
-  feature_enable : FeatureEnable,
-}
-
-test InitCommand {
-  "\x20\x01\x02\x00\x00",
-}
-
-packet InitResponse : Response (cmd_op = CORE_INIT) {
-  status : Status,
-  nfcc_features : NfccFeatures,
-  max_log_conns : 4, //TODO set max to 0x0E
-  _reserved_ : 4,
-  max_rout_tbls_size : 16,
-  max_ctrl_payload : 8,  //TODO 32 <= val <= 255
-  max_data_payload : 8,
-  num_of_credits : 8,
-  max_nfcv_rf_frame_sz : 16,
-  _count_(rf_interface) : 8,
-  rf_interface: RfInterface[],
-}
-
-test InitResponse {
-  "\x40\x01\x18\x00\x1a\x7e\x06\x00\x01\x00\x04\xff\xff\x00\x0c\x01\x05\x01\x00\x02\x00\x03\x00\x00\x00\x90\x00",
-}
-
-enum ParamIds : 8 {
-  TOTAL_DURATION = 0x00,
-  CON_DISCOVERY_PARAM = 0x02,
-  POWER_STATE = 0x03,
-  PA_BAIL_OUT = 0x08,
-  PA_DEVICES_LIMIT = 0x09,
-  PB_AFI = 0x10,
-  PB_BAIL_OUT = 0x11,
-  PB_ATTRIB_PARAM1 = 0x12,
-  PB_SENSB_REQ_PARAM = 0x13,
-  PB_DEVICES_LIMIT = 0x14,
-  PF_BIT_RATE = 0x18,
-  PF_BAIL_OUT = 0x19,
-  PF_DEVICES_LIMIT = 0x1A,
-  PI_B_H_INFO = 0x20,
-  PI_BIT_RATE = 0x21,
-  PN_NFC_DEP_PSL = 0x28,
-  PN_ATR_REQ_GEN_BYTES = 0x29,
-  PN_ATR_REQ_CONFIG = 0x2A,
-  PV_DEVICES_LIMIT = 0x2F,
-  LA_BIT_FRAME_SDD = 0x30,
-  LA_PLATFORM_CONFIG = 0x31,
-  LA_SEL_INFO = 0x32,
-  LA_NFCID1 = 0x33,
-  LB_SENSB_INFO = 0x38,
-  LB_NFCID0 = 0x39,
-  LB_APPLICATION_DATA = 0x3A,
-  LB_SFGI = 0x3B,
-  LB_FWI_ADC_FO = 0x3C,
-  LB_BIT_RATE = 0x3E,
-  LF_T3T_IDENTIFIERS_1 = 0x40,
-  LF_T3T_IDENTIFIERS_2 = 0x41,
-  LF_T3T_IDENTIFIERS_3 = 0x42,
-  LF_T3T_IDENTIFIERS_4 = 0x43,
-  LF_T3T_IDENTIFIERS_5 = 0x44,
-  LF_T3T_IDENTIFIERS_6 = 0x45,
-  LF_T3T_IDENTIFIERS_7 = 0x46,
-  LF_T3T_IDENTIFIERS_8 = 0x47,
-  LF_T3T_IDENTIFIERS_9 = 0x48,
-  LF_T3T_IDENTIFIERS_10 = 0x49,
-  LF_T3T_IDENTIFIERS_11 = 0x4A,
-  LF_T3T_IDENTIFIERS_12 = 0x4B,
-  LF_T3T_IDENTIFIERS_13 = 0x4C,
-  LF_T3T_IDENTIFIERS_14 = 0x4D,
-  LF_T3T_IDENTIFIERS_15 = 0x4E,
-  LF_T3T_IDENTIFIERS_16 = 0x4F,
-  LF_T3T_MAX = 0x52,
-  LF_T3T_FLAGS = 0x53,
-  LF_T3T_RD_ALLOWED = 0x55,
-  LF_PROTOCOL_TYPE = 0x50,
-  LI_A_RATS_TB1 = 0x58,
-  LI_A_HIST_BY = 0x59,
-  LI_B_H_INFO_RESP = 0x5A,
-  LI_A_BIT_RATE = 0x5B,
-  LI_A_RATS_TC1 = 0x5C,
-  LN_WT = 0x60,
-  LN_ATR_RES_GEN_BYTES = 0x61,
-  LN_ATR_RES_CONFIG = 0x62,
-  PACM_BIT_RATE = 0x68,
-  RF_FIELD_INFO = 0x80,
-  RF_NFCEE_ACTION = 0x81,
-  NFCDEP_OP = 0x82,
-  LLCP_VERSION = 0x83,
-  NFCC_CONFIG_CONTROL = 0x85,
-  PROP0 = 0xa0,
-  PROP1 = 0xa1,
-  PROP2 = 0xa2,
-  PROP3 = 0xa3,
-  PROP4 = 0xa4,
-  PROP5 = 0xa5,
-}
-
-struct ConfigParams {
-  paramid : ParamIds,
-  _size_(valm) : 8,
-  valm : 8[],
-}
-
-struct ParamList {
-  pids : ParamIds,
-}
-
-packet SetConfigCommand : Command (op = CORE_SET_CONFIG) {
-  _count_(params) : 8,
-  params : ConfigParams[],
-}
-
-test SetConfigCommand {
-  "\x20\x02\x10\x05\x30\x01\x04\x31\x01\x00\x32\x01\x20\x38\x01\x01\x50\x01\x00",
-}
-
-packet SetConfigResponse : Response (cmd_op = CORE_SET_CONFIG) {
-  status : Status,
-  _count_(paramids) : 8,
-  paramids : ParamList[],
-}
-
-test SetConfigResponse {
-  "\x40\x02\x02\x00\x00",
-}
-
-packet GetConfigCommand : Command (op = CORE_GET_CONFIG) {
-  _count_(paramids) : 8,
-  paramids : ParamList[],
-}
-
-test GetConfigCommand {
-  "\x20\x03\x02\x01\x52",
-}
-
-packet GetConfigResponse : Response (cmd_op = CORE_GET_CONFIG) {
-  status : Status,
-  _count_(params) : 8,
-  params : ConfigParams[],
-}
-
-test GetConfigResponse {
-  "\x40\x03\x05\x00\x01\x52\x01\x10",
-}
-
-enum RfProtocols : 8 {
-  PROTOCOL_UNDETERMINED = 0x00,
-  PROTOCOL_T1T = 0x01,
-  PROTOCOL_T2T = 0x02,
-  PROTOCOL_T3T = 0x03,
-  PROTOCOL_ISO_DEP = 0x04,
-  PROTOCOL_NFC_DEP = 0x05,
-  PROTOCOL_T5T = 0x06,
-  PROTOCOL_NDEF = 0x07,
-}
-
-enum NfceeProtocols : 8 {
-  APDU = 0x00,
-  RFU = 0x01,
-  T3CS = 0x02,
-  TRANSPARENT = 0x04,
-}
-
-enum DestTypes : 8 {
-  RFU = 0x00,
-  NFCC_LPBK = 0x01,
-  REMOTE = 0x02,
-  NFCEE = 0x03,
-}
-
-enum DestParamTypes : 8 {
-  RF_DISC = 0x00,
-  NFCEE = 0x01,
-}
-
-struct RfDiscType {
-  id : 8,
-  proto: RfProtocols,
-}
-
-struct NfceeType {
-  id : 8,
-  proto : NfceeProtocols,
-}
-
-struct DestParams {
-  ptype : DestParamTypes,
-  _size_(valdsp) : 8,
-  valdsp : 8[],
-}
-
-packet ConnCreateCommand : Command (op = CORE_CONN_CREATE) {
-  dt : DestTypes,
-  _count_(destparams) : 8,
-  destparams : DestParams[],
-}
-
-packet ConnCreateResponse : Response (cmd_op = CORE_CONN_CREATE) {
-  status : Status,
-  mpps : 8,
-  ncreds : 8,
-  conn_id : 8,
-}
-
-packet ConnCloseCommand : Command (op = CORE_CONN_CLOSE) {
-  conn_id : 8,
-}
-
-packet ConnCloseResponse : Response (cmd_op = CORE_CONN_CLOSE) {
-  status : Status,
-}
-
-struct CreditsPerConn {
-  conn_id : 8,
-  ncredits : 8,
-}
-
-packet ConnCreditsNotification : Notification (cmd_op = CORE_CONN_CREDITS) {
-  _count_(conns) : 8,
-  conns : CreditsPerConn[],
-}
-
-packet GenericError : Notification (cmd_op = CORE_GENERIC_ERROR) {
-  status : Status,
-}
-
-packet InterfaceError : Notification (cmd_op = CORE_INTERFACE_ERROR) {
-  status : Status,
-  conn_id : 8,
-}
-
diff --git a/src/nfa/dm/nfa_dm_discover.cc b/src/nfa/dm/nfa_dm_discover.cc
index e1b279e..0925434 100644
--- a/src/nfa/dm/nfa_dm_discover.cc
+++ b/src/nfa/dm/nfa_dm_discover.cc
@@ -2131,6 +2131,7 @@
 *******************************************************************************/
 static void nfa_dm_disc_sm_poll_active(tNFA_DM_RF_DISC_SM_EVENT event,
                                        tNFA_DM_RF_DISC_DATA* p_data) {
+  tNFC_STATUS status;
   tNFA_DM_DISC_FLAGS old_sleep_wakeup_flag =
       (nfa_dm_cb.disc_cb.disc_flags & NFA_DM_DISC_FLAGS_CHECKING);
   bool sleep_wakeup_event = false;
@@ -2142,7 +2143,7 @@
       if (nfa_dm_cb.disc_cb.activated_protocol == NCI_PROTOCOL_MIFARE) {
         nfa_dm_cb.disc_cb.deact_pending = true;
         nfa_dm_cb.disc_cb.pending_deact_type = p_data->deactivate_type;
-        nfa_dm_send_deactivate_cmd(p_data->deactivate_type);
+        status = nfa_dm_send_deactivate_cmd(p_data->deactivate_type);
         break;
       }
 
@@ -2152,7 +2153,7 @@
         nfa_dm_cb.disc_cb.deact_pending = true;
         nfa_dm_cb.disc_cb.pending_deact_type = p_data->deactivate_type;
       } else {
-        nfa_dm_send_deactivate_cmd(p_data->deactivate_type);
+        status = nfa_dm_send_deactivate_cmd(p_data->deactivate_type);
       }
 
       break;
@@ -2911,6 +2912,7 @@
   }
 
   if (nfa_dm_cb.disc_cb.disc_state == NFA_DM_RFST_DISCOVERY) {
+    uint8_t rf_disc_id = 0xFF;
     uint8_t type = 0xFF;
     uint8_t protocol = 0xFF;
     uint8_t tech_mode = 0xFF;
@@ -2918,7 +2920,7 @@
     DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("P2P_Prio_Logic");
 
     if (event == NCI_MSG_RF_INTF_ACTIVATED) {
-      p++;  // rf_disc_id = *p++;
+      rf_disc_id = *p++;
       type = *p++;
       protocol = *p++;
       tech_mode = *p++;
diff --git a/src/nfa/ee/nfa_ee_act.cc b/src/nfa/ee/nfa_ee_act.cc
index 73c224c..8b637d6 100644
--- a/src/nfa/ee/nfa_ee_act.cc
+++ b/src/nfa/ee/nfa_ee_act.cc
@@ -21,19 +21,20 @@
  *  This file contains the action functions for NFA-EE
  *
  ******************************************************************************/
-#include <android-base/stringprintf.h>
-#include <base/logging.h>
-#include <statslog.h>
 #include <string.h>
 
-#include "include/debug_lmrt.h"
-#include "metrics.h"
+#include <android-base/stringprintf.h>
+#include <base/logging.h>
+
 #include "nfa_api.h"
 #include "nfa_dm_int.h"
 #include "nfa_ee_int.h"
 #include "nfa_hci_int.h"
 #include "nfc_int.h"
 
+#include <statslog.h>
+#include "metrics.h"
+
 using android::base::StringPrintf;
 
 extern bool nfc_debug_enabled;
@@ -645,8 +646,8 @@
                                     int* p_offset, int* p_entry) {
   int xx, yy, aid_len_offset, offset;
   tNFA_EE_ECB *p_ret = nullptr, *p_ecb;
-  /* NFA_EE_CB_4_DH + Empty aid ECB */
-  p_ecb = &nfa_ee_cb.ecb[NFA_EE_CB_4_DH + 1];
+
+  p_ecb = &nfa_ee_cb.ecb[NFA_EE_CB_4_DH];
   aid_len_offset = 1; /* skip the tag */
   for (yy = 0; yy <= nfa_ee_cb.cur_ee; yy++) {
     if (p_ecb->aid_entries) {
@@ -2250,9 +2251,7 @@
 
     if (nfa_ee_cb.ee_wait_evt & NFA_EE_WAIT_UPDATE) {
       nfa_ee_cb.ee_wait_evt &= ~NFA_EE_WAIT_UPDATE;
-      /* finished updating NFCC; record the committed listen mode routing
-       * configuration command; report NFA_EE_UPDATED_EVT now */
-      lmrt_update();
+      /* finished updating NFCC; report NFA_EE_UPDATED_EVT now */
       evt_data.status = NFA_STATUS_OK;
       nfa_ee_report_event(nullptr, NFA_EE_UPDATED_EVT, &evt_data);
     }
@@ -2412,6 +2411,7 @@
 *******************************************************************************/
 void nfa_ee_nci_disc_req_ntf(tNFA_EE_MSG* p_data) {
   tNFC_EE_DISCOVER_REQ_REVT* p_cbk = p_data->disc_req.p_data;
+  tNFA_HANDLE ee_handle;
   tNFA_EE_ECB* p_cb = nullptr;
   uint8_t report_ntf = 0;
   uint8_t xx;
@@ -2420,6 +2420,8 @@
       "num_info: %d cur_ee:%d", p_cbk->num_info, nfa_ee_cb.cur_ee);
 
   for (xx = 0; xx < p_cbk->num_info; xx++) {
+    ee_handle = NFA_HANDLE_GROUP_EE | p_cbk->info[xx].nfcee_id;
+
     p_cb = nfa_ee_find_ecb(p_cbk->info[xx].nfcee_id);
     if (!p_cb) {
       DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
@@ -2803,6 +2805,7 @@
   int max_len;
   tNFA_STATUS status = NFA_STATUS_FAILED;
   int cur_offset;
+  uint8_t max_tlv;
 
   /* update routing table: DH and the activated NFCEEs */
   max_len = (NFC_GetLmrtSize() > NFA_EE_ROUT_BUF_SIZE) ? NFC_GetLmrtSize()
@@ -2831,6 +2834,10 @@
   if (last_active == NFA_EE_INVALID) {
     check = false;
   }
+
+  max_tlv =
+      (uint8_t)((max_len > NFA_EE_ROUT_MAX_TLV_SIZE) ? NFA_EE_ROUT_MAX_TLV_SIZE
+                                                     : max_len);
   cur_offset = 0;
   /* use the first byte of the buffer (p) to keep the num_tlv */
   *p = 0;
@@ -2852,16 +2859,6 @@
         << StringPrintf("%s --add the routing for DH!!", __func__);
     nfa_ee_route_add_one_ecb_by_route_order(&nfa_ee_cb.ecb[NFA_EE_CB_4_DH], rt,
                                             &max_len, more, p, &cur_offset);
-
-    if (rt == NCI_ROUTE_ORDER_AID) {
-      p_cb = &nfa_ee_cb.ecb[NFA_EE_EMPTY_AID_ECB];
-      if (p_cb->ee_status == NFC_NFCEE_STATUS_ACTIVE) {
-        DLOG_IF(INFO, nfc_debug_enabled)
-            << StringPrintf("%s --add the routing for Empty Aid!!", __func__);
-        nfa_ee_route_add_one_ecb_by_route_order(p_cb, rt, &max_len, more, p,
-                                                &cur_offset);
-      }
-    }
   }
 
   GKI_freebuf(p);
diff --git a/src/nfa/ee/nfa_ee_api.cc b/src/nfa/ee/nfa_ee_api.cc
index 428ac21..4881261 100644
--- a/src/nfa/ee/nfa_ee_api.cc
+++ b/src/nfa/ee/nfa_ee_api.cc
@@ -127,9 +127,6 @@
     p_info->ee_status = p_cb->ee_status;
     p_info->num_interface = p_cb->num_interface;
     p_info->num_tlvs = p_cb->num_tlvs;
-    p_info->la_protocol = p_cb->la_protocol;
-    p_info->lb_protocol = p_cb->lb_protocol;
-    p_info->lf_protocol = p_cb->lf_protocol;
     memcpy(p_info->ee_interface, p_cb->ee_interface, p_cb->num_interface);
     memcpy(p_info->ee_tlv, p_cb->ee_tlv, p_cb->num_tlvs * sizeof(tNFA_EE_TLV));
     p_info->ee_power_supply_status = p_cb->ee_power_supply_status;
@@ -561,11 +558,7 @@
   tNFA_EE_ECB* p_cb;
 
   DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("handle:<0x%x>", ee_handle);
-  if (aid_len == 0) {
-    p_cb = &nfa_ee_cb.ecb[NFA_EE_EMPTY_AID_ECB];
-  } else {
-    p_cb = nfa_ee_find_ecb(nfcee_id);
-  }
+  p_cb = nfa_ee_find_ecb(nfcee_id);
 
   /* validate parameters - make sure the AID is in valid length range */
   if ((p_cb == nullptr) ||
@@ -577,7 +570,6 @@
     LOG(ERROR) << StringPrintf("Bad ee_handle or AID (len=%d)", aid_len);
     status = NFA_STATUS_INVALID_PARAM;
   } else {
-    p_cb->nfcee_id = nfcee_id;
     p_msg = (tNFA_EE_API_ADD_AID*)GKI_getbuf(size);
     if (p_msg != nullptr) {
       if (p_aid != nullptr)
diff --git a/src/nfa/hci/nfa_hci_act.cc b/src/nfa/hci/nfa_hci_act.cc
index ae9c3b1..70c519c 100644
--- a/src/nfa/hci/nfa_hci_act.cc
+++ b/src/nfa/hci/nfa_hci_act.cc
@@ -1356,7 +1356,7 @@
           /* Set WHITELIST */
           nfa_hciu_send_set_param_cmd(
               NFA_HCI_ADMIN_PIPE, NFA_HCI_WHITELIST_INDEX,
-              p_nfa_hci_cfg->num_allowlist_host, p_nfa_hci_cfg->p_allowlist);
+              p_nfa_hci_cfg->num_whitelist_host, p_nfa_hci_cfg->p_whitelist);
         } else if (nfa_hci_cb.param_in_use == NFA_HCI_WHITELIST_INDEX) {
           if ((nfa_hci_cb.hci_state == NFA_HCI_STATE_STARTUP) ||
               (nfa_hci_cb.hci_state == NFA_HCI_STATE_RESTORE))
@@ -1408,7 +1408,7 @@
             /* Session has not changed, Set WHITELIST */
             nfa_hciu_send_set_param_cmd(
                 NFA_HCI_ADMIN_PIPE, NFA_HCI_WHITELIST_INDEX,
-                p_nfa_hci_cfg->num_allowlist_host, p_nfa_hci_cfg->p_allowlist);
+                p_nfa_hci_cfg->num_whitelist_host, p_nfa_hci_cfg->p_whitelist);
           } else {
             /* Something wrong, NVRAM data could be corrupt or first start with
              * default session id */
diff --git a/src/nfa/include/nfa_api.h b/src/nfa/include/nfa_api.h
index b94f45e..d89c6f3 100755
--- a/src/nfa/include/nfa_api.h
+++ b/src/nfa/include/nfa_api.h
@@ -573,10 +573,10 @@
   uint16_t hci_netwk_enable_timeout;
   /* Maximum time to wait for EE DISC REQ NTF(s) after HOT PLUG EVT(s) */
   uint16_t hcp_response_timeout;
-  /* Number of host in the allowlist of Terminal host */
-  uint8_t num_allowlist_host;
-  /* Allowlist of Terminal Host */
-  uint8_t* p_allowlist;
+  /* Number of host in the whitelist of Terminal host */
+  uint8_t num_whitelist_host;
+  /* Whitelist of Terminal Host */
+  uint8_t* p_whitelist;
 } tNFA_HCI_CFG;
 
 /*
diff --git a/src/nfa/include/nfa_ee_api.h b/src/nfa/include/nfa_ee_api.h
index ec9b20a..30a0867 100644
--- a/src/nfa/include/nfa_ee_api.h
+++ b/src/nfa/include/nfa_ee_api.h
@@ -119,9 +119,6 @@
   uint8_t num_tlvs;                       /* number of TLVs           */
   tNFA_EE_TLV ee_tlv[NFC_MAX_EE_TLVS];    /* the TLV                  */
   uint8_t ee_power_supply_status;         /* The NFCEE Power supply */
-  tNFA_NFC_PROTOCOL la_protocol;          /* Listen A protocol    */
-  tNFA_NFC_PROTOCOL lb_protocol;          /* Listen B protocol    */
-  tNFA_NFC_PROTOCOL lf_protocol;          /* Listen F protocol    */
 } tNFA_EE_INFO;
 
 typedef struct {
diff --git a/src/nfa/include/nfa_ee_int.h b/src/nfa/include/nfa_ee_int.h
index b280562..cf1781a 100644
--- a/src/nfa/include/nfa_ee_int.h
+++ b/src/nfa/include/nfa_ee_int.h
@@ -30,12 +30,10 @@
 /*****************************************************************************
 **  Constants and data types
 *****************************************************************************/
-/* the number of tNFA_EE_ECBs (for NFCEEs and DH) + Empty aid ECB */
-#define NFA_EE_NUM_ECBS (NFA_EE_MAX_EE_SUPPORTED + 2)
+/* the number of tNFA_EE_ECBs (for NFCEEs and DH) */
+#define NFA_EE_NUM_ECBS (NFA_EE_MAX_EE_SUPPORTED + 1)
 /* The index for DH in nfa_ee_cb.ee_cb[] */
 #define NFA_EE_CB_4_DH NFA_EE_MAX_EE_SUPPORTED
-/* The index for Empty aid in nfa_ee_cb.ee_cb[] */
-#define NFA_EE_EMPTY_AID_ECB (NFA_EE_CB_4_DH + 1)
 #define NFA_EE_INVALID 0xFF
 /* only A, B, F, Bprime are supported by UICC now */
 #define NFA_EE_MAX_TECH_ROUTE 4
diff --git a/src/nfa/p2p/nfa_p2p_act.cc b/src/nfa/p2p/nfa_p2p_act.cc
index 86f3bed..3fca288 100644
--- a/src/nfa/p2p/nfa_p2p_act.cc
+++ b/src/nfa/p2p/nfa_p2p_act.cc
@@ -282,7 +282,7 @@
 **
 *******************************************************************************/
 void nfa_p2p_proc_llcp_connect_ind(tLLCP_SAP_CBACK_DATA* p_data) {
-  uint8_t server_sap;
+  uint8_t server_sap, local_sap;
   tNFA_P2P_EVT_DATA evt_data;
   uint8_t xx;
 
@@ -290,6 +290,7 @@
       << StringPrintf("server_sap:0x%x", p_data->connect_ind.server_sap);
 
   server_sap = p_data->connect_ind.server_sap;
+  local_sap = p_data->connect_ind.local_sap;
 
   if (nfa_p2p_cb.sap_cb[server_sap].p_cback) {
     xx = nfa_p2p_allocate_conn_cb(server_sap);
diff --git a/src/nfa/p2p/nfa_p2p_main.cc b/src/nfa/p2p/nfa_p2p_main.cc
index 67ff679..e39f59d 100644
--- a/src/nfa/p2p/nfa_p2p_main.cc
+++ b/src/nfa/p2p/nfa_p2p_main.cc
@@ -475,9 +475,6 @@
   uint8_t xx;
 
   DLOG_IF(INFO, nfc_debug_enabled) << __func__;
-  /* Set initial P2P flag to paused. So that if platform doesn't support P2P,
-   * p2p_prio_logic should be disabled in reader mode */
-  nfa_dm_cb.flags |= NFA_DM_FLAGS_P2P_PAUSED;
 
   /* initialize control block */
   memset(&nfa_p2p_cb, 0, sizeof(tNFA_P2P_CB));
diff --git a/src/nfa/rw/nfa_rw_main.cc b/src/nfa/rw/nfa_rw_main.cc
index 3cd7559..36701ac 100644
--- a/src/nfa/rw/nfa_rw_main.cc
+++ b/src/nfa/rw/nfa_rw_main.cc
@@ -91,6 +91,7 @@
   tRW_T1T_CB* p_t1t;
   tRW_T2T_CB* p_t2t;
   tRW_T3T_CB* p_t3t;
+  tRW_T4T_CB* p_t4t;
   tRW_I93_CB* p_i93;
   tRW_MFC_CB* p_mfc;
 
@@ -123,6 +124,7 @@
       }
       break;
     case RW_CB_TYPE_T4T: /* do nothing */
+      p_t4t = &rw_cb.tcb.t4t;
       break;
     case RW_CB_TYPE_T5T:
       p_i93 = &rw_cb.tcb.i93;
diff --git a/src/nfa/sys/nfa_sys_ptim.cc b/src/nfa/sys/nfa_sys_ptim.cc
index cc85f74..abcd608 100644
--- a/src/nfa/sys/nfa_sys_ptim.cc
+++ b/src/nfa/sys/nfa_sys_ptim.cc
@@ -85,10 +85,10 @@
   p_cb->last_gki_ticks = new_ticks_count;
 
   /* while there are expired timers */
-  while (!GKI_timer_list_empty(&p_cb->timer_queue) &&
-         (GKI_timer_list_first(&p_cb->timer_queue)->ticks <= 0)) {
+  while ((p_cb->timer_queue.p_first) &&
+         (p_cb->timer_queue.p_first->ticks <= 0)) {
     /* removed expired timer from list */
-    p_tle = GKI_timer_list_first(&p_cb->timer_queue);
+    p_tle = p_cb->timer_queue.p_first;
     DLOG_IF(INFO, nfc_debug_enabled)
         << StringPrintf("nfa_sys_ptim_timer_update expired: %p", p_tle);
     GKI_remove_from_timer_list(&p_cb->timer_queue, p_tle);
@@ -107,7 +107,7 @@
   }
 
   /* if timer list is empty stop periodic GKI timer */
-  if (GKI_timer_list_empty(&p_cb->timer_queue)) {
+  if (p_cb->timer_queue.p_first == nullptr) {
     DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("ptim timer stop");
     GKI_stop_timer(p_cb->timer_id);
   }
@@ -129,7 +129,7 @@
       << StringPrintf("nfa_sys_ptim_start_timer %p", p_tle);
 
   /* if timer list is currently empty, start periodic GKI timer */
-  if (GKI_timer_list_empty(&p_cb->timer_queue)) {
+  if (p_cb->timer_queue.p_first == nullptr) {
     DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("ptim timer start");
     p_cb->last_gki_ticks = GKI_get_tick_count();
     GKI_start_timer(p_cb->timer_id, GKI_MS_TO_TICKS(p_cb->period), true);
@@ -159,7 +159,7 @@
   GKI_remove_from_timer_list(&p_cb->timer_queue, p_tle);
 
   /* if timer list is empty stop periodic GKI timer */
-  if (GKI_timer_list_empty(&p_cb->timer_queue)) {
+  if (p_cb->timer_queue.p_first == nullptr) {
     DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("ptim timer stop");
     GKI_stop_timer(p_cb->timer_id);
   }
diff --git a/src/nfc/include/nfc_int.h b/src/nfc/include/nfc_int.h
index 5ecc879..f357965 100644
--- a/src/nfc/include/nfc_int.h
+++ b/src/nfc/include/nfc_int.h
@@ -199,8 +199,6 @@
   bool reassembly; /* Reassemble fragmented data pkt */
   uint8_t last_hdr[NFC_SAVED_HDR_SIZE]; /* part of last NCI command header */
   uint8_t last_cmd[NFC_SAVED_CMD_SIZE]; /* part of last NCI command payload */
-  uint8_t
-      last_nfcee_cmd[NFC_SAVED_CMD_SIZE]; /* part of last NCI command payload */
   void* p_vsc_cback;       /* the callback function for last VSC command */
   BUFFER_Q nci_cmd_xmit_q; /* NCI command queue */
   TIMER_LIST_ENT
diff --git a/src/nfc/llcp/llcp_link.cc b/src/nfc/llcp/llcp_link.cc
index 97a57e9..f87da82 100644
--- a/src/nfc/llcp/llcp_link.cc
+++ b/src/nfc/llcp/llcp_link.cc
@@ -1089,7 +1089,7 @@
 *******************************************************************************/
 static void llcp_link_proc_agf_pdu(NFC_HDR* p_agf) {
   uint16_t agf_length;
-  uint8_t *p, *p_info;
+  uint8_t *p, *p_info, *p_pdu_length;
   uint16_t pdu_hdr, pdu_length, pdu_num;
   uint8_t dsap, ptype, ssap;
 
@@ -1139,6 +1139,7 @@
 
   while (agf_length >= (LLCP_PDU_HEADER_SIZE + LLCP_PDU_AGF_LEN_SIZE)) {
     /* get length of PDU */
+    p_pdu_length = p;
     BE_STREAM_TO_UINT16(pdu_length, p);
     agf_length -= LLCP_PDU_AGF_LEN_SIZE;
 
diff --git a/src/nfc/nci/nci_hmsgs.cc b/src/nfc/nci/nci_hmsgs.cc
index ed7caaa..885ebaa 100644
--- a/src/nfc/nci/nci_hmsgs.cc
+++ b/src/nfc/nci/nci_hmsgs.cc
@@ -22,15 +22,13 @@
  *  commands (for DH).
  *
  ******************************************************************************/
-#include "nci_hmsgs.h"
-
 #include <string.h>
+#include "nfc_target.h"
 
-#include "include/debug_lmrt.h"
 #include "nci_defs.h"
+#include "nci_hmsgs.h"
 #include "nfc_api.h"
 #include "nfc_int.h"
-#include "nfc_target.h"
 
 /*******************************************************************************
 **
@@ -657,10 +655,6 @@
     UINT8_TO_STREAM(pp, num_tlv);
     ARRAY_TO_STREAM(pp, p_param_tlvs, tlv_size);
   }
-
-  uint8_t* lmrt_head_ptr = (uint8_t*)(p + 1) + p->offset;
-  lmrt_capture(lmrt_head_ptr, size + 3);
-
   nfc_ncif_send_cmd(p);
 
   return (NCI_STATUS_OK);
diff --git a/src/nfc/nci/nci_hrcv.cc b/src/nfc/nci/nci_hrcv.cc
index 34d8573..50a6297 100644
--- a/src/nfc/nci/nci_hrcv.cc
+++ b/src/nfc/nci/nci_hrcv.cc
@@ -168,14 +168,14 @@
 *******************************************************************************/
 void nci_proc_rf_management_rsp(NFC_HDR* p_msg) {
   uint8_t* p;
-  uint8_t *pp, op_code;
+  uint8_t *pp, len, op_code;
   uint8_t* p_old = nfc_cb.last_cmd;
 
   /* find the start of the NCI message and parse the NCI header */
   p = (uint8_t*)(p_msg + 1) + p_msg->offset;
   pp = p + 1;
   NCI_MSG_PRS_HDR1(pp, op_code);
-  pp++;  // len = *pp++;
+  len = *pp++;
 
   switch (op_code) {
     case NCI_MSG_RF_DISCOVER:
@@ -333,7 +333,7 @@
   tNFC_RESPONSE_CBACK* p_cback = nfc_cb.p_resp_cback;
   tNFC_RESPONSE nfc_response;
   tNFC_RESPONSE_EVT event = NFC_NFCEE_INFO_REVT;
-  uint8_t* p_old = nfc_cb.last_nfcee_cmd;
+  uint8_t* p_old = nfc_cb.last_cmd;
 
   /* find the start of the NCI message and parse the NCI header */
   p = (uint8_t*)(p_msg + 1) + p_msg->offset;
@@ -412,7 +412,7 @@
   tNFC_RESPONSE_CBACK* p_cback = nfc_cb.p_resp_cback;
   tNFC_RESPONSE nfc_response;
   tNFC_RESPONSE_EVT event = NFC_NFCEE_INFO_REVT;
-  uint8_t* p_old = nfc_cb.last_nfcee_cmd;
+  uint8_t* p_old = nfc_cb.last_cmd;
   uint8_t xx;
   uint8_t yy;
   tNFC_NFCEE_TLV* p_tlv;
@@ -529,14 +529,14 @@
 void nci_proc_prop_rsp(NFC_HDR* p_msg) {
   uint8_t* p;
   uint8_t* p_evt;
-  uint8_t *pp, op_code;
+  uint8_t *pp, len, op_code;
   tNFC_VS_CBACK* p_cback = (tNFC_VS_CBACK*)nfc_cb.p_vsc_cback;
 
   /* find the start of the NCI message and parse the NCI header */
   p = p_evt = (uint8_t*)(p_msg + 1) + p_msg->offset;
   pp = p + 1;
   NCI_MSG_PRS_HDR1(pp, op_code);
-  pp++;  // len = *pp++;
+  len = *pp++;
 
   /*If there's a pending/stored command, restore the associated address of the
    * callback function */
@@ -584,14 +584,14 @@
 void nci_proc_prop_ntf(NFC_HDR* p_msg) {
   uint8_t* p;
   uint8_t* p_evt;
-  uint8_t *pp, op_code;
+  uint8_t *pp, len, op_code;
   int i;
 
   /* find the start of the NCI message and parse the NCI header */
   p = p_evt = (uint8_t*)(p_msg + 1) + p_msg->offset;
   pp = p + 1;
   NCI_MSG_PRS_HDR1(pp, op_code);
-  pp++;  // len = *pp++;
+  len = *pp++;
 
   for (i = 0; i < NFC_NUM_VS_CBACKS; i++) {
     if (nfc_cb.p_vs_cb[i]) {
diff --git a/src/nfc/nfc/nfc_main.cc b/src/nfc/nfc/nfc_main.cc
index 747a1aa..a03fa7a 100644
--- a/src/nfc/nfc/nfc_main.cc
+++ b/src/nfc/nfc/nfc_main.cc
@@ -148,7 +148,7 @@
       return "HAL_NFC_RELEASE_CONTROL_EVT";
     case HAL_NFC_ERROR_EVT:
       return "HAL_NFC_ERROR_EVT";
-    case HAL_HCI_NETWORK_RESET:
+    case (uint32_t)NfcEvent::HCI_NETWORK_RESET:
       return "HCI_NETWORK_RESET";
     default:
       return "???? UNKNOWN EVENT";
@@ -526,7 +526,7 @@
           }
           break;
 
-        case HAL_HCI_NETWORK_RESET:
+        case (uint32_t)NfcEvent::HCI_NETWORK_RESET:
           delete_stack_non_volatile_store(true);
           break;
 
@@ -630,7 +630,7 @@
     case HAL_NFC_REQUEST_CONTROL_EVT:
     case HAL_NFC_RELEASE_CONTROL_EVT:
     case HAL_NFC_ERROR_EVT:
-    case HAL_HCI_NETWORK_RESET:
+    case (uint32_t)NfcEvent::HCI_NETWORK_RESET:
       nfc_main_post_hal_evt(event, status);
       break;
 
@@ -785,8 +785,6 @@
   nfc_cb.nci_ctrl_size = NCI_CTRL_INIT_SIZE;
   nfc_cb.reassembly = true;
   nfc_cb.nci_version = NCI_VERSION_UNKNOWN;
-  GKI_init_timer_list(&nfc_cb.timer_queue);
-  GKI_init_timer_list(&nfc_cb.quick_timer_queue);
   rw_init();
   ce_init();
   llcp_init();
diff --git a/src/nfc/nfc/nfc_ncif.cc b/src/nfc/nfc/nfc_ncif.cc
index 950bb2d..96d5556 100644
--- a/src/nfc/nfc/nfc_ncif.cc
+++ b/src/nfc/nfc/nfc_ncif.cc
@@ -282,11 +282,6 @@
       ps = (uint8_t*)(p_buf + 1) + p_buf->offset;
       memcpy(nfc_cb.last_hdr, ps, NFC_SAVED_HDR_SIZE);
       memcpy(nfc_cb.last_cmd, ps + NCI_MSG_HDR_SIZE, NFC_SAVED_CMD_SIZE);
-      // Check first byte to check if this is an NFCEE command
-      if (*ps == ((NCI_MT_CMD << NCI_MT_SHIFT) | NCI_GID_EE_MANAGE)) {
-        memcpy(nfc_cb.last_nfcee_cmd, ps + NCI_MSG_HDR_SIZE,
-               NFC_SAVED_CMD_SIZE);
-      }
       if (p_buf->layer_specific == NFC_WAIT_RSP_VSC) {
         /* save the callback for NCI VSCs)  */
         nfc_cb.p_vsc_cback = (void*)((tNFC_NCI_VS_MSG*)p_buf)->p_cback;
@@ -2056,7 +2051,7 @@
   LOG(ERROR) << StringPrintf("%s", __func__);
   tNFC_RESPONSE nfc_response;
   nfc_response.mode_set.status = NCI_STATUS_FAILED;
-  nfc_response.mode_set.nfcee_id = *nfc_cb.last_nfcee_cmd;
+  nfc_response.mode_set.nfcee_id = *nfc_cb.last_cmd;
   nfc_response.mode_set.mode = NCI_NFCEE_MD_DEACTIVATE;
 
   tNFC_RESPONSE_CBACK* p_cback = nfc_cb.p_resp_cback;
diff --git a/src/nfc/nfc/nfc_task.cc b/src/nfc/nfc/nfc_task.cc
index 5fe07ab..19bbb8c 100644
--- a/src/nfc/nfc/nfc_task.cc
+++ b/src/nfc/nfc/nfc_task.cc
@@ -45,8 +45,6 @@
 using android::base::StringPrintf;
 
 extern bool nfc_debug_enabled;
-extern bool nfc_nci_reset_keep_cfg_enabled;
-extern uint8_t nfc_nci_reset_type;
 
 /*******************************************************************************
 **
@@ -63,7 +61,7 @@
   NFC_HDR* p_msg;
 
   /* if timer list is currently empty, start periodic GKI timer */
-  if (GKI_timer_list_empty(&nfc_cb.timer_queue)) {
+  if (nfc_cb.timer_queue.p_first == nullptr) {
     /* if timer starts on other than NFC task (scritp wrapper) */
     if (GKI_get_taskid() != NFC_TASK) {
       /* post event to start timer in NFC task */
@@ -113,9 +111,8 @@
 
   GKI_update_timer_list(&nfc_cb.timer_queue, 1);
 
-  while (!GKI_timer_list_empty(&nfc_cb.timer_queue) &&
-         !GKI_timer_list_first(&nfc_cb.timer_queue)->ticks) {
-    p_tle = GKI_timer_list_first(&nfc_cb.timer_queue);
+  while ((nfc_cb.timer_queue.p_first) && (!nfc_cb.timer_queue.p_first->ticks)) {
+    p_tle = nfc_cb.timer_queue.p_first;
     GKI_remove_from_timer_list(&nfc_cb.timer_queue, p_tle);
 
     switch (p_tle->event) {
@@ -140,7 +137,7 @@
   }
 
   /* if timer list is empty stop periodic GKI timer */
-  if (GKI_timer_list_empty(&nfc_cb.timer_queue)) {
+  if (nfc_cb.timer_queue.p_first == nullptr) {
     GKI_stop_timer(NFC_TIMER_ID);
   }
 }
@@ -158,7 +155,7 @@
   GKI_remove_from_timer_list(&nfc_cb.timer_queue, p_tle);
 
   /* if timer list is empty stop periodic GKI timer */
-  if (GKI_timer_list_empty(&nfc_cb.timer_queue)) {
+  if (nfc_cb.timer_queue.p_first == nullptr) {
     GKI_stop_timer(NFC_TIMER_ID);
   }
 }
@@ -181,7 +178,7 @@
   NFC_HDR* p_msg;
 
   /* if timer list is currently empty, start periodic GKI timer */
-  if (GKI_timer_list_empty(&nfc_cb.quick_timer_queue)) {
+  if (nfc_cb.quick_timer_queue.p_first == nullptr) {
     /* if timer starts on other than NFC task (scritp wrapper) */
     if (GKI_get_taskid() != NFC_TASK) {
       /* post event to start timer in NFC task */
@@ -219,7 +216,7 @@
   GKI_remove_from_timer_list(&nfc_cb.quick_timer_queue, p_tle);
 
   /* if timer list is empty stop periodic GKI timer */
-  if (GKI_timer_list_empty(&nfc_cb.quick_timer_queue)) {
+  if (nfc_cb.quick_timer_queue.p_first == nullptr) {
     GKI_stop_timer(NFC_QUICK_TIMER_ID);
   }
 }
@@ -238,10 +235,9 @@
 
   GKI_update_timer_list(&nfc_cb.quick_timer_queue, 1);
 
-  while (!GKI_timer_list_empty(&nfc_cb.quick_timer_queue) &&
-         (!GKI_timer_list_first(&nfc_cb.quick_timer_queue)->ticks)) {
-    p_tle = GKI_timer_list_first(&nfc_cb.quick_timer_queue);
-
+  while ((nfc_cb.quick_timer_queue.p_first) &&
+         (!nfc_cb.quick_timer_queue.p_first->ticks)) {
+    p_tle = nfc_cb.quick_timer_queue.p_first;
     GKI_remove_from_timer_list(&nfc_cb.quick_timer_queue, p_tle);
 
     switch (p_tle->event) {
@@ -292,7 +288,7 @@
   }
 
   /* if timer list is empty stop periodic GKI timer */
-  if (GKI_timer_list_empty(&nfc_cb.quick_timer_queue)) {
+  if (nfc_cb.quick_timer_queue.p_first == nullptr) {
     GKI_stop_timer(NFC_QUICK_TIMER_ID);
   }
 }
@@ -368,22 +364,7 @@
 
       /* Reset the NFC controller. */
       nfc_set_state(NFC_STATE_CORE_INIT);
-
-      /* Reset NCI configurations base on NAME_NCI_RESET_TYPE setting */
-      if (nfc_nci_reset_type == 0x02) {
-        /* 0x02, keep configurations. */
-        nci_snd_core_reset(NCI_RESET_TYPE_KEEP_CFG);
-        nfc_nci_reset_keep_cfg_enabled = true;
-      } else if (nfc_nci_reset_type == 0x01 &&
-                 !nfc_nci_reset_keep_cfg_enabled) {
-        /* 0x01, reset configurations only once every boot. */
-        nci_snd_core_reset(NCI_RESET_TYPE_KEEP_CFG);
-        nfc_nci_reset_keep_cfg_enabled = true;
-      } else {
-        /* Default, reset configurations every time*/
-        nci_snd_core_reset(NCI_RESET_TYPE_RESET_CFG);
-        nfc_nci_reset_keep_cfg_enabled = false;
-      }
+      nci_snd_core_reset(NCI_RESET_TYPE_RESET_CFG);
     }
 
     if (event & NFC_MBOX_EVT_MASK) {
diff --git a/src/nfc/tags/rw_i93.cc b/src/nfc/tags/rw_i93.cc
index 2b246e8..5bf9afc 100644
--- a/src/nfc/tags/rw_i93.cc
+++ b/src/nfc/tags/rw_i93.cc
@@ -1776,7 +1776,7 @@
     num_blocks = RW_I93_GET_MULTI_BLOCK_SEC_SIZE;
 
   DLOG_IF(INFO, nfc_debug_enabled)
-      << StringPrintf("%s intl_flags=%d", __func__, rw_cb.tcb.i93.intl_flags);
+      << __func__ << std::hex << rw_cb.tcb.i93.intl_flags;
   return rw_i93_send_cmd_get_multi_block_sec(p_i93->rw_offset, num_blocks);
 }
 
@@ -2287,9 +2287,6 @@
 
     if (p_resp->len > 0) {
       (*(rw_cb.p_cback))(RW_I93_NDEF_READ_EVT, &rw_data);
-    } else {
-       // free buffer, if len == 0
-       GKI_freebuf(p_resp);
     }
 
     /* this will make read data from next block */
diff --git a/src/nfc/tags/rw_mfc.cc b/src/nfc/tags/rw_mfc.cc
index ed4fda1..649f333 100644
--- a/src/nfc/tags/rw_mfc.cc
+++ b/src/nfc/tags/rw_mfc.cc
@@ -130,9 +130,9 @@
   tNFC_STATUS status = NFC_STATUS_OK;
 
   if (p_mfc->state != RW_MFC_STATE_IDLE) {
-    LOG(ERROR) << StringPrintf(
-        "%s Mifare Classic tag not activated or Busy - State:%d", __func__,
-        p_mfc->state);
+    LOG(ERROR) << __func__
+               << " Mifare Classic tag not activated or Busy - State:"
+               << p_mfc->state;
     return NFC_STATUS_BUSY;
   }
 
@@ -643,8 +643,7 @@
       << StringPrintf("%s conn_id=%i, evt=0x%x", __func__, conn_id, event);
   /* Only handle static conn_id */
   if (conn_id != NFC_RF_CONN_ID) {
-    LOG(ERROR) << StringPrintf("%s Not static connection id =%d", __func__,
-                               conn_id);
+    LOG(ERROR) << __func__ << " Not static connection id =" << conn_id;
     return;
   }
 
@@ -695,9 +694,7 @@
   }
 
   if ((p_mfc->state != RW_MFC_STATE_IDLE) && (mfc_data == NULL)) {
-    if (p_mfc->state != RW_MFC_STATE_NOT_ACTIVATED) {
-      LOG(ERROR) << StringPrintf("%s NULL pointer", __func__);
-    }
+    LOG(ERROR) << StringPrintf("%s NULL pointer", __func__);
     return;
   }
 
@@ -737,8 +734,7 @@
       GKI_freebuf(mfc_data);
       break;
     default:
-      LOG(ERROR) << StringPrintf("%s : invalid state=%d", __func__,
-                                 p_mfc->state);
+      LOG(ERROR) << __func__ << ": invalid state=" << p_mfc->state;
       break;
   }
 }
@@ -763,10 +759,9 @@
   tNFC_STATUS success = NFC_STATUS_OK;
 
   if (p_mfc->state != RW_MFC_STATE_IDLE) {
-    LOG(ERROR) << StringPrintf(
-        "%s Mifare Classic tag not activated or Busy - State:%d", __func__,
-        p_mfc->state);
-
+    LOG(ERROR) << __func__
+               << " Mifare Classic tag not activated or Busy - State:"
+               << p_mfc->state;
     return NFC_STATUS_BUSY;
   }
 
@@ -790,12 +785,12 @@
   success = rw_mfc_readBlock(p_mfc->next_block.block);
   if (success == NFC_STATUS_OK) {
     p_mfc->state = RW_MFC_STATE_DETECT_TLV;
-    DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
-        "%s RW_MFC_STATE_DETECT_TLV state=%d", __func__, p_mfc->state);
+    DLOG_IF(INFO, nfc_debug_enabled)
+        << __func__ << " RW_MFC_STATE_DETECT_TLV state=" << p_mfc->state;
   } else {
     p_mfc->substate = RW_MFC_SUBSTATE_NONE;
     DLOG_IF(INFO, nfc_debug_enabled)
-        << StringPrintf("%s rw_MfcLocateTlv state=%d", __func__, p_mfc->state);
+        << __func__ << " rw_MfcLocateTlv state=" << p_mfc->state;
   }
 
   return NFC_STATUS_OK;
@@ -947,8 +942,7 @@
       } else {
         p_mfc->next_block.auth = false;
         p_mfc->last_block_accessed.auth = false;
-        DLOG_IF(INFO, nfc_debug_enabled)
-            << StringPrintf("%s : status=%d", __func__, p[0]);
+        DLOG_IF(INFO, nfc_debug_enabled) << __func__ << ": status=" << p[0];
         nfc_stop_quick_timer(&p_mfc->timer);
         rw_mfc_process_error();
       }
@@ -977,19 +971,20 @@
  *******************************************************************************/
 static void rw_mfc_resume_op() {
   tRW_MFC_CB* p_mfc = &rw_cb.tcb.mfc;
+  bool status = true;
 
   switch (p_mfc->state) {
     case RW_MFC_STATE_DETECT_TLV:
-      rw_mfc_readBlock(p_mfc->next_block.block);
+      status = rw_mfc_readBlock(p_mfc->next_block.block);
       break;
     case RW_MFC_STATE_READ_NDEF:
-      rw_mfc_readBlock(p_mfc->next_block.block);
+      status = rw_mfc_readBlock(p_mfc->next_block.block);
       break;
     case RW_MFC_STATE_NDEF_FORMAT:
-      rw_mfc_formatBlock(p_mfc->next_block.block);
+      status = rw_mfc_formatBlock(p_mfc->next_block.block);
       break;
     case RW_MFC_STATE_UPDATE_NDEF:
-      rw_mfc_writeBlock(p_mfc->next_block.block);
+      status = rw_mfc_writeBlock(p_mfc->next_block.block);
       break;
   }
 }
@@ -1203,9 +1198,9 @@
   tNFC_STATUS status = NFC_STATUS_OK;
 
   if (p_mfc->state != RW_MFC_STATE_IDLE) {
-    LOG(ERROR) << StringPrintf(
-        "%s Mifare Classic tag not activated or Busy - State=%d", __func__,
-        p_mfc->state);
+    LOG(ERROR) << __func__
+               << " Mifare Classic tag not activated or Busy - State="
+               << p_mfc->state;
     return NFC_STATUS_FAILED;
   }
 
@@ -1356,9 +1351,7 @@
   tRW_MFC_CB* p_mfc = &rw_cb.tcb.mfc;
   tRW_DETECT_NDEF_DATA ndef_data;
 
-  DLOG_IF(INFO, nfc_debug_enabled)
-      << StringPrintf("%s State=%d", __func__, p_mfc->state);
-
+  DLOG_IF(INFO, nfc_debug_enabled) << __func__ << " State=" << p_mfc->state;
   evt_data.status = NFC_STATUS_FAILED;
 
   /* Retry sending command if retry-count < max */
@@ -1409,7 +1402,7 @@
     ndef_data.max_size = 0;
     ndef_data.cur_size = 0;
     DLOG_IF(INFO, nfc_debug_enabled)
-        << StringPrintf("%s status=%d", __func__, evt_data.status);
+        << __func__ << " status=" << evt_data.status;
     /* If not Halt move to idle state */
     rw_mfc_handle_op_complete();
 
@@ -1422,7 +1415,7 @@
     }
 
     DLOG_IF(INFO, nfc_debug_enabled)
-        << StringPrintf("%s status=%d", __func__, evt_data.status);
+        << __func__ << " status=" << evt_data.status;
     p_mfc->substate = RW_MFC_SUBSTATE_NONE;
     (*rw_cb.p_cback)(rw_event, (tRW_DATA*)&evt_data);
   }
diff --git a/src/nfc/tags/rw_t2t_ndef.cc b/src/nfc/tags/rw_t2t_ndef.cc
index 74453fd..1297815 100644
--- a/src/nfc/tags/rw_t2t_ndef.cc
+++ b/src/nfc/tags/rw_t2t_ndef.cc
@@ -402,6 +402,7 @@
   uint16_t len = 0;
   bool failed = false;
   bool found = false;
+  tRW_EVENT event;
   uint8_t index;
   uint16_t count = 0;
   uint8_t xx;
@@ -723,7 +724,7 @@
 
   p_t2t->work_offset += T2T_READ_DATA_LEN;
 
-  rw_t2t_info_to_event(p_cmd_rsp_info);
+  event = rw_t2t_info_to_event(p_cmd_rsp_info);
 
   /* If not found and not failed, read next block and search tlv */
   if (!found && !failed) {
@@ -1727,6 +1728,7 @@
   bool b_notify = false;
   uint8_t write_block[T2T_BLOCK_SIZE];
   bool b_pending = false;
+  uint8_t read_lock = 0;
   uint8_t num_locks = 0;
   uint16_t offset;
 
@@ -1788,6 +1790,7 @@
                * overwrite possible NDEF or Reserved data
                */
               b_pending = true;
+              read_lock = num_locks;
             } else {
               /* Write zero in internal byte */
               memset(write_block, 0, T2T_BLOCK_SIZE);
diff --git a/src/rust/Android.bp b/src/rust/Android.bp
deleted file mode 100644
index 4c0032f..0000000
--- a/src/rust/Android.bp
+++ /dev/null
@@ -1,107 +0,0 @@
-package {
-    // See: http://go/android-license-faq
-    // A large-scale-change added 'default_applicable_licenses' to import
-    // all of the 'license_kinds' from "system_nfc_license"
-    // to get the below license kinds:
-    //   SPDX-license-identifier-Apache-2.0
-    default_applicable_licenses: ["system_nfc_license"],
-}
-
-rust_defaults {
-    name: "nfc_rust_defaults",
-    target: {
-        darwin: {
-            enabled: false,
-        },
-    },
-    host_supported: true,
-}
-
-cc_defaults {
-    name: "nfc_ffi_defaults",
-    target: {
-        darwin: {
-            enabled: false,
-        },
-    },
-}
-
-rust_library {
-    name: "libnfc_rnci",
-    defaults: ["nfc_rust_defaults"],
-    crate_name: "nfc_rnci",
-    srcs: ["nci/nci.rs"],
-    host_supported: true,
-    rustlibs: [
-        "libnfc_packets",
-        "libbytes",
-        "libnfc_hal",
-        "libtokio",
-        "libcxx",
-        "liblazy_static",
-        "liblog_rust",
-    ],
-    proc_macros: ["libnum_derive"],
-}
-
-rust_library {
-    name: "libnfc_hal",
-    defaults: ["nfc_rust_defaults"],
-    crate_name: "nfc_hal",
-    srcs: ["hal/hal.rs"],
-    host_supported: true,
-    rustlibs: [
-        "libnfc_packets",
-        "libbytes",
-        "libthiserror",
-        "libtokio",
-        "libcxx",
-        "liblazy_static",
-        "liblog_rust",
-    ],
-    proc_macros: ["libnum_derive"],
-    target: {
-        android: {
-                whole_static_libs: ["libnfc_hidl_hal_cxx"],
-                shared_libs: [
-                    "android.hardware.nfc@1.0",
-                    "android.hardware.nfc@1.1",
-                    "android.hardware.nfc@1.2",
-                    "libhidlbase",
-                    "libutils",
-                ],
-        },
-    },
-}
-
-genrule {
-    name: "libnfc_hidl_hal_bridge_header",
-    tools: ["cxxbridge"],
-    cmd: "$(location cxxbridge) $(in) --header > $(out)",
-    srcs: ["hal/hidl_hal.rs"],
-    out: ["hal/hidl_hal.rs.h"],
-}
-
-genrule {
-    name: "libnfc_hidl_hal_bridge_code",
-    tools: ["cxxbridge"],
-    cmd: "$(location cxxbridge) $(in) >> $(out)",
-    srcs: ["hal/hidl_hal.rs"],
-    out: ["hidl_hal_generated.cc"],
-}
-
-cc_library_static {
-    name: "libnfc_hidl_hal_cxx",
-    defaults: ["nfc_ffi_defaults"],
-    srcs: ["hal/ffi/hidl.cc"],
-    local_include_dirs: ["hal/ffi"],
-    generated_headers: ["libnfc_hidl_hal_bridge_header", "cxx-bridge-header"],
-    generated_sources: ["libnfc_hidl_hal_bridge_code"],
-    shared_libs: [
-        "android.hardware.nfc@1.0",
-        "android.hardware.nfc@1.1",
-        "android.hardware.nfc@1.2",
-        "libhidlbase",
-        "libutils",
-    ],
-}
diff --git a/src/rust/hal/ffi/hidl.cc b/src/rust/hal/ffi/hidl.cc
deleted file mode 100644
index fb3b5b3..0000000
--- a/src/rust/hal/ffi/hidl.cc
+++ /dev/null
@@ -1,115 +0,0 @@
-#include "hal/ffi/hidl.h"
-
-#include <log/log.h>
-#include <stdlib.h>
-
-using ::android::wp;
-using ::android::hardware::hidl_death_recipient;
-using ::android::hidl::base::V1_0::IBase;
-
-using android::OK;
-using android::sp;
-using android::status_t;
-
-using ::android::hardware::hidl_vec;
-using ::android::hardware::Return;
-using ::android::hardware::Void;
-using android::hardware::nfc::V1_0::INfc;
-using INfcV1_1 = android::hardware::nfc::V1_1::INfc;
-using INfcV1_2 = android::hardware::nfc::V1_2::INfc;
-using android::hardware::nfc::V1_1::INfcClientCallback;
-
-namespace nfc {
-namespace hal {
-namespace {
-
-class NfcHalDeathRecipient : public hidl_death_recipient {
- public:
-  virtual void serviceDied(
-      uint64_t /*cookie*/,
-      const android::wp<::android::hidl::base::V1_0::IBase>& /*who*/) {
-    LOG_FATAL("Nfc HAL service died!");
-    abort();
-  }
-};
-
-class NfcCallbackTrampoline : public INfcClientCallback {
- public:
-  NfcCallbackTrampoline() {}
-
-  Return<void> sendEvent_1_1(
-      ::android::hardware::nfc::V1_1::NfcEvent event,
-      ::android::hardware::nfc::V1_0::NfcStatus event_status) override {
-    on_event(event, event_status);
-    return Void();
-  }
-  Return<void> sendEvent(
-      ::android::hardware::nfc::V1_0::NfcEvent event,
-      ::android::hardware::nfc::V1_0::NfcStatus event_status) override {
-    on_event((::android::hardware::nfc::V1_1::NfcEvent)event, event_status);
-    return Void();
-  }
-
-  Return<void> sendData(const ::android::hardware::nfc::V1_0::NfcData& data) {
-    on_data(rust::Slice(&data[0], data.size()));
-    return Void();
-  }
-};
-
-android::sp<NfcHalDeathRecipient> nfc_death_recipient_;
-android::sp<INfc> nci_;
-android::sp<INfcV1_1> nci_1_1_;
-android::sp<INfcV1_2> nci_1_2_;
-android::sp<NfcCallbackTrampoline> trampoline_;
-
-}  // namespace
-
-void start_hal() {
-  ALOG_ASSERT(nci_ != nullptr, "Stale value of the NCI port");
-
-  nci_ = nci_1_1_ = nci_1_2_ = INfcV1_2::getService();
-  if (nci_1_2_ == nullptr) {
-    nci_ = nci_1_1_ = INfcV1_1::getService();
-    if (nci_1_1_ == nullptr) {
-      nci_ = INfc::getService();
-    }
-  }
-  LOG_FATAL_IF(nci_ == nullptr, "Failed to retrieve the NFC HAL!");
-  ALOGI("%s: INfc::getService() returned %p (%s)", __func__, nci_.get(),
-        (nci_->isRemote() ? "remote" : "local"));
-  if (nci_) {
-    nfc_death_recipient_ = new NfcHalDeathRecipient();
-    auto death_link = nci_->linkToDeath(nfc_death_recipient_, 0);
-    ALOG_ASSERT(death_link.isOk(),
-                "Unable to set the death recipient for the Nfc HAL");
-  }
-
-  trampoline_ = new NfcCallbackTrampoline();
-  if (nci_1_1_ != nullptr) {
-    nci_1_1_->open_1_1(trampoline_);
-  } else {
-    nci_->open(trampoline_);
-  }
-}
-
-void stop_hal() {
-  ALOG_ASSERT(nci_ == nullptr, "The NCI communication was already closed");
-
-  auto death_unlink = nci_->unlinkToDeath(nfc_death_recipient_);
-  if (!death_unlink.isOk()) {
-    ALOGE("Error unlinking death recipient from the Bluetooth HAL");
-  }
-  nci_->close();
-  nci_ = nullptr;
-  nci_1_1_ = nullptr;
-  nci_1_2_ = nullptr;
-  trampoline_ = nullptr;
-}
-
-void send_command(rust::Slice<const uint8_t> data) {
-  ALOG_ASSERT(nci_ == nullptr, "The NCI communication was already closed");
-  nci_->write(hidl_vec<uint8_t>(data.data(), data.data() + data.length()));
-}
-
-}  // namespace hal
-}  // namespace nfc
diff --git a/src/rust/hal/ffi/hidl.h b/src/rust/hal/ffi/hidl.h
deleted file mode 100644
index b4b7761..0000000
--- a/src/rust/hal/ffi/hidl.h
+++ /dev/null
@@ -1,25 +0,0 @@
-#pragma once
-#include <android/hardware/nfc/1.0/INfc.h>
-#include <android/hardware/nfc/1.1/INfc.h>
-#include <android/hardware/nfc/1.2/INfc.h>
-
-namespace nfc {
-namespace hal {
-
-using android::hardware::nfc::V1_0::NfcStatus;
-using android::hardware::nfc::V1_1::NfcEvent;
-
-}  // namespace hal
-}  // namespace nfc
-
-#include "hal/hidl_hal.rs.h"
-
-namespace nfc {
-namespace hal {
-
-void start_hal();
-void stop_hal();
-void send_command(rust::Slice<const uint8_t> data);
-
-}  // namespace hal
-}  // namespace nfc
diff --git a/src/rust/hal/hal.rs b/src/rust/hal/hal.rs
deleted file mode 100644
index fd4ae32..0000000
--- a/src/rust/hal/hal.rs
+++ /dev/null
@@ -1,146 +0,0 @@
-// 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.
-
-//! NCI Hardware Abstraction Layer
-//! Supports sending NCI commands to the HAL and receiving
-//! NCI events from the HAL
-
-use nfc_packets::nci::{DataPacket, NciPacket};
-use std::collections::HashMap;
-use std::sync::Arc;
-use thiserror::Error;
-use tokio::sync::mpsc::{UnboundedReceiver, UnboundedSender};
-use tokio::sync::{oneshot, Mutex};
-
-#[cfg(target_os = "android")]
-#[path = "hidl_hal.rs"]
-pub mod ihal;
-
-#[cfg(not(target_os = "android"))]
-#[path = "rootcanal_hal.rs"]
-pub mod ihal;
-
-/// HAL module interface
-pub struct Hal {
-    /// HAL events
-    pub hal_events: HalEventRegistry,
-    /// HAL outbound channel for Command messages
-    pub out_cmd_tx: UnboundedSender<NciPacket>,
-    /// HAL inbound channel for Response and Notification messages
-    pub in_cmd_rx: UnboundedReceiver<NciPacket>,
-    /// HAL outbound channel for Data messages
-    pub out_data_tx: UnboundedSender<DataPacket>,
-    /// HAL inbound channel for Data messages
-    pub in_data_rx: UnboundedReceiver<DataPacket>,
-}
-
-/// Initialize the module and connect the channels
-pub async fn init() -> Hal {
-    ihal::init().await
-}
-
-/// NFC HAL specific events
-#[derive(Debug, Hash, Eq, PartialEq, Clone, Copy)]
-pub enum HalEvent {
-    /// HAL CLOSE_CPLT event
-    CloseComplete,
-}
-
-/// Status of a NFC HAL event
-#[derive(Debug)]
-pub enum HalEventStatus {
-    /// HAL OK status
-    Success,
-    /// HAL FAILED status
-    Failed,
-    /// HAL ERR_TRANSPORT status
-    TransportError,
-    /// HAL ERR_CMD_TIMEOUT status
-    Timeout,
-    /// HAL REFUSED status
-    Refused,
-}
-
-/// Provides ability to register and unregister for HAL event notifications
-#[derive(Clone)]
-pub struct HalEventRegistry {
-    handlers: Arc<Mutex<HashMap<HalEvent, oneshot::Sender<HalEventStatus>>>>,
-}
-
-impl HalEventRegistry {
-    /// Indicate interest in specific HAL event
-    pub async fn register(&mut self, event: HalEvent, sender: oneshot::Sender<HalEventStatus>) {
-        assert!(
-            self.handlers.lock().await.insert(event, sender).is_none(),
-            "A handler for {:?} is already registered",
-            event
-        );
-    }
-
-    /// Remove interest in specific HAL event
-    pub async fn unregister(&mut self, event: HalEvent) -> Option<oneshot::Sender<HalEventStatus>> {
-        self.handlers.lock().await.remove(&event)
-    }
-}
-
-mod internal {
-    use crate::{Hal, HalEventRegistry};
-    use nfc_packets::nci::{DataPacket, NciPacket};
-    use std::collections::HashMap;
-    use std::sync::Arc;
-    use tokio::sync::mpsc::{unbounded_channel, UnboundedReceiver, UnboundedSender};
-    use tokio::sync::Mutex;
-
-    pub struct InnerHal {
-        pub out_cmd_rx: UnboundedReceiver<NciPacket>,
-        pub in_cmd_tx: UnboundedSender<NciPacket>,
-        pub out_data_rx: UnboundedReceiver<DataPacket>,
-        pub in_data_tx: UnboundedSender<DataPacket>,
-    }
-
-    impl InnerHal {
-        pub fn new() -> (Hal, Self) {
-            let (out_cmd_tx, out_cmd_rx) = unbounded_channel();
-            let (in_cmd_tx, in_cmd_rx) = unbounded_channel();
-            let (out_data_tx, out_data_rx) = unbounded_channel();
-            let (in_data_tx, in_data_rx) = unbounded_channel();
-            let handlers = Arc::new(Mutex::new(HashMap::new()));
-            let hal_events = HalEventRegistry { handlers };
-            (
-                Hal { hal_events, out_cmd_tx, in_cmd_rx, out_data_tx, in_data_rx },
-                Self { out_cmd_rx, in_cmd_tx, out_data_rx, in_data_tx },
-            )
-        }
-    }
-}
-
-/// Is this NCI control stream or data response
-pub fn is_control_packet(data: &[u8]) -> bool {
-    // Check the MT bits
-    (data[0] >> 5) & 0x7 != 0
-}
-
-/// Result type
-type Result<T> = std::result::Result<T, Box<dyn std::error::Error + Send + Sync>>;
-
-/// Errors that can be encountered while dealing with the HAL
-#[derive(Error, Debug)]
-pub enum HalError {
-    /// Invalid rootcanal host error
-    #[error("Invalid rootcanal host")]
-    InvalidAddressError,
-    /// Error while connecting to rootcanal
-    #[error("Connection to rootcanal failed: {0}")]
-    RootcanalConnectError(#[from] tokio::io::Error),
-}
diff --git a/src/rust/hal/hidl_hal.rs b/src/rust/hal/hidl_hal.rs
deleted file mode 100644
index 91e67ef..0000000
--- a/src/rust/hal/hidl_hal.rs
+++ /dev/null
@@ -1,174 +0,0 @@
-// 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.
-
-//! Implementation of the HAl that talks to NFC controller over Android's HIDL
-use crate::internal::InnerHal;
-#[allow(unused)]
-use crate::{is_control_packet, Hal, HalEvent, HalEventRegistry, HalEventStatus, Result};
-use lazy_static::lazy_static;
-use log::{debug, error};
-use nfc_packets::nci::{DataPacket, NciPacket, Packet};
-use std::sync::Mutex;
-use tokio::select;
-use tokio::sync::mpsc::{UnboundedReceiver, UnboundedSender};
-use tokio::sync::oneshot;
-
-/// Initialize the module
-pub async fn init() -> Hal {
-    let (raw_hal, inner_hal) = InnerHal::new();
-    let (hal_open_evt_tx, hal_open_evt_rx) = oneshot::channel::<ffi::NfcStatus>();
-    let (hal_close_evt_tx, hal_close_evt_rx) = oneshot::channel::<ffi::NfcStatus>();
-    *CALLBACKS.lock().unwrap() = Some(Callbacks {
-        hal_open_evt_tx: Some(hal_open_evt_tx),
-        hal_close_evt_tx: Some(hal_close_evt_tx),
-        in_cmd_tx: inner_hal.in_cmd_tx,
-        in_data_tx: inner_hal.in_data_tx,
-    });
-    ffi::start_hal();
-    hal_open_evt_rx.await.unwrap();
-
-    tokio::spawn(dispatch_outgoing(
-        raw_hal.hal_events.clone(),
-        inner_hal.out_cmd_rx,
-        inner_hal.out_data_rx,
-        hal_close_evt_rx,
-    ));
-
-    raw_hal
-}
-
-#[cxx::bridge(namespace = nfc::hal)]
-// TODO Either use or remove these functions, this shouldn't be the long term state
-#[allow(dead_code)]
-mod ffi {
-
-    #[repr(u32)]
-    #[derive(Debug)]
-    enum NfcEvent {
-        OPEN_CPLT = 0,
-        CLOSE_CPLT = 1,
-        POST_INIT_CPLT = 2,
-        PRE_DISCOVER_CPLT = 3,
-        REQUEST_CONTROL = 4,
-        RELEASE_CONTROL = 5,
-        ERROR = 6,
-        HCI_NETWORK_RESET = 7,
-    }
-
-    #[repr(u32)]
-    #[derive(Debug)]
-    enum NfcStatus {
-        OK = 0,
-        FAILED = 1,
-        ERR_TRANSPORT = 2,
-        ERR_CMD_TIMEOUT = 3,
-        REFUSED = 4,
-    }
-
-    unsafe extern "C++" {
-        include!("hal/ffi/hidl.h");
-        fn start_hal();
-        fn stop_hal();
-        fn send_command(data: &[u8]);
-
-        #[namespace = "android::hardware::nfc::V1_1"]
-        type NfcEvent;
-
-        #[namespace = "android::hardware::nfc::V1_0"]
-        type NfcStatus;
-    }
-
-    extern "Rust" {
-        fn on_event(evt: NfcEvent, status: NfcStatus);
-        fn on_data(data: &[u8]);
-    }
-}
-
-impl From<ffi::NfcStatus> for HalEventStatus {
-    fn from(ffi_nfc_status: ffi::NfcStatus) -> Self {
-        match ffi_nfc_status {
-            ffi::NfcStatus::OK => HalEventStatus::Success,
-            ffi::NfcStatus::FAILED => HalEventStatus::Failed,
-            ffi::NfcStatus::ERR_TRANSPORT => HalEventStatus::TransportError,
-            ffi::NfcStatus::ERR_CMD_TIMEOUT => HalEventStatus::Timeout,
-            ffi::NfcStatus::REFUSED => HalEventStatus::Refused,
-            _ => HalEventStatus::Failed,
-        }
-    }
-}
-
-struct Callbacks {
-    hal_open_evt_tx: Option<oneshot::Sender<ffi::NfcStatus>>,
-    hal_close_evt_tx: Option<oneshot::Sender<ffi::NfcStatus>>,
-    in_cmd_tx: UnboundedSender<NciPacket>,
-    in_data_tx: UnboundedSender<DataPacket>,
-}
-
-lazy_static! {
-    static ref CALLBACKS: Mutex<Option<Callbacks>> = Mutex::new(None);
-}
-
-fn on_event(evt: ffi::NfcEvent, status: ffi::NfcStatus) {
-    debug!("got event: {:?} with status {:?}", evt, status);
-    let mut callbacks = CALLBACKS.lock().unwrap();
-    match evt {
-        ffi::NfcEvent::OPEN_CPLT => {
-            if let Some(evt_tx) = callbacks.as_mut().unwrap().hal_open_evt_tx.take() {
-                evt_tx.send(status).unwrap();
-            }
-        }
-        ffi::NfcEvent::CLOSE_CPLT => {
-            if let Some(evt_tx) = callbacks.as_mut().unwrap().hal_close_evt_tx.take() {
-                evt_tx.send(status).unwrap();
-            }
-        }
-        _ => error!("Unhandled HAL event {:?}", evt),
-    }
-}
-
-fn on_data(data: &[u8]) {
-    debug!("got packet: {:02x?}", data);
-    let callbacks = CALLBACKS.lock().unwrap();
-    if is_control_packet(data) {
-        match NciPacket::parse(data) {
-            Ok(p) => callbacks.as_ref().unwrap().in_cmd_tx.send(p).unwrap(),
-            Err(e) => error!("failure to parse response: {:?} data: {:02x?}", e, data),
-        }
-    } else {
-        match DataPacket::parse(data) {
-            Ok(p) => callbacks.as_ref().unwrap().in_data_tx.send(p).unwrap(),
-            Err(e) => error!("failure to parse response: {:?} data: {:02x?}", e, data),
-        }
-    }
-}
-
-async fn dispatch_outgoing(
-    mut hal_events: HalEventRegistry,
-    mut out_cmd_rx: UnboundedReceiver<NciPacket>,
-    mut out_data_rx: UnboundedReceiver<DataPacket>,
-    hal_close_evt_rx: oneshot::Receiver<ffi::NfcStatus>,
-) {
-    loop {
-        select! {
-            Some(cmd) = out_cmd_rx.recv() => ffi::send_command(&cmd.to_bytes()),
-            Some(data) = out_data_rx.recv() => ffi::send_command(&data.to_bytes()),
-            else => break,
-        }
-    }
-    ffi::stop_hal();
-    let status = hal_close_evt_rx.await.unwrap();
-    if let Some(evt) = hal_events.unregister(HalEvent::CloseComplete).await {
-        evt.send(HalEventStatus::from(status)).unwrap();
-    }
-}
diff --git a/src/rust/hal/rootcanal_hal.rs b/src/rust/hal/rootcanal_hal.rs
deleted file mode 100644
index b52154d..0000000
--- a/src/rust/hal/rootcanal_hal.rs
+++ /dev/null
@@ -1,128 +0,0 @@
-// 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.
-
-//! Rootcanal HAL
-//! This connects to "rootcanal" which provides a simulated
-//! Nfc chip as well as a simulated environment.
-
-use crate::internal::InnerHal;
-use crate::{is_control_packet, Hal, HalEvent, HalEventRegistry, HalEventStatus, Result};
-use bytes::{BufMut, BytesMut};
-use log::{debug, error};
-use nfc_packets::nci::{DataPacket, NciPacket, Packet};
-use std::convert::TryInto;
-use tokio::io::{AsyncReadExt, AsyncWriteExt, BufReader};
-use tokio::net::TcpStream;
-use tokio::select;
-use tokio::sync::mpsc::{UnboundedReceiver, UnboundedSender};
-
-/// Initialize the module
-pub async fn init() -> Hal {
-    let (raw_hal, inner_hal) = InnerHal::new();
-    let (reader, writer) = TcpStream::connect("127.0.0.1:54323")
-        .await
-        .expect("unable to create stream to rootcanal")
-        .into_split();
-
-    let reader = BufReader::new(reader);
-    tokio::spawn(dispatch_incoming(inner_hal.in_cmd_tx, inner_hal.in_data_tx, reader));
-    tokio::spawn(dispatch_outgoing(
-        raw_hal.hal_events.clone(),
-        inner_hal.out_cmd_rx,
-        inner_hal.out_data_rx,
-        writer,
-    ));
-
-    raw_hal
-}
-
-/// Send NCI events received from the HAL to the NCI layer
-async fn dispatch_incoming<R>(
-    in_cmd_tx: UnboundedSender<NciPacket>,
-    in_data_tx: UnboundedSender<DataPacket>,
-    mut reader: R,
-) -> Result<()>
-where
-    R: AsyncReadExt + Unpin,
-{
-    loop {
-        let mut buffer = BytesMut::with_capacity(1024);
-        let len: usize = reader.read_u16().await?.into();
-        buffer.resize(len, 0);
-        reader.read_exact(&mut buffer).await?;
-        let frozen = buffer.freeze();
-        debug!("{:?}", &frozen);
-        if is_control_packet(&frozen[..]) {
-            match NciPacket::parse(&frozen) {
-                Ok(p) => {
-                    if in_cmd_tx.send(p).is_err() {
-                        break;
-                    }
-                }
-                Err(e) => error!("dropping invalid cmd event packet: {}: {:02x}", e, frozen),
-            }
-        } else {
-            match DataPacket::parse(&frozen) {
-                Ok(p) => {
-                    if in_data_tx.send(p).is_err() {
-                        break;
-                    }
-                }
-                Err(e) => error!("dropping invalid data event packet: {}: {:02x}", e, frozen),
-            }
-        }
-    }
-    debug!("Dispatch incoming finished.");
-    Ok(())
-}
-
-/// Send commands received from the NCI later to rootcanal
-async fn dispatch_outgoing<W>(
-    mut hal_events: HalEventRegistry,
-    mut out_cmd_rx: UnboundedReceiver<NciPacket>,
-    mut out_data_rx: UnboundedReceiver<DataPacket>,
-    mut writer: W,
-) -> Result<()>
-where
-    W: AsyncWriteExt + Unpin,
-{
-    loop {
-        select! {
-            Some(cmd) = out_cmd_rx.recv() => write_nci(&mut writer, cmd).await?,
-            Some(data) = out_data_rx.recv() => write_nci(&mut writer, data).await?,
-            else => break,
-        }
-    }
-
-    writer.shutdown().await?;
-    if let Some(evt) = hal_events.unregister(HalEvent::CloseComplete).await {
-        evt.send(HalEventStatus::Success).unwrap();
-    }
-    debug!("Dispatch outgoing finished.");
-    Ok(())
-}
-
-async fn write_nci<W, P>(writer: &mut W, cmd: P) -> Result<()>
-where
-    W: AsyncWriteExt + Unpin,
-    P: Packet,
-{
-    let b = cmd.to_bytes();
-    let mut data = BytesMut::with_capacity(b.len() + 2);
-    data.put_u16(b.len().try_into().unwrap());
-    data.extend(b);
-    writer.write_all(&data[..]).await?;
-    debug!("Sent {:?}", data);
-    Ok(())
-}
diff --git a/src/rust/nci/api.rs b/src/rust/nci/api.rs
deleted file mode 100644
index 15e16a5..0000000
--- a/src/rust/nci/api.rs
+++ /dev/null
@@ -1,246 +0,0 @@
-// 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.
-
-//! NCI API module
-
-use crate::{CommandSender, Result};
-use bytes::Bytes;
-use log::debug;
-use nfc_hal::{HalEvent, HalEventRegistry, HalEventStatus};
-use nfc_packets::nci::{self, CommandBuilder, Opcode};
-use nfc_packets::nci::{FeatureEnable, PacketBoundaryFlag, ResetType};
-use nfc_packets::nci::{InitCommandBuilder, ResetCommandBuilder};
-use nfc_packets::nci::{InitResponsePacket, ResponseChild};
-use tokio::sync::oneshot;
-
-/// NCI API object to manage static API data
-pub struct NciApi {
-    /// Command Sender external interface
-    commands: Option<CommandSender>,
-    /// The NFC response callback
-    callback: Option<fn(u16, &[u8])>,
-    /// HalEventRegistry is used to register for HAL events
-    hal_events: Option<HalEventRegistry>,
-    nfc_data: NfcData,
-}
-
-struct NfcData {
-    init_response: Option<InitResponsePacket>,
-}
-
-impl NciApi {
-    /// NciApi constructor
-    pub fn new() -> NciApi {
-        let nfc_data = NfcData { init_response: None };
-        NciApi { commands: None, callback: None, hal_events: None, nfc_data }
-    }
-
-    /** ****************************************************************************
-     **
-     ** Function         nfc_enable
-     **
-     ** Description      This function enables NFC. Prior to calling NFC_Enable:
-     **                  - the NFCC must be powered up, and ready to receive
-     **                    commands.
-     **
-     **                  This function opens the NCI transport (if applicable),
-     **                  resets the NFC controller, and initializes the NFC
-     **                  subsystems.
-     **
-     **                  When the NFC startup procedure is completed, an
-     **                  NFC_ENABLE_REVT is returned to the application using the
-     **                  tNFC_RESPONSE_CBACK.
-     **
-     ** Returns          tNFC_STATUS
-     **
-     *******************************************************************************/
-    /// extern tNFC_STATUS NFC_Enable(tNFC_RESPONSE_CBACK* p_cback);
-    pub async fn nfc_enable(&mut self, callback: fn(u16, &[u8])) {
-        let nci = crate::init().await;
-
-        self.commands = Some(nci.commands);
-        self.callback = Some(callback);
-        self.hal_events = Some(nci.hal_events);
-    }
-    /** ****************************************************************************
-     **
-     ** Function         NFC_Disable
-     **
-     ** Description      This function performs clean up routines for shutting down
-     **                  NFC and closes the NCI transport (if using dedicated NCI
-     **                  transport).
-     **
-     **                  When the NFC shutdown procedure is completed, an
-     **                  NFC_DISABLED_REVT is returned to the application using the
-     **                  tNFC_RESPONSE_CBACK.
-     **
-     ** Returns          nothing
-     **
-     *******************************************************************************/
-    /// extern void NFC_Disable(void);
-    pub async fn nfc_disable(&mut self) {
-        let (tx, rx) = oneshot::channel::<HalEventStatus>();
-        if let Some(mut hr) = self.hal_events.take() {
-            hr.register(HalEvent::CloseComplete, tx).await;
-
-            if let Some(cmd) = self.commands.take() {
-                drop(cmd);
-            }
-            let status = rx.await.unwrap();
-            debug!("Shutdown complete {:?}.", status);
-
-            if let Some(cb) = self.callback.take() {
-                cb(1, &[]);
-            }
-        }
-    }
-
-    /** ****************************************************************************
-     **
-     ** Function         NFC_Init
-     **
-     ** Description      This function initializes control blocks for NFC
-     **
-     ** Returns          nothing
-     **
-     *******************************************************************************/
-    /// extern void NFC_Init(tHAL_NFC_ENTRY* p_hal_entry_tbl);
-    pub async fn nfc_init(&mut self) -> Result<()> {
-        let pbf = PacketBoundaryFlag::CompleteOrFinal;
-        if let Some(cmd) = self.commands.as_mut() {
-            let reset = cmd
-                .send_and_notify(
-                    ResetCommandBuilder { gid: 0, pbf, reset_type: ResetType::ResetConfig }
-                        .build()
-                        .into(),
-                )
-                .await?;
-            let _notification_packet = reset.notification.await?;
-            let init = cmd
-                .send(
-                    InitCommandBuilder { gid: 0, pbf, feature_enable: FeatureEnable::Rfu }
-                        .build()
-                        .into(),
-                )
-                .await?;
-            if let ResponseChild::InitResponse(irp) = init.specialize() {
-                self.nfc_data.init_response = Some(irp);
-            }
-        }
-        Ok(())
-    }
-
-    /** *****************************************************************************
-     **
-     ** Function         NFC_GetLmrtSize
-     **
-     ** Description      Called by application wto query the Listen Mode Routing
-     **                  Table size supported by NFCC
-     **
-     ** Returns          Listen Mode Routing Table size
-     **
-     *******************************************************************************/
-    /// extern uint16_t NFC_GetLmrtSize(void);
-    pub async fn nfc_get_lmrt_size(&mut self) -> u16 {
-        if let Some(ir) = &self.nfc_data.init_response {
-            ir.get_max_rout_tbls_size()
-        } else {
-            0
-        }
-    }
-
-    /** *****************************************************************************
-     **
-     ** Function         NFC_SetConfig
-     **
-     ** Description      This function is called to send the configuration parameter
-     **                  TLV to NFCC. The response from NFCC is reported by
-     **                  tNFC_RESPONSE_CBACK as NFC_SET_CONFIG_REVT.
-     **
-     ** Parameters       tlv_size - the length of p_param_tlvs.
-     **                  p_param_tlvs - the parameter ID/Len/Value list
-     **
-     ** Returns          tNFC_STATUS
-     **
-     *******************************************************************************/
-    /// extern tNFC_STATUS NFC_SetConfig(uint8_t tlv_size, uint8_t* p_param_tlvs);
-    pub async fn nfc_set_config(&mut self, param_tlvs: &[u8]) -> Result<u8> {
-        let pbf = PacketBoundaryFlag::CompleteOrFinal;
-        if let Some(cmd) = self.commands.as_mut() {
-            let rp = cmd
-                .send(
-                    CommandBuilder {
-                        gid: 0,
-                        pbf,
-                        op: Opcode::CoreSetConfig,
-                        payload: Some(Bytes::copy_from_slice(param_tlvs)),
-                    }
-                    .build(),
-                )
-                .await?;
-            let raw = Bytes::from(rp);
-            if let Some(cb) = self.callback {
-                cb(2, &raw[3..]);
-            }
-            Ok(raw[3])
-        } else {
-            Ok(nci::Status::NotInitialized as u8)
-        }
-    }
-
-    /** *****************************************************************************
-     **
-     ** Function         NFC_GetConfig
-     **
-     ** Description      This function is called to retrieve the parameter TLV from
-     **                  NFCC. The response from NFCC is reported by
-     **                  tNFC_RESPONSE_CBACK as NFC_GET_CONFIG_REVT.
-     **
-     ** Parameters       num_ids - the number of parameter IDs
-     **                  p_param_ids - the parameter ID list.
-     **
-     ** Returns          tNFC_STATUS
-     **
-     *******************************************************************************/
-    /// extern tNFC_STATUS NFC_GetConfig(uint8_t num_ids, uint8_t* p_param_ids);
-    pub async fn nfc_get_config(&mut self, param_tlvs: &[u8]) -> Result<u8> {
-        let pbf = PacketBoundaryFlag::CompleteOrFinal;
-        if let Some(cmd) = self.commands.as_mut() {
-            let rp = cmd
-                .send(
-                    CommandBuilder {
-                        gid: 0,
-                        pbf,
-                        op: Opcode::CoreGetConfig,
-                        payload: Some(Bytes::copy_from_slice(param_tlvs)),
-                    }
-                    .build(),
-                )
-                .await?;
-            let raw = Bytes::from(rp);
-            if let Some(cb) = self.callback {
-                cb(3, &raw[3..]);
-            }
-            Ok(raw[3])
-        } else {
-            Ok(nci::Status::NotInitialized as u8)
-        }
-    }
-}
-
-impl Default for NciApi {
-    fn default() -> Self {
-        Self::new()
-    }
-}
diff --git a/src/rust/nci/nci.rs b/src/rust/nci/nci.rs
deleted file mode 100644
index d0743f1..0000000
--- a/src/rust/nci/nci.rs
+++ /dev/null
@@ -1,231 +0,0 @@
-// 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.
-
-//! NCI Protocol Abstraction Layer
-//! Supports sending NCI commands to the HAL and receiving
-//! NCI messages back
-
-use log::{debug, error};
-use nfc_hal::{Hal, HalEventRegistry};
-use nfc_packets::nci::NciChild::{Notification, Response};
-use nfc_packets::nci::{CommandPacket, DataPacket, NotificationPacket, Opcode, ResponsePacket};
-use std::collections::HashMap;
-use std::sync::Arc;
-use tokio::select;
-use tokio::sync::mpsc::{channel, Receiver, Sender};
-use tokio::sync::{oneshot, Mutex};
-use tokio::time::{sleep, Duration, Instant};
-
-pub mod api;
-
-/// Result type
-type Result<T> = std::result::Result<T, Box<dyn std::error::Error + Send + Sync>>;
-
-/// Initialize the module and connect the channels
-pub async fn init() -> Nci {
-    let hc = nfc_hal::init().await;
-    // Channel to handle data downstream messages
-    let (out_data_ext, out_data_int) = channel::<DataPacket>(10);
-    // Channel to handle data upstream messages
-    let (in_data_int, in_data_ext) = channel::<DataPacket>(10);
-    // Internal data channels
-    let ic = InternalChannels { out_data_int, in_data_int };
-
-    let (cmd_tx, cmd_rx) = channel::<QueuedCommand>(10);
-    let commands = CommandSender { cmd_tx };
-    let hal_events = hc.hal_events.clone();
-
-    let notifications = EventRegistry { handlers: Arc::new(Mutex::new(HashMap::new())) };
-
-    tokio::spawn(dispatch(notifications, hc, ic, cmd_rx));
-    Nci { hal_events, commands, out_data_ext, in_data_ext }
-}
-
-/// NCI module external interface
-pub struct Nci {
-    /// HAL events
-    pub hal_events: HalEventRegistry,
-    /// NCI command communication interface
-    pub commands: CommandSender,
-    /// NCI outbound channel for Data messages
-    pub out_data_ext: Sender<DataPacket>,
-    /// NCI inbound channel for Data messages
-    pub in_data_ext: Receiver<DataPacket>,
-}
-
-struct InternalChannels {
-    out_data_int: Receiver<DataPacket>,
-    in_data_int: Sender<DataPacket>,
-}
-
-#[derive(Debug)]
-struct PendingCommand {
-    cmd: CommandPacket,
-    response: oneshot::Sender<ResponsePacket>,
-}
-
-#[derive(Debug)]
-struct QueuedCommand {
-    pending: PendingCommand,
-    notification: Option<oneshot::Sender<NotificationPacket>>,
-}
-
-/// Sends raw commands. Only useful for facades & shims, or wrapped as a CommandSender.
-// #[derive(Clone)]
-pub struct CommandSender {
-    cmd_tx: Sender<QueuedCommand>,
-}
-
-/// The data returned by send_notify() method.
-pub struct ResponsePendingNotification {
-    /// Command response
-    pub response: ResponsePacket,
-    /// Pending notification receiver
-    pub notification: oneshot::Receiver<NotificationPacket>,
-}
-
-impl CommandSender {
-    /// Send a command, but do not expect notification to be returned
-    pub async fn send(&mut self, cmd: CommandPacket) -> Result<ResponsePacket> {
-        let (tx, rx) = oneshot::channel::<ResponsePacket>();
-        self.cmd_tx
-            .send(QueuedCommand {
-                pending: PendingCommand { cmd, response: tx },
-                notification: None,
-            })
-            .await?;
-        let event = rx.await?;
-        Ok(event)
-    }
-    /// Send a command which expects notification as a result
-    pub async fn send_and_notify(
-        &mut self,
-        cmd: CommandPacket,
-    ) -> Result<ResponsePendingNotification> {
-        let (tx, rx) = oneshot::channel::<ResponsePacket>();
-        let (ntx, nrx) = oneshot::channel::<NotificationPacket>();
-        self.cmd_tx
-            .send(QueuedCommand {
-                pending: PendingCommand { cmd, response: tx },
-                notification: Some(ntx),
-            })
-            .await?;
-        let event = rx.await?;
-        Ok(ResponsePendingNotification { response: event, notification: nrx })
-    }
-}
-
-impl Drop for CommandSender {
-    fn drop(&mut self) {
-        debug!("CommandSender is dropped");
-    }
-}
-
-/// Provides ability to register and unregister for NCI notifications
-#[derive(Clone)]
-pub struct EventRegistry {
-    handlers: Arc<Mutex<HashMap<Opcode, oneshot::Sender<NotificationPacket>>>>,
-}
-
-impl EventRegistry {
-    /// Indicate interest in specific NCI notification
-    pub async fn register(&mut self, code: Opcode, sender: oneshot::Sender<NotificationPacket>) {
-        assert!(
-            self.handlers.lock().await.insert(code, sender).is_none(),
-            "A handler for {:?} is already registered",
-            code
-        );
-    }
-
-    /// Remove interest in specific NCI notification
-    pub async fn unregister(
-        &mut self,
-        code: Opcode,
-    ) -> Option<oneshot::Sender<NotificationPacket>> {
-        self.handlers.lock().await.remove(&code)
-    }
-}
-
-async fn dispatch(
-    mut ntfs: EventRegistry,
-    mut hc: Hal,
-    mut ic: InternalChannels,
-    mut cmd_rx: Receiver<QueuedCommand>,
-) -> Result<()> {
-    let mut pending: Option<PendingCommand> = None;
-    let timeout = sleep(Duration::MAX);
-    // The max_deadline is used to set  the sleep() deadline to a very distant moment in
-    // the future, when the notification from the timer is not required.
-    let max_deadline = timeout.deadline();
-    tokio::pin!(timeout);
-    loop {
-        select! {
-            Some(cmd) = hc.in_cmd_rx.recv() => {
-                match cmd.specialize() {
-                    Response(rsp) => {
-                        timeout.as_mut().reset(max_deadline);
-                        let this_opcode = rsp.get_cmd_op();
-                        match pending.take() {
-                            Some(PendingCommand{cmd, response}) if cmd.get_op() == this_opcode => {
-                                if let Err(e) = response.send(rsp) {
-                                    error!("failure dispatching command status {:?}", e);
-                                }
-                            },
-                            Some(PendingCommand{cmd, ..}) => panic!("Waiting for {}, got {}", cmd.get_op(), this_opcode),
-                            None => panic!("Unexpected status event with opcode {}", this_opcode),
-                        }
-                    }
-                    Notification(ntfy) => {
-                        let code = ntfy.get_cmd_op();
-                        match ntfs.unregister(code).await {
-                            Some(sender) => {
-                                if let Err(e) = sender.send(ntfy) {
-                                    error!("notification channel closed {:?}", e);
-                                }
-                            },
-                            None => panic!("Unhandled notification {:?}", code),
-                        }
-                    }
-                    _ => error!("Unexpected NCI data received {:?}", cmd),
-                }
-            },
-            qc = cmd_rx.recv(), if pending.is_none() => if let Some(queued) = qc {
-                debug!("cmd_rx got a q");
-                if let Some(nsender) = queued.notification {
-                    ntfs.register(queued.pending.cmd.get_op(), nsender).await;
-                }
-                if let Err(e) = hc.out_cmd_tx.send(queued.pending.cmd.clone().into()) {
-                    error!("command queue closed: {:?}", e);
-                }
-                timeout.as_mut().reset(Instant::now() + Duration::from_millis(20));
-                pending = Some(queued.pending);
-            } else {
-                break;
-            },
-            () = &mut timeout => {
-                error!("Command processing timeout");
-                timeout.as_mut().reset(max_deadline);
-                pending = None;
-            },
-            Some(data) = hc.in_data_rx.recv() => ic.in_data_int.send(data).await.unwrap(),
-            Some(data) = ic.out_data_int.recv() => hc.out_data_tx.send(data).unwrap(),
-            else => {
-                debug!("Select is done");
-                break;
-            },
-        }
-    }
-    debug!("NCI dispatch is terminated.");
-    Ok(())
-}
diff --git a/src/rust/packets/lib.rs b/src/rust/packets/lib.rs
deleted file mode 100644
index c459c75..0000000
--- a/src/rust/packets/lib.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-//! reimport of generated packets (to go away once rust_genrule exists)
-
-#![allow(clippy::all)]
-#![allow(unused)]
-#![allow(missing_docs)]
-
-pub mod nci {
-    include!(concat!(env!("OUT_DIR"), "/nci_packets.rs"));
-}
diff --git a/src/rust/rootcanal/Android.bp b/src/rust/rootcanal/Android.bp
deleted file mode 100644
index 8673273..0000000
--- a/src/rust/rootcanal/Android.bp
+++ /dev/null
@@ -1,23 +0,0 @@
-package {
-    // See: http://go/android-license-faq
-    // A large-scale-change added 'default_applicable_licenses' to import
-    // all of the 'license_kinds' from "system_nfc_license"
-    // to get the below license kinds:
-    //   SPDX-license-identifier-Apache-2.0
-    default_applicable_licenses: ["system_nfc_license"],
-}
-
-rust_binary {
-    name: "nfc_rootcanal",
-    defaults: ["nfc_rust_defaults"],
-    srcs: ["main.rs"],
-    rustlibs: [
-        "libnfc_packets",
-        "libbytes",
-        "libthiserror",
-        "liblogger",
-        "liblog_rust",
-        "libtokio",
-    ],
-    proc_macros: ["libnum_derive"],
-}
diff --git a/src/rust/rootcanal/main.rs b/src/rust/rootcanal/main.rs
deleted file mode 100644
index a8c6a84..0000000
--- a/src/rust/rootcanal/main.rs
+++ /dev/null
@@ -1,267 +0,0 @@
-// 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.
-
-//! This connects to "rootcanal" and provides a simulated
-//! Nfc chip as well as a simulated environment.
-
-use bytes::{BufMut, BytesMut};
-use log::{debug, Level};
-use logger::{self, Config};
-use nfc_packets::nci;
-use nfc_packets::nci::{CommandChild, NciChild};
-use nfc_packets::nci::{
-    ConfigParams, ConfigStatus, GetConfigResponseBuilder, NciVersion, ParamIds,
-    ResetNotificationBuilder, ResetResponseBuilder, ResetTrigger, ResetType,
-    SetConfigResponseBuilder,
-};
-use nfc_packets::nci::{InitResponseBuilder, NfccFeatures, RfInterface};
-use nfc_packets::nci::{NciMsgType, NciPacket, Packet, PacketBoundaryFlag};
-use std::collections::HashMap;
-use std::convert::TryInto;
-use std::mem::size_of_val;
-use std::sync::Arc;
-use thiserror::Error;
-use tokio::io;
-use tokio::io::{AsyncReadExt, AsyncWriteExt, BufReader, ErrorKind};
-use tokio::net::TcpListener;
-use tokio::sync::RwLock;
-
-/// Result type
-type Result<T> = std::result::Result<T, RootcanalError>;
-
-#[derive(Debug, Error)]
-enum RootcanalError {
-    #[error("Termination request")]
-    TerminateTask,
-    #[error("Socket error")]
-    IoError(#[from] io::Error),
-    #[error("Unsupported command packet")]
-    UnsupportedCommand,
-    #[error("Packet did not parse correctly")]
-    InvalidPacket,
-    #[error("Packet type not supported")]
-    UnsupportedPacket,
-}
-
-/// Provides storage for internal configuration parameters
-#[derive(Clone)]
-pub struct InternalConfiguration {
-    map: Arc<RwLock<HashMap<ParamIds, Vec<u8>>>>,
-}
-
-impl InternalConfiguration {
-    /// InternalConfiguration constructor
-    pub async fn new() -> Self {
-        let ic = InternalConfiguration { map: Arc::new(RwLock::new(HashMap::new())) };
-        let mut map = ic.map.write().await;
-        map.insert(ParamIds::LfT3tMax, vec![0x10u8]);
-        drop(map);
-        ic
-    }
-
-    /// Set a configuration parameter
-    pub async fn set(&mut self, parameter: ParamIds, value: Vec<u8>) {
-        self.map.write().await.insert(parameter, value);
-    }
-
-    /// Gets a parameter value or None
-    pub async fn get(&mut self, parameter: ParamIds) -> Option<Vec<u8>> {
-        self.map.read().await.get(&parameter).map(|v| (*v).clone())
-    }
-
-    /// Clears the allocated storage
-    pub async fn clear(&mut self) {
-        self.map.write().await.clear();
-    }
-}
-
-const TERMINATION: u8 = 4u8;
-
-#[tokio::main]
-async fn main() -> io::Result<()> {
-    logger::init(Config::default().with_tag_on_device("nfc-rc").with_min_level(Level::Trace));
-
-    let listener = TcpListener::bind("127.0.0.1:54323").await?;
-
-    for _ in 0..2 {
-        let (mut sock, _) = listener.accept().await?;
-
-        tokio::spawn(async move {
-            let (rd, mut wr) = sock.split();
-            let mut rd = BufReader::new(rd);
-            let config = InternalConfiguration::new().await;
-            loop {
-                if let Err(e) = process(config.clone(), &mut rd, &mut wr).await {
-                    match e {
-                        RootcanalError::TerminateTask => break,
-                        RootcanalError::IoError(e) => {
-                            if e.kind() == ErrorKind::UnexpectedEof {
-                                break;
-                            }
-                        }
-                        _ => panic!("Communication error: {:?}", e),
-                    }
-                }
-            }
-        })
-        .await?;
-    }
-    Ok(())
-}
-
-async fn process<R, W>(config: InternalConfiguration, reader: &mut R, writer: &mut W) -> Result<()>
-where
-    R: AsyncReadExt + Unpin,
-    W: AsyncWriteExt + Unpin,
-{
-    let mut buffer = BytesMut::with_capacity(1024);
-    let len: usize = reader.read_u16().await?.into();
-    buffer.resize(len, 0);
-    reader.read_exact(&mut buffer).await?;
-    let frozen = buffer.freeze();
-    debug!("{:?}", &frozen);
-    let pkt_type = (frozen[0] >> 5) & 0x7;
-    debug!("packet {} received len={}", &pkt_type, &len);
-    if pkt_type == NciMsgType::Command as u8 {
-        match NciPacket::parse(&frozen) {
-            Ok(p) => command_response(config, writer, p).await,
-            Err(_) => Err(RootcanalError::InvalidPacket),
-        }
-    } else if pkt_type == TERMINATION {
-        Err(RootcanalError::TerminateTask)
-    } else {
-        Err(RootcanalError::UnsupportedPacket)
-    }
-}
-
-const MAX_PAYLOAD: u8 = 255;
-
-async fn command_response<W>(
-    mut config: InternalConfiguration,
-    out: &mut W,
-    cmd: NciPacket,
-) -> Result<()>
-where
-    W: AsyncWriteExt + Unpin,
-{
-    let pbf = PacketBoundaryFlag::CompleteOrFinal;
-    let gid = 0u8;
-    let mut status = nci::Status::Ok;
-    match cmd.specialize() {
-        NciChild::Command(cmd) => match cmd.specialize() {
-            CommandChild::ResetCommand(rst) => {
-                write_nci(out, (ResetResponseBuilder { gid, pbf, status }).build()).await?;
-                write_nci(
-                    out,
-                    (ResetNotificationBuilder {
-                        gid,
-                        pbf,
-                        trigger: ResetTrigger::ResetCommand,
-                        config_status: if rst.get_reset_type() == ResetType::KeepConfig {
-                            ConfigStatus::ConfigKept
-                        } else {
-                            ConfigStatus::ConfigReset
-                        },
-                        nci_version: NciVersion::Version20,
-                        manufacturer_id: 0,
-                        mfsi: Vec::new(),
-                    })
-                    .build(),
-                )
-                .await
-            }
-            CommandChild::InitCommand(_) => {
-                let nfcc_feat = [0u8; 5];
-                let rf_int = [0u8; 2];
-                write_nci(
-                    out,
-                    (InitResponseBuilder {
-                        gid,
-                        pbf,
-                        status,
-                        nfcc_features: NfccFeatures::parse(&nfcc_feat).unwrap(),
-                        max_log_conns: 0,
-                        max_rout_tbls_size: 0x0000,
-                        max_ctrl_payload: MAX_PAYLOAD,
-                        max_data_payload: MAX_PAYLOAD,
-                        num_of_credits: 0,
-                        max_nfcv_rf_frame_sz: 64,
-                        rf_interface: vec![RfInterface::parse(&rf_int).unwrap(); 1],
-                    })
-                    .build(),
-                )
-                .await
-            }
-            CommandChild::SetConfigCommand(sc) => {
-                for cp in sc.get_params() {
-                    if cp.valm.len() > 251 {
-                        status = nci::Status::InvalidParam;
-                        break;
-                    }
-                    config.set(cp.paramid, cp.valm.clone()).await;
-                }
-                write_nci(
-                    out,
-                    (SetConfigResponseBuilder { gid, pbf, status, paramids: Vec::new() }).build(),
-                )
-                .await
-            }
-            CommandChild::GetConfigCommand(gc) => {
-                let mut cpv: Vec<ConfigParams> = Vec::new();
-                for paramid in gc.get_paramids() {
-                    let mut cp = ConfigParams { paramid: paramid.pids, valm: Vec::new() };
-                    if status == nci::Status::Ok {
-                        if let Some(val) = config.get(paramid.pids).await {
-                            cp.valm = val;
-                        } else {
-                            status = nci::Status::InvalidParam;
-                            cpv.clear();
-                        }
-                    } else if config.get(paramid.pids).await.is_some() {
-                        continue;
-                    }
-                    cpv.push(cp);
-                    // The Status field takes a byte
-                    if size_of_val(&*cpv) > (MAX_PAYLOAD - 1).into() {
-                        cpv.pop();
-                        if status == nci::Status::Ok {
-                            status = nci::Status::MessageSizeExceeded;
-                        }
-                        break;
-                    }
-                }
-                write_nci(out, (GetConfigResponseBuilder { gid, pbf, status, params: cpv }).build())
-                    .await
-            }
-            _ => Err(RootcanalError::UnsupportedCommand),
-        },
-        _ => Err(RootcanalError::InvalidPacket),
-    }
-}
-
-async fn write_nci<W, T>(writer: &mut W, rsp: T) -> Result<()>
-where
-    W: AsyncWriteExt + Unpin,
-    T: Into<NciPacket>,
-{
-    let pkt = rsp.into();
-    let b = pkt.to_bytes();
-    let mut data = BytesMut::with_capacity(b.len() + 2);
-    data.put_u16(b.len().try_into().unwrap());
-    data.extend(b);
-    let frozen = data.freeze();
-    writer.write_all(frozen.as_ref()).await?;
-    debug!("command written");
-    Ok(())
-}
diff --git a/src/rust/test/Android.bp b/src/rust/test/Android.bp
deleted file mode 100644
index 138d551..0000000
--- a/src/rust/test/Android.bp
+++ /dev/null
@@ -1,24 +0,0 @@
-package {
-    // See: http://go/android-license-faq
-    // A large-scale-change added 'default_applicable_licenses' to import
-    // all of the 'license_kinds' from "system_nfc_license"
-    // to get the below license kinds:
-    //   SPDX-license-identifier-Apache-2.0
-    default_applicable_licenses: ["system_nfc_license"],
-}
-
-rust_binary {
-    name: "nfc_rootcanal_test",
-    defaults: ["nfc_rust_defaults"],
-    srcs: ["main.rs"],
-    rustlibs: [
-        "libnfc_packets",
-        "libnfc_rnci",
-        "libbytes",
-        "libthiserror",
-	"liblogger",
-        "liblog_rust",
-        "libtokio",
-    ],
-    proc_macros: ["libnum_derive"],
-}
diff --git a/src/rust/test/main.rs b/src/rust/test/main.rs
deleted file mode 100644
index c27971c..0000000
--- a/src/rust/test/main.rs
+++ /dev/null
@@ -1,53 +0,0 @@
-// 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.
-
-//! Rootcanal HAL
-//! This connects to "rootcanal" which provides a simulated
-//! Nfc chip as well as a simulated environment.
-
-use log::{debug, Level};
-use logger::{self, Config};
-use nfc_rnci::api::NciApi;
-
-/// Result type
-type Result<T> = std::result::Result<T, Box<dyn std::error::Error + Send + Sync>>;
-
-/// The NFC response callback
-pub fn nfc_callback(kind: u16, val: &[u8]) {
-    debug!("Callback#{} -> {:?}", kind, val);
-}
-
-#[tokio::main]
-async fn main() -> Result<()> {
-    let set_tlvs: [u8; 10] = [3, 0xa1, 1, 0x1e, 0xa2, 1, 0x19, 0x80, 1, 0x01];
-    let get_tlvs: [u8; 3] = [2, 0x52, 0x80];
-    logger::init(Config::default().with_tag_on_device("lnfc").with_min_level(Level::Trace));
-
-    let mut nci = NciApi::new();
-    nci.nfc_enable(nfc_callback).await;
-    nci.nfc_init().await?;
-    let lmrts = nci.nfc_get_lmrt_size().await;
-    debug!("LMRT size:{}", lmrts);
-    let status = nci.nfc_set_config(&set_tlvs).await?;
-    debug!("SET_CONFIG status:{}", status);
-    let status = nci.nfc_get_config(&get_tlvs).await?;
-    debug!("GET_CONFIG status:{}", status);
-    nci.nfc_disable().await;
-    nci.nfc_enable(nfc_callback).await;
-    nci.nfc_init().await?;
-    let status = nci.nfc_get_config(&get_tlvs).await?;
-    debug!("GET_CONFIG status:{}", status);
-    nci.nfc_disable().await;
-    Ok(())
-}
diff --git a/utils/Android.bp b/utils/Android.bp
index 77f0434..d8a5e9d 100644
--- a/utils/Android.bp
+++ b/utils/Android.bp
@@ -17,7 +17,7 @@
         "-Werror",
     ],
     target: {
-        host_linux: {
+        linux_glibc: {
             cflags: ["-D_GNU_SOURCE"],
         },
         darwin: {
diff --git a/utils/config.cc b/utils/config.cc
index 40be00f..6354a2e 100644
--- a/utils/config.cc
+++ b/utils/config.cc
@@ -59,13 +59,6 @@
   value_unsigned_ = value;
 }
 
-ConfigValue::ConfigValue(std::vector<int8_t> value) {
-  CHECK(!(value.empty()));
-  type_ = BYTES;
-  value_bytes_ = std::vector<uint8_t>(value.begin(), value.end());
-  value_unsigned_ = 0;
-}
-
 ConfigValue::ConfigValue(std::vector<uint8_t> value) {
   CHECK(!(value.empty()));
   type_ = BYTES;
diff --git a/utils/include/config.h b/utils/include/config.h
index e48717b..f4bcdec 100644
--- a/utils/include/config.h
+++ b/utils/include/config.h
@@ -27,7 +27,6 @@
   explicit ConfigValue(std::string);
   explicit ConfigValue(unsigned);
   explicit ConfigValue(std::vector<uint8_t>);
-  explicit ConfigValue(std::vector<int8_t>);
   Type getType() const;
   std::string getString() const;
   unsigned getUnsigned() const;
diff --git a/utils/include/ringbuffer.h b/utils/include/ringbuffer.h
index 35cc023..d2c310a 100644
--- a/utils/include/ringbuffer.h
+++ b/utils/include/ringbuffer.h
@@ -19,7 +19,6 @@
 #pragma once
 
 #include <stdint.h>
-#include <sys/types.h>
 
 typedef struct ringbuffer_t ringbuffer_t;